[Freeswitch-svn] [commit] r4056 - in freeswitch/trunk/src/mod: applications/mod_conference endpoints/mod_sofia

Freeswitch SVN anthm at freeswitch.org
Thu Jan 25 12:26:24 EST 2007


Author: anthm
Date: Thu Jan 25 12:26:23 2007
New Revision: 4056

Modified:
   freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c

Log:
make conference_local_play_file honor the sound-prefix param

Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	Thu Jan 25 12:26:23 2007
@@ -287,7 +287,8 @@
 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 @@
 }
 
 /* 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 @@
 
     /* 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 @@
 
                 /* 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 @@
 
                     /* 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 @@
             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;
         }

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	Thu Jan 25 12:26:23 2007
@@ -2223,6 +2223,7 @@
 	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 @@
 			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;
 



More information about the Freeswitch-svn mailing list