[asterisk-users] sip.conf setvar option

Johansson Olle E oej at edvina.net
Fri Mar 28 07:55:06 CDT 2008


28 mar 2008 kl. 13.42 skrev Jared Smith:
> On Fri, 2008-03-28 at 12:30 +0100, Marcus Hunger wrote:
>> does anybody know about the setvar option in asterisk's sip.conf.
>
> Sure!  This is one of my favorite features.
>
> Let's say I have a definition for my phone in sip.conf, and it looks
> something like this:
>
> [myphone]
> secret=verysecretpassword
> type=friend   ; a friend is both a user and a peer
> host=dynamic  ; phone will register to Asterisk
> disallow=all
> allow=gsm     ; first, try to negotiate gsm
> allow=ulaw    ; the try ulaw
> setvar=MYVAR=blah
>
> Whenever a call comes into Asterisk from this particular phone,  
> Asterisk
> will automatically create a channel variable named MYVAR, and ${MYVAR}
> will contain the value "blah".  I can then use it for whatever  
> purpose I
> see fit within my dialplan.

Well, Jared, but that's the reverse. You stripped out this important  
part:
" am trying to define it for a peer that's used when making calls  
using the originate ami call, but it seems to not have any effect."

The important thing with your lesson was that SETVAR is only used on  
INCOMING calls from
devices, not outbound calls TO devices. Using ORIGINATE to call a SIP  
peer, there's no variables
set from sip.conf.

/O

---
* Olle E. Johansson - oej at edvina.net
* Asterisk Training http://edvina.net/training/ * SIP Masterclass  
Orlando FL * April 21-25 2008






More information about the asterisk-users mailing list