From: Michael Jerris Date: Sun, 24 Jun 2007 03:17:21 +0000 (+0000) Subject: fix hold on ua's that send sendonly in the m instead of the a line and unhold without... X-Git-Tag: v1.0-beta1~114 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33ec66f396d9e92480b237a51b5c181d113f00a0;p=thirdparty%2Ffreeswitch.git fix hold on ua's that send sendonly in the m instead of the a line and unhold without a sendrecv. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5449 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index a70287b47e..8e292acaf4 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1055,6 +1055,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t * sdp_attribute_t *a; int first = 0, last = 0; int ptime = 0, dptime = 0; + int sendonly = 0; int greedy = 0, x = 0, skip = 0, mine = 0; switch_channel_t *channel = NULL; char *val; @@ -1080,33 +1081,44 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t * } } + if (((m = sdp->sdp_media)) && m->m_mode == sdp_sendonly) { + sendonly = 1; + } + for (a = sdp->sdp_attributes; a; a = a->a_next) { if (switch_strlen_zero(a->a_name)) { continue; } if (!strcasecmp(a->a_name, "sendonly")) { - if (!switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) { - char *stream; - switch_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD); - if (!(stream = switch_channel_get_variable(tech_pvt->channel, SWITCH_HOLD_MUSIC_VARIABLE))) { - stream = tech_pvt->profile->hold_music; - } - if (stream) { - switch_ivr_broadcast(switch_core_session_get_uuid(tech_pvt->session), stream, SMF_ECHO_BLEG | SMF_LOOP); - } - } - } else if (!strcasecmp(a->a_name, "sendrecv")) { - if (switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) { - switch_channel_clear_flag_partner(tech_pvt->channel, CF_BROADCAST); - switch_channel_set_flag_partner(tech_pvt->channel, CF_BREAK); - switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD); - } + sendonly = 1; + } else if (!strcasecmp(a->a_name, "sendrecv")) { + sendonly = 0; } else if (!strcasecmp(a->a_name, "ptime")) { dptime = atoi(a->a_value); } } + if (sendonly) { + if (!switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) { + char *stream; + switch_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD); + if (!(stream = switch_channel_get_variable(tech_pvt->channel, SWITCH_HOLD_MUSIC_VARIABLE))) { + stream = tech_pvt->profile->hold_music; + } + if (stream) { + switch_ivr_broadcast(switch_core_session_get_uuid(tech_pvt->session), stream, SMF_ECHO_BLEG | SMF_LOOP); + } + } + } else { + if (switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) { + switch_channel_clear_flag_partner(tech_pvt->channel, CF_BROADCAST); + switch_channel_set_flag_partner(tech_pvt->channel, CF_BREAK); + switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD); + } + } + + for (m = sdp->sdp_media; m; m = m->m_next) { sdp_connection_t *connection;