diff --git a/conf/insideout/directory/default/brian.xml b/conf/insideout/directory/default/brian.xml index 4bd562686f..43f349f144 100644 --- a/conf/insideout/directory/default/brian.xml +++ b/conf/insideout/directory/default/brian.xml @@ -34,7 +34,7 @@ - + diff --git a/conf/insideout/sip_profiles/external/example.xml b/conf/insideout/sip_profiles/external/example.xml index c6b79e8fe3..64081fdcd8 100644 --- a/conf/insideout/sip_profiles/external/example.xml +++ b/conf/insideout/sip_profiles/external/example.xml @@ -27,7 +27,7 @@ - + diff --git a/conf/insideout/sip_profiles/internal/example.xml b/conf/insideout/sip_profiles/internal/example.xml index c6b79e8fe3..64081fdcd8 100644 --- a/conf/insideout/sip_profiles/internal/example.xml +++ b/conf/insideout/sip_profiles/internal/example.xml @@ -27,7 +27,7 @@ - + diff --git a/conf/rayo/sip_profiles/external/example.xml b/conf/rayo/sip_profiles/external/example.xml index 2a4df31aaf..0497bcd1e1 100644 --- a/conf/rayo/sip_profiles/external/example.xml +++ b/conf/rayo/sip_profiles/external/example.xml @@ -27,7 +27,7 @@ - + diff --git a/conf/sbc/sbc_profiles/external/example.xml b/conf/sbc/sbc_profiles/external/example.xml index c6b79e8fe3..64081fdcd8 100644 --- a/conf/sbc/sbc_profiles/external/example.xml +++ b/conf/sbc/sbc_profiles/external/example.xml @@ -27,7 +27,7 @@ - + diff --git a/conf/sbc/sbc_profiles/internal/example.xml b/conf/sbc/sbc_profiles/internal/example.xml index c6b79e8fe3..64081fdcd8 100644 --- a/conf/sbc/sbc_profiles/internal/example.xml +++ b/conf/sbc/sbc_profiles/internal/example.xml @@ -27,7 +27,7 @@ - + diff --git a/conf/softphone/accounts/example.xml b/conf/softphone/accounts/example.xml index 7ac8db1186..249b460709 100644 --- a/conf/softphone/accounts/example.xml +++ b/conf/softphone/accounts/example.xml @@ -27,7 +27,7 @@ - + diff --git a/conf/vanilla/directory/default/brian.xml b/conf/vanilla/directory/default/brian.xml index 5ea3f58ea6..98f720f47e 100644 --- a/conf/vanilla/directory/default/brian.xml +++ b/conf/vanilla/directory/default/brian.xml @@ -36,7 +36,7 @@ - + diff --git a/conf/vanilla/sip_profiles/external/example.xml b/conf/vanilla/sip_profiles/external/example.xml index 2a4df31aaf..0497bcd1e1 100644 --- a/conf/vanilla/sip_profiles/external/example.xml +++ b/conf/vanilla/sip_profiles/external/example.xml @@ -27,7 +27,7 @@ - + diff --git a/conf/vanilla/sip_profiles/internal/example.xml b/conf/vanilla/sip_profiles/internal/example.xml index 10263b05a5..a5cbd7d2b7 100644 --- a/conf/vanilla/sip_profiles/internal/example.xml +++ b/conf/vanilla/sip_profiles/internal/example.xml @@ -27,7 +27,7 @@ - + diff --git a/configure.ac b/configure.ac index 6b39505fff..c008ebcff3 100644 --- a/configure.ac +++ b/configure.ac @@ -331,6 +331,17 @@ if test "${LIBTOOL_MAJOR_VERSION}" = "2" ; then fi AC_MSG_RESULT([using libtool library extension... ${LIBTOOL_LIB_EXTEN}]) +if test "$ax_cv_c_compiler_vendor" = "gnu"; then + saved_CFLAGS="$CFLAGS" + AC_CACHE_CHECK([whether compiler supports -Wno-unused-result], + [ac_cv_gcc_supports_w_no_unused_result], [ + CFLAGS="$CFLAGS -Wno-unused-result" + AC_TRY_COMPILE([],[return 0;], + [ac_cv_gcc_supports_w_no_unused_result=yes], + [ac_cv_gcc_supports_w_no_unused_result=no])]) + CFLAGS="$saved_CFLAGS" + AC_MSG_RESULT($ac_cv_gcc_supports_w_no_unused_result) +fi # tweak compiler specific flags if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then @@ -360,7 +371,9 @@ elif test "x${ax_cv_c_compiler_vendor}" = "xclang" ; then elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then APR_ADDTO(SWITCH_AM_CFLAGS, -fPIC) APR_ADDTO(SWITCH_AM_CXXFLAGS, -fPIC) - APR_ADDTO(SWITCH_AM_CFLAGS, -Werror) + if test "$ac_cv_gcc_supports_w_no_unused_result" = yes; then + APR_ADDTO(SWITCH_AM_CFLAGS, -Werror) + fi if test "${enable_64}" = "yes"; then case "$host" in *darwin12.*|*darwin11.*|*darwin10.*|*darwin9.*|*darwin8.*) @@ -464,7 +477,9 @@ if test "${enable_debug}" = "yes"; then CFLAGS="$saved_CFLAGS" if test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then - APR_ADDTO(SWITCH_AM_CFLAGS, -Wno-unused-result) + if test "$ac_cv_gcc_supports_w_no_unused_result" = yes; then + APR_ADDTO(SWITCH_AM_CFLAGS, -Wno-unused-result) + fi APR_ADDTO(SWITCH_AM_CFLAGS, -g -ggdb) export DEBUG_CFLAGS="-g -ggdb" fi diff --git a/debian/freeswitch.postinst b/debian/freeswitch.postinst index 6f024b726f..d2f3f8ac87 100644 --- a/debian/freeswitch.postinst +++ b/debian/freeswitch.postinst @@ -22,9 +22,12 @@ case "$1" in /var/log/freeswitch \ /var/run/freeswitch; do - mkdir -p $x - chown -R freeswitch:freeswitch $x - chmod -R o-rwx,g+u $x + if ! test -d $x; then + mkdir -p $x + chown freeswitch:freeswitch $x + chmod o-rwx,g+u $x + fi + chown freeswitch $x done ;; abort-upgrade|abort-remove|abort-deconfigure) diff --git a/html5/verto/demo/verto.js b/html5/verto/demo/verto.js index 9e68674b9f..3935854ffb 100644 --- a/html5/verto/demo/verto.js +++ b/html5/verto/demo/verto.js @@ -76,6 +76,54 @@ function check_vid() { return use_vid; } +function messageTextToJQ(body) { + // Builds a jQuery collection from body text, linkifies http/https links, imageifies http/https links to images, and doesn't allow script injection + + var match, $link, img_url, $body_parts = $(), rx = /(https?:\/\/[^ \n\r]+|\n\r|\n|\r)/; + + while ((match = rx.exec(body)) !== null) { + if (match.index !== 0) { + $body_parts = $body_parts.add(document.createTextNode(body.substr(0, match.index))); + } + + if (match[0].match(/^(\n|\r|\n\r)$/)) { + // Make a BR from a newline + $body_parts = $body_parts.add($('
')); + body = body.substr(match.index + match[0].length); + } else { + // Make a link (or image) + $link = $('').attr('href', match[0]); + + if (match[0].search(/\.(gif|jpe?g|png)/) > -1) { + // Make an image + img_url = match[0]; + + // Handle dropbox links + if (img_url.indexOf('dropbox.com') !== -1) { + if (img_url.indexOf('?dl=1') === -1 && img_url.indexOf('?dl=0') === -1) { + img_url += '?dl=1'; + } else if (img_url.indexOf('?dl=0') !== -1) { + img_url = img_url.replace(/dl=0$/, 'dl=1'); + } + } + + $link.append($('').attr('src', img_url)); + } else { + // Make a link + $link.text(match[0]); + } + + body = body.substr(match.index + match[0].length); + $body_parts = $body_parts.add($link); + } + } + if (body) { + $body_parts = $body_parts.add(document.createTextNode(body)); + } + + return $body_parts; +} // END function messageTextToJQ + var callbacks = { onMessage: function(verto, dialog, msg, data) { @@ -114,6 +162,9 @@ var callbacks = { case $.verto.enum.message.info: var body = data.body; + /* + // This section has been replaced with messageTextToJQ function + if (body.match(/\.gif|\.jpg|\.jpeg|\.png/)) { var mod = ""; if (body.match(/dropbox.com/)) { @@ -129,11 +180,21 @@ var callbacks = { } body = body.replace(/(?:\r\n|\r|\n)/g, '
'); - var from = data.from_msg_name || data.from; - + var from = data.from_msg_name || data.from; + $("#chatwin").append("" + from + ":
" + body); $('#chatwin').animate({"scrollTop": $('#chatwin')[0].scrollHeight}, "fast"); - + */ + + var from = data.from_msg_name || data.from; + + $('#chatwin') + .append($('').text(from + ':')) + .append($('
')) + .append(messageTextToJQ(body)) + .append($('
')); + $('#chatwin').animate({"scrollTop": $('#chatwin')[0].scrollHeight}, "fast"); + break; case $.verto.enum.message.display: var party = dialog.params.remote_caller_id_name + "<" + dialog.params.remote_caller_id_number + ">"; diff --git a/libs/esl/fs_cli.c b/libs/esl/fs_cli.c index ed59792771..43c186b728 100644 --- a/libs/esl/fs_cli.c +++ b/libs/esl/fs_cli.c @@ -1284,7 +1284,7 @@ static void read_config(const char *dft_cfile, const char *cfile) { static void clear_el_buffer(void) { #ifdef HAVE_LIBEDIT const LineInfo *lf = el_line(el); - int len = (int)(lf->lastchar - lf->buffer); + int len = (int)(lf->cursor - lf->buffer); if (global_profile->batch_mode) return; el_deletestr(el, len); memset((char*)lf->buffer, 0, len); diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index d7933b4880..e64541b309 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -179,6 +179,9 @@ struct switch_core_session { switch_media_handle_t *media_handle; uint32_t decoder_errors; + switch_time_t last_read_time; + switch_time_t last_write_time; + }; struct switch_media_bug { diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 4d2478ce7c..fbb1cd9036 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -3312,7 +3312,6 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, v main_frame[x] = (int32_t) bptr[x]; } else { memset(&main_frame[x], 255, sizeof(main_frame[x])); - //printf("FUCCCK %d <= %ld (%ld/%d)\n", x, file_sample_len * conference->channels, file_sample_len, conference->channels); } } } @@ -3372,6 +3371,10 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, v } if (!switch_test_flag(omember, MFLAG_CAN_HEAR)) { + switch_mutex_lock(omember->audio_out_mutex); + memset(write_frame, 255, bytes); + ok = switch_buffer_write(omember->mux_buffer, write_frame, bytes); + switch_mutex_unlock(omember->audio_out_mutex); continue; } @@ -3423,6 +3426,31 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, v ok = switch_buffer_write(omember->mux_buffer, write_frame, bytes); switch_mutex_unlock(omember->audio_out_mutex); + if (!ok) { + switch_mutex_unlock(conference->mutex); + goto end; + } + } + } else { /* There is no source audio. Push silence into all of the buffers */ + int16_t write_frame[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 }; + + if (conference->comfort_noise_level) { + switch_generate_sln_silence(write_frame, samples, conference->channels, conference->comfort_noise_level); + } else { + memset(write_frame, 255, bytes); + } + + for (omember = conference->members; omember; omember = omember->next) { + switch_size_t ok = 1; + + if (!switch_test_flag(omember, MFLAG_RUNNING)) { + continue; + } + + switch_mutex_lock(omember->audio_out_mutex); + ok = switch_buffer_write(omember->mux_buffer, write_frame, bytes); + switch_mutex_unlock(omember->audio_out_mutex); + if (!ok) { switch_mutex_unlock(conference->mutex); goto end; @@ -4902,63 +4930,33 @@ static void conference_loop_output(conference_member_t *member) write_frame.data = data; use_buffer = member->mux_buffer; low_count = 0; + if ((write_frame.datalen = (uint32_t) switch_buffer_read(use_buffer, write_frame.data, bytes))) { if (write_frame.datalen) { write_frame.samples = write_frame.datalen / 2 / member->conference->channels; if( !switch_test_flag(member, MFLAG_CAN_HEAR)) { memset(write_frame.data, 255, write_frame.datalen); + } else if (member->volume_out_level) { /* Check for output volume adjustments */ + switch_change_sln_volume(write_frame.data, write_frame.samples * member->conference->channels, member->volume_out_level); } - else { - /* Check for output volume adjustments */ - if (member->volume_out_level) { - switch_change_sln_volume(write_frame.data, write_frame.samples * member->conference->channels, member->volume_out_level); - } + + write_frame.timestamp = timer.samplecount; + + if (member->fnode) { + member_add_file_data(member, write_frame.data, write_frame.datalen); } - write_frame.timestamp = timer.samplecount; - if (member->fnode) { - member_add_file_data(member, write_frame.data, write_frame.datalen); - } - member_check_channels(&write_frame, member, SWITCH_FALSE); - - if (switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { - switch_mutex_unlock(member->audio_out_mutex); - break; - } + member_check_channels(&write_frame, member, SWITCH_FALSE); + + if (switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { + switch_mutex_unlock(member->audio_out_mutex); + break; + } } } switch_mutex_unlock(member->audio_out_mutex); - } else if (member->fnode) { - write_frame.datalen = bytes; - write_frame.samples = samples; - memset(write_frame.data, 255, write_frame.datalen); - write_frame.timestamp = timer.samplecount; - member_add_file_data(member, write_frame.data, write_frame.datalen); - member_check_channels(&write_frame, member, SWITCH_FALSE); - if (switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - break; - } - } else { - - if (member->conference->comfort_noise_level) { - switch_generate_sln_silence(write_frame.data, samples, member->conference->channels, member->conference->comfort_noise_level); - } else { - memset(write_frame.data, 255, bytes); - } - - write_frame.datalen = bytes; - write_frame.samples = samples; - write_frame.timestamp = timer.samplecount; - - member_check_channels(&write_frame, member, SWITCH_FALSE); - - if (switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - break; - } } if (switch_test_flag(member, MFLAG_FLUSH_BUFFER)) { @@ -5068,8 +5066,6 @@ static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *th uint32_t rlen; switch_size_t data_buf_len; switch_event_t *event; - int no_data = 0; - int lead_in = 20; switch_size_t len = 0; if (switch_thread_rwlock_tryrdlock(conference->rwlock) != SWITCH_STATUS_SUCCESS) { @@ -5174,11 +5170,6 @@ static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *th len = 0; - if (lead_in) { - lead_in--; - goto loop; - } - mux_used = (uint32_t) switch_buffer_inuse(member->mux_buffer); if (switch_test_flag(member, MFLAG_FLUSH_BUFFER)) { @@ -5205,7 +5196,6 @@ static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *th if ((rlen = (uint32_t) switch_buffer_read(member->mux_buffer, data_buf, data_buf_len))) { len = (switch_size_t) rlen / sizeof(int16_t) / conference->channels; - no_data = 0; } switch_mutex_unlock(member->audio_out_mutex); } @@ -5217,10 +5207,6 @@ static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *th goto again; } - if (++no_data < 2) { - goto loop; - } - memset(data_buf, 255, (switch_size_t) data_buf_len); len = (switch_size_t) samples; } @@ -5238,16 +5224,18 @@ static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *th } /* Rinse ... Repeat */ end: - - while(!no_data) { + + for(;;) { switch_mutex_lock(member->audio_out_mutex); - if ((rlen = (uint32_t) switch_buffer_read(member->mux_buffer, data_buf, data_buf_len))) { - len = (switch_size_t) rlen / sizeof(int16_t)/ conference->channels; - switch_core_file_write(&fh, data_buf, &len); - } else { - no_data = 1; - } + rlen = (uint32_t) switch_buffer_read(member->mux_buffer, data_buf, data_buf_len); switch_mutex_unlock(member->audio_out_mutex); + + if (rlen > 0) { + len = (switch_size_t) rlen / sizeof(int16_t)/ conference->channels; + switch_core_file_write(&fh, data_buf, &len); + } else { + break; + } } switch_safe_free(data_buf); diff --git a/src/mod/applications/mod_db/mod_db.c b/src/mod/applications/mod_db/mod_db.c index 58a5a25616..d0e9dd8931 100644 --- a/src/mod/applications/mod_db/mod_db.c +++ b/src/mod/applications/mod_db/mod_db.c @@ -188,9 +188,9 @@ SWITCH_LIMIT_INCR(limit_incr_db) got = atoi(gotstr); if (max < 0) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s_%s is now %d\n", realm, resource, got + 1); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Usage for %s_%s is now %d\n", realm, resource, got + 1); } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s_%s is now %d/%d\n", realm, resource, got + 1, max); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Usage for %s_%s is now %d/%d\n", realm, resource, got + 1, max); } if (max >= 0 && got + 1 > max) { diff --git a/src/mod/applications/mod_directory/mod_directory.c b/src/mod/applications/mod_directory/mod_directory.c index 9baaf8bcf1..e37b89a660 100644 --- a/src/mod/applications/mod_directory/mod_directory.c +++ b/src/mod/applications/mod_directory/mod_directory.c @@ -1091,7 +1091,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_directory_load) Macro expands to: switch_status_t mod_directory_shutdown() */ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_directory_shutdown) { - switch_hash_index_t *hi; + switch_hash_index_t *hi = NULL; dir_profile_t *profile; void *val = NULL; const void *key; @@ -1100,7 +1100,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_directory_shutdown) switch_mutex_lock(globals.mutex); - while ((hi = switch_core_hash_first(globals.profile_hash))) { + while ((hi = switch_core_hash_first_iter(globals.profile_hash, hi))) { switch_core_hash_this(hi, &key, &keylen, &val); profile = (dir_profile_t *) val; diff --git a/src/mod/applications/mod_hash/mod_hash.c b/src/mod/applications/mod_hash/mod_hash.c index d151bd7c9d..133f05de3e 100644 --- a/src/mod/applications/mod_hash/mod_hash.c +++ b/src/mod/applications/mod_hash/mod_hash.c @@ -158,7 +158,7 @@ SWITCH_LIMIT_INCR(limit_incr_hash) */ increment = !switch_core_hash_find(pvt->hash, hashkey); } else { - /* This is the first limit check on this channel, create a hashtable, set our prviate data */ + /* This is the first limit check on this channel, create a hashtable, set our private data */ pvt = (limit_hash_private_t *) switch_core_session_alloc(session, sizeof(limit_hash_private_t)); memset(pvt, 0, sizeof(limit_hash_private_t)); switch_core_hash_init(&pvt->hash); @@ -197,11 +197,11 @@ SWITCH_LIMIT_INCR(limit_incr_hash) switch_core_hash_insert(pvt->hash, hashkey, item); if (max == -1) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is now %d\n", hashkey, item->total_usage + remote_usage.total_usage); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Usage for %s is now %d\n", hashkey, item->total_usage + remote_usage.total_usage); } else if (interval == 0) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is now %d/%d\n", hashkey, item->total_usage + remote_usage.total_usage, max); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Usage for %s is now %d/%d\n", hashkey, item->total_usage + remote_usage.total_usage, max); } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is now %d/%d for the last %d seconds\n", hashkey, + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Usage for %s is now %d/%d for the last %d seconds\n", hashkey, item->rate_usage, max, interval); } @@ -273,14 +273,12 @@ SWITCH_STANDARD_SCHED_FUNC(limit_hash_cleanup_callback) } } -/* !\brief Releases usage of a limit_hash-controlled ressource */ +/* !\brief Releases usage of a limit_hash-controlled resource */ SWITCH_LIMIT_RELEASE(limit_release_hash) { switch_channel_t *channel = switch_core_session_get_channel(session); limit_hash_private_t *pvt = switch_channel_get_private(channel, "limit_hash"); limit_hash_item_t *item = NULL; - switch_hash_index_t *hi; - char *hashkey = NULL; if (!pvt || !pvt->hash) { return SWITCH_STATUS_SUCCESS; @@ -290,8 +288,9 @@ SWITCH_LIMIT_RELEASE(limit_release_hash) /* clear for uuid */ if (realm == NULL && resource == NULL) { + switch_hash_index_t *hi = NULL; /* Loop through the channel's hashtable which contains mapping to all the limit_hash_item_t referenced by that channel */ - while ((hi = switch_core_hash_first(pvt->hash))) { + while ((hi = switch_core_hash_first_iter(pvt->hash, hi))) { void *val = NULL; const void *key; switch_ssize_t keylen; @@ -301,7 +300,7 @@ SWITCH_LIMIT_RELEASE(limit_release_hash) item = (limit_hash_item_t *) val; item->total_usage--; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is now %d\n", (const char *) key, item->total_usage); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Usage for %s is now %d\n", (const char *) key, item->total_usage); if (item->total_usage == 0 && item->rate_usage == 0) { /* Noone is using this item anymore */ @@ -311,12 +310,13 @@ SWITCH_LIMIT_RELEASE(limit_release_hash) switch_core_hash_delete(pvt->hash, (const char *) key); } + switch_core_hash_destroy(&pvt->hash); } else { - hashkey = switch_core_session_sprintf(session, "%s_%s", realm, resource); + char *hashkey = switch_core_session_sprintf(session, "%s_%s", realm, resource); if ((item = (limit_hash_item_t *) switch_core_hash_find(pvt->hash, hashkey))) { item->total_usage--; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is now %d\n", (const char *) hashkey, item->total_usage); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Usage for %s is now %d\n", (const char *) hashkey, item->total_usage); switch_core_hash_delete(pvt->hash, hashkey); diff --git a/src/mod/applications/mod_redis/mod_redis.c b/src/mod/applications/mod_redis/mod_redis.c index 3c8fc3f79d..5e84b196e9 100644 --- a/src/mod/applications/mod_redis/mod_redis.c +++ b/src/mod/applications/mod_redis/mod_redis.c @@ -152,7 +152,6 @@ SWITCH_LIMIT_RELEASE(limit_release_redis) switch_channel_t *channel = switch_core_session_get_channel(session); limit_redis_private_t *pvt = switch_channel_get_private(channel, "limit_redis"); int val, uuid_val; - switch_hash_index_t *hi; char *rediskey = NULL; char *uuid_rediskey = NULL; int status = SWITCH_STATUS_SUCCESS; @@ -171,8 +170,9 @@ SWITCH_LIMIT_RELEASE(limit_release_redis) /* clear for uuid */ if (realm == NULL && resource == NULL) { + switch_hash_index_t *hi = NULL; /* Loop through the channel's hashtable which contains mapping to all the limit_redis_item_t referenced by that channel */ - while ((hi = switch_core_hash_first(pvt->hash))) { + while ((hi = switch_core_hash_first_iter(pvt->hash, hi))) { void *p_val = NULL; const void *p_key; char *p_uuid_key = NULL; diff --git a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c index db50ef3056..8e85cf2960 100644 --- a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c +++ b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2009-2012, Anthony Minessale II + * Copyright (C) 2009-2014, Anthony Minessale II * * Version: MPL 1.1 * @@ -162,7 +162,6 @@ static switch_status_t profile_create(profile_t ** profile, const char *name, sw static switch_xml_config_item_t instructions[] = { SWITCH_CONFIG_ITEM_STRING_STRDUP("max-connection-count", CONFIG_REQUIRED, &globals.unimrcp_max_connection_count, "100", "", "The max MRCPv2 connections to manage"), - /* TODO figure out what this param does */ SWITCH_CONFIG_ITEM_STRING_STRDUP("offer-new-connection", CONFIG_REQUIRED, &globals.unimrcp_offer_new_connection, "1", "", ""), SWITCH_CONFIG_ITEM_STRING_STRDUP("default-tts-profile", CONFIG_REQUIRED, &globals.unimrcp_default_synth_profile, "default", "", "The default profile to use for TTS"), @@ -481,9 +480,6 @@ static switch_status_t recog_asr_disable_all_grammars(switch_asr_handle_t *ah); static switch_status_t recog_asr_close(switch_asr_handle_t *ah, switch_asr_flag_t *flags); static switch_status_t recog_asr_feed(switch_asr_handle_t *ah, void *data, unsigned int len, switch_asr_flag_t *flags); static switch_status_t recog_asr_feed_dtmf(switch_asr_handle_t *ah, const switch_dtmf_t *dtmf, switch_asr_flag_t *flags); -#if 0 -static switch_status_t recog_asr_start(switch_asr_handle_t *ah, const char *name); -#endif static switch_status_t recog_asr_resume(switch_asr_handle_t *ah); static switch_status_t recog_asr_pause(switch_asr_handle_t *ah); static switch_status_t recog_asr_check_results(switch_asr_handle_t *ah, switch_asr_flag_t *flags); @@ -1043,6 +1039,13 @@ static switch_status_t speech_channel_open(speech_channel_t *schannel, profile_t /* can't retry */ status = SWITCH_STATUS_FALSE; } else if (schannel->state == SPEECH_CHANNEL_ERROR) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) Terminating MRCP session\n", schannel->name); + if (!mrcp_application_session_terminate(schannel->unimrcp_session)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) Unable to terminate application session\n", schannel->name); + status = SWITCH_STATUS_FALSE; + goto done; + } + /* Wait for session to be cleaned up */ warned = 0; while (schannel->state == SPEECH_CHANNEL_ERROR) { @@ -1888,14 +1891,10 @@ error: if (schannel) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) %s channel error!\n", schannel->name, speech_channel_type_to_string(schannel->type)); + speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(unknown) channel error!\n"); } - if (session) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Terminating MRCP session\n"); - speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR); - mrcp_application_session_terminate(session); - } return TRUE; } @@ -2187,7 +2186,6 @@ static switch_status_t recog_channel_start(speech_channel_t *schannel) r->start_of_input = 0; /* input timers are started by default unless the start-input-timers=false param is set */ - /* TODO this is true for Nuance, but might not be true on other MRCP servers */ start_input_timers = (char *) switch_core_hash_find(schannel->params, "start-input-timers"); r->timers_started = zstr(start_input_timers) || strcasecmp(start_input_timers, "false"); @@ -2389,7 +2387,6 @@ static switch_status_t recog_channel_load_grammar(speech_channel_t *schannel, co } /* set up name, type for future RECOGNIZE requests. We'll reference this cached grammar by name */ - /* TODO rethink this */ ldata = switch_mprintf("session:%s", name); data = ldata; type = GRAMMAR_TYPE_URI; @@ -3432,21 +3429,6 @@ static switch_status_t recog_asr_feed_dtmf(switch_asr_handle_t *ah, const switch return SWITCH_STATUS_SUCCESS; } -#if 0 -/** - * Process asr_start request from FreeSWITCH - * @param ah the FreeSWITCH speech recognition handle - * @return SWITCH_STATUS_SUCCESS if successful - */ -static switch_status_t recog_asr_start(switch_asr_handle_t *ah) -{ - switch_status_t status; - speech_channel_t *schannel = (speech_channel_t *) ah->private_info; - status = recog_channel_start(schannel); - return status; -} -#endif - /** * Process asr_resume request from FreeSWITCH * @@ -3763,9 +3745,6 @@ static switch_status_t recog_load(switch_loadable_module_interface_t *module_int asr_interface->asr_close = recog_asr_close; asr_interface->asr_feed = recog_asr_feed; asr_interface->asr_feed_dtmf = recog_asr_feed_dtmf; -#if 0 - asr_interface->asr_start = recog_asr_start; -#endif asr_interface->asr_resume = recog_asr_resume; asr_interface->asr_pause = recog_asr_pause; asr_interface->asr_check_results = recog_asr_check_results; diff --git a/src/mod/endpoints/mod_rtmp/mod_rtmp.c b/src/mod/endpoints/mod_rtmp/mod_rtmp.c index 6a7e4a45b7..928ec58fe9 100644 --- a/src/mod/endpoints/mod_rtmp/mod_rtmp.c +++ b/src/mod/endpoints/mod_rtmp/mod_rtmp.c @@ -1078,7 +1078,7 @@ fail: switch_status_t rtmp_profile_destroy(rtmp_profile_t **profile) { int sanity = 0; - switch_hash_index_t *hi; + switch_hash_index_t *hi = NULL; switch_xml_config_item_t *instructions = get_instructions(*profile); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Stopping profile: %s\n", (*profile)->name); @@ -1087,7 +1087,7 @@ switch_status_t rtmp_profile_destroy(rtmp_profile_t **profile) { switch_thread_rwlock_wrlock((*profile)->rwlock); /* Kill all sessions */ - while ((hi = switch_core_hash_first((*profile)->session_hash))) { + while ((hi = switch_core_hash_first_iter((*profile)->session_hash, hi))) { void *val; rtmp_session_t *session; const void *key; diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index d2c4cd1ca7..18b10e584d 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -1485,7 +1485,7 @@ switch_status_t skinny_handle_off_hook_message(listener_t *listener, skinny_mess line_state = skinny_line_get_state(listener, line_instance, call_id); - if(session && line_state != SKINNY_OFF_HOOK ) { /*answering a call */ + if(session && line_state == SKINNY_RING_IN ) { /*answering a call */ skinny_session_answer(session, listener, line_instance); } else { /* start a new call */ skinny_create_incoming_session(listener, &line_instance, &session); diff --git a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml index f624fa5a74..52fb8faefb 100644 --- a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml +++ b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml @@ -43,7 +43,7 @@ calls via this gateway --> - +