finally fix private hold

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16315 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Brian West 2010-01-15 00:31:43 +00:00
parent 25aff5bc81
commit 21234215f0
3 changed files with 32 additions and 5 deletions

View File

@ -51,6 +51,10 @@ extern su_log_t sresolv_log[];
extern su_log_t stun_log[]; extern su_log_t stun_log[];
extern su_log_t su_log_default[]; extern su_log_t su_log_default[];
void sofia_handle_sip_i_reinvite(switch_core_session_t *session,
nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
static void set_variable_sip_param(switch_channel_t *channel, char *header_type, sip_param_t const *params); static void set_variable_sip_param(switch_channel_t *channel, char *header_type, sip_param_t const *params);
@ -671,7 +675,11 @@ void sofia_event_callback(nua_event_t event,
sofia_handle_sip_i_options(status, phrase, nua, profile, nh, sofia_private, sip, tags); sofia_handle_sip_i_options(status, phrase, nua, profile, nh, sofia_private, sip, tags);
break; break;
case nua_i_invite: case nua_i_invite:
if (!session) sofia_handle_sip_i_invite(nua, profile, nh, sofia_private, sip, tags); if (session) {
sofia_handle_sip_i_reinvite(session, nua, profile, nh, sofia_private, sip, tags);
} else {
sofia_handle_sip_i_invite(nua, profile, nh, sofia_private, sip, tags);
}
break; break;
case nua_i_publish: case nua_i_publish:
sofia_presence_handle_sip_i_publish(nua, profile, nh, sofia_private, sip, tags); sofia_presence_handle_sip_i_publish(nua, profile, nh, sofia_private, sip, tags);
@ -5311,6 +5319,25 @@ const char *_url_set_chanvars(switch_core_session_t *session, url_t *url, const
return uri; return uri;
} }
void sofia_handle_sip_i_reinvite(switch_core_session_t *session,
nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
{
char *call_info = NULL;
if (sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)) {
switch_channel_t *channel = switch_core_session_get_channel(session);
if (channel && sip->sip_call_info) {
char *p;
if ((call_info = sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_call_info))) {
if ((p = strchr(call_info, ';'))) {
switch_channel_set_variable(channel, "presence_call_info", p+1);
}
su_free(nua_handle_home(nh), call_info);
}
}
}
}
void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]) void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
{ {
switch_core_session_t *session = NULL; switch_core_session_t *session = NULL;

View File

@ -503,10 +503,10 @@ SWITCH_DECLARE(void) switch_channel_presence(switch_channel_t *channel, const ch
if (!switch_channel_up(channel)) { if (!switch_channel_up(channel)) {
call_info_state = "idle"; call_info_state = "idle";
} else if (!strcasecmp(status, "hold")) {
call_info_state = "held";
} else if (!strcasecmp(status, "hold-private")) { } else if (!strcasecmp(status, "hold-private")) {
call_info_state = "held-private"; call_info_state = "held-private";
} else if (!strcasecmp(status, "hold")) {
call_info_state = "held";
} else if (!switch_channel_test_flag(channel, CF_ANSWERED)) { } else if (!switch_channel_test_flag(channel, CF_ANSWERED)) {
if (channel->direction == SWITCH_CALL_DIRECTION_OUTBOUND) { if (channel->direction == SWITCH_CALL_DIRECTION_OUTBOUND) {
call_info_state = "progressing"; call_info_state = "progressing";

View File

@ -189,7 +189,7 @@ SWITCH_DECLARE(void) switch_time_calibrate_clock(void)
if (ts.tv_nsec / 1000 > 1500) { if (ts.tv_nsec / 1000 > 1500) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
"Timer resolution of %ld microseconds detected!\n" "Timer resolution of %ld microseconds detected!\n"
"Do you have your kernel timer set to higher than 1khz? You may experience audio problems.\n", ts.tv_nsec / 1000); "Do you have your kernel timer set to higher than 1 kHz? You may experience audio problems.\n", ts.tv_nsec / 1000);
do_sleep(5000000); do_sleep(5000000);
switch_time_set_cond_yield(SWITCH_TRUE); switch_time_set_cond_yield(SWITCH_TRUE);
return; return;
@ -206,7 +206,7 @@ SWITCH_DECLARE(void) switch_time_calibrate_clock(void)
if (diff > 1500) { if (diff > 1500) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
"Abnormally large timer gap %d detected!\n" "Abnormally large timer gap %d detected!\n"
"Do you have your kernel timer set to higher than 1khz? You may experience audio problems.\n", diff); "Do you have your kernel timer set to higher than 1 kHz? You may experience audio problems.\n", diff);
do_sleep(5000000); do_sleep(5000000);
switch_time_set_cond_yield(SWITCH_TRUE); switch_time_set_cond_yield(SWITCH_TRUE);
return; return;