[asterisk-users] Passing parameter from executable program to asterisk dialplan

Muro, Sam research at businesstz.com
Sun Jul 25 11:18:27 CDT 2010


Steve Edwards wrote:
> On Sun, 25 Jul 2010, Muro, Sam wrote:
>
>> I am having a problem understanding the way to retrieve some parameters
>> to asterisk via AGI or what ever method that fits. I have an executable
>> program that accept one parameter (CALLERID) and return customer status
>> from the database server which can be printed in the console.
>>
>> #./retrive 0117473789
>> NAME: Franklin John
>> STATUS: Active
>>
>> Can someone advice on how i can catch this values from AGI or directly
>> on dialplan.
>
> AGI is a protocol used to interact with Asterisk. An AGI is a separate
> process created by Asterisk when you execute "agi()" in the dialplan.
>
> From best to worst...
>
> 1) You could recode your retrieve application so it uses the AGI protocol.
> Then, you could set channel variables to make these values accessible to
> the rest of your dialplan.
>
> 2) You could cobble up an AGI to execute your retrieve application using a
> "pipe" ("popen()" in c), parse the output and set channel variables.
>
> 3) You could cobble up something to execute your retrieve application,
> redirecting the output to a file and then use the FILE function read the
> text file and then parse the output using dialplan functions.
>
> --
> Thanks in advance,
> -------------------------------------------------------------------------
> Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
> Newline                                              Fax: +1-760-731-3000
>
> --
Thanks Steve
Option one and two looks more ideal. Let stick on option one, the program
is written in C++ (Actually is a corba interface). I have tried looking on
how to write AGI script using C++ in vain. I am used to perl/php for
scripting.. Can you post a snippet of c++ agi script.

Sam



More information about the asterisk-users mailing list