Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[asterisk-users] sip.conf setvar option


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users
View previous topic :: View next topic  
Author Message
jsmith at digium.com
Guest





PostPosted: Fri Mar 28, 2008 7:42 am    Post subject: [asterisk-users] sip.conf setvar option Reply with quote

On Fri, 2008-03-28 at 12:30 +0100, Marcus Hunger wrote:
Quote:
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.

--
Jared Smith
Community Relations Manager
Digium, Inc.
Back to top
oej at edvina.net
Guest





PostPosted: Fri Mar 28, 2008 7:55 am    Post subject: [asterisk-users] sip.conf setvar option Reply with quote

28 mar 2008 kl. 13.42 skrev Jared Smith:
Quote:
On Fri, 2008-03-28 at 12:30 +0100, Marcus Hunger wrote:
Quote:
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
Back to top
hunger at sipgate.de
Guest





PostPosted: Fri Mar 28, 2008 8:00 am    Post subject: [asterisk-users] sip.conf setvar option Reply with quote

So, wouldn't it be great to enable setvar for outgoing calls too?

On Fri, Mar 28, 2008 at 1:55 PM, Johansson Olle E <oej at edvina.net> wrote:

Quote:

28 mar 2008 kl. 13.42 skrev Jared Smith:
Quote:
On Fri, 2008-03-28 at 12:30 +0100, Marcus Hunger wrote:
Quote:
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




_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users


--
Marcus Hunger - hunger at sipgate.de
Telefon: +49 (0)211-63 55 55-61
Telefax: +49 (0)211-63 55 55-22

indigo networks GmbH - Gladbacher Str. 74 - 40219 D?sseldorf
HRB D?sseldorf 39841 - Gesch?ftsf?hrer: Thilo Salmon, Tim Mois
Steuernummer: 106/5713/2881, Umsatzsteuer-ID: DE219349391

www.sipgate.de - www.sipgate.at - www.sipgate.co.uk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20080328/12837e8b/attachment.htm
Back to top
jsmith at digium.com
Guest





PostPosted: Fri Mar 28, 2008 8:02 am    Post subject: [asterisk-users] sip.conf setvar option Reply with quote

On Fri, 2008-03-28 at 13:55 +0100, Johansson Olle E wrote:
Quote:
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.

Absolutely true... and I'll make up for it by pointing out that if
you're using the Originate manager command, you can set channel
variables by adding the "Variable" setting to your manager command:

Action: Originate
Channel: SIP/myphone
Context: test
Exten: 123
Priority: 1
Async: True
ActionID: ThisIsMyVeryOriginalActionID
Variable: MYVAR=blah|ANOTHERVAR=baz

--
Jared Smith
Community Relations Manager
Digium, Inc.
Back to top
oej at edvina.net
Guest





PostPosted: Fri Mar 28, 2008 8:47 am    Post subject: [asterisk-users] sip.conf setvar option Reply with quote

28 mar 2008 kl. 14.00 skrev Marcus Hunger:
Quote:
So, wouldn't it be great to enable setvar for outgoing calls too?

Well, maybe in the outbound channel then. But that won't help much.
mixing the caller's and callee's variables in the INCOMING channel
would be messy and only cause issues.

But there's another way. Hint hint. Friday afternoon hack.

/O Wink
Back to top
hunger at sipgate.de
Guest





PostPosted: Fri Mar 28, 2008 8:56 am    Post subject: [asterisk-users] sip.conf setvar option Reply with quote

Particularly, I want to set the SIPADDHEADER variable dynamicly for peers
with rt-engine. Working around it might be possible, but having the thing
working transparently for Dial and Originate would be great.

On Fri, Mar 28, 2008 at 2:47 PM, Johansson Olle E <oej at edvina.net> wrote:

Quote:

28 mar 2008 kl. 14.00 skrev Marcus Hunger:
Quote:
So, wouldn't it be great to enable setvar for outgoing calls too?

Well, maybe in the outbound channel then. But that won't help much.
mixing the caller's and callee's variables in the INCOMING channel
would be messy and only cause issues.

But there's another way. Hint hint. Friday afternoon hack.

/O Wink

_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users


--
Marcus Hunger - hunger at sipgate.de
Telefon: +49 (0)211-63 55 55-61
Telefax: +49 (0)211-63 55 55-22

indigo networks GmbH - Gladbacher Str. 74 - 40219 D?sseldorf
HRB D?sseldorf 39841 - Gesch?ftsf?hrer: Thilo Salmon, Tim Mois
Steuernummer: 106/5713/2881, Umsatzsteuer-ID: DE219349391

www.sipgate.de - www.sipgate.at - www.sipgate.co.uk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20080328/b97dfad0/attachment.htm
Back to top
oej at edvina.net
Guest





PostPosted: Fri Mar 28, 2008 9:44 am    Post subject: [asterisk-users] sip.conf setvar option Reply with quote

28 mar 2008 kl. 14.56 skrev Marcus Hunger:
Quote:
Particularly, I want to set the SIPADDHEADER variable dynamicly for
peers with rt-engine. Working around it might be possible, but
having the thing working transparently for Dial and Originate would
be great.

That should work today with the unofficial backdoor I implemented.
sipaddheader just adds a few channel variables that the outbound
channel inherits.
If you add them yourself with

setvar=_SIPADDHEADER99=X-peeraccountcode: 12345

I think that should work. Out of the box, like magic.

This of course only works with calls FROM peers.

Have a nice weekend!

/O
Back to top
oej at edvina.net
Guest





PostPosted: Fri Mar 28, 2008 10:57 am    Post subject: [asterisk-users] sip.conf setvar option Reply with quote

Ok,

Now I have a friday afternoon patch for the community.

In the branch
http://svn.digium.com/view/asterisk/team/oej/peer-chanvars/

there's an addition to the SIPPEER() dialplan function where you can
retrieve a setvar= channel variable defined in sip.conf for the peer.
The branch is based on 1.4 and the patch will soon be included in the
1.6 trunk.

This way, you can for example add a variable called "CELLPHONE" with
the peer's cell phone number. If dial(sip/olle) fails, I can now do

dial(zap/${SIPPEER(olle,chanvar[CELLPHONE])})

This is something I came up with a few weeks ago when I created a PBX
based on Asterisk for a company, something that I don't do much, since
I normally use Asterisk in carrier environments with SIP proxys. Doing
this little PBX project was a lot of fun and I learned a lot.

Have a nice weekend!

/O
---
* Olle E. Johansson - oej at edvina.net
* Asterisk Training http://edvina.net/training/
* Asterisk SIP Masterclass, Orlando Florida April 21-25 2008. Register
today!
Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services