Merge branch 'master' into v1.4

This commit is contained in:
Ken Rice 2014-09-03 09:47:10 -05:00
commit 5605274664
34 changed files with 320 additions and 200 deletions

View File

@ -34,7 +34,7 @@
<!--Use the callerid of an inbound call in the from field on outbound calls via this gateway -->
<!--<param name="caller-id-in-from" value="false"/>-->
<!--extra sip params to send in the contact-->
<!--<param name="contact-params" value="tport=tcp"/>-->
<!--<param name="contact-params" value=""/>-->
<!--send an options ping every x seconds, failure will unregister and/or mark it down-->
<!--<param name="ping" value="25"/>-->
<!--</gateway>-->

View File

@ -27,7 +27,7 @@
<!--Use the callerid of an inbound call in the from field on outbound calls via this gateway -->
<!--<param name="caller-id-in-from" value="false"/>-->
<!--extra sip params to send in the contact-->
<!--<param name="contact-params" value="tport=tcp"/>-->
<!--<param name="contact-params" value=""/>-->
<!--send an options ping every x seconds, failure will unregister and/or mark it down-->
<!--<param name="ping" value="25"/>-->
<!--</gateway>-->

View File

@ -27,7 +27,7 @@
<!--Use the callerid of an inbound call in the from field on outbound calls via this gateway -->
<!--<param name="caller-id-in-from" value="false"/>-->
<!--extra sip params to send in the contact-->
<!--<param name="contact-params" value="tport=tcp"/>-->
<!--<param name="contact-params" value=""/>-->
<!--send an options ping every x seconds, failure will unregister and/or mark it down-->
<!--<param name="ping" value="25"/>-->
<!--</gateway>-->

View File

@ -27,7 +27,7 @@
<!--Use the callerid of an inbound call in the from field on outbound calls via this gateway -->
<!--<param name="caller-id-in-from" value="false"/>-->
<!--extra sip params to send in the contact-->
<!--<param name="contact-params" value="tport=tcp"/>-->
<!--<param name="contact-params" value=""/>-->
<!--send an options ping every x seconds, failure will unregister and/or mark it down-->
<!--<param name="ping" value="25"/>-->
<!--</gateway>-->

View File

@ -27,7 +27,7 @@
<!--Use the callerid of an inbound call in the from field on outbound calls via this gateway -->
<!--<param name="caller-id-in-from" value="false"/>-->
<!--extra sip params to send in the contact-->
<!--<param name="contact-params" value="tport=tcp"/>-->
<!--<param name="contact-params" value=""/>-->
<!--send an options ping every x seconds, failure will unregister and/or mark it down-->
<!--<param name="ping" value="25"/>-->
<!--</gateway>-->

View File

@ -27,7 +27,7 @@
<!--Use the callerid of an inbound call in the from field on outbound calls via this gateway -->
<!--<param name="caller-id-in-from" value="false"/>-->
<!--extra sip params to send in the contact-->
<!--<param name="contact-params" value="tport=tcp"/>-->
<!--<param name="contact-params" value=""/>-->
<!--send an options ping every x seconds, failure will unregister and/or mark it down-->
<!--<param name="ping" value="25"/>-->
<!--</gateway>-->

View File

@ -27,7 +27,7 @@
<!--Use the callerid of an inbound call in the from field on outbound calls via this gateway -->
<!--<param name="caller-id-in-from" value="false"/>-->
<!--extra sip params to send in the contact-->
<!--<param name="contact-params" value="tport=tcp"/>-->
<!--<param name="contact-params" value=""/>-->
<!--send an options ping every x seconds, failure will unregister and/or mark it down-->
<!--<param name="ping" value="25"/>-->
<!--</gateway>-->

View File

@ -36,7 +36,7 @@
<!--Use the callerid of an inbound call in the from field on outbound calls via this gateway -->
<!--<param name="caller-id-in-from" value="false"/>-->
<!--extra sip params to send in the contact-->
<!--<param name="contact-params" value="tport=tcp"/>-->
<!--<param name="contact-params" value=""/>-->
<!--send an options ping every x seconds, failure will unregister and/or mark it down-->
<!--<param name="ping" value="25"/>-->
<!--</gateway>-->

View File

@ -27,7 +27,7 @@
<!--Use the callerid of an inbound call in the from field on outbound calls via this gateway -->
<!--<param name="caller-id-in-from" value="false"/>-->
<!--extra sip params to send in the contact-->
<!--<param name="contact-params" value="tport=tcp"/>-->
<!--<param name="contact-params" value=""/>-->
<!--send an options ping every x seconds, failure will unregister and/or mark it down-->
<!--<param name="ping" value="25"/>-->
<!--</gateway>-->

View File

@ -27,7 +27,7 @@
<!--Use the callerid of an inbound call in the from field on outbound calls via this gateway -->
<!--<param name="caller-id-in-from" value="false"/>-->
<!--extra sip params to send in the contact-->
<!--<param name="contact-params" value="tport=tcp"/>-->
<!--<param name="contact-params" value=""/>-->
<!-- Put the extension in the contact -->
<!--<param name="extension-in-contact" value="true"/>-->
<!--send an options ping every x seconds, failure will unregister and/or mark it down-->

View File

@ -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

View File

@ -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)

View File

@ -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($('<br />'));
body = body.substr(match.index + match[0].length);
} else {
// Make a link (or image)
$link = $('<a target="_blank" />').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($('<img border="0" class="chatimg" />').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, '<br />');
var from = data.from_msg_name || data.from;
var from = data.from_msg_name || data.from;
$("#chatwin").append("<span class=chatuid>" + from + ":</span><br>" + body);
$('#chatwin').animate({"scrollTop": $('#chatwin')[0].scrollHeight}, "fast");
*/
var from = data.from_msg_name || data.from;
$('#chatwin')
.append($('<span class="chatuid" />').text(from + ':'))
.append($('<br />'))
.append(messageTextToJQ(body))
.append($('<br />'));
$('#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 + ">";

View File

@ -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);

View File

@ -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 {

View File

@ -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);

View File

@ -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) {

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -1,6 +1,6 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2009-2012, Anthony Minessale II <anthm@freeswitch.org>
* Copyright (C) 2009-2014, Anthony Minessale II <anthm@freeswitch.org>
*
* 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;

View File

@ -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;

View File

@ -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);

View File

@ -43,7 +43,7 @@
calls via this gateway -->
<param name="caller-id-in-from" value="false"/>
<!-- extra sip params to send in the contact -->
<param name="contact-params" value="tport=tcp"/>
<param name="contact-params" value=""/>
<!-- put the extension in the contact -->
<param name="extension-in-contact" value="true"/>
<!-- send an options ping every x seconds, failure will unregister

View File

@ -8265,6 +8265,29 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t
}
}
} else if (!strncasecmp(sip->sip_content_type->c_type, "application", 11) &&
!strcasecmp(sip->sip_content_type->c_subtype, "vnd.nortelnetworks.digits")) {
int tmp;
if ((signal_ptr = switch_stristr("d=", sip->sip_payload->pl_data))) {
signal_ptr = signal_ptr + 2;
while (*signal_ptr && *signal_ptr == ' ') {
signal_ptr++;
}
if (*signal_ptr && (*signal_ptr == '*' || *signal_ptr == '#' || *signal_ptr == 'A' || *signal_ptr == 'B'
|| *signal_ptr == 'C' || *signal_ptr == 'D')) {
dtmf.digit = *signal_ptr;
} else {
tmp = atoi(signal_ptr);
dtmf.digit = switch_rfc2833_to_char(tmp);
}
dtmf.duration = 100;
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Bad signal\n");
goto end;
}
} else if (!strncasecmp(sip->sip_content_type->c_type, "application", 11) && !strcasecmp(sip->sip_content_type->c_subtype, "dtmf-relay")) {
/* Try and find signal information in the payload */
if ((signal_ptr = switch_stristr("Signal=", sip->sip_payload->pl_data))) {

View File

@ -1553,7 +1553,7 @@ void rayo_peer_server_send(struct rayo_actor *server, struct rayo_message *msg)
*/
static void rayo_peer_server_cleanup(struct rayo_actor *actor)
{
switch_hash_index_t *hi;
switch_hash_index_t *hi = NULL;
struct rayo_peer_server *rserver = RAYO_PEER_SERVER(actor);
/* a little messy... client will remove itself from the peer server when it is destroyed,
@ -1561,7 +1561,7 @@ static void rayo_peer_server_cleanup(struct rayo_actor *actor)
* the server must remove the client.
*/
switch_mutex_lock(globals.clients_mutex);
while ((hi = switch_core_hash_first(rserver->clients))) {
while ((hi = switch_core_hash_first_iter(rserver->clients, hi))) {
const void *key;
void *client;
switch_core_hash_this(hi, &key, NULL, &client);
@ -2668,11 +2668,10 @@ static void *SWITCH_THREAD_FUNC rayo_dial_thread(switch_thread_t *thread, void *
if (gateway) {
iks *join = iks_find(dial, "join");
const char *dial_to_stripped = dial_to + gateway->strip;
switch_core_session_t *caller_session = NULL;
switch_core_session_t *called_session = NULL;
switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
const char *dialstring = NULL;
const char *app = NULL;
const char *app_args = NULL;
const char *rayo_app_args = "";
if (join) {
/* check join args */
@ -2689,47 +2688,41 @@ static void *SWITCH_THREAD_FUNC rayo_dial_thread(switch_thread_t *thread, void *
goto done;
} else if (!zstr(call_uri)) {
/* bridge */
struct rayo_call *b_call = RAYO_CALL_LOCATE(call_uri);
/* is b-leg available? */
if (!b_call) {
response = iks_new_error_detailed(iq, STANZA_ERROR_SERVICE_UNAVAILABLE, "b-leg not found");
struct rayo_call *peer_call = RAYO_CALL_LOCATE(call_uri);
/* is peer call available? */
if (!peer_call) {
response = iks_new_error_detailed(iq, STANZA_ERROR_SERVICE_UNAVAILABLE, "peer call not found");
goto done;
} else if (b_call->joined) {
response = iks_new_error_detailed(iq, STANZA_ERROR_SERVICE_UNAVAILABLE, "b-leg already joined to another call");
RAYO_RELEASE(b_call);
} else if (peer_call->joined) {
response = iks_new_error_detailed(iq, STANZA_ERROR_SERVICE_UNAVAILABLE, "peer call already joined");
RAYO_RELEASE(peer_call);
goto done;
}
app = "bridge";
app_args = switch_core_strdup(dtdata->pool, rayo_call_get_uuid(b_call));
RAYO_RELEASE(b_call);
rayo_app_args = switch_core_sprintf(dtdata->pool, "bridge %s", rayo_call_get_uuid(peer_call));
RAYO_RELEASE(peer_call);
} else {
/* conference */
app = "conference";
app_args = switch_core_sprintf(dtdata->pool, "%s@%s", mixer_name, globals.mixer_conf_profile);
rayo_app_args = switch_core_sprintf(dtdata->pool, "conference %s@%s", mixer_name, globals.mixer_conf_profile);
}
} else {
/* default one-legged call */
app = "rayo";
app_args = "";
}
dialstring = switch_core_sprintf(dtdata->pool, "%s%s", gateway->dial_prefix, dial_to_stripped);
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(rayo_call_get_uuid(call)), SWITCH_LOG_DEBUG, "dial: Using dialstring: %s\n", dialstring);
/* <iq><ref> response will be sent when originate event is received- otherwise error is returned */
if (switch_ivr_originate(NULL, &caller_session, &cause, dialstring, dial_timeout_sec, NULL, NULL, NULL, NULL, originate_vars, SOF_NONE, NULL) == SWITCH_STATUS_SUCCESS && caller_session) {
if (switch_ivr_originate(NULL, &called_session, &cause, dialstring, dial_timeout_sec, NULL, NULL, NULL, NULL, originate_vars, SOF_NONE, NULL) == SWITCH_STATUS_SUCCESS && called_session) {
/* start APP */
switch_caller_extension_t *extension = NULL;
switch_channel_t *caller_channel = switch_core_session_get_channel(caller_session);
switch_channel_t *called_channel = switch_core_session_get_channel(called_session);
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(uuid), SWITCH_LOG_DEBUG, "dial: Call originated\n");
if ((extension = switch_caller_extension_new(caller_session, app, app_args)) == 0) {
if ((extension = switch_caller_extension_new(called_session, "rayo", rayo_app_args)) == 0) {
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(rayo_call_get_uuid(call)), SWITCH_LOG_CRIT, "Memory Error!\n");
abort();
}
switch_caller_extension_add_application(caller_session, extension, app, app_args);
switch_channel_set_caller_extension(caller_channel, extension);
switch_channel_set_state(caller_channel, CS_EXECUTE);
switch_core_session_rwunlock(caller_session);
switch_caller_extension_add_application(called_session, extension, "rayo", rayo_app_args);
switch_channel_set_caller_extension(called_channel, extension);
switch_channel_set_state(called_channel, CS_EXECUTE);
switch_core_session_rwunlock(called_session);
} else {
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(uuid), SWITCH_LOG_DEBUG, "dial: Failed to originate call: %s\n", switch_channel_cause2str(cause));
switch_mutex_lock(RAYO_ACTOR(call)->mutex);

View File

@ -0,0 +1 @@
switch_swig_wrap.cpp -diff

View File

@ -0,0 +1 @@
mod_lua_wrap.cpp -diff

View File

@ -0,0 +1,4 @@
*_wrap.cxx -diff
*_wrap.*.cxx -diff
swig.cs -diff
swig.*.cs -diff

View File

@ -0,0 +1 @@
mod_perl_wrap.cpp -diff

View File

@ -0,0 +1 @@
mod_python_wrap.cpp -diff

View File

@ -762,11 +762,26 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
switch_media_bug_t *bp;
switch_bool_t ok = SWITCH_TRUE;
int prune = 0;
switch_time_t now = switch_micro_time_now();
switch_time_t diff = 0;
switch_size_t len = session->read_impl.decoded_bytes_per_packet;
unsigned char fill_data[SWITCH_RECOMMENDED_BUFFER_SIZE] = {0};
switch_thread_rwlock_rdlock(session->bug_rwlock);
if (session->last_read_time && session->last_read_time < now) {
diff = ((now - session->last_read_time) + 3000 ) / session->read_impl.microseconds_per_packet;
if (diff > 1) {
memset(fill_data, 255, len);
}
}
session->last_read_time = switch_micro_time_now();
for (bp = session->bugs; bp; bp = bp->next) {
ok = SWITCH_TRUE;
if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) {
continue;
}
@ -786,6 +801,17 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
if (ok && bp->ready && switch_test_flag(bp, SMBF_READ_STREAM)) {
switch_mutex_lock(bp->read_mutex);
if (diff > 1) {
switch_time_t tdiff = diff;
while(tdiff > 1) {
switch_buffer_write(bp->raw_read_buffer, fill_data, len);
tdiff--;
}
}
if (bp->read_demux_frame) {
uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];
int bytes = read_frame->datalen / 2;
@ -1341,8 +1367,23 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
if (session->bugs) {
switch_media_bug_t *bp;
int prune = 0;
switch_time_t now = switch_micro_time_now();
switch_time_t diff = 0;
switch_size_t len = session->read_impl.decoded_bytes_per_packet;
unsigned char fill_data[SWITCH_RECOMMENDED_BUFFER_SIZE] = {0};
switch_thread_rwlock_rdlock(session->bug_rwlock);
if (session->last_write_time && session->last_write_time < now) {
diff = ((now - session->last_write_time) + 3000 ) / session->read_impl.microseconds_per_packet;
if (diff > 1) {
memset(fill_data, 255, len);
}
}
session->last_write_time = switch_micro_time_now();
for (bp = session->bugs; bp; bp = bp->next) {
switch_bool_t ok = SWITCH_TRUE;
@ -1365,6 +1406,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
if (switch_test_flag(bp, SMBF_WRITE_STREAM)) {
switch_mutex_lock(bp->write_mutex);
if (diff > 1) {
switch_time_t tdiff = diff;
while(tdiff > 1) {
switch_buffer_write(bp->raw_read_buffer, fill_data, len);
tdiff--;
}
}
switch_buffer_write(bp->raw_write_buffer, write_frame->data, write_frame->datalen);
switch_mutex_unlock(bp->write_mutex);

View File

@ -1268,47 +1268,44 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
frame.data = data;
frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
for (;;) {
status = switch_core_media_bug_read(bug, &frame, SWITCH_FALSE);
if (status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK) {
status = switch_core_media_bug_read(bug, &frame, SWITCH_FALSE);
if (status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK) {
len = (switch_size_t) frame.datalen / 2;
len = (switch_size_t) frame.datalen / 2;
if (len && switch_core_file_write(rh->fh, mask ? null_data : data, &len) != SWITCH_STATUS_SUCCESS && rh->hangup_on_error) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error writing %s\n", rh->file);
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
return SWITCH_FALSE;
}
if (len && switch_core_file_write(rh->fh, mask ? null_data : data, &len) != SWITCH_STATUS_SUCCESS && rh->hangup_on_error) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error writing %s\n", rh->file);
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
return SWITCH_FALSE;
}
/* check for silence timeout */
if (rh->silence_threshold) {
switch_codec_implementation_t read_impl = { 0 };
switch_core_session_get_read_impl(session, &read_impl);
if (is_silence_frame(&frame, rh->silence_threshold, &read_impl)) {
if (!rh->silence_time) {
/* start of silence */
rh->silence_time = switch_micro_time_now();
} else {
/* continuing silence */
int duration_ms = (int)((switch_micro_time_now() - rh->silence_time) / 1000);
if (rh->silence_timeout_ms > 0 && duration_ms >= rh->silence_timeout_ms) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Recording file %s timeout: %i >= %i\n", rh->file, duration_ms, rh->silence_timeout_ms);
switch_core_media_bug_set_flag(bug, SMBF_PRUNE);
}
}
} else { /* not silence */
if (rh->silence_time) {
/* end of silence */
rh->silence_time = 0;
/* switch from initial timeout to final timeout */
rh->silence_timeout_ms = rh->final_timeout_ms;
/* check for silence timeout */
if (rh->silence_threshold) {
switch_codec_implementation_t read_impl = { 0 };
switch_core_session_get_read_impl(session, &read_impl);
if (is_silence_frame(&frame, rh->silence_threshold, &read_impl)) {
if (!rh->silence_time) {
/* start of silence */
rh->silence_time = switch_micro_time_now();
} else {
/* continuing silence */
int duration_ms = (int)((switch_micro_time_now() - rh->silence_time) / 1000);
if (rh->silence_timeout_ms > 0 && duration_ms >= rh->silence_timeout_ms) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Recording file %s timeout: %i >= %i\n", rh->file, duration_ms, rh->silence_timeout_ms);
switch_core_media_bug_set_flag(bug, SMBF_PRUNE);
}
}
} else { /* not silence */
if (rh->silence_time) {
/* end of silence */
rh->silence_time = 0;
/* switch from initial timeout to final timeout */
rh->silence_timeout_ms = rh->final_timeout_ms;
}
}
} else {
break;
}
}
}

View File

@ -123,7 +123,7 @@ SWITCH_DECLARE(switch_status_t) switch_limit_incr(const char *backend, switch_co
switch_goto_status(SWITCH_STATUS_GENERR, end);
}
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "incr called: %s_%s max:%d, interval:%d\n",
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "incr called: %s_%s max:%d, interval:%d\n",
realm, resource, max, interval);
if ((status = limit->incr(session, realm, resource, max, interval)) == SWITCH_STATUS_SUCCESS) {