Talk:Proxy Media
From FreeSWITCH Wiki
T.38
From a thread on freeswitch-users (12/22/09 7:45 PM): Proxy media is really a special hack that should only be used for T.38 passthrough. If you are using it for other purposes, think about it some more...
Why to use it
"less CPU usage."
I keep seeing people choosing this because of this, and then getting confused why they can't use feature X. Is anyone able to do some benchmarking to see whether this is actually true, and if so by how much?
Obviously pretty much anything with media that needs significant CPU won't work in proxy mode (transcoding, recording, conference etc). So it seems it's only for the RTP stack handling, and should be a pretty small difference.
How to detect when it should be used
I have moved this here - firstly some of it's out of date, secondly it implies you should always use either proxy_media or bypass_media
This example shows how to use bypass_media, unless clients are behind NAT (where bypass will not work) in which case to use proxy_media.
[18:07] bkw_: late-neg [18:07] bkw_: regexp on the sdp [18:08] bkw_: then decide
Please document!
You can enable detection of NAT on the Sofia Profile, see NAT_Traversal#apply-nat-acl, and use the ${sip_nat_detected} variable to routing logic, e.g.:
<extension name="setup_media" continue="true">
<condition field="${sip_nat_detected}" expression="true">
<action application="set" data="proxy_media=true"/>
<action application="set" data="bypass_media=false"/>
<anti-action application="set" data="proxy_media=false"/>
<anti-action application="set" data="bypass_media=true"/>
</condition>
</extension>
The section below is no longer needed it seems. Not sure when this was added.
This will detect if they have a rfc1918 ip address in either the sip_contact_host or the remote_media_ip and proxy the media if detected:
<action application="set" data="proxy_media=${cond( ${acl(${remote_media_ip} rfc1918)} == ${acl(${sip_contact_host} rfc1918)} ? ${$acl(${sip_contact_host} rfc1918)} : true) : false}"/>
Or you could do the same thing like this:
<extension name="detect_nat" continue="true">
<condition>
<action application="set" data="sip_nat_detected=${cond( ${acl(${remote_media_ip} rfc1918)} == ${acl(${sip_contact_host} rfc1918)} ? ${$acl(${sip_contact_host} rfc1918)} : true) : false}"/>
<action application="set" data="proxy_media=${cond(${sip_nat_detected} == true ? true : false)}"/>
<action application="set" data="bypass_media=${cond(${sip_nat_detected} == true ? false : true)}"/>
</condition>
</extension>
Enable late codec negotiation in the SIP profile:
<param name="inbound-late-negotiation" value="true"/>

