[asterisk-users] calling machine over sip

Steve Edwards asterisk.org at sedwards.com
Thu Jun 17 13:14:27 CDT 2010


On Thu, 17 Jun 2010, nikhil singhania wrote:

> I have used the exec_dial function found in phpagi.php . It is built 
> above basic dial function. Here 'agi' is an instance of class AGI, which 
> has a method exec_dial.

Something on voip-info.org (sorry, no URL handy) says dialing from an AGI 
is not recommended because you lose control of the call within your AGI -- 
execution continues at the statement in your dialplan after "agi()." I 
can't "vouch" for the accuracy or applicability to your version of 
Asterisk. I would code up my AGI to set a channel variable and then dial() 
in the dialplan.

> When i execute the php file, over command line on my unix machine, I am 
> expecting a call on the softphone which I have registered on the 
> asterisk server.

When you execute an AGI from a shell command line, it is not talking to 
Asterisk. The AGI protocol is based on STDIN and STDOUT. When executed 
within Asterisk, STDIN and STDOUT are "piped" to Asterisk. When executed 
from a shell command line, STDIN and STDOUT is your TTY. All your AGI is 
doing is printing "pretty strings" on your screen and waiting for you to 
press return. (Personally, I would consider it a flaw in your AGI library 
that it doesn't complain about the invalid "response.")

If you execute your AGI using the agi() application in your dialplan and 
you have enabled agi debugging, you will see the "conversation" of 
requests and responses between Asterisk and your AGI. Usually you will 
also see what you are doing wrong -- an unexpected "echo" or "print" that 
violates the AGI protocol, a syntax error, etc.

-- 
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000



More information about the asterisk-users mailing list