[asterisk-users] Accessing a 'user' variable via. dialplan.

William Stillwell william at stillwellsoft.com
Thu Jan 20 10:30:49 CST 2011



> -----Original Message-----
> From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-
> bounces at lists.digium.com] On Behalf Of Andrew Thomas
> Sent: Thursday, January 20, 2011 11:26 AM
> To: Asterisk Users Mailing List - Non-Commercial Discussion
> Subject: [asterisk-users] Accessing a 'user' variable via. dialplan.
> 
> Hi,
> 
> I know you can access various sip variables via
> 'Set(sstatus=${SIPPEER(201,status)})' (for example) to get the status
> of
> the sip user - but what about variables?
> 
> I have a user that has setvar=123456 in their users.conf (sip.conf if
> you prefer).  I can read it with a 'sip show peer 201' - but that gives
> everything and parsing that isn't really an option.
> 
> Anyone know how to access 'variables' (and maybe the contents)
> directly?
> 
> Thanks
> 



Posted by Joshua Colp dated 12/19/2010, with the subject of  "Specifying DID
for outbound calls"

I'm surprised nobody has suggested using the setvar functionality. It's
extremely useful for stuff like this and would allow you to keep all
CallerID information with the actual configuration of the device.

Using a configuration entry for sip.conf in another response as an example:

[101]
type=friend
username=101
secret=0000
mailbox=101
callerid="User One" <101>
host=dynamic
nat=yes
dtmfmode=rfc2833
canreinvite=no
reinvite=no
qualify=yes
setvar=EXTERNAL_CALLERID="User One" <3012323434>

And then in extensions.conf:

exten => _1NXXNXXXXXX,1,Set(CALLERID(all)=${EXTERNAL_CALLERID})
exten => _1NXXNXXXXXX,n,Dial(SIP/${EXTEN}@vitel-outbound)

Of course you could add some sanity checking there to make sure that
${EXTERNAL_CALLERID} contains a value and if not default to your main DID.

-----

I think you can get an idea on how to access setvar much easier, he also
stated you can have multiple setvar(s)

Ie, 

Setvar=VAR_1=Taco
Setvar=VAR_2=Apples
Setvar=VAR_3=Bannanna


------

William Stillwell





More information about the asterisk-users mailing list