[asterisk-users] use dial plan passed arg value in C agi code

Eric "ManxPower" Wieling eric at fnords.org
Fri Nov 2 16:10:07 CDT 2007


James FitzGibbon wrote:
> On 11/2/07, Arpit Mehta <am2866 at columbia.edu> wrote:
>> Hello * users,
>>
>> I know that passing variable in the AGI script is by
>>
>> exten => _.,1,AGI(simple_c_prgm|123|789)  ; 123, 789 are arguments being
>> passed and simple_c_prgm is C code
>>
>> Now how will I receive these variables within C code ? Is it by the same
>> way arguments are passed in command line to C by using argc and argv or
>> there is more to be done than that?
> 
> 
>>From the wiki (http://www.voip-info.org/wiki-Asterisk+AGI):
> 
> When Asterisk starts an AGI script, it feeds the channel variables to the
> script on standard input. The variable names are prefixed with "agi_" and
> are separated from their values by a colon and a space. Though the actual
> channel variables may be in the upper case, the names passed to an AGI
> script are all lower case. Also, some channel variable names as passed to
> AGI script differ from the current variable names used in the dial plan.
> 
> These docs, while dated, are also useful:
> 
> http://www.bitflipper.ca/Documentation/agi.html
> 
> It even includes code for getting at variables from several languages.

Sadly those docs cover the situation of this:

   exten => 666,1,Set(MY_VAR=fred)
   exten => 666,n,AGI(simple_c_prgm)

Not this:
   exten => 666,1,AGI(simple_c_prgm|123|789)




More information about the asterisk-users mailing list