[asterisk-users] Variable using AMI

Carlos Ruiz Diaz carlos.ruizdiaz at gmail.com
Mon Jul 6 14:55:03 CDT 2009


I am sorry for my bad English. Apparently I'm explain myself wrongly but you
got the point.

I tried GetVar as AMI action but I have to specify a channel string. Of
course I have the channel string, I parametrized it but Asterisk adds
another string to the original channel and I can't obtain the variable value
because of the lack of the real channel string.

eg.
I write SIP/1000 in the channel param. but asterisk adds SIP/1000-*12eg12*.
Obviously is not always the same string. This is just a illustrative
demonstration.

I wrote a mail asking for help with that problem.

Thanks.


2009/7/6 "Juan E. Rodríguez" <jerdguez at gmail.com>

>  Well, I do not understand very well what you are trying to do, but I'll
> give you some advice:
>
> If you want a variable only for the AGI you call, you just have to declare
> that variable on the AGI.
> If you would like to make visible that variable as long as the call is
> active and for each call, even if the name is the same, you have to set a
> channel variable with the Set(variable=value) command.
> If you would like to have a variable shared between two or more channels,
> use the SHARED() funcion(Asterisk 1.6, back ported to 1.4)
> If you want a variable to be accessed from all the channels, you could use
> a global variable.
>
> http://www.voip-info.org/wiki/view/Asterisk+variables
>
> Regards,
> Juan
>
> Carlos Ruiz Diaz wrote:
>
> Thank you!
>
> I did not know the existence of  DB command. The command allows me to store
> KVPs but I have to use the same variable name every time so every process
> that starts the AMI instance will override the values making it unusable for
> what I want to achieve.
>
> It was really useful anyways. :)
>
>
> 2009/7/6 "Juan E. Rodríguez" <jerdguez at gmail.com>
>
>> Maybe you could use the Asterisk Database.
>> In 1.4 you can do it with DBGet and DBPut:
>> http://www.voip-info.org/wiki/view/Asterisk+cmd+DBget
>> http://www.voip-info.org/wiki/view/Asterisk+cmd+DBput
>>
>> In 1.6 use DB() function.
>>
>> Regards,
>> Juan
>>
>> David Backeberg wrote:
>>
>> On Mon, Jul 6, 2009 at 11:37 AM, Carlos Ruiz
>> Diaz<carlos.ruizdiaz at gmail.com> <carlos.ruizdiaz at gmail.com> wrote:
>>
>>
>>  Hello,
>>
>> if I do a variable assignation using AMI interface, that variable will be
>> visible only for the current AMI instance or will be readable for all AMI
>> instances?. I will login using the same user, concurrently. A program will
>> write a global variable using the same name and if asterisk don't have any
>> scope rules I have to find another way to do what I want.
>>
>>
>>  If you want to maintain scope for a variable across multiple calls you
>> should maintain the value of that variable outside of asterisk and
>> keep setting it for each new phonecall. Global variables in asterisk
>> do not do what you are describing.
>>
>> AMI does have something where you can name a particular AMI session,
>> and then communication for that session will care that name. That
>> should not be confused with a system-wide global variable.
>>
>> _______________________________________________
>> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>>
>> asterisk-users mailing list
>> To UNSUBSCRIBE or update options visit:
>>    http://lists.digium.com/mailman/listinfo/asterisk-users
>>
>>
>>
>>
>> _______________________________________________
>> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>>
>> asterisk-users mailing list
>> To UNSUBSCRIBE or update options visit:
>>   http://lists.digium.com/mailman/listinfo/asterisk-users
>>
>
> ------------------------------
>
> _______________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>
>
>
> _______________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20090706/305c9885/attachment.htm 


More information about the asterisk-users mailing list