you could try setting execute_on_answer variable to lock in the codec 

Make an extension in the same context "assuming default for this example"

<extension name="lock_codec">                                                                                                                                   
  <condition field="destination_number" expression="^lock_codec$">
    <action application="set" data="absolute_codec_string=${rtp_use_codec_name}"/>
  </condition>
</extension>


In your normal call processing extension add this condition before calling bridge:

<action application="set" data="execute_on_answer=execute_extension lock_codec XML default"/>


Then when the channel is answered it will execute the extension and set the absolute_codec_string to whatever codec was first negotiated, that should limit what it will choose on the re-invite.

You can probably set it on both legs with "export" instead of set or by adding it also to the {} before bridge.


Dialplan: sofia/internal/1007@192.168.168.35 Regex (PASS) [lock_codec] destination_number(lock_codec) =~ /^lock_codec$/ break=on-false

Dialplan: sofia/internal/1007@192.168.168.35 Action set(absolute_codec_string=${rtp_use_codec_name}) 

2016-12-14 00:51:19.722495 [NOTICE] switch_core_session.c:2966 Execute set(absolute_codec_string=${rtp_use_codec_name})

EXECUTE sofia/internal/1007@192.168.168.35 set(absolute_codec_string=PCMU)

2016-12-14 00:51:19.722495 [DEBUG] mod_dptools.c:1562 SET sofia/internal/1007@192.168.168.35 [absolute_codec_string]=[PCMU]



On Mon, Dec 12, 2016 at 12:37 AM, Joshua Gigg <giggsey@gmail.com> wrote:

I opened a JIRA on a related note earlier this year, because when you have this call recorded, and it gets switched between G711 and G722, it messes up the recording.


On Mon, 12 Dec 2016, 04:11 Sebastian Kemper, <sebastian_ml@gmx.net> wrote:
On Fri, Dec 09, 2016 at 10:47:35PM +0100, Sebastian Kemper wrote:

<snip>

> It's probably not the smartest move for the phone to renegotiate codecs
> at this point. But I think FS should be able to deal with it (without
> simply falling back to transcoding). I've tried if putting
> "disable-transcoding" into the profiles changes anything, but it didn't.
> "renegotiate-codec-on-hold" and "renegotiate-codec-on-reinvite" are gone
> since FS 1.6.10 so I can't try those. I read something about
> "indicate_hold" which probably means that FS will send a reINVITE on the
> other leg, so I might try that.

I thought about it some more and came to the conclusion that for a B2BUA
it does seem legit to accept the first codec in the reINVTIE's offer and
use transcoding to make the bridge work. It's not what I would like to
happen, but that's a different story :D

I also found a posting from 2011 which mentions this behavior:
http://lists.freeswitch.org/pipermail/freeswitch-users/2011-December/078228.html

Anyway, "case closed".

Regards,
Sebastian

_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@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@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org

_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@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@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org



--
Anthony Minessale II       ♬ @anthmfs  ♬ @FreeSWITCH  ♬

ClueCon Weekly Development Call 
☎ sip:888@conference.freeswitch.org  ☎ +19193869900