[Freeswitch-users] Video Upgrade/Downgrade and Transcoding

Carsten Bock carsten at ng-voice.com
Wed Sep 26 12:31:10 UTC 2018


I am using FreeSwitch Release:
FreeSWITCH (Version 1.9.0 -n20180903T123919Z-1~jessie+1git 5dd4451
2018-08-31 19:05:39Z 64bit) is ready

I have the following, rather simple scenario, where I can't figure
out, how to configure it properly. I use FreeSwitch as Transcoding
B2B-UA/SBC. All the logic is done on a Kamailio in Front of
FreeSwitch. Thus my dialplan is rather simple:

  <context name="public">
    <extension name="other">
        <action application="bridge"

In order to provide transcoding, I have set the following in my
internal.xml profile:

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

    <param name="disable-transcoding" value="false"/>
    <param name="inherit_codec" value="false"/>

    <!--set to 'greedy' if you want your codec list to take precedence -->
    <param name="inbound-codec-negotiation" value="generous"/>

    <!-- Let calls hit the dialplan before selecting codec for the a-leg -->
    <param name="inbound-late-negotiation" value="true"/>

In vars.xml, I have the following:

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

  <X-PRE-PROCESS cmd="set" data="media_mix_inbound_outbound_codecs=true"/>
  <X-PRE-PROCESS cmd="set" data="rtp_pass_codecs_on_stream_change=true"/>
  <X-PRE-PROCESS cmd="set" data="sip_renegotiate_codec_on_reinvite=true"/>

This works like a charm for all Voice-Calls, the B-Party gets an offer
including all the codecs from the list, e.g. A-Party supports only
G722, B-Party supports only PCMU, so FreeSwitch does the transcoding.

However, it leads to issues, when it comes to Video. As soon as I add
H264 and VP8 to the codecs list (global_codec_pref /
outbound_codec_prefs), the call to my B-Party includes the offer for
Video as well, even if the A-Party did not offer Video initially. Is
there an easy way to solve this? What are the right settings for such

I tried the following in my dialplan:

      <!-- Here we check for Video to add it back into the SDP if we want -->
      <condition field="${switch_r_sdp}" expression="/(.*)(m=video
\d+)(.*)/s" break="never">
        <anti-action application="export"

This would remove the Video from the initial invite, if the A-Party
did not offer Video initially. However, if I then enable Video at a
later stage (Re-INVITE with m=video), FreeSwitch will not forward the
new stream to the B-Party and then instead just send a re-INVITE with
Audio only to the B-Party.

Where did I go wrong? Any ideas?



Carsten Bock
CEO (Geschäftsführer)

ng-voice GmbH
Millerntorplatz 1
20359 Hamburg / Germany

mailto:carsten at ng-voice.com

Office +49 40 5247593-40
Fax +49 40 5247593-99

Sitz der Gesellschaft: Hamburg
Registergericht: Amtsgericht Hamburg, HRB 120189
Geschäftsführer: Carsten Bock
Ust-ID: DE279344284

Hier finden Sie unsere handelsrechtlichen Pflichtangaben:

More information about the FreeSWITCH-users mailing list