diff --git a/configure.in b/configure.in index 0867323da7..a5948d2d5e 100644 --- a/configure.in +++ b/configure.in @@ -3,10 +3,10 @@ # Must change all of the below together # For a release, set revision for that tagged release as well and uncomment -AC_INIT([freeswitch], [1.2.7], bugs@freeswitch.org) +AC_INIT([freeswitch], [1.2.8], bugs@freeswitch.org) AC_SUBST(SWITCH_VERSION_MAJOR, [1]) AC_SUBST(SWITCH_VERSION_MINOR, [2]) -AC_SUBST(SWITCH_VERSION_MICRO, [7]) +AC_SUBST(SWITCH_VERSION_MICRO, [8]) AC_SUBST(SWITCH_VERSION_REVISION, []) AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, []) diff --git a/debian/README.source b/debian/README.source index 566cfe6f2f..5119f1817b 100644 --- a/debian/README.source +++ b/debian/README.source @@ -77,7 +77,7 @@ To build for a stable branch, do this: Alternatively, you can build using our automated tools. To build the source packages and all supported binary packages for sid, wheezy, squeeze on i386 and amd64, run the following as root from a clean -Debian 'buildd' image: +Debian sid 'buildd' image: aptitude update && aptitude upgrade aptitude install -y \ @@ -104,4 +104,4 @@ freeswitch-music-*: git clone https://github.com/traviscross/freeswitch-sounds.git cd freeswitch-sounds && cat debian/README.source - -- Travis Cross , Mon, 11 Mar 2013 17:09:33 +0000 + -- Travis Cross , Fri, 29 Mar 2013 22:07:26 +0000 diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index 6af8cfb72c..14706d441a 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -201,8 +201,8 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_caller_profile(swit \param channel channel to assign the profile to \param caller_profile the profile to assign */ -SWITCH_DECLARE(void) _switch_channel_set_originator_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile); -#define switch_channel_set_originator_caller_profile(_c, _cp) switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(_c), SWITCH_LOG_CRIT, "%s SET ORIGINATOR\n", switch_channel_get_name(_c)); _switch_channel_set_originator_caller_profile(_c, _cp) +SWITCH_DECLARE(void) switch_channel_set_originator_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile); + SWITCH_DECLARE(void) switch_channel_set_hunt_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile); @@ -218,8 +218,8 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_originator_caller_p \param channel channel to assign the profile to \param caller_profile the profile to assign */ -SWITCH_DECLARE(void) _switch_channel_set_originatee_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile); -#define switch_channel_set_originatee_caller_profile(_c, _cp) switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(_c), SWITCH_LOG_CRIT, "%s SET ORIGINATEE\n", switch_channel_get_name(_c)); _switch_channel_set_originatee_caller_profile(_c, _cp) +SWITCH_DECLARE(void) switch_channel_set_originatee_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile); + /*! \brief Retrieve the given channel's originatee caller profile diff --git a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c index 91b9943805..a3809eb9ab 100644 --- a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c +++ b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c @@ -172,7 +172,7 @@ static switch_xml_config_item_t instructions[] = { "EMERGENCY|ALERT|CRITICAL|ERROR|WARNING|NOTICE|INFO|DEBUG", "Logging level for UniMRCP"), SWITCH_CONFIG_ITEM_STRING_STRDUP("enable-profile-events", CONFIG_REQUIRED, &globals.enable_profile_events_param, "false", "", "Fire profile events (true|false)"), - SWITCH_CONFIG_ITEM_STRING_STRDUP("request-timeout", CONFIG_REQUIRED, &globals.unimrcp_request_timeout, "10000", "", + SWITCH_CONFIG_ITEM_STRING_STRDUP("request-timeout", CONFIG_REQUIRED, &globals.unimrcp_request_timeout, "10000", "", "Maximum time to wait for server response to a request"), SWITCH_CONFIG_ITEM_END() }; @@ -273,7 +273,8 @@ static switch_status_t audio_queue_destroy(audio_queue_t *queue); * SPEECH_CHANNEL : speech functions common to recognizer and synthesizer */ -#define SPEECH_CHANNEL_TIMEOUT_USEC (5 * 1000000) +#define SPEECH_CHANNEL_TIMEOUT_USEC (5000 * 1000) +#define AUDIO_TIMEOUT_USEC (SWITCH_MAX_INTERVAL * 1000) /** * Type of MRCP channel @@ -725,11 +726,18 @@ static switch_status_t audio_queue_read(audio_queue_t *queue, void *data, switch #endif switch_mutex_lock(queue->mutex); + /* allow the initial frame to buffer */ + if (!queue->read_bytes && switch_buffer_inuse(queue->buffer) < requested) { + *data_len = 0; + status = SWITCH_STATUS_SUCCESS; + goto done; + } + /* wait for data, if allowed */ if (block) { while (switch_buffer_inuse(queue->buffer) < requested) { queue->waiting = requested; - if (switch_thread_cond_timedwait(queue->cond, queue->mutex, SPEECH_CHANNEL_TIMEOUT_USEC) == SWITCH_STATUS_TIMEOUT) { + if (switch_thread_cond_timedwait(queue->cond, queue->mutex, AUDIO_TIMEOUT_USEC) == SWITCH_STATUS_TIMEOUT) { break; } } @@ -774,6 +782,9 @@ static switch_status_t audio_queue_clear(audio_queue_t *queue) switch_buffer_zero(queue->buffer); switch_thread_cond_signal(queue->cond); switch_mutex_unlock(queue->mutex); + queue->read_bytes = 0; + queue->write_bytes = 0; + queue->waiting = 0; return SWITCH_STATUS_SUCCESS; } @@ -3222,7 +3233,7 @@ static switch_status_t recog_asr_feed(switch_asr_handle_t *ah, void *data, unsig * Process asr_feed_dtmf request from FreeSWITCH * * @param ah the FreeSWITCH speech recognition handle - * @return SWITCH_STATUS_SUCCESS if successful + * @return SWITCH_STATUS_SUCCESS if successful */ static switch_status_t recog_asr_feed_dtmf(switch_asr_handle_t *ah, const switch_dtmf_t *dtmf, switch_asr_flag_t *flags) { @@ -3507,9 +3518,9 @@ static apt_bool_t recog_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *cod { speech_channel_t *schannel = (speech_channel_t *) stream->obj; recognizer_data_t *r = (recognizer_data_t *) schannel->data; - + r->unimrcp_stream = stream; - + return TRUE; } @@ -3534,7 +3545,7 @@ static apt_bool_t recog_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *fra frame->type |= MEDIA_FRAME_TYPE_AUDIO; } - switch_mutex_lock(schannel->mutex); + switch_mutex_lock(schannel->mutex); if (r->dtmf_generator_active) { if (!mpf_dtmf_generator_put_frame(r->dtmf_generator, frame)) { if (!mpf_dtmf_generator_sending(r->dtmf_generator)) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 96a7182ff3..4f30bb334f 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -833,13 +833,26 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro switch_event_t *event; const char *val; int fs = 0, lazy = 0, att = 0; + const char *name_var = "callee_id_name"; + const char *num_var = "callee_id_number"; + const char *ename_var = "effective_callee_id_name"; + const char *enum_var = "effective_callee_id_number"; if (switch_true(switch_channel_get_variable(channel, SWITCH_IGNORE_DISPLAY_UPDATES_VARIABLE))) { return; } - number = (char *) switch_channel_get_variable(channel, "callee_id_number"); - name = (char *) switch_channel_get_variable(channel, "callee_id_name"); + + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) { + name_var = "caller_id_name"; + num_var = "caller_id_number"; + ename_var = "effective_caller_id_name"; + enum_var = "effective_caller_id_number"; + } + + + number = (char *) switch_channel_get_variable(channel, num_var); + name = (char *) switch_channel_get_variable(channel, name_var); if (zstr(number) && sip->sip_to) { @@ -886,18 +899,18 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro } } - if (((tmp = switch_channel_get_variable(channel, "effective_callee_id_name")) || + if (((tmp = switch_channel_get_variable(channel, ename_var)) || (tmp = switch_channel_get_variable(channel, "sip_callee_id_name"))) && !zstr(tmp)) { name = (char *) tmp; } - if (((tmp = switch_channel_get_variable(channel, "effective_callee_id_number")) || + if (((tmp = switch_channel_get_variable(channel, enum_var)) || (tmp = switch_channel_get_variable(channel, "sip_callee_id_number"))) && !zstr(tmp)) { number = tmp; } if (zstr(number)) { - if ((tmp = switch_channel_get_variable(channel, "callee_id_number")) && !zstr(tmp)) { + if ((tmp = switch_channel_get_variable(channel, num_var)) && !zstr(tmp)) { number = (char *) tmp; } @@ -907,7 +920,7 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro } if (zstr(name)) { - if ((tmp = switch_channel_get_variable(channel, "callee_id_name")) && !zstr(tmp)) { + if ((tmp = switch_channel_get_variable(channel, name_var)) && !zstr(tmp)) { name = (char *) tmp; } } @@ -922,16 +935,30 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro caller_profile = switch_channel_get_caller_profile(channel); - if (!strcmp(caller_profile->callee_id_name, name) && !strcmp(caller_profile->callee_id_number, number)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "%s Same Callee ID \"%s\" <%s>\n", switch_channel_get_name(channel), name, number); - send = 0; - } else { - caller_profile->callee_id_name = switch_sanitize_number(switch_core_strdup(caller_profile->pool, name)); - caller_profile->callee_id_number = switch_sanitize_number(switch_core_strdup(caller_profile->pool, number)); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s Update Callee ID to \"%s\" <%s>\n", switch_channel_get_name(channel), name, number); + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) { - if (lazy || (att && !switch_channel_get_partner_uuid(channel))) { - switch_channel_flip_cid(channel); + if (!strcmp(caller_profile->caller_id_name, name) && !strcmp(caller_profile->caller_id_number, number)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "%s Same Caller ID \"%s\" <%s>\n", switch_channel_get_name(channel), name, number); + send = 0; + } else { + caller_profile->caller_id_name = switch_sanitize_number(switch_core_strdup(caller_profile->pool, name)); + caller_profile->caller_id_number = switch_sanitize_number(switch_core_strdup(caller_profile->pool, number)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s Update Caller ID to \"%s\" <%s>\n", switch_channel_get_name(channel), name, number); + } + + } else { + + if (!strcmp(caller_profile->callee_id_name, name) && !strcmp(caller_profile->callee_id_number, number)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "%s Same Callee ID \"%s\" <%s>\n", switch_channel_get_name(channel), name, number); + send = 0; + } else { + caller_profile->callee_id_name = switch_sanitize_number(switch_core_strdup(caller_profile->pool, name)); + caller_profile->callee_id_number = switch_sanitize_number(switch_core_strdup(caller_profile->pool, number)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s Update Callee ID to \"%s\" <%s>\n", switch_channel_get_name(channel), name, number); + + if (lazy || (att && !switch_channel_get_partner_uuid(channel))) { + switch_channel_flip_cid(channel); + } } } @@ -3468,10 +3495,9 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) } else { mod_sofia_globals.rewrite_multicasted_fs_path = SWITCH_FALSE; } + } else if (!strcasecmp(var, "capture-server")) { + mod_sofia_globals.capture_server = switch_core_strdup(mod_sofia_globals.pool, val); } - else if (!strcasecmp(var, "capture-server")) { - mod_sofia_globals.capture_server = switch_core_strdup(mod_sofia_globals.pool, val); - } } } diff --git a/src/mod/formats/mod_shout/mod_shout.c b/src/mod/formats/mod_shout/mod_shout.c index e3fda4bef9..88ba993dea 100644 --- a/src/mod/formats/mod_shout/mod_shout.c +++ b/src/mod/formats/mod_shout/mod_shout.c @@ -882,7 +882,7 @@ static switch_status_t shout_file_close(switch_file_handle_t *handle) static switch_status_t shout_file_seek(switch_file_handle_t *handle, unsigned int *cur_sample, int64_t samples, int whence) { shout_context_t *context = handle->private_info; - + if (handle->handler || switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) { return SWITCH_STATUS_FALSE; } else { @@ -893,7 +893,12 @@ static switch_status_t shout_file_seek(switch_file_handle_t *handle, unsigned in switch_buffer_zero(context->audio_buffer); *cur_sample = mpg123_seek(context->mh, (off_t) samples, whence); - return *cur_sample >= 0 ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; + if (*cur_sample >= 0) { + handle->pos = *cur_sample; + return SWITCH_STATUS_SUCCESS; + } + + return SWITCH_STATUS_FALSE; } } diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c index 1fa7b4ad5c..7c2928db4c 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c @@ -1217,7 +1217,7 @@ static switch_status_t js_stream_input_callback(switch_core_session_t *session, switch_status_t status; struct input_callback_state *cb_state = buf; switch_file_handle_t *fh = cb_state->extra; - struct js_session *jss = cb_state->session_state; + //struct js_session *jss = cb_state->session_state; if (!switch_test_flag(fh, SWITCH_FILE_OPEN)) { return SWITCH_STATUS_FALSE; @@ -1285,11 +1285,11 @@ static switch_status_t js_stream_input_callback(switch_core_session_t *session, switch_core_file_seek(fh, &pos, 0, SEEK_SET); return SWITCH_STATUS_SUCCESS; } else if (!strncasecmp(ret, "seek", 4)) { - switch_codec_t *codec; + //switch_codec_t *codec; uint32_t samps = 0; uint32_t pos = 0; char *p; - codec = switch_core_session_get_read_codec(jss->session); + //codec = switch_core_session_get_read_codec(jss->session); if ((p = strchr(ret, ':'))) { p++; @@ -1299,14 +1299,14 @@ static switch_status_t js_stream_input_callback(switch_core_session_t *session, step = 1000; } if (step > 0) { - samps = step * (codec->implementation->actual_samples_per_second / 1000); + samps = step * (fh->samplerate / 1000); switch_core_file_seek(fh, &pos, samps, SEEK_CUR); } else { - samps = abs(step) * (codec->implementation->actual_samples_per_second / 1000); + samps = abs(step) * (fh->samplerate / 1000); switch_core_file_seek(fh, &pos, fh->pos - samps, SEEK_SET); } } else { - samps = atoi(p) * (codec->implementation->actual_samples_per_second / 1000); + samps = atoi(p) * (fh->samplerate / 1000); switch_core_file_seek(fh, &pos, samps, SEEK_SET); } } @@ -2008,7 +2008,9 @@ static JSBool session_speak(JSContext * cx, JSObject * obj, uintN argc, jsval * args.buflen = len; switch_core_speech_flush_tts(&jss->speech->sh); - switch_ivr_speak_text_handle(jss->session, &jss->speech->sh, &jss->speech->codec, NULL, text, &args); + if (switch_core_codec_ready(&jss->speech->codec)) { + switch_ivr_speak_text_handle(jss->session, &jss->speech->sh, &jss->speech->codec, NULL, text, &args); + } JS_ResumeRequest(cx, cb_state.saveDepth); check_hangup_hook(jss, &ret); *rval = cb_state.ret; diff --git a/src/switch_channel.c b/src/switch_channel.c index 95b7fe0756..0668e8b293 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2571,7 +2571,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_caller_profile(swit return profile; } -SWITCH_DECLARE(void) _switch_channel_set_originator_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile) +SWITCH_DECLARE(void) switch_channel_set_originator_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile) { switch_assert(channel != NULL); switch_assert(channel->caller_profile != NULL); @@ -2635,7 +2635,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_origination_caller_ } -SWITCH_DECLARE(void) _switch_channel_set_originatee_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile) +SWITCH_DECLARE(void) switch_channel_set_originatee_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile) { switch_assert(channel != NULL); switch_assert(channel->caller_profile != NULL); diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 92440ce78f..5342d3e846 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -3366,11 +3366,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_process_fh(switch_core_session_t *ses switch_core_file_seek(fhp, &pos, 0, SEEK_SET); return SWITCH_STATUS_SUCCESS; } else if (!strncasecmp(cmd, "seek", 4)) { - switch_codec_t *codec; + //switch_codec_t *codec; unsigned int samps = 0; unsigned int pos = 0; char *p; - codec = switch_core_session_get_read_codec(session); + //codec = switch_core_session_get_read_codec(session); if ((p = strchr(cmd, ':'))) { p++; @@ -3381,7 +3381,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_process_fh(switch_core_session_t *ses step = 1000; } - samps = step * (codec->implementation->samples_per_second / 1000); + samps = step * (fhp->samplerate / 1000); target = (int32_t)fhp->pos + samps; if (target < 0) { @@ -3392,7 +3392,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_process_fh(switch_core_session_t *ses switch_core_file_seek(fhp, &pos, target, SEEK_SET); } else { - samps = switch_atoui(p) * (codec->implementation->samples_per_second / 1000); + samps = switch_atoui(p) * (fhp->samplerate / 1000); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "seek to position %d\n", samps); switch_core_file_seek(fhp, &pos, samps, SEEK_SET); } diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index b20ce84476..3ce8b6bc72 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -797,8 +797,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se } if (read_impl.actual_samples_per_second) { - switch_channel_set_variable_printf(channel, "record_seconds", "%d", fh->samples_out / read_impl.actual_samples_per_second); - switch_channel_set_variable_printf(channel, "record_ms", "%d", fh->samples_out / (read_impl.actual_samples_per_second / 1000)); + switch_channel_set_variable_printf(channel, "record_seconds", "%d", fh->samples_out / fh->samplerate); + switch_channel_set_variable_printf(channel, "record_ms", "%d", fh->samples_out / (fh->samplerate/ 1000)); } @@ -1693,8 +1693,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "done playing file %s\n", file); if (read_impl.samples_per_second) { - switch_channel_set_variable_printf(channel, "playback_seconds", "%d", fh->samples_in / read_impl.samples_per_second); - switch_channel_set_variable_printf(channel, "playback_ms", "%d", fh->samples_in / (read_impl.samples_per_second / 1000)); + switch_channel_set_variable_printf(channel, "playback_seconds", "%d", fh->samples_in / fh->samplerate); + switch_channel_set_variable_printf(channel, "playback_ms", "%d", fh->samples_in / fh->samplerate); } switch_channel_set_variable_printf(channel, "playback_samples", "%d", fh->samples_in); @@ -2141,6 +2141,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session return SWITCH_STATUS_FALSE; } + if (!switch_core_codec_ready(codec)) { + return SWITCH_STATUS_FALSE; + } + arg_recursion_check_start(args); write_frame.data = abuf;