Dnis/dnid

We have multiple (virtual phone numbers) going to single PSTN line and same with VoIP. Currently the calls do come through, but are all grouped together. We need to identify which number the user dialed in order for us to handle the call correctly.

We have checked with our providers and they are sending the DNID information. Here is a sample of the header that we receive:

<-- SIP read from 204.xxx.xxx.xxx:5060: INVITE sip:s@xxx.xxx.xxx.xxx SIP/2.0 v: SIP/2.0/UDP 204.xxx.xxxxxx:5060;branch=z9hG4bK-0de0e327814bb58b0ccf4b981e511ba7 f: <sip:1905xxxxxxx@xxx.xxx.xxx.xxx>;tag=4771DE00-D34 t: <sip:1905xxxxxxx@ss.callcentric.com> i: 171655-3350352051-451874@xxx.xxx.xxx.xxx CSeq: 1 INVITE Max-Forwards: 10

How can we access the to “t:” value through Asterisk or AGI? Important note: I’m new to Asterisk so please be gentle. :smile:

Thanks for all help in advance,
Paul

you would do it in hte dial plan whtever contecxt the calls come in to you need something like this

exten => 1112223333,1,Dial(sip or iax2/context name in the sip or iax file)

I tried that and no luck. The problem is that at the point it gets to the dial planin Asterisk it is all from the same account; therefore it all appears from the same number. We need access to the dialed number dnid which gets sent to Asterisk in the header through the “t:” field.

When I display the dnid through Asterisk it gives me the account number which is same for all virtual numbers.

I see the “t:” field which contains the dialed number in the SIP header and I can’t touch it.

Paul

I would try adding the NoOP with view varibels and see what the CLI tells you when the call comes in see here

voip-info.org/wiki/index.php … +variables

voip-info.org/wiki/index.php … k+cmd+NoOp

Done the NoOp with all the variables that are listed in the docs. I even tried the channel variables and no progress. All values referencing the caller id work, but value DNID shows the account/user for the SIP account which is same for all the virtual numbers, and RDNIS is blank.

It is frustrating because I can see the info in the header and can’t seem to touch it. Is there any way to access the SIP header sent to Asterisk and parse it myself?

Thanks,
Paul

There maybe a way to do it but im not aware of any.

I found a solution after a many days of searching. I have to give the credit to the user on this site - sorry for violating any link references for this forum but I need to place credit where it is due.

http://forums.whirlpool.net.au/forum-replies-archive.cfm/464741.html

The solution is with the SIP_HEADER function and it does give me the DNIS that I was looking for and saw in the header.

Thanks for all your help and hopefully it will be handy for others,

  • Paul

Great! glad you got it working. Maybe you should send an example to someone over at the wiki so it could be posted there for future refrence.

Does anyone know where I could find a list of the allowable parameters passed in by SIP_HEADER?