16.5 codec inbound issue from mobile

Hi there.
I have a strange issue i cant get my head around. If someone can enlighten me with what’s going on would be appreciated.
Sorry in advance… struggled to make this look pretty.

####################Summary####################
chan_sip config works fine on Asterisk 13 “everything is awesome…!”

We are doing our testing for migrating to Asterisk 16 as per the support life-cycle.
and on 16.5 using pjsip i have this issue with the same provider

  • incoming calls from “Telstra cell phone” through VSP causes the error:
    channel.c:5589 set_format: Unable to find a codec translation path: (g729) -> (alaw)
    “outgoing calls to Telstra are fine”
    NOTE: incoming calls from other providers are fine… just in from my Telstra Mobile is broken.
    NOTE2: I dont have or want G729 codec anywhere

is this a configuration on my end?.
Why does it work fine on Asterisk 13 and chan_sip

Any tips ?

Thanks in advance.

#info

** running Asterisk 13 on ubuntu apt installed and everything is great

Asterisk 13.18.3~dfsg-1ubuntu4 built by nobody at buildd.debian. org on a unknown running Linux on 2018-02-28 06:44:47 UTC

** BUT pjsip config on 16.5 compiled and on same OS

-----SAME VSP and account details.

testpbx-2CLI> core show version
Asterisk 16.5.0 built by root @ testpbx-2 on a x86_64 running Linux on 2019-09-01 11:03:22 UTC
testpbx-2
CLI>

CONFIG BELOW!!!
#################
#################

####################SIP HISTORY#################### 
**testpbx-2*CLI> pjsip show history where number = 00000**


<--- History Entry 0 Received from 203.2.134.1:5060 at 1567384890 --->
INVITE sip:PHONENUMBER @ PBX.ipaddr:5060;line=elacjeb SIP/2.0
Via: SIP/2.0/UDP 203.2.134.1:5060;received=203.2.134.1;branch=z9hG4bKdb18jb20dolp08dku100.1
From: <sip:MOBILENUMBER @ 203.2.134.129;user=phone>;tag=284947600-1567384890779-
To: "NodePhone" <sip:PHONENUMBER @ FQDN ;line=elacjeb>
Call-ID: BW004130779020919-1955374055 @ 203.2.134.129
CSeq: 934655694 INVITE
Contact: <sip:MOBILENUMBER @ 203.2.134.1:5060;transport=udp>
Supported: 100rel
Allow: ACK, BYE, CANCEL, INFO, INVITE, OPTIONS, PRACK, REFER, NOTIFY
Recv-Info: x-broadworks-client-session-info
Accept: application/media_control+xml, application/sdp, multipart/mixed
Max-Forwards: 69
Content-Type: application/sdp
Content-Length: 227
Content-Type: application/sdp
Content-Length:   227

v=0
o=BroadWorks 38774207 1 IN IP4 203.2.134.1
s=-
c=IN IP4 203.2.134.1
t=0 0
m=audio 20704 RTP/AVP 8 0 18 106 101
**a=rtpmap:106 G.729b/8000**
a=rtpmap:101 telephone-event/80


**testpbx-2*CLI> pjsip show history where number = 00002**
<--- History Entry 2 Sent to Endpoint_ipaddr:5060 at 1567384890 --->
INVITE sip:6001 @ Endpoint_ipaddr;transport=udp SIP/2.0
Via: SIP/2.0/UDP PBX.ipaddress:5060;rport;branch=z9hG4bKPjadea4019-002c-4d4a-b18c-e3139bba1cfe
From: "Main Ring Group" <sip:MOBILENUMBER @ PBX.ipaddress>;tag=690cb88b-0ba5-4ec9-beaa-3d509ad13960
To: <sip:6001 @ Endpoint_ipaddr>
Contact: <sip:asterisk @ PBX.ipaddress:5060>
Call-ID: 5b6b3433-5436-46a7-9864-cd33d18e7de5
CSeq: 17896 INVITE
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
Remote-Party-ID: "Main Ring Group" <sip:MOBILENUMBER @ PBX.ipaddress>;party=calling;privacy=off;screen=no
Max-Forwards: 70
User-Agent: Asterisk PBX 16.5.0
Content-Type: application/sdp
Content-Length:   237

v=0
o=- 1635044233 1635044233 IN IP4 PBX.ipaddress
s=Asterisk
c=IN IP4 PBX.ipaddress
t=0 0
m=audio 10176 RTP/AVP 8 101
**a=rtpmap:8 PCMA/8000**
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxpti

####################config####################
CLI> core show version
Asterisk 16.5.0 built by root @ testpbx-2 on a x86_64 running Linux on 2019-09-01 11:03:22 UTC

#########pjsip.conf #####################

[transport-udp]
type=transport
protocol=udp    ;udp,tcp,tls,ws,wss
;bind=0.0.0.0
bind=0.0.0.0

[mytrunk]
type=registration
transport=transport-udp
outbound_auth=mytrunk_auth

server_uri=sip:sip.internode.on.net
client_uri=sip:username@FQDN
contact_user=username ; this is the DestNo.. otherwise becomes 's'.
retry_interval=60
forbidden_retry_interval=600
expiration=3600
line=yes
endpoint=mytrunk


[mytrunk_auth]
type=auth
auth_type=userpass
password=secress
username=username
;(DO NOT USE REALM)
;realm=BroadWorks ;Internode can be BroadWorks or leave this blank




[mytrunk]
type=endpoint
transport=transport-udp
;transport=transport-udp-nat
context=inbound_handler
disallow=all
allow=alaw
allow=ulaw
outbound_auth=mytrunk_auth
aors=mytrunk

direct_media=no
force_rport=yes




[mytrunk]
type=aor
contact=sip:username@FQDN

[mytrunk]
type=identify
endpoint=mytrunk
match=203.2.134.1
;match=203.2.134.129

[anonymous]
type=endpoint
context=inbound_handler
disallow=all
allow=alaw
allow=ulaw



;============= Extension 6001 =============;
[6001]
type=endpoint
transport=transport-udp
context=national
send_rpid=yes 			
disallow=all
allow=alaw
allow=ulaw
aors=6001

[6001]
type=auth
auth_type=userpass
password=6001
username=secret

[6001]
type=aor
max_contacts=2
##############################

,

debug flow of call



   >-- Executing [2244668811 @ inbound_handler:3] NoOp("PJSIP/mytrunk-00000032", "EXTEN is 2244668811") in new stack
    -- Executing [2244668811 @ inbound_handler:4] Set("PJSIP/mytrunk-00000032", "DestNo=2244668811") in new stack
    -- Executing [2244668811 @ inbound_handler:5] NoOp("PJSIP/mytrunk-00000032", "DestNo is 2244668811") in new stack
    -- Executing [2244668811 @ inbound_handler:6] Goto("PJSIP/mytrunk-00000032", "sw_11_2244668811,10") in new stack
    -- Goto (inbound_handler,sw_11_2244668811,10)
    -- Executing [sw_11_2244668811 @ inbound_handler:10] Goto("PJSIP/mytrunk-00000032", "_.,main_no") in new stack
    -- Goto (inbound_handler,_.,8)
    -- Executing [_. @ inbound_handler:8] GotoIf("PJSIP/mytrunk-00000032", "1?9:13") in new stack
    -- Goto (inbound_handler,_.,9)
    -- Executing [_. @ inbound_handler:9] Set("PJSIP/mytrunk-00000032", "CALLERID(name)=Main Ring Group") in new stack
    -- Executing [_. @ inbound_handler:10] Dial("PJSIP/mytrunk-00000032", "PJSIP/6001,30") in new stack
    -- Called PJSIP/6001
    -- PJSIP/6001-00000033 is ringing
    -- PJSIP/6001-00000033 is ringing
    -- PJSIP/6001-00000033 answered PJSIP/mytrunk-00000032
       > 0x7f299002ef10 -- Strict RTP learning after remote address set to: endpoint.ipaddr:7078
       > 0x7f299004ed80 -- Strict RTP learning after remote address set to: 203.2.134.1:23436
    -- Channel PJSIP/6001-00000033 joined 'simple_bridge' basic-bridge <be88a861-020d-4f78-b15a-f4ec574258a4>
    -- Channel PJSIP/mytrunk-00000032 joined 'simple_bridge' basic-bridge <be88a861-020d-4f78-b15a-f4ec574258a4>
       > Bridge be88a861-020d-4f78-b15a-f4ec574258a4: switching from simple_bridge technology to native_rtp
       > Locally RTP bridged 'PJSIP/mytrunk-00000032' and 'PJSIP/6001-00000033' in stack
       > 0x7f299002ef10 -- Strict RTP switching to RTP target address endpoint.ipaddr:7078 as source
       > 0x7f299004ed80 -- Strict RTP switching to RTP target address 203.2.134.1:23436 as source
[Sep  6 10:39:35] WARNING[15748][C-0000001b]: translate.c:488 ast_translator_build_path: No translator path: (ending codec is not valid)
[Sep  6 10:39:35] WARNING[15748][C-0000001b]: translate.c:488 ast_translator_build_path: No translator path: (ending codec is not valid)
       > Bridge be88a861-020d-4f78-b15a-f4ec574258a4: switching from native_rtp technology to simple_bridge
[Sep  6 10:39:35] WARNING[15750][C-0000001b]: channel.c:5589 set_format: Unable to find a codec translation path: (g729) -> (alaw)
[Sep  6 10:39:35] WARNING[15748][C-0000001b]: channel.c:6549 ast_channel_make_compatible_helper: No path to translate from PJSIP/6001-00000033 to PJSIP/mytrunk-00000032
[Sep  6 10:39:35] WARNING[15748][C-0000001b]: channel.c:6549 ast_channel_make_compatible_helper: No path to translate from PJSIP/6001-00000033 to PJSIP/mytrunk-00000032
[Sep  6 10:39:35] WARNING[15748][C-0000001b]: channel.c:6549 ast_channel_make_compatible_helper: No path to translate from PJSIP/6001-00000033 to PJSIP/mytrunk-00000032
[Sep  6 10:39:35] WARNING[15748][C-0000001b]: channel.c:6549 ast_channel_make_compatible_helper: No path to translate from PJSIP/6001-00000033 to PJSIP/mytrunk-00000032
    -- Channel PJSIP/mytrunk-00000032 left 'simple_bridge' basic-bridge <be88a861-020d-4f78-b15a-f4ec574258a4>
    -- Channel PJSIP/6001-00000033 left 'simple_bridge' basic-bridge <be88a861-020d-4f78-b15a-f4ec574258a4>
[Sep  6 10:39:35] WARNING[15748][C-0000001b]: channel.c:5589 set_format: Unable to find a codec translation path: (g729) -> (alaw)
  == Spawn extension (inbound_handler, _., 10) exited non-zero on 'PJSIP/mytrunk-00000032'
    -- Executing [h @ inbound_handler:1] Wait("PJSIP/mytrunk-00000032", "1") in new stack

This is the codec negotiation flow on chan sip for incoming calls, I assume is the same on PJSIP

When Asterisk is receiving a call, the codec will initially be set to the
first codec in the allowed codecs defined for the user receiving the call
that the caller also indicates that it supports. But, after the caller
starts sending RTP, Asterisk will switch to using whatever codec the caller
is sending.

So based on the trace your carrier is sending RTP using G729 codec, and this is causing the error, So your carrier should honor your codec selection

You could also try using the option preferred_codec_only

Respond to a SIP invite with the single most preferred codec rather than advertising all joint codec capabilities. This limits the other side’s codec choice to exactly what we prefer

Thanks for the reply
Looking at my notes had tried that but to no avail.

I tried again just now and received the same result.
I’m curious as it works fine with chan_sip and Asterisk 13

Full SIP TRACE HERE


testpbx-2*CLI>
testpbx-2*CLI>
testpbx-2*CLI>
testpbx-2*CLI>
testpbx-2*CLI>
testpbx-2*CLI>
testpbx-2*CLI>
<--- Received SIP request (910 bytes) from UDP:203.2.134.1:5060 --->
INVITE sip:{DIALLED_NUMBER}@PBX.IPADDR:5060;line=elacjeb SIP/2.0
Via: SIP/2.0/UDP 203.2.134.1:5060;branch=z9hG4bKq0j4f820bo4geukhi400.1
From: <sip:{MOBILENUMBER}@203.2.134.129;user=phone>;tag=1689587097-1568006240701-
To: "NodePhone"<sip:{DIALLED_NUMBER}@sip.internode.on.net;line=elacjeb>
Call-ID: BW0517207010909192121262918@203.2.134.129
CSeq: 171588831 INVITE
Contact: <sip:{MOBILENUMBER}@203.2.134.1:5060;transport=udp>
Supported: 100rel
Allow: ACK,BYE,CANCEL,INFO,INVITE,OPTIONS,PRACK,REFER,NOTIFY
Recv-Info: x-broadworks-client-session-info
Accept: application/media_control+xml,application/sdp,multipart/mixed
Max-Forwards: 69
Content-Type: application/sdp
Content-Length: 227

v=0
o=BroadWorks 51418107 1 IN IP4 203.2.134.1
s=-
c=IN IP4 203.2.134.1
t=0 0
m=audio 23582 RTP/AVP 8 0 18 106 101
a=rtpmap:106 G.729b/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=bsoft: 1 image udptl t38

  == Setting global variable 'SIPDOMAIN' to 'PBX.IPADDR'
<--- Transmitting SIP response (398 bytes) to UDP:203.2.134.1:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 203.2.134.1:5060;rport=5060;received=203.2.134.1;branch=z9hG4bKq0j4f820bo4geukhi400.1
Call-ID: BW0517207010909192121262918@203.2.134.129
From: <sip:{MOBILENUMBER}@203.2.134.129;user=phone>;tag=1689587097-1568006240701-
To: "NodePhone" <sip:{DIALLED_NUMBER}@sip.internode.on.net;line=elacjeb>
CSeq: 171588831 INVITE
Server: Asterisk PBX 16.5.0
Content-Length:  0


    -- Executing [{DIALLED_NUMBER}@inbound_handler:1] MSet("PJSIP/mytrunk-00000036", "~~EXTEN~~={DIALLED_NUMBER}") in new stack
    -- Executing [{DIALLED_NUMBER}@inbound_handler:2] DumpChan("PJSIP/mytrunk-00000036", "") in new stack

Dumping Info For Channel: PJSIP/mytrunk-00000036:
================================================================================
Info:
Name=               PJSIP/mytrunk-00000036
Type=               PJSIP
UniqueID=           1568006240.92
LinkedID=           1568006240.92
CallerIDNum=        {MOBILENUMBER}
CallerIDName=       (N/A)
ConnectedLineIDNum= (N/A)
ConnectedLineIDName=(N/A)
DNIDDigits=         {DIALLED_NUMBER}
RDNIS=              (N/A)
Parkinglot=
Language=           en_AU
State=              Ring (4)
Rings=              1
NativeFormat=       (alaw|ulaw)
WriteFormat=        alaw
ReadFormat=         alaw
RawWriteFormat=     alaw
RawReadFormat=      alaw
WriteTranscode=     No
ReadTranscode=      No
1stFileDescriptor=  -1
Framesin=           0
Framesout=          0
TimetoHangup=       0
ElapsedTime=        0h0m0s
BridgeID=           (Not bridged)
Context=            inbound_handler
Extension=          {DIALLED_NUMBER}
Priority=           2
CallGroup=
PickupGroup=
Application=        DumpChan
Data=               (Empty)
Blocking_in=        (Not Blocking)

Variables:
~~EXTEN~~={DIALLED_NUMBER}
================================================================================
    -- Executing [{DIALLED_NUMBER}@inbound_handler:3] NoOp("PJSIP/mytrunk-00000036", "EXTEN is {DIALLED_NUMBER}") in new stack
    -- Executing [{DIALLED_NUMBER}@inbound_handler:4] Set("PJSIP/mytrunk-00000036", "DestNo={DIALLED_NUMBER}") in new stack
    -- Executing [{DIALLED_NUMBER}@inbound_handler:5] NoOp("PJSIP/mytrunk-00000036", "DestNo is {DIALLED_NUMBER}") in new stack
    -- Executing [{DIALLED_NUMBER}@inbound_handler:6] Goto("PJSIP/mytrunk-00000036", "sw_11_{DIALLED_NUMBER},10") in new stack
    -- Goto (inbound_handler,sw_11_{DIALLED_NUMBER},10)
    -- Executing [sw_11_{DIALLED_NUMBER}@inbound_handler:10] Goto("PJSIP/mytrunk-00000036", "_.,main_no") in new stack
    -- Goto (inbound_handler,_.,8)
    -- Executing [_.@inbound_handler:8] GotoIf("PJSIP/mytrunk-00000036", "1?9:13") in new stack
    -- Goto (inbound_handler,_.,9)
    -- Executing [_.@inbound_handler:9] Set("PJSIP/mytrunk-00000036", "CALLERID(name)=Main Ring Group") in new stack
    -- Executing [_.@inbound_handler:10] Dial("PJSIP/mytrunk-00000036", "PJSIP/6002,30") in new stack
    -- Called PJSIP/6002
<--- Transmitting SIP request (1018 bytes) to UDP:ENDPOINT.ipaddr:5060 --->
INVITE sip:6002@ENDPOINT.ipaddr;transport=udp SIP/2.0
Via: SIP/2.0/UDP PBX.IPADDR:5060;rport;branch=z9hG4bKPj4c305dd3-7989-410f-a9b3-f3b49080d10b
From: "Main Ring Group" <sip:{MOBILENUMBER}@PBX.IPADDR>;tag=6a29134f-b859-4e93-974b-951b0f03181e
To: <sip:6002@ENDPOINT.ipaddr>
Contact: <sip:asterisk@PBX.IPADDR:5060>
Call-ID: 292f13dd-7aba-4b9d-9bfc-5cfef65744f8
CSeq: 25780 INVITE
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
Remote-Party-ID: "Main Ring Group" <sip:{MOBILENUMBER}@PBX.IPADDR>;party=calling;privacy=off;screen=no
Max-Forwards: 70
User-Agent: Asterisk PBX 16.5.0
Content-Type: application/sdp
Content-Length:   235

v=0
o=- 485256149 485256149 IN IP4 PBX.IPADDR
s=Asterisk
c=IN IP4 PBX.IPADDR
t=0 0
m=audio 10128 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

<--- Received SIP response (306 bytes) from UDP:ENDPOINT.ipaddr:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP PBX.IPADDR:5060;rport;branch=z9hG4bKPj4c305dd3-7989-410f-a9b3-f3b49080d10b
From: "Main Ring Group" <sip:{MOBILENUMBER}@PBX.IPADDR>;tag=6a29134f-b859-4e93-974b-951b0f03181e
To: sip:6002@ENDPOINT.ipaddr
Call-ID: 292f13dd-7aba-4b9d-9bfc-5cfef65744f8
CSeq: 25780 INVITE


<--- Received SIP response (406 bytes) from UDP:ENDPOINT.ipaddr:5060 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP PBX.IPADDR:5060;rport;branch=z9hG4bKPj4c305dd3-7989-410f-a9b3-f3b49080d10b
From: "Main Ring Group" <sip:{MOBILENUMBER}@PBX.IPADDR>;tag=6a29134f-b859-4e93-974b-951b0f03181e
To: <sip:6002@ENDPOINT.ipaddr>;tag=fRVSmhG
Call-ID: 292f13dd-7aba-4b9d-9bfc-5cfef65744f8
CSeq: 25780 INVITE
User-Agent: Linphone Desktop/4.1.1 (belle-sip/1.6.3)
Supported: replaces, outbound


    -- PJSIP/6002-00000037 is ringing
    -- PJSIP/6002-00000037 is ringing
<--- Transmitting SIP response (585 bytes) to UDP:203.2.134.1:5060 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 203.2.134.1:5060;rport=5060;received=203.2.134.1;branch=z9hG4bKq0j4f820bo4geukhi400.1
Call-ID: BW0517207010909192121262918@203.2.134.129
From: <sip:{MOBILENUMBER}@203.2.134.129;user=phone>;tag=1689587097-1568006240701-
To: "NodePhone" <sip:{DIALLED_NUMBER}@sip.internode.on.net;line=elacjeb>;tag=ae3931a5-4a2c-4f9e-8d11-a7538f0787e0
CSeq: 171588831 INVITE
Server: Asterisk PBX 16.5.0
Contact: <sip:PBX.IPADDR:5060>
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Content-Length:  0




<?xml version="1.0" encoding="UTF-8"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info" version="12" state="full" entity="sip:6002@PBX.IPADDR:5060">
 <dialog id="6002" direction="recipient">
  <state>early</state>
 </dialog>
</dialog-info>



<--- Received SIP response (794 bytes) from UDP:ENDPOINT.ipaddr:5060 --->
SIP/2.0 200 Ok
Via: SIP/2.0/UDP PBX.IPADDR:5060;rport;branch=z9hG4bKPj4c305dd3-7989-410f-a9b3-f3b49080d10b
From: "Main Ring Group" <sip:{MOBILENUMBER}@PBX.IPADDR>;tag=6a29134f-b859-4e93-974b-951b0f03181e
To: <sip:6002@ENDPOINT.ipaddr>;tag=fRVSmhG
Call-ID: 292f13dd-7aba-4b9d-9bfc-5cfef65744f8
CSeq: 25780 INVITE
User-Agent: Linphone Desktop/4.1.1 (belle-sip/1.6.3)
Supported: replaces, outbound
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO, UPDATE
Contact: <sip:6002@ENDPOINT.ipaddr;transport=udp>;+sip.instance="<urn:uuid:6da72189-8ee1-4f27-bd58-e5dd63217c23>"
Content-Type: application/sdp
Content-Length: 139

v=0
o=6002 854 65 IN IP4 ENDPOINT.ipaddr
s=Talk
c=IN IP4 ENDPOINT.ipaddr
t=0 0
m=audio 7078 RTP/AVP 8 101
a=rtpmap:101 telephone-event/8000

       > 0x7f28e40237e0 -- Strict RTP learning after remote address set to: ENDPOINT.ipaddr:7078
    -- PJSIP/6002-00000037 answered PJSIP/mytrunk-00000036
<--- Transmitting SIP request (416 bytes) to UDP:ENDPOINT.ipaddr:5060 --->
ACK sip:6002@ENDPOINT.ipaddr;transport=udp SIP/2.0
Via: SIP/2.0/UDP PBX.IPADDR:5060;rport;branch=z9hG4bKPja82f74cd-8f40-40a3-94b5-4ca0a26b9474
From: "Main Ring Group" <sip:{MOBILENUMBER}@PBX.IPADDR>;tag=6a29134f-b859-4e93-974b-951b0f03181e
To: <sip:6002@ENDPOINT.ipaddr>;tag=fRVSmhG
Call-ID: 292f13dd-7aba-4b9d-9bfc-5cfef65744f8
CSeq: 25780 ACK
Max-Forwards: 70
User-Agent: Asterisk PBX 16.5.0
Content-Length:  0




<?xml version="1.0" encoding="UTF-8"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info" version="13" state="full" entity="sip:6002@PBX.IPADDR:5060">
 <dialog id="6002">
  <state>confirmed</state>
 </dialog>
</dialog-info>

       > 0x7f28e4013680 -- Strict RTP learning after remote address set to: 203.2.134.1:23582
<--- Transmitting SIP response (888 bytes) to UDP:203.2.134.1:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 203.2.134.1:5060;rport=5060;received=203.2.134.1;branch=z9hG4bKq0j4f820bo4geukhi400.1
Call-ID: BW0517207010909192121262918@203.2.134.129
From: <sip:{MOBILENUMBER}@203.2.134.129;user=phone>;tag=1689587097-1568006240701-
To: "NodePhone" <sip:{DIALLED_NUMBER}@sip.internode.on.net;line=elacjeb>;tag=ae3931a5-4a2c-4f9e-8d11-a7538f0787e0
CSeq: 171588831 INVITE
Server: Asterisk PBX 16.5.0
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Contact: <sip:PBX.IPADDR:5060>
Supported: 100rel, timer, replaces, norefersub
Content-Type: application/sdp
Content-Length:   226

v=0
o=- 51418107 3 IN IP4 PBX.IPADDR
s=Asterisk
c=IN IP4 PBX.IPADDR
t=0 0
m=audio 17688 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

    -- Channel PJSIP/6002-00000037 joined 'simple_bridge' basic-bridge <a7c60c3e-d86b-4eec-9e05-203e53789286>
    -- Channel PJSIP/mytrunk-00000036 joined 'simple_bridge' basic-bridge <a7c60c3e-d86b-4eec-9e05-203e53789286>
       > Bridge a7c60c3e-d86b-4eec-9e05-203e53789286: switching from simple_bridge technology to native_rtp
       > Locally RTP bridged 'PJSIP/mytrunk-00000036' and 'PJSIP/6002-00000037' in stack



       > 0x7f28e40237e0 -- Strict RTP switching to RTP target address ENDPOINT.ipaddr:7078 as source
<--- Received SIP request (465 bytes) from UDP:203.2.134.1:5060 --->
ACK sip:PBX.IPADDR:5060 SIP/2.0
Via: SIP/2.0/UDP 203.2.134.1:5060;branch=z9hG4bKcjb8oh002oqu25djg100.1
From: <sip:{MOBILENUMBER}@203.2.134.129;user=phone>;tag=1689587097-1568006240701-
To: "NodePhone" <sip:{DIALLED_NUMBER}@sip.internode.on.net;line=elacjeb>;tag=ae3931a5-4a2c-4f9e-8d11-a7538f0787e0
Call-ID: BW0517207010909192121262918@203.2.134.129
CSeq: 171588831 ACK
Contact: <sip:{MOBILENUMBER}@203.2.134.1:5060;transport=udp>
Max-Forwards: 69
Content-Length: 0


       > 0x7f28e4013680 -- Strict RTP switching to RTP target address 203.2.134.1:23582 as source
[Sep  9 05:17:23] WARNING[23074][C-0000001d]: translate.c:488 ast_translator_build_path: No translator path: (ending codec is not valid)
[Sep  9 05:17:23] WARNING[23074][C-0000001d]: translate.c:488 ast_translator_build_path: No translator path: (ending codec is not valid)
       > Bridge a7c60c3e-d86b-4eec-9e05-203e53789286: switching from native_rtp technology to simple_bridge
[Sep  9 05:17:23] WARNING[23075][C-0000001d]: channel.c:5589 set_format: Unable to find a codec translation path: (g729) -> (alaw)
[Sep  9 05:17:23] WARNING[23074][C-0000001d]: channel.c:6549 ast_channel_make_compatible_helper: No path to translate from PJSIP/6002-00000037 to PJSIP/mytrunk-00000036
[Sep  9 05:17:23] WARNING[23074][C-0000001d]: channel.c:6549 ast_channel_make_compatible_helper: No path to translate from PJSIP/6002-00000037 to PJSIP/mytrunk-00000036
[Sep  9 05:17:23] WARNING[23074][C-0000001d]: channel.c:6549 ast_channel_make_compatible_helper: No path to translate from PJSIP/6002-00000037 to PJSIP/mytrunk-00000036
[Sep  9 05:17:23] WARNING[23074][C-0000001d]: channel.c:6549 ast_channel_make_compatible_helper: No path to translate from PJSIP/6002-00000037 to PJSIP/mytrunk-00000036
    -- Channel PJSIP/mytrunk-00000036 left 'simple_bridge' basic-bridge <a7c60c3e-d86b-4eec-9e05-203e53789286>
[Sep  9 05:17:23] WARNING[23074][C-0000001d]: channel.c:5589 set_format: Unable to find a codec translation path: (g729) -> (alaw)
    -- Channel PJSIP/6002-00000037 left 'simple_bridge' basic-bridge <a7c60c3e-d86b-4eec-9e05-203e53789286>
  == Spawn extension (inbound_handler, _., 10) exited non-zero on 'PJSIP/mytrunk-00000036'
<--- Transmitting SIP request (440 bytes) to UDP:ENDPOINT.ipaddr:5060 --->
BYE sip:6002@ENDPOINT.ipaddr;transport=udp SIP/2.0
Via: SIP/2.0/UDP PBX.IPADDR:5060;rport;branch=z9hG4bKPj4b7c7ed1-cb80-4e34-958d-81ae8faa27ac
From: "Main Ring Group" <sip:{MOBILENUMBER}@PBX.IPADDR>;tag=6a29134f-b859-4e93-974b-951b0f03181e
To: <sip:6002@ENDPOINT.ipaddr>;tag=fRVSmhG
Call-ID: 292f13dd-7aba-4b9d-9bfc-5cfef65744f8
CSeq: 25781 BYE
Reason: Q.850;cause=16
Max-Forwards: 70
User-Agent: Asterisk PBX 16.5.0
Content-Length:  0


    -- Executing [h@inbound_handler:1] Wait("PJSIP/mytrunk-00000036", "1") in new stack
  == Spawn extension (inbound_handler, h, 1) exited non-zero on 'PJSIP/mytrunk-00000036'


<?xml version="1.0" encoding="UTF-8"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info" version="14" state="full" entity="sip:6002@PBX.IPADDR:5060">
 <dialog id="6002">
  <state>terminated</state>
 </dialog>
</dialog-info>

<--- Transmitting SIP request (508 bytes) to UDP:203.2.134.1:5060 --->
BYE sip:{MOBILENUMBER}@203.2.134.1:5060;transport=udp SIP/2.0
Via: SIP/2.0/UDP PBX.IPADDR:5060;rport;branch=z9hG4bKPj250c7bf6-2f80-46c0-915c-0f82d6b50fbd
From: "NodePhone" <sip:{DIALLED_NUMBER}@sip.internode.on.net;line=elacjeb>;tag=ae3931a5-4a2c-4f9e-8d11-a7538f0787e0
To: <sip:{MOBILENUMBER}@203.2.134.129;user=phone>;tag=1689587097-1568006240701-
Call-ID: BW0517207010909192121262918@203.2.134.129
CSeq: 16981 BYE
Reason: Q.850;cause=16
Max-Forwards: 70
User-Agent: Asterisk PBX 16.5.0
Content-Length:  0


<--- Received SIP response (398 bytes) from UDP:ENDPOINT.ipaddr:5060 --->
SIP/2.0 200 Ok
Via: SIP/2.0/UDP PBX.IPADDR:5060;rport;branch=z9hG4bKPj4b7c7ed1-cb80-4e34-958d-81ae8faa27ac
From: "Main Ring Group" <sip:{MOBILENUMBER}@PBX.IPADDR>;tag=6a29134f-b859-4e93-974b-951b0f03181e
To: <sip:6002@ENDPOINT.ipaddr>;tag=fRVSmhG
Call-ID: 292f13dd-7aba-4b9d-9bfc-5cfef65744f8
CSeq: 25781 BYE
User-Agent: Linphone Desktop/4.1.1 (belle-sip/1.6.3)
Supported: replaces, outbound





<--- Received SIP response (416 bytes) from UDP:203.2.134.1:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP PBX.IPADDR:5060;received=PBX.IPADDR;branch=z9hG4bKPj250c7bf6-2f80-46c0-915c-0f82d6b50fbd;rport=5060
From: "NodePhone" <sip:{DIALLED_NUMBER}@sip.internode.on.net;line=elacjeb>;tag=ae3931a5-4a2c-4f9e-8d11-a7538f0787e0
To: <sip:{MOBILENUMBER}@203.2.134.129;user=phone>;tag=1689587097-1568006240701-
Call-ID: BW0517207010909192121262918@203.2.134.129
CSeq: 16981 BYE
Content-Length: 0

Asterisk has told both sides that is only prepared to accept codec 8, which is one of the G.711 ones. If it is actually receiving G.729, the peer is completely ignoring the protocol.

It seems that it might be possible that I am able to cause the issue of the inbound codec.

If i use Asterisk 13 and chan_sip the inbound calls are fine.
If I use Asterisk 16.5 and pjsip the inbound calls send rtp with the wrong codec.
NOTE: other inboudn calls are fine. Only when calling in from Telstra mobile phone.

I think i need to do some more detailed packet captures on the entire SIP dialog and compare on both systems.

Any thoughts?

please try using sngrep to debug

you can afterwards save the pcap and analyze in wireshark

Thanks here is some info dumped from sngrep

sngrep dump

                                                                x   INVITE sip:DIALLEDNUMBER @PBXIPAddress:5060;line=tljvtpn SIP/2.0
             203.2.134.1:5060             PBXIPAddress:5060     x   Via: SIP/2.0/UDP 203.2.134.1:5060;branch=z9hG4bKdpnhlf0000li4412i400.1
          qqqqqqqqqqwqqqqqqqqq          qqqqqqqqqqwqqqqqqqqq    x   From: <sip:MOBILENUMBER@203.2.134.129;user=phone>;tag=162529303-1568207271937-
                    x      INV (203.2.134.1)      x             x   To: "NodePhone"<sip:DIALLEDNUMBER @sip.internode.on.net;line=tljvtpn>
                    x     audio 30646 (g711a)     x             x   Call-ID: BW130751937110919-606925269@203.2.134.129
  13:07:51.951470   x qqqqqqqqqqqqqqqqqqqqqqqqqq> x             x   CSeq: 272104449 INVITE
        +0.000563   x         100 Trying          x             x   Contact: <sip:MOBILENUMBER@203.2.134.1:5060;transport=udp>
  13:07:51.952033   x <qqqqqqqqqqqqqqqqqqqqqqqqqq x             x   Supported: 100rel
        +0.473562   x         180 Ringing         x             x   Allow: ACK,BYE,CANCEL,INFO,INVITE,OPTIONS,PRACK,REFER,NOTIFY
  13:07:52.425595   x <qqqqqqqqqqqqqqqqqqqqqqqqqq x             x   Recv-Info: x-broadworks-client-session-info
                    x     200 (PBXIPAddress)      x             x   Accept: application/media_control+xml,application/sdp,multipart/mixed
        +6.492771   x     audio 10198 (g711a)     x             x   Max-Forwards: 69
  13:07:58.918366   x <qqqqqqqqqqqqqqqqqqqqqqqqqq x             x   Content-Type: application/sdp
                    x        RTP (g711a) 2        x             x   Content-Length: 227
  13:07:59.021599   x30646 <qqqqqqqqqqqqqqqq 10198x             x   
                    x        RTP (g729) 2         x             x   v=0
  13:07:59.045606   x30646 qqqqqqqqqqqqqqqq> 10198x             x   o=BroadWorks 56584560 1 IN IP4 203.2.134.1
        +0.133835   x             ACK             x             x   s=-
  13:07:59.052201   x qqqqqqqqqqqqqqqqqqqqqqqqqq> x             x   c=IN IP4 203.2.134.1
        +0.000258   x             BYE             x             x   t=0 0
  13:07:59.052459   x <qqqqqqqqqqqqqqqqqqqqqqqqqq x             x   m=audio 30646 RTP/AVP 8 0 18 106 101
        +0.032116   x           200 OK            x             x   a=rtpmap:106 G.729b/8000
  13:07:59.084575   x qqqqqqqqqqqqqqqqqqqqqqqqqq> x             x   a=rtpmap:101 telephone-event/8000
                    x                             x             x   a=fmtp:101 0-15
                    x                             x             x   a=bsoft: 1 image udptl t38
    

RAW SIP

2019/09/11 13:07:51.951470 203.2.134.1:5060 -> PBX-IPADDR:5060
INVITE sip:DialledNumber@PBX-IPADDR:5060;line=tljvtpn SIP/2.0
Via: SIP/2.0/UDP 203.2.134.1:5060;branch=z9hG4bKdpnhlf0000li4412i400.1
From: <sip:MobileNumber@203.2.134.129;user=phone>;tag=162529303-1568207271937-
To: "NodePhone"<sip:DialledNumber@sip.internode.on.net;line=tljvtpn>
Call-ID: BW130751937110919-606925269@203.2.134.129
CSeq: 272104449 INVITE
Contact: <sip:MobileNumber@203.2.134.1:5060;transport=udp>
Supported: 100rel
Allow: ACK,BYE,CANCEL,INFO,INVITE,OPTIONS,PRACK,REFER,NOTIFY
Recv-Info: x-broadworks-client-session-info
Accept: application/media_control+xml,application/sdp,multipart/mixed
Max-Forwards: 69
Content-Type: application/sdp
Content-Length: 227

v=0
o=BroadWorks 56584560 1 IN IP4 203.2.134.1
s=-
c=IN IP4 203.2.134.1
t=0 0
m=audio 30646 RTP/AVP 8 0 18 106 101
a=rtpmap:106 G.729b/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=bsoft: 1 image udptl t38

2019/09/11 13:07:51.952033 PBX-IPADDR:5060 -> 203.2.134.1:5060
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 203.2.134.1:5060;rport=5060;received=203.2.134.1;branch=z9hG4bKdpnhlf0000li4412i400.1
Call-ID: BW130751937110919-606925269@203.2.134.129
From: <sip:MobileNumber@203.2.134.129;user=phone>;tag=162529303-1568207271937-
To: "NodePhone" <sip:DialledNumber@sip.internode.on.net;line=tljvtpn>
CSeq: 272104449 INVITE
Server: Asterisk PBX 16.5.0
Content-Length:  0


2019/09/11 13:07:52.425595 PBX-IPADDR:5060 -> 203.2.134.1:5060
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 203.2.134.1:5060;rport=5060;received=203.2.134.1;branch=z9hG4bKdpnhlf0000li4412i400.1
Call-ID: BW130751937110919-606925269@203.2.134.129
From: <sip:MobileNumber@203.2.134.129;user=phone>;tag=162529303-1568207271937-
To: "NodePhone" <sip:DialledNumber@sip.internode.on.net;line=tljvtpn>;tag=d624d3be-a66b-4aa2-82f6-99ddff98ea9d
CSeq: 272104449 INVITE
Server: Asterisk PBX 16.5.0
Contact: <sip:PBX-IPADDR:5060>
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Content-Length:  0


2019/09/11 13:07:58.918366 PBX-IPADDR:5060 -> 203.2.134.1:5060
SIP/2.0 200 OK
Via: SIP/2.0/UDP 203.2.134.1:5060;rport=5060;received=203.2.134.1;branch=z9hG4bKdpnhlf0000li4412i400.1
Call-ID: BW130751937110919-606925269@203.2.134.129
From: <sip:MobileNumber@203.2.134.129;user=phone>;tag=162529303-1568207271937-
To: "NodePhone" <sip:DialledNumber@sip.internode.on.net;line=tljvtpn>;tag=d624d3be-a66b-4aa2-82f6-99ddff98ea9d
CSeq: 272104449 INVITE
Server: Asterisk PBX 16.5.0
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Contact: <sip:PBX-IPADDR:5060>
Supported: 100rel, timer, replaces, norefersub
Content-Type: application/sdp
Content-Length:   226

v=0
o=- 56584560 3 IN IP4 PBX-IPADDR
s=Asterisk
c=IN IP4 PBX-IPADDR
t=0 0
m=audio 10198 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv


2019/09/11 13:07:59.052201 203.2.134.1:5060 -> PBX-IPADDR:5060
ACK sip:PBX-IPADDR:5060 SIP/2.0
Via: SIP/2.0/UDP 203.2.134.1:5060;branch=z9hG4bKtl2qf2301gp5u91qg500.1
From: <sip:MobileNumber@203.2.134.129;user=phone>;tag=162529303-1568207271937-
To: "NodePhone" <sip:DialledNumber@sip.internode.on.net;line=tljvtpn>;tag=d624d3be-a66b-4aa2-82f6-99ddff98ea9d
Call-ID: BW130751937110919-606925269@203.2.134.129
CSeq: 272104449 ACK
Contact: <sip:MobileNumber@203.2.134.1:5060;transport=udp>
Max-Forwards: 69
Content-Length: 0


2019/09/11 13:07:59.052459 PBX-IPADDR:5060 -> 203.2.134.1:5060
BYE sip:MobileNumber@203.2.134.1:5060;transport=udp SIP/2.0
Via: SIP/2.0/UDP PBX-IPADDR:5060;rport;branch=z9hG4bKPj8cb21f5d-2ac0-4a33-953e-cbe10fbc3f69
From: "NodePhone" <sip:DialledNumber@sip.internode.on.net;line=tljvtpn>;tag=d624d3be-a66b-4aa2-82f6-99ddff98ea9d
To: <sip:MobileNumber@203.2.134.129;user=phone>;tag=162529303-1568207271937-
Call-ID: BW130751937110919-606925269@203.2.134.129
CSeq: 23350 BYE
Reason: Q.850;cause=16
Max-Forwards: 70
User-Agent: Asterisk PBX 16.5.0
Content-Length:  0


2019/09/11 13:07:59.084575 203.2.134.1:5060 -> PBX-IPADDR:5060
SIP/2.0 200 OK
Via: SIP/2.0/UDP PBX-IPADDR:5060;received=PBX-IPADDR;branch=z9hG4bKPj8cb21f5d-2ac0-4a33-953e-cbe10fbc3f69;rport=5060
From: "NodePhone" <sip:DialledNumber@sip.internode.on.net;line=tljvtpn>;tag=d624d3be-a66b-4aa2-82f6-99ddff98ea9d
To: <sip:MobileNumber@203.2.134.129;user=phone>;tag=162529303-1568207271937-
Call-ID: BW130751937110919-606925269@203.2.134.129
CSeq: 23350 BYE
Content-Length: 0

Have you tried putting allow=!all,alaw in your peer pjsip.conf ?

It still looks to me as though the peer is broken. Asterisk has clearly said it is only able to accept G.711, but the peer has sent it G.729, anyway.

I don’t htink you can fix this from the Asterisk side, as the fault isn’t there.

Asterisk should be ignoring the packets, but it’s still up to the remote side to not send them in the first place. The issue tracking the ignoring is on JIRA[1].

[1] https://issues.asterisk.org/jira/browse/ASTERISK-28139

Thanks jcolp.

I tested the workaround and correct it worked, so it seems to be the same issue.