How to use asterisk in a shell program

I want to use Asterisk in a shell Linux program more or less like this :

asterisk -r && console dial 101

How can I do that ?
Thank you.

Answer

You can run an asterisk command by adding the -x option.

From the man page:

       -x command
              Connect to a running Asterisk process and execute a command on a
              command line, passing any output through  to  standard  out  and
              then  terminating  when the command execution completes. Implies
              -r when -R is not explicitly supplied.

So you can do something like:

asterisk -rx "pjsip show endpoints"

Attribution
Source : Link , Question Author : user534581 , Answer Author : Michael Hampton

Leave a Comment