<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[Freeswitch-trunk][15658] </title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<div id="header">FreeSWITCH Subversion</div>
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://fisheye.freeswitch.org/changelog/FreeSWITCH?cs=15658">15658</a></dd>
<dt>Author</dt> <dd>anthm</dd>
<dt>Date</dt> <dd>2009-11-24 12:52:57 -0600 (Tue, 24 Nov 2009)</dd>
</dl>
<h3>Log Message</h3>
<pre>add separate inbound/outound codec prefs params to sofia profile original codec-prefs sets both to the same value for back-compat</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunkconfsip_profilesexternalxml">freeswitch/trunk/conf/sip_profiles/external.xml</a></li>
<li><a href="#freeswitchtrunkconfsip_profilesinternalipv6xml">freeswitch/trunk/conf/sip_profiles/internal-ipv6.xml</a></li>
<li><a href="#freeswitchtrunkconfsip_profilesinternalxml">freeswitch/trunk/conf/sip_profiles/internal.xml</a></li>
<li><a href="#freeswitchtrunksrcmodendpointsmod_sofiamod_sofiac">freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c</a></li>
<li><a href="#freeswitchtrunksrcmodendpointsmod_sofiamod_sofiah">freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h</a></li>
<li><a href="#freeswitchtrunksrcmodendpointsmod_sofiasofiac">freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c</a></li>
<li><a href="#freeswitchtrunksrcmodendpointsmod_sofiasofia_gluec">freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunkconfsip_profilesexternalxml"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/conf/sip_profiles/external.xml (15657 => 15658)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/conf/sip_profiles/external.xml        2009-11-24 18:18:09 UTC (rev 15657)
+++ freeswitch/trunk/conf/sip_profiles/external.xml        2009-11-24 18:52:57 UTC (rev 15658)
</span><span class="lines">@@ -24,7 +24,8 @@
</span><span class="cx"> <param name="dialplan" value="XML"/>
</span><span class="cx"> <param name="context" value="public"/>
</span><span class="cx"> <param name="dtmf-duration" value="100"/>
</span><del>- <param name="codec-prefs" value="$${outbound_codec_prefs}"/>
</del><ins>+ <param name="inbound-codec-prefs" value="$${global_codec_prefs}"/>
+ <param name="outbound-codec-prefs" value="$${outbound_codec_prefs}"/>
</ins><span class="cx"> <param name="hold-music" value="$${hold_music}"/>
</span><span class="cx"> <param name="rtp-timer-name" value="soft"/>
</span><span class="cx"> <!--<param name="enable-100rel" value="true"/>-->
</span></span></pre></div>
<a id="freeswitchtrunkconfsip_profilesinternalipv6xml"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/conf/sip_profiles/internal-ipv6.xml (15657 => 15658)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/conf/sip_profiles/internal-ipv6.xml        2009-11-24 18:18:09 UTC (rev 15657)
+++ freeswitch/trunk/conf/sip_profiles/internal-ipv6.xml        2009-11-24 18:52:57 UTC (rev 15658)
</span><span class="lines">@@ -14,7 +14,8 @@
</span><span class="cx"> <param name="sip-port" value="$${internal_sip_port}"/>
</span><span class="cx"> <param name="dialplan" value="XML"/>
</span><span class="cx"> <param name="dtmf-duration" value="100"/>
</span><del>- <param name="codec-prefs" value="$${global_codec_prefs}"/>
</del><ins>+ <param name="inbound-codec-prefs" value="$${global_codec_prefs}"/>
+ <param name="outbound-codec-prefs" value="$${global_codec_prefs}"/>
</ins><span class="cx"> <param name="use-rtp-timer" value="true"/>
</span><span class="cx"> <param name="rtp-timer-name" value="soft"/>
</span><span class="cx"> <!-- ip address to use for rtp -->
</span></span></pre></div>
<a id="freeswitchtrunkconfsip_profilesinternalxml"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/conf/sip_profiles/internal.xml (15657 => 15658)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/conf/sip_profiles/internal.xml        2009-11-24 18:18:09 UTC (rev 15657)
+++ freeswitch/trunk/conf/sip_profiles/internal.xml        2009-11-24 18:52:57 UTC (rev 15658)
</span><span class="lines">@@ -47,7 +47,8 @@
</span><span class="cx"> <param name="sip-port" value="$${internal_sip_port}"/>
</span><span class="cx"> <param name="dialplan" value="XML"/>
</span><span class="cx"> <param name="dtmf-duration" value="100"/>
</span><del>- <param name="codec-prefs" value="$${global_codec_prefs}"/>
</del><ins>+ <param name="inbound-codec-prefs" value="$${global_codec_prefs}"/>
+ <param name="outbound-codec-prefs" value="$${global_codec_prefs}"/>
</ins><span class="cx"> <param name="rtp-timer-name" value="soft"/>
</span><span class="cx"> <!-- ip address to use for rtp, DO NOT USE HOSTNAMES ONLY IP ADDRESSES -->
</span><span class="cx"> <param name="rtp-ip" value="$${local_ip_v4}"/>
</span></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_sofiamod_sofiac"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (15657 => 15658)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c        2009-11-24 18:18:09 UTC (rev 15657)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c        2009-11-24 18:52:57 UTC (rev 15658)
</span><span class="lines">@@ -1966,7 +1966,9 @@
</span><span class="cx">                                         }
</span><span class="cx">                                         stream->write_function(stream, "HOLD-MUSIC \t%s\n", zstr(profile->hold_music) ? "N/A" : profile->hold_music);
</span><span class="cx">                                         stream->write_function(stream, "OUTBOUND-PROXY \t%s\n", zstr(profile->outbound_proxy) ? "N/A" : profile->outbound_proxy);
</span><del>-                                        stream->write_function(stream, "CODECS \t%s\n", switch_str_nil(profile->codec_string));
</del><ins>+                                        stream->write_function(stream, "CODECS IN \t%s\n", switch_str_nil(profile->inbound_codec_string));
+                                        stream->write_function(stream, "CODECS OUT \t%s\n", switch_str_nil(profile->outbound_codec_string));
+
</ins><span class="cx">                                         stream->write_function(stream, "TEL-EVENT \t%d\n", profile->te);
</span><span class="cx">                                         if (profile->dtmf_type == DTMF_2833) {
</span><span class="cx">                                         stream->write_function(stream, "DTMF-MODE \trfc2833\n");
</span><span class="lines">@@ -2186,7 +2188,9 @@
</span><span class="cx">                                         stream->write_function(stream, " <tls-bind-url>%s</tls-bind-url>\n", switch_str_nil(profile->tls_bindurl));
</span><span class="cx">                                         stream->write_function(stream, " <hold-music>%s</hold-music>\n", zstr(profile->hold_music) ? "N/A" : profile->hold_music);
</span><span class="cx">                                         stream->write_function(stream, " <outbound-proxy>%s</outbound-proxy>\n", zstr(profile->outbound_proxy) ? "N/A" : profile->outbound_proxy);
</span><del>-                                        stream->write_function(stream, " <codecs>%s</codecs>\n", switch_str_nil(profile->codec_string));
</del><ins>+                                        stream->write_function(stream, " <inbound-codecs>%s</inbound-codecs>\n", switch_str_nil(profile->inbound_codec_string));
+                                        stream->write_function(stream, " <outbound-codecs>%s</outbound-codecs>\n", switch_str_nil(profile->outbound_codec_string));
+
</ins><span class="cx">                                         stream->write_function(stream, " <tel-event>%d</tel-event>\n", profile->te);
</span><span class="cx">                                         stream->write_function(stream, " <dtmf-mode>rfc2833</dtmf-mode>\n");
</span><span class="cx">                                         stream->write_function(stream, " <dtmf-mode>info</dtmf-mode>\n");
</span></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_sofiamod_sofiah"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h (15657 => 15658)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h        2009-11-24 18:18:09 UTC (rev 15657)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h        2009-11-24 18:52:57 UTC (rev 15658)
</span><span class="lines">@@ -459,7 +459,8 @@
</span><span class="cx">         switch_port_t sip_port;
</span><span class="cx">         switch_port_t tls_sip_port;
</span><span class="cx">         int tls_version;
</span><del>-        char *codec_string;
</del><ins>+        char *inbound_codec_string;
+        char *outbound_codec_string;
</ins><span class="cx">         int running;
</span><span class="cx">         int dtmf_duration;
</span><span class="cx">         uint8_t flags[TFLAG_MAX];
</span><span class="lines">@@ -705,6 +706,8 @@
</span><span class="cx">
</span><span class="cx"> void sofia_glue_tech_prepare_codecs(private_object_t *tech_pvt);
</span><span class="cx">
</span><ins>+const char *sofia_glue_get_codec_string(private_object_t *tech_pvt);
+
</ins><span class="cx"> void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *profile, private_object_t *tech_pvt, const char *channame);
</span><span class="cx">
</span><span class="cx"> switch_status_t sofia_glue_tech_choose_port(private_object_t *tech_pvt, int force);
</span></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_sofiasofiac"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (15657 => 15658)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c        2009-11-24 18:18:09 UTC (rev 15657)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c        2009-11-24 18:52:57 UTC (rev 15658)
</span><span class="lines">@@ -2179,7 +2179,12 @@
</span><span class="cx">                                         } else if (!strcasecmp(var, "max-calls")) {
</span><span class="cx">                                                 profile->max_calls = atoi(val);
</span><span class="cx">                                         } else if (!strcasecmp(var, "codec-prefs")) {
</span><del>-                                                profile->codec_string = switch_core_strdup(profile->pool, val);
</del><ins>+                                                profile->inbound_codec_string = switch_core_strdup(profile->pool, val);
+                                                profile->outbound_codec_string = switch_core_strdup(profile->pool, val);
+                                        } else if (!strcasecmp(var, "inbound-codec-prefs")) {
+                                                profile->inbound_codec_string = switch_core_strdup(profile->pool, val);
+                                        } else if (!strcasecmp(var, "outbound-codec-prefs")) {
+                                                profile->outbound_codec_string = switch_core_strdup(profile->pool, val);
</ins><span class="cx">                                         } else if (!strcasecmp(var, "challenge-realm")) {
</span><span class="cx">                                                 profile->challenge_realm = switch_core_strdup(profile->pool, val);
</span><span class="cx">                                         } else if (!strcasecmp(var, "dtmf-duration")) {
</span><span class="lines">@@ -2883,7 +2888,12 @@
</span><span class="cx">                                         } else if (!strcasecmp(var, "max-calls")) {
</span><span class="cx">                                                 profile->max_calls = atoi(val);
</span><span class="cx">                                         } else if (!strcasecmp(var, "codec-prefs")) {
</span><del>-                                                profile->codec_string = switch_core_strdup(profile->pool, val);
</del><ins>+                                                profile->inbound_codec_string = switch_core_strdup(profile->pool, val);
+                                                profile->outbound_codec_string = switch_core_strdup(profile->pool, val);
+                                        } else if (!strcasecmp(var, "inbound-codec-prefs")) {
+                                                profile->inbound_codec_string = switch_core_strdup(profile->pool, val);
+                                        } else if (!strcasecmp(var, "outbound-codec-prefs")) {
+                                                profile->outbound_codec_string = switch_core_strdup(profile->pool, val);
</ins><span class="cx">                                         } else if (!strcasecmp(var, "challenge-realm")) {
</span><span class="cx">                                                 profile->challenge_realm = switch_core_strdup(profile->pool, val);
</span><span class="cx">                                         } else if (!strcasecmp(var, "dtmf-duration")) {
</span><span class="lines">@@ -3700,7 +3710,7 @@
</span><span class="cx">
</span><span class="cx">                                 if (sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) && (parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0))) {
</span><span class="cx">                                         if ((sdp = sdp_session(parser))) {
</span><del>-                                                sofia_glue_set_r_sdp_codec_string(session, (tech_pvt->profile?tech_pvt->profile->codec_string:NULL), sdp);
</del><ins>+                                                sofia_glue_set_r_sdp_codec_string(session, sofia_glue_get_codec_string(tech_pvt), sdp);
</ins><span class="cx">                                         }
</span><span class="cx">                                         sdp_parser_free(parser);
</span><span class="cx">                                 }
</span></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_sofiasofia_gluec"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (15657 => 15658)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c        2009-11-24 18:18:09 UTC (rev 15657)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c        2009-11-24 18:52:57 UTC (rev 15658)
</span><span class="lines">@@ -409,6 +409,19 @@
</span><span class="cx">         sofia_glue_tech_set_local_sdp(tech_pvt, buf, SWITCH_TRUE);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+const char *sofia_glue_get_codec_string(private_object_t *tech_pvt)
+{
+        const char *codec_string = NULL;
+        
+        if (switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_OUTBOUND && !zstr(tech_pvt->profile->outbound_codec_string)) {
+                codec_string = tech_pvt->profile->outbound_codec_string ? tech_pvt->profile->outbound_codec_string : tech_pvt->profile->inbound_codec_string;
+        } else if (!zstr(tech_pvt->profile->inbound_codec_string)) {
+                codec_string = tech_pvt->profile->inbound_codec_string ? tech_pvt->profile->inbound_codec_string : tech_pvt->profile->outbound_codec_string;
+        }
+        
+        return codec_string;
+}
+
</ins><span class="cx"> void sofia_glue_tech_prepare_codecs(private_object_t *tech_pvt)
</span><span class="cx"> {
</span><span class="cx">         const char *abs, *codec_string = NULL;
</span><span class="lines">@@ -426,25 +439,29 @@
</span><span class="cx">
</span><span class="cx">         if ((abs = switch_channel_get_variable(tech_pvt->channel, "absolute_codec_string"))) {
</span><span class="cx">                 codec_string = abs;
</span><del>-        } else {
-                if (!(codec_string = switch_channel_get_variable(tech_pvt->channel, "codec_string"))) {
-                        if (tech_pvt->profile->codec_string) {
-                                codec_string = tech_pvt->profile->codec_string;
-                        }
</del><ins>+                goto ready;
+        }
+
+        if (!(codec_string = switch_channel_get_variable(tech_pvt->channel, "codec_string"))) {
+                codec_string = sofia_glue_get_codec_string(tech_pvt);
+                if (codec_string && *codec_string == '=') {
+                        codec_string++;
+                        goto ready;
</ins><span class="cx">                 }
</span><ins>+        }
</ins><span class="cx">
</span><del>-                if ((ocodec = switch_channel_get_variable(tech_pvt->channel, SWITCH_ORIGINATOR_CODEC_VARIABLE))) {
-                        if (!codec_string || sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_TRANSCODING)) {
</del><ins>+        if ((ocodec = switch_channel_get_variable(tech_pvt->channel, SWITCH_ORIGINATOR_CODEC_VARIABLE))) {
+                if (!codec_string || sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_TRANSCODING)) {
+                        codec_string = ocodec;
+                } else {
+                        if (!(codec_string = switch_core_session_sprintf(tech_pvt->session, "%s,%s", ocodec, codec_string))) {
</ins><span class="cx">                                 codec_string = ocodec;
</span><del>-                        } else {
-                                if (!(codec_string = switch_core_session_sprintf(tech_pvt->session, "%s,%s", ocodec, codec_string))) {
-                                        codec_string = ocodec;
-                                }
</del><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">         }
</span><ins>+        
+ ready:
</ins><span class="cx">
</span><del>-
</del><span class="cx">         if (codec_string) {
</span><span class="cx">                 char *tmp_codec_string;
</span><span class="cx">                 if ((tmp_codec_string = switch_core_session_strdup(tech_pvt->session, codec_string))) {
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>
</body>
</html>