bilal ghayyad
2011-Oct-24 09:46 UTC
[asterisk-users] Storing a variable at a context and using it in another context
Hi All; Is it possible to store a variable at context and using it in another context or in the MACRO? For example, how I can store the ${CALLERID(num)} in a variable and use it in another context or in a MACRO? Regards Bilal
Sammy Govind
2011-Oct-24 09:50 UTC
[asterisk-users] Storing a variable at a context and using it in another context
Try using variables between macros and contexts without doing anything. It works fine for me in asterisk 1.6.13+. If not then use _ before variable name. On Mon, Oct 24, 2011 at 2:46 PM, bilal ghayyad <bilmar_gh at yahoo.com> wrote:> Hi All; > > Is it possible to store a variable at context and using it in another > context or in the MACRO? For example, how I can store the ${CALLERID(num)} > in a variable and use it in another context or in a MACRO? > > Regards > Bilal > > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > New to Asterisk? Join us for a live introductory webinar every Thurs: > http://www.asterisk.org/hello > > 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/20111024/f745d107/attachment.htm>
amit anand
2011-Oct-24 11:44 UTC
[asterisk-users] Storing a variable at a context and using it in another context
Declare the global variable On Mon, Oct 24, 2011 at 15:16, bilal ghayyad <bilmar_gh at yahoo.com> wrote:> Hi All; > > Is it possible to store a variable at context and using it in another > context or in the MACRO? For example, how I can store the ${CALLERID(num)} > in a variable and use it in another context or in a MACRO? > > Regards > Bilal > > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > New to Asterisk? Join us for a live introductory webinar every Thurs: > http://www.asterisk.org/hello > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >-- Amit Anand +91 9818559898 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20111024/365f2d07/attachment.htm>
A J Stiles
2011-Oct-24 12:37 UTC
[asterisk-users] Storing a variable at a context and using it in another context
On Monday 24 October 2011, bilal ghayyad wrote:> Hi All; > > Is it possible to store a variable at context and using it in another > context or in the MACRO? For example, how I can store the ${CALLERID(num)} > in a variable and use it in another context or in a MACRO?Variables are local to channels (to all intents and purposes, call legs), not contexts. If you call a macro or GoTo() another context, any variables you defined in the calling context should be preserved. They will only be forgotten when the channel is destroyed (to all intents and purposes, when the call is hung up). -- AJS Answers come *after* questions.
Danny Nicholas
2011-Oct-25 14:11 UTC
[asterisk-users] Storing a variable at a context and using it in another context
In my 1.4 and 10.0 experience, there are two types of variables. Call/Local variables that "live" for the duration of the current call only and Global variables that are set and live on until Asterisk is restarted. I can do set(foo=${CALLERID(num)) and use ${foo} anywhere in my dialplan. I can do Set(GLOBAL(lastcaller)=${CALLERID(num)}) and see that my last caller was ${lastcaller} from any concurrent or later call. From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of amit anand Sent: Monday, October 24, 2011 6:44 AM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] Storing a variable at a context and using it in another context Declare the global variable On Mon, Oct 24, 2011 at 15:16, bilal ghayyad <bilmar_gh at yahoo.com> wrote: Hi All; Is it possible to store a variable at context and using it in another context or in the MACRO? For example, how I can store the ${CALLERID(num)} in a variable and use it in another context or in a MACRO? Regards Bilal -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- Amit Anand +91 9818559898 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20111025/07bc5849/attachment.htm>