Inbound Route Issue - SIP trunk

Good Afternoon!

So i was hoping you folks could help with an issue that is driving me crazy.

I work for a small IT deployment department in a mid-sized telecommunications company and we have recently accepted a contract with an Adventure Resort business to provide outdoor WIFI, individual cabin WIFI and phones for 26+ cabin locations.

I’ve set up a couple of PBX deployments using FreePBX but have always used SIP lines with individual authentication. In this case, for setup and testing purposes prior to deployment, we are using a SIP trunk that is provided by our parent company. Our CO has tagged 2 DIDs for testing purposes on the trunk which is built on a static address also provided by our parent company. The CO has confirmed that the trunk is sending the DIDs across as 7 digits.

Anyways, I followed a few walkthrus for setting up the trunk and the inbound routes. So currently I have a freePBX server and 2 Grandstream 2130s for the test enviroment. The internet is provided through an Arris device with the PBXserver set in the DMZ. This is a very temporary test setup so I have no issue posting route / IP information.

SIP trunk IP: 69.176.9.16
SIP server address: 12.21.194.239
FreePBX server IP: 172.18.30.10
DIDs: 4798991, 4798992

The issue I’m having is that when I use the inbound route, it only works if there is no DID definition. Once I define a DID for either 4798991 or 4798992, I get Line is not in service. I did research and figured out how to perform a packet capture and I’ve saved it as a *.txt file. I’ll post the headers here I guess with the first instance having DID set and the second as allowing ANY:

1st PC

No. Time Source Destination Protocol Length Info
1 0.000000 fe80::22f3:75ff:fe7f:246 ff02::1:ff4d:2543 ICMPv6 86 Neighbor Solicitation for ::c274:adff:fe4d:2543 from 20:f3:75:7f:02:46

Frame 1: 86 bytes on wire (688 bits), 86 bytes captured (688 bits)
Ethernet II, Src: ARRISGro_7f:02:46 (20:f3:75:7f:02:46), Dst: IPv6mcast_ff:4d:25:43 (33:33:ff:4d:25:43)
Internet Protocol Version 6, Src: fe80::22f3:75ff:fe7f:246, Dst: ff02::1:ff4d:2543
Internet Control Message Protocol v6

No. Time Source Destination Protocol Length Info
2 0.269003 fe80::22f3:75ff:fe7f:246 ff02::1:ff4d:253c ICMPv6 86 Neighbor Solicitation for ::c274:adff:fe4d:253c from 20:f3:75:7f:02:46

Frame 2: 86 bytes on wire (688 bits), 86 bytes captured (688 bits)
Ethernet II, Src: ARRISGro_7f:02:46 (20:f3:75:7f:02:46), Dst: IPv6mcast_ff:4d:25:3c (33:33:ff:4d:25:3c)
Internet Protocol Version 6, Src: fe80::22f3:75ff:fe7f:246, Dst: ff02::1:ff4d:253c
Internet Control Message Protocol v6

No. Time Source Destination Protocol Length Info
3 1.223494 Ubiquiti_0d:55:75 Spanning-tree-(for-bridges)_00 STP 60 RST. Root = 32768/0/74:83:c2:0d:55:74 Cost = 0 Port = 0x8005

Frame 3: 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
IEEE 802.3 Ethernet
Logical-Link Control
Spanning Tree Protocol

No. Time Source Destination Protocol Length Info
4 2.866710 fe80::22f3:75ff:fe7f:246 ff02::1 ICMPv6 110 Router Advertisement from 20:f3:75:7f:02:46

Frame 4: 110 bytes on wire (880 bits), 110 bytes captured (880 bits)
Ethernet II, Src: ARRISGro_7f:02:46 (20:f3:75:7f:02:46), Dst: IPv6mcast_01 (33:33:00:00:00:01)
Internet Protocol Version 6, Src: fe80::22f3:75ff:fe7f:246, Dst: ff02::1
Internet Control Message Protocol v6

No. Time Source Destination Protocol Length Info
5 3.223869 Ubiquiti_0d:55:75 Spanning-tree-(for-bridges)_00 STP 60 RST. Root = 32768/0/74:83:c2:0d:55:74 Cost = 0 Port = 0x8005

Frame 5: 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
IEEE 802.3 Ethernet
Logical-Link Control
Spanning Tree Protocol

No. Time Source Destination Protocol Length Info
6 4.912138 23.148.145.137 172.18.30.10 SIP/SDP 778 Request: INVITE sip:[email protected]:5060 |

Frame 6: 778 bytes on wire (6224 bits), 778 bytes captured (6224 bits)
Ethernet II, Src: ARRISGro_7f:02:46 (20:f3:75:7f:02:46), Dst: Dell_9c:17:4d (54:bf:64:9c:17:4d)
Internet Protocol Version 4, Src: 23.148.145.137, Dst: 172.18.30.10
User Datagram Protocol, Src Port: 54233, Dst Port: 5060
Session Initiation Protocol (INVITE)

No. Time Source Destination Protocol Length Info
7 4.912158 172.18.30.10 23.148.145.137 ICMP 590 Destination unreachable (Port unreachable)

Frame 7: 590 bytes on wire (4720 bits), 590 bytes captured (4720 bits)
Ethernet II, Src: Dell_9c:17:4d (54:bf:64:9c:17:4d), Dst: ARRISGro_7f:02:46 (20:f3:75:7f:02:46)
Internet Protocol Version 4, Src: 172.18.30.10, Dst: 23.148.145.137
Internet Control Message Protocol
Session Initiation Protocol

No. Time Source Destination Protocol Length Info
8 5.034211 67.205.174.60 172.18.30.10 TCP 74 39856 → 80 [SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM=1 TSval=580553903 TSecr=0 WS=128

Frame 8: 74 bytes on wire (592 bits), 74 bytes captured (592 bits)
Ethernet II, Src: ARRISGro_7f:02:46 (20:f3:75:7f:02:46), Dst: Dell_9c:17:4d (54:bf:64:9c:17:4d)
Internet Protocol Version 4, Src: 67.205.174.60, Dst: 172.18.30.10
Transmission Control Protocol, Src Port: 39856, Dst Port: 80, Seq: 0, Len: 0

No. Time Source Destination Protocol Length Info
9 5.034230 172.18.30.10 67.205.174.60 TCP 74 80 → 39856 [SYN, ACK] Seq=0 Ack=1 Win=28960 Len=0 MSS=1460 SACK_PERM=1 TSval=342293240 TSecr=580553903 WS=128

Frame 9: 74 bytes on wire (592 bits), 74 bytes captured (592 bits)
Ethernet II, Src: Dell_9c:17:4d (54:bf:64:9c:17:4d), Dst: ARRISGro_7f:02:46 (20:f3:75:7f:02:46)
Internet Protocol Version 4, Src: 172.18.30.10, Dst: 67.205.174.60
Transmission Control Protocol, Src Port: 80, Dst Port: 39856, Seq: 0, Ack: 1, Len: 0

No. Time Source Destination Protocol Length Info
10 5.089539 67.205.174.60 172.18.30.10 TCP 66 39856 → 80 [ACK] Seq=1 Ack=1 Win=64256 Len=0 TSval=580553958 TSecr=342293240

Frame 10: 66 bytes on wire (528 bits), 66 bytes captured (528 bits)
Ethernet II, Src: ARRISGro_7f:02:46 (20:f3:75:7f:02:46), Dst: Dell_9c:17:4d (54:bf:64:9c:17:4d)
Internet Protocol Version 4, Src: 67.205.174.60, Dst: 172.18.30.10
Transmission Control Protocol, Src Port: 39856, Dst Port: 80, Seq: 1, Ack: 1, Len: 0

No. Time Source Destination Protocol Length Info
11 5.090236 67.205.174.60 172.18.30.10 HTTP 332 POST /admin/config.php HTTP/1.1 (application/x-www-form-urlencoded)

Frame 11: 332 bytes on wire (2656 bits), 332 bytes captured (2656 bits)
Ethernet II, Src: ARRISGro_7f:02:46 (20:f3:75:7f:02:46), Dst: Dell_9c:17:4d (54:bf:64:9c:17:4d)
Internet Protocol Version 4, Src: 67.205.174.60, Dst: 172.18.30.10
Transmission Control Protocol, Src Port: 39856, Dst Port: 80, Seq: 1, Ack: 1, Len: 266
Hypertext Transfer Protocol
HTML Form URL Encoded: application/x-www-form-urlencoded

No. Time Source Destination Protocol Length Info
12 5.090263 172.18.30.10 67.205.174.60 TCP 66 80 → 39856 [ACK] Seq=1 Ack=267 Win=30080 Len=0 TSval=342293296 TSecr=580553959

Frame 12: 66 bytes on wire (528 bits), 66 bytes captured (528 bits)
Ethernet II, Src: Dell_9c:17:4d (54:bf:64:9c:17:4d), Dst: ARRISGro_7f:02:46 (20:f3:75:7f:02:46)
Internet Protocol Version 4, Src: 172.18.30.10, Dst: 67.205.174.60
Transmission Control Protocol, Src Port: 80, Dst Port: 39856, Seq: 1, Ack: 267, Len: 0

2nd PC

No. Time Source Destination Protocol Length Info
1 0.000000 Grandstr_4d:25:3c CDP/VTP/DTP/PAgP/UDLD CDP 127 Device ID: GXP2130_c0:74:ad:4d:25:3c Port ID: eth0

Frame 1: 127 bytes on wire (1016 bits), 127 bytes captured (1016 bits)
IEEE 802.3 Ethernet
Logical-Link Control
Cisco Discovery Protocol

No. Time Source Destination Protocol Length Info
2 0.179807 fe80::c274:adff:fe4d:253c ff02::16 ICMPv6 90 Multicast Listener Report Message v2

Frame 2: 90 bytes on wire (720 bits), 90 bytes captured (720 bits)
Ethernet II, Src: Grandstr_4d:25:3c (c0:74:ad:4d:25:3c), Dst: IPv6mcast_16 (33:33:00:00:00:16)
Internet Protocol Version 6, Src: fe80::c274:adff:fe4d:253c, Dst: ff02::16
Internet Control Message Protocol v6

No. Time Source Destination Protocol Length Info
3 0.236231 fe80::fd3b:b5c:121b:4f43 ff02::16 ICMPv6 90 Multicast Listener Report Message v2

Frame 3: 90 bytes on wire (720 bits), 90 bytes captured (720 bits)
Ethernet II, Src: HewlettP_39:e0:0b (ac:e2:d3:39:e0:0b), Dst: IPv6mcast_16 (33:33:00:00:00:16)
Internet Protocol Version 6, Src: fe80::fd3b:b5c:121b:4f43, Dst: ff02::16
Internet Control Message Protocol v6

No. Time Source Destination Protocol Length Info
4 0.531341 31.169.121.6 172.18.30.10 SIP 399 Request: REGISTER sip:172.18.30.10:5060 (1 binding) |

Frame 4: 399 bytes on wire (3192 bits), 399 bytes captured (3192 bits)
Ethernet II, Src: ARRISGro_7f:02:46 (20:f3:75:7f:02:46), Dst: Dell_9c:17:4d (54:bf:64:9c:17:4d)
Internet Protocol Version 4, Src: 31.169.121.6, Dst: 172.18.30.10
User Datagram Protocol, Src Port: 60418, Dst Port: 5060
Session Initiation Protocol (REGISTER)

No. Time Source Destination Protocol Length Info
5 0.531360 172.18.30.10 31.169.121.6 ICMP 427 Destination unreachable (Port unreachable)

Frame 5: 427 bytes on wire (3416 bits), 427 bytes captured (3416 bits)
Ethernet II, Src: Dell_9c:17:4d (54:bf:64:9c:17:4d), Dst: ARRISGro_7f:02:46 (20:f3:75:7f:02:46)
Internet Protocol Version 4, Src: 172.18.30.10, Dst: 31.169.121.6
Internet Control Message Protocol
Session Initiation Protocol (REGISTER)

No. Time Source Destination Protocol Length Info
6 1.307199 Ubiquiti_0d:55:75 Spanning-tree-(for-bridges)_00 STP 60 RST. Root = 32768/0/74:83:c2:0d:55:74 Cost = 0 Port = 0x8005

Frame 6: 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
IEEE 802.3 Ethernet
Logical-Link Control
Spanning Tree Protocol

No. Time Source Destination Protocol Length Info
7 1.978127 fe80::22f3:75ff:fe7f:246 ff02::1 ICMPv6 110 Router Advertisement from 20:f3:75:7f:02:46

Frame 7: 110 bytes on wire (880 bits), 110 bytes captured (880 bits)
Ethernet II, Src: ARRISGro_7f:02:46 (20:f3:75:7f:02:46), Dst: IPv6mcast_01 (33:33:00:00:00:01)
Internet Protocol Version 6, Src: fe80::22f3:75ff:fe7f:246, Dst: ff02::1
Internet Control Message Protocol v6

No. Time Source Destination Protocol Length Info
8 3.257723 ARRISGro_7f:02:46 Dell_9c:17:4d ARP 60 Who has 172.18.30.10? Tell 172.18.30.1

Frame 8: 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
Ethernet II, Src: ARRISGro_7f:02:46 (20:f3:75:7f:02:46), Dst: Dell_9c:17:4d (54:bf:64:9c:17:4d)
Address Resolution Protocol (request)

No. Time Source Destination Protocol Length Info
9 3.257734 Dell_9c:17:4d ARRISGro_7f:02:46 ARP 42 172.18.30.10 is at 54:bf:64:9c:17:4d

Frame 9: 42 bytes on wire (336 bits), 42 bytes captured (336 bits)
Ethernet II, Src: Dell_9c:17:4d (54:bf:64:9c:17:4d), Dst: ARRISGro_7f:02:46 (20:f3:75:7f:02:46)
Address Resolution Protocol (reply)

No. Time Source Destination Protocol Length Info
10 3.303650 Ubiquiti_0d:55:75 Spanning-tree-(for-bridges)_00 STP 60 RST. Root = 32768/0/74:83:c2:0d:55:74 Cost = 0 Port = 0x8005

Frame 10: 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
IEEE 802.3 Ethernet
Logical-Link Control
Spanning Tree Protocol

No. Time Source Destination Protocol Length Info
11 3.505602 172.18.30.101 255.255.255.255 UDP 198 43356 → 10001 Len=156

Frame 11: 198 bytes on wire (1584 bits), 198 bytes captured (1584 bits)
Ethernet II, Src: Ubiquiti_0d:55:74 (74:83:c2:0d:55:74), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Internet Protocol Version 4, Src: 172.18.30.101, Dst: 255.255.255.255
User Datagram Protocol, Src Port: 43356, Dst Port: 10001
Data (156 bytes)

0000 02 06 00 98 02 00 0a 74 83 c2 0d 55 74 ac 12 1e …t…Ut…
0010 65 01 00 06 74 83 c2 0d 55 74 0a 00 04 00 05 64 e…t…Ut…d
0020 eb 0b 00 04 55 42 4e 54 0c 00 08 55 53 31 36 50 …UBNT…US16P
0030 31 35 30 03 00 24 55 53 2e 62 63 6d 35 33 33 34 150…$US.bcm5334
0040 78 2e 76 33 2e 39 2e 35 34 2e 39 33 37 33 2e 31 x.v3.9.54.9373.1
0050 38 30 39 31 34 2e 30 30 30 35 16 00 0b 33 2e 39 80914.0005…3.9
0060 2e 35 34 2e 39 33 37 33 15 00 08 55 53 31 36 50 .54.9373…US16P
0070 31 35 30 17 00 01 01 18 00 01 00 19 00 01 01 1a 150…
0080 00 01 01 13 00 06 74 83 c2 0d 55 74 12 00 04 00 …t…Ut…
0090 00 89 d1 1b 00 06 33 2e 33 2e 31 33 …3.3.13

No. Time Source Destination Protocol Length Info
12 4.068532 67.205.174.60 172.18.30.10 TCP 74 58468 → 80 [SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM=1 TSval=591584582 TSecr=0 WS=128

Frame 12: 74 bytes on wire (592 bits), 74 bytes captured (592 bits)
Ethernet II, Src: ARRISGro_7f:02:46 (20:f3:75:7f:02:46), Dst: Dell_9c:17:4d (54:bf:64:9c:17:4d)
Internet Protocol Version 4, Src: 67.205.174.60, Dst: 172.18.30.10
Transmission Control Protocol, Src Port: 58468, Dst Port: 80, Seq: 0, Len: 0

I hope this is enough information to maybe get an idea of what’s causing the issue but if not, please advise on what would help out. Our CO has checked the trunk side and sees no configuration issues.

Thanks!

Not really. We need the full payload of the SIP UDP packets, e.g. we would be looking at request URIs and To: headers, neither of which are provided here.

Also, which channel driver are you using.

Assuming that the SIP is actually reaching Asterisk, the most familiar form is the output to /var/log/asterisk/full after using the CLI command “pjsip set logger on” or “sip set debug on”, as appropriate. The preferred way of presenting this for this forum is to upload to pastebin.freepbx.org and include the URL here, or at least the identifier part of it.

Great. With the catch-all route in place, make a test call in. In FreePBX, go to Reports → CDR Reports, click Search and see what appeared in the DID field for your call. If it’s a recognizable number, set up your Inbound Routes accordingly and you should be good to go.

If it’s S, your username or something else that isn’t unique for each number, change the Context for the trunk to from-pstn-toheader and retest.

If that also doesn’t help, paste a log as noted by @david55 .

1 Like

Thanks david55. I really appreciate the guidance on presenting the data. On a side note, when I see people posting Peer Details on here, is this some sort of export? I’m really new at the data retrieval / presentation part of this so I’m beyond grateful for any and all direction.

I’ll try to get a moment to get that file and dump it in pastebin.

OK. I performed a test inbound call and grabbed the var/log/asterisk/full record. here is the URL shortcut:

https://pastebin.freepbx.org/view/cb927efd

Thanks!

Also, Stewart1 …

I looked at the CDR Report as suggested. When placing the inbound call with ANY set instead of the DID, I’m getting:

CallerID: “Pikeville KY” <6067940099>
DID: 4798991; phone-context=private
App: Dial
Destination: 5001

When defining the DID as 4798991, I get:

CallerID: 6067940099
DID: (BLANK) not the word, just the void …
App: SayAlpha
Destination: s[from-trunk]

When setting the trunk context to from-pstn-toheader the Destination changes to: s[from-pstn] with all other fields remaining the same.

OK, so it appears that the trunk is adding the phone-context parameter to the SIP URI and FreePBX is not smart enough to strip it off, so it doesn’t match.

Try making an Inbound Route with DID Number set to
_4798991.
and retest. If no luck, change the trunk Context to from-pstn-toheader and retest with an ANY/ANY route. With luck the DID should show up differently and we’ll be able to match that.

1 Like

Unfortunately, we got nothing new. With the DID set as _4798991, we are still getting 4798991;phone-context=private in the DID column with extension 5001 (assigned) as the destination. Inbound calling still giving Line Not in Service in this configuration.

Please note the dot at the end of
_4798991.

I see nothing different in the CDR Report but I’ll be darned if that didn’t fix it. I also set the 2nd inbound route to _4798992. and it rang in properly as well. Outstanding Sir! Thank you so much! So what is the functionality of the underscore and the period?

_ indicates that it is a pattern and the . means that matches can have arbitrary numbers of additional characters; it is a wild card.

Thank you Stewart1 and david55. Not only is my issue resolved but I now understand why. I actually see the extra characters that the trunk is sending and I’ll speak to the CO about it on Monday. Have a great weekend fellas.

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