[asterisk-users] How to pass variable back and forth from dialplan to php file?
bruce bruce
bruceb444 at gmail.com
Mon Jun 14 20:05:36 CDT 2010
I do have a rather bigger project coming my way and I would really like to
know how to do the *"feeding a text file into the STDIN of your AGI so you
can debug completely external to Asterisk"*
*
*
*However, for this project, it seems that I can use php system() along with
grep to see the status of a peer with one line of code:*
*
*
*
asterisk -rx "sip show peer $sip_peer" | grep -c "X-Lite"'
Above ^^^ in Linux prompt returns 1 if $sip_peer is registered with X-Lite
else it returns 0.
But using system() I think the "" confuse php and value is always returned
as 0.
$peer_count = system('asterisk -rx "sip show peer $sip_peer" | grep -c
"X-Lite"', $retval);
Should $sip_peer be inside another set of parenthesis?
Thanks,
Bruce
*
On Mon, Jun 14, 2010 at 6:44 PM, Steve Edwards <asterisk.org at sedwards.com>wrote:
> On Mon, 14 Jun 2010, bruce bruce wrote:
>
> Thanks for the input. I actually did use verbose() and that is when I
>> noticed that my path to phpagi was not right since nothing was coming
>> through. For return value prior to fixing phpagi path, I was getting:
>>
>> NoOp("SIP/64.111.222.111-00000ca7", "")
>>
>> which actually is just right because if you notice the last three
>> charecters of that line is ""). So, when the phpagi path is correct, it
>> looks like: "415444555").
>>
>
> Which is why enabling AGI debugging and posting actual console code can
> speed problem resolution. Sometimes it's just another set of eyes on the
> same output :)
>
> If you're going to be developing a significant bit of AGI code, there is a
> "not immediately obvious" technique of feeding a text file into the STDIN of
> your AGI so you can debug completely external to Asterisk -- even within an
> IDE like emacs+gdb. (Or whatever the PHP equivalence is.)
>
> --
> Thanks in advance,
> -------------------------------------------------------------------------
> Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST
> Newline Fax: +1-760-731-3000
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
> http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100614/7120c479/attachment.htm
More information about the asterisk-users
mailing list