From aaa822ba79612ce592ee541b23a77771a295ec8b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 28 Jan 2010 20:35:17 +0000 Subject: [PATCH] SFSIP-197 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16534 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- .../libsofia-sip-ua/nua/nua_session.c | 2 +- src/mod/endpoints/mod_sofia/mod_sofia.c | 12 ++++++----- src/mod/endpoints/mod_sofia/sofia.c | 20 +++++++++++++------ 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c index 2630dc2913..bbbc534a81 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c @@ -3935,7 +3935,7 @@ int nua_bye_server_report(nua_server_request_t *sr, tagi_t const *tags) retval = nua_base_server_report(sr, tags); - assert(2 <= retval && retval < 4); + //assert(2 <= retval && retval < 4); #if 0 if (ss) { diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index d32799f727..d9730a723c 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -394,7 +394,8 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session) } if (switch_channel_test_flag(channel, CF_ANSWERED) || sofia_test_flag(tech_pvt, TFLAG_ANS)) { - const char *call_info = switch_channel_get_variable(channel, "presence_call_info"); + const char *call_info = switch_channel_get_variable(channel, "presence_call_info_full"); + if (!tech_pvt->got_bye) { switch_channel_set_variable(channel, "sip_hangup_disposition", "send_bye"); } @@ -474,7 +475,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session) const char *b_sdp = NULL; int is_proxy = 0; char *sticky = NULL; - const char *call_info = switch_channel_get_variable(channel, "presence_call_info"); + const char *call_info = switch_channel_get_variable(channel, "presence_call_info_full"); if (sofia_test_flag(tech_pvt, TFLAG_ANS) || switch_channel_test_flag(channel, CF_OUTBOUND)) { return SWITCH_STATUS_SUCCESS; @@ -506,7 +507,6 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session) /* Send the 200 OK */ if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) { char *extra_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_RESPONSE_HEADER_PREFIX); - if (sofia_use_soa(tech_pvt)) { nua_respond(tech_pvt->nh, SIP_200_OK, SIPTAG_CONTACT_STR(tech_pvt->profile->url), @@ -611,6 +611,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session) if (sofia_use_soa(tech_pvt)) { nua_respond(tech_pvt->nh, SIP_200_OK, NUTAG_AUTOANSWER(0), + TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)), TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)), SIPTAG_HEADER_STR(generate_pai_str(session)), NUTAG_SESSION_TIMER(session_timeout), @@ -626,6 +627,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session) nua_respond(tech_pvt->nh, SIP_200_OK, NUTAG_AUTOANSWER(0), NUTAG_MEDIA_ENABLE(0), + TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)), TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)), SIPTAG_HEADER_STR(generate_pai_str(session)), NUTAG_SESSION_TIMER(session_timeout), @@ -1776,7 +1778,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi if (!switch_channel_test_flag(channel, CF_RING_READY) && !sofia_test_flag(tech_pvt, TFLAG_BYE) && !switch_channel_test_flag(channel, CF_EARLY_MEDIA) && !switch_channel_test_flag(channel, CF_ANSWERED)) { char *extra_header = sofia_glue_get_extra_headers(channel, SOFIA_SIP_PROGRESS_HEADER_PREFIX); - const char *call_info = switch_channel_get_variable(channel, "presence_call_info"); + const char *call_info = switch_channel_get_variable(channel, "presence_call_info_full"); nua_respond(tech_pvt->nh, SIP_180_RINGING, SIPTAG_CONTACT_STR(tech_pvt->reply_contact), @@ -1797,7 +1799,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi { char *sticky = NULL; const char *val = NULL; - const char *call_info = switch_channel_get_variable(channel, "presence_call_info"); + const char *call_info = switch_channel_get_variable(channel, "presence_call_info_full"); if (sofia_test_pflag(tech_pvt->profile, PFLAG_3PCC_PROXY) && sofia_test_flag(tech_pvt, TFLAG_3PCC)) { sofia_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 8a4ab4d296..a17ea0ecb1 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -387,7 +387,7 @@ void sofia_handle_sip_i_bye(switch_core_session_t *session, int status, phrase = "OK"; sofia_set_flag_locked(tech_pvt, TFLAG_BYE); - call_info = switch_channel_get_variable(channel, "presence_call_info"); + call_info = switch_channel_get_variable(channel, "presence_call_info_full"); if (sip->sip_reason && sip->sip_reason->re_protocol && (!strcasecmp(sip->sip_reason->re_protocol, "Q.850") @@ -3525,8 +3525,11 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status if (channel && sip->sip_call_info) { char *p; 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); + if (!switch_stristr("appearance", call_info)) { + switch_channel_set_variable(channel, "presence_call_info_full", call_info); + if ((p = strchr(call_info, ';'))) { + switch_channel_set_variable(channel, "presence_call_info", p+1); + } } } else if ((status == 180 || status == 183 || status == 200)) { char buf[128] = ""; @@ -5422,8 +5425,11 @@ void sofia_handle_sip_i_reinvite(switch_core_session_t *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); + if (!switch_stristr("appearance", call_info)) { + switch_channel_set_variable(channel, "presence_call_info_full", 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); } @@ -6159,6 +6165,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ if ((uuid = switch_channel_get_variable(b_channel, SWITCH_SIGNAL_BOND_VARIABLE))) { switch_channel_set_variable(b_channel, "presence_call_info", NULL); + switch_channel_set_variable(b_channel, "presence_call_info_full", NULL); one_leg = 0; } else { uuid = switch_core_session_get_uuid(b_session); @@ -6353,7 +6360,8 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ full_contact = sip_header_as_string(nua_handle_home(tech_pvt->nh), (void *) sip->sip_contact); } - if (call_info_str) { + if (call_info_str && !switch_stristr("appearance", call_info_str)) { + switch_channel_set_variable(channel, "presence_call_info_full", call_info_str); if ((p = strchr(call_info_str, ';'))) { p++; switch_channel_set_variable(channel, "presence_call_info", p);