[asterisk-users] How to pass variable back and forth from dialplan to php file?

2010-06-14 Thread bruce bruce
Hi Everyone, I have a php file that if an argument is passed to it, it will echo a number back. I am looking to use system() in dial-plan to send ${EXTEN} to it and then to get that processed value back from the php file and put it in $var back into asterisk dial-plan. While trying this method

Re: [asterisk-users] How to pass variable back and forth from dialplan to php file?

2010-06-14 Thread Carlos Chavez
On Mon, 2010-06-14 at 12:00 -0400, bruce bruce wrote: Hi Everyone, I have a php file that if an argument is passed to it, it will echo a number back. I am looking to use system() in dial-plan to send ${EXTEN} to it and then to get that processed value back from the php file and put it in

Re: [asterisk-users] How to pass variable back and forth from dialplan to php file?

2010-06-14 Thread William Stillwell (Lists)
I would think AGI would be better. ? I don't think system() returns anything, except maybe a success/fail ? From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of bruce bruce Sent: Monday, June 14, 2010 12:00 PM To: Asterisk

Re: [asterisk-users] How to pass variable back and forth from dialplan to php file?

2010-06-14 Thread bruce bruce
Hi Carlso, Thanks for the input. I have done this in php and am not familiar with phpagi. So, there is absolutely no way to temporarily solve this problem by getting the value back from php file? Wondering if it would require a lot of work to change the php file to phpagi? Thanks, Bruce On Mon,

Re: [asterisk-users] How to pass variable back and forth from dialplan to php file?

2010-06-14 Thread Carlos Chavez
On Mon, 2010-06-14 at 13:41 -0400, bruce bruce wrote: Hi Carlso, Thanks for the input. I have done this in php and am not familiar with phpagi. So, there is absolutely no way to temporarily solve this problem by getting the value back from php file? Wondering if it would require a

Re: [asterisk-users] How to pass variable back and forth from dialplan to php file?

2010-06-14 Thread bruce bruce
Carlos, Thanks a lot for getting me started. That helps a great deal. Currently, the *$agi-request['agi_extension']; returns the SIP channel info with IP and I want that to be the incoming DID number. * * * *My dialplan output is this for line one:* **exten = _x.,1,NoOp(${EXTEN}) *415444555*

Re: [asterisk-users] How to pass variable back and forth from dialplan to php file?

2010-06-14 Thread Steve Edwards
On Mon, 14 Jun 2010, Carlos Chavez wrote: You can even send parameters to the AGI via the command line like: exten = _x.,1,AGI(sample.agi,param1,param2) //Use comma for 1.6 or | for 1.4 or below Comma works fine in 1.2. -- Thanks in advance,

Re: [asterisk-users] How to pass variable back and forth from dialplan to php file?

2010-06-14 Thread bruce bruce
Hi again, So, I have this but NoOp shows a random SIP info value rather then the one passed to it. Just to test, I am sending $didin as argument to test.php and then expect it back as $didgot back into dialplan. But it seems that either send or receive has problem because no matter what I put as

Re: [asterisk-users] How to pass variable back and forth from dialplan to php file?

2010-06-14 Thread Carlos Chavez
If you do an agi set debug on from the CLI and run your AGI you should see something like this: [Jun 10 12:53:00] VERBOSE[8515] res_agi.c: SIP/206-0d9bAGI Tx agi_request: auth.agi [Jun 10 12:53:00] VERBOSE[8515] res_agi.c: SIP/206-0d9bAGI Tx agi_channel: SIP/206-0d9b [Jun 10

Re: [asterisk-users] How to pass variable back and forth from dialplan to php file?

2010-06-14 Thread bruce bruce
Thanks for pointing to the debug. I found that the path to phpagi was not right and since I fixed that everything seems to work fine. Now, I want to know if I can use a phpagi command to check the status of SIP Peer if it is online and registered or not. I know I can use *grep with asterisk rx

Re: [asterisk-users] How to pass variable back and forth from dialplan to php file?

2010-06-14 Thread Steve Edwards
On Mon, 2010-06-14 at 14:57 -0400, bruce bruce wrote: Carlos, Thanks a lot for getting me started. That helps a great deal. exten = _x.,1,NoOp(${EXTEN}) Since you're just getting started, there is an application specifically written to send output to the CLI -- verbose(). It's more obvious

Re: [asterisk-users] How to pass variable back and forth from dialplan to php file?

2010-06-14 Thread Carlos Chavez
Go to http://phpagi.sourceforge.net/ and check the documentation. Basically you can run any command you can run on the CLI or extensions.conf. To get the status of a SIP peer I would recommend using AMI. PHPAGI also has a library to connect to the AMI and send commands. On Mon,

Re: [asterisk-users] How to pass variable back and forth from dialplan to php file?

2010-06-14 Thread bruce bruce
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-0ca7, )* which actually is just right because if you

Re: [asterisk-users] How to pass variable back and forth from dialplan to php file?

2010-06-14 Thread Steve Edwards
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-0ca7, ) which

Re: [asterisk-users] How to pass variable back and forth from dialplan to php file?

2010-06-14 Thread bruce bruce
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

Re: [asterisk-users] How to pass variable back and forth from dialplan to php file?

2010-06-14 Thread Steve Edwards
On Mon, 14 Jun 2010, bruce bruce wrote: 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