RTP Audio troubles...sometimes!

Hi all,

sometimes calls from ToIP trunk to our internal VoIP phones, via an Asterisk B2BUA, have troubles with audio. Caller doesn’t hear any sound and seems to be related to codecs.

ToIP trunk use only G.729 (and maybe G.711) codec and all our phones were configured to use G.729 as primary choice for calls.

Seems that the codec handshake works correctly but i’m asking if a much-more-expert than me :slight_smile: see somethiong wrong in my Asterisk config.

I’ve enabled “debug” log on my Asterisk and here’s the piece of log of a failed call:

 pbx_variables.c: Function CALLERID(num) result is 'YYYYYYYY'
 pbx_variables.c: Result of 'EXTEN' is '+39XXXXXX'
 pbx.c: Launching 'NoOp'
 pbx_variables.c: Result of 'EXTEN' is '+39XXXXXX'
 pbx.c: Launching 'Dial'
 app_dial.c:  PJSIP/toip-00006a82: Data: PJSIP/+39XXXXXX@voip
 chan_pjsip.c:  +39XXXXXX@voip Topology:  <0:audio-0:audio:sendrecv (g729)>
 chan_pjsip.c:  voip
 channel_internal_api.c:  <initializing>: Formats: (none)
 channel_internal_api.c:  Channel is being initialized or destroyed
 stasis.c: Creating topic. name: channel:1651743237.28215, detail: 
 stasis.c: Topic 'channel:1651743237.28215': 0x7f4f20013a40 created
 channel.c: Channel 0x7f4f200398e0 'PJSIP/voip-00006a83' allocated
 chan_pjsip.c:  Topology:  <0:audio-0:audio:sendrecv (g729|g722|alaw|ulaw)> Formats: (g729|g722|alaw|ulaw)
 chan_pjsip.c:  Compatible? yes
 channel_internal_api.c:  PJSIP/voip-00006a83: MultistreamFormats: (g729|g722|alaw|ulaw)
 channel_internal_api.c:  Set native formats but not topology
 channel_internal_api.c:  PJSIP/voip-00006a83:  <0:audio-0:audio:sendrecv (g729|g722|alaw|ulaw)>
 channel_internal_api.c:  Used provided topology
 chan_pjsip.c:  
 chan_pjsip.c:  Channel: PJSIP/voip-00006a83
 chan_pjsip.c:  PJSIP/voip-00006a83 Topology:  <0:audio-0:audio:sendrecv (g729|g722|alaw|ulaw)>
 chan_pjsip.c:  'call' task pushed
 app_dial.c:  PJSIP/toip-00006a82
 channel.c: Channel PJSIP/voip-00006a83 setting read format path: g729 -> g729
 channel.c: Channel PJSIP/toip-00006a82 setting write format path: g729 -> g729
 channel.c: Channel PJSIP/toip-00006a82 setting read format path: g729 -> g729
 channel.c: Channel PJSIP/voip-00006a83 setting write format path: g729 -> g729
 chan_pjsip.c:  PJSIP/toip-00006a82: Indicated Connected line update
 chan_pjsip.c:  PJSIP/toip-00006a82
 chan_pjsip.c:  PJSIP/toip-00006a82: Indicated Private Cause Code
 chan_pjsip.c:  PJSIP/toip-00006a82
 chan_pjsip.c:  PJSIP/toip-00006a82: Indicated Private Cause Code
 chan_pjsip.c:  PJSIP/toip-00006a82
 chan_pjsip.c:  PJSIP/toip-00006a82: Indicated Ringing
 chan_pjsip.c:  PJSIP/toip-00006a82
 chan_pjsip.c:  PJSIP/toip-00006a82: Indicated Private Cause Code
 chan_pjsip.c:  PJSIP/toip-00006a82
 chan_pjsip.c:  PJSIP/toip-00006a82: Indicated Private Cause Code
 chan_pjsip.c:  PJSIP/toip-00006a82
 app_dial.c:  PJSIP/voip-00006a83 answered PJSIP/toip-00006a82
 app_dial.c:  PJSIP/toip-00006a82: Answered by PJSIP/voip-00006a83
 channel.c: Channel PJSIP/voip-00006a83 setting read format path: g729 -> g729
 channel.c: Channel PJSIP/toip-00006a82 setting write format path: g729 -> g729
 channel.c: Channel PJSIP/toip-00006a82 setting read format path: g729 -> g729
 channel.c: Channel PJSIP/voip-00006a83 setting write format path: g729 -> g729
 chan_pjsip.c:  PJSIP/toip-00006a82
 chan_pjsip.c:  
 chan_pjsip.c:  PJSIP/toip-00006a82: Indicated Stop generators
 chan_pjsip.c:  PJSIP/toip-00006a82
 stasis.c: Creating topic. name: bridge:all/bridge:a2c39a67-af9c-4063-8aa7-2bcedbce52a9, detail: 
 stasis.c: Topic 'bridge:all/bridge:a2c39a67-af9c-4063-8aa7-2bcedbce52a9': 0x7f4f200380f0 created
 bridge_native_rtp.c: Bridge 'a2c39a67-af9c-4063-8aa7-2bcedbce52a9' can not use native RTP bridge as two channels are required
 bridge.c: Bridge technology native_rtp is not compatible with properties of existing bridge.
 bridge.c: Bridge technology holding_bridge does not have any capabilities we want.
 bridge.c: Bridge technology softmix has less preference than simple_bridge (10 <= 50). Skipping.
 bridge.c: Chose bridge technology simple_bridge
 bridge.c: Bridge a2c39a67-af9c-4063-8aa7-2bcedbce52a9: calling simple_bridge technology constructor
 bridge.c: Bridge a2c39a67-af9c-4063-8aa7-2bcedbce52a9: calling simple_bridge technology start
 stasis_bridges.c: Update: 0x7f4f20012158  Old: <none>  New: a2c39a67-af9c-4063-8aa7-2bcedbce52a9
 stasis_bridges.c: Update: 0x7f4f20012158  Old: <none>  New: a2c39a67-af9c-4063-8aa7-2bcedbce52a9
 bridge_channel.c: Bridge a2c39a67-af9c-4063-8aa7-2bcedbce52a9: 0x7f4f20033820(PJSIP/toip-00006a82) is joining
 bridge_channel.c: Bridge a2c39a67-af9c-4063-8aa7-2bcedbce52a9: pushing 0x7f4f20033820(PJSIP/toip-00006a82)
 stasis_bridges.c: Update: 0x7f4f20004118  Old: a2c39a67-af9c-4063-8aa7-2bcedbce52a9  New: a2c39a67-af9c-4063-8aa7-2bcedbce52a9
 stasis_bridges.c: Update: 0x7f4f20004118  Old: a2c39a67-af9c-4063-8aa7-2bcedbce52a9  New: a2c39a67-af9c-4063-8aa7-2bcedbce52a9
 bridge_native_rtp.c: Bridge 'a2c39a67-af9c-4063-8aa7-2bcedbce52a9'.  Checking compatability for channels 'PJSIP/voip-00006a83' and 'PJSIP/toip-00006a82'
 chan_pjsip.c:  PJSIP/voip-00006a83 Native formats (g729)
 chan_pjsip.c:  
 chan_pjsip.c:  PJSIP/toip-00006a82 Native formats (g729)
 chan_pjsip.c:  
 bridge_native_rtp.c: Symmetric ptimes on the two call legs (0). May be able to native bridge in RTP
 bridge_native_rtp.c: Bridge 'a2c39a67-af9c-4063-8aa7-2bcedbce52a9': Packetization comparison success between RTP streams (read_ptime0:20 == write_ptime1:20 and read_ptime1:20 == write_ptime0:20).
 bridge.c: Bridge technology simple_bridge has less preference than native_rtp (50 <= 90). Skipping.
 bridge.c: Bridge technology holding_bridge does not have any capabilities we want.
 bridge.c: Bridge technology softmix does not have any capabilities we want.
 bridge.c: Chose bridge technology native_rtp
 bridge.c: Bridge a2c39a67-af9c-4063-8aa7-2bcedbce52a9: calling native_rtp technology constructor
 bridge.c: Bridge a2c39a67-af9c-4063-8aa7-2bcedbce52a9: moving 0x7f4f20038240(PJSIP/voip-00006a83) to dummy bridge temporarily
 bridge.c: Bridge a2c39a67-af9c-4063-8aa7-2bcedbce52a9: 0x7f4f20038240(PJSIP/voip-00006a83) is leaving simple_bridge technology (dummy)
 bridge.c: Bridge a2c39a67-af9c-4063-8aa7-2bcedbce52a9: calling simple_bridge technology stop
 bridge.c: Bridge a2c39a67-af9c-4063-8aa7-2bcedbce52a9: 0x7f4f20033820(PJSIP/toip-00006a82) is joining native_rtp technology
 bridge_native_rtp.c: Bridge 'a2c39a67-af9c-4063-8aa7-2bcedbce52a9'.  Channel 'PJSIP/toip-00006a82' is joining bridge tech
 bridge_native_rtp.c: Bridge 'a2c39a67-af9c-4063-8aa7-2bcedbce52a9'.  Attaching hook data 0x7f4f20037b70 to 'PJSIP/toip-00006a82'
 channel.c: PJSIP/voip-00006a83: Topologies already match. Current:  <0:audio-0:audio:sendrecv (g729|g722|alaw|ulaw)>  Requested:  <0:audio-0:audio:sendrecv (g729|g722|alaw|ulaw)>
 channel.c: PJSIP/voip-00006a83: Topologies already match. Current:  <0:audio-0:audio:sendrecv (g729|g722|alaw|ulaw)>  Requested:  <0:audio-0:audio:sendrecv (g729|g722|alaw|ulaw)>
 bridge.c: Bridge a2c39a67-af9c-4063-8aa7-2bcedbce52a9: 0x7f4f20038240(PJSIP/voip-00006a83) is joining native_rtp technology
 bridge_native_rtp.c: Bridge 'a2c39a67-af9c-4063-8aa7-2bcedbce52a9'.  Channel 'PJSIP/voip-00006a83' is joining bridge tech
 bridge_native_rtp.c: Bridge 'a2c39a67-af9c-4063-8aa7-2bcedbce52a9'.  Attaching hook data 0x7f4f20011fe0 to 'PJSIP/voip-00006a83'
 channel.c: PJSIP/voip-00006a83: Topologies already match. Current:  <0:audio-0:audio:sendrecv (g729|g722|alaw|ulaw)>  Requested:  <0:audio-0:audio:sendrecv (g729|g722|alaw|ulaw)>
 bridge_native_rtp.c: Bridge 'a2c39a67-af9c-4063-8aa7-2bcedbce52a9'.  Tech starting 'PJSIP/toip-00006a82' and 'PJSIP/voip-00006a83' with target 'none'
 chan_pjsip.c:  PJSIP/toip-00006a82 Native formats (g729)
 chan_pjsip.c:  
 chan_pjsip.c:  PJSIP/voip-00006a83 Native formats (g729)
 chan_pjsip.c:  
 chan_pjsip.c:  PJSIP/toip-00006a82 (g729)
 chan_pjsip.c:  
 chan_pjsip.c:  PJSIP/voip-00006a83 (g729)
 chan_pjsip.c:  
 channel.c: PJSIP/toip-00006a82: Topologies already match. Current:  <0:audio-0:audio:sendrecv (g729)>  Requested:  <0:audio-0:audio:sendrecv (g729)>
 bridge.c: Bridge a2c39a67-af9c-4063-8aa7-2bcedbce52a9: calling native_rtp technology start
 bridge.c: Bridge a2c39a67-af9c-4063-8aa7-2bcedbce52a9: calling simple_bridge technology destructor
 stasis_bridges.c: Update: 0x7f4f2003f288  Old: a2c39a67-af9c-4063-8aa7-2bcedbce52a9  New: a2c39a67-af9c-4063-8aa7-2bcedbce52a9
 stasis_bridges.c: Update: 0x7f4f2003f288  Old: a2c39a67-af9c-4063-8aa7-2bcedbce52a9  New: a2c39a67-af9c-4063-8aa7-2bcedbce52a9
 chan_pjsip.c:  PJSIP/toip-00006a82: Indicated Media SSRC change
 chan_pjsip.c:  PJSIP/toip-00006a82
 bridge_native_rtp.c: Bridge 'a2c39a67-af9c-4063-8aa7-2bcedbce52a9'.  Checking compatability for channels 'PJSIP/toip-00006a82' and 'PJSIP/voip-00006a83'
 chan_pjsip.c:  PJSIP/toip-00006a82 Native formats (g729)
 chan_pjsip.c:  
 chan_pjsip.c:  PJSIP/voip-00006a83 Native formats (g729)
 chan_pjsip.c:  
 bridge_native_rtp.c: Symmetric ptimes on the two call legs (0). May be able to native bridge in RTP
 bridge_native_rtp.c: Bridge 'a2c39a67-af9c-4063-8aa7-2bcedbce52a9': Packetization comparison success between RTP streams (read_ptime0:20 == write_ptime1:20 and read_ptime1:20 == write_ptime0:20).
 bridge.c: Bridge technology simple_bridge has less preference than native_rtp (50 <= 90). Skipping.
 bridge.c: Bridge technology holding_bridge does not have any capabilities we want.
 bridge.c: Bridge technology softmix does not have any capabilities we want.
 bridge.c: Chose bridge technology native_rtp
 bridge.c: Bridge a2c39a67-af9c-4063-8aa7-2bcedbce52a9 is already using the new technology.
 stasis_bridges.c: Update: 0x7f4f2000e2c8  Old: a2c39a67-af9c-4063-8aa7-2bcedbce52a9  New: a2c39a67-af9c-4063-8aa7-2bcedbce52a9
 stasis_bridges.c: Update: 0x7f4f2000e2c8  Old: a2c39a67-af9c-4063-8aa7-2bcedbce52a9  New: a2c39a67-af9c-4063-8aa7-2bcedbce52a9
 chan_pjsip.c:  PJSIP/toip-00006a82: Indicated Private Cause Code
 chan_pjsip.c:  PJSIP/toip-00006a82
 chan_pjsip.c:  PJSIP/toip-00006a82: Indicated Private Cause Code
 chan_pjsip.c:  PJSIP/toip-00006a82
 res_rtp_asterisk.c: (0x7f4f080fdbc0) RTP ooh, format changed from none to g729
 res_rtp_asterisk.c: (0x7f4f080fdbc0) RTCP starting transmission
 bridge_native_rtp.c: Bridge 'a2c39a67-af9c-4063-8aa7-2bcedbce52a9'.  Checking compatability for channels 'PJSIP/toip-00006a82' and 'PJSIP/voip-00006a83'
 chan_pjsip.c:  PJSIP/toip-00006a82 Native formats (g729)
 chan_pjsip.c:  
 chan_pjsip.c:  PJSIP/voip-00006a83 Native formats (g729)
 chan_pjsip.c:  
 bridge_native_rtp.c: Symmetric ptimes on the two call legs (0). May be able to native bridge in RTP
 bridge_native_rtp.c: Bridge 'a2c39a67-af9c-4063-8aa7-2bcedbce52a9': Packetization comparison success between RTP streams (read_ptime0:20 == write_ptime1:20 and read_ptime1:20 == write_ptime0:20).
 bridge.c: Bridge technology simple_bridge has less preference than native_rtp (50 <= 90). Skipping.
 bridge.c: Bridge technology holding_bridge does not have any capabilities we want.
 bridge.c: Bridge technology softmix does not have any capabilities we want.
 bridge.c: Chose bridge technology native_rtp
 bridge.c: Bridge a2c39a67-af9c-4063-8aa7-2bcedbce52a9 is already using the new technology.
 stasis_bridges.c: Update: 0x7f4f2001cf08  Old: a2c39a67-af9c-4063-8aa7-2bcedbce52a9  New: a2c39a67-af9c-4063-8aa7-2bcedbce52a9
 stasis_bridges.c: Update: 0x7f4f2001cf08  Old: a2c39a67-af9c-4063-8aa7-2bcedbce52a9  New: a2c39a67-af9c-4063-8aa7-2bcedbce52a9
 channel.c: Dropping duplicate answer!
 chan_pjsip.c:  PJSIP/toip-00006a82: Indicated Private Cause Code
 chan_pjsip.c:  PJSIP/toip-00006a82
 bridge_channel.c: Bridge a2c39a67-af9c-4063-8aa7-2bcedbce52a9: pulling 0x7f4f20033820(PJSIP/toip-00006a82)
 bridge_channel.c: Bridge a2c39a67-af9c-4063-8aa7-2bcedbce52a9: 0x7f4f20033820(PJSIP/toip-00006a82) is leaving native_rtp technology
 bridge_native_rtp.c: Bridge 'a2c39a67-af9c-4063-8aa7-2bcedbce52a9'.  Channel 'PJSIP/toip-00006a82' is leaving bridge tech
 bridge_native_rtp.c: Bridge 'a2c39a67-af9c-4063-8aa7-2bcedbce52a9'.  Detaching hook data 0x7f4f20008188 from 'PJSIP/toip-00006a82'
 bridge_native_rtp.c: Destroying channel tech_pvt data 0x7f4f20037b70
 stasis_bridges.c: Update: 0x7f4f20037798  Old: a2c39a67-af9c-4063-8aa7-2bcedbce52a9  New: a2c39a67-af9c-4063-8aa7-2bcedbce52a9
 stasis_bridges.c: Update: 0x7f4f20037798  Old: a2c39a67-af9c-4063-8aa7-2bcedbce52a9  New: a2c39a67-af9c-4063-8aa7-2bcedbce52a9
 bridge.c: Bridge a2c39a67-af9c-4063-8aa7-2bcedbce52a9 is dissolved, not performing smart bridge operation.
 chan_pjsip.c:  PJSIP/toip-00006a82: Indicated Media SSRC change
 chan_pjsip.c:  PJSIP/toip-00006a82
 app_dial.c: Exiting with DIALSTATUS=ANSWER.
 app_dial.c:  PJSIP/toip-00006a82: Done
 pbx.c: Spawn extension (from-toip,+39XXXXXX,2) exited non-zero on 'PJSIP/toip-00006a82'
 channel.c: Soft-Hanging (0x10) up channel 'PJSIP/toip-00006a82'
 channel.c: Channel 0x7f4f0820b380 'PJSIP/toip-00006a82' hanging up.  Refs: 2
 chan_pjsip.c:  PJSIP/toip-00006a82
 chan_pjsip.c: AST hangup cause 16 (no match found in PJSIP)
 chan_pjsip.c:  Cause: 0

on the voip phone (called), here’s the INVITE BODY received:


v=0
o=- 164455675 164455675 IN IP4 [Asterisk B2BUA IP]
s=Asterisk
c=IN IP4 [Asterisk B2BUA IP]
t=0 0
m=audio 14766 RTP/AVP 18 9 8 0 101
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:9 G722/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

Thanks for any help!
Michele

You haven’t actually provided any config to look at. That being said, have you looked at the actual flow of media using “rtp set debug on”?

That’s true, here’s my pjsip.conf:

[global]
type = global

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

and the pjsip_wizard.conf:

[trunk_defaults](!)
type = wizard
transport = transport-udp
endpoint/allow_subscribe = no
aor/qualify_frequency = 30
registration/expiration = 1800
ignore_uri_user_options = yes
has_hint = no
allow_transfer = yes
redirect_method = uri_core
allow_subscribe=no
t38_udptl=yes
t38_udptl_ec=redundancy
fax_detect=no
t38_udptl_nat=yes

[toip](trunk_defaults)
;hint_context = from-toip
endpoint/context = from-toip
endpoint/allow=!all,g729
remote_hosts = [ToIP SBC]
sends_registrations = no
accepts_registrations = no
sends_auth = no
accepts_auth = no

[voip](trunk_defaults)
;hint_context = from-voip
endpoint/context = from-voip
endpoint/allow=!all,g729,g722,alaw,ulaw
remote_hosts = [OpenSIPS SIP Router]
sends_registrations = no
accepts_registrations = no
sends_auth = no
accepts_auth = no

can you try only allow 1 codec on voip as well “g729”
do you have a g729 licens on your server (allow transcoding)

We are using free G.729 codec and seems that is not a license issue. Looks like something related to codec negotiation mismatching.

Thanks however for your kindly reply.

Have you checked “rtp set debug on” as I originally mentioned to ensure media is actually flowing as expected? How did you determine that it’s a “codec negotiation mismatch” issue?

More investigation, using Wireshark to analyze the RTP traffic between endpoints, seems to point to an issue in our VoIP phones, expecially for a specified firmware release. Seems that Asterisk is not involved in this issue.

To close this issue, seems that forcing transcoding (using, for example, G.722 for voip side and G.729 for toip side) solve the issue. It’s just a workaround, but works.

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