]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix hold on ua's that send sendonly in the m instead of the a line and unhold without...
authorMichael Jerris <mike@jerris.com>
Sun, 24 Jun 2007 03:17:21 +0000 (03:17 +0000)
committerMichael Jerris <mike@jerris.com>
Sun, 24 Jun 2007 03:17:21 +0000 (03:17 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5449 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/sofia_glue.c

index a70287b47ef0b694ee2d8ea221955680c58703d7..8e292acaf44f260ca6cc1d40a928b44fa35f1f96 100644 (file)
@@ -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")) {\r
+                       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;