Re: [asterisk-users] AGI Problem

2011-09-27 Thread Mehmet Avcioglu

Danny's suggestion of using System instead of AGI was correct, it was wrong of 
me to use AGI here as there is no communication. The same script does 
communicate with asterisk when executed with different options, so I had just 
kept the same line using different options at different places. 

Today I changed the AGI calls to System at places where there is no response 
back to asterisk. Kept everything the same, instead of 
AGI(script.php,var1,var2) made it System(/path/script.php var1 var2) and it 
worked without a problem. This way I have been able to fix the problem where 
this caused a deadlock requiring human intervention. 

The lines in the dialplan that continue to use the AGI call still experience 
the same problem as before. Today it happened 9 times out of 10486 executions, 
but these are not as fatal as before, so they can almost be ignored. 

 Are you reading the AGI environment in the script?

Yes

 How are you passing variables from Asterisk? As channel variables or as 
 command line parameters?
 What is the dialplan statement that executes your script?

Command line parameters, explained above.

 Can you post the script source?

Yes but I really cannot see how the script could have a problem, it is around 
2000 lines and since my problem has come to a more manageable level, I would 
rather not bug you with debugging the whole thing:)

 If you captured the AGI dialog from a call when your script failed and you 
 feed the same values (including the AGI environment) into your script from a 
 shell does it fail?

Yes it runs just fine. It even runs fine at different times from within the 
asterisk using AGI when the same number calls or is called. So the only 
variable that is different between executions is time.

 On a Unix system level, a 4 means 'Interrupted system call' -- assuming this 
 is what your '4' signifies. BTW, I'm a 1.2 Luddite and the AGI return value 
 was meaningless back then.

Running these on 1.8.5

I'll migrate this setup to a different environment, perhaps try at different 
asterisk and try the signal catching mentioned before and if I get any more 
data will update the list.

Thanks a lot.

--
Mehmet
--
_
-- 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


Re: [asterisk-users] AGI Problem

2011-09-27 Thread Steve Edwards

On Tue, 27 Sep 2011, Mehmet Avcioglu wrote:

Today I changed the AGI calls to System at places where there is no 
response back to asterisk. Kept everything the same, instead of 
AGI(script.php,var1,var2) made it System(/path/script.php var1 var2) 
and it worked without a problem. This way I have been able to fix the 
problem where this caused a deadlock requiring human intervention.


This is not a 'fix.'

The lines in the dialplan that continue to use the AGI call still 
experience the same problem as before. Today it happened 9 times out of 
10486 executions, but these are not as fatal as before, so they can 
almost be ignored.


All this strongly points at your implementation of the AGI protocol.

So now the question becomes 'Is it easier to debug my own private AGI 
library or should I switch to a more mature implementation?'


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


Re: [asterisk-users] AGI Problem

2011-09-26 Thread Mehmet Avcioglu

Thanks for the response. Although I had already gone thorough a lot of these 
types of QAs during my own problem solving, your suggestions did bring a couple 
that I had not.

 In no particular order...
 
 Earlier, you suspected receiving a signal was causing your problem.
 Instead of ignoring the signal, how setting up a handler and logging the 
 reception?

The program is written in a very top to bottom way (himm stateless? non-oo? not 
sure what to call it) and would be really hard for me to catch those and figure 
out where it happened and clean things up. So I have been reluctant to do this. 
But it is one of those tests that I'll eventually hit if I cannot solve the 
problem.

 How about 'agi set debug on'?

I was doing extensive logging in my scripts and had turned on full logging for 
asterisk but I had not turned agi debuging on. I did and carefully inspected 
the output. And there is nothing out of ordinary between successful executions 
and unsuccessful ones.

 Whose AGI library did you use? If you 'rolled your own' maybe you are 
 violating the protocol. Nobody gets it right the first time :)
 What does the AGI do?
 Can you execute it outside of Asterisk by feeding it the appropriate cruft 
 via STDIN?

I am using my own. Yes agreed, but this doesn't even interact with asterisk at 
all. Just receives a couple values and updates jobs, database accordingly. Does 
not return anything back to asterisk. Yes executes fine outside of asterisk and 
even executes fine within asterisk 99.9% of the time. 

 Are there any characteristics common to the 48? Same ANI? Same DNIS?, Same 
 path through your dialplan?

I have not been able to find any difference.

So returning 4 doesn't mean anything special. It is just the return code 
received from the AGI application that was forked. What about the fact that 
asterisk does not continue with the dialplan after receiving 4, is that 
expected behavior? 
I have not been able to find what would make a php cli application exit with 4 
other than exit(4). php does not log anything when this happens, doesn't write 
anything to stderr (I specifically remained on the console I started * to see 
stderr). So this can only be a crash of some sort of php cli binary. What type 
of a crash would cause it to return 4? 

I will keep digging.

Thanks

--
Mehmet 


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


Re: [asterisk-users] AGI Problem

2011-09-26 Thread Steve Edwards

On Sat, 24 Sep 2011, Steve Edwards wrote:

Instead of ignoring the signal, how setting up a handler and logging 
the reception?


On Mon, 26 Sep 2011, Mehmet Avcioglu wrote:

The program is written in a very top to bottom way (himm stateless? 
non-oo? not sure what to call it) and would be really hard for me to 
catch those and figure out where it happened and clean things up.


All you need to do is set a signal handler and call syslog() to log the 
occurrence in a 'safe' place and then exit().. If the signal is already 
causing your script to abort, you're not doing any cleanup or recovery 
anyway. All we want to establish is if you are actually receiving a 
signal.



Whose AGI library did you use?


I am using my own. Yes agreed, but this doesn't even interact with 
asterisk at all. Just receives a couple values and updates jobs, 
database accordingly. Does not return anything back to asterisk.


Are you reading the AGI environment in the script?

How are you passing variables from Asterisk? As channel variables or as 
command line parameters?


What is the dialplan statement that executes your script?

Can you post the script source?

If you captured the AGI dialog from a call when your script failed and you 
feed the same values (including the AGI environment) into your script from 
a shell does it fail?


On a Unix system level, a 4 means 'Interrupted system call' -- assuming 
this is what your '4' signifies. BTW, I'm a 1.2 Luddite and the AGI return 
value was meaningless back then.


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


Re: [asterisk-users] AGI Problem

2011-09-24 Thread Mehmet Avcioglu

On Sep 23, 2011, at 8:01 PM, Mehmet Avcioglu wrote:
 I have an AGI script that occasionally disappears without completing its 
 action and asterisk logs the following.
 
  Local/0123456@context-f46e;1AGI Script script.php completed, returning 4
  Spawn extension (context, 0123456, 2) exited non-zero on 
 'Local/0123456@context-f46e;1'


I also changed the dialplan and added a line to print AGISTATUS, but when this 
returning 4 happens, asterisk stops there and doesn't execute any further 
dialplan actions, so I don't even see AGISTATUS value.

exten = h,1,AGI(script.php,${ANSWEREDTIME},,,)
exten = h,n,NoOp(${AGISTATUS})

Executing [h@context:1] AGI(Local/0123456@context-4b79;1, script.php,13,,,) 
in new stack
Local/0123456@context-4b79;1AGI Script script.php completed, returning 4
Spawn extension (context, h, 1) exited non-zero on 
'Local/0123456@context-4b79;1'

--
Mehmet
--
_
-- 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


Re: [asterisk-users] AGI Problem

2011-09-24 Thread Sam Govind
How much time your AGI is taking? Check if it is completing its task and not
killed by asterisk. I guess we've 6~7 seconds before asterisk kills all call
channel and related tasks.

On Sat, Sep 24, 2011 at 3:21 PM, Mehmet Avcioglu meh...@activecom.netwrote:


 On Sep 23, 2011, at 8:01 PM, Mehmet Avcioglu wrote:
  I have an AGI script that occasionally disappears without completing its
 action and asterisk logs the following.
 
   Local/0123456@context-f46e;1AGI Script script.php completed,
 returning 4
   Spawn extension (context, 0123456, 2) exited non-zero on
 'Local/0123456@context-f46e;1'


 I also changed the dialplan and added a line to print AGISTATUS, but when
 this returning 4 happens, asterisk stops there and doesn't execute any
 further dialplan actions, so I don't even see AGISTATUS value.

 exten = h,1,AGI(script.php,${ANSWEREDTIME},,,)
 exten = h,n,NoOp(${AGISTATUS})

 Executing [h@context:1] AGI(Local/0123456@context-4b79;1,
 script.php,13,,,) in new stack
 Local/0123456@context-4b79;1AGI Script script.php completed, returning 4
 Spawn extension (context, h, 1) exited non-zero on
 'Local/0123456@context-4b79;1'

 --
 Mehmet
 --
 _
 -- 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

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

Re: [asterisk-users] AGI Problem

2011-09-24 Thread Mehmet Avcioglu

Thanks for the response.

Asterisk logs the execution of the AGI and script completed messages within the 
same second, so less than a second. 

--
Mehmet

On Sep 24, 2011, at 3:34 PM, Sam Govind wrote:

 How much time your AGI is taking? Check if it is completing its task and not 
 killed by asterisk. I guess we've 6~7 seconds before asterisk kills all call 
 channel and related tasks.
 
 On Sat, Sep 24, 2011 at 3:21 PM, Mehmet Avcioglu meh...@activecom.net wrote:
 
 On Sep 23, 2011, at 8:01 PM, Mehmet Avcioglu wrote:
  I have an AGI script that occasionally disappears without completing its 
  action and asterisk logs the following.
 
   Local/0123456@context-f46e;1AGI Script script.php completed, returning 4
   Spawn extension (context, 0123456, 2) exited non-zero on 
  'Local/0123456@context-f46e;1'
 
 I also changed the dialplan and added a line to print AGISTATUS, but when 
 this returning 4 happens, asterisk stops there and doesn't execute any 
 further dialplan actions, so I don't even see AGISTATUS value.
 
 exten = h,1,AGI(script.php,${ANSWEREDTIME},,,)
 exten = h,n,NoOp(${AGISTATUS})
 
 Executing [h@context:1] AGI(Local/0123456@context-4b79;1, 
 script.php,13,,,) in new stack
 Local/0123456@context-4b79;1AGI Script script.php completed, returning 4
 Spawn extension (context, h, 1) exited non-zero on 
 'Local/0123456@context-4b79;1'
--
_
-- 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

Re: [asterisk-users] AGI Problem

2011-09-24 Thread Sam Govind
Thats wicked !! hmmm stop your asterisk (if u can afford) and run it like
asterisk -cvg and then make a call.. see whats your AGI doing in there
!!

On Sat, Sep 24, 2011 at 5:43 PM, Mehmet Avcioglu meh...@activecom.netwrote:


 Thanks for the response.

 Asterisk logs the execution of the AGI and script completed messages within
 the same second, so less than a second.

 --
 Mehmet

 On Sep 24, 2011, at 3:34 PM, Sam Govind wrote:

 How much time your AGI is taking? Check if it is completing its task and
 not killed by asterisk. I guess we've 6~7 seconds before asterisk kills all
 call channel and related tasks.

 On Sat, Sep 24, 2011 at 3:21 PM, Mehmet Avcioglu meh...@activecom.netwrote:


 On Sep 23, 2011, at 8:01 PM, Mehmet Avcioglu wrote:
  I have an AGI script that occasionally disappears without completing its
 action and asterisk logs the following.
 
   Local/0123456@context-f46e;1AGI Script script.php completed,
 returning 4
   Spawn extension (context, 0123456, 2) exited non-zero on
 'Local/0123456@context-f46e;1'

 I also changed the dialplan and added a line to print AGISTATUS, but when
 this returning 4 happens, asterisk stops there and doesn't execute any
 further dialplan actions, so I don't even see AGISTATUS value.

 exten = h,1,AGI(script.php,${ANSWEREDTIME},,,)
 exten = h,n,NoOp(${AGISTATUS})

 Executing [h@context:1] AGI(Local/0123456@context-4b79;1,
 script.php,13,,,) in new stack
 Local/0123456@context-4b79;1AGI Script script.php completed, returning
 4
 Spawn extension (context, h, 1) exited non-zero on
 'Local/0123456@context-4b79;1'


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

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

Re: [asterisk-users] AGI Problem

2011-09-24 Thread Mehmet Avcioglu

Out of about 18000 instances this problem occurred 48 times yesterday. So it 
has been pretty much impossible for me to replicate it under test conditions.

Thanks

--
Mehmet

On Sep 24, 2011, at 4:00 PM, Sam Govind wrote:

 Thats wicked !! hmmm stop your asterisk (if u can afford) and run it like 
 asterisk -cvg and then make a call.. see whats your AGI doing in there 
 !!
 
 On Sat, Sep 24, 2011 at 5:43 PM, Mehmet Avcioglu meh...@activecom.net wrote:
 
 Thanks for the response.
 
 Asterisk logs the execution of the AGI and script completed messages within 
 the same second, so less than a second. 
 
 --
 Mehmet
 
 On Sep 24, 2011, at 3:34 PM, Sam Govind wrote:
 
 How much time your AGI is taking? Check if it is completing its task and not 
 killed by asterisk. I guess we've 6~7 seconds before asterisk kills all call 
 channel and related tasks.
 
 On Sat, Sep 24, 2011 at 3:21 PM, Mehmet Avcioglu meh...@activecom.net 
 wrote:
 
 On Sep 23, 2011, at 8:01 PM, Mehmet Avcioglu wrote:
  I have an AGI script that occasionally disappears without completing its 
  action and asterisk logs the following.
 
   Local/0123456@context-f46e;1AGI Script script.php completed, returning 4
   Spawn extension (context, 0123456, 2) exited non-zero on 
  'Local/0123456@context-f46e;1'
 
 I also changed the dialplan and added a line to print AGISTATUS, but when 
 this returning 4 happens, asterisk stops there and doesn't execute any 
 further dialplan actions, so I don't even see AGISTATUS value.
 
 exten = h,1,AGI(script.php,${ANSWEREDTIME},,,)
 exten = h,n,NoOp(${AGISTATUS})
 
 Executing [h@context:1] AGI(Local/0123456@context-4b79;1, 
 script.php,13,,,) in new stack
 Local/0123456@context-4b79;1AGI Script script.php completed, returning 4
 Spawn extension (context, h, 1) exited non-zero on 
 'Local/0123456@context-4b79;1'
 
 --
 _
 -- 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
 
 --
 _
 -- 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

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

Re: [asterisk-users] AGI Problem

2011-09-24 Thread Sam Govind
Should we consider it ignorable or you are still interested in resolving !
Best of Luck in any case !

On Sat, Sep 24, 2011 at 6:16 PM, Mehmet Avcioglu meh...@activecom.netwrote:


 Out of about 18000 instances this problem occurred 48 times yesterday. So
 it has been pretty much impossible for me to replicate it under test
 conditions.

 Thanks

 --
 Mehmet

 On Sep 24, 2011, at 4:00 PM, Sam Govind wrote:

 Thats wicked !! hmmm stop your asterisk (if u can afford) and run it like
 asterisk -cvg and then make a call.. see whats your AGI doing in there
 !!

 On Sat, Sep 24, 2011 at 5:43 PM, Mehmet Avcioglu meh...@activecom.netwrote:


 Thanks for the response.

 Asterisk logs the execution of the AGI and script completed messages
 within the same second, so less than a second.

 --
 Mehmet

 On Sep 24, 2011, at 3:34 PM, Sam Govind wrote:

 How much time your AGI is taking? Check if it is completing its task and
 not killed by asterisk. I guess we've 6~7 seconds before asterisk kills all
 call channel and related tasks.

 On Sat, Sep 24, 2011 at 3:21 PM, Mehmet Avcioglu meh...@activecom.netwrote:


 On Sep 23, 2011, at 8:01 PM, Mehmet Avcioglu wrote:
  I have an AGI script that occasionally disappears without completing
 its action and asterisk logs the following.
 
   Local/0123456@context-f46e;1AGI Script script.php completed,
 returning 4
   Spawn extension (context, 0123456, 2) exited non-zero on
 'Local/0123456@context-f46e;1'

 I also changed the dialplan and added a line to print AGISTATUS, but when
 this returning 4 happens, asterisk stops there and doesn't execute any
 further dialplan actions, so I don't even see AGISTATUS value.

 exten = h,1,AGI(script.php,${ANSWEREDTIME},,,)
 exten = h,n,NoOp(${AGISTATUS})

 Executing [h@context:1] AGI(Local/0123456@context-4b79;1,
 script.php,13,,,) in new stack
 Local/0123456@context-4b79;1AGI Script script.php completed, returning
 4
 Spawn extension (context, h, 1) exited non-zero on
 'Local/0123456@context-4b79;1'


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


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



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

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

Re: [asterisk-users] AGI Problem

2011-09-24 Thread Mehmet Avcioglu

Thanks for the help. 48 times out of 18000 should be ignorable in most cases 
but it required human intervention 48 times.:) Obviously if there is no other 
way I'll find a way to automate that human intervention somehow.. Thanks again.

--
Mehmet

On Sep 24, 2011, at 4:34 PM, Sam Govind wrote:

 Should we consider it ignorable or you are still interested in resolving ! 
 Best of Luck in any case !
 
 On Sat, Sep 24, 2011 at 6:16 PM, Mehmet Avcioglu meh...@activecom.net wrote:
 
 Out of about 18000 instances this problem occurred 48 times yesterday. So it 
 has been pretty much impossible for me to replicate it under test conditions.
 
 Thanks
 
 --
 Mehmet
 
 On Sep 24, 2011, at 4:00 PM, Sam Govind wrote:
 
 Thats wicked !! hmmm stop your asterisk (if u can afford) and run it like 
 asterisk -cvg and then make a call.. see whats your AGI doing in there 
 !!
 
 On Sat, Sep 24, 2011 at 5:43 PM, Mehmet Avcioglu meh...@activecom.net 
 wrote:
 
 Thanks for the response.
 
 Asterisk logs the execution of the AGI and script completed messages within 
 the same second, so less than a second. 
 
 --
 Mehmet
 
 On Sep 24, 2011, at 3:34 PM, Sam Govind wrote:
 
 How much time your AGI is taking? Check if it is completing its task and 
 not killed by asterisk. I guess we've 6~7 seconds before asterisk kills all 
 call channel and related tasks.
 
 On Sat, Sep 24, 2011 at 3:21 PM, Mehmet Avcioglu meh...@activecom.net 
 wrote:
 
 On Sep 23, 2011, at 8:01 PM, Mehmet Avcioglu wrote:
  I have an AGI script that occasionally disappears without completing its 
  action and asterisk logs the following.
 
   Local/0123456@context-f46e;1AGI Script script.php completed, returning 
  4
   Spawn extension (context, 0123456, 2) exited non-zero on 
  'Local/0123456@context-f46e;1'
 
 I also changed the dialplan and added a line to print AGISTATUS, but when 
 this returning 4 happens, asterisk stops there and doesn't execute any 
 further dialplan actions, so I don't even see AGISTATUS value.
 
 exten = h,1,AGI(script.php,${ANSWEREDTIME},,,)
 exten = h,n,NoOp(${AGISTATUS})
 
 Executing [h@context:1] AGI(Local/0123456@context-4b79;1, 
 script.php,13,,,) in new stack
 Local/0123456@context-4b79;1AGI Script script.php completed, returning 4
 Spawn extension (context, h, 1) exited non-zero on 
 'Local/0123456@context-4b79;1'
 
 --
 _
 -- 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
 
 --
 _
 -- 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
 
 
 --
 _
 -- 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
 
 --
 _
 -- 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

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

Re: [asterisk-users] AGI Problem

2011-09-24 Thread Steve Edwards

On Sat, 24 Sep 2011, Mehmet Avcioglu wrote:

Thanks for the help. 48 times out of 18000 should be ignorable in most 
cases but it required human intervention 48 times.:) Obviously if there 
is no other way I'll find a way to automate that human intervention 
somehow.. Thanks again.


In no particular order...

Earlier, you suspected receiving a signal was causing your problem.

Instead of ignoring the signal, how setting up a handler and logging the 
reception?


How about 'agi set debug on'?

Whose AGI library did you use? If you 'rolled your own' maybe you are 
violating the protocol. Nobody gets it right the first time :)


What does the AGI do?

Can you execute it outside of Asterisk by feeding it the appropriate cruft 
via STDIN?


Are there any characteristics common to the 48? Same ANI? Same DNIS?, Same 
path through your dialplan?


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


Re: [asterisk-users] AGI Problem

2011-09-23 Thread Danny Nicholas
-Original Message-
From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Mehmet
Avcioglu
Sent: Friday, September 23, 2011 12:02 PM
To: asterisk-users@lists.digium.com
Subject: [asterisk-users] AGI Problem


Hello,

I have an AGI script that occasionally disappears without completing its
action and asterisk logs the following.

  Local/0123456@context-f46e;1AGI Script script.php completed, returning 4
  Spawn extension (context, 0123456, 2) exited non-zero on
'Local/0123456@context-f46e;1'

I figured this was due to channel hanging up and * sending a SIGHUP to the
script and added a catch and ignore for SIGHUP and SIGPIPE. But I still have
instances where AGI script gets lost. I am running 1.8.

Any ideas what returning 4 really means, where should I concentrate?

Thanks

--
Mehmet

Just a WAG - 4 is the error level returned by your php script, where it
normally returns 0.


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


Re: [asterisk-users] AGI Problem

2011-09-23 Thread Mehmet Avcioglu

On Sep 23, 2011, at 8:07 PM, Danny Nicholas wrote:
 Just a WAG - 4 is the error level returned by your php script, where it
 normally returns 0.

Yes would thing so. But at no place in my script I intentionally exit with 4. I 
believe 4 is SIGILL (Illegal Instruction) so my script might be seg faulting 
somewhere? Should I be going after this? It is a php script and php doesn't log 
anything for these instances. 

Thanks

--
Mehmet
--
_
-- 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


Re: [asterisk-users] AGI Problem

2011-09-23 Thread Kevin P. Fleming

On 09/23/2011 12:16 PM, Mehmet Avcioglu wrote:


On Sep 23, 2011, at 8:07 PM, Danny Nicholas wrote:

Just a WAG - 4 is the error level returned by your php script, where it
normally returns 0.


Yes would thing so. But at no place in my script I intentionally exit with 4. I 
believe 4 is SIGILL (Illegal Instruction) so my script might be seg faulting 
somewhere? Should I be going after this? It is a php script and php doesn't log 
anything for these instances.


No, 4 isn't SIGILL; result codes generated by uncaptured signals are 
always negative, I believe.


--
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
Jabber: kflem...@digium.com | SIP: kpflem...@digium.com | Skype: kpfleming
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at www.digium.com  www.asterisk.org

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


Re: [asterisk-users] AGI problem using mono (.Net)

2009-03-03 Thread Luis Morales
Hi douglas,

I made an AGI script with curl  in my dial-plan. Take a look:

[custom-login]
exten = s,1,Set(LOGINOK=0)
exten = s,2,Read(codigo|custom/codigo|4||3|3)
exten = s,3,Read(clave|custom/clave|4||3|3)
exten = 
s,4,Set(LOGINOK=${CURL(http://URL/cgi-bin/login.pl?codigo=${codigo}clave=${clave})})
exten = s,5,Set(TRY=$[${TRY} + 1])
exten = s,6,GotoIf($[${TRY}  2]?custom-finish,s,1:)
exten = s,7,GotoIf($[${LOGINOK} = 0]?custom-login,s,4:)
exten = s,8,GotoIf($[${LOGINOK} = 1]?custom-ok,s,1:)

login.pl
--
#!/usr/bin/perl

use CGI qw/:standard/;
use strict;

my $codigo = (param('codigo') ne undef) ? param('codigo') : 0;
my $clave = (param('clave') ne undef) ? param('clave') : 0;
my $i = 0;

$i = ($codigo eq $clave) ? 1 : 0;

print Content-type: text/html\n\n;
print $i;
--

Now you can use asterisk+curl to send and receive data. If you are
working with .net you can make web services integration + asterisk +
curl

Have an nice day,

Regards,

Luis Morales
On Thu, Feb 26, 2009 at 2:07 PM, Douglas Mortensen
d...@impalanetworks.com wrote:
 Steve:
 =
 Thanks for the info on the agi debug command. We'll see what information
 we can garner with that. Thanks also for the advanced logging info.

 Unfortunately, we are pretty aware of how AGI works (at least at the
 level that you explained it). Thanks for the illustrations though.

 Also thanks for the info regarding the 1 active request at a time. We
 appreciate the information.



 Luis:
 =
 I'm not sure that we can use curl in our situation. We are querying an
 Microsoft SQL 2005 database server directly from the asterisk box. It
 doesn't look like curl support SQL. Let me know if I am not
 understanding your suggestion.

 -
 Doug Mortensen
 Network Consultant
 Impala Networks Inc
 CCNA, MCP, Security+
 Linux+, Network+, A+
 .
 www.impalanetworks.com
 P: (505) 327-7300
 F: (505) 327-7545



 ___
 - Show quoted text -
 -- 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




-- 
-
Luis Morales
Consultor de Tecnologia
Cel: +(58)416-4242091
-
Empieza por hacer lo necesario, luego lo que es posible... y de
pronto estarás haciendo lo imposible

Leonardo Da'Vinci
-

___
-- 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] AGI problem using mono (.Net)

2009-02-26 Thread Douglas Mortensen
Steve:
=
Thanks for the info on the agi debug command. We'll see what information
we can garner with that. Thanks also for the advanced logging info.

Unfortunately, we are pretty aware of how AGI works (at least at the
level that you explained it). Thanks for the illustrations though.

Also thanks for the info regarding the 1 active request at a time. We
appreciate the information.



Luis:
=
I'm not sure that we can use curl in our situation. We are querying an
Microsoft SQL 2005 database server directly from the asterisk box. It
doesn't look like curl support SQL. Let me know if I am not
understanding your suggestion.

-
Doug Mortensen
Network Consultant
Impala Networks Inc
CCNA, MCP, Security+
Linux+, Network+, A+
.
www.impalanetworks.com
P: (505) 327-7300
F: (505) 327-7545



___
-- 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] AGI problem using mono (.Net)

2009-02-26 Thread Douglas Mortensen
An update here. Yesterday's problem has been solved (partly). After
looking closer at the results of my perl script, as well as looking at
the documentation, I realized that we were leaving the escape character
argument off of the STREAM FILE command in the mono application. After
appending  to the STREAM FILE filename, we are now seeing asterisk
attempt to play the file (both in the console and
/var/log/asterisk/full log).

New problem:
==
Although we see the following in our logs / asterisk console:
[Feb 26 11:11:05] VERBOSE[9824] logger.c: -- Playing 'filename'
(escape_digits=) (sample_offset 0)

All that the caller hears is a very brief click. And then the dial plan
continues. This is causing me to wonder whether asterisk halts playback
of the file, if the AGI script that send the STREAM FILE command
completes/returns. Talking to my developer, I asked him to create a loop
after sending the STREAM FILE command and read from stdin until he gets
a string that starts with 200. I'm supposing that asterisk would send
this AFTER the audio file has successfully played out. But again, this
is only a guess.

Thanks so much for the responses you provided yesterday. I look forward
to further information you can assist us with.

Sincerely,
-
Doug Mortensen
Network Consultant
Impala Networks Inc
CCNA, MCP, Security+
Linux+, Network+, A+
.
www.impalanetworks.com
P: (505) 327-7300
F: (505) 327-7545



___
-- 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] AGI problem using mono (.Net)

2009-02-26 Thread Steve Edwards
On Thu, 26 Feb 2009, Douglas Mortensen wrote:

 New problem:
 ==
 Although we see the following in our logs / asterisk console: [Feb 26 
 11:11:05] VERBOSE[9824] logger.c:  -- Playing 'filename' 
 (escape_digits=) (sample_offset 0)

 All that the caller hears is a very brief click. And then the dial plan 
 continues. This is causing me to wonder whether asterisk halts playback 
 of the file, if the AGI script that send the STREAM FILE command 
 completes/returns.

If your AGI is exiting before the sound file has finished and without 
reading the result from STDIN, you have violated the protocol.

 Talking to my developer, I asked him to create a loop after sending the 
 STREAM FILE command and read from stdin until he gets a string that 
 starts with 200.

All it takes is a single line oriented read. This is pretty elemental 
to the protocol -- issue a request, read the result. Most (all?) AGI 
libraries wrap these two steps into a single function call so the 
library user never has the opportunity to do anything in between.

 I'm supposing that asterisk would send this AFTER the audio file has 
 successfully played out. But again, this is only a guess.

It makes sense that Asterisk sends the result when the request is 
finished, successful or not.

A few more suggestions:

) Try to STREAM FILE demo-congrats.

) Verify that your sound file is playable (in the correct format for the 
codecs you have loaded) by using playback() in the dialplan.

Apologies if it is too basic (but still I forget sometimes...) that the 
file name is specified without the file type and is relative to Asterisk's 
sound directory (usually /var/lib/asterisk/sounds/) if the file name does 
not start with a slash.

The error message you showed above looks like STREAM FILE is finding the 
file. I'm guessing that you are still violating the protocol or that the 
file is not in an acceptable format for the codecs you have loaded.

It appears that you did not use an existing AGI library. Why not?

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] AGI problem using mono (.Net)

2009-02-25 Thread Eric Wieling, Asteria Solutions Group
Douglas Mortensen wrote:
 
 I have a software developer creating a .Net / mono program to use as an
 AGI script. We are having problems getting it to stream files. From what
 we can tell, it is talking to asterisk correctly when called from the
 dial plan. Its stderr output goes to the asterisk console. But asterisk
 doesn't give any indication that it receives the STREAM FILE command.
 Asterisk simply quickly executes the program and moves to the next step
 of the dial plan, as though it didn't receive any commands from the
 program.
 
 We know it is running, and outputting its results, because we have
 called it from within a bash script, and in doing so, I set the script
 to output stdout to a txt file for testing (like this 
 /var/log/asterisk/querylog). When we do this, the file does end up with
 the first line showing STREAM FILE filename.
 
 We're at a bit of a loss as to what's going on. We have checked
 filenames and are pretty sure that there are no typos and that the files
 are there. Further, I have a perl agi script using asterisk::agi that
 also does a STREAM FILE which runs without any problem. In our dial
 plan, my perl script runs, gets data from the user via the keypad, puts
 it in a channel variable, then exits, and his AGI script is immediately
 called as the next step of the dial plan receiving the channel variable
 as an argument.

STDERR only goes to the Asterisk console if you are running 1.4 or later 
and enable agi debug in the CLI.

I seem to recall something about AGIs not working correctly (streamfile 
or DTMF read) if your AGI script does not process the input Asterisk 
sends it on STDIN when Asterisk starts the AGI.  I don't know if it 
applies here, but it's worth looking at.

-- 
Eric Wieling * Asteria Solutions Group * Huntsville, AL
Call centers * IVRs * Enterprise PBXs * Conferencing applications
256-705-0277 * http://www.asteriasgi.com/ * sa...@asteriasgi.com

___
-- 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] AGI problem using mono (.Net)

2009-02-25 Thread Steve Edwards
On Wed, 25 Feb 2009, Douglas Mortensen wrote:

 I have a software developer creating a .Net / mono program to use as an 
 AGI script. We are having problems getting it to stream files. From what 
 we can tell, it is talking to asterisk correctly when called from the 
 dial plan. Its stderr output goes to the asterisk console. But asterisk 
 doesn't give any indication that it receives the STREAM FILE command. 
 Asterisk simply quickly executes the program and moves to the next step 
 of the dial plan, as though it didn't receive any commands from the 
 program.

Maybe you need a new developer? (Just kidding...)

The agi debug command may shed some light on the problem. I'm not a big 
fan of AGIs outputting to STDERR. I like to pepper my AGIs with syslog() 
statements to show the program state and variables.

 We know it is running, and outputting its results, because we have 
 called it from within a bash script, and in doing so, I set the script 
 to output stdout to a txt file for testing (like this  
 /var/log/asterisk/querylog). When we do this, the file does end up with 
 the first line showing STREAM FILE filename.

You can configure Asterisk to log a whole bunch of cruft to syslog with 
the following statement in logger.conf:

 syslog.local0 = debug,dtmf,error,event,info,notice,verbose,warning

I'll apologize in advance if the text below underestimates your AGI 
skills.

The AGI interface (is that redundant?) can be summarized as:

1) Asterisk sends a bunch of cruft (the AGI environment variables) to your 
program's STDIN.

2) Your program sends a request to Asterisk via STDOUT.

3) Asterisk sends a result to your program via STDIN.

4) Your program does something else.

5) go to step 2.

It's very simple, but not very forgiving.

Let's imagine a simple AGI that reads the ANI as a channel variable, 
parses out the area code and sets it as a channel variable named NPA.

Thus, you can simulate the AGI environment with a shell script. For an 
example, imagine the following script named test-my-agi.sh:

# the standard AGI environment variables
 echo agi_accountcode: 
 echo agi_callerid: 1234567890
 echo agi_calleridname: sedwards
 echo agi_callingani2: 0
 echo agi_callingpres: 0
 echo agi_callingtns: 0
 echo agi_callington: 0
 echo agi_channel: SIP/201-09456478
 echo agi_context: newline
 echo agi_dnid: *
 echo agi_enhanced: 0.0
 echo agi_extension: *
 echo agi_language: en
 echo agi_priority: 1
 echo agi_rdnis: unknown
 echo agi_request: block-ani
 echo agi_type: SIP
 echo agi_uniqueid: 1195070681.28
 echo 

# result for AGI command GET VARIABLE ANI
 echo 200 result=1 (5551234567)

# result for AGI command SET VARIABLE NPA
 echo 200 result=1

# (end of test-my-agi.sh)

You can test your agi by executing:

./test-my-agi.sh | my-agi

Since your AGI requires specific interaction with Asterisk to play the 
file this method will not allow you to fully test it, but it may help 
identify where you are violating the protocol.

This technique can even be used in an actual debugger like gdb so you can 
step through your code line by line.

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] AGI problem using mono (.Net)

2009-02-25 Thread Luis Morales
Suggest,

Use .net to do an web services and use curl+agi scripts  to integrate
your solutions.

Regards,

Luis Morales

On Wed, Feb 25, 2009 at 6:37 PM, Douglas Mortensen
d...@impalanetworks.com wrote:
 Hello.

 I have a software developer creating a .Net / mono program to use as an
 AGI script. We are having problems getting it to stream files. From what
 we can tell, it is talking to asterisk correctly when called from the
 dial plan. Its stderr output goes to the asterisk console. But asterisk
 doesn't give any indication that it receives the STREAM FILE command.
 Asterisk simply quickly executes the program and moves to the next step
 of the dial plan, as though it didn't receive any commands from the
 program.

 We know it is running, and outputting its results, because we have
 called it from within a bash script, and in doing so, I set the script
 to output stdout to a txt file for testing (like this 
 /var/log/asterisk/querylog). When we do this, the file does end up with
 the first line showing STREAM FILE filename.

 We're at a bit of a loss as to what's going on. We have checked
 filenames and are pretty sure that there are no typos and that the files
 are there. Further, I have a perl agi script using asterisk::agi that
 also does a STREAM FILE which runs without any problem. In our dial
 plan, my perl script runs, gets data from the user via the keypad, puts
 it in a channel variable, then exits, and his AGI script is immediately
 called as the next step of the dial plan receiving the channel variable
 as an argument.

 It seems that there are not as many out there using mono / .net with
 AGI. The few examples we've found online are a bit dated. Any help would
 be greatly appreciated.

 Thanks much!
 -
 Doug Mortensen
 Network Consultant
 Impala Networks Inc
 CCNA, MCP, Security+
 Linux+, Network+, A+
 .
 www.impalanetworks.com
 P: (505) 327-7300
 F: (505) 327-7545


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




-- 
-
Luis Morales
Consultor de Tecnologia
Cel: +(58)416-4242091
-
Empieza por hacer lo necesario, luego lo que es posible... y de
pronto estarás haciendo lo imposible

Leonardo Da'Vinci
-

___
-- 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] AGI problem using mono (.Net)

2009-02-25 Thread Steve Edwards
On Wed, 25 Feb 2009, Steve Edwards wrote:

 The AGI interface (is that redundant?) can be summarized as:

 1) Asterisk sends a bunch of cruft (the AGI environment variables) to your
 program's STDIN.

1a) Your program must read all of the AGI environment variables.

 2) Your program sends a request to Asterisk via STDOUT.

 3) Asterisk sends a result to your program via STDIN.

 4) Your program does something else.

 5) go to step 2.

 It's very simple, but not very forgiving.

If you output anything to STDOUT that is not expected, you're hosed. It is 
possible to write multi-threaded AGIs (eg, play a file while you are 
waiting for an answer from your credit card processor), but you can only 
have 1 request active (you've issued the request and you haven't 
received a result yet) at a time.

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] AGI Problem

2005-12-05 Thread Giovanni Miano
See:Dec3 01:16:52 WARNING[20212]: chan_iax2.c:2747 create_addr: No such host:24
Are u sure exists 24 iax device ?Try with ip 
2005/12/3, Cyrille Demaret 
[EMAIL PROTECTED]:Hi,Same result with dial:-- Executing DeadAGI(SIP/205-0231, b) in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/b-- AGI Script Executing Application: (Dial) Options: (IAX2/24)Dec3 01:16:52 WARNING[20212]: chan_iax2.c:2747 create_addr: No such host:24Dec3 01:16:52 NOTICE[20212]: app_dial.c:1011 dial_exec_full: Unable to
create channel of type 'IAX2' (cause 3 - No route to destination)== Everyone is busy/congested at this time (1:0/0/1)b: 200 result=0-- AGI Script Executing Application: (Dial) Options: (IAX2/24)
Dec3 01:16:52 WARNING[20212]: chan_iax2.c:2747 create_addr: No such host:24Dec3 01:16:52 NOTICE[20212]: app_dial.c:1011 dial_exec_full: Unable tocreate channel of type 'IAX2' (cause 3 - No route to destination)
== Everyone is busy/congested at this time (1:0/0/1)b: 200 result=1-- AGI Script Executing Application: (Dial) Options: (IAX2/24)Dec3 01:16:52 WARNING[20212]: chan_iax2.c:2747 create_addr: No such host:
24Dec3 01:16:52 NOTICE[20212]: app_dial.c:1011 dial_exec_full: Unable tocreate channel of type 'IAX2' (cause 3 - No route to destination)== Everyone is busy/congested at this time (1:0/0/1)b: 510 Invalid or unknown command
-- AGI Script b completed, returning 03 different results...Regards,Cyrille-Message d'origine-De: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] De la part de GiovanniMianoEnvoyé: vendredi 2 décembre 2005 16:18À: Asterisk Users Mailing List - Non-Commercial Discussion
Objet: Re: [Asterisk-Users] AGI ProblemI thing u cant use ChanIsAvail with exec command... as use EXEC DIAL(SIP/40) .. it isnt work2005/12/2, Cyrille Demaret 
[EMAIL PROTECTED]: Hi, I've changed that and it's the same problem. I've this problem with all applications. Results from agi are not correct. Regards, Cyrille
 -Message d'origine- De: [EMAIL PROTECTED] [mailto:
[EMAIL PROTECTED]] De la part de Giovanni Miano Envoyé: vendredi 2 décembre 2005 12:52 À: Asterisk Users Mailing List - Non-Commercial Discussion Objet: Re: [Asterisk-Users] AGI Problem
 Try print EXEC ChanIsAvail IAX2/24\n; Channel type is IAX2 not IAX Cheers 2005/12/2, Cyrille Demaret [EMAIL PROTECTED]
:  Hi,   I'm running the last CVS asterisk version (I was running an olderversion  before with the same problem) and I've a problem with agi scripts. Commands
  results are not always correct.   I've made a small agi test script that execute ChanIsAvail on an inexistent  extension:   
  #!/usr/bin/perl   $|=1;  while(STDIN) {  chomp;  last unless length($_);  if (/^agi_(\w+)\:\s+(.*)$/) {
  $AGI{$1} = $2;  }  }   # Check  print EXEC ChanIsAvail IAX/24\n;  $result = STDIN;  print VERBOSE \$result\ 0\n;
   # Check  print EXEC ChanIsAvail IAX/24\n;  $result = STDIN;  print VERBOSE \$result\ 0\n;   # Check
  print EXEC ChanIsAvail IAX/24\n;  $result = STDIN;  print VERBOSE \$result\ 0\n;  
   Result is :    -- Executing DeadAGI(SIP/200-60d2, b) in new stack  -- Launched AGI Script /var/lib/asterisk/agi-bin/b
  -- AGI Script Executing Application: (ChanIsAvail) Options: (IAX/24)  Dec2 10:29:37 WARNING[15776]: channel.c:2520 ast_request: No channel type  registered for 'IAX'
  b: 200 result=-1  -- AGI Script Executing Application: (ChanIsAvail) Options: (IAX/24)  Dec2 10:29:37 WARNING[15776]: channel.c:2520 ast_request: No channel type  registered for 'IAX'
  b: 200 result=1  -- AGI Script Executing Application: (ChanIsAvail) Options: (IAX/24)  Dec2 10:29:37 WARNING[15776]: channel.c:2520 ast_request: No channel type  registered for 'IAX'
  b: 510 Invalid or unknown command  -- AGI Script b completed, returning 0     The first result is ok (-1) but not the second and the third.
   Why do I get different results for the same command?   Thank you,   Regards,   Cyrille   ___
  --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  -- Giovanni Miano ___
 --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 ___ --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
--Giovanni Miano___--Bandwidth and Colocation provided by Easynews.com --Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit: http

Re: [Asterisk-Users] AGI Problem

2005-12-02 Thread Giovanni Miano
Try print EXEC ChanIsAvail IAX2/24\n;

Channel type is IAX2 not IAX

Cheers

2005/12/2, Cyrille Demaret [EMAIL PROTECTED]:
 Hi,

 I'm running the last CVS asterisk version (I was running an older version
 before with the same problem) and I've a problem with agi scripts. Commands
 results are not always correct.

 I've made a small agi test script that execute ChanIsAvail on an inexistent
 extension:

 
 #!/usr/bin/perl

 $|=1;
 while(STDIN) {
 chomp;
 last unless length($_);
 if (/^agi_(\w+)\:\s+(.*)$/) {
 $AGI{$1} = $2;
 }
 }

 # Check
 print EXEC ChanIsAvail IAX/24\n;
 $result = STDIN;
 print VERBOSE \$result\ 0\n;

 # Check
 print EXEC ChanIsAvail IAX/24\n;
 $result = STDIN;
 print VERBOSE \$result\ 0\n;

 # Check
 print EXEC ChanIsAvail IAX/24\n;
 $result = STDIN;
 print VERBOSE \$result\ 0\n;
 

 Result is :

 
-- Executing DeadAGI(SIP/200-60d2, b) in new stack
 -- Launched AGI Script /var/lib/asterisk/agi-bin/b
 -- AGI Script Executing Application: (ChanIsAvail) Options: (IAX/24)
 Dec  2 10:29:37 WARNING[15776]: channel.c:2520 ast_request: No channel type
 registered for 'IAX'
   b: 200 result=-1
 -- AGI Script Executing Application: (ChanIsAvail) Options: (IAX/24)
 Dec  2 10:29:37 WARNING[15776]: channel.c:2520 ast_request: No channel type
 registered for 'IAX'
   b: 200 result=1
 -- AGI Script Executing Application: (ChanIsAvail) Options: (IAX/24)
 Dec  2 10:29:37 WARNING[15776]: channel.c:2520 ast_request: No channel type
 registered for 'IAX'
   b: 510 Invalid or unknown command
 -- AGI Script b completed, returning 0
 

 The first result is ok (-1) but not the second and the third.

 Why do I get different results for the same command?

 Thank you,

 Regards,

 Cyrille

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



--
Giovanni Miano
___
--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 Problem

2005-12-02 Thread Cyrille Demaret
Hi,

I've changed that and it's the same problem. I've this problem with all
applications. Results from agi are not correct.

Regards,

Cyrille

-Message d'origine-
De : [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] De la part de Giovanni
Miano
Envoyé : vendredi 2 décembre 2005 12:52
À : Asterisk Users Mailing List - Non-Commercial Discussion
Objet : Re: [Asterisk-Users] AGI Problem

Try print EXEC ChanIsAvail IAX2/24\n;

Channel type is IAX2 not IAX

Cheers

2005/12/2, Cyrille Demaret [EMAIL PROTECTED]:
 Hi,

 I'm running the last CVS asterisk version (I was running an older version
 before with the same problem) and I've a problem with agi scripts.
Commands
 results are not always correct.

 I've made a small agi test script that execute ChanIsAvail on an
inexistent
 extension:

 
 #!/usr/bin/perl

 $|=1;
 while(STDIN) {
 chomp;
 last unless length($_);
 if (/^agi_(\w+)\:\s+(.*)$/) {
 $AGI{$1} = $2;
 }
 }

 # Check
 print EXEC ChanIsAvail IAX/24\n;
 $result = STDIN;
 print VERBOSE \$result\ 0\n;

 # Check
 print EXEC ChanIsAvail IAX/24\n;
 $result = STDIN;
 print VERBOSE \$result\ 0\n;

 # Check
 print EXEC ChanIsAvail IAX/24\n;
 $result = STDIN;
 print VERBOSE \$result\ 0\n;
 

 Result is :

 
-- Executing DeadAGI(SIP/200-60d2, b) in new stack
 -- Launched AGI Script /var/lib/asterisk/agi-bin/b
 -- AGI Script Executing Application: (ChanIsAvail) Options: (IAX/24)
 Dec  2 10:29:37 WARNING[15776]: channel.c:2520 ast_request: No channel
type
 registered for 'IAX'
   b: 200 result=-1
 -- AGI Script Executing Application: (ChanIsAvail) Options: (IAX/24)
 Dec  2 10:29:37 WARNING[15776]: channel.c:2520 ast_request: No channel
type
 registered for 'IAX'
   b: 200 result=1
 -- AGI Script Executing Application: (ChanIsAvail) Options: (IAX/24)
 Dec  2 10:29:37 WARNING[15776]: channel.c:2520 ast_request: No channel
type
 registered for 'IAX'
   b: 510 Invalid or unknown command
 -- AGI Script b completed, returning 0
 

 The first result is ok (-1) but not the second and the third.

 Why do I get different results for the same command?

 Thank you,

 Regards,

 Cyrille

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



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

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

2005-12-02 Thread Giovanni Miano
I thing u cant use ChanIsAvail with exec command

... as use EXEC DIAL(SIP/40) .. it isnt work

2005/12/2, Cyrille Demaret [EMAIL PROTECTED]:
 Hi,

 I've changed that and it's the same problem. I've this problem with all
 applications. Results from agi are not correct.

 Regards,

 Cyrille

 -Message d'origine-
 De: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] De la part de Giovanni
 Miano
 Envoyé: vendredi 2 décembre 2005 12:52
 À: Asterisk Users Mailing List - Non-Commercial Discussion
 Objet: Re: [Asterisk-Users] AGI Problem

 Try print EXEC ChanIsAvail IAX2/24\n;

 Channel type is IAX2 not IAX

 Cheers

 2005/12/2, Cyrille Demaret [EMAIL PROTECTED]:
  Hi,
 
  I'm running the last CVS asterisk version (I was running an older version
  before with the same problem) and I've a problem with agi scripts.
 Commands
  results are not always correct.
 
  I've made a small agi test script that execute ChanIsAvail on an
 inexistent
  extension:
 
  
  #!/usr/bin/perl
 
  $|=1;
  while(STDIN) {
  chomp;
  last unless length($_);
  if (/^agi_(\w+)\:\s+(.*)$/) {
  $AGI{$1} = $2;
  }
  }
 
  # Check
  print EXEC ChanIsAvail IAX/24\n;
  $result = STDIN;
  print VERBOSE \$result\ 0\n;
 
  # Check
  print EXEC ChanIsAvail IAX/24\n;
  $result = STDIN;
  print VERBOSE \$result\ 0\n;
 
  # Check
  print EXEC ChanIsAvail IAX/24\n;
  $result = STDIN;
  print VERBOSE \$result\ 0\n;
  
 
  Result is :
 
  
 -- Executing DeadAGI(SIP/200-60d2, b) in new stack
  -- Launched AGI Script /var/lib/asterisk/agi-bin/b
  -- AGI Script Executing Application: (ChanIsAvail) Options: (IAX/24)
  Dec  2 10:29:37 WARNING[15776]: channel.c:2520 ast_request: No channel
 type
  registered for 'IAX'
b: 200 result=-1
  -- AGI Script Executing Application: (ChanIsAvail) Options: (IAX/24)
  Dec  2 10:29:37 WARNING[15776]: channel.c:2520 ast_request: No channel
 type
  registered for 'IAX'
b: 200 result=1
  -- AGI Script Executing Application: (ChanIsAvail) Options: (IAX/24)
  Dec  2 10:29:37 WARNING[15776]: channel.c:2520 ast_request: No channel
 type
  registered for 'IAX'
b: 510 Invalid or unknown command
  -- AGI Script b completed, returning 0
  
 
  The first result is ok (-1) but not the second and the third.
 
  Why do I get different results for the same command?
 
  Thank you,
 
  Regards,
 
  Cyrille
 
  ___
  --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
 


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

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



--
Giovanni Miano
___
--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 Problem

2005-12-02 Thread Philipp von Klitzing
Hi!


 The first result is ok (-1) but not the second and the third.
 Why do I get different results for the same command?

Hm... u might want to try this:


# Check
print EXEC ChanIsAvail IAX/24\n;
$result = STDIN;
print VERBOSE \$result\ 0\n;
$result = STDIN;

# Check
print EXEC ChanIsAvail IAX/24\n;
$result = STDIN;
print VERBOSE \$result\ 0\n;
$result = STDIN;

# Check
print EXEC ChanIsAvail IAX/24\n;
$result = STDIN;
print VERBOSE \$result\ 0\n;
$result = STDIN;


Philipp


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

2005-12-02 Thread Cyrille Demaret
Hi,

Same result with dial:

-- Executing DeadAGI(SIP/205-0231, b) in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/b
-- AGI Script Executing Application: (Dial) Options: (IAX2/24)
Dec  3 01:16:52 WARNING[20212]: chan_iax2.c:2747 create_addr: No such host:
24
Dec  3 01:16:52 NOTICE[20212]: app_dial.c:1011 dial_exec_full: Unable to
create channel of type 'IAX2' (cause 3 - No route to destination)
  == Everyone is busy/congested at this time (1:0/0/1)
  b: 200 result=0
-- AGI Script Executing Application: (Dial) Options: (IAX2/24)
Dec  3 01:16:52 WARNING[20212]: chan_iax2.c:2747 create_addr: No such host:
24
Dec  3 01:16:52 NOTICE[20212]: app_dial.c:1011 dial_exec_full: Unable to
create channel of type 'IAX2' (cause 3 - No route to destination)
  == Everyone is busy/congested at this time (1:0/0/1)
  b: 200 result=1
-- AGI Script Executing Application: (Dial) Options: (IAX2/24)
Dec  3 01:16:52 WARNING[20212]: chan_iax2.c:2747 create_addr: No such host:
24
Dec  3 01:16:52 NOTICE[20212]: app_dial.c:1011 dial_exec_full: Unable to
create channel of type 'IAX2' (cause 3 - No route to destination)
  == Everyone is busy/congested at this time (1:0/0/1)
  b: 510 Invalid or unknown command
-- AGI Script b completed, returning 0

3 different results...

Regards,

Cyrille

-Message d'origine-
De : [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] De la part de Giovanni
Miano
Envoyé : vendredi 2 décembre 2005 16:18
À : Asterisk Users Mailing List - Non-Commercial Discussion
Objet : Re: [Asterisk-Users] AGI Problem

I thing u cant use ChanIsAvail with exec command

... as use EXEC DIAL(SIP/40) .. it isnt work

2005/12/2, Cyrille Demaret [EMAIL PROTECTED]:
 Hi,

 I've changed that and it's the same problem. I've this problem with all
 applications. Results from agi are not correct.

 Regards,

 Cyrille

 -Message d'origine-
 De: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] De la part de Giovanni
 Miano
 Envoyé: vendredi 2 décembre 2005 12:52
 À: Asterisk Users Mailing List - Non-Commercial Discussion
 Objet: Re: [Asterisk-Users] AGI Problem

 Try print EXEC ChanIsAvail IAX2/24\n;

 Channel type is IAX2 not IAX

 Cheers

 2005/12/2, Cyrille Demaret [EMAIL PROTECTED]:
  Hi,
 
  I'm running the last CVS asterisk version (I was running an older
version
  before with the same problem) and I've a problem with agi scripts.
 Commands
  results are not always correct.
 
  I've made a small agi test script that execute ChanIsAvail on an
 inexistent
  extension:
 
  
  #!/usr/bin/perl
 
  $|=1;
  while(STDIN) {
  chomp;
  last unless length($_);
  if (/^agi_(\w+)\:\s+(.*)$/) {
  $AGI{$1} = $2;
  }
  }
 
  # Check
  print EXEC ChanIsAvail IAX/24\n;
  $result = STDIN;
  print VERBOSE \$result\ 0\n;
 
  # Check
  print EXEC ChanIsAvail IAX/24\n;
  $result = STDIN;
  print VERBOSE \$result\ 0\n;
 
  # Check
  print EXEC ChanIsAvail IAX/24\n;
  $result = STDIN;
  print VERBOSE \$result\ 0\n;
  
 
  Result is :
 
  
 -- Executing DeadAGI(SIP/200-60d2, b) in new stack
  -- Launched AGI Script /var/lib/asterisk/agi-bin/b
  -- AGI Script Executing Application: (ChanIsAvail) Options: (IAX/24)
  Dec  2 10:29:37 WARNING[15776]: channel.c:2520 ast_request: No channel
 type
  registered for 'IAX'
b: 200 result=-1
  -- AGI Script Executing Application: (ChanIsAvail) Options: (IAX/24)
  Dec  2 10:29:37 WARNING[15776]: channel.c:2520 ast_request: No channel
 type
  registered for 'IAX'
b: 200 result=1
  -- AGI Script Executing Application: (ChanIsAvail) Options: (IAX/24)
  Dec  2 10:29:37 WARNING[15776]: channel.c:2520 ast_request: No channel
 type
  registered for 'IAX'
b: 510 Invalid or unknown command
  -- AGI Script b completed, returning 0
  
 
  The first result is ok (-1) but not the second and the third.
 
  Why do I get different results for the same command?
 
  Thank you,
 
  Regards,
 
  Cyrille
 
  ___
  --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
 


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

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



--
Giovanni Miano
___
--Bandwidth

Re: [Asterisk-Users] AGI Problem

2005-10-17 Thread Obelix
Quoting René Enskat [Teamware GmbH] [EMAIL PROTECTED]:

In my experience most AGI problems I had came from other info sent to the
terminal via verbose commands and other stdout output. There is some info on
the voip-info wiki about using AGI.

I use the phpagi 2 library, and carefully setting up the agi-verbose commmands
fixes my 510 problems


 Hmm still have problems with the get variable with PHP i have this error
 now separated with a script:

 Sending string GET VARIABLE CALLERIDNUM\n to Asterisk...
 Wroten bytes to STDOUT: 25

 Reading 80 bytes response from Asterisk...
 Received response: 510 Invalid or unknown command



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

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






This message was sent using IMP, the Internet Messaging Program.

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

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


Re: [Asterisk-Users] AGI problem with library path

2005-09-12 Thread Olivier Perrin
You can add your library path in the /etc/init.d/asterisk script and
restart asterisk via service.
or
You also can 
1/ add your library path in your /etc/ld.so.conf
2/ type ldconfig  as root.
3/ restart asterisk via service


 Hi List,
 
 My AGI seems work well in asterisk -vvvc mode,
 other than that it doesn't work.
 
 Its seems to me, when I run asterisk as daemon (service asterisk start  ..
 on fc4), it doesn't know about my library path.
 
 How can pass libray path to my AGI script or asterisk?
 
 Thanks___
 --Bandwidth and Colocation sponsored by Easynews.com --
 
 Asterisk-Users mailing list
 Asterisk-Users@lists.digium.com
 http://lists.digium.com/mailman/listinfo/asterisk-users
 To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users

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

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


Re: [Asterisk-Users] agi problem

2005-05-03 Thread Moises Silva
Hi Smadi. I have tested the script in my box and seems to be working
just fine. By the way, in any programming language, the way to get the
asterisk environment vars, and in general all the communication is
through STDIN, STDOUT and STDERR

try to give us more info so we can help you

best regards

On 5/3/05, M.N.A.Smadi [EMAIL PROTECTED] wrote:
 hi;
 
 am using an agi script to do some call forwarding.  I got the following
 pyton script off http://home.cogeco.ca/~camstuff/agi.html:
 #!/usr/bin/python
 
 import sys,string
 
 class AGI:
 
 Class AGI facilitates writing AGI scripts in Python.
 
 Exported functions:
 
 Write(message):
 Writes message to Asterisk Console.
 
 Cmd(command):
 Send command to Asterisk, read result.
 The result is a two element tuple:
 [0] A text string giving the entire result returned by
 Asterisk
 [1] The result= integer extracted from the result line
 
 If we get an unhappy response from Asterisk or if the result
 returned to the right of the equals sign is not an integer we
 issue an error message and terminate the script.
 
 Exported Variables:
 
 env
 Dictionary containing the various environment startup items, as
 passed to us by Asterisk.
 
 
 def Write(self,data):
 
 Write unbuffered line output to STDERR.
 Ensures data is flushed out.
 
 sys.stderr.write(str(data) + \n)
 sys.stderr.flush()
 
 def Cmd(self,command):
 
 Send an AGI command to Asterisk; read back the response.
 The result is a two element tuple:
 [0] A text string giving the entire result returned by Asterisk
 [1] The result= integer extracted from the result line
 
 If we get an unhappy response from Asterisk or if the result
 returned to the right of the equals sign is not an integer we
 issue an error message and terminate the script.
 
 try:
 sys.stdout.write(str(command) + \n)
 sys.stdout.flush()
 Response = sys.stdin.readline()
 if Response[:11]  '200 result=':
 #we didn't get a happy response for AGI
 raise AgiError
 #accumulate integer portion
 J = 11
 while J  len(Response) and (Response[J] in '0123456789'):
 J += 1
 res = Response[11:J]
 try:
 ResInt = int(res)
 except ValueError:
 #there is no integer immediatly to the right of the
 equal sign
 raise AgiError
 except AgiError:
 self.Error('Unexpected response to AGI command.')
 self.Error('Command: %s'%command)
 self.Error('Response: %s'%Response)
 self.Error('Script terminated.')
 sys.exit()
 return (Response,ResInt)
 
 def __init__(self):
 
 Read until blank line to get the AGI environment.
 The lines read are used to build the dictionary 'env'.
 
 self.env = {1:'moe',2:'joe'}
 while 1:
 line = string.strip(sys.stdin.readline())
 if line == '':
 #blank line signals end
 break
 key,data = string.split(line,':')
 key = string.strip(key)
 data = string.strip(data)
 if key  '':
 self.env[key] = data
 
 =
 
 however i think there is something wrong with initialization code, namely:
 
 def __init__(self):
 
 Read until blank line to get the AGI environment.
 The lines read are used to build the dictionary 'env'.
 
 self.env = {1:'moe',2:'joe'}
 while 1:
 line = string.strip(sys.stdin.readline())
 if line == '':
 #blank line signals end
 break
 key,data = string.split(line,':')
 key = string.strip(key)
 data = string.strip(data)
 if key  '':
 self.env[key] = data
 
 because when i replace that piece of code with my own hardcode variables
 things work just fine.
 
 Now my question is does anybody have a clue why this code is not
 working? or alternatively how can i read the environment variables in
 python?
 
 thanks
 m.smadi
 ___
 Asterisk-Users mailing list
 Asterisk-Users@lists.digium.com
 http://lists.digium.com/mailman/listinfo/asterisk-users
 To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
 


-- 
Su nombre es GNU/Linux, no solamente Linux, mas info en http://www.gnu.org;
___
Asterisk-Users mailing list
Asterisk-Users@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options 

RE: [Asterisk-Users] AGI problem (crash) in RH9

2003-10-21 Thread Ívar Ragnarsson
Hi 

Thank you everyone for your help.

I got Asterisk to stop crashing by installing a 2.4.22 kernel.

Best regards,
Ívar Ragnarsson


-Original Message-
From: Michael T Farnworth [mailto:[EMAIL PROTECTED]
Sent: 17. október 2003 22:21
To: '[EMAIL PROTECTED]'
Subject: RE: [Asterisk-Users] AGI problem (crash) in RH9


On Fri, 17 Oct 2003, mattf wrote:

 Redhat has EVERYTHING set to LANG=UTF-8 and it screws up all sorts of perl
 stuff, and several other pre-written programs in other languages too

It is a pain, and it even breaks man pages and all sorts of other things 
in my experience.  I recommend disabling the UTF-8 default by editing:

/etc/sysconfig/i18n

The top line probably reads something like:

LANG=en_US.UTF-8

change it to:

LANG=en_US

or en_GB if you are a UK person.

You probably need to reboot after doing that.

Michael

 
 
 MATT---

___
Asterisk-Users mailing list
[EMAIL PROTECTED]
http://lists.digium.com/mailman/listinfo/asterisk-users
___
Asterisk-Users mailing list
[EMAIL PROTECTED]
http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] AGI problem (crash) in RH9

2003-10-17 Thread Nicolas Gudino
Hi Ivar,

Try putting this line before launching asterisk:

export LD_ASSUME_KERNEL=2.4.1

Best regards,

On Thu, 2003-10-16 at 06:48, var Ragnarsson wrote:
 Hi
 
 Every time I hangup on my AGI script Asterisk crashes if it is not running
 in console mode. 
 (happens when using python and perl AGI scripts)
 
 I'm desparatly trying to get my employer to let me use Asterisk.  So I must
 get this to work.  
 I've posted about this before, I'm sorry, but I'm desperate.
 
   I'm running RedHat 9.0 (kernel 2.4.20-8 everything else updated)
   I'm using Netmeeting to test
-- 
Nicolas Gudino [EMAIL PROTECTED]
House Internet S.R.L.

___
Asterisk-Users mailing list
[EMAIL PROTECTED]
http://lists.digium.com/mailman/listinfo/asterisk-users


RE: [Asterisk-Users] AGI problem (crash) in RH9

2003-10-17 Thread Ray Burkholder
You may wish to upgrade your kernel to 2.4.20-20.9 through 'up2date'.


Regards,
Ray Burkholder



 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of 
 Nicolas Gudino
 Sent: October 17, 2003 16:17
 To: [EMAIL PROTECTED]
 Subject: Re: [Asterisk-Users] AGI problem (crash) in RH9
 
 
 Hi Ivar,
 
 Try putting this line before launching asterisk:
 
 export LD_ASSUME_KERNEL=2.4.1
 
 Best regards,
 
 On Thu, 2003-10-16 at 06:48, Ívar Ragnarsson wrote:
  Hi
  
  Every time I hangup on my AGI script Asterisk crashes if it is not 
  running in console mode. (happens when using python and perl AGI 
  scripts)
  
  I'm desparatly trying to get my employer to let me use 
 Asterisk.  So I 
  must get this to work.
  I've posted about this before, I'm sorry, but I'm desperate.
  
  I'm running RedHat 9.0 (kernel 2.4.20-8 everything else updated)
  I'm using Netmeeting to test
 -- 
 Nicolas Gudino [EMAIL PROTECTED]
 House Internet S.R.L.
 
 ___
 Asterisk-Users mailing list
 [EMAIL PROTECTED] 
 http://lists.digium.com/mailman/listinfo/aster isk-users
 
 -- 
 
 Scanned for viruses and dangerous content at 
 
http://www.oneunified.net and is believed to be clean.


-- 
Scanned for viruses and dangerous content at 
http://www.oneunified.net and is believed to be clean.

___
Asterisk-Users mailing list
[EMAIL PROTECTED]
http://lists.digium.com/mailman/listinfo/asterisk-users


RE: [Asterisk-Users] AGI problem (crash) in RH9

2003-10-17 Thread mattf
If you're using perl on RedHat 9 make sure you put this command somewhere in
your boot scheme:

export LANG=C


or at least execute it before running perl scripts. 

Redhat has EVERYTHING set to LANG=UTF-8 and it screws up all sorts of perl
stuff, and several other pre-written programs in other languages too


MATT---



-Original Message-
From: Ray Burkholder [mailto:[EMAIL PROTECTED]
Sent: Friday, October 17, 2003 5:16 PM
To: [EMAIL PROTECTED]
Subject: RE: [Asterisk-Users] AGI problem (crash) in RH9


You may wish to upgrade your kernel to 2.4.20-20.9 through 'up2date'.


Regards,
Ray Burkholder



 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of 
 Nicolas Gudino
 Sent: October 17, 2003 16:17
 To: [EMAIL PROTECTED]
 Subject: Re: [Asterisk-Users] AGI problem (crash) in RH9
 
 
 Hi Ivar,
 
 Try putting this line before launching asterisk:
 
 export LD_ASSUME_KERNEL=2.4.1
 
 Best regards,
 
 On Thu, 2003-10-16 at 06:48, Ívar Ragnarsson wrote:
  Hi
  
  Every time I hangup on my AGI script Asterisk crashes if it is not 
  running in console mode. (happens when using python and perl AGI 
  scripts)
  
  I'm desparatly trying to get my employer to let me use 
 Asterisk.  So I 
  must get this to work.
  I've posted about this before, I'm sorry, but I'm desperate.
  
  I'm running RedHat 9.0 (kernel 2.4.20-8 everything else updated)
  I'm using Netmeeting to test
 -- 
 Nicolas Gudino [EMAIL PROTECTED]
 House Internet S.R.L.
 
 ___
 Asterisk-Users mailing list
 [EMAIL PROTECTED] 
 http://lists.digium.com/mailman/listinfo/aster isk-users
 
 -- 
 
 Scanned for viruses and dangerous content at 
 
http://www.oneunified.net and is believed to be clean.


-- 
Scanned for viruses and dangerous content at 
http://www.oneunified.net and is believed to be clean.

___
Asterisk-Users mailing list
[EMAIL PROTECTED]
http://lists.digium.com/mailman/listinfo/asterisk-users
___
Asterisk-Users mailing list
[EMAIL PROTECTED]
http://lists.digium.com/mailman/listinfo/asterisk-users


RE: [Asterisk-Users] AGI problem (crash) in RH9

2003-10-17 Thread Michael T Farnworth
On Fri, 17 Oct 2003, mattf wrote:

 Redhat has EVERYTHING set to LANG=UTF-8 and it screws up all sorts of perl
 stuff, and several other pre-written programs in other languages too

It is a pain, and it even breaks man pages and all sorts of other things 
in my experience.  I recommend disabling the UTF-8 default by editing:

/etc/sysconfig/i18n

The top line probably reads something like:

LANG=en_US.UTF-8

change it to:

LANG=en_US

or en_GB if you are a UK person.

You probably need to reboot after doing that.

Michael

 
 
 MATT---

___
Asterisk-Users mailing list
[EMAIL PROTECTED]
http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] AGI problem (crash)

2003-10-16 Thread Nicolas Gudino
Hi,

I have the same problem, Im also running RH 9. But Im using SIP only
with Cisco ATAs. There are reports of asterisk not doing well with
RedHat because of the new threads handling in RH kernel. Maybe compiling
a fresh rpm from kernel.org will solve the problem.

Testing my AGI script (writen in perl) I had a dial command (not
background), and I could cause asterisk to crash when hanging up when
inside the script. But now I moved the dial command to the extensions
file (setting a variable inside the script to pass to the dial command
in the extension file) and the problem went away. Maybe it is because
its difficult to hang up exactly during the execution of the script that
runs and exits really fast now that it is not doing the dial.

I will try to compile a fresh kernel and see if the problem persists,
and post my results here. Regards,


On Thu, 2003-10-16 at 06:48, var Ragnarsson wrote:
 Hi
 
 Every time I hangup on my AGI script Asterisk crashes if it is not running
 in console mode. 
 (happens when using python and perl AGI scripts)
 
 I'm desparatly trying to get my employer to let me use Asterisk.  So I must
 get this to work.  
 I've posted about this before, I'm sorry, but I'm desperate.
 
   I'm running RedHat 9.0 (kernel 2.4.20-8 everything else updated)
   I'm using Netmeeting to test
   I use H.323 only.  I've tried using chan_h323 and chan_oh323.
 (Output is from oh323)
   Newest zaptel libpri asterisk from CVS
 
 
 Has anyone had this problem?
 Can anyone confirm this failure on a similar system? (that is running the
 script and hanging up while the number is beeing read.)
 Can anyone test this on RedHat 8 please?
 Are there any log files that could give clues to what is happening?
 Should I post this on the dev mailing list?
 
 
 Following are outputs from the console, a sample script and my config files.
 
 ++
 output from asterisk -vvv 
 ++
 [chan_oh323.so] = (OpenH323 Channel Driver)
   == Parsing '/etc/asterisk/rtp.conf': Found
   == Parsing '/etc/asterisk/oh323.conf': Found
   0:00.007 OpenH323 Wrapper OpenH323 WrapperVersion
 0.0alpha0 by inAccess Networks (www.inaccessnetworks.com) on Unix Linux
 (2.4.20-8-i686) at 2003/10/15 15:34:17.735
 WrapH323EndPoint::WrapH323EndPoint: Compile-time libraries OpenH323 v1.12.0,
 PWlib v1.5.0
   == Registered channel type 'OH323' (OpenH323 Channel Driver)
   == OpenH323 Channel Ready (v0.5.5)
   == Parsing '/etc/asterisk/enum.conf': Found
 Asterisk Ready.
 WrapH323Connection::WrapH323Connection: WrapH323Connection created.
 -- Executing Answer(H323:25128, ) in new stack
 PAsteriskAudioDelay::PAsteriskAudioDelay: Object initialized.
 PAsteriskAudioDelay::PAsteriskAudioDelay: Object initialized.
 PAsteriskSoundChannel::PAsteriskSoundChannel: Object initialized.
 PAsteriskAudioDelay::PAsteriskAudioDelay: Object initialized.
 PAsteriskAudioDelay::PAsteriskAudioDelay: Object initialized.
 PAsteriskSoundChannel::PAsteriskSoundChannel: Object initialized.
 -- Executing AGI(H323:25128, agi-pytest2.py) in new stack
 -- Launched AGI Script /var/lib/asterisk/agi-bin/agi-pytest2.py
 -- Playing 'digits/1'
 -- Playing 'digits/hundred'
 PAsteriskSoundChannel::PAsteriskSoundChannel: Object deleted.
 PAsteriskAudioDelay::PAsteriskAudioDelay: Object deleted.
 PAsteriskAudioDelay::PAsteriskAudioDelay: Object deleted.
 PAsteriskSoundChannel::PAsteriskSoundChannel: Object deleted.
 PAsteriskAudioDelay::PAsteriskAudioDelay: Object deleted.
 PAsteriskAudioDelay::PAsteriskAudioDelay: Object deleted.
   0:05.269 H323 Cleaner H323Connection
 ip$192.168.0.100:1712/25128 terminated.
   == Spawn extension (default, 147, 2) exited non-zero on 'H323:25128'
 -- Hungup 'H323:25128'
 Received 200 result=-1
 
 
 ++
 output from asterisk -vvvc 
 ++
  [chan_oh323.so] = (OpenH323 Channel Driver)
   == Parsing '/etc/asterisk/rtp.conf': Found
   == Parsing '/etc/asterisk/oh323.conf': Found
   0:00.008 OpenH323 Wrapper OpenH323 WrapperVersion
 0.0alpha0 by inAccess Networks (www.inaccessnetworks.com) on Unix Linux
 (2.4.20-8-i686) at 2003/10/15 15:35:11.096
 WrapH323EndPoint::WrapH323EndPoint: Compile-time libraries OpenH323 v1.12.0,
 PWlib v1.5.0
   == Registered channel type 'OH323' (OpenH323 Channel Driver)
   == OpenH323 Channel Ready (v0.5.5)
   == Parsing '/etc/asterisk/enum.conf': Found
 Asterisk Ready.
 *CLI WrapH323Connection::WrapH323Connection: WrapH323Connection created.
 -- Executing Answer(H323:25129, ) in new stack
 PAsteriskAudioDelay::PAsteriskAudioDelay: Object initialized.
 PAsteriskAudioDelay::PAsteriskAudioDelay: Object initialized.
 PAsteriskSoundChannel::PAsteriskSoundChannel: Object initialized.
 PAsteriskAudioDelay::PAsteriskAudioDelay: Object initialized.