Hi John, No you`re not over simplifying, that would be a great idea if I wasn't building dynamically my sip registrations in realtime based on my own web portal and was already finding the setvar column cluttered enough for other values. That of course wasn't explained in my original question, so you're solution would have been good.
I guess SIPPEER func is what is best, I`ll go and see if it works as I think it does. Regards, Mike -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Todd Sent: Tuesday, December 09, 2008 16:37 To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] Asterisk variable for SIP context On Dec 9, 2008, at 11:17 AM, Mike wrote: > Hi, > > Say I wanted to know what context a SIP registration is using to > dial out in my dialplan, what would I do? > > For example, I have phones on a "local-calls-only" context (as > defined in sip.conf), others in "unrestricted-calls". In my > dialplan, I`d like to act on that knowledge. > > Mike Perhaps the easiest way is to set a variable in the SIP peer that is equal to the same value as you have set in the "context=xxx..." setting. [snom33942] type=peer secret=blahblahblah qualify=200 nat=yes context=my-internal-context setvar=SIPCONTEXT=internal-context Then can evaluate ${SIPCONTEXT} in your dialplan. It is often useful to set other variables in this way as well, so you can have some "static" values that don't change depending on how the call is handled. For instance, I often set the "human-readable" caller ID name (like "Joe Smith") as a variable in the SIP peer for small systems that aren't database-driven. This lets me ignore what the phone says. It's a bit crude when compared to more sophisticated solutions using realtime or other database systems, but often that is overkill for smaller PBX or PBX-like systems and setting variables in sip.conf is sufficient. "There's more than one way to do it." Or am I over-simplifying your question? JT --- John Todd [EMAIL PROTECTED] +1-256-428-6083 Asterisk Open Source Community Director _______________________________________________ -- 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 _______________________________________________ -- 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