[asterisk-users] setting variable for a DID number

Sherwood McGowan sherwood.mcgowan at gmail.com
Thu Aug 19 23:48:45 CDT 2010


On Thu, Aug 19, 2010 at 11:01 PM, Steve Edwards
<asterisk.org at sedwards.com> wrote:
> On Thu, 19 Aug 2010, Tino wrote:
>
>> But when i call my DID number following dialplans are being executed.
>> What i need is to set a variable with one value for one DID number and set
>> the same variable with another value for another DID number. Also any
>> contexts should be able to use this variable.
>
>        exten = _x.,n,                  set(FOO=XXX)
>        exten = _x.,n,                  execif($["${ANI}" =
> "5555551212"],set,FOO=YYY})
>
> --
> Thanks in advance,
> -------------------------------------------------------------------------
> Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
> Newline                                              Fax: +1-760-731-3000
> --
> _____________________________________________________________________
> -- 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
>

Oh boy...Ok, first, let's get into the root issue here...First, when a
variable is set during a call, unless it's defined as a GLOBAL
variable, it is only accessible to THE CHANNEL THAT EXECUTED THE SET
COMMAND THAT CAUSED THE VARIABLE TO "EXIST". Of course, you can make
it available to child channels that are spawned by the original
channel by prepending the variable name in the Set() command with one
or more underscores....See the following Voip-Info.org link for more
information regarding channels and variable
inheritance....http://www.voip-info.org/wiki/view/Asterisk+variables#InheritanceofChannelVariables

If you really need an example of how this works and why variables are
specific to the call they're related to, I'll gladly write one up when
I return from the pub in the wee hours of the morning...if you're
nice...

I'll give you a great real world hint/example....

If I was playing a quick round of Doom at a gaming cafe where all the
terminals were thin clients, and all the code to make the game
"happen" was being executed on the application server, my game would
not suddenly jump back to the first level when you told the
application server you wanted to play Doom as well....Now, envision
the application server as your Asterisk server, and our respective
games as calls coming into that Asterisk server......

Getting a candle? Possibly a torch? Maybe....maybe....a light bulb?

Let me know, I'll gladly elucidate further if need be, but be aware
that it will be after a solid round or five of the Slainte


Sherwood Mother-F'ing McGowan....
Because I'm the Mick....and I'm awesome....


P.S. a Sixpack of your choosing to the first person who can correctly
identify the person or character the last line of that signature was
parodying////



More information about the asterisk-users mailing list