SIP Header DID HELP

Folks I have a Asterisk based system and I just got service from Nextiva. They state that I need to be looking at the TO field so that the Asterisk can determine which of my 5 DID’s is being dialed.

The issue is that I have 5 DID’s and no matter which if the 5 DIDs all the calls look like the same number ending in 0818. That is the pilot number and the number in my registry string.

I called support and they say I need to set the ASterisk to look at the SIP header for it see the inbound caller ID. Then the Asterisk system will know how to handle it and match it to the inbound route.

how do I set up the system to look at the SIP header TO field so it will read the inbound DID ?

Neither chan_sip or chan_pjsip currently allow routing based on the To header within them. Depending on the channel driver you need to use the mechanism available (SIP_HEADER or PJSIP_HEADER dialplan function) to get the To header and route based on that.

The expectation from the provider is that I set the system to look at the SIP header to see the inbound DID and I don’t know how to do that.

Jonathon has told you how to do this.

However, I would point out that your provider should be using the request URI, not the To header, for anything intended for routing.

It’s Joshua. :smiley:

Like I said the modules themselves don’t have the logic to do that so you have to write it. SIP_HEADER and PJSIP_HEADER allow you to retrieve headers in dialplan, including the To header. You would therefore need to retrieve and parse from the dialplan to route. I’m sure examples exist but I don’t have them readily available.

1 Like

You should have something like this in your dialplan

First you must check what you receive from your provider and afterwards change the following line

exten => s,n,Set(MYVAR=${SIP_HEADER(TO):5})

You should change the number 5 to what characters must be removed from your did number.