How to use asterisk in a shell program

user534581 asked:

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.

My 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"

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.