Transcoding fusionpbx incoming codecs to g711

Status
Not open for further replies.

chickenpbx

New Member
May 2, 2023
3
0
1
29
Hello dears,
I hope you're doing great!

I need your help to find the correct way to transcode any incoming calls with any incoming codecs to go with PCMU,PCMA (g711).
So first I had the rejection code 488 as soon as I send the call with g726 codec for example, so I added these lines to my dialplan:

<action application="set" data="codec_string= PCMU,PCMA"/>
<action application="set" data="absolute_codec_string=PCMU,PCMA"/>
<action application="set" data="outbound_codec_string=PCMU,PCMA"/>
<action application="set" data="disable_rtp_auto_adjust=true"/>

after adding these lines, the call wasn't rejected immediately, we can hear the ring and everything is okay until the call is answered, so when it's answered, the same rejection happens again (488) and the call hangs up.

These are the logs:



2023-06-23 14:08:27.835666 99.37% [NOTICE] switch_ivr_originate.c:3844 Channel [sofia/internal/test@192.168.1.53] has been answered


2023-06-23 14:08:27.835666 99.37% [DEBUG] switch_channel.c:3893 (sofia/internal/test@192.168.1.53) Callstate Change EARLY -> ACTIVE


2023-06-23 14:08:27.835666 99.37% [DEBUG] sofia.c:7487 Channel sofia/internal/test@192.168.1.53 entering state [completed][200]


2023-06-23 14:08:27.835666 99.37% [DEBUG] switch_ivr_originate.c:3902 Originate Resulted in Success: [sofia/external/111111] Peer UUID: 169b49c8-a2bf-48f7-917a-4b49cc9ad891


2023-06-23 14:08:27.835666 99.37% [DEBUG] switch_ivr_bridge.c:1791 (sofia/external/111111) State Change CS_CONSUME_MEDIA -> CS_EXCHANGE_MEDIA


2023-06-23 14:08:27.835666 99.37% [DEBUG] switch_core_state_machine.c:581 (sofia/external/111111) Running State Change CS_EXCHANGE_MEDIA (Cur 2 Tot 14)


2023-06-23 14:08:27.835666 99.37% [DEBUG] switch_core_state_machine.c:650 (sofia/external/111111) State EXCHANGE_MEDIA


2023-06-23 14:08:27.835666 99.37% [DEBUG] mod_sofia.c:671 SOFIA EXCHANGE_MEDIA


2023-06-23 14:08:27.875666 99.37% [DEBUG] switch_rtp.c:7511 Correct audio ip/port confirmed.


2023-06-23 14:08:28.095667 99.37% [DEBUG] sofia.c:7487 Channel sofia/internal/test@192.168.1.53 entering state [ready][200]


2023-06-23 14:08:28.435666 99.37% [DEBUG] switch_rtp.c:1775 rtcp_stats_init: audio ssrc[3492333494] base_seq[63016]


2023-06-23 14:08:32.335661 99.27% [NOTICE] sofia.c:1065 Hangup sofia/internal/test@192.168.1.53 [CS_EXECUTE] [NORMAL_CLEARING]


2023-06-23 14:08:32.335661 99.27% [DEBUG] switch_ivr_bridge.c:911 BRIDGE THREAD DONE [sofia/internal/test@192.168.1.53]


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_ivr_bridge.c:819 sofia/internal/test@192.168.1.53 ending bridge by request from write function


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_ivr_bridge.c:911 BRIDGE THREAD DONE [sofia/external/111111]


2023-06-23 14:08:32.355638 99.30% [NOTICE] switch_ivr_bridge.c:1027 Hangup sofia/external/111111 [CS_EXCHANGE_MEDIA] [NORMAL_CLEARING]


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_core_state_machine.c:650 (sofia/external/111111) State EXCHANGE_MEDIA going to sleep


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_core_state_machine.c:581 (sofia/external/111111) Running State Change CS_HANGUP (Cur 2 Tot 14)


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_core_state_machine.c:844 (sofia/external/111111) Callstate Change ACTIVE -> HANGUP


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_core_state_machine.c:846 (sofia/external/111111) State HANGUP


2023-06-23 14:08:32.355638 99.30% [DEBUG] mod_sofia.c:462 sofia/external/111111 Overriding SIP cause 480 with 200 from the other leg


2023-06-23 14:08:32.355638 99.30% [DEBUG] mod_sofia.c:468 Channel sofia/external/111111 hanging up, cause: NORMAL_CLEARING


2023-06-23 14:08:32.355638 99.30% [DEBUG] mod_sofia.c:522 Sending BYE to sofia/external/111111


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_core_state_machine.c:59 sofia/external/111111 Standard HANGUP, cause: NORMAL_CLEARING


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_core_state_machine.c:846 (sofia/external/111111) State HANGUP going to sleep


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_core_state_machine.c:616 (sofia/external/111111) State Change CS_HANGUP -> CS_REPORTING


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_core_state_machine.c:581 (sofia/external/111111) Running State Change CS_REPORTING (Cur 2 Tot 14)


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_core_state_machine.c:932 (sofia/external/111111) State REPORTING


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_core_state_machine.c:168 sofia/external/111111 Standard REPORTING, cause: NORMAL_CLEARING


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_core_state_machine.c:932 (sofia/external/111111) State REPORTING going to sleep


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_core_state_machine.c:607 (sofia/external/111111) State Change CS_REPORTING -> CS_DESTROY


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_core_session.c:1743 Session 14 (sofia/external/111111) Locked, Waiting on external entities


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_ivr_bridge.c:1893 sofia/internal/test@192.168.1.53 skip receive message [UNBRIDGE] (channel is hungup already)


2023-06-23 14:08:32.355638 99.30% [NOTICE] switch_core_session.c:1761 Session 14 (sofia/external/111111) Ended


2023-06-23 14:08:32.355638 99.30% [NOTICE] switch_core_session.c:1765 Close Channel sofia/external/111111 [CS_DESTROY]


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_core_session.c:2973 sofia/internal/test@192.168.1.53 skip receive message [PHONE_EVENT] (channel is hungup already)


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_core_state_machine.c:647 (sofia/internal/test@192.168.1.53) State EXECUTE going to sleep


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_core_state_machine.c:581 (sofia/internal/test@192.168.1.53) Running State Change CS_HANGUP (Cur 1 Tot 14)


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_core_state_machine.c:735 (sofia/external/111111) Running State Change CS_DESTROY (Cur 1 Tot 14)


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_core_state_machine.c:844 (sofia/internal/test@192.168.1.53) Callstate Change ACTIVE -> HANGUP


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_core_state_machine.c:846 (sofia/internal/test@192.168.1.53) State HANGUP


2023-06-23 14:08:32.355638 99.30% [DEBUG] mod_sofia.c:468 Channel sofia/internal/test@192.168.1.53 hanging up, cause: NORMAL_CLEARING


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_core_state_machine.c:745 (sofia/external/111111) State DESTROY


2023-06-23 14:08:32.355638 99.30% [DEBUG] mod_sofia.c:379 sofia/external/111111 SOFIA DESTROY


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_core_state_machine.c:175 sofia/external/111111 Standard DESTROY


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_core_state_machine.c:745 (sofia/external/111111) State DESTROY going to sleep


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_core_state_machine.c:59 sofia/internal/test@192.168.1.53 Standard HANGUP, cause: NORMAL_CLEARING


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_core_state_machine.c:846 (sofia/internal/test@192.168.1.53) State HANGUP going to sleep


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_core_state_machine.c:616 (sofia/internal/test@192.168.1.53) State Change CS_HANGUP -> CS_REPORTING


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_core_state_machine.c:581 (sofia/internal/test@192.168.1.53) Running State Change CS_REPORTING (Cur 1 Tot 14)


2023-06-23 14:08:32.355638 99.30% [DEBUG] switch_core_state_machine.c:932 (sofia/internal/test@192.168.1.53) State REPORTING


2023-06-23 14:08:32.435649 99.30% [DEBUG] switch_core_state_machine.c:168 sofia/internal/test@192.168.1.53 Standard REPORTING, cause: NORMAL_CLEARING


2023-06-23 14:08:32.435649 99.30% [DEBUG] switch_core_state_machine.c:932 (sofia/internal/test@192.168.1.53) State REPORTING going to sleep


2023-06-23 14:08:32.435649 99.30% [DEBUG] switch_core_state_machine.c:607 (sofia/internal/test@192.168.1.53) State Change CS_REPORTING -> CS_DESTROY


2023-06-23 14:08:32.435649 99.30% [DEBUG] switch_core_session.c:1743 Session 13 (sofia/internal/test@192.168.1.53) Locked, Waiting on external entities


2023-06-23 14:08:32.435649 99.30% [NOTICE] switch_core_session.c:1761 Session 13 (sofia/internal/test@192.168.1.53) Ended


2023-06-23 14:08:32.435649 99.30% [NOTICE] switch_core_session.c:1765 Close Channel sofia/internal/test@192.168.1.53 [CS_DESTROY]


2023-06-23 14:08:32.435649 99.30% [DEBUG] switch_core_state_machine.c:735 (sofia/internal/test@192.168.1.53) Running State Change CS_DESTROY (Cur 0 Tot 14)


2023-06-23 14:08:32.455638 99.30% [DEBUG] switch_core_state_machine.c:745 (sofia/internal/test@192.168.1.53) State DESTROY


2023-06-23 14:08:32.455638 99.30% [DEBUG] mod_sofia.c:379 sofia/internal/test@192.168.1.53 SOFIA DESTROY


So anyone knows how to fix this issue, how to do the correct transcoding way to keep the call flowing without any hangup or codec negotiation issue?


Thank you in advance
 

hfoster

Active Member
Jan 28, 2019
684
81
28
34
I would only really set them in the Variables:

Set:

global_codec_prefs = PCMU,PCMA
outbound_codec_prefs = G726,PCMU,PCMA
media_mix_inbound_outbound_codec = true

Internal profile should only then allow PCMU and PCMA, and the external will transcode G726 if it needs to.
 

chickenpbx

New Member
May 2, 2023
3
0
1
29
Thank you for your answer!
I tried these configs, but still getting rejection code 488.
Are you sure that there is a way to transcode any incoming codec to G711 in fusionpbx/freeswitch?
 

hfoster

Active Member
Jan 28, 2019
684
81
28
34
Well, that's what media_mix_inbound_outbound_codec does. I do it in reverse for OPUS.

Did you restart the SIP Profiles?
 

chickenpbx

New Member
May 2, 2023
3
0
1
29
Yeah I restarted the SIP profiles. and I even tried to remove these:

<action application="set" data="codec_string= PCMU,PCMA"/>
<action application="set" data="absolute_codec_string=PCMU,PCMA"/>
<action application="set" data="outbound_codec_string=PCMU,PCMA"/>
<action application="set" data="disable_rtp_auto_adjust=true"/>

from the dialplan.

Like the call goes and it rings but when the call is answered, it hangs up directly and the reason is some codec negotiation 488 (not acceptable). So it's like it's transcoding before answer but after the answer it's not continuing the the transcode
 

hfoster

Active Member
Jan 28, 2019
684
81
28
34
If you run an sngrep from the server, is it the client that is rejecting the call or the server? It might not be the codec, it might be SRTP or something similar.
 

hfoster

Active Member
Jan 28, 2019
684
81
28
34
What does the 200 OK (SDP) show for the second image? It almost looks like it's replied back with codecs that don't intersect. In the Freeswitch logs at /var/log/freeswitch.log this should show as a mismatch during the 'Audio Codec Compare' stage.
 
Status
Not open for further replies.