[Freeswitch-svn] [commit] r4135 - in freeswitch/trunk/src: . include mod/endpoints/mod_sofia
Freeswitch SVN
mikej at freeswitch.org
Tue Feb 6 13:11:25 EST 2007
Author: mikej
Date: Tue Feb 6 13:11:25 2007
New Revision: 4135
Modified:
freeswitch/trunk/src/include/switch_types.h
freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
freeswitch/trunk/src/switch_core.c
Log:
pass and decrement max_forwards across the bridge for sip
Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h (original)
+++ freeswitch/trunk/src/include/switch_types.h Tue Feb 6 13:11:25 2007
@@ -88,6 +88,7 @@
#define SWITCH_REMOTE_MEDIA_IP_VARIABLE "remote_media_ip"
#define SWITCH_REMOTE_MEDIA_PORT_VARIABLE "remote_media_port"
#define SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE "hangup_after_bridge"
+#define SWITCH_MAX_FORWARDS_VARIABLE "max_forwards"
#define SWITCH_SPEECH_KEY "speech"
#define SWITCH_UUID_BRIDGE "uuid_bridge"
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Tue Feb 6 13:11:25 2007
@@ -952,7 +952,10 @@
{
char rpid[1024] = { 0 };
char alert_info[1024] = { 0 };
+ char max_forwards[8] = { 0 };
char *alertbuf;
+ char *forwardbuf;
+ int forwardval;
private_object_t *tech_pvt;
switch_channel_t *channel = NULL;
switch_caller_profile_t *caller_profile;
@@ -984,6 +987,11 @@
snprintf(alert_info, sizeof(alert_info) - 1, "Alert-Info: %s", alertbuf);
}
+ if ((forwardbuf = switch_channel_get_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE))) {
+ forwardval = atoi(forwardbuf) - 1;
+ snprintf(max_forwards, sizeof(max_forwards) - 1, "%d", forwardval);
+ }
+
if (tech_choose_port(tech_pvt) != SWITCH_STATUS_SUCCESS) {
return;
}
@@ -1046,9 +1054,11 @@
}
holdstr = switch_test_flag(tech_pvt, TFLAG_SIP_HOLD) ? "*" : "";
+
nua_invite(tech_pvt->nh,
TAG_IF(!switch_strlen_zero(rpid), SIPTAG_HEADER_STR(rpid)),
- TAG_IF(alert_info, SIPTAG_HEADER_STR(alert_info)),
+ TAG_IF(!switch_strlen_zero(alert_info), SIPTAG_HEADER_STR(alert_info)),
+ TAG_IF(!switch_strlen_zero(max_forwards),SIPTAG_MAX_FORWARDS_STR(max_forwards)),
//SIPTAG_CONTACT_STR(tech_pvt->profile->url),
SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
SOATAG_RTP_SORT(SOA_RTP_SORT_REMOTE),
@@ -4338,7 +4348,7 @@
if (sip->sip_max_forwards) {
snprintf(uri, sizeof(uri), "%u", sip->sip_max_forwards->mf_count);
- switch_channel_set_variable(channel, "max_forwards", uri);
+ switch_channel_set_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE, uri);
}
if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
Modified: freeswitch/trunk/src/switch_core.c
==============================================================================
--- freeswitch/trunk/src/switch_core.c (original)
+++ freeswitch/trunk/src/switch_core.c Tue Feb 6 13:11:25 2007
@@ -1660,6 +1660,10 @@
if ((val = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE))) {
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);
+ }
if (switch_channel_test_flag(channel, CF_NOMEDIA)) {
switch_channel_set_flag(peer_channel, CF_NOMEDIA);
More information about the Freeswitch-svn
mailing list