From 21234215f0bbde0e8f21bc11446b469eec866a91 Mon Sep 17 00:00:00 2001 From: Brian West Date: Fri, 15 Jan 2010 00:31:43 +0000 Subject: [PATCH] finally fix private hold git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16315 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/sofia.c | 29 ++++++++++++++++++++++++++++- src/switch_channel.c | 4 ++-- src/switch_time.c | 4 ++-- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 10f4ccd308..63aaea2730 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -51,6 +51,10 @@ extern su_log_t sresolv_log[]; extern su_log_t stun_log[]; 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); @@ -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); break; 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; case nua_i_publish: 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; } +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[]) { switch_core_session_t *session = NULL; diff --git a/src/switch_channel.c b/src/switch_channel.c index 123430a1cb..1e9c27dc13 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -503,10 +503,10 @@ SWITCH_DECLARE(void) switch_channel_presence(switch_channel_t *channel, const ch if (!switch_channel_up(channel)) { call_info_state = "idle"; - } else if (!strcasecmp(status, "hold")) { - call_info_state = "held"; } else if (!strcasecmp(status, "hold-private")) { call_info_state = "held-private"; + } else if (!strcasecmp(status, "hold")) { + call_info_state = "held"; } else if (!switch_channel_test_flag(channel, CF_ANSWERED)) { if (channel->direction == SWITCH_CALL_DIRECTION_OUTBOUND) { call_info_state = "progressing"; diff --git a/src/switch_time.c b/src/switch_time.c index a50a1d51b6..cfc052e1ae 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -189,7 +189,7 @@ SWITCH_DECLARE(void) switch_time_calibrate_clock(void) if (ts.tv_nsec / 1000 > 1500) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "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); switch_time_set_cond_yield(SWITCH_TRUE); return; @@ -206,7 +206,7 @@ SWITCH_DECLARE(void) switch_time_calibrate_clock(void) if (diff > 1500) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "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); switch_time_set_cond_yield(SWITCH_TRUE); return;