Hi, I'm running asterisk 1.4.22 on a debian server. I have php5 installed and it works correctly command line. When trying to run a php script via AGI, I get messages such as: GI Tx >> I> AGI Rx << #!/usr/bin/php5 -q AGI Tx >> 510 Invalid or unknown command The scripts are completely executable and owned by asterisk -rwxr-xr-x 1 asterisk asterisk Googling is not helping much, and php seems installed perfectly. Other servers running the same AGIs have no such problem. I also have noticed odd behavior. When I edit an AGI, the changes aren't always showing up in the running of the script via asterisk. For example, I tried editing the bash command to read #!/usr/bin/php -q, and got the same response on my agi debug. I know for a fact it's running the script I've edited: Launched AGI Script /var/lib/asterisk/agi-bin/myscript.php and it's not in some other directory. Any input: obvious or not is requested...a few people here are stumped! Thank you! Leah Newmark VoIP Programmer Capalon Communications
David Backeberg
2009-Jun-24 20:09 UTC
[asterisk-users] PHP AGI Not Working and Odd Behavior
On Wed, Jun 24, 2009 at 3:43 PM, Leah Newmark<lnewmark at capalon.com> wrote:> Hi, > > I'm running asterisk 1.4.22 on a debian server. > I have php5 installed and it works correctly command line. > When trying to run a php script via AGI, I get messages such as: > GI Tx >> I> > AGI Rx << #!/usr/bin/php5 -q > AGI Tx >> 510 Invalid or unknown command > > The scripts are completely executable and owned by asterisk > -rwxr-xr-x 1 asterisk asterisk > > Googling is not helping much, and php seems installed perfectly. Other > servers running the same AGIs have no such problem. > > I also have noticed odd behavior. When I edit an AGI, the changes aren't > always showing up in the running of the script via asterisk. > For example, I tried editing the bash command to read #!/usr/bin/php -q, > and got the same response on my agi debug. > I know for a fact it's running the script I've edited: > ?Launched AGI Script /var/lib/asterisk/agi-bin/myscript.php > and it's not in some other directory.Keep in mind that if you change your dialplan to call a different script you will need to cli> dialplan reload Other than that, I'm not sure that it's legal to put an argument into a shbang, as in your -q when launching php. It's also possible you've somehow locked down php or directories way too much. The proper test is to: bash$ sudo -u asterisk /path/to/script.php
Thanks. I didn't change anything in my dialplan. I am aware of reloading configuration :) My AGIs are copied from a working asterisk install -- the shebang argument is how I've always done it. Either way, I have tried it without the -q as well, and that also didn't succeed. I just tried your test and it worked fine to run it. As I said, I know the server is reading the file I've been editing. I see it on the monitor. It's definitely opening the file to return that message... Any other ideas? ____________________________________________________________________________ On Wed, Jun 24, 2009 at 3:43 PM, Leah Newmark<lnewmark at capalon.com <http://lists.digium.com/mailman/listinfo/asterisk-users>> wrote:>/ Hi,/>/ />/ I'm running asterisk 1.4.22 on a debian server. />/ I have php5 installed and it works correctly command line. />/ When trying to run a php script via AGI, I get messages such as: />/ GI Tx >> I> />/ AGI Rx << #!/usr/bin/php5 -q />/ AGI Tx >> 510 Invalid or unknown command />/ />/ The scripts are completely executable and owned by asterisk />/ -rwxr-xr-x 1 asterisk asterisk />/ />/ Googling is not helping much, and php seems installed perfectly. Other />/ servers running the same AGIs have no such problem. />/ />/ I also have noticed odd behavior. When I edit an AGI, the changes aren't />/ always showing up in the running of the script via asterisk. />/ For example, I tried editing the bash command to read #!/usr/bin/php -q, />/ and got the same response on my agi debug. />/ I know for a fact it's running the script I've edited: />/ Launched AGI Script /var/lib/asterisk/agi-bin/myscript.php />/ and it's not in some other directory. / Keep in mind that if you change your dialplan to call a different script you will need to cli> dialplan reload Other than that, I'm not sure that it's legal to put an argument into a shbang, as in your -q when launching php. It's also possible you've somehow locked down php or directories way too much. The proper test is to: bash$ sudo -u asterisk /path/to/script.php
asterisk-users at enlai.net
2009-Jun-24 21:28 UTC
[asterisk-users] Determining picked up line from multiple line ring
I think I got it. ${DIALEDPEERNUMBER} contains the leg that connected (just what I need). FYI I used DumpChan() to get all the available variables and found it. Thanks! Enlai On Wed, 24 Jun 2009 14:19:46 -0700, asterisk-users at lists.digium.com said:> Thanks Danny. > > I tried accessing ${CHANNEL} and ${DNID} or ${CALLERID{dnid)} in the h > (hangup) context, which is invoked after either party hangs up. > > However, the ${CHANNEL} contains the original channel the call came in > on and not the outbound channel that connected. The ${CALLERID(dnid)} > contains the caller's phone number and not the one that connected on the > outbound leg. > > Any other ideas? Should I put the ${CHANNEL} and ${CALLERID(dnid)} > somewhere else? > > Thanks, > Enlai > > > On Wed, 24 Jun 2009 15:51:18 -0500, "Danny Nicholas" <danny at debsinc.com> > said: > > ${CHANNEL} or ${DNID} should do the trick. > > > > -----Original Message----- > > From: asterisk-users-bounces at lists.digium.com > > [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of > > asterisk-users at enlai.net > > Sent: Wednesday, June 24, 2009 3:41 PM > > To: Asterisk Users Mailing List - Non-Commercial Discussion > > Subject: [asterisk-users] Determining picked up line from multiple line > > ring > > > > Hi all, > > > > I've looked at the various variables but can't seem to find a way to > > determine which line was picked up in a multi-line ring. > > > > For example, in this excerpt from my asterisk logging: > > > > -- Executing [5558280000 at inbound:52] Dial("SIP/proxy3-05ac9180", > > "SIP/15551111111 at proxy1&SIP/15552222222 at proxy1|18|r") in new stack > > -- Called 15551111111 at proxy1 > > -- Called 15552222222 at proxy1 > > -- SIP/proxy1-05af5ca0 is making progress passing it to > > SIP/proxy3-05ac9180 > > -- SIP/proxy1-05acaae0 is making progress passing it to > > SIP/proxy3-05ac9180 > > -- SIP/proxy1-05acaae0 answered SIP/proxy3-05ac9180 > > -- Packet2Packet bridging SIP/proxy3-05ac9180 and > > SIP/proxy1-05acaae0 > > > > When someone dials in to 5558280000, I call two phone numbers, > > 15551111111 and 15552222222 simultaneously. > > > > The logging shows when one of those numbers is picked up, but I don't > > know which one. I'd like to be able to determine which phone number was > > picked up. How do I do that? Is there a variable somewhere I can tap in > > real time? The CDRs don't show which number was picked up either. > > > > Thanks! > > > > Enlai > > > > > > _______________________________________________ > > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > > > asterisk-users mailing list > > To UNSUBSCRIBE or update options visit: > > http://lists.digium.com/mailman/listinfo/asterisk-users > > > > > > _______________________________________________ > > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > > > asterisk-users mailing list > > To UNSUBSCRIBE or update options visit: > > http://lists.digium.com/mailman/listinfo/asterisk-users
On Wed, 24 Jun 2009 15:43:14 -0400, Leah Newmark <lnewmark at capalon.com> wrote:>I also have noticed odd behavior. When I edit an AGI, the changes aren't >always showing up in the running of the script via asterisk.May be a total red herring (I'm using an old version of Trixbox) but if I edit my PHPs on a Windows machine and upload using FTP, they will only run if I fire up Nano and save the file on the Asterisk box.
Thanks for the suggestion, but I'm editing directly on the server.... I've been doing AGIs for, what, 4 years now? I have never been *this* stumped! __________________________________________________ On Wed, 24 Jun 2009 15:43:14 -0400, Leah Newmark <lnewmark at capalon.com <http://lists.digium.com/mailman/listinfo/asterisk-users>> wrote:>/I also have noticed odd behavior. When I edit an AGI, the changes aren't/>/always showing up in the running of the script via asterisk. / May be a total red herring (I'm using an old version of Trixbox) but if I edit my PHPs on a Windows machine and upload using FTP, they will only run if I fire up Nano and save the file on the Asterisk box. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20090625/b44c36e3/attachment.htm
I think I found the part of my AGI the script is stuck at. The #!/usr/bin/php command was fine. What the agi debug I believe is displaying is the output of this: $in = fopen("php://stdin","r"); Which explains what I thought was "cached" -- the same #!/usr/bin/php5 -q command repeatedly failing was NOT the opening of my script, but rather the <stdin> I'm going to play around more with this, but in case anyone has a similar problem, they'll have a starting place. Thanks!
Philipp Kempgen
2009-Jun-26 22:55 UTC
[asterisk-users] PHP AGI Not Working and Odd Behavior
Leah Newmark schrieb:> I'm running asterisk 1.4.22 on a debian server. > I have php5 installed and it works correctly command line. > When trying to run a php script via AGI, I get messages such as: > GI Tx >> I> > AGI Rx << #!/usr/bin/php5 -q > AGI Tx >> 510 Invalid or unknown command > > The scripts are completely executable and owned by asterisk > -rwxr-xr-x 1 asterisk asterisk > > Googling is not helping much, and php seems installed perfectly. Other > servers running the same AGIs have no such problem. > > I also have noticed odd behavior. When I edit an AGI, the changes aren't > always showing up in the running of the script via asterisk. > For example, I tried editing the bash command to read #!/usr/bin/php -q, > and got the same response on my agi debug. > I know for a fact it's running the script I've edited: > Launched AGI Script /var/lib/asterisk/agi-bin/myscript.php > and it's not in some other directory. > > Any input: obvious or not is requested...a few people here are stumped!Are you by any chance mounting two volumes to the same path? Do you use a PHP opcode cache? Did you try to reboot the system? Strange filesystem? Philipp Kempgen -- AMOOMA GmbH - Bachstr. 126 - 56566 Neuwied -> http://www.amooma.de Gesch?ftsf?hrer: Stefan Wintermeyer, Handelsregister: Neuwied B14998 Asterisk: http://the-asterisk-book.com - http://das-asterisk-buch.de Videos of the AMOOCON VoIP conference 2009 -> http://www.amoocon.de --