[asterisk-users] Asterisk variable for SIP context

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Tue Dec 9 16:07:28 CST 2008


On Tuesday 09 December 2008 13:17:18 Mike wrote:
> 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.

I suspect others are making this far more complicated than it needs to be.
The typical setup is to create included contexts in your dialplan, like in:

[local-calls-only]
include => local-calls

[unrestricted-calls]
include => local-calls
include => long-distance
include => international

If you're wanting to find out the top context, even though you're in an
included context, then just use ${CONTEXT}.  Your context doesn't actually
change when you're using an included context, which is why this works.
There's no need to make it any more complicated.

-- 
Tilghman



More information about the asterisk-users mailing list