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

Steve Edwards asterisk.org at sedwards.com
Sun Jul 25 11:07:51 CDT 2010


> On Sun, Jul 25, 2010 at 8:18 AM, Muro, Sam <research at businesstz.com> 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.

On Sun, 25 Jul 2010, Kyle Kienapfel wrote:

> Hopefully you can modify the executable
>
> #./retrieve 8675309
> SET VARIABLE name Jenny
> SET VARIABLE status Active

A "creative" hack, but since it violates the AGI protocol, may be subject 
to failure now or sometime in the future. (Quoting the values would allow 
embedded spaces.)

> When running an AGI asterisk expects to have a conversation with the 
> application, so when the AGI does a command asterisk reports back with 
> whether or not it worked. I know a person can set one variable that way, 
> but when I got a need to set two variables I finally broke down and read 
> the documentation on AGI's :)
>
> Start
> Readlines from input until line is blank
> print "SET VARIABLE name Jenny"
> readline
> print "SET VARIABLE status Active"
> End

You should add a "readline" to read the response after the second request.

-- 
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000



More information about the asterisk-users mailing list