Pass parameters to AGI app?

Get help with installing, upgrading and running Asterisk.

Moderators: muppetmaster, Moderator, Support

Pass parameters to AGI app?

Postby ecuguru » Mon Sep 25, 2006 4:51 am

Hi,
Can someone tell me how I can pass / collect parameters from Dialpad to an AGI program? I've seen some examples through the STDIN, but supposedly in the initial AGI call you can pass startup parameters to the code.

Thanks!
ecuguru
Newsterisk
 
Posts: 20
Joined: Thu Dec 21, 2006 10:56 pm

Postby vinod.vijayan » Mon Sep 25, 2006 5:14 am

vinod-asterisk*CLI> show application AGI
vinod-asterisk*CLI>
-= Info about application 'AGI' =-

[Synopsis]
Executes an AGI compliant application

[Description]
[E|Dead]AGI(command|args): Executes an Asterisk Gateway Interface compliant
program on a channel. AGI allows Asterisk to launch external programs
written in any language to control a telephony channel, play audio,
read DTMF digits, etc. by communicating with the AGI protocol on stdin
and stdout.
Returns -1 on hangup (except for DeadAGI) or if application requested
hangup, or 0 on non-hangup exit.
Using 'EAGI' provides enhanced AGI, with incoming audio available out of band
on file descriptor 3

Use the CLI command 'show agi' to list available agi commands
Today is a new day.
vinod.vijayan
Oldsterisk
 
Posts: 223
Joined: Thu Dec 21, 2006 10:56 pm

Postby ecuguru » Mon Sep 25, 2006 1:40 pm

Thanks, but calling the app isn't the problem, it's passing parameters on execution. For example, I've got:

exten => 44,2,AGI(agi-test2.agi|"Parameters")

Which I read was supposed to pass the string "Parameters" to the app, but it doesn't appear to show up. Ideally I'd like to do something like:

exten => 44,2,AGI(agi-test2.agi|${EXTEN})

Any ideas?
ecuguru
Newsterisk
 
Posts: 20
Joined: Thu Dec 21, 2006 10:56 pm

Postby Hamster » Tue Sep 26, 2006 7:31 am

exten => 44,2,AGI(agi-test2.agi,${EXTEN},"hi")

gives you the value of EXTEN in $ARGV[0] and "hi" in $ARGV[1]

Hamster
Hamster
Newsterisk
 
Posts: 9
Joined: Thu Dec 21, 2006 10:56 pm

Postby ecuguru » Tue Sep 26, 2006 2:38 pm

Hamster --> Perfect! Worked great, Thanks!!
ecuguru
Newsterisk
 
Posts: 20
Joined: Thu Dec 21, 2006 10:56 pm


Return to Asterisk Support

Who is online

Users browsing this forum: Exabot [Bot] and 36 guests