Hi everyone.

I need help please to make a call using PortAudio which is failing at the CODEC negotiation step. I've done this successfully in the past but that was a number of Freeswitch versions ago and on a different laptop and something may have changed.

I have a recent installation of Freeswitch on a laptop with PortAudio enabled. It registers to our main box running Freeswitch (though a rather older version) which in turn registers to our VOIP provider. When I call a number with the api pa call command, it appears to be successful but nothing happens.

Freeswitch.log on the main box shows the following lines that may explain the problem:
a13d9197-2a00-4858-92d4-5aed6dc7652d 2021-10-24 13:46:23.400156 [ERR] mod_sofia.c:2247 CODEC NEGOTIATION ERROR.  SDP:
a13d9197-2a00-4858-92d4-5aed6dc7652d v=0
a13d9197-2a00-4858-92d4-5aed6dc7652d o=FreeSWITCH 1635011588 1635011589 IN IP4 192.168.1.90
a13d9197-2a00-4858-92d4-5aed6dc7652d s=FreeSWITCH
a13d9197-2a00-4858-92d4-5aed6dc7652d c=IN IP4 192.168.1.90
a13d9197-2a00-4858-92d4-5aed6dc7652d t=0 0
a13d9197-2a00-4858-92d4-5aed6dc7652d m=audio 24794 RTP/AVP 102 101
a13d9197-2a00-4858-92d4-5aed6dc7652d a=rtpmap:102 L16/16000
a13d9197-2a00-4858-92d4-5aed6dc7652d a=rtpmap:101 telephone-event/16000
a13d9197-2a00-4858-92d4-5aed6dc7652d a=fmtp:101 0-16
a13d9197-2a00-4858-92d4-5aed6dc7652d a=ptime:20
a13d9197-2a00-4858-92d4-5aed6dc7652d 
a13d9197-2a00-4858-92d4-5aed6dc7652d 2021-10-24 13:46:23.400156 [NOTICE] switch_channel.c:3438 Hangup sofia/internal/1015@192.168.1.61 [CS_EXECUTE] [INCOMPATIBLE_DESTINATION]

I know nothing about SDP but when I look at this it kind of suggests to me that the originating machine is only offering L16/16000 as the CODEC to use. If that is the case then that is the problem because I'm pretty sure the main Freeswitch box is not set up to accept that codec.

Back to the laptop, in SIP profiles external.xml, outbound-codec-prefs is set to "$${outbound_codec_prefs}". In vars.xml, outbound_codec_prefs is set to PCMU,PCMA,GSM. I think when it makes the call it should be offering these codecs which are all acceptable to the main Freeswitch box. But then I would expect to see that in the SDP stuff in the log. It should mean the laptop would transcode from the raw PCM data from PortAudio to the codec agreed between the two machines.

But that doesn't seem to be happening. The PortAudio configuration does have a parameter for sample-rate which is currently 16000, and there is something to do with timing set to 20. But those are the only parameters I can see that relate to codecs and neither of them actually specify the codec to use. So I'm thinking that PortAudio has nothing to do with codecs, which would make sense. But that means something else in Freeswitch needs to transcode to the real world.

Can anyone explain why this is failing?

Thank you.

Clive Lansink
Email: Clive@Lansink.Co.NZ
Phone: +64 9 520-4242
Mobile: +64 21 663-999

