Re: [asterisk-users] PHP AGI : handle Event /AGI session

2009-11-20 Thread Steve Edwards
On Fri, 20 Nov 2009, mickael ropars wrote:

 someone send a URL to call someone a PHP script (script 1) is launch and 
 in its I configure Astmanager in order to make an originating call then 
 my script stop running and Asterisk continue processing the call in an 
 extension when hangup occurs I execute another AGI script (script 2).

Is script1 executed by Asterisk or Apache? If it is Apache, it is not an 
Asterisk Gateway Interface (AGI) executable.

 my concerns is that scipt 2 need same parameters, and mySQL connexions 
 that I script 1

 so at the end of the script 1 the mySQL connection is closed and I need 
 to pass many parameters to script 2 through asterisk

The 2 scripts execute as 2 separate processes. They cannot share 
connections to either MySQL or AMI. You can pass the parameters through 
the database or are you contemplating setting a bunch of channel variables 
in script1 and reading them in script2?

 so my idea is to use AGI commands in script 1, and then not use the 
 extension on the asterisk server. but I have one question if the call 
 duration is hours then the connection to Astmanager will closed ? what's 
 the timeout value for Astmanager ?

The connection to the Asterisk Manager Interface (AMI) is closed when you 
explicitly close it or when the script exits.

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

___
-- 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


Re: [asterisk-users] PHP AGI : handle Event /AGI session

2009-11-20 Thread mickael ropars
thanks a lot steve for your answer

the script is launch by a web page so it's a AGI executable

if it was your case which implementation will you choose ?

regards

Mickael



2009/11/20 Steve Edwards asterisk@sedwards.com

 On Fri, 20 Nov 2009, mickael ropars wrote:

  someone send a URL to call someone a PHP script (script 1) is launch and
  in its I configure Astmanager in order to make an originating call then
  my script stop running and Asterisk continue processing the call in an
  extension when hangup occurs I execute another AGI script (script 2).

 Is script1 executed by Asterisk or Apache? If it is Apache, it is not an
 Asterisk Gateway Interface (AGI) executable.

  my concerns is that scipt 2 need same parameters, and mySQL connexions
  that I script 1
 
  so at the end of the script 1 the mySQL connection is closed and I need
  to pass many parameters to script 2 through asterisk

 The 2 scripts execute as 2 separate processes. They cannot share
 connections to either MySQL or AMI. You can pass the parameters through
 the database or are you contemplating setting a bunch of channel variables
 in script1 and reading them in script2?

  so my idea is to use AGI commands in script 1, and then not use the
  extension on the asterisk server. but I have one question if the call
  duration is hours then the connection to Astmanager will closed ? what's
  the timeout value for Astmanager ?

 The connection to the Asterisk Manager Interface (AMI) is closed when you
 explicitly close it or when the script exits.

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

 ___
 -- 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

Re: [asterisk-users] PHP AGI : handle Event /AGI session

2009-11-20 Thread Steve Edwards
Un-top-posting...

 On Fri, 20 Nov 2009, mickael ropars wrote:

 someone send a URL to call someone a PHP script (script 1) is launch 
 and in its I configure Astmanager in order to make an originating call 
 then my script stop running and Asterisk continue processing the call 
 in an extension when hangup occurs I execute another AGI script 
 (script 2).

 2009/11/20 Steve Edwards asterisk@sedwards.com

 Is script1 executed by Asterisk or Apache? If it is Apache, it is not 
 an Asterisk Gateway Interface (AGI) executable.

On Fri, 20 Nov 2009, mickael ropars wrote:

 the script is launch by a web page so it's a AGI executable

No. If script1 is launched by a web page, it's a CGI (Common Gateway 
Interface). So you cannot use any AGI commands in script1. You can, 
however, use AMI.

 if it was your case which implementation will you choose ?

I don't have a lot of experience with AMI, and I have a very limited 
understanding of your environment, so I can't give an opinion with much 
confidence.

Is AMI able and stable in setting the number of parameters you need? 
You'll have to test this yourself.

I've written AGI's that set hundreds of channel variables so I know this 
will not be a limitation in Asterisk.

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

___
-- 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


Re: [asterisk-users] PHP AGI : handle Event /AGI session

2009-11-20 Thread mickael ropars
oupps sorry steve.

thanks

Mickael

2009/11/20 Steve Edwards asterisk@sedwards.com

 Un-top-posting...

  On Fri, 20 Nov 2009, mickael ropars wrote:
 
  someone send a URL to call someone a PHP script (script 1) is launch
  and in its I configure Astmanager in order to make an originating call
  then my script stop running and Asterisk continue processing the call
  in an extension when hangup occurs I execute another AGI script
  (script 2).

  2009/11/20 Steve Edwards asterisk@sedwards.com

  Is script1 executed by Asterisk or Apache? If it is Apache, it is not
  an Asterisk Gateway Interface (AGI) executable.

 On Fri, 20 Nov 2009, mickael ropars wrote:

  the script is launch by a web page so it's a AGI executable

 No. If script1 is launched by a web page, it's a CGI (Common Gateway
 Interface). So you cannot use any AGI commands in script1. You can,
 however, use AMI.

  if it was your case which implementation will you choose ?

 I don't have a lot of experience with AMI, and I have a very limited
 understanding of your environment, so I can't give an opinion with much
 confidence.

 Is AMI able and stable in setting the number of parameters you need?
 You'll have to test this yourself.

 I've written AGI's that set hundreds of channel variables so I know this
 will not be a limitation in Asterisk.

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

 ___
 -- 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

Re: [asterisk-users] PHP AGI : handle Event /AGI session

2009-11-20 Thread Steve Edwards
 On Fri, 20 Nov 2009, mickael ropars wrote:

 someone send a URL to call someone a PHP script (script 1) is launch 
 and in its I configure Astmanager in order to make an originating call 
 then my script stop running and Asterisk continue processing the call 
 in an extension when hangup occurs I execute another AGI script 
 (script 2).

When you write your AGI script*, do yourself a favor and use an existing 
library -- don't try to write your own.

The AGI protocol is not complex, it's just been my experience that 
everybody gets it wrong the first time around :)

*) I write my AGIs in C. If you expect performance to ever be an issue, 
you can execute hundreds of AGIs written in a compiled language (like C) 
in the time it will take to load a script interpreter (like Perl or PHP) 
and parse a single script.

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

___
-- 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


Re: [asterisk-users] PHP AGI : handle Event /AGI session

2009-11-20 Thread mickael ropars
thanks a lot for your advice. In my side, I am using a PHP agi library

you seems to have a lot experience on asterisk ...

Regards

Mickael

2009/11/20 Steve Edwards asterisk@sedwards.com

  On Fri, 20 Nov 2009, mickael ropars wrote:
 
  someone send a URL to call someone a PHP script (script 1) is launch
  and in its I configure Astmanager in order to make an originating call
  then my script stop running and Asterisk continue processing the call
  in an extension when hangup occurs I execute another AGI script
  (script 2).

 When you write your AGI script*, do yourself a favor and use an existing
 library -- don't try to write your own.

 The AGI protocol is not complex, it's just been my experience that
 everybody gets it wrong the first time around :)

 *) I write my AGIs in C. If you expect performance to ever be an issue,
 you can execute hundreds of AGIs written in a compiled language (like C)
 in the time it will take to load a script interpreter (like Perl or PHP)
 and parse a single script.

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

 ___
 -- 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

Re: [asterisk-users] PHP AGI : handle Event /AGI session

2009-11-20 Thread Danny Nicholas
Steve is quite the Guru.  I'll second his advice about writing things in C.
I actually do Perl, but that's just because I haven't been able to devote
the time to polishing my C skills.

 

  _  

From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of mickael ropars
Sent: Friday, November 20, 2009 3:18 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] PHP AGI : handle Event /AGI session

 

thanks a lot for your advice. In my side, I am using a PHP agi library 

you seems to have a lot experience on asterisk ...

Regards

Mickael

2009/11/20 Steve Edwards asterisk@sedwards.com

 On Fri, 20 Nov 2009, mickael ropars wrote:

 someone send a URL to call someone a PHP script (script 1) is launch
 and in its I configure Astmanager in order to make an originating call
 then my script stop running and Asterisk continue processing the call
 in an extension when hangup occurs I execute another AGI script
 (script 2).

When you write your AGI script*, do yourself a favor and use an existing
library -- don't try to write your own.

The AGI protocol is not complex, it's just been my experience that
everybody gets it wrong the first time around :)

*) I write my AGIs in C. If you expect performance to ever be an issue,
you can execute hundreds of AGIs written in a compiled language (like C)
in the time it will take to load a script interpreter (like Perl or PHP)
and parse a single script.

--

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

___
-- 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

Re: [asterisk-users] PHP AGI : handle Event /AGI session

2009-11-20 Thread Steve Edwards
 [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of mickael 
 ropars

 you seems to have a lot experience on asterisk ...

On Fri, 20 Nov 2009, Danny Nicholas wrote:

 Steve is quite the Guru.  I'll second his advice about writing things in 
 C. I actually do Perl, but that's just because I haven't been able to 
 devote the time to polishing my C skills.

Well, thanks, but I only know a very small corner of Asterisk -- and 1.2 
at that :)

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

___
-- 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