No audio in confbridge depending on used codec

Asterisk: 14.1.2
FreePbx: 13.0.190.2

I’m having a very strange “no audio” problem with asterisk.

I’ve set up a trunk and enabled the following codecs in this order: g722, alaw, ulaw, gsm
A confbridge is configured which plays music on hold when only 1 caller is in conference
The trunk is configured, to route all calls to this conference.

Now when an incoming call with g722 is received, the call is put to the conference (see this log):

[2016-11-17 20:37:45] VERBOSE[83623][C-00000024] pbx.c: Executing [STARTMEETME@ext-meetme:1] ExecIf("PJSIP/Telekom_8885855-0000001b", "1?Set(CONFBRIDGE(user,music_on_hold_class)=PopMusic)") in new stack
[2016-11-17 20:37:45] VERBOSE[83623][C-00000024] pbx.c: Executing [STARTMEETME@ext-meetme:2] ExecIf("PJSIP/Telekom_8885855-0000001b", "1?Set(CHANNEL(musicclass)=PopMusic)") in new stack
[2016-11-17 20:37:45] VERBOSE[83623][C-00000024] pbx.c: Executing [STARTMEETME@ext-meetme:3] Set("PJSIP/Telekom_8885855-0000001b", "GROUP(meetme)=995") in new stack
[2016-11-17 20:37:45] VERBOSE[83623][C-00000024] pbx.c: Executing [STARTMEETME@ext-meetme:4] GotoIf("PJSIP/Telekom_8885855-0000001b", "0?MEETMEFULL,1") in new stack
[2016-11-17 20:37:45] VERBOSE[83623][C-00000024] pbx.c: Executing [STARTMEETME@ext-meetme:5] ConfBridge("PJSIP/Telekom_8885855-0000001b", "995,,,") in new stack
[2016-11-17 20:37:45] VERBOSE[83633] bridge_channel.c: Channel CBAnn/995-00000018;2 joined 'softmix' base-bridge <67e74f9b-46a6-4624-85e7-8c1112466edb>
[2016-11-17 20:37:45] VERBOSE[83623][C-00000024] file.c: <PJSIP/Telekom_8885855-0000001b> Playing 'conf-onlyperson.g722' (language 'en')
[2016-11-17 20:37:48] VERBOSE[83623][C-00000024] res_musiconhold.c: Started music on hold, class 'PopMusic', on channel 'PJSIP/Telekom_8885855-0000001b'
[2016-11-17 20:37:48] VERBOSE[83623][C-00000024] bridge_channel.c: Channel PJSIP/Telekom_8885855-0000001b joined 'softmix' base-bridge <67e74f9b-46a6-4624-85e7-8c1112466edb>
[2016-11-17 20:37:48] VERBOSE[83632] file.c: <CBAnn/995-00000018;1> Playing 'confbridge-join.slin' (language 'en')

The strange thing is:

  • The caller can hear the announcement ‘conf-onlyperson.g722’
  • But the caller CANNOT hear the music on hold

OK. Now lets disable all codecs on the trunk and leave only the g722 enabled

Now when an incoming call with g722 is received, the call is also put to the conference. Log is the same as above, but:

  • The caller can also hear the announcement ‘conf-onlyperson.g722’
  • AND the caller can also hear the music on hold

Some things to mention:

  • The problem is not only related to music on hold. Even if another party joins the conference, the caller can only hear the initial announcement from the confbridge
  • Very strange, that the problem only occurs if alaw codec is enabled after g722 (even if it is not used)

I think is has something to do with transcoding, but cannot find out why.

Has someone a hint for me?

No one? I think this is a bug in asterisk. I did more tests on this.

If i pass the call directly to an extension audio is fine in both cases.
If i pass the call to the conference, audio is broken in case of used coded g722 with enabled codec alaw or ulaw or both of them.

We would need to see a SIP trace to see exactly what is negotiated, as well as configuration. It may be that Asterisk is dynamically changing the codec sent out the RTP (as it is allowed to when negotiated) but the other side does not like it.

Ok, i’ve done it. And as i can see asterisk puts the call into the conference. Then plays the join file. This results in sending RTP packets of type 09 ==> g722. Then after the file is played asterisk switches to RTP Type 8 ==> PCMA, and this is the point where the caller cannot hear anything. I think this is a bug, or am i wrong?

Initial invite: Line 1
Response TRYING: Line 66
Response OK: Line 795
RTP Switches to G722: Line 1043
Playing sound conf-onlyperson.g722 which the caller can hear: Line 1047
RTP Packets with g722 sending: Line 1056 … 1369

Strange things happens now: (Line 1375 and following): Format changed from g722 to alaw… But Why ???

[2016-11-21 22:11:29] DEBUG[112557][C-00000004] media_cache.c: Failed to obtain media at ‘confbridge-join’
[2016-11-21 22:11:29] DEBUG[112557][C-00000004] media_cache.c: Failed to obtain media at ‘confbridge-join’
[2016-11-21 22:11:29] DEBUG[112557][C-00000004] bridge.c: Putting interval hook 0x7ff7c4037c88 with interval 21600000 in the heap on features 0x7ff7de8d25e8
[2016-11-21 22:11:29] DEBUG[112557][C-00000004] channel.c: Channel PJSIP/Telekom_8496822-00000003 setting write format path: slin -> alaw
[2016-11-21 22:11:29] VERBOSE[112557][C-00000004] res_musiconhold.c: Started music on hold, class ‘PopMusic’, on channel ‘PJSIP/Telekom_8496822-00000003’
[2016-11-21 22:11:29] DEBUG[112557][C-00000004] channel.c: Scheduling timer at (50 requested / 50 actual) timer ticks per second
[2016-11-21 22:11:29] DEBUG[112557][C-00000004] bridge_channel.c: Bridge 37ddc666-a087-422a-8e8c-cd2904863223: 0x7ff7c4004b80(PJSIP/Telekom_8496822-00000003) is joining
[2016-11-21 22:11:29] DEBUG[112557][C-00000004] bridge_channel.c: Bridge 37ddc666-a087-422a-8e8c-cd2904863223: pushing 0x7ff7c4004b80(PJSIP/Telekom_8496822-00000003)
[2016-11-21 22:11:29] VERBOSE[112557][C-00000004] bridge_channel.c: Channel PJSIP/Telekom_8496822-00000003 joined ‘softmix’ base-bridge <37ddc666-a087-422a-8e8c-cd2904863223>
[2016-11-21 22:11:29] DEBUG[112557][C-00000004] bridge.c: Bridge 37ddc666-a087-422a-8e8c-cd2904863223: 0x7ff7c4004b80(PJSIP/Telekom_8496822-00000003) is joining softmix technology
[2016-11-21 22:11:29] DEBUG[112557][C-00000004] channel.c: Channel PJSIP/Telekom_8496822-00000003 setting read format path: g722 -> slin
[2016-11-21 22:11:29] DEBUG[112557][C-00000004] dsp.c: Setup tone 1100 Hz, 500 ms, block_size=160, hits_required=21
[2016-11-21 22:11:29] DEBUG[112557][C-00000004] dsp.c: Setup tone 2100 Hz, 2600 ms, block_size=160, hits_required=116
[2016-11-21 22:11:29] DEBUG[109248] cdr.c: Finalized CDR for PJSIP/Telekom_8496822-00000003 - start 1479762683.821996 answer 1479762684.666813 end 1479762689.345990 dispo ANSWERED
[2016-11-21 22:11:29] DEBUG[112566] media_cache.c: Failed to obtain media at ‘confbridge-join’
[2016-11-21 22:11:29] DEBUG[112566] channel.c: Scheduling timer at (50 requested / 50 actual) timer ticks per second
[2016-11-21 22:11:29] VERBOSE[112566] file.c: <CBAnn/995-00000002;1> Playing ‘confbridge-join.slin’ (language ‘en’)
[2016-11-21 22:11:29] VERBOSE[112557][C-00000004] res_rtp_asterisk.c: Got RTP packet from 217.0.5.103:48740 (type 09, seq 040876, ts 822524001, len 000160)
[2016-11-21 22:11:29] VERBOSE[112557][C-00000004] res_rtp_asterisk.c: Got RTP packet from 217.0.5.103:48740 (type 09, seq 040877, ts 822524161, len 000160)
[2016-11-21 22:11:29] DEBUG[112557][C-00000004] res_rtp_asterisk.c: Ooh, format changed from g722 to alaw
[2016-11-21 22:11:29] VERBOSE[112557][C-00000004] res_rtp_asterisk.c: Sent RTP packet to 217.0.5.103:48740 (type 08, seq 000500, ts 025436, len 000160)
[2016-11-21 22:11:29] VERBOSE[112557][C-00000004] res_rtp_asterisk.c: Got RTP packet from 217.0.5.103:48740 (type 09, seq 040878, ts 822524321, len 000160)
[2016-11-21 22:11:29] VERBOSE[112557][C-00000004] res_rtp_asterisk.c: Sent RTP packet to 217.0.5.103:48740 (type 08, seq 000501, ts 025596, len 000160)
[2016-11-21 22:11:29] VERBOSE[112557][C-00000004] res_rtp_asterisk.c: Got RTP packet from 217.0.5.103:48740 (type 09, seq 040879, ts 822524481, len 000160)
[2016-11-21 22:11:29] VERBOSE[112557][C-00000004] res_rtp_asterisk.c: Sent RTP packet to 217.0.5.103:48740 (type 08, seq 000502, ts 025756, len 000160)
[2016-11-21 22:11:29] VERBOSE[112557][C-00000004] res_rtp_asterisk.c: Got RTP packet from 217.0.5.103:48740 (type 09, seq 040880, ts 822524641, len 000160)

----- COMPLETE LOG -----

Both G.722 and ALAW were negotiated in the SDP and according to the spec a client can switch between them. In practice some devices don’t like this. An initial fix was put in but a subsequent followup one is up on gerrit currently[1].

[1] https://gerrit.asterisk.org/#/c/4453/

Thank you. Thats it !!!

I downloaded the latest rc of asterisk (14.2.0-rc1) and applied the fix to this, et voila… We have audio… Thank you so much for this hint.

But i don’t understand your comment “In practive some devices don’t like this”… The call is a regular incoming call from pstn (Calling from my mobile with german telekom as provider). So i think this is not a bug in some devices that don’t like that. Tried this also with another mobile via another provider.

What he means is that there is no bug in Asterisk when it changes codecs, but some devices have bugs in them that cause them to not operate correctly when this happens. In this case, it would seem the faulty device is the device that implements the ITSP’s system.

The fix will be a workaround, rather than a fix, as the actual fix would have to be made where the fault lies.

Really ? So i should raise an issue and tell german telekom that they have a faulty implementation in their system ??

And as i see in the logs, asterisk is switching from g722 to PCMA where the initial handshake was g722. So why is asterisk switching to a codec with a lower quality where a higher quality codec was already used? Sorry, but I don’t understand that.

It was most likely switched because you’ve installed sound files in slin format. The cost of transcoding from slin to alaw is less than the cost of transcoding from slin to g722. You’ve told Asterisk that both formats are acceptable, and so Asterisk picks the transcoding that is cheapest. This switches the format to alaw.

If you had provided sound prompts in g722 or in slin16, Asterisk might have chosen those sound files to play, which would either have required no transcoding, or else would have had a transcoding cost equal to slin => alaw. In that case, we wouldn’t have switched to alaw.

So: no, there’s no bug here. You told Asterisk that it could use a set of formats, it chose to use one of them to keep the cost to the system minimized, and the far end apparently couldn’t support it.

Unfortunately it is common for there to be bugs in systems run by monopolies and near monopolies, as they can use their monopoly position to force the smaller people who are using them to work round their problems. Generally it is smaller organisations that benefit from standards; larger ones set de facto standards with their bugs.

If there is a conference, the conference itself will need to work in a linear format, so that should be enough to trigger the switch, if the conference is working at 8kHz.

When dealing with the PSTN, G.722 is a lower quality format than PCMA, as PCMA is the format used by the PSTN, so can be losslessly transported over the PSTN, whereas, G.722 will undergo a lossless conversion on to PCMA on entry to the PSTN. (For North America, and Japan, substitute PCMU for PCMA.)

If the bridge is running at 8kHz, PCMA will be higher quality than G.722.

Hello mjordan, thank you for your reply. I did some more tests based on your comments:

  1. removed all .sln files from system, all soundfiles in g722 format available

== > Same behaviour with no sound (asterisk log telling: Playing ‘confbridge-join.slin’ with no error ???)

[2016-11-22 19:07:28] VERBOSE[84778][C-00000004] file.c: <PJSIP/Telekom_8496822-00000002> Playing ‘conf-onlyperson.g722’ (language ‘en’)
[2016-11-22 19:07:31] VERBOSE[84778][C-00000004] res_musiconhold.c: Started music on hold, class ‘PopMusic’, on channel ‘PJSIP/Telekom_8496822-00000002’
[2016-11-22 19:07:31] VERBOSE[84778][C-00000004] bridge_channel.c: Channel PJSIP/Telekom_8496822-00000002 joined ‘softmix’ base-bridge <122375ea-fb7e-4d09-ba3c-9ef6c40ecc05>
[2016-11-22 19:07:31] VERBOSE[84790] file.c: <CBAnn/995-00000002;1> Playing ‘confbridge-join.slin’ (language ‘en’)

  1. reconfigured asterisk via make menuconfig and disabled codec translators leaving only alaw, g722, ulaw and gsm
  2. disabled Format interpreter format_sln

==> Still same behaviour with no sound (astersik log still telling: Playing ‘confbridge-join.slin’ with no error ???)

[2016-11-22 19:07:28] VERBOSE[84778][C-00000004] file.c: <PJSIP/Telekom_8496822-00000002> Playing ‘conf-onlyperson.g722’ (language ‘en’)
[2016-11-22 19:07:31] VERBOSE[84778][C-00000004] res_musiconhold.c: Started music on hold, class ‘PopMusic’, on channel ‘PJSIP/Telekom_8496822-00000002’
[2016-11-22 19:07:31] VERBOSE[84778][C-00000004] bridge_channel.c: Channel PJSIP/Telekom_8496822-00000002 joined ‘softmix’ base-bridge <122375ea-fb7e-4d09-ba3c-9ef6c40ecc05>
[2016-11-22 19:07:31] VERBOSE[84790] file.c: <CBAnn/995-00000002;1> Playing ‘confbridge-join.slin’ (language ‘en’)

updatedb
locate .sln

NO OUTPUT, No files found

Still confused about the handling asterisk is doing here, but i thank you very much for your hints.