From 4e75aa0b527f659f4b53f5bda3a3b513ebb812f6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 25 Jan 2007 17:26:23 +0000 Subject: [PATCH] make conference_local_play_file honor the sound-prefix param git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4056 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- .../mod_conference/mod_conference.c | 22 ++++++++++++++----- src/mod/endpoints/mod_sofia/mod_sofia.c | 10 +++++++++ 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 20d853f5b9..ea5ec19c83 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -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; } diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 5cf356df4b..de4d1a26f1 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -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;