]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
make conference_local_play_file honor the sound-prefix param
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 25 Jan 2007 17:26:23 +0000 (17:26 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 25 Jan 2007 17:26:23 +0000 (17:26 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4056 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_conference/mod_conference.c
src/mod/endpoints/mod_sofia/mod_sofia.c

index 20d853f5b9c03f162ec368fde53f9f080b691d9a..ea5ec19c83ff55c18f21825f7b00df994ee9ae69 100644 (file)
@@ -287,7 +287,8 @@ static switch_status_t conference_outcall(conference_obj_t *conference,
 static void conference_function(switch_core_session_t *session, char *data);
 static void launch_conference_thread(conference_obj_t *conference);
 static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *obj);
-static switch_status_t conference_local_play_file(switch_core_session_t *session, char *path, uint32_t leadin, char *buf, switch_size_t len);
+static switch_status_t conference_local_play_file(conference_obj_t *conference,
+                                                  switch_core_session_t *session, char *path, uint32_t leadin, char *buf, switch_size_t len);
 static switch_status_t conference_member_play_file(conference_member_t *member, char *file, uint32_t leadin);
 static switch_status_t conference_member_say(conference_member_t *member, char *text, uint32_t leadin);
 static uint32_t conference_member_stop_file(conference_member_t *member, file_stop_t stop);
@@ -3415,7 +3416,8 @@ static switch_status_t conference_outcall(conference_obj_t *conference,
 }
 
 /* Play a file */
-static switch_status_t conference_local_play_file(switch_core_session_t *session, char *path, uint32_t leadin, char *buf, switch_size_t len)
+static switch_status_t conference_local_play_file(conference_obj_t *conference, 
+                                                  switch_core_session_t *session, char *path, uint32_t leadin, char *buf, switch_size_t len)
 {
     uint32_t x = 0;
     switch_status_t status = SWITCH_STATUS_SUCCESS;
@@ -3432,7 +3434,17 @@ static switch_status_t conference_local_play_file(switch_core_session_t *session
 
     /* if all is well, really play the file */
     if (status == SWITCH_STATUS_SUCCESS) {
+        char *dpath = NULL;
+
+        if (conference->sound_prefix) {
+            if (!(dpath = switch_mprintf("%s/%s", conference->sound_prefix, path))) {
+                return SWITCH_STATUS_MEMERR;
+            }
+            path = dpath;
+        }
+
         status = switch_ivr_play_file(session, NULL, path, NULL);
+        switch_safe_free(dpath);
     }
 
     return status;
@@ -3610,7 +3622,7 @@ static void conference_function(switch_core_session_t *session, char *data)
 
                 /* be friendly */
                 if (conference->pin_sound) {
-                    conference_local_play_file(session, conference->pin_sound, 20, pin_buf, sizeof(pin_buf));
+                    conference_local_play_file(conference, session, conference->pin_sound, 20, pin_buf, sizeof(pin_buf));
                 } 
                 /* wait for them if neccessary */
                 if (strlen(pin_buf) < strlen(conference->pin)) {
@@ -3631,7 +3643,7 @@ static void conference_function(switch_core_session_t *session, char *data)
 
                     /* more friendliness */
                     if (conference->bad_pin_sound) {
-                        conference_local_play_file(session, conference->bad_pin_sound, 20, pin_buf, sizeof(pin_buf));
+                        conference_local_play_file(conference, session, conference->bad_pin_sound, 20, pin_buf, sizeof(pin_buf));
                     }
                 }
                 pin_retries --;
@@ -3648,7 +3660,7 @@ static void conference_function(switch_core_session_t *session, char *data)
             if (conference->locked_sound) {
                 /* Answer the channel */
                 switch_channel_answer(channel);
-                conference_local_play_file(session, conference->locked_sound, 20, NULL, 0);
+                conference_local_play_file(conference, session, conference->locked_sound, 20, NULL, 0);
             }
             goto done;
         }
index 5cf356df4b43c8fa5b99c3fb5ad2c792e1e8fd35..de4d1a26f17989508613f7ff708a3530557bf8cf 100644 (file)
@@ -2223,6 +2223,7 @@ static uint8_t negotiate_sdp(switch_core_session_t *session, sdp_session_t *sdp)
        sdp_media_t *m;
        sdp_attribute_t *a;
        switch_channel_t *channel;
+    int ptime = 0, dptime = 0;
 
        tech_pvt = switch_core_session_get_private(session);
        assert(tech_pvt != NULL);                                                                                                                               
@@ -2246,10 +2247,19 @@ static uint8_t negotiate_sdp(switch_core_session_t *session, sdp_session_t *sdp)
                        switch_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
                } else if (!strcasecmp(a->a_name, "sendrecv")) {
                        switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+               } else if (!strcasecmp(a->a_name, "ptime")) {
+            dptime = atoi(a->a_value);
                }
        }
 
        for (m = sdp->sdp_media; m ; m = m->m_next) {
+        ptime = dptime;
+        for (a = m->m_attributes; a; a = a->a_next) {
+            if (!strcasecmp(a->a_name, "ptime")) {
+                ptime = atoi(a->a_value);
+            }
+        }
+
                if (m->m_type == sdp_media_audio) {
                        sdp_rtpmap_t *map;