Andrew Thomas
2011-Jan-20 16:25 UTC
[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 If you have received this communication in error we would appreciate you advising us either by telephone or return of e-mail. The contents of this message, and any attachments, are the property of DataVox, and are intended for the confidential use of the named recipient only. If you are not the intended recipient, employee or agent responsible for delivery of this message to the intended recipient, take note that any dissemination, distribution or copying of this communication and its attachments is strictly prohibited, and may be subject to civil or criminal action for which you may be liable. Every effort has been made to ensure that this e-mail or any attachments are free from viruses. While the company has taken every reasonable precaution to minimise this risk, neither company, nor the sender can accept liability for any damage which you sustain as a result of viruses. It is recommended that you should carry out your own virus checks before opening any attachments. Registered in England. No. 27459085.
William Stillwell
2011-Jan-20 16:30 UTC
[asterisk-users] Accessing a 'user' variable via. dialplan.
> -----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
Andrew Thomas
2011-Jan-20 16:46 UTC
[asterisk-users] Accessing a 'user' variable via. dialplan.
That's what I am already using :) Somehow, the outbound ID sometimes gets messed up (maybe to do with 2 calls from different users at once) - and the wrong one is sent to the telco. So, rather than just using a 'Set(CALLERID(num)=callidnum' just before Dial - I wanted to check the user directly (to double-check Asterisk if you like and check my own sanity). Something alone the lines of 'Set(idvar=${SIPPEER(201:callidnum)})' or even 'Set(idvar=${SIPPEER(201:variables)})' [to parse that little bit myself]. That way I can check if there is a genuine problem - or if, indeed, it is the telco themselves (I don't want to leave a Trend tester on-site). Thanks anyway. -----Original Message----- From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of William Stillwell Sent: 20 January 2011 16:31 To: 'Asterisk Users Mailing List - Non-Commercial Discussion' Subject: Re: [asterisk-users] Accessing a 'user' variable via. dialplan.> -----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 -- _____________________________________________________________________ -- 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 If you have received this communication in error we would appreciate you advising us either by telephone or return of e-mail. The contents of this message, and any attachments, are the property of DataVox, and are intended for the confidential use of the named recipient only. If you are not the intended recipient, employee or agent responsible for delivery of this message to the intended recipient, take note that any dissemination, distribution or copying of this communication and its attachments is strictly prohibited, and may be subject to civil or criminal action for which you may be liable. Every effort has been made to ensure that this e-mail or any attachments are free from viruses. While the company has taken every reasonable precaution to minimise this risk, neither company, nor the sender can accept liability for any damage which you sustain as a result of viruses. It is recommended that you should carry out your own virus checks before opening any attachments. Registered in England. No. 27459085.