[asterisk-users] info about DID.

A J Stiles asterisk_list at earthshod.co.uk
Fri Oct 28 04:10:14 CDT 2016

On Thursday 27 Oct 2016, KyD wrote:
> Hi!
> I need to make a dialplan by DID.
> where it gets the asterisk values did? from sip headers or ... ?
> Thanks!

It will all be taken care of for you, so you don't have to do anything special 
for calls to a direct inbound number.  When a call comes into your Asterisk 
via a SIP trunk or ISDN line and hits the appropriate context in your 
dialplan, the destination number  (i.e., what the person on the other end 
dialled)  will be in the variable ${EXTEN}.  (But *note*, it may be in any one 
of several formats:  local number only; national number with STD  [town]  
code, with or without initial 0; international number with IDD  [country]  and 
STD  [town]  codes).  The same provider will always present the number in the 
same format, though; so if they include the STD code, they will -always- 
insert it, even for calls within the same town where the caller dialled only 
the local number.

If you define an "s" extension which displays the value of ${EXTEN} in the 
console, then dial one of your direct lines, you can work out how the number 
is being presented:

exten => s,1,NoOp(Incoming call for ${EXTEN})

Then you can write appropriate extension logic in your dialplan.  For 
instance, if one of the dialled numbers comes in as "206318", you just need to 
have an extension like this in your dialplan;

exten => 206318,1,DoSomething()

And when somebody dials that number, it will fire the appropriate extension in 
your dialplan.


Note:  Originating address only accepts e-mail from list!  If replying off-
list, change address to asterisk1list at earthshod dot co dot uk .

More information about the asterisk-users mailing list