fix for MODENDP-60 (handle max-forwards across a bridge). Move logic to core to copy and decrement var.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6974 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2007-12-24 18:52:10 +00:00
parent 9857d6ddc6
commit 0e7a329069
2 changed files with 10 additions and 9 deletions

View File

@ -616,10 +616,8 @@ char *sofia_overcome_sip_uri_weakness(switch_core_session_t *session, const char
switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
{
char *alert_info = NULL;
char *max_forwards = NULL;
const char *max_forwards = NULL;
const char *alertbuf;
const char *forwardbuf;
int forwardval;
private_object_t *tech_pvt;
switch_channel_t *channel = NULL;
switch_caller_profile_t *caller_profile;
@ -664,10 +662,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
alert_info = switch_core_session_sprintf(tech_pvt->session, "Alert-Info: %s", alertbuf);
}
if ((forwardbuf = switch_channel_get_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE))) {
forwardval = atoi(forwardbuf) - 1;
max_forwards = switch_core_session_sprintf(tech_pvt->session, "%d", forwardval);
}
max_forwards = switch_channel_get_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE);
if ((status = sofia_glue_tech_choose_port(tech_pvt)) != SWITCH_STATUS_SUCCESS) {
return status;

View File

@ -288,8 +288,14 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_
switch_channel_set_variable(peer_channel, SWITCH_B_SDP_VARIABLE, val);
}
if ((val = switch_channel_get_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE))) {
switch_channel_set_variable(peer_channel, SWITCH_MAX_FORWARDS_VARIABLE, val);
val = switch_channel_get_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE);
if (!switch_strlen_zero(val)) {
int forwardval = atoi(val) - 1;
const char *max_forwards = switch_core_session_sprintf(session, "%d", forwardval);
switch_channel_set_variable(peer_channel, SWITCH_MAX_FORWARDS_VARIABLE, max_forwards);
} else {
switch_channel_set_variable(peer_channel, SWITCH_MAX_FORWARDS_VARIABLE, "70");
}
if (switch_channel_test_flag(channel, CF_BYPASS_MEDIA)) {