Steven J. Sobol
2003-Sep-25 17:48 UTC
[Asterisk-Users] AGI: getting the return code from an exec()'d application?
So I hacked up the Dial app to return a numeric return code instead of changing contexts based on a number being busy or unanswered. The purpose for this modified dial app, which I call AGIDial, is to help me concoct a "follow-me" type of application. The app returns -1 for a completed call, 0 for unanswered, or 1 for busy. Well, I hooked the thing up to an AGI script that uses perl and AGI.pm, and ran some tests. The AGIDial app is definitely returning the right status codes and is able to differentiate between the three types of call termination. But the AGI script always reports a status code of 0. And I figured out why. $AGI->exec() seems to grab the return code of a Perl print() command which outputs the command to the server - but the return code of the print() is not what I want - the return code of the application is what I want. How do I exec an app through AGI and get *its* return code? -- JustThe.net Internet & Multimedia Services 22674 Motnocab Road * Apple Valley, CA 92307-1950 Steve Sobol, Proprietor 888.480.4NET (4638) * 248.724.4NET * sjsobol@JustThe.net
Ing. Angel Gomez
2003-Sep-25 18:16 UTC
[Asterisk-Users] AGI: getting the return code from an exec()'d application?
SET VARIABLE var value ? Inside the AGI Steven J. Sobol wrote:>So I hacked up the Dial app to return a numeric return code instead of >changing contexts based on a number being busy or unanswered. The purpose >for this modified dial app, which I call AGIDial, is to help me concoct a >"follow-me" type of application. The app returns -1 for a completed call, >0 for unanswered, or 1 for busy. > >Well, I hooked the thing up to an AGI script that uses perl and AGI.pm, >and ran some tests. > >The AGIDial app is definitely returning the right status codes and is able >to differentiate between the three types of call termination. > >But the AGI script always reports a status code of 0. > >And I figured out why. $AGI->exec() seems to grab the return code of a >Perl print() command which outputs the command to the server - but the >return code of the print() is not what I want - the return code of the >application is what I want. > >How do I exec an app through AGI and get *its* return code? > > >
Chee Foong
2003-Sep-25 18:50 UTC
[Asterisk-Users] AGI: getting the return code from an exec()'d application?
Hello Steven, I am planing to do the same thing: make dial return correct dial status and use agi to detect it. Is it possible for you to share the modified dial source. If not, can you provide some pointers on how to hack it? I am no real C programmer :( If i am not mistaken, result return by exec is like: 200 Result=<number> <additional information, if any> does the status appear in the 'additional ionformation' portion? ----- Original Message ----- From: "Steven J. Sobol" <sjsobol@JustThe.net> To: <asterisk-users@lists.digium.com> Sent: Friday, September 26, 2003 8:48 AM Subject: [Asterisk-Users] AGI: getting the return code from an exec()'d application?> > So I hacked up the Dial app to return a numeric return code instead of > changing contexts based on a number being busy or unanswered. The purpose > for this modified dial app, which I call AGIDial, is to help me concoct a > "follow-me" type of application. The app returns -1 for a completed call, > 0 for unanswered, or 1 for busy. > > Well, I hooked the thing up to an AGI script that uses perl and AGI.pm, > and ran some tests. > > The AGIDial app is definitely returning the right status codes and is able > to differentiate between the three types of call termination. > > But the AGI script always reports a status code of 0. > > And I figured out why. $AGI->exec() seems to grab the return code of a > Perl print() command which outputs the command to the server - but the > return code of the print() is not what I want - the return code of the > application is what I want. > > How do I exec an app through AGI and get *its* return code? > > -- > JustThe.net Internet & Multimedia Services > 22674 Motnocab Road * Apple Valley, CA 92307-1950 > Steve Sobol, Proprietor > 888.480.4NET (4638) * 248.724.4NET * sjsobol@JustThe.net > > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users >