[Freeswitch-users] About Codec Negotiation

王聡 cong.wang.itsherpa at gmail.com
Fri Dec 29 08:01:30 UTC 2017


Hey all,

I had got an issue when I tried to bridge FS to Asterisk for a outgoing call. The late negotation had been set as true, but I got a codec error on Asterisk which showed:

[Dec 29 16:16:52] NOTICE[2095][C-00000002]: chan_sip.c:10465 process_sdp: No compatible codecs, not accepting this offer!

After this I checked the codec negotiation, like this:

SDP message from softphone:

43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:46.677190 [DEBUG] sofia.c:7094 Remote SDP:401e6cb7-3c4d-43ca-9bc9-a5055ad52485 v=0
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:46.677190 [DEBUG] sofia.c:7094 Remote SDP:
43e110bf-0dd2-4518-a5d8-3b3afd52f6de v=0
43e110bf-0dd2-4518-a5d8-3b3afd52f6de o=52bf0a8a88c515081c124a49cf6ce7bc 2651 2264 IN IP4 192.168.254.65
43e110bf-0dd2-4518-a5d8-3b3afd52f6de s=Talk
43e110bf-0dd2-4518-a5d8-3b3afd52f6de c=IN IP4 192.168.254.65
43e110bf-0dd2-4518-a5d8-3b3afd52f6de t=0 0
43e110bf-0dd2-4518-a5d8-3b3afd52f6de a=rtcp-xr:rcvr-rtt=all:10000 stat-summary=loss,dup,jitt,TTL voip-metrics
43e110bf-0dd2-4518-a5d8-3b3afd52f6de m=audio 7076 RTP/AVP 96 97 98 99 0 8 101 100 102
43e110bf-0dd2-4518-a5d8-3b3afd52f6de a=rtpmap:96 opus/48000/2
43e110bf-0dd2-4518-a5d8-3b3afd52f6de a=fmtp:96 useinbandfec=1
43e110bf-0dd2-4518-a5d8-3b3afd52f6de a=rtpmap:97 SILK/16000
43e110bf-0dd2-4518-a5d8-3b3afd52f6de a=rtpmap:98 speex/16000
43e110bf-0dd2-4518-a5d8-3b3afd52f6de a=fmtp:98 vbr=on
43e110bf-0dd2-4518-a5d8-3b3afd52f6de a=rtpmap:99 speex/8000
43e110bf-0dd2-4518-a5d8-3b3afd52f6de a=fmtp:99 vbr=on
43e110bf-0dd2-4518-a5d8-3b3afd52f6de a=rtpmap:101 telephone-event/48000
43e110bf-0dd2-4518-a5d8-3b3afd52f6de a=rtpmap:100 telephone-event/16000
43e110bf-0dd2-4518-a5d8-3b3afd52f6de a=rtpmap:102 telephone-event/8000
43e110bf-0dd2-4518-a5d8-3b3afd52f6de a=rtcp-fb:* trr-int 5000

Negotiation steps:

43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [opus:96:48000:20:0:1]/[PCMU:0:8000:20:64000:1]
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [opus:96:48000:20:0:1]/[PCMA:8:8000:20:64000:1]
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [opus:96:48000:20:0:1]/[GSM:3:8000:20:13200:1]
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [opus:96:48000:20:0:1]/[SPEEX:99:8000:20:24600:1]
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [opus:96:48000:20:0:1]/[SPEEX:99:16000:20:42200:1]
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [SILK:97:16000:20:0:1]/[PCMU:0:8000:20:64000:1]
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [SILK:97:16000:20:0:1]/[PCMA:8:8000:20:64000:1]
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [SILK:97:16000:20:0:1]/[GSM:3:8000:20:13200:1]
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [SILK:97:16000:20:0:1]/[SPEEX:99:8000:20:24600:1]
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [SILK:97:16000:20:0:1]/[SPEEX:99:16000:20:42200:1]
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [speex:98:16000:20:0:1]/[PCMU:0:8000:20:64000:1]
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [speex:98:16000:20:0:1]/[PCMA:8:8000:20:64000:1]
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [speex:98:16000:20:0:1]/[GSM:3:8000:20:13200:1]
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [speex:98:16000:20:0:1]/[SPEEX:99:8000:20:24600:1]
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [speex:98:16000:20:0:1]/[SPEEX:99:16000:20:42200:1]
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4504 Audio Codec Compare [SPEEX:99:16000:20:42200:1] ++++ is saved as a match
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [speex:99:8000:20:0:1]/[PCMU:0:8000:20:64000:1]
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [speex:99:8000:20:0:1]/[PCMA:8:8000:20:64000:1]
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [speex:99:8000:20:0:1]/[GSM:3:8000:20:13200:1]
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [speex:99:8000:20:0:1]/[SPEEX:99:8000:20:24600:1]
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4504 Audio Codec Compare [SPEEX:99:8000:20:24600:1] ++++ is saved as a match
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [speex:99:8000:20:0:1]/[SPEEX:99:16000:20:42200:1]
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [PCMU:0:8000:20:64000:1]/[PCMU:0:8000:20:64000:1]
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4504 Audio Codec Compare [PCMU:0:8000:20:64000:1] ++++ is saved as a match
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [PCMU:0:8000:20:64000:1]/[PCMA:8:8000:20:64000:1]
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [PCMU:0:8000:20:64000:1]/[GSM:3:8000:20:13200:1]
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [PCMU:0:8000:20:64000:1]/[SPEEX:99:8000:20:24600:1]
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [PCMU:0:8000:20:64000:1]/[SPEEX:99:16000:20:42200:1]
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [PCMA:8:8000:20:64000:1]/[PCMU:0:8000:20:64000:1]
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [PCMA:8:8000:20:64000:1]/[PCMA:8:8000:20:64000:1]
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4504 Audio Codec Compare [PCMA:8:8000:20:64000:1] ++++ is saved as a match
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [PCMA:8:8000:20:64000:1]/[GSM:3:8000:20:13200:1]
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [PCMA:8:8000:20:64000:1]/[SPEEX:99:8000:20:24600:1]
43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [PCMA:8:8000:20:64000:1]/[SPEEX:99:16000:20:42200:1]
Returned SDP message:

43e110bf-0dd2-4518-a5d8-3b3afd52f6de 2017-12-29 16:35:47.277188 [DEBUG] mod_sofia.c:2364 Ring SDP:
43e110bf-0dd2-4518-a5d8-3b3afd52f6de v=0
43e110bf-0dd2-4518-a5d8-3b3afd52f6de o=FreeSWITCH 1514482587 1514482588 IN IP4 172.16.25.25
43e110bf-0dd2-4518-a5d8-3b3afd52f6de s=FreeSWITCH
43e110bf-0dd2-4518-a5d8-3b3afd52f6de c=IN IP4 210.148.155.42
43e110bf-0dd2-4518-a5d8-3b3afd52f6de t=0 0
43e110bf-0dd2-4518-a5d8-3b3afd52f6de m=audio 50360 RTP/AVP 98 100
43e110bf-0dd2-4518-a5d8-3b3afd52f6de a=rtpmap:98 speex/16000
43e110bf-0dd2-4518-a5d8-3b3afd52f6de a=rtpmap:100 telephone-event/16000
43e110bf-0dd2-4518-a5d8-3b3afd52f6de a=fmtp:100 0-16
43e110bf-0dd2-4518-a5d8-3b3afd52f6de a=ptime:20
43e110bf-0dd2-4518-a5d8-3b3afd52f6de a=sendrecv

I’m not clear what happened, but PCMU and PCMA codecs are gone even it passed the check. Next the SDP had sent to Asterisk:

c5439be6-10e0-431b-b5e3-7904a14a37c0 Local SDP:
c5439be6-10e0-431b-b5e3-7904a14a37c0 v=0
c5439be6-10e0-431b-b5e3-7904a14a37c0 o=FreeSWITCH 1514482871 1514482872 IN IP4 172.16.25.24
c5439be6-10e0-431b-b5e3-7904a14a37c0 s=FreeSWITCH
c5439be6-10e0-431b-b5e3-7904a14a37c0 c=IN IP4 172.16.25.24
c5439be6-10e0-431b-b5e3-7904a14a37c0 t=0 0
c5439be6-10e0-431b-b5e3-7904a14a37c0 m=audio 50076 RTP/AVP 102 101 13
c5439be6-10e0-431b-b5e3-7904a14a37c0 a=rtpmap:102 SPEEX/16000
c5439be6-10e0-431b-b5e3-7904a14a37c0 a=rtpmap:101 telephone-event/16000
c5439be6-10e0-431b-b5e3-7904a14a37c0 a=fmtp:101 0-16
c5439be6-10e0-431b-b5e3-7904a14a37c0 a=rtpmap:13 CN/16000
c5439be6-10e0-431b-b5e3-7904a14a37c0 a=ptime:20
c5439be6-10e0-431b-b5e3-7904a14a37c0 a=sendrecv

Asterisk can’t recognize these codecs, and it turned into a failure.

So what happened in the codec negotiation, and how could I let PCMU enabled?

PS. I had pasted some setting file and hope it helps.

Vars.xml:

…
  <X-PRE-PROCESS cmd="set" data="global_codec_prefs=PCMU,PCMA,GSM,speex at 8000h@20i,speex at 16000h@20i,VP8,H264,H263-1998"/>
  <X-PRE-PROCESS cmd="set" data="outbound_codec_prefs=PCMU,PCMA,GSM,speex at 8000h@20i,speex at 16000h@20i”/>
…

Sip_profiles/external.xml:

…
    <param name="inbound-codec-prefs" value="$${global_codec_prefs}"/>
    <param name="outbound-codec-prefs" value="$${outbound_codec_prefs}”/>

    <param name="inbound-codec-negotiation" value=“generous"/>
    <param name="nonce-ttl" value="60"/>
    <param name="auth-calls" value="false"/>
    <param name="inbound-late-negotiation" value="true"/>
    <param name="inbound-zrtp-passthru" value="true"/> <!-- (also enables late negotiation) -->
…

Regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20171229/46b6c368/attachment.html>


More information about the FreeSWITCH-users mailing list