Help on DNID

We are trying to strip out the Dialed Number IS ( DNID or DNIS depending on which article you read) so that we can automatically route to a specific extension, avoiding our auto attendant.
Nobody seems to know if this information is in the sip header and if it is, which part of it contains the number the calling party is dialing to reach us. Wiki and other sources have only a bare minimum of information and the little there is conflicts. Have you had occasion to try to utilize this data?

Someone out there help us

Can you provide a little more info about what you are trying to do. An example would be good.

We are trying to be able to allow a call to come in and by pass the companys auto attendant system adn go directly to a specific direction. I was told by Skibum at counter path to go into INVITE.
Still can’t find it.

We just want the bosses wife to get her calls directly to her phone instead of through the company auto attendant.

We have 8 lines.


I’m not sure if this will help much because I use freePBX as an interface but here is a snippet of my extensions_additional.conf:

include => ext-did-custom
exten => s,1,Set(FROM_DID=s)
exten => s,n,Set(KEEPCID=${CALLERID(num)})
exten => s,n,Set(TESTCID=${MATH(${CALLERID(num)}+1)})
exten => s,n,GotoIf($[foo${TESTCID} = foo]?CLEARCID:PRIVMGR)
exten => s,n(CLEARCID),Set(CALLERID(num)=)
exten => s,n(PRIVMGR),PrivacyManager
exten => s,n,Goto(ivr-1,s,1)
exten => _X.,1,Goto(ext-did,s,1)
exten => s/12345678901,1,Set(FROM_DID=s/12345678901)
exten => s/12345678901,n,Goto(ext-group,1,1)
exten => s/0987654321,1,Set(FROM_DID=s/0987654321)
exten => s/0987654321,n,Goto(ext-local,100,1)

I’ve changed the numbers, but it should give you a general idea. The system looks at the CALLERID in the rule and if it matches sends it to the desination.

I hope this helps!


I assume that your bosses phone has its own DID from what you are saying (his own telephone number that can be dialed from the PSTN that will be delivered to you by your SIP provider).

Assuming that is the case, what you want is very straight forward. SIP simply addresses your system just as if it was email. If your bosses number is ‘IAM-THE-BOSS’ (e.g. 4268432677) then it is going to arrive to you as: You sip.conf setting for this provider should have a context defined where the calls are to go, e.g. context=my-incoming-calls or something (in aah it is usually from-pstn or from-trunk).

Asterisk will look for the bosses extension in that context and if it doesn’t find it then it will look for the ‘s’ extension. So you simply need something like:

exten => _4268432677,1,Goto(the-boss,1,1)

or what ever dial plan you want at that point to deliver the call to your bosses extension.