[asterisk-users] DIDs

Steve Edwards asterisk.org at sedwards.com
Sat Nov 21 11:26:54 CST 2009


> Thomas Perron wrote:
>
>> I have two DID numbers.  I want to configurate my IVR to initiate a 
>> context 1 if I dial DID 1. If DID2 is dialed then start with context 2.

If the DIDs are from different providers, you can specify different 
contexts in [iax|sip].conf.

On Sat, 21 Nov 2009, Alex Balashov wrote:

> Assuming that the DID originator sends you the number in the Request 
> URI, you can just treat them like "extensions" in Asterisk.  Example: if 
> you have DID 6789540670 and 6789540671:
>
>    exten => 6789540670,1,Goto(context_1,${EXTEN},1)
>    exten => 6789540671,1,Goto(context_2,${EXTEN},1)

I prefer to save EXTEN (after any pattern matching nonsense) in a more 
"meaningful" variable like DNIS and then use the "s" extension from then 
on. I find it "cleaner" and more maintainable. For example (typing off the 
top of my head):

[incoming-from-xyz]
 	exten = _678954067x,1,		set(DNIS=${EXTEN})
 	exten = 6789540670,2,		goto(home,s,1)
 	exten = 6789540671,2,		goto(work,s,1)

[home]
 	exten = s,1,			dial(sip/home-phone)

[work]
 	exten = s,1,			dial(sip/work-phone)

If I get another work number, I just add another line to 
incoming-from-xyz. If I change a number, I just change that single line.

-- 
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000



More information about the asterisk-users mailing list