Inbound Routing Help?

Hi All and thanks in advanced!

I am having trouble setting something up (or maybe I just don’t know how to set it up). Here’s the issue:

I have FreePBX (Asterisk Based) set up in our office with Nextiva for our SIP Trunking service. We have a group trunk from them with 4 trunks. We also have 2 phone numbers attached to the trunk group. Not sure how to manipulate how these numbers are set up, but the way they are set up now is no matter which of the 2 numbers they call it’ll ring our phones. I would like to set it up so that when one of the phone numbers rings, it gets sent to only one of our IP phones. And for that phones outbound caller id to be the same number as well. I thought it would be set up in Inbound routing but it doesn’t do anything when i set up a new inbound route with the DID number to that ext. Any suggestions?

Hope its clear, if not lemme try to explain with the set up we want.
We have a trunk group service with 2 numbers attached to it (818) 555-5555 & (818) 666-6666. We have about 8 ip phones in the office. I need 7 phones to ring when (818)555-5555 is dialed in as well as have that as the outbound caller id on those 7 phones; and 1 phone to ring when (818)666-6666 is dialed with that being its outbound CID.

Thank you all again for all your help!

You filter by DID. Check the DID column in the CDR to see what Asterisk sees when an inbound call arrives and then construct your inbound routes with DID to match exactly.


Thanks so much for the response. I will give that a shot!

Still having trouble with this,

I checked the log and for some reason whenever I call the second number, it comes it as the same number no matter what so I cant set up a inbound route for it. When I call in 81855555555 the log shows in the DID was 8186666666. I called my SIP Provider and they said it must be configured on the PBX side… any ideas?

The DID is sent by the provider, so if you are not getting the expected DID, you will have to sort it out with them.

1 Like

thanks for the response, they’re saying it’s all good on there side, saying it has to do with the PBX Software…

Show them a SIP debug trace, so they can see the issue

1 Like

Tried again, they insist it’s on the PBX side…

This should not be hard to troubleshoot. At the Asterisk command prompt, it you are using a pjsip trunk, type
pjsip set logger on
it it’s a chan_sip trunk, the command is
sip set debug on
Then, make a test call to 8185555555 and look at the SIP INVITE from the provider in the Asterisk log.
If it says e.g. INVITE sip:[email protected]
then your Inbound Route should specify 18185555555 in the DID field.
If it says e.g. INVITE sip:[email protected]
then look at the To: header to see whether 8185555555 is there.
If it is, try changing the context for the incoming trunk to [from-pstn-toheader]
If the To: header also has 8186666666 then either you have set up something wrong on the Nextiva portal, or they have configured something wrong for you. Show them the SIP and they should be able to straighten it out.

1 Like

I gave that a shot but when i dial in the test call, so many things pop up in the command prompt to the point where i can’t scroll all the way back up, any ideas? I’m also not sure exactly where to look for the invite part?

thanks in advanced

You can look at the asterisk log located on /var/log/asterisk/full

how do i open the that file within asterisk?
I’m not too savy with command prompts…

You can open it from the linux command prompt, using vi

Still can’t seem to figure it out. In all the logs i check all I’m seeing is one number no matter which DID i dial in. SIP Provider is insisting it’s on the pbx side… any one have any ideas what it could be i got to change?

any help is appreciated i really need this done …

This is not a complex problem. Look in the log for an entry that starts
INVITE sip:[some number]@[hostname]
that comes from the provider.
Following the INVITE line, there are some headers, including From: and To:
If the number you are calling into does not appear on the INVITE line nor in any header, the trouble is not on the PBX side. Either you can fix this in the settings on the provider portal, or you should open a ticket with them and include the SIP packet showing that the dialed number is not present.

If the dialed number appears in the request line, setting the Inbound Route to match its format should work.

If the dialed number appears in To:, the change in my previous post should work.

If the dialed number appears in some other header, please post details.

1 Like

okay, so i see what you’re saying… here’s what I’m showing:

<— SIP read from UDP: —>
INVITE sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP;branch=z9hG4bKadm4or2060ohldeluaa0.1
From: sip:[email protected];user=phone;tag=1622708389-1524253738296-
To: "8182086039 8182086039"sip:[email protected]
Call-ID: [email protected]
CSeq: 843915933 INVITE
Contact: sip:[email protected]:5060;transport=udp
Recv-Info: x-broadworks-client-session-info
Accept: application/media_control+xml,application/sdp,multipart/mixed
Max-Forwards: 19
Content-Type: application/sdp
Content-Disposition: session;handling=required
Content-Length: 215

the To: header is correct, that’s the correct number…what am i setting up wrong in the inbounf route? I changed the context setting in the inbound trunk but it didnt change anything :frowning:

Resolved! I just had to change it in the outbound trunk settings too!! Thank you so much Stewart! and everyone else as well!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.