PJSIP No Audo / Port unreachable

I’m attempting to setup a Comcast business SIP trunk that I can get working with chan_sip, but not with pjsip. Signalling works, calls ring/answer, but no audio on either side. I’ve tried various config options and asterisk13 and 16.

Setup:

  • FreeBSD 12.0
  • Tried Asterisk 13.25.0 & 16.2.1
  • There’s no NAT, but the system has two network interfaces
    • Phone network : 10.4.3.1/255.255.252.0
    • Vendor network: 10.0.0.201/255.255.255.252

There’s no authentication/registration required on the trunk endpoint. I’m attaching the working config from sip.conf and what I’m trying in pjsip.conf (though I have tried lots of options, and no, I’m not trying both at the same time).

On that vendor interface, the Asterisk IP is 10.0.0.202, and the Comcast Adtran device is 10.0.0.201. There is no firewall.

sip.conf (works)

[comcast]
type=peer
context=incoming
host=10.0.0.201
port=5060
insecure=port,invite
qualify=yes
allow=ulaw
session-minse=930
session-expires=1920
session-timers=originate
dtmfmode=rfc2833
directmedia=no

pjsip.conf (does not work)

[transport-comcast-udp]
type=transport
protocol=udp
bind=10.0.0.202:5060
; tried with and without these options
local_net=10.0.0.201/255.255.255.252
external_media_address=10.0.0.201
external_signaling_address=10.0.0.201

[comcast]
type=endpoint
context=incoming
dtmf_mode=rfc4733
disallow=all
allow=ulaw
aors=comcast
identify_by=ip
direct_media=no
rewrite_contact=yes
timers_min_se=930
timers_sess_expires=1920

[comcast]
type=aor
contact=sip:10.0.0.201:5060
qualify_frequency=300
authenticate_qualify=no

[comcast]
type=identify
endpoint=comcast
match=10.0.0.201

So if I place calls, either inbound or outbound, signaling goes through, I get all the INVITEs / Trying / OKs / ACKs, the other side rings, picks up. On the RTP side, I see media come in from the trunk to Asterisk, but the server seems to respond that the Destination/Port is unreachable. I’ll try to show a little of the call capture below:

Console with rtp set debug on:

 <--- Received SIP request (943 bytes) from UDP:10.0.0.201:5060 --->
INVITE sip:<our DID here>@10.0.0.202:5060 SIP/2.0
From: "A Person" <sip:<inbound number here>@10.0.0.202:5060;transport=UDP>;tag=734bd58-7f000001-13c4-1dea50-dfa1874f-1dea50
To: <sip:<our DID here>@10.0.0.202:5060>
Call-ID: 73e83a8-7f000001-13c4-1dea50-fad90986-1dea50@10.0.0.202
CSeq: 1 INVITE
Via: SIP/2.0/UDP 10.0.0.201:5060;branch=z9hG4bK-1dea50-74db4a57-71fe68ca
Max-Forwards: 70
Supported: replaces
Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, PRACK, REFER, REGISTER
User-Agent: ADTRAN_NetVanta_3430/R11.4.3.V (s001992f387ee)
P-Asserted-Identity: "A Person" <sip:<inbound number here>@10.0.0.202>
Contact: <sip:<inbound number here>@10.0.0.201:5060;transport=UDP>
Content-Type: application/sdp
Content-Length: 231

v=0
o=Sonus_UAC 461882 436682 IN IP4 10.0.0.201
s=SIP Media Capabilities
c=IN IP4 10.0.0.201
t=0 0
m=audio 10740 RTP/AVP 0 101
a=sendrecv
a=ptime:20
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=  == Setting global variable 'SIPDOMAIN' to '10.0.0.202'
<--- Transmitting SIP response (390 bytes) to UDP:10.0.0.201:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.0.0.201:5060;rport=5060;received=10.0.0.201;branch=z9hG4bK-1dea50-74db4a57-71fe68ca
Call-ID: 73e83a8-7f000001-13c4-1dea50-fad90986-1dea50@10.0.0.202
From: "A Person" <sip:<inbound number>@10.0.0.202>;tag=734bd58-7f000001-13c4-1dea50-dfa1874f-1dea50
To: <sip:<our DID here>@10.0.0.202>
CSeq: 1 INVITE
Server: Asterisk PBX 13.25.0
Content-Length:  0


    -- Executing [<our DID here>@incoming:1] Answer("PJSIP/comcast-00000002", "") in new stack
       > 0x807edd000 -- Strict RTP learning after remote address set to: 10.0.0.201:10740
<--- Transmitting SIP response (877 bytes) to UDP:10.0.0.201:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.0.0.201:5060;rport=5060;received=10.0.0.201;branch=z9hG4bK-1dea50-74db4a57-71fe68ca
Call-ID: 73e83a8-7f000001-13c4-1dea50-fad90986-1dea50@10.0.0.202
From: "A Person" <sip:<inbound number>@10.0.0.202>;tag=734bd58-7f000001-13c4-1dea50-dfa1874f-1dea50
To: <sip:<our DID here>@10.0.0.202>;tag=a171dd77-ea70-42e6-a041-54699acd0244
CSeq: 1 INVITE
Server: Asterisk PBX 13.25.0
Contact: <sip:10.0.0.202:5060>
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Content-Type: application/sdp
Content-Length:   225

v=0
o=- 461882 436684 IN IP4 10.0.0.202
s=Asterisk
c=IN IP4 10.0.0.202
t=0 0
m=audio 29294 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

<--- Received SIP request (712 bytes) from UDP:10.0.0.201:5060 --->
ACK sip:10.0.0.202:5060;transport=UDP SIP/2.0
From: "A Person" <sip:<inbound number>@10.0.0.202:5060;transport=UDP>;tag=734bd58-7f000001-13c4-1dea50-dfa1874f-1dea50
To: <sip:<our DID here>@10.0.0.202>;tag=a171dd77-ea70-42e6-a041-54699acd0244
Call-ID: 73e83a8-7f000001-13c4-1dea50-fad90986-1dea50@10.0.0.202
CSeq: 1 ACK
Via: SIP/2.0/UDP 10.0.0.201:5060;branch=z9hG4bK-1dea50-74db4ab4-7b75d74d
Max-Forwards: 70
Supported: replaces
Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, PRACK, REFER, REGISTER
User-Agent: ADTRAN_NetVanta_3430/R11.4.3.V (s001992f387ee)
P-Asserted-Identity: "A Person" <sip:<inbound number>@10.0.0.202>
Contact: <sip:<inbound number>@10.0.0.201:5060;transport=UDP>
Content-Length: 0


    -- Executing [<our DID here>@incoming:2] Wait("PJSIP/comcast-00000002", "1") in new stack
    -- Executing [<our DID here>@incoming:3] Verbose("PJSIP/comcast-00000002", ""OKAY! Send to Echo Test!"") in new stack
OKAY! Send to Echo Test!
    -- Executing [<our DID here>@incoming:4] Playback("PJSIP/comcast-00000002", "demo-echotest") in new stack
Sent RTP packet to      10.0.0.201:10740 (type 00, seq 002999, ts 000160, len -000013)
    -- <PJSIP/comcast-00000002> Playing 'demo-echotest.gsm' (language 'en')
Sent RTP packet to      10.0.0.201:10740 (type 00, seq 003000, ts 000320, len -000013)
Sent RTP packet to      10.0.0.201:10740 (type 00, seq 003001, ts 000480, len -000013)
Sent RTP packet to      10.0.0.201:10740 (type 00, seq 003002, ts 000640, len -000013)
Sent RTP packet to      10.0.0.201:10740 (type 00, seq 003003, ts 000800, len -000013)
(above repeats....)

On the tshark side, I get these weird ICMP Destination unreachable packets…

Wireshark:

10.0.0.201 ? 10.0.0.202   SIP/SDP 985 Request: INVITE sip:<our DID here>@10.0.0.202:5060 |
10.0.0.202 ? 10.0.0.201   SIP 432 Status: 100 Trying |
10.0.0.202 ? 10.0.0.201   SIP/SDP 919 Status: 200 OK |
10.0.0.201 ? 10.0.0.202   SIP 754 Request: ACK sip:10.0.0.202:5060;transport=UDP |
10.0.0.201 ? 10.0.0.202   RTP 214 PT=ITU-T G.711 PCMU, SSRC=0x829BAD93, Seq=0, Time=0, Mark
10.0.0.202 ? 10.0.0.201   ICMP 242 Destination unreachable (Port unreachable)
10.0.0.201 ? 10.0.0.202   RTP 214 PT=ITU-T G.711 PCMU, SSRC=0x829BAD93, Seq=1, Time=160
10.0.0.202 ? 10.0.0.201   ICMP 242 Destination unreachable (Port unreachable)
10.0.0.201 ? 10.0.0.202   RTP 214 PT=ITU-T G.711 PCMU, SSRC=0x829BAD93, Seq=2, Time=320
10.0.0.202 ? 10.0.0.201   ICMP 242 Destination unreachable (Port unreachable)
(repeats)

I really appreciate any help that can be provided and let me know if other information is needed. This one has been puzzling me for a couple days now.

I would start with changing the call flow, us MusicOnHold first.

Call the DID and see if you hear the MOH.

First get that working, proceed from there.

The unreachable port is ICMP protocol, not the SIP, the call setup proces is fine.

The ICMP is being sent in response to RTP to a port which is either not being listened to, on the interface, or is firewall blocked.

I also note that the RTP that Asterisk is sending is not being seen at the packet capture point.

The wireshark information is over-summarised, e.g. the RTP will have a port number and the ICMP will contain the prefix of the rejected packet, which would confirm that it is the RTP.

Thanks for the responses. I’m playing the “demo-echotest” sound file first before going to the Echo function, and don’t hear any audio from the sound file or the echo test, so that should be equivalent to your MOH suggestion. I’ve also tried recording the call to try and see if I’m getting anything from that end and the result is an empty file.

As I mentioned, there’s no firewall. Indeed, switching over to chan_sip and the call works fine.

Sorry about not enough detail in the capture. I’ll try to provide more from tcpdump. If there’s some flag that would add needed detail please let me know.

10:45:16.712551 IP (tos 0x68, ttl 255, id 65457, offset 0, flags [none], proto UDP (17), length 971)
    10.0.0.201.sip > 10.0.0.202.sip: SIP, length: 943
        INVITE sip:971XXXXXXX@10.0.0.202:5060 SIP/2.0
        From: "A Person" <sip:301XXXXXXX@10.0.0.202:5060;transport=UDP>;tag=738fa08-7f000001-13c4-1f2961-ef6b4f78-1f2961
        To: <sip:971XXXXXXX@10.0.0.202:5060>
        Call-ID: 73ea248-7f000001-13c4-1f2961-8433a91c-1f2961@10.0.0.202
        CSeq: 1 INVITE
        Via: SIP/2.0/UDP 10.0.0.201:5060;branch=z9hG4bK-1f2961-79b9a440-61a2c77c
        Max-Forwards: 70
        Supported: replaces
        Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, PRACK, REFER, REGISTER
        User-Agent: ADTRAN_NetVanta_3430/R11.4.3.V (s001992f387ee)
        P-Asserted-Identity: "A Person" <sip:301XXXXXXX@10.0.0.202>
        Contact: <sip:301XXXXXXX@10.0.0.201:5060;transport=UDP>
        Content-Type: application/sdp
        Content-Length: 231

        v=0
        o=Sonus_UAC 514561 607003 IN IP4 10.0.0.201
        s=SIP Media Capabilities
        c=IN IP4 10.0.0.201
        t=0 0
        m=audio 10768 RTP/AVP 0 101
        a=sendrecv
        a=ptime:20
        a=rtpmap:0 PCMU/8000
        a=rtpmap:101 telephone-event/8000
        a=fmtp:101 0-15
10:45:16.712751 IP (tos 0x0, ttl 64, id 37090, offset 0, flags [none], proto UDP (17), length 417, bad cksum 0 (->d2d7)!)
    10.0.0.202.sip > 10.0.0.201.sip: SIP, length: 389
        SIP/2.0 100 Trying
        Via: SIP/2.0/UDP 10.0.0.201:5060;rport=5060;received=10.0.0.201;branch=z9hG4bK-1f2961-79b9a440-61a2c77c
        Call-ID: 73ea248-7f000001-13c4-1f2961-8433a91c-1f2961@10.0.0.202
        From: "A Person" <sip:301XXXXXXX@10.0.0.202>;tag=738fa08-7f000001-13c4-1f2961-ef6b4f78-1f2961
        To: <sip:971XXXXXXX@10.0.0.202>
        CSeq: 1 INVITE
        Server: Asterisk PBX 16.2.1
        Content-Length:  0

10:45:16.714193 IP (tos 0x0, ttl 64, id 37075, offset 0, flags [none], proto UDP (17), length 904, bad cksum 0 (->d0ff)!)
    10.0.0.202.sip > 10.0.0.201.sip: SIP, length: 876
        SIP/2.0 200 OK
        Via: SIP/2.0/UDP 10.0.0.201:5060;rport=5060;received=10.0.0.201;branch=z9hG4bK-1f2961-79b9a440-61a2c77c
        Call-ID: 73ea248-7f000001-13c4-1f2961-8433a91c-1f2961@10.0.0.202
        From: "A Person" <sip:301XXXXXXX@10.0.0.202>;tag=738fa08-7f000001-13c4-1f2961-ef6b4f78-1f2961
        To: <sip:971XXXXXXX@10.0.0.202>;tag=482b2b6f-bd2b-44f5-b136-8b1f4aa6beb7
        CSeq: 1 INVITE
        Server: Asterisk PBX 16.2.1
        Contact: <sip:10.0.0.202:5060>
        Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
        Supported: 100rel, timer, replaces, norefersub
        Content-Type: application/sdp
        Content-Length:   225

        v=0
        o=- 514561 607005 IN IP4 10.0.0.202
        s=Asterisk
        c=IN IP4 10.0.0.202
        t=0 0
        m=audio 10886 RTP/AVP 0 101
        a=rtpmap:0 PCMU/8000
        a=rtpmap:101 telephone-event/8000
        a=fmtp:101 0-16
        a=ptime:20
        a=maxptime:150
        a=sendrecv

10:45:16.805134 IP (tos 0x68, ttl 255, id 65462, offset 0, flags [none], proto UDP (17), length 740)
    10.0.0.201.sip > 10.0.0.202.sip: SIP, length: 712
        ACK sip:10.0.0.202:5060;transport=UDP SIP/2.0
        From: "A Person" <sip:301XXXXXXX@10.0.0.202:5060;transport=UDP>;tag=738fa08-7f000001-13c4-1f2961-ef6b4f78-1f2961
        To: <sip:971XXXXXXX@10.0.0.202>;tag=482b2b6f-bd2b-44f5-b136-8b1f4aa6beb7
        Call-ID: 73ea248-7f000001-13c4-1f2961-8433a91c-1f2961@10.0.0.202
        CSeq: 1 ACK
        Via: SIP/2.0/UDP 10.0.0.201:5060;branch=z9hG4bK-1f2961-79b9a49d-58cd0f83
        Max-Forwards: 70
        Supported: replaces
        Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, PRACK, REFER, REGISTER
        User-Agent: ADTRAN_NetVanta_3430/R11.4.3.V (s001992f387ee)
        P-Asserted-Identity: "A Person" <sip:301XXXXXXX@10.0.0.202>
        Contact: <sip:301XXXXXXX@10.0.0.201:5060;transport=UDP>
        Content-Length: 0

10:45:16.815031 IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10768 > 10.0.0.202.10886: UDP, length 172
10:45:16.815035 IP (tos 0x0, ttl 64, id 50284, offset 0, flags [none], proto ICMP (1), length 228, bad cksum 0 (->a01a)!)
    10.0.0.202 > 10.0.0.201: ICMP 10.0.0.202 udp port 10886 unreachable, length 208
        IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10768 > 10.0.0.202.10886: UDP, length 172
        MPLS extension v15 packet not supported
10:45:16.835163 IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10768 > 10.0.0.202.10886: UDP, length 172
10:45:16.835165 IP (tos 0x0, ttl 64, id 50285, offset 0, flags [none], proto ICMP (1), length 228, bad cksum 0 (->a019)!)
    10.0.0.202 > 10.0.0.201: ICMP 10.0.0.202 udp port 10886 unreachable, length 208
        IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10768 > 10.0.0.202.10886: UDP, length 172
        MPLS extension v15 packet not supported
10:45:16.854841 IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10768 > 10.0.0.202.10886: UDP, length 172
10:45:16.854843 IP (tos 0x0, ttl 64, id 50286, offset 0, flags [none], proto ICMP (1), length 228, bad cksum 0 (->a018)!)
    10.0.0.202 > 10.0.0.201: ICMP 10.0.0.202 udp port 10886 unreachable, length 208
        IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10768 > 10.0.0.202.10886: UDP, length 172
        MPLS extension v15 packet not supported
10:45:16.874821 IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10768 > 10.0.0.202.10886: UDP, length 172
10:45:16.874822 IP (tos 0x0, ttl 64, id 50287, offset 0, flags [none], proto ICMP (1), length 228, bad cksum 0 (->a017)!)
    10.0.0.202 > 10.0.0.201: ICMP 10.0.0.202 udp port 10886 unreachable, length 208
        IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10768 > 10.0.0.202.10886: UDP, length 172
        MPLS extension v15 packet not supported
10:45:16.894800 IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10768 > 10.0.0.202.10886: UDP, length 172
10:45:16.894801 IP (tos 0x0, ttl 64, id 50288, offset 0, flags [none], proto ICMP (1), length 228, bad cksum 0 (->a016)!)
    10.0.0.202 > 10.0.0.201: ICMP 10.0.0.202 udp port 10886 unreachable, length 208
        IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10768 > 10.0.0.202.10886: UDP, length 172
        MPLS extension v15 packet not supported
10:45:16.914779 IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10768 > 10.0.0.202.10886: UDP, length 172
10:45:16.914780 IP (tos 0x0, ttl 64, id 50289, offset 0, flags [none], proto ICMP (1), length 228, bad cksum 0 (->a015)!)
    10.0.0.202 > 10.0.0.201: ICMP 10.0.0.202 udp port 10886 unreachable, length 208
        IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10768 > 10.0.0.202.10886: UDP, length 172
        MPLS extension v15 packet not supported
10:45:16.934759 IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10768 > 10.0.0.202.10886: UDP, length 172
10:45:16.934762 IP (tos 0x0, ttl 64, id 37091, offset 0, flags [none], proto ICMP (1), length 228, bad cksum 0 (->d3a3)!)
    10.0.0.202 > 10.0.0.201: ICMP 10.0.0.202 udp port 10886 unreachable, length 208
        IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10768 > 10.0.0.202.10886: UDP, length 172
        MPLS extension v15 packet not supported
10:45:16.954740 IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10768 > 10.0.0.202.10886: UDP, length 172
10:45:16.954741 IP (tos 0x0, ttl 64, id 37092, offset 0, flags [none], proto ICMP (1), length 228, bad cksum 0 (->d3a2)!)
    10.0.0.202 > 10.0.0.201: ICMP 10.0.0.202 udp port 10886 unreachable, length 208
        IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10768 > 10.0.0.202.10886: UDP, length 172
        MPLS extension v15 packet not supported

It really looks like there’s a firewall blocking RTP, but like I said, there is no firewall and the same call works when switching to chan_sip. It feels like pjsip just isn’t open the port for some reason. Maybe something on the transport settings, but I’m just guessing. Below is a working SIP call:

11:00:00.248086 IP (tos 0x68, ttl 255, id 142, offset 0, flags [none], proto UDP (17), length 971)
    10.0.0.201.sip > 10.0.0.202.sip: SIP, length: 943
        INVITE sip:971XXXXXXX@10.0.0.202:5060 SIP/2.0
        From: "A Person" <sip:301XXXXXXX@10.0.0.202:5060;transport=UDP>;tag=73204a0-7f000001-13c4-1f2cd4-aa045d66-1f2cd4
        To: <sip:971XXXXXXX@10.0.0.202:5060>
        Call-ID: 73eb828-7f000001-13c4-1f2cd4-a9c47ffd-1f2cd4@10.0.0.202
        CSeq: 1 INVITE
        Via: SIP/2.0/UDP 10.0.0.201:5060;branch=z9hG4bK-1f2cd4-79c71f3c-1b030e25
        Max-Forwards: 70
        Supported: replaces
        Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, PRACK, REFER, REGISTER
        User-Agent: ADTRAN_NetVanta_3430/R11.4.3.V (s001992f387ee)
        P-Asserted-Identity: "A Person" <sip:301XXXXXXX@10.0.0.202>
        Contact: <sip:301XXXXXXX@10.0.0.201:5060;transport=UDP>
        Content-Type: application/sdp
        Content-Length: 231

        v=0
        o=Sonus_UAC 517206 565821 IN IP4 10.0.0.201
        s=SIP Media Capabilities
        c=IN IP4 10.0.0.201
        t=0 0
        m=audio 10780 RTP/AVP 0 101
        a=sendrecv
        a=ptime:20
        a=rtpmap:0 PCMU/8000
        a=rtpmap:101 telephone-event/8000
        a=fmtp:101 0-15
11:00:00.250139 IP (tos 0x0, ttl 64, id 37156, offset 0, flags [none], proto UDP (17), length 629, bad cksum 0 (->d1c1)!)
    10.0.0.202.sip > 10.0.0.201.sip: SIP, length: 601
        SIP/2.0 100 Trying
        Via: SIP/2.0/UDP 10.0.0.201:5060;branch=z9hG4bK-1f2cd4-79c71f3c-1b030e25;received=10.0.0.201
        From: "A Person" <sip:301XXXXXXX@10.0.0.202:5060;transport=UDP>;tag=73204a0-7f000001-13c4-1f2cd4-aa045d66-1f2cd4
        To: <sip:971XXXXXXX@10.0.0.202:5060>
        Call-ID: 73eb828-7f000001-13c4-1f2cd4-a9c47ffd-1f2cd4@10.0.0.202
        CSeq: 1 INVITE
        Server: Asterisk PBX 16.2.1
        Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
        Supported: replaces, timer
        Session-Expires: 1920;refresher=uas
        Contact: <sip:971XXXXXXX@10.0.0.202:5060>
        Content-Length: 0

11:00:00.250324 IP (tos 0x0, ttl 64, id 59182, offset 0, flags [none], proto UDP (17), length 908, bad cksum 0 (->7aa0)!)
    10.0.0.202.sip > 10.0.0.201.sip: SIP, length: 880
        SIP/2.0 200 OK
        Via: SIP/2.0/UDP 10.0.0.201:5060;branch=z9hG4bK-1f2cd4-79c71f3c-1b030e25;received=10.0.0.201
        From: "A Person" <sip:301XXXXXXX@10.0.0.202:5060;transport=UDP>;tag=73204a0-7f000001-13c4-1f2cd4-aa045d66-1f2cd4
        To: <sip:971XXXXXXX@10.0.0.202:5060>;tag=as6b34065b
        Call-ID: 73eb828-7f000001-13c4-1f2cd4-a9c47ffd-1f2cd4@10.0.0.202
        CSeq: 1 INVITE
        Server: Asterisk PBX 16.2.1
        Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
        Supported: replaces, timer
        Session-Expires: 1920;refresher=uas
        Contact: <sip:971XXXXXXX@10.0.0.202:5060>
        Content-Type: application/sdp
        Content-Length: 235

        v=0
        o=root 1505109749 1505109749 IN IP4 10.0.0.202
        s=Asterisk PBX 16.2.1
        c=IN IP4 10.0.0.202
        t=0 0
        m=audio 12448 RTP/AVP 0 101
        a=rtpmap:0 PCMU/8000
        a=rtpmap:101 telephone-event/8000
        a=fmtp:101 0-16
        a=maxptime:150
        a=sendrecv

11:00:00.342760 IP (tos 0x68, ttl 255, id 147, offset 0, flags [none], proto UDP (17), length 730)
    10.0.0.201.sip > 10.0.0.202.sip: SIP, length: 702
        ACK sip:971XXXXXXX@10.0.0.202:5060;transport=UDP SIP/2.0
        From: "A Person" <sip:301XXXXXXX@10.0.0.202:5060;transport=UDP>;tag=73204a0-7f000001-13c4-1f2cd4-aa045d66-1f2cd4
        To: <sip:971XXXXXXX@10.0.0.202:5060>;tag=as6b34065b
        Call-ID: 73eb828-7f000001-13c4-1f2cd4-a9c47ffd-1f2cd4@10.0.0.202
        CSeq: 1 ACK
        Via: SIP/2.0/UDP 10.0.0.201:5060;branch=z9hG4bK-1f2cd4-79c71f9a-336c67a0
        Max-Forwards: 70
        Supported: replaces
        Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, PRACK, REFER, REGISTER
        User-Agent: ADTRAN_NetVanta_3430/R11.4.3.V (s001992f387ee)
        P-Asserted-Identity: "A Person" <sip:301XXXXXXX@10.0.0.202>
        Contact: <sip:301XXXXXXX@10.0.0.201:5060;transport=UDP>
        Content-Length: 0

11:00:00.347113 IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10780 > 10.0.0.202.12448: UDP, length 172
11:00:00.367215 IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10780 > 10.0.0.202.12448: UDP, length 172
11:00:00.386866 IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10780 > 10.0.0.202.12448: UDP, length 172
11:00:00.406817 IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10780 > 10.0.0.202.12448: UDP, length 172
11:00:00.426918 IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10780 > 10.0.0.202.12448: UDP, length 172
11:00:00.446869 IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10780 > 10.0.0.202.12448: UDP, length 172
11:00:00.466819 IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10780 > 10.0.0.202.12448: UDP, length 172
11:00:00.486921 IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10780 > 10.0.0.202.12448: UDP, length 172
11:00:00.506872 IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10780 > 10.0.0.202.12448: UDP, length 172
11:00:00.526822 IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10780 > 10.0.0.202.12448: UDP, length 172
11:00:00.546769 IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10780 > 10.0.0.202.12448: UDP, length 172
11:00:00.566874 IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10780 > 10.0.0.202.12448: UDP, length 172
11:00:00.586825 IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10780 > 10.0.0.202.12448: UDP, length 172
11:00:00.606777 IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10780 > 10.0.0.202.12448: UDP, length 172
11:00:00.626877 IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10780 > 10.0.0.202.12448: UDP, length 172
11:00:00.646828 IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10780 > 10.0.0.202.12448: UDP, length 172
...
11:00:01.347895 IP (tos 0x0, ttl 64, id 37157, offset 0, flags [none], proto UDP (17), length 200, bad cksum 0 (->d36d)!)
    10.0.0.202.12448 > 10.0.0.201.10780: UDP, length 172
11:00:01.366377 IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10780 > 10.0.0.202.12448: UDP, length 172
11:00:01.368854 IP (tos 0x0, ttl 64, id 37158, offset 0, flags [none], proto UDP (17), length 200, bad cksum 0 (->d36c)!)
    10.0.0.202.12448 > 10.0.0.201.10780: UDP, length 172
11:00:01.386436 IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10780 > 10.0.0.202.12448: UDP, length 172
11:00:01.388851 IP (tos 0x0, ttl 64, id 37159, offset 0, flags [none], proto UDP (17), length 200, bad cksum 0 (->d36b)!)
    10.0.0.202.12448 > 10.0.0.201.10780: UDP, length 172
11:00:01.406432 IP (tos 0xb8, ttl 52, id 0, offset 0, flags [DF], proto UDP (17), length 200)
    10.0.0.201.10780 > 10.0.0.202.12448: UDP, length 172
11:00:01.408851 IP (tos 0x0, ttl 64, id 37160, offset 0, flags [none], proto UDP (17), length 200, bad cksum 0 (->d36a)!)
    10.0.0.202.12448 > 10.0.0.201.10780: UDP, length 172

I would fix your external* parameters, but they don’t seem to be being used, and your local networks (there should not be any bits set to the left of the / that are not in the mask, although some implementations tolerate this), but Asterisk doesn’t seem to be interpreting this as NAT, anyway.

I left those lines in there to show some of the things I’ve tried. I’m not doing NAT, so my understanding those lines should not be needed. Same result with them in or out.

About the only thing I can think of is that the media socket may be bound to the wrong interface, so use netstat to see if that is the case.

The internet is, by definition, a single area for routing, so your configuration isn’t the internet. Whilst things have been bolted on to allow private networks and NAT, those weren’t designed to cope with more than one private sub-internet. As such, I’m not entirely surprised that this sort of configuration breaks.

I find it very odd that there is a negative length. It appears the RTP packet is not being transmitted. I’m not sure why that would be the case here. However you may be able to confirm this by increasing the debug logging in Asterisk:

core set debug 5

You should see something like “RTP Transmission error of packet …” in the log.

That was it! I’m surprised that this is the behavior, but when looking at the sockets when the media was supposed to be playing, I saw:

# sockstat | grep asterisk
root     asterisk   68696 6  stream /var/run/asterisk/asterisk.ctl
root     asterisk   68696 7  udp4   *:22100               *:*
root     asterisk   68696 8  udp6   *:57975               *:*
root     asterisk   68696 9  udp4   10.4.3.1:5062         *:*
root     asterisk   68696 10 udp4   10.0.0.202:5060       *:*
root     asterisk   68696 11 udp4   *:5060                *:*
root     asterisk   68696 17 udp6   *:16654               *:*
root     asterisk   68696 18 udp6   *:16655               *:*
root     asterisk   68657 3  stream (not connected)

So, I’m guessing when it’s binding to *:16654, it’s attaching to the first interface (10.4.3.1), not the one the endpoint is configured on (10.0.0.202). And it’s trying to do ipv6 for some reason?

So I tried adding to the endpoint config:

media_address=10.0.0.202
bind_rtp_to_media_address=yes

and now it’s attached to the right interface (and ipv4) and media works!:

root     asterisk   68721 17 udp4   10.0.0.202:16052      *:*
root     asterisk   68721 18 udp4   10.0.0.202:16053      *:*

I had tried the media_address setting before, but I had assumed it was the remote media end; I didn’t think to try setting to my end.

I’m still surprised by the different behavior here between chan_sip and pjsip, but hey, it’s at least working now! Thanks!

2 Likes

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