[asterisk-users] Variable using AMI
"Juan E. Rodríguez"
jerdguez at gmail.com
Mon Jul 6 14:36:55 CDT 2009
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
> <mailto: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> <mailto: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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20090706/88836267/attachment.htm
More information about the asterisk-users
mailing list