pass and decrement max_forwards across the bridge for sip

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4135 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2007-02-06 18:11:25 +00:00
parent 1b4e65d4a5
commit 608fac923a
3 changed files with 17 additions and 2 deletions

View File

@ -88,6 +88,7 @@ SWITCH_BEGIN_EXTERN_C
#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"

View File

@ -952,7 +952,10 @@ static void do_invite(switch_core_session_t *session)
{
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 @@ static void do_invite(switch_core_session_t *session)
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 @@ static void do_invite(switch_core_session_t *session)
}
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 @@ static void sip_i_invite(nua_t *nua,
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),

View File

@ -1660,6 +1660,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_outgoing_channel(switch_core
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);