[Freeswitch-svn] [commit] r6974 - in freeswitch/trunk/src: . mod/endpoints/mod_sofia
Freeswitch SVN
mikej at freeswitch.org
Mon Dec 24 13:52:11 EST 2007
Author: mikej
Date: Mon Dec 24 13:52:10 2007
New Revision: 6974
Modified:
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
freeswitch/trunk/src/switch_core_session.c
Log:
fix for MODENDP-60 (handle max-forwards across a bridge). Move logic to core to copy and decrement var.
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Mon Dec 24 13:52:10 2007
@@ -616,10 +616,8 @@
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 @@
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;
Modified: freeswitch/trunk/src/switch_core_session.c
==============================================================================
--- freeswitch/trunk/src/switch_core_session.c (original)
+++ freeswitch/trunk/src/switch_core_session.c Mon Dec 24 13:52:10 2007
@@ -288,8 +288,14 @@
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)) {
More information about the Freeswitch-svn
mailing list