[asterisk-users] AGI doesn't execute PHP5 script

2006-08-08 Thread Stefan-Michael. Guenther (in-put GbR)
Hi,

I'm trying to start a PHP5 script via the AGI Interface.
The asterisk version is Asterisk 1.2.5-BRIstuffed-0.3.0-PRE-1k and I followed 
the instructions on

http://www.voip-info.org/tiki-print.php?page=Asterisk+AGI+php

The problem is, as you can see from the output in the CLI, that Asterisk 
claims that it executes the script, but nothing happens. It doesn't create 
the file /tmp/asterisk and it doesn't send an email.
When I execute the script manually on the command line, it is execute without 
an error, the file is there and the email, too.

##
;extensions.conf
;
[guenther]
exten => 111,1,Answer()
exten => 111,2,AGI(test.php)
exten => 111,3,Hangup

##
ls -l /var/lib/asterisk/agi-bin/test.php

-rwxr-xr-x 1 asterisk root  340 Aug  8 10:07 test.php

##

cat /var/lib/asterisk/agi-bin/test.php
#! /usr/bin/php5

\nX-OTRS-Queue:Misc\n";
$subject="Anruf vom SysAdmin";
mail("[EMAIL PROTECTED]",$subject,"Testemail","From: Asterisk 
<[EMAIL PROTECTED]>");
?>

##
asterisk*CLI> dial [EMAIL PROTECTED]
-- Executing Answer("OSS/dsp", "") in new stack
 << Console call has been answered >>
-- Executing AGI("OSS/dsp", "test.php") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/test.php
AGI Tx >> agi_request: test.php
AGI Tx >> agi_channel: OSS/dsp
AGI Tx >> agi_language: en
AGI Tx >> agi_type: Console
AGI Tx >> agi_uniqueid: asterisk-6958-1155024459.47
AGI Tx >> agi_callerid: unknown
AGI Tx >> agi_calleridname: unknown
AGI Tx >> agi_callingpres: 0
AGI Tx >> agi_callingani2: 0
AGI Tx >> agi_callington: 0
AGI Tx >> agi_callingtns: 0
AGI Tx >> agi_dnid: unknown
AGI Tx >> agi_rdnis: unknown
AGI Tx >> agi_context: guenther
AGI Tx >> agi_extension: 111
AGI Tx >> agi_priority: 2
AGI Tx >> agi_enhanced: 0.0
AGI Tx >> agi_accountcode:
AGI Tx >> LI>
-- AGI Script test.php completed, returning 0
-- Executing Hangup("OSS/dsp", "") in new stack
 << Hangup on console >>

##
When I use a shell script instead of the PHP script, everything works as 
expected, the file /tmp/asterisk is created:

cat /var/lib/asterisk/agi-bin/test.sh
#! /bin/bash

echo "1" > /tmp/asterisk

##

Obviously, PHP5 is the problem, but what's wrong with it?

Thanks for your help,

Stefan
-- 


in-put GbR - Das Linux-Systemhaus
Stefan-Michael Guenther
Moltkestrasse 49 D-76133 Karlsruhe
Tel./Fax : +49 (0)721 / 83044 - 98/93
http://www.in-put.de

 Schulungen  Installationen  
 Beratung   Support
  Voice-over-IP-Loesungen


-- 


in-put GbR - Das Linux-Systemhaus
Stefan-Michael Guenther
Moltkestrasse 49 D-76133 Karlsruhe
Tel./Fax : +49 (0)721 / 83044 - 98/93
http://www.in-put.de

 Schulungen  Installationen  
 Beratung   Support
  Voice over IP - Lösungen

___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] AGI doesn't execute PHP5 script

2006-08-08 Thread Matt Riddell (NZ)
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Stefan-Michael. Guenther (in-put GbR) wrote:
> Hi,
> 
> I'm trying to start a PHP5 script via the AGI Interface.
> The asterisk version is Asterisk 1.2.5-BRIstuffed-0.3.0-PRE-1k and I followed 
> the instructions on
> 
> http://www.voip-info.org/tiki-print.php?page=Asterisk+AGI+php
> 
> The problem is, as you can see from the output in the CLI, that Asterisk 
> claims that it executes the script, but nothing happens. It doesn't create 
> the file /tmp/asterisk and it doesn't send an email.
> When I execute the script manually on the command line, it is execute without 
> an error, the file is there and the email, too.
> 
> ##
> ;extensions.conf
> ;
> [guenther]
> exten => 111,1,Answer()
> exten => 111,2,AGI(test.php)
> exten => 111,3,Hangup
> 
> ##
> ls -l /var/lib/asterisk/agi-bin/test.php
> 
> -rwxr-xr-x 1 asterisk root  340 Aug  8 10:07 test.php
> 
> ##
> 
> cat /var/lib/asterisk/agi-bin/test.php
> #! /usr/bin/php5
> 
>  ob_implicit_flush(false);
> set_time_limit(6);
> error_reporting(0);

Try running it from the command line and see what happens

- --
Cheers,

Matt Riddell
___

http://www.sineapps.com/news.php (Daily Asterisk News - html)
http://freevoip.gedameurope.com (Free Asterisk Voip Community)
http://www.sineapps.com/rssfeed.php (Daily Asterisk News - rss)
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE2Hh3S6d5vy0jeVcRAkf7AJ0bbLWCZXQ/ismZJxG2l2vfMCktiQCfeshM
Sk03IFfNGOdKGM9CZvsrldE=
=CNyN
-END PGP SIGNATURE-
___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] AGI doesn't execute PHP5 script

2006-08-08 Thread Stefan-Michael. Guenther (in-put GbR)
Hi,

Am Dienstag, 8. August 2006 13:41 schrieb Matt Riddell (NZ):
> Stefan-Michael. Guenther (in-put GbR) wrote:
> > Hi,
> >
> > I'm trying to start a PHP5 script via the AGI Interface.
> > The asterisk version is Asterisk 1.2.5-BRIstuffed-0.3.0-PRE-1k and I
> > followed the instructions on
> >
> > http://www.voip-info.org/tiki-print.php?page=Asterisk+AGI+php
> >
> > The problem is, as you can see from the output in the CLI, that Asterisk
> > claims that it executes the script, but nothing happens. It doesn't
> > create the file /tmp/asterisk and it doesn't send an email.
> > When I execute the script manually on the command line, it is executes
> > without an error, the file is there and the email, too.
^^^
> >
>
> Try running it from the command line and see what happens
>
I guess you meant the test.php script, right?
Executing php5 scripts on the command line isn't a problem at all, only when 
they are started through AGI.

Stefan
-- 


in-put GbR - Das Linux-Systemhaus
Stefan-Michael Guenther
Moltkestrasse 49 D-76133 Karlsruhe
Tel./Fax : +49 (0)721 / 83044 - 98/93
http://www.in-put.de

 Schulungen  Installationen  
 Beratung   Support
  Voice over IP - Lösungen

___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] AGI doesn't execute PHP5 script

2006-08-08 Thread Vahram Igityan
Hello Stefan-Michael.,

You ,need to use
 #!/usr/bin/php5 -q insted off  #! /usr/bin/php5 i guess.


Tuesday, August 8, 2006, 2:55:10 PM, you wrote:

> Hi,

> I'm trying to start a PHP5 script via the AGI Interface.
> The asterisk version is Asterisk 1.2.5-BRIstuffed-0.3.0-PRE-1k and I followed
> the instructions on

> http://www.voip-info.org/tiki-print.php?page=Asterisk+AGI+php

> The problem is, as you can see from the output in the CLI, that Asterisk
> claims that it executes the script, but nothing happens. It doesn't create
> the file /tmp/asterisk and it doesn't send an email.
> When I execute the script manually on the command line, it is execute without
> an error, the file is there and the email, too.

> ##
> ;extensions.conf
> ;
> [guenther]
exten =>> 111,1,Answer()
exten =>> 111,2,AGI(test.php)
exten =>> 111,3,Hangup

> ##
> ls -l /var/lib/asterisk/agi-bin/test.php

> -rwxr-xr-x 1 asterisk root  340 Aug  8 10:07 test.php

> ##

> cat /var/lib/asterisk/agi-bin/test.php
> #! /usr/bin/php5

>  ob_implicit_flush(false);
> set_time_limit(6);
> error_reporting(0);
> system("touch /tmp/asterisk");
> $header="From: Asterisk <[EMAIL PROTECTED]>\nX-OTRS-Queue:Misc\n";
> $subject="Anruf vom SysAdmin";
> mail("[EMAIL PROTECTED]",$subject,"Testemail","From: Asterisk 
> <[EMAIL PROTECTED]>");
?>>

> ##
asterisk*CLI>> dial [EMAIL PROTECTED]
> -- Executing Answer("OSS/dsp", "") in new stack
>  << Console call has been answered >>
> -- Executing AGI("OSS/dsp", "test.php") in new stack
> -- Launched AGI Script /var/lib/asterisk/agi-bin/test.php
AGI Tx >>> agi_request: test.php
AGI Tx >>> agi_channel: OSS/dsp
AGI Tx >>> agi_language: en
AGI Tx >>> agi_type: Console
AGI Tx >>> agi_uniqueid: asterisk-6958-1155024459.47
AGI Tx >>> agi_callerid: unknown
AGI Tx >>> agi_calleridname: unknown
AGI Tx >>> agi_callingpres: 0
AGI Tx >>> agi_callingani2: 0
AGI Tx >>> agi_callington: 0
AGI Tx >>> agi_callingtns: 0
AGI Tx >>> agi_dnid: unknown
AGI Tx >>> agi_rdnis: unknown
AGI Tx >>> agi_context: guenther
AGI Tx >>> agi_extension: 111
AGI Tx >>> agi_priority: 2
AGI Tx >>> agi_enhanced: 0.0
AGI Tx >>> agi_accountcode:
AGI Tx >>> LI>
> -- AGI Script test.php completed, returning 0
> -- Executing Hangup("OSS/dsp", "") in new stack
>  << Hangup on console >>

> ##
> When I use a shell script instead of the PHP script, everything works as
> expected, the file /tmp/asterisk is created:

> cat /var/lib/asterisk/agi-bin/test.sh
> #! /bin/bash

echo "1" >> /tmp/asterisk

> ##

> Obviously, PHP5 is the problem, but what's wrong with it?

> Thanks for your help,

> Stefan
> -- 

> 
> in-put GbR - Das Linux-Systemhaus
> Stefan-Michael Guenther
> Moltkestrasse 49 D-76133 Karlsruhe
> Tel./Fax : +49 (0)721 / 83044 - 98/93
> http://www.in-put.de
> 
>  Schulungen  Installationen  
>  Beratung   Support
>   Voice-over-IP-Loesungen
> 




-- 
Best regards,
 Vahram

___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] AGI doesn't execute PHP5 script

2006-08-08 Thread Matt Riddell (NZ)
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Stefan-Michael. Guenther (in-put GbR) wrote:
> Hi,
> 
> Am Dienstag, 8. August 2006 13:41 schrieb Matt Riddell (NZ):
>> Stefan-Michael. Guenther (in-put GbR) wrote:
>>> Hi,
>>>
>>> I'm trying to start a PHP5 script via the AGI Interface.
>>> The asterisk version is Asterisk 1.2.5-BRIstuffed-0.3.0-PRE-1k and I
>>> followed the instructions on
>>>
>>> http://www.voip-info.org/tiki-print.php?page=Asterisk+AGI+php
>>>
>>> The problem is, as you can see from the output in the CLI, that Asterisk
>>> claims that it executes the script, but nothing happens. It doesn't
>>> create the file /tmp/asterisk and it doesn't send an email.
>>> When I execute the script manually on the command line, it is executes
>>> without an error, the file is there and the email, too.
> ^^^
>> Try running it from the command line and see what happens
>>
> I guess you meant the test.php script, right?
> Executing php5 scripts on the command line isn't a problem at all, only when 
> they are started through AGI.

This particular script also?

Are you using AGI DEBUG in console?

- --
Cheers,

Matt Riddell
___

http://www.sineapps.com/news.php (Daily Asterisk News - html)
http://freevoip.gedameurope.com (Free Asterisk Voip Community)
http://www.sineapps.com/rssfeed.php (Daily Asterisk News - rss)
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE2XwPS6d5vy0jeVcRAlCtAJoDPCIIgX4XxVELnoQYEmvc1l+oLwCcDioH
7AyLQZcKjqrJMBxqNiM4qI8=
=tgJm
-END PGP SIGNATURE-
___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] AGI doesn't execute PHP5 script

2006-08-08 Thread Stefan-Michael. Guenther (in-put GbR)
Hi,

Am Mittwoch, 9. August 2006 08:09 schrieb Matt Riddell (NZ):
> >>> The problem is, as you can see from the output in the CLI, that
> >>> Asterisk claims that it executes the script, but nothing happens. It
> >>> doesn't create the file /tmp/asterisk and it doesn't send an email.
> >>> When I execute the script manually on the command line, it is executes
> >>> without an error, the file is there and the email, too.
> >
> > ^^^
> >
> >> Try running it from the command line and see what happens
> >
> > I guess you meant the test.php script, right?
> > Executing php5 scripts on the command line isn't a problem at all, only
> > when they are started through AGI.
>
> This particular script also?
>
> Are you using AGI DEBUG in console?
>
yes, I can execute test.php on the command line and it runs as expected.
Wenn I call it via AGI nothing happens.

Yes, the first mail contained the output of the script with "agi debug", "set 
verbose 10", "set debug 10" set before. Here it is again:

asterisk*CLI> dial [EMAIL PROTECTED]
    -- Executing Answer("OSS/dsp", "") in new stack
 << Console call has been answered >>
    -- Executing AGI("OSS/dsp", "test.php") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/test.php
AGI Tx >> agi_request: test.php
AGI Tx >> agi_channel: OSS/dsp
AGI Tx >> agi_language: en
AGI Tx >> agi_type: Console
AGI Tx >> agi_uniqueid: asterisk-6958-1155024459.47
AGI Tx >> agi_callerid: unknown
AGI Tx >> agi_calleridname: unknown
AGI Tx >> agi_callingpres: 0
AGI Tx >> agi_callingani2: 0
AGI Tx >> agi_callington: 0
AGI Tx >> agi_callingtns: 0
AGI Tx >> agi_dnid: unknown
AGI Tx >> agi_rdnis: unknown
AGI Tx >> agi_context: guenther
AGI Tx >> agi_extension: 111
AGI Tx >> agi_priority: 2
AGI Tx >> agi_enhanced: 0.0
AGI Tx >> agi_accountcode:
AGI Tx >> LI>
    -- AGI Script test.php completed, returning 0
    -- Executing Hangup("OSS/dsp", "") in new stack
 << Hangup on console >>

And it doesn't make a difference whether I use the dial command or a sip phone 
to call extension 111 in context [guenther]. Strange, isn't it?

Stefan
-- 


in-put GbR - Das Linux-Systemhaus
Stefan-Michael Guenther
Moltkestrasse 49 D-76133 Karlsruhe
Tel./Fax : +49 (0)721 / 83044 - 98/93
http://www.in-put.de

 Schulungen  Installationen  
 Beratung   Support
  Voice over IP - Lösungen

___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] AGI doesn't execute PHP5 script [SOLVED]

2006-08-09 Thread Stefan-Michael. Guenther (in-put GbR)
Hi,

I have solved it (but don't understand yet, why it works)!!!

SuSE 10.1 uses different configuration files for the cli version and the cgi 
version of PHP5.

When I modify the first line in the script from 

#! /usr/bin/php5

to

#! /usr/bin/php5 -c /etc/php5/cli/

the php scripts gets executed! I guess I have to compare the parameters in the 
two configuration files to get the important detail.

>> AGI Tx >> agi_accountcode:
>> AGI Tx >> LI>
>>     -- AGI Script test.php completed, returning 0
>>     -- Executing Hangup("OSS/dsp", "") in new stack
>>  << Hangup on console >>
>>
>> And it doesn't make a difference whether I use the dial command or a sip 
>>phone
>> to call extension 111 in context [guenther]. Strange, isn't it?

>Yeah.  That response is usually when things are not happening properly.
>
Matt,  the ouput hasn't changed, although ist script is executed properly. Why 
do you thing that this output shows a failure?

>Also are you using php -q?
>
No, this isn't required for php5 (taken from README.CLI):

* CLI is started up in quiet mode by default.
  (-q switch kept for compatibility)

Thanks for your help and suggestions,

Stefan
-- 


in-put GbR - Das Linux-Systemhaus
Stefan-Michael Guenther
Moltkestrasse 49 D-76133 Karlsruhe
Tel./Fax : +49 (0)721 / 83044 - 98/93
http://www.in-put.de

 Schulungen  Installationen  
 Beratung   Support
  Voice over IP - Lösungen

___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] AGI doesn't execute PHP5 script [SOLVED]

2006-08-09 Thread Matt Riddell (NZ)
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Stefan-Michael. Guenther (in-put GbR) wrote:
>> Yeah.  That response is usually when things are not happening properly.
>>
> Matt,  the ouput hasn't changed, although ist script is executed properly. 
> Why 
> do you thing that this output shows a failure?

:) Usually my scripts have hundreds of lines of debug statements, so
when I see nothing come back, I'm always a little concerned!

:)

- --
Cheers,

Matt Riddell
___

http://www.sineapps.com/news.php (Daily Asterisk News - html)
http://freevoip.gedameurope.com (Free Asterisk Voip Community)
http://www.sineapps.com/rssfeed.php (Daily Asterisk News - rss)
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE2cYRS6d5vy0jeVcRAt8WAJ9W15a0rslNlGx8YDXl13dwbFMI0gCfWX8c
58YUsSa6/3Bpr/yyd/VYcps=
=r7Pv
-END PGP SIGNATURE-
___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users