<param name="dialplan" value="XML"/>
<param name="context" value="public"/>
<param name="dtmf-duration" value="100"/>
- <param name="codec-prefs" value="$${outbound_codec_prefs}"/>
+ <param name="inbound-codec-prefs" value="$${global_codec_prefs}"/>
+ <param name="outbound-codec-prefs" value="$${outbound_codec_prefs}"/>
<param name="hold-music" value="$${hold_music}"/>
<param name="rtp-timer-name" value="soft"/>
<!--<param name="enable-100rel" value="true"/>-->
<param name="sip-port" value="$${internal_sip_port}"/>
<param name="dialplan" value="XML"/>
<param name="dtmf-duration" value="100"/>
- <param name="codec-prefs" value="$${global_codec_prefs}"/>
+ <param name="inbound-codec-prefs" value="$${global_codec_prefs}"/>
+ <param name="outbound-codec-prefs" value="$${global_codec_prefs}"/>
<param name="use-rtp-timer" value="true"/>
<param name="rtp-timer-name" value="soft"/>
<!-- ip address to use for rtp -->
<param name="sip-port" value="$${internal_sip_port}"/>
<param name="dialplan" value="XML"/>
<param name="dtmf-duration" value="100"/>
- <param name="codec-prefs" value="$${global_codec_prefs}"/>
+ <param name="inbound-codec-prefs" value="$${global_codec_prefs}"/>
+ <param name="outbound-codec-prefs" value="$${global_codec_prefs}"/>
<param name="rtp-timer-name" value="soft"/>
<!-- ip address to use for rtp, DO NOT USE HOSTNAMES ONLY IP ADDRESSES -->
<param name="rtp-ip" value="$${local_ip_v4}"/>
}
stream->write_function(stream, "HOLD-MUSIC \t%s\n", zstr(profile->hold_music) ? "N/A" : profile->hold_music);
stream->write_function(stream, "OUTBOUND-PROXY \t%s\n", zstr(profile->outbound_proxy) ? "N/A" : profile->outbound_proxy);
- stream->write_function(stream, "CODECS \t%s\n", switch_str_nil(profile->codec_string));
+ 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));
+
stream->write_function(stream, "TEL-EVENT \t%d\n", profile->te);
if (profile->dtmf_type == DTMF_2833) {
stream->write_function(stream, "DTMF-MODE \trfc2833\n");
stream->write_function(stream, " <tls-bind-url>%s</tls-bind-url>\n", switch_str_nil(profile->tls_bindurl));
stream->write_function(stream, " <hold-music>%s</hold-music>\n", zstr(profile->hold_music) ? "N/A" : profile->hold_music);
stream->write_function(stream, " <outbound-proxy>%s</outbound-proxy>\n", zstr(profile->outbound_proxy) ? "N/A" : profile->outbound_proxy);
- stream->write_function(stream, " <codecs>%s</codecs>\n", switch_str_nil(profile->codec_string));
+ 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));
+
stream->write_function(stream, " <tel-event>%d</tel-event>\n", profile->te);
stream->write_function(stream, " <dtmf-mode>rfc2833</dtmf-mode>\n");
stream->write_function(stream, " <dtmf-mode>info</dtmf-mode>\n");
switch_port_t sip_port;
switch_port_t tls_sip_port;
int tls_version;
- char *codec_string;
+ char *inbound_codec_string;
+ char *outbound_codec_string;
int running;
int dtmf_duration;
uint8_t flags[TFLAG_MAX];
void sofia_glue_tech_prepare_codecs(private_object_t *tech_pvt);
+const char *sofia_glue_get_codec_string(private_object_t *tech_pvt);
+
void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *profile, private_object_t *tech_pvt, const char *channame);
switch_status_t sofia_glue_tech_choose_port(private_object_t *tech_pvt, int force);
} else if (!strcasecmp(var, "max-calls")) {
profile->max_calls = atoi(val);
} else if (!strcasecmp(var, "codec-prefs")) {
- profile->codec_string = switch_core_strdup(profile->pool, val);
+ 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);
} else if (!strcasecmp(var, "challenge-realm")) {
profile->challenge_realm = switch_core_strdup(profile->pool, val);
} else if (!strcasecmp(var, "dtmf-duration")) {
} else if (!strcasecmp(var, "max-calls")) {
profile->max_calls = atoi(val);
} else if (!strcasecmp(var, "codec-prefs")) {
- profile->codec_string = switch_core_strdup(profile->pool, val);
+ 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);
} else if (!strcasecmp(var, "challenge-realm")) {
profile->challenge_realm = switch_core_strdup(profile->pool, val);
} else if (!strcasecmp(var, "dtmf-duration")) {
if (sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) && (parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0))) {
if ((sdp = sdp_session(parser))) {
- sofia_glue_set_r_sdp_codec_string(session, (tech_pvt->profile?tech_pvt->profile->codec_string:NULL), sdp);
+ sofia_glue_set_r_sdp_codec_string(session, sofia_glue_get_codec_string(tech_pvt), sdp);
}
sdp_parser_free(parser);
}
sofia_glue_tech_set_local_sdp(tech_pvt, buf, SWITCH_TRUE);
}
+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;
+}
+
void sofia_glue_tech_prepare_codecs(private_object_t *tech_pvt)
{
const char *abs, *codec_string = NULL;
if ((abs = switch_channel_get_variable(tech_pvt->channel, "absolute_codec_string"))) {
codec_string = abs;
- } 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;
- }
+ 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;
}
+ }
- 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)) {
+ 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))) {
codec_string = ocodec;
- } else {
- if (!(codec_string = switch_core_session_sprintf(tech_pvt->session, "%s,%s", ocodec, codec_string))) {
- codec_string = ocodec;
- }
}
}
}
-
+
+ ready:
if (codec_string) {
char *tmp_codec_string;