[Freeswitch-users] Early media + T38 in SDP = Codec negotiation error

Tristan Dean tristan at mocha.net.nz
Thu Aug 17 08:17:14 UTC 2017


Hi animal_alpha

This sounds very much like a problem I had when we upgraded from 1.4 to 1.6.
In our case, the carrier was sending the initial INVITE messages with 2 m-lines. One with audio, one with image. Both had non-zero port numbers. In my testing, it seemed to be that having 2 m-lines with different port numbers upset FreeSWITCH's SDP parsing. 

If I set bypass_media=true and FreeSWITCH could step out of media path, the call could connect normally, but this wasn't an option for us as we needed to transcode. I can't recall if proxy_media=true worked (I.E. FreeSWITCH just proxies RTP and doesn't transcode). Our application required transcoding anyway.

In the end I made a rather ugly work-around, but I'm sure there are nicer ways to manage this.
I found that FreeSWITCH 1.6 could parse the SDP correctly if I rewrote the port for the m-line containing image.

Since we were using mod_xml_curl for the dialplan, this was quite easy. 
Effectively I have a bit of perl script  parsing the SDP lines from 'variable_switch_r_sdp'.

if ($line =~  /^m\=image\s+(\d+)\s+udptl\s+(.*)$/) {
                        $line = "m=image 0 udptl $2";
                        $rewrite_reqd = 1;
                        }
$line = "$line\r\n";

You can insert the rewritten SDP with <![CDATA[switch_r_sdp=$rewritten_sdp]]>
This worked around the problem and didn't interfere with T.38 revinites from fax machines. 

All this being said, I am not certain that my approach would work as if I understand you correctly, your problem is with the SDP attached to the 18X message. Hopefully this might inspire some other ideas if nothing else.

I am very interested to hear other's thoughts on this. I feel I'm probably missing something and there is a cleaner way of managing these SDPs.

Many thanks,

Tristan

-----Original Message-----
From: FreeSWITCH-users [mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of animal_alpha
Sent: Wednesday, 16 August 2017 5:57 PM
To: freeswitch-users at lists.freeswitch.org
Subject: [Freeswitch-users] Early media + T38 in SDP = Codec negotiation error

Hello everybody. Have some problem with fs.
I've got codec negotiation error when i try use early_media and sdp has T38

pre_answer()
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [PCMA:8:8000:20:64000:1]/[PCMA:8:8000:20:64000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4504 Audio Codec Compare [PCMA:8:8000:20:64000:1] ++++ is saved as a match
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [PCMA:8:8000:20:64000:1]/[PCMU:0:8000:20:64000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [PCMA:8:8000:20:64000:1]/[G729:18:8000:20:8000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [PCMA:8:8000:20:64000:1]/[G722:9:8000:20:64000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [PCMU:0:8000:20:64000:1]/[PCMA:8:8000:20:64000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [PCMU:0:8000:20:64000:1]/[PCMU:0:8000:20:64000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4504 Audio Codec Compare [PCMU:0:8000:20:64000:1] ++++ is saved as a match
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [PCMU:0:8000:20:64000:1]/[G729:18:8000:20:8000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [PCMU:0:8000:20:64000:1]/[G722:9:8000:20:64000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [G729:101:8000:20:0:1]/[PCMA:8:8000:20:64000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [G729:101:8000:20:0:1]/[PCMU:0:8000:20:64000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [G729:101:8000:20:0:1]/[G729:18:8000:20:8000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [G729:101:8000:20:0:1]/[G722:9:8000:20:64000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [iLBC:97:8000:30:0:1]/[PCMA:8:8000:20:64000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [iLBC:97:8000:30:0:1]/[PCMU:0:8000:20:64000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [iLBC:97:8000:30:0:1]/[G729:18:8000:20:8000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [iLBC:97:8000:30:0:1]/[G722:9:8000:20:64000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [iLBC:98:8000:30:0:1]/[PCMA:8:8000:20:64000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [iLBC:98:8000:30:0:1]/[PCMU:0:8000:20:64000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [iLBC:98:8000:30:0:1]/[G729:18:8000:20:8000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [iLBC:98:8000:30:0:1]/[G722:9:8000:20:64000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [gsm:3:8000:20:13200:1]/[PCMA:8:8000:20:64000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [gsm:3:8000:20:13200:1]/[PCMU:0:8000:20:64000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [gsm:3:8000:20:13200:1]/[G729:18:8000:20:8000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [gsm:3:8000:20:13200:1]/[G722:9:8000:20:64000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [speex:99:8000:20:0:1]/[PCMA:8:8000:20:64000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [speex:99:8000:20:0:1]/[PCMU:0:8000:20:64000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [speex:99:8000:20:0:1]/[G729:18:8000:20:8000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [speex:99:8000:20:0:1]/[G722:9:8000:20:64000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [G729:18:8000:20:8000:1]/[PCMA:8:8000:20:64000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [G729:18:8000:20:8000:1]/[PCMU:0:8000:20:64000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [G729:18:8000:20:8000:1]/[G729:18:8000:20:8000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4504 Audio Codec Compare [G729:18:8000:20:8000:1] ++++ is saved as a match
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [G729:18:8000:20:8000:1]/[G722:9:8000:20:64000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [G729:100:8000:20:0:1]/[PCMA:8:8000:20:64000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [G729:100:8000:20:0:1]/[PCMU:0:8000:20:64000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [G729:100:8000:20:0:1]/[G729:18:8000:20:8000:1]
2017-08-16 08:50:36.337346 [DEBUG] switch_core_media.c:4449 Audio Codec Compare [G729:100:8000:20:0:1]/[G722:9:8000:20:64000:1]

2017-08-16 08:25:36.105410 [DEBUG] switch_core_media.c:4365 Set telephone-event payload to 96 at 8000
2017-08-16 08:25:36.105410 [DEBUG] switch_core_media.c:3061 Set Codec
sofia/external/4995196123 at 10.34.111.140:5061 PCMA/8000 20 ms 160 samples
64000 bits 1 channels
2017-08-16 08:25:36.105410 [DEBUG] switch_core_codec.c:111
sofia/external/4995196123 at 10.34.111.140:5061 Original read codec set to
PCMA:8
2017-08-16 08:25:36.105410 [DEBUG] switch_core_media.c:4708 Set telephone-event payload to 96 at 8000
2017-08-16 08:25:36.105410 [DEBUG] switch_core_media.c:4767
sofia/external/123 at 10.34.111.140:5061 Set 2833 dtmf send payload to 96 recv payload to 96
2017-08-16 08:25:36.105410 [DEBUG] switch_core_media.c:4028
sofia/external/123 at 10.34.111.140:5061 T38 REFUSE on request
2017-08-16 08:25:36.105410 [ERR] mod_sofia.c:2343 CODEC NEGOTIATION ERROR. 
SDP:
v=0                                                                                                                                                                             
o=- 1502861170 1502861170 IN IP4 10.34.111.143                                                                                                                                 
s=-                                                                                                                                                                             
c=IN IP4 10.34.84.100                                                                                                                                                           
t=0 0                                                                                                                                                                           
m=audio 53628 RTP/AVP 8 0 101 97 98 3 99 18 100 96                                                                                                                              
a=rtpmap:8 PCMA/8000                                                                                                                                                            
a=rtpmap:0 PCMU/8000                                                                                                                                                            
a=rtpmap:101 G729/8000                                                                                                                                                          
a=fmtp:101 annexb=yes                                                                                                                                                           
a=rtpmap:97 iLBC/8000                                                                                                                                                           
a=fmtp:97 mode=20                                                                                                                                                               
a=rtpmap:98 iLBC/8000                                                                                                                                                           
a=fmtp:98 mode=30                                                                                                                                                               
a=rtpmap:3 gsm/8000                                                                                                                                                             
a=rtpmap:99 speex/8000                                                                                                                                                          
a=fmtp:99 mode=3;vbr=off                                                                                                                                                        
a=rtpmap:18 G729/8000                                                                                                                                                           
a=fmtp:18 annexb=no                                                                                                                                                             
a=rtpmap:100 G729/8000                                                                                                                                                          
a=fmtp:100 annexb=no                                                                                                                                                            
a=rtpmap:96 telephone-event/8000                                                                                                                                                
a=fmtp:96 0-15                                                                                                                                                                  
m=image 41690 udptl t38                                                                                                                                                         
a=T38FaxRateManagement:transferredTCF                                                                                                                                           
a=T38FaxUdpEC:t38UDPRedundancy          

my codecs:
  <X-PRE-PROCESS cmd="set" data="global_codec_prefs=PCMA,PCMU,G729,G722"/>
  <X-PRE-PROCESS cmd="set" data="outbound_codec_prefs=PCMA,PCMU,G729,G722"/>

Solution: dont use early media (use execute_on_answer=record_session instead of application=record_session in my case)

Does not help: t38 ignore, late negotiation=false, 



--
View this message in context: http://freeswitch-users.2379917.n2.nabble.com/Early-media-T38-in-SDP-Codec-negotiation-error-tp7596350.html
Sent from the freeswitch-users mailing list archive at Nabble.com.

_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting at freeswitch.org
http://www.freeswitchsolutions.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org


---
This email has been checked for viruses by AVG.
http://www.avg.com





More information about the FreeSWITCH-users mailing list