Merge branch 'master' into gsmopen01

This commit is contained in:
Giovanni Maruzzelli 2012-04-13 17:18:03 +02:00
commit f74ba1ae61
43 changed files with 877 additions and 375 deletions

View File

@ -186,6 +186,51 @@ check_libtoolize() {
fi fi
} }
check_make() {
#
# Check to make sure we have GNU Make installed
#
make=`which make`
if [ -x "$make" ]; then
make_version=`$make --version | grep GNU`
if [ $? -ne 0 ]; then
make=`which gmake`
if [ -x "$make" ]; then
make_version=`$make --version | grep GNU`
if [ $? -ne 0 ]; then
echo "GNU Make does not exist or is not executable"
exit 1;
fi
fi
fi
fi
}
check_awk() {
#
# Check to make sure we have GNU Make installed
#
awk=`which awk`
if [ -x "$awk" ]; then
awk_version=`$awk --version | head -n 1 |grep GNU`
if [ $? -ne 0 ]; then
awk=`which gawk`
if [ -x "$awk" ]; then
awk_version=`$awk --version | head -n 1 |grep GNU`
if [ $? -ne 0 ]; then
echo "GNU awk does not exist or is not executable"
exit 1;
fi
fi
fi
fi
}
print_autotools_vers() { print_autotools_vers() {
# #
# Info output # Info output
@ -196,6 +241,8 @@ print_autotools_vers() {
echo " aclocal : ${ACLOCAL:-`which aclocal`}" echo " aclocal : ${ACLOCAL:-`which aclocal`}"
echo " libtool : ${libtool} (${lt_version})" echo " libtool : ${libtool} (${lt_version})"
echo " libtoolize: ${libtoolize}" echo " libtoolize: ${libtoolize}"
echo " make : ${make} (${make_version})"
echo " awk : ${awk} (${awk_version})"
echo echo
} }
@ -426,6 +473,8 @@ bootstrap_libs() {
run() { run() {
setup_modules setup_modules
setup_gnu setup_gnu
check_make
check_awk
check_ac_ver check_ac_ver
check_am_ver check_am_ver
check_acl_ver check_acl_ver

View File

@ -120,6 +120,10 @@
<!-- <param name="ivr-input-timeout" value="0" /> --> <!-- <param name="ivr-input-timeout" value="0" /> -->
<!-- Delay before a conference is asked to be terminated --> <!-- Delay before a conference is asked to be terminated -->
<!-- <param name="endconf-grace-time" value="120" /> --> <!-- <param name="endconf-grace-time" value="120" /> -->
<!-- Can be | delim of wait-mod|audio-always|video-bridge|video-floor-only
wait_mod will wait until the moderator in,
audio-always will always mix audio from all members regardless they are talking or not -->
<!-- <param name="conference-flags" value="audio-always"/> -->
</profile> </profile>
<profile name="wideband"> <profile name="wideband">

View File

@ -180,3 +180,5 @@ case "$1" in
exit 3 exit 3
;; ;;
esac esac
:

View File

@ -491,7 +491,9 @@ ESL_DECLARE(esl_status_t) esl_attach_handle(esl_handle_t *handle, esl_socket_t s
ESL_DECLARE(esl_status_t) esl_sendevent(esl_handle_t *handle, esl_event_t *event) ESL_DECLARE(esl_status_t) esl_sendevent(esl_handle_t *handle, esl_event_t *event)
{ {
char *txt; char *txt;
char event_buf[256] = ""; char *event_buf = NULL;
esl_status_t status = ESL_FAIL;
size_t len = 0;
if (!handle->connected || !event) { if (!handle->connected || !event) {
return ESL_FAIL; return ESL_FAIL;
@ -500,23 +502,20 @@ ESL_DECLARE(esl_status_t) esl_sendevent(esl_handle_t *handle, esl_event_t *event
esl_event_serialize(event, &txt, ESL_FALSE); esl_event_serialize(event, &txt, ESL_FALSE);
esl_log(ESL_LOG_DEBUG, "SEND EVENT\n%s\n", txt); esl_log(ESL_LOG_DEBUG, "SEND EVENT\n%s\n", txt);
snprintf(event_buf, sizeof(event_buf), "sendevent %s\n", esl_event_name(event->event_id));
if (send(handle->sock, event_buf, strlen(event_buf), 0) <= 0) goto fail; len = strlen(txt) + 100;
if (send(handle->sock, txt, strlen(txt), 0) <= 0) goto fail; event_buf = malloc(len);
assert(event_buf);
memset(event_buf, 0, len);
free(txt); snprintf(event_buf, len, "sendevent %s\n%s", esl_event_name(event->event_id), txt);
return esl_recv(handle); status = esl_send_recv(handle, event_buf);
fail:
handle->connected = 0;
free(txt); free(txt);
free(event_buf);
return ESL_FAIL; return status;
} }
@ -554,34 +553,36 @@ ESL_DECLARE(esl_status_t) esl_execute(esl_handle_t *handle, const char *app, con
ESL_DECLARE(esl_status_t) esl_sendmsg(esl_handle_t *handle, esl_event_t *event, const char *uuid) ESL_DECLARE(esl_status_t) esl_sendmsg(esl_handle_t *handle, esl_event_t *event, const char *uuid)
{ {
char cmd_buf[128] = "sendmsg\n"; char *cmd_buf = NULL;
char *txt; char *txt;
size_t len = 0;
esl_status_t status = ESL_FAIL;
if (!handle || !handle->connected || handle->sock == ESL_SOCK_INVALID) { if (!handle || !handle->connected || handle->sock == ESL_SOCK_INVALID) {
return ESL_FAIL; return ESL_FAIL;
} }
esl_event_serialize(event, &txt, ESL_FALSE);
len = strlen(txt) + 100;
cmd_buf = malloc(len);
assert(cmd_buf);
memset(cmd_buf, 0, len);
if (uuid) { if (uuid) {
snprintf(cmd_buf, sizeof(cmd_buf), "sendmsg %s\n", uuid); snprintf(cmd_buf, sizeof(cmd_buf), "sendmsg %s\n%s", uuid, txt);
} else {
snprintf(cmd_buf, sizeof(cmd_buf), "sendmsg\n%s", txt);
} }
esl_event_serialize(event, &txt, ESL_FALSE);
esl_log(ESL_LOG_DEBUG, "%s%s\n", cmd_buf, txt); esl_log(ESL_LOG_DEBUG, "%s%s\n", cmd_buf, txt);
if (send(handle->sock, cmd_buf, strlen(cmd_buf), 0) <= 0) goto fail; status = esl_send_recv(handle, cmd_buf);
if (send(handle->sock, txt, strlen(txt), 0) <= 0) goto fail;
free(txt);
return esl_recv(handle);
fail:
handle->connected = 0;
free(txt); free(txt);
free(cmd_buf);
return ESL_FAIL; return status;
} }

View File

@ -407,22 +407,13 @@ AC_ARG_WITH([misdn],
) )
AS_IF([test "${with_misdn}" != "no"], AS_IF([test "${with_misdn}" != "no"],
[AC_MSG_RESULT([${as_nl}<<>> ftmod_misdn (Linux mISDN I/O plugin)]) [AC_MSG_RESULT([${as_nl}<<>> ftmod_misdn (Linux mISDN I/O plugin)])
AC_CHECK_FUNCS([timerfd_create],, AC_CHECK_HEADER([mISDN/mISDNif.h],
[AS_IF([test "${with_misdn}" = "yes"], [HAVE_MISDN="yes"],
[AC_MSG_ERROR([no timerfd support in libc])],
[AC_MSG_NOTICE([no timerfd support in libc])]
)]
)
AC_CHECK_HEADER([mISDN/mISDNif.h],,
[AS_IF([test "${with_misdn}" = "yes"], [AS_IF([test "${with_misdn}" = "yes"],
[AC_MSG_ERROR([mISDN/mISDNif.h not found])], [AC_MSG_ERROR([mISDN/mISDNif.h not found])],
[AC_MSG_NOTICE([mISDN/mISDNif.h not found])] [AC_MSG_NOTICE([mISDN/mISDNif.h not found])]
)], )],
[#include <sys/socket.h>] [#include <sys/socket.h>]
)
AS_IF([test "${ac_cv_func_timerfd_create}" = "yes" -a "${ac_cv_header_mISDN_mISDNif_h}" = "yes"],
[HAVE_MISDN="yes"],
[AC_MSG_NOTICE([Some required dependencies are missing, module disabled])]
)] )]
) )
AM_CONDITIONAL([HAVE_MISDN], [test "${HAVE_MISDN}" = "yes"]) AM_CONDITIONAL([HAVE_MISDN], [test "${HAVE_MISDN}" = "yes"])

View File

@ -45,8 +45,6 @@
#include <poll.h> #include <poll.h>
#include <pthread.h> #include <pthread.h>
#include <sys/timerfd.h>
/* this is how it should have been... /* this is how it should have been...
#ifdef HAVE_FREETDM_FREETDM_H #ifdef HAVE_FREETDM_FREETDM_H
#include <freetdm/freetdm.h> #include <freetdm/freetdm.h>
@ -256,7 +254,6 @@ struct misdn_chan_private {
/* */ /* */
int state; int state;
int debugfd; int debugfd;
int timerfd;
int active; int active;
/* hw addr of channel */ /* hw addr of channel */
@ -941,36 +938,7 @@ static FIO_OPEN_FUNCTION(misdn_open)
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "mISDN channel activation request sent\n"); ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "mISDN channel activation request sent\n");
switch (ftdmchan->type) { switch (ftdmchan->type) {
case FTDM_CHAN_TYPE_B: { case FTDM_CHAN_TYPE_B:
#if 0
struct itimerspec its = {
.it_interval = { 0, 0 },
.it_value = { 0, 0 },
};
its.it_interval.tv_nsec = (ftdmchan->effective_interval * 1000000);
its.it_value.tv_nsec = (ftdmchan->effective_interval * 1000000);
/* create tx timerfd */
chan_priv->timerfd = timerfd_create(CLOCK_MONOTONIC, O_NONBLOCK);
if (chan_priv->timerfd < 0) {
ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "mISDN failed to create b-channel tx interval timer: %s\n",
strerror(errno));
return FTDM_FAIL;
}
/* start tx timerfd */
ret = timerfd_settime(chan_priv->timerfd, 0, &its, NULL);
if (ret < 0) {
ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "mISDN failed to start b-channel tx interval timer: %s\n",
strerror(errno));
return FTDM_FAIL;
}
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "mISDN created tx interval (%d ms) timer\n",
ftdmchan->effective_interval);
#endif
}
case FTDM_CHAN_TYPE_DQ921: case FTDM_CHAN_TYPE_DQ921:
chan_priv->state = MISDN_CHAN_STATE_OPEN; chan_priv->state = MISDN_CHAN_STATE_OPEN;
break; break;
@ -998,15 +966,6 @@ static FIO_CLOSE_FUNCTION(misdn_close)
/* deactivate b-channels on close */ /* deactivate b-channels on close */
if (ftdm_channel_get_type(ftdmchan) == FTDM_CHAN_TYPE_B) { if (ftdm_channel_get_type(ftdmchan) == FTDM_CHAN_TYPE_B) {
#if 0
/*
* Stop tx timerfd
*/
if (chan_priv->timerfd >= 0) {
close(chan_priv->timerfd);
chan_priv->timerfd = -1;
}
#endif
/* /*
* Send deactivation request (don't wait for answer) * Send deactivation request (don't wait for answer)
*/ */
@ -1570,7 +1529,6 @@ static ftdm_status_t misdn_open_range(ftdm_span_t *span, ftdm_chan_type_t type,
priv->addr = addr; priv->addr = addr;
priv->debugfd = -1; priv->debugfd = -1;
priv->timerfd = -1;
/* /*
* Create event queue * Create event queue

View File

@ -1 +1 @@
Wed Apr 4 16:17:37 CDT 2012 Tue Apr 10 16:19:10 CDT 2012

View File

@ -1212,10 +1212,12 @@ int nua_base_client_check_restart(nua_client_request_t *cr,
return 1; return 1;
} }
} }
/* GriGiu : RFC-3261 status supported Retry-After */
if (0 && 500 <= status && status < 600 && if ( (status == 404 || status == 413 || status == 480 || status == 486 ||
status == 500 || status == 503 ||
status == 600 || status == 603) &&
sip->sip_retry_after && sip->sip_retry_after &&
sip->sip_retry_after->af_delta < 32) { sip->sip_retry_after->af_delta < 3200) {
su_timer_t *timer; su_timer_t *timer;
char phrase[18]; /* Retry After XXXX\0 */ char phrase[18]; /* Retry After XXXX\0 */

View File

@ -273,6 +273,7 @@ SWITCH_DECLARE(const char *) switch_channel_get_hold_music_partner(switch_channe
SWITCH_DECLARE(uint32_t) switch_channel_del_variable_prefix(switch_channel_t *channel, const char *prefix); SWITCH_DECLARE(uint32_t) switch_channel_del_variable_prefix(switch_channel_t *channel, const char *prefix);
#define switch_channel_set_variable_safe(_channel, _var, _val) switch_channel_set_variable_var_check(_channel, _var, _val, SWITCH_FALSE)
#define switch_channel_set_variable(_channel, _var, _val) switch_channel_set_variable_var_check(_channel, _var, _val, SWITCH_TRUE) #define switch_channel_set_variable(_channel, _var, _val) switch_channel_set_variable_var_check(_channel, _var, _val, SWITCH_TRUE)
#define switch_channel_set_variable_partner(_channel, _var, _val) switch_channel_set_variable_partner_var_check(_channel, _var, _val, SWITCH_TRUE) #define switch_channel_set_variable_partner(_channel, _var, _val) switch_channel_set_variable_partner_var_check(_channel, _var, _val, SWITCH_TRUE)
@ -592,8 +593,8 @@ SWITCH_DECLARE(void) switch_channel_event_set_extended_data(_In_ switch_channel_
\return the original string if no expansion takes place otherwise a new string that must be freed \return the original string if no expansion takes place otherwise a new string that must be freed
\note it's necessary to test if the return val is the same as the input and free the string if it is not. \note it's necessary to test if the return val is the same as the input and free the string if it is not.
*/ */
SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *channel, const char *in, switch_event_t *var_list, switch_event_t *api_list); SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *channel, const char *in, switch_event_t *var_list, switch_event_t *api_list, uint32_t recur);
#define switch_channel_expand_variables(_channel, _in) switch_channel_expand_variables_check(_channel, _in, NULL, NULL) #define switch_channel_expand_variables(_channel, _in) switch_channel_expand_variables_check(_channel, _in, NULL, NULL, 0)
SWITCH_DECLARE(char *) switch_channel_build_param_string(_In_ switch_channel_t *channel, _In_opt_ switch_caller_profile_t *caller_profile, SWITCH_DECLARE(char *) switch_channel_build_param_string(_In_ switch_channel_t *channel, _In_opt_ switch_caller_profile_t *caller_profile,

View File

@ -330,8 +330,8 @@ SWITCH_DECLARE(switch_status_t) switch_event_add_body(switch_event_t *event, con
SWITCH_DECLARE(switch_status_t) switch_event_set_body(switch_event_t *event, const char *body); SWITCH_DECLARE(switch_status_t) switch_event_set_body(switch_event_t *event, const char *body);
SWITCH_DECLARE(char *) switch_event_expand_headers_check(switch_event_t *event, const char *in, switch_event_t *var_list, switch_event_t *api_list); SWITCH_DECLARE(char *) switch_event_expand_headers_check(switch_event_t *event, const char *in, switch_event_t *var_list, switch_event_t *api_list, uint32_t recur);
#define switch_event_expand_headers(_event, _in) switch_event_expand_headers_check(_event, _in, NULL, NULL) #define switch_event_expand_headers(_event, _in) switch_event_expand_headers_check(_event, _in, NULL, NULL, 0)
SWITCH_DECLARE(switch_status_t) switch_event_create_pres_in_detailed(_In_z_ char *file, _In_z_ char *func, _In_ int line, SWITCH_DECLARE(switch_status_t) switch_event_create_pres_in_detailed(_In_z_ char *file, _In_z_ char *func, _In_ int line,
_In_z_ const char *proto, _In_z_ const char *login, _In_z_ const char *proto, _In_z_ const char *login,

View File

@ -188,7 +188,7 @@ static switch_bool_t cidlookup_execute_sql_callback(char *sql, switch_core_db_ca
switch_bool_t retval = SWITCH_FALSE; switch_bool_t retval = SWITCH_FALSE;
switch_cache_db_handle_t *dbh = NULL; switch_cache_db_handle_t *dbh = NULL;
if (globals.odbc_dsn && (dbh = cidlookup_get_db_handle())) { if (!zstr(globals.odbc_dsn) && (dbh = cidlookup_get_db_handle())) {
if (switch_cache_db_execute_sql_callback(dbh, sql, callback, (void *) cbt, err) != SWITCH_STATUS_SUCCESS) { if (switch_cache_db_execute_sql_callback(dbh, sql, callback, (void *) cbt, err) != SWITCH_STATUS_SUCCESS) {
retval = SWITCH_FALSE; retval = SWITCH_FALSE;
} else { } else {
@ -533,7 +533,7 @@ static char *do_db_lookup(switch_memory_pool_t *pool, switch_event_t *event, con
callback_t cbt = { 0 }; callback_t cbt = { 0 };
cbt.pool = pool; cbt.pool = pool;
if (globals.odbc_dsn) { if (!zstr(globals.odbc_dsn)) {
newsql = switch_event_expand_headers(event, sql); newsql = switch_event_expand_headers(event, sql);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "SQL: %s\n", newsql); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "SQL: %s\n", newsql);
if (cidlookup_execute_sql_callback(newsql, cidlookup_callback, &cbt, &err)) { if (cidlookup_execute_sql_callback(newsql, cidlookup_callback, &cbt, &err)) {
@ -655,8 +655,6 @@ static cid_data_t *do_lookup(switch_memory_pool_t *pool, switch_event_t *event,
SWITCH_STANDARD_APP(cidlookup_app_function) SWITCH_STANDARD_APP(cidlookup_app_function)
{ {
switch_status_t status = SWITCH_STATUS_SUCCESS;
char *argv[4] = { 0 }; char *argv[4] = { 0 };
int argc; int argc;
char *mydata = NULL; char *mydata = NULL;
@ -705,7 +703,7 @@ SWITCH_STANDARD_APP(cidlookup_app_function)
if (switch_string_var_check_const(cid->name)) { if (switch_string_var_check_const(cid->name)) {
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_CRIT, "Invalid CID data {%s} contains a variable\n", cid->name); switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_CRIT, "Invalid CID data {%s} contains a variable\n", cid->name);
switch_goto_status(SWITCH_STATUS_GENERR, done); goto done;
} }
if (cid && channel) { if (cid && channel) {
@ -719,7 +717,6 @@ SWITCH_STANDARD_APP(cidlookup_app_function)
profile->caller_id_name = switch_core_strdup(profile->pool, cid->name);; profile->caller_id_name = switch_core_strdup(profile->pool, cid->name);;
} }
switch_goto_status(SWITCH_STATUS_SUCCESS, done);
done: done:
if (event) { if (event) {
@ -728,9 +725,6 @@ SWITCH_STANDARD_APP(cidlookup_app_function)
if (!session && pool) { if (!session && pool) {
switch_core_destroy_memory_pool(&pool); switch_core_destroy_memory_pool(&pool);
} }
/* This is so compile doesn't failed because status is never used */
if (status) {
}
} }
SWITCH_STANDARD_API(cidlookup_function) SWITCH_STANDARD_API(cidlookup_function)

View File

@ -120,6 +120,10 @@
<!-- <param name="ivr-input-timeout" value="0" /> --> <!-- <param name="ivr-input-timeout" value="0" /> -->
<!-- Delay before a conference is asked to be terminated --> <!-- Delay before a conference is asked to be terminated -->
<!-- <param name="endconf-grace-time" value="120" /> --> <!-- <param name="endconf-grace-time" value="120" /> -->
<!-- Can be | delim of wait-mod|audio-always|video-bridge|video-floor-only
wait_mod will wait until the moderator in,
audio-always will always mix audio from all members regardless they are talking or not -->
<!-- <param name="conference-flags" value="audio-always"/> -->
</profile> </profile>
<profile name="wideband"> <profile name="wideband">

View File

@ -174,7 +174,8 @@ typedef enum {
CFLAG_INHASH = (1 << 11), CFLAG_INHASH = (1 << 11),
CFLAG_EXIT_SOUND = (1 << 12), CFLAG_EXIT_SOUND = (1 << 12),
CFLAG_ENTER_SOUND = (1 << 13), CFLAG_ENTER_SOUND = (1 << 13),
CFLAG_VIDEO_BRIDGE = (1 << 14) CFLAG_VIDEO_BRIDGE = (1 << 14),
CFLAG_AUDIO_ALWAYS = (1 << 15)
} conf_flag_t; } conf_flag_t;
typedef enum { typedef enum {
@ -2670,8 +2671,8 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, v
} }
/* skip frames that are not actual media or when we are muted or silent */ /* skip frames that are not actual media or when we are muted or silent */
if ((switch_test_flag(member, MFLAG_TALKING) || member->energy_level == 0) && switch_test_flag(member, MFLAG_CAN_SPEAK) && if ((switch_test_flag(member, MFLAG_TALKING) || member->energy_level == 0 || switch_test_flag(member->conference, CFLAG_AUDIO_ALWAYS))
!switch_test_flag(member->conference, CFLAG_WAIT_MOD)) { && switch_test_flag(member, MFLAG_CAN_SPEAK) && !switch_test_flag(member->conference, CFLAG_WAIT_MOD)) {
switch_audio_resampler_t *read_resampler = member->read_resampler; switch_audio_resampler_t *read_resampler = member->read_resampler;
void *data; void *data;
uint32_t datalen; uint32_t datalen;
@ -4426,6 +4427,10 @@ static void conference_xlist(conference_obj_t *conference, switch_xml_t x_confer
switch_xml_set_attr_d(x_conference, "wait_mod", "true"); switch_xml_set_attr_d(x_conference, "wait_mod", "true");
} }
if (switch_test_flag(conference, CFLAG_AUDIO_ALWAYS)) {
switch_xml_set_attr_d(x_conference, "audio_always", "true");
}
if (switch_test_flag(conference, CFLAG_RUNNING)) { if (switch_test_flag(conference, CFLAG_RUNNING)) {
switch_xml_set_attr_d(x_conference, "running", "true"); switch_xml_set_attr_d(x_conference, "running", "true");
} }
@ -5962,6 +5967,8 @@ static void set_cflags(const char *flags, uint32_t *f)
*f |= CFLAG_VID_FLOOR; *f |= CFLAG_VID_FLOOR;
} else if (!strcasecmp(argv[i], "video-bridge")) { } else if (!strcasecmp(argv[i], "video-bridge")) {
*f |= CFLAG_VIDEO_BRIDGE; *f |= CFLAG_VIDEO_BRIDGE;
} else if (!strcasecmp(argv[i], "audio-always")) {
*f |= CFLAG_AUDIO_ALWAYS;
} }
} }

View File

@ -1121,7 +1121,7 @@ static switch_status_t messagehook (switch_core_session_t *session, switch_core_
"(fifo_name,caller_uuid,caller_caller_id_name,caller_caller_id_number,consumer_uuid,consumer_outgoing_uuid,bridge_start) " "(fifo_name,caller_uuid,caller_caller_id_name,caller_caller_id_number,consumer_uuid,consumer_outgoing_uuid,bridge_start) "
"values ('%q','%q','%q','%q','%q','%q',%ld)", "values ('%q','%q','%q','%q','%q','%q',%ld)",
MANUAL_QUEUE_NAME, MANUAL_QUEUE_NAME,
"N/A", (msg->string_arg && strchr(msg->string_arg, '-')) ? msg->string_arg : "00000000-0000-0000-0000-000000000000",
ced_name, ced_name,
ced_number, ced_number,
switch_core_session_get_uuid(session), switch_core_session_get_uuid(session),

View File

@ -1142,7 +1142,8 @@ static switch_status_t parse_xml(client_t *client)
switch_channel_get_variables(client->channel, &templ_data); switch_channel_get_variables(client->channel, &templ_data);
switch_event_merge(templ_data, client->params); switch_event_merge(templ_data, client->params);
expanded = switch_event_expand_headers_check(templ_data, tag->txt, expanded = switch_event_expand_headers_check(templ_data, tag->txt,
client->profile->var_params.expand_var_list, client->profile->var_params.api_list); client->profile->var_params.expand_var_list,
client->profile->var_params.api_list, 0);
switch_event_destroy(&templ_data); switch_event_destroy(&templ_data);
} }

View File

@ -43,12 +43,17 @@ typedef struct {
uint32_t last_digit_end; uint32_t last_digit_end;
uint32_t digit_begin; uint32_t digit_begin;
uint32_t min_dup_digit_spacing; uint32_t min_dup_digit_spacing;
int twist;
int reverse_twist;
int filter_dialtone;
int threshold;
} switch_inband_dtmf_t; } switch_inband_dtmf_t;
static void spandsp_dtmf_rx_realtime_callback(void *user_data, int code, int level, int delay) static void spandsp_dtmf_rx_realtime_callback(void *user_data, int code, int level, int duration)
{ {
switch_inband_dtmf_t *pvt = (switch_inband_dtmf_t *)user_data; switch_inband_dtmf_t *pvt = (switch_inband_dtmf_t *)user_data;
char digit = (char)code; char digit = (char)code;
pvt->samples += duration;
if (digit) { if (digit) {
/* prevent duplicate DTMF */ /* prevent duplicate DTMF */
if (digit != pvt->last_digit || (pvt->samples - pvt->last_digit_end) > pvt->min_dup_digit_spacing) { if (digit != pvt->last_digit || (pvt->samples - pvt->last_digit_end) > pvt->min_dup_digit_spacing) {
@ -74,16 +79,12 @@ static switch_bool_t inband_dtmf_callback(switch_media_bug_t *bug, void *user_da
{ {
switch_inband_dtmf_t *pvt = (switch_inband_dtmf_t *) user_data; switch_inband_dtmf_t *pvt = (switch_inband_dtmf_t *) user_data;
switch_frame_t *frame = NULL; switch_frame_t *frame = NULL;
switch_channel_t *channel = switch_core_session_get_channel(pvt->session);
switch (type) { switch (type) {
case SWITCH_ABC_TYPE_INIT: { case SWITCH_ABC_TYPE_INIT: {
const char *min_dup_digit_spacing_str = switch_channel_get_variable(channel, "min_dup_digit_spacing_ms");
pvt->dtmf_detect = dtmf_rx_init(NULL, NULL, NULL); pvt->dtmf_detect = dtmf_rx_init(NULL, NULL, NULL);
dtmf_rx_parms(pvt->dtmf_detect, pvt->filter_dialtone, pvt->twist, pvt->reverse_twist, pvt->threshold);
dtmf_rx_set_realtime_callback(pvt->dtmf_detect, spandsp_dtmf_rx_realtime_callback, pvt); dtmf_rx_set_realtime_callback(pvt->dtmf_detect, spandsp_dtmf_rx_realtime_callback, pvt);
if (!zstr(min_dup_digit_spacing_str)) {
pvt->min_dup_digit_spacing = atoi(min_dup_digit_spacing_str) * 8;
}
break; break;
} }
case SWITCH_ABC_TYPE_CLOSE: case SWITCH_ABC_TYPE_CLOSE:
@ -93,7 +94,6 @@ static switch_bool_t inband_dtmf_callback(switch_media_bug_t *bug, void *user_da
break; break;
case SWITCH_ABC_TYPE_READ_REPLACE: case SWITCH_ABC_TYPE_READ_REPLACE:
if ((frame = switch_core_media_bug_get_read_replace_frame(bug))) { if ((frame = switch_core_media_bug_get_read_replace_frame(bug))) {
pvt->samples += frame->samples;
dtmf_rx(pvt->dtmf_detect, frame->data, frame->samples); dtmf_rx(pvt->dtmf_detect, frame->data, frame->samples);
switch_core_media_bug_set_read_replace_frame(bug, frame); switch_core_media_bug_set_read_replace_frame(bug, frame);
} }
@ -126,6 +126,7 @@ switch_status_t spandsp_inband_dtmf_session(switch_core_session_t *session)
switch_status_t status; switch_status_t status;
switch_inband_dtmf_t *pvt; switch_inband_dtmf_t *pvt;
switch_codec_implementation_t read_impl = { 0 }; switch_codec_implementation_t read_impl = { 0 };
const char *value;
switch_core_session_get_read_impl(session, &read_impl); switch_core_session_get_read_impl(session, &read_impl);
@ -133,8 +134,60 @@ switch_status_t spandsp_inband_dtmf_session(switch_core_session_t *session)
return SWITCH_STATUS_MEMERR; return SWITCH_STATUS_MEMERR;
} }
pvt->session = session; pvt->session = session;
/* get detector params */
pvt->min_dup_digit_spacing = 0;
value = switch_channel_get_variable(channel, "min_dup_digit_spacing_ms");
if (!zstr(value) && switch_is_number(value)) {
int val = atoi(value) * 8; /* convert from ms to samples */
if (val < 0) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "min_dup_digit_spacing_ms must be >= 0\n");
} else {
pvt->min_dup_digit_spacing = val;
}
}
pvt->threshold = -100;
value = switch_channel_get_variable(channel, "spandsp_dtmf_rx_threshold");
if (!zstr(value) && switch_is_number(value)) {
int val = atoi(value);
if (val < -99) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "spandsp_dtmf_rx_threshold must be >= -99 dBm0\n");
} else {
pvt->threshold = val;
}
}
pvt->twist = -1;
value = switch_channel_get_variable(channel, "spandsp_dtmf_rx_twist");
if (!zstr(value) && switch_is_number(value)) {
int val = atoi(value);
if (val < 0) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "spandsp_dtmf_rx_twist must be >= 0 dB\n");
} else {
pvt->twist = val;
}
}
pvt->reverse_twist = -1;
value = switch_channel_get_variable(channel, "spandsp_dtmf_rx_reverse_twist");
if (!zstr(value) && switch_is_number(value)) {
int val = atoi(value);
if (val < 0) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "spandsp_dtmf_rx_reverse_twist must be >= 0 dB\n");
} else {
pvt->reverse_twist = val;
}
}
pvt->filter_dialtone = -1;
value = switch_channel_get_variable(channel, "spandsp_dtmf_rx_filter_dialtone");
if (switch_true(value)) {
pvt->filter_dialtone = 1;
} else if (switch_false(value)) {
pvt->filter_dialtone = 0;
}
if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) { if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;

View File

@ -629,6 +629,7 @@ vm_profile_t *profile_set_config(vm_profile_t *profile)
SWITCH_CONFIG_SET_ITEM(profile->config[i++], "email_date-fmt", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, SWITCH_CONFIG_SET_ITEM(profile->config[i++], "email_date-fmt", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
&profile->date_fmt, "%A, %B %d %Y, %I:%M %p", &profile->config_str_pool, NULL, NULL); &profile->date_fmt, "%A, %B %d %Y, %I:%M %p", &profile->config_str_pool, NULL, NULL);
SWITCH_CONFIG_SET_ITEM(profile->config[i++], "odbc-dsn", SWITCH_CONFIG_STRING, 0, &profile->odbc_dsn, NULL, &profile->config_str_pool, NULL, NULL); SWITCH_CONFIG_SET_ITEM(profile->config[i++], "odbc-dsn", SWITCH_CONFIG_STRING, 0, &profile->odbc_dsn, NULL, &profile->config_str_pool, NULL, NULL);
SWITCH_CONFIG_SET_ITEM(profile->config[i++], "dbname", SWITCH_CONFIG_STRING, 0, &profile->dbname, NULL, &profile->config_str_pool, NULL, NULL);
SWITCH_CONFIG_SET_ITEM_CALLBACK(profile->config[i++], "email_template-file", SWITCH_CONFIG_CUSTOM, CONFIG_RELOADABLE, SWITCH_CONFIG_SET_ITEM_CALLBACK(profile->config[i++], "email_template-file", SWITCH_CONFIG_CUSTOM, CONFIG_RELOADABLE,
NULL, NULL, profile, vm_config_email_callback, NULL, NULL); NULL, NULL, profile, vm_config_email_callback, NULL, NULL);
SWITCH_CONFIG_SET_ITEM_CALLBACK(profile->config[i++], "email_notify-template-file", SWITCH_CONFIG_CUSTOM, CONFIG_RELOADABLE, SWITCH_CONFIG_SET_ITEM_CALLBACK(profile->config[i++], "email_notify-template-file", SWITCH_CONFIG_CUSTOM, CONFIG_RELOADABLE,
@ -722,7 +723,9 @@ static vm_profile_t *load_profile(const char *profile_name)
} }
} }
profile->dbname = switch_core_sprintf(profile->pool, "voicemail_%s", profile_name); if (zstr(profile->dbname)) {
profile->dbname = switch_core_sprintf(profile->pool, "voicemail_%s", profile_name);
}
if (!(dbh = vm_get_db_handle(profile))) { if (!(dbh = vm_get_db_handle(profile))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot open DB!\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot open DB!\n");

View File

@ -117,51 +117,143 @@ struct speex_context {
static switch_status_t switch_speex_fmtp_parse(const char *fmtp, switch_codec_fmtp_t *codec_fmtp) static switch_status_t switch_speex_fmtp_parse(const char *fmtp, switch_codec_fmtp_t *codec_fmtp)
{ {
if (codec_fmtp) { speex_codec_settings_t *codec_settings = NULL;
speex_codec_settings_t *codec_settings = NULL; int x, argc;
if (codec_fmtp->private_info) { char *argv[10];
codec_settings = codec_fmtp->private_info; char *fmtp_dup = NULL;
memcpy(codec_settings, &default_codec_settings, sizeof(*codec_settings));
}
if (fmtp) { if (!codec_fmtp) {
int x, argc; return SWITCH_STATUS_FALSE;
char *argv[10]; }
char *fmtp_dup = strdup(fmtp);
switch_assert(fmtp_dup); /* load default settings */
if (codec_fmtp->private_info) {
argc = switch_separate_string(fmtp_dup, ';', argv, (sizeof(argv) / sizeof(argv[0]))); codec_settings = codec_fmtp->private_info;
memcpy(codec_settings, &default_codec_settings, sizeof(*codec_settings));
for (x = 0; x < argc; x++) { } else {
char *data = argv[x]; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "codec_fmtp->private_info is NULL\n");
char *arg;
switch_assert(data);
while (*data == ' ') {
data++;
}
if ((arg = strchr(data, '='))) {
*arg++ = '\0';
/*
if (!strcasecmp(data, "bitrate")) {
bit_rate = atoi(arg);
}
*/
/*
if (codec_settings) {
if (!strcasecmp(data, "vad")) {
bit_rate = atoi(arg);
}
}
*/
}
}
free(fmtp_dup);
}
/*codec_fmtp->bits_per_second = bit_rate;*/
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
return SWITCH_STATUS_FALSE;
if (!fmtp) {
return SWITCH_STATUS_SUCCESS;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "got fmtp: %s\n", fmtp);
fmtp_dup = strdup(fmtp);
switch_assert(fmtp_dup);
/* parse ; separated fmtp args */
argc = switch_separate_string(fmtp_dup, ';', argv, (sizeof(argv) / sizeof(argv[0])));
for (x = 0; x < argc; x++) {
char *data = argv[x];
char *arg;
switch_assert(data);
while (*data == ' ') {
data++;
}
if (!(arg = strchr(data, '='))) {
continue;
}
*arg++ = '\0';
if (zstr(arg)) {
continue;
}
if (!strcasecmp("vbr", data)) {
/* vbr can be on/off/vad */
if (!strcasecmp("vad", arg)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "enabling speex vbr=vad\n");
codec_settings->vbr = 0;
codec_settings->vad = 1;
codec_settings->pp_vad = 1;
} else {
if (switch_true(arg)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "enabling speex vbr\n");
codec_settings->vbr = 1;
codec_settings->vad = 0;
codec_settings->pp_vad = 1;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "disabling speex vbr\n");
codec_settings->vbr = 0;
codec_settings->vad = 0;
codec_settings->pp_vad = 0;
}
}
} else if (!strcasecmp("cng", data)) {
/* TODO don't know how to turn on CNG */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "speex cng is unsupported\n");
} else if (!strcasecmp("mode", data)) {
/* mode is a comma-separate list of preferred modes. Use the first mode in the list */
char *arg_dup;
char *mode[2];
if (!strncasecmp("any", arg, 3)) {
/* "any", keep the default setting */
continue;
}
arg_dup = strdup(arg);
if (switch_separate_string(arg_dup, ',', mode, (sizeof(mode) / sizeof(mode[0])))) {
int mode_num = -1;
char *mode_str = mode[0];
if (mode_str[0] == '"') {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "mode starts with \"\n");
mode_str++;
}
if (switch_is_number(mode_str)) {
mode_num = atoi(mode_str);
}
/* TODO there might be a way to set the mode directly instead of changing the quality */
if (codec_fmtp->actual_samples_per_second == 8000) {
switch (mode_num) {
case 1:
codec_settings->quality = 0;
break;
case 2:
codec_settings->quality = 2;
break;
case 3:
codec_settings->quality = 4;
break;
case 4:
codec_settings->quality = 6;
break;
case 5:
codec_settings->quality = 8;
break;
case 6:
codec_settings->quality = 9;
break;
case 7:
codec_settings->quality = 10;
break;
case 8:
codec_settings->quality = 1;
break;
default:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "ignoring invalid speex/8000 mode %s\n", mode_str);
continue;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "choosing speex/8000 mode %s\n", mode_str);
codec_settings->quality = codec_settings->quality;
codec_settings->vbr_quality = codec_settings->quality;
} else {
if (mode_num >= 0 && mode_num <= 10) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "choosing speex/%d mode %s\n", codec_fmtp->actual_samples_per_second, mode_str);
codec_settings->quality = mode_num;
codec_settings->vbr_quality = mode_num;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "ignoring invalid speex/%d mode %s\n", codec_fmtp->actual_samples_per_second, mode_str);
continue;
}
}
}
free(arg_dup);
}
}
free(fmtp_dup);
/*codec_fmtp->bits_per_second = bit_rate;*/
return SWITCH_STATUS_SUCCESS;
} }
@ -182,6 +274,7 @@ static switch_status_t switch_speex_init(switch_codec_t *codec, switch_codec_fla
memset(&codec_fmtp, '\0', sizeof(struct switch_codec_fmtp)); memset(&codec_fmtp, '\0', sizeof(struct switch_codec_fmtp));
codec_fmtp.private_info = &codec_settings; codec_fmtp.private_info = &codec_settings;
codec_fmtp.actual_samples_per_second = codec->implementation->actual_samples_per_second;
switch_speex_fmtp_parse(codec->fmtp_in, &codec_fmtp); switch_speex_fmtp_parse(codec->fmtp_in, &codec_fmtp);
memcpy(&context->codec_settings, &codec_settings, sizeof(context->codec_settings)); memcpy(&context->codec_settings, &codec_settings, sizeof(context->codec_settings));
@ -205,11 +298,24 @@ static switch_status_t switch_speex_init(switch_codec_t *codec, switch_codec_fla
speex_encoder_ctl(context->encoder_state, SPEEX_GET_FRAME_SIZE, &context->encoder_frame_size); speex_encoder_ctl(context->encoder_state, SPEEX_GET_FRAME_SIZE, &context->encoder_frame_size);
speex_encoder_ctl(context->encoder_state, SPEEX_SET_COMPLEXITY, &context->codec_settings.complexity); speex_encoder_ctl(context->encoder_state, SPEEX_SET_COMPLEXITY, &context->codec_settings.complexity);
if (context->codec_settings.preproc) { if (context->codec_settings.preproc) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "preprocessor on\n");
context->pp = speex_preprocess_state_init(context->encoder_frame_size, codec->implementation->actual_samples_per_second); context->pp = speex_preprocess_state_init(context->encoder_frame_size, codec->implementation->actual_samples_per_second);
if (context->codec_settings.pp_vad) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "preprocessor vad on\n");
}
speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_VAD, &context->codec_settings.pp_vad); speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_VAD, &context->codec_settings.pp_vad);
if (context->codec_settings.pp_agc) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "preprocessor agc on\n");
}
speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_AGC, &context->codec_settings.pp_agc); speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_AGC, &context->codec_settings.pp_agc);
speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_AGC_LEVEL, &context->codec_settings.pp_agc_level); speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_AGC_LEVEL, &context->codec_settings.pp_agc_level);
if (context->codec_settings.pp_denoise) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "preprocessor denoise on\n");
}
speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_DENOISE, &context->codec_settings.pp_denoise); speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_DENOISE, &context->codec_settings.pp_denoise);
if (context->codec_settings.pp_dereverb) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "preprocessor dereverb on\n");
}
speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_DEREVERB, &context->codec_settings.pp_dereverb); speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_DEREVERB, &context->codec_settings.pp_dereverb);
speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_DEREVERB_DECAY, &context->codec_settings.pp_dereverb_decay); speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_DEREVERB_DECAY, &context->codec_settings.pp_dereverb_decay);
speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_DEREVERB_LEVEL, &context->codec_settings.pp_dereverb_level); speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_DEREVERB_LEVEL, &context->codec_settings.pp_dereverb_level);
@ -218,17 +324,21 @@ static switch_status_t switch_speex_init(switch_codec_t *codec, switch_codec_fla
if (!context->codec_settings.abr && !context->codec_settings.vbr) { if (!context->codec_settings.abr && !context->codec_settings.vbr) {
speex_encoder_ctl(context->encoder_state, SPEEX_SET_QUALITY, &context->codec_settings.quality); speex_encoder_ctl(context->encoder_state, SPEEX_SET_QUALITY, &context->codec_settings.quality);
if (context->codec_settings.vad) { if (context->codec_settings.vad) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "vad on\n");
speex_encoder_ctl(context->encoder_state, SPEEX_SET_VAD, &context->codec_settings.vad); speex_encoder_ctl(context->encoder_state, SPEEX_SET_VAD, &context->codec_settings.vad);
} }
} }
if (context->codec_settings.vbr) { if (context->codec_settings.vbr) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "vbr on\n");
speex_encoder_ctl(context->encoder_state, SPEEX_SET_VBR, &context->codec_settings.vbr); speex_encoder_ctl(context->encoder_state, SPEEX_SET_VBR, &context->codec_settings.vbr);
speex_encoder_ctl(context->encoder_state, SPEEX_SET_VBR_QUALITY, &context->codec_settings.vbr_quality); speex_encoder_ctl(context->encoder_state, SPEEX_SET_VBR_QUALITY, &context->codec_settings.vbr_quality);
} }
if (context->codec_settings.abr) { if (context->codec_settings.abr) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "abr on\n");
speex_encoder_ctl(context->encoder_state, SPEEX_SET_ABR, &context->codec_settings.abr); speex_encoder_ctl(context->encoder_state, SPEEX_SET_ABR, &context->codec_settings.abr);
} }
if (context->codec_settings.dtx) { if (context->codec_settings.dtx) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "dtx on\n");
speex_encoder_ctl(context->encoder_state, SPEEX_SET_DTX, &context->codec_settings.dtx); speex_encoder_ctl(context->encoder_state, SPEEX_SET_DTX, &context->codec_settings.dtx);
} }
} }
@ -243,6 +353,7 @@ static switch_status_t switch_speex_init(switch_codec_t *codec, switch_codec_fla
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "initialized Speex codec \n");
codec->private_info = context; codec->private_info = context;
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
@ -279,17 +390,15 @@ static switch_status_t switch_speex_encode(switch_codec_t *codec,
if (is_speech) { if (is_speech) {
switch_clear_flag(context, SWITCH_CODEC_FLAG_SILENCE); switch_clear_flag(context, SWITCH_CODEC_FLAG_SILENCE);
*flag |= SWITCH_CODEC_FLAG_SILENCE_STOP;
*flag &= ~SFF_CNG; *flag &= ~SFF_CNG;
} else { } else {
if (switch_test_flag(context, SWITCH_CODEC_FLAG_SILENCE)) { if (switch_test_flag(context, SWITCH_CODEC_FLAG_SILENCE)) {
*encoded_data_len = 0; *encoded_data_len = 0;
*flag |= SWITCH_CODEC_FLAG_SILENCE | SFF_CNG; *flag |= SFF_CNG;
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
switch_set_flag(context, SWITCH_CODEC_FLAG_SILENCE); switch_set_flag(context, SWITCH_CODEC_FLAG_SILENCE);
*flag |= SWITCH_CODEC_FLAG_SILENCE_START;
} }

View File

@ -1,3 +1,4 @@
LIBS+=$(PA_LIBS)
include $(top_srcdir)/build/modmake.rulesam include $(top_srcdir)/build/modmake.rulesam
MODNAME=mod_portaudio MODNAME=mod_portaudio

View File

@ -515,6 +515,13 @@ typedef enum {
MEDIA_OPT_BYPASS_AFTER_ATT_XFER = (1 << 1) MEDIA_OPT_BYPASS_AFTER_ATT_XFER = (1 << 1)
} sofia_media_options_t; } sofia_media_options_t;
typedef enum {
PAID_DEFAULT = 0,
PAID_USER,
PAID_USER_DOMAIN,
PAID_VERBATIM
} sofia_paid_type_t;
#define MAX_RTPIP 50 #define MAX_RTPIP 50
struct sofia_profile { struct sofia_profile {
@ -652,6 +659,7 @@ struct sofia_profile {
uint32_t sip_force_expires; uint32_t sip_force_expires;
uint32_t sip_expires_max_deviation; uint32_t sip_expires_max_deviation;
int ireg_seconds; int ireg_seconds;
sofia_paid_type_t paid_type;
}; };
struct private_object { struct private_object {

View File

@ -3494,6 +3494,18 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
} else { } else {
profile->sip_expires_max_deviation = 0; profile->sip_expires_max_deviation = 0;
} }
} else if (!strcasecmp(var, "p-asserted-id-parse")) {
if (!strncasecmp(val, "default", 7)) {
profile->paid_type = PAID_DEFAULT;
} else if (!strncasecmp(val, "user-only", 9)) {
profile->paid_type = PAID_USER;
} else if (!strncasecmp(val, "user-domain", 11)) {
profile->paid_type = PAID_USER_DOMAIN;
} else if (!strncasecmp(val, "verbatim", 8)) {
profile->paid_type = PAID_VERBATIM;
} else {
profile->paid_type = PAID_DEFAULT;
}
} }
} }
} }
@ -3753,6 +3765,7 @@ switch_status_t config_sofia(int reload, char *profile_name)
profile->ndlb |= PFLAG_NDLB_ALLOW_NONDUP_SDP; profile->ndlb |= PFLAG_NDLB_ALLOW_NONDUP_SDP;
profile->te = 101; profile->te = 101;
profile->ireg_seconds = IREG_SECONDS; profile->ireg_seconds = IREG_SECONDS;
profile->paid_type = PAID_DEFAULT;
profile->tls_verify_policy = TPTLS_VERIFY_NONE; profile->tls_verify_policy = TPTLS_VERIFY_NONE;
@ -4568,6 +4581,18 @@ switch_status_t config_sofia(int reload, char *profile_name)
} else { } else {
sofia_clear_pflag(profile, PFLAG_NO_CONNECTION_REUSE); sofia_clear_pflag(profile, PFLAG_NO_CONNECTION_REUSE);
} }
} else if (!strcasecmp(var, "p-asserted-id-parse")) {
if (!strncasecmp(val, "default", 7)) {
profile->paid_type = PAID_DEFAULT;
} else if (!strncasecmp(val, "user-only", 9)) {
profile->paid_type = PAID_USER;
} else if (!strncasecmp(val, "user-domain", 11)) {
profile->paid_type = PAID_USER_DOMAIN;
} else if (!strncasecmp(val, "verbatim", 8)) {
profile->paid_type = PAID_VERBATIM;
} else {
profile->paid_type = PAID_DEFAULT;
}
} }
} }
@ -7781,9 +7806,17 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
if ((passerted = sip_p_asserted_identity(sip))) { if ((passerted = sip_p_asserted_identity(sip))) {
if (passerted->paid_url && passerted->paid_url->url_user) { if (passerted->paid_url && passerted->paid_url->url_user) {
char *full_paid_header = sip_header_as_string(nh->nh_home, (void *) passerted); char *full_paid_header = sip_header_as_string(nh->nh_home, (void *) passerted);
//char *full_paid_header = (char *)(passerted->paid_common->h_data);
from_user = passerted->paid_url->url_user; from_user = passerted->paid_url->url_user;
if (!zstr(full_paid_header)) { if (!zstr(full_paid_header)) {
switch_channel_set_variable(channel, "sip_P-Asserted-Identity", from_user); if (profile->paid_type == PAID_DEFAULT || profile->paid_type == PAID_USER) {
switch_channel_set_variable(channel, "sip_P-Asserted-Identity", from_user);
} else if (profile->paid_type == PAID_USER_DOMAIN) {
switch_channel_set_variable(channel, "sip_P-Asserted-Identity",
switch_core_session_sprintf(session, "%s@%s", passerted->paid_url->url_user, passerted->paid_url->url_host));
} else if (profile->paid_type == PAID_VERBATIM) {
switch_channel_set_variable(channel, "sip_P-Asserted-Identity", full_paid_header);
}
} }
} }
if (!zstr(passerted->paid_display)) { if (!zstr(passerted->paid_display)) {

View File

@ -7042,14 +7042,17 @@ char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, nua
if (contact->m_url->url_params) { if (contact->m_url->url_params) {
contact_str = switch_mprintf("%s <sip:%s@%s%s%s%s;%s>%s", contact_str = switch_mprintf("%s <sip:%s%s%s%s%s%s;%s>%s",
display, contact->m_url->url_user, display, contact->m_url->url_user,
contact->m_url->url_user ? "@" : "",
ipv6 ? "[" : "", ipv6 ? "[" : "",
contact_host, ipv6 ? "]" : "", new_port, contact->m_url->url_params, np->is_nat ? ";fs_nat=yes" : ""); contact_host, ipv6 ? "]" : "", new_port, contact->m_url->url_params, np->is_nat ? ";fs_nat=yes" : "");
} else { } else {
contact_str = switch_mprintf("%s <sip:%s@%s%s%s%s>%s", contact_str = switch_mprintf("%s <sip:%s%s%s%s%s%s>%s",
display, display,
contact->m_url->url_user, ipv6 ? "[" : "", contact_host, ipv6 ? "]" : "", new_port, np->is_nat ? ";fs_nat=yes" : ""); contact->m_url->url_user,
contact->m_url->url_user ? "@" : "",
ipv6 ? "[" : "", contact_host, ipv6 ? "]" : "", new_port, np->is_nat ? ";fs_nat=yes" : "");
} }
} }

View File

@ -2647,7 +2647,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
if (!zstr(astate) && !zstr(uuid) && if (!zstr(astate) && !zstr(uuid) &&
helper && helper->stream.data && strcmp(helper->last_uuid, uuid) && strcasecmp(astate, "terminated") && strchr(uuid, '-')) { helper && helper->stream.data && strcmp(helper->last_uuid, uuid) && strcasecmp(astate, "terminated") && strchr(uuid, '-')) {
helper->stream.write_function(&helper->stream, "update sip_dialogs set state='%s' where hostname='%q' and profile_name='%q' and uuid='%s';", helper->stream.write_function(&helper->stream, "update sip_dialogs set state='%s' where hostname='%q' and profile_name='%q' and uuid='%s';",
mod_sofia_globals.hostname, profile->name, astate, uuid); astate, mod_sofia_globals.hostname, profile->name, uuid);
switch_copy_string(helper->last_uuid, uuid, sizeof(helper->last_uuid)); switch_copy_string(helper->last_uuid, uuid, sizeof(helper->last_uuid));
} }
@ -2703,9 +2703,9 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
rpid = "on-the-phone"; rpid = "on-the-phone";
force_status = 1; force_status = 1;
} else if (!strcmp(astate, "terminated") || !strcmp(astate, "hangup")) { } else if (!strcmp(astate, "terminated") || !strcmp(astate, "hangup")) {
rpid = "online"; //rpid = "online";
dialog_rpid = ""; //dialog_rpid = "";
force_event_status = "Available"; //force_event_status = "Available";
term = 1; term = 1;
} }
@ -2778,8 +2778,8 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
if (!zstr(uuid) && strchr(uuid, '-') && !zstr(status_line) && !zstr(rpid) && (zstr(register_source) || strcasecmp(register_source, "register"))) { if (!zstr(uuid) && strchr(uuid, '-') && !zstr(status_line) && !zstr(rpid) && (zstr(register_source) || strcasecmp(register_source, "register"))) {
char *sql = switch_mprintf("update sip_dialogs set rpid='%q',status='%q' where hostname='%q' and profile_name='%q' and uuid='%q'", char *sql = switch_mprintf("update sip_dialogs set rpid='%q',status='%q' where hostname='%q' and profile_name='%q' and uuid='%q'",
mod_sofia_globals.hostname, profile->name, rpid, status_line,
rpid, status_line, uuid); mod_sofia_globals.hostname, profile->name, uuid);
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE); sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
} }
} }
@ -3588,8 +3588,8 @@ void sofia_presence_handle_sip_i_subscribe(int status,
" from sip_subscriptions where hostname='%q' and profile_name='%q' and " " from sip_subscriptions where hostname='%q' and profile_name='%q' and "
"event='message-summary' and sip_user='%q' " "event='message-summary' and sip_user='%q' "
"and (sip_host='%q' or presence_hosts like '%%%q%%')", "and (sip_host='%q' or presence_hosts like '%%%q%%')",
mod_sofia_globals.hostname, profile->name, to_host, mod_sofia_globals.hostname, profile->name,
to_host, to_user, to_host, to_host))) { to_user, to_host, to_host))) {
sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_sub_reg_callback, profile); sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_sub_reg_callback, profile);
switch_safe_free(sql); switch_safe_free(sql);
@ -3880,16 +3880,24 @@ void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, n
open_closed = basic->txt; open_closed = basic->txt;
} }
if ((person = switch_xml_child(xml, "dm:person")) && (note = switch_xml_child(person, "dm:note"))) { if ((person = switch_xml_child(xml, "dm:person"))) {
note_txt = note->txt; if ((note = switch_xml_child(person, "dm:note"))) {
note_txt = note->txt;
} else if ((note = switch_xml_child(person, "rpid:note"))) {
note_txt = note->txt;
}
if ((act = switch_xml_child(person, "rpid:activities")) && act->child && act->child->name) {
if ((rpid = strchr(act->child->name, ':'))) {
rpid++;
} else {
rpid = act->child->name;
}
}
if (zstr(note_txt)) note_txt = rpid;
} }
if (person && (act = switch_xml_child(person, "rpid:activities")) && act->child && act->child->name) { if (!strcasecmp(open_closed, "closed")) {
if ((rpid = strchr(act->child->name, ':'))) { rpid = note_txt = "Unregistered";
rpid++;
} else {
rpid = act->child->name;
}
} }
if (sofia_test_pflag(profile, PFLAG_MULTIREG) && !open) { if (sofia_test_pflag(profile, PFLAG_MULTIREG) && !open) {

View File

@ -1344,7 +1344,8 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event,
} }
} }
if (switch_test_flag(listener, LFLAG_HANDLE_DISCO) && switch_epoch_time_now(NULL) > listener->linger_timeout) { if (switch_test_flag(listener, LFLAG_HANDLE_DISCO) &&
listener->linger_timeout != (time_t) -1 && switch_epoch_time_now(NULL) > listener->linger_timeout) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(listener->session), SWITCH_LOG_DEBUG, "linger timeout, closing socket\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(listener->session), SWITCH_LOG_DEBUG, "linger timeout, closing socket\n");
status = SWITCH_STATUS_FALSE; status = SWITCH_STATUS_FALSE;
break; break;
@ -1356,8 +1357,18 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event,
char message[128] = ""; char message[128] = "";
char disco_buf[512] = ""; char disco_buf[512] = "";
switch_snprintf(message, sizeof(message), if (listener->linger_timeout != (time_t) -1) {
"Channel %s has disconnected, lingering by request from remote.\n", switch_channel_get_name(channel)); listener->linger_timeout += switch_epoch_time_now(NULL);
switch_snprintf(message, sizeof(message),
"Channel %s has disconnected, lingering %d seconds by request from remote.\n",
switch_channel_get_name(channel), listener->linger_timeout);
} else {
switch_snprintf(message, sizeof(message),
"Channel %s has disconnected, lingering by request from remote.\n",
switch_channel_get_name(channel));
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s", message);
mlen = strlen(message); mlen = strlen(message);
switch_snprintf(disco_buf, sizeof(disco_buf), "Content-Type: text/disconnect-notice\n" switch_snprintf(disco_buf, sizeof(disco_buf), "Content-Type: text/disconnect-notice\n"
@ -2056,8 +2067,12 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
if (async) { if (async) {
if ((status = switch_core_session_queue_private_event(listener->session, event, SWITCH_FALSE)) == SWITCH_STATUS_SUCCESS) { if ((status = switch_core_session_queue_private_event(listener->session, event, SWITCH_FALSE)) == SWITCH_STATUS_SUCCESS) {
switch_snprintf(reply, reply_len, "+OK"); switch_snprintf(reply, reply_len, "+OK");
} else if (status == SWITCH_STATUS_TERM) {
switch_snprintf(reply, reply_len, "-ERR closed queue");
status = SWITCH_STATUS_SUCCESS;
} else { } else {
switch_snprintf(reply, reply_len, "-ERR memory error"); switch_snprintf(reply, reply_len, "-ERR memory error");
status = SWITCH_STATUS_SUCCESS;
} }
} else { } else {
switch_ivr_parse_event(listener->session, *event); switch_ivr_parse_event(listener->session, *event);
@ -2067,8 +2082,12 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
if (!zstr(uuid) && (session = switch_core_session_locate(uuid))) { if (!zstr(uuid) && (session = switch_core_session_locate(uuid))) {
if ((status = switch_core_session_queue_private_event(session, event, SWITCH_FALSE)) == SWITCH_STATUS_SUCCESS) { if ((status = switch_core_session_queue_private_event(session, event, SWITCH_FALSE)) == SWITCH_STATUS_SUCCESS) {
switch_snprintf(reply, reply_len, "+OK"); switch_snprintf(reply, reply_len, "+OK");
} else if (status == SWITCH_STATUS_TERM) {
switch_snprintf(reply, reply_len, "-ERR closed queue");
status = SWITCH_STATUS_SUCCESS;
} else { } else {
switch_snprintf(reply, reply_len, "-ERR memory error"); switch_snprintf(reply, reply_len, "-ERR memory error");
status = SWITCH_STATUS_SUCCESS;
} }
switch_core_session_rwunlock(session); switch_core_session_rwunlock(session);
} else { } else {
@ -2267,15 +2286,20 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
} }
} else if (!strncasecmp(cmd, "linger", 6)) { } else if (!strncasecmp(cmd, "linger", 6)) {
if (listener->session) { if (listener->session) {
uint32_t linger_time = 600; /* sounds reasonable? */ time_t linger_time = 600; /* sounds reasonable? */
if (*(cmd+6) == ' ' && *(cmd+7)) { /*how long do you want to linger?*/ if (*(cmd+6) == ' ' && *(cmd+7)) { /*how long do you want to linger?*/
linger_time = (uint32_t)atoi(cmd+7); linger_time = (time_t) atoi(cmd+7);
} else {
linger_time = (time_t) -1;
} }
/*do we need a mutex to update linger_timeout ?*/ listener->linger_timeout = linger_time;
listener->linger_timeout = switch_epoch_time_now(NULL) + linger_time;
switch_set_flag_locked(listener, LFLAG_LINGER); switch_set_flag_locked(listener, LFLAG_LINGER);
switch_snprintf(reply, reply_len, "+OK will linger %d seconds", linger_time); if (listener->linger_timeout != (time_t) -1) {
switch_snprintf(reply, reply_len, "+OK will linger %d seconds", linger_time);
} else {
switch_snprintf(reply, reply_len, "+OK will linger");
}
} else { } else {
switch_snprintf(reply, reply_len, "-ERR not controlling a session"); switch_snprintf(reply, reply_len, "-ERR not controlling a session");
} }

View File

@ -122,7 +122,7 @@ static lua_State *lua_init(void)
luaopen_freeswitch(L); luaopen_freeswitch(L);
lua_gc(L, LUA_GCRESTART, 0); lua_gc(L, LUA_GCRESTART, 0);
lua_atpanic(L, panic); lua_atpanic(L, panic);
error = luaL_loadbuffer(L, buff, strlen(buff), "line") || docall(L, 0, 1, 0); error = luaL_loadbuffer(L, buff, strlen(buff), "line") || docall(L, 0, 0, 0);
} }
return L; return L;
} }
@ -141,10 +141,10 @@ static int lua_parse_and_execute(lua_State * L, char *input_code)
if (*input_code == '~') { if (*input_code == '~') {
char *buff = input_code + 1; char *buff = input_code + 1;
error = luaL_loadbuffer(L, buff, strlen(buff), "line") || docall(L, 0, 1, 0); //lua_pcall(L, 0, 0, 0); error = luaL_loadbuffer(L, buff, strlen(buff), "line") || docall(L, 0, 0, 0); //lua_pcall(L, 0, 0, 0);
} else if (!strncasecmp(input_code, "#!/lua", 6)) { } else if (!strncasecmp(input_code, "#!/lua", 6)) {
char *buff = input_code + 6; char *buff = input_code + 6;
error = luaL_loadbuffer(L, buff, strlen(buff), "line") || docall(L, 0, 1, 0); //lua_pcall(L, 0, 0, 0); error = luaL_loadbuffer(L, buff, strlen(buff), "line") || docall(L, 0, 0, 0); //lua_pcall(L, 0, 0, 0);
} else { } else {
char *args = strchr(input_code, ' '); char *args = strchr(input_code, ' ');
if (args) { if (args) {
@ -168,14 +168,14 @@ static int lua_parse_and_execute(lua_State * L, char *input_code)
} }
if (code) { if (code) {
error = luaL_loadbuffer(L, code, strlen(code), "line") || docall(L, 0, 1, 0); error = luaL_loadbuffer(L, code, strlen(code), "line") || docall(L, 0, 0, 0);
switch_safe_free(code); switch_safe_free(code);
} }
} else { } else {
// Force empty argv table // Force empty argv table
char *code = NULL; char *code = NULL;
code = switch_mprintf("argv = {[0]='%s'};", input_code); code = switch_mprintf("argv = {[0]='%s'};", input_code);
error = luaL_loadbuffer(L, code, strlen(code), "line") || docall(L, 0, 1, 0); error = luaL_loadbuffer(L, code, strlen(code), "line") || docall(L, 0, 0, 0);
switch_safe_free(code); switch_safe_free(code);
} }
@ -187,7 +187,7 @@ static int lua_parse_and_execute(lua_State * L, char *input_code)
switch_assert(fdup); switch_assert(fdup);
file = fdup; file = fdup;
} }
error = luaL_loadfile(L, file) || docall(L, 0, 1, 0); error = luaL_loadfile(L, file) || docall(L, 0, 0, 0);
switch_safe_free(fdup); switch_safe_free(fdup);
} }
} }

View File

@ -6595,6 +6595,16 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_media_bug_set_read_replace_frame(
} }
SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_cpu_count() {
unsigned long jresult ;
uint32_t result;
result = (uint32_t)switch_core_cpu_count();
jresult = (unsigned long)result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_remove(void * jarg1, void * jarg2) { SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_remove(void * jarg1, void * jarg2) {
int jresult ; int jresult ;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
@ -24949,6 +24959,14 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_mark_answered(void * ja
} }
SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_check_zrtp(void * jarg1) {
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
arg1 = (switch_channel_t *)jarg1;
switch_channel_check_zrtp(arg1);
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_ring_ready_value(void * jarg1, int jarg2, char * jarg3, char * jarg4, int jarg5) { SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_ring_ready_value(void * jarg1, int jarg2, char * jarg3, char * jarg4, int jarg5) {
int jresult ; int jresult ;
switch_channel_t *arg1 = (switch_channel_t *) 0 ; switch_channel_t *arg1 = (switch_channel_t *) 0 ;
@ -25291,19 +25309,21 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_event_set_extended_data(void *
} }
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_expand_variables_check(void * jarg1, char * jarg2, void * jarg3, void * jarg4) { SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_expand_variables_check(void * jarg1, char * jarg2, void * jarg3, void * jarg4, unsigned long jarg5) {
char * jresult ; char * jresult ;
switch_channel_t *arg1 = (switch_channel_t *) 0 ; switch_channel_t *arg1 = (switch_channel_t *) 0 ;
char *arg2 = (char *) 0 ; char *arg2 = (char *) 0 ;
switch_event_t *arg3 = (switch_event_t *) 0 ; switch_event_t *arg3 = (switch_event_t *) 0 ;
switch_event_t *arg4 = (switch_event_t *) 0 ; switch_event_t *arg4 = (switch_event_t *) 0 ;
uint32_t arg5 ;
char *result = 0 ; char *result = 0 ;
arg1 = (switch_channel_t *)jarg1; arg1 = (switch_channel_t *)jarg1;
arg2 = (char *)jarg2; arg2 = (char *)jarg2;
arg3 = (switch_event_t *)jarg3; arg3 = (switch_event_t *)jarg3;
arg4 = (switch_event_t *)jarg4; arg4 = (switch_event_t *)jarg4;
result = (char *)switch_channel_expand_variables_check(arg1,(char const *)arg2,arg3,arg4); arg5 = (uint32_t)jarg5;
result = (char *)switch_channel_expand_variables_check(arg1,(char const *)arg2,arg3,arg4,arg5);
jresult = SWIG_csharp_string_callback((const char *)result); jresult = SWIG_csharp_string_callback((const char *)result);
return jresult; return jresult;
} }
@ -26881,19 +26901,21 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_set_body(void * jarg1, char * jar
} }
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_expand_headers_check(void * jarg1, char * jarg2, void * jarg3, void * jarg4) { SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_expand_headers_check(void * jarg1, char * jarg2, void * jarg3, void * jarg4, unsigned long jarg5) {
char * jresult ; char * jresult ;
switch_event_t *arg1 = (switch_event_t *) 0 ; switch_event_t *arg1 = (switch_event_t *) 0 ;
char *arg2 = (char *) 0 ; char *arg2 = (char *) 0 ;
switch_event_t *arg3 = (switch_event_t *) 0 ; switch_event_t *arg3 = (switch_event_t *) 0 ;
switch_event_t *arg4 = (switch_event_t *) 0 ; switch_event_t *arg4 = (switch_event_t *) 0 ;
uint32_t arg5 ;
char *result = 0 ; char *result = 0 ;
arg1 = (switch_event_t *)jarg1; arg1 = (switch_event_t *)jarg1;
arg2 = (char *)jarg2; arg2 = (char *)jarg2;
arg3 = (switch_event_t *)jarg3; arg3 = (switch_event_t *)jarg3;
arg4 = (switch_event_t *)jarg4; arg4 = (switch_event_t *)jarg4;
result = (char *)switch_event_expand_headers_check(arg1,(char const *)arg2,arg3,arg4); arg5 = (uint32_t)jarg5;
result = (char *)switch_event_expand_headers_check(arg1,(char const *)arg2,arg3,arg4,arg5);
jresult = SWIG_csharp_string_callback((const char *)result); jresult = SWIG_csharp_string_callback((const char *)result);
return jresult; return jresult;
} }
@ -30456,6 +30478,14 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_break(void * jarg1) {
} }
SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_flush(void * jarg1) {
switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
arg1 = (switch_rtp_t *)jarg1;
switch_rtp_flush(arg1);
}
SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_rtp_ready(void * jarg1) { SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_rtp_ready(void * jarg1) {
unsigned char jresult ; unsigned char jresult ;
switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
@ -31892,6 +31922,20 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_xml_toxml(void * jarg1, int jarg2) {
} }
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_xml_toxml_nolock(void * jarg1, int jarg2) {
char * jresult ;
switch_xml_t arg1 = (switch_xml_t) 0 ;
switch_bool_t arg2 ;
char *result = 0 ;
arg1 = (switch_xml_t)jarg1;
arg2 = (switch_bool_t)jarg2;
result = (char *)switch_xml_toxml_nolock(arg1,arg2);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_xml_toxml_buf(void * jarg1, char * jarg2, void * jarg3, void * jarg4, int jarg5) { SWIGEXPORT char * SWIGSTDCALL CSharp_switch_xml_toxml_buf(void * jarg1, char * jarg2, void * jarg3, void * jarg4, int jarg5) {
char * jresult ; char * jresult ;
switch_xml_t arg1 = (switch_xml_t) 0 ; switch_xml_t arg1 = (switch_xml_t) 0 ;

View File

@ -6902,6 +6902,16 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_media_bug_set_read_replace_frame(
} }
SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_cpu_count() {
unsigned long jresult ;
uint32_t result;
result = (uint32_t)switch_core_cpu_count();
jresult = (unsigned long)result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_remove(void * jarg1, void * jarg2) { SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_remove(void * jarg1, void * jarg2) {
int jresult ; int jresult ;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
@ -7030,6 +7040,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_flush_all(void * jarg1)
} }
SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_set_pre_buffer_framecount(void * jarg1, unsigned long jarg2) {
int jresult ;
switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ;
uint32_t arg2 ;
switch_status_t result;
arg1 = (switch_media_bug_t *)jarg1;
arg2 = (uint32_t)jarg2;
result = (switch_status_t)switch_core_media_bug_set_pre_buffer_framecount(arg1,arg2);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_port_allocator_new(unsigned short jarg1, unsigned short jarg2, unsigned long jarg3, void * jarg4) { SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_port_allocator_new(unsigned short jarg1, unsigned short jarg2, unsigned long jarg3, void * jarg4) {
int jresult ; int jresult ;
switch_port_t arg1 ; switch_port_t arg1 ;
@ -25630,6 +25654,14 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_mark_answered(void * ja
} }
SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_check_zrtp(void * jarg1) {
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
arg1 = (switch_channel_t *)jarg1;
switch_channel_check_zrtp(arg1);
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_ring_ready_value(void * jarg1, int jarg2, char * jarg3, char * jarg4, int jarg5) { SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_ring_ready_value(void * jarg1, int jarg2, char * jarg3, char * jarg4, int jarg5) {
int jresult ; int jresult ;
switch_channel_t *arg1 = (switch_channel_t *) 0 ; switch_channel_t *arg1 = (switch_channel_t *) 0 ;
@ -25972,19 +26004,21 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_event_set_extended_data(void *
} }
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_expand_variables_check(void * jarg1, char * jarg2, void * jarg3, void * jarg4) { SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_expand_variables_check(void * jarg1, char * jarg2, void * jarg3, void * jarg4, unsigned long jarg5) {
char * jresult ; char * jresult ;
switch_channel_t *arg1 = (switch_channel_t *) 0 ; switch_channel_t *arg1 = (switch_channel_t *) 0 ;
char *arg2 = (char *) 0 ; char *arg2 = (char *) 0 ;
switch_event_t *arg3 = (switch_event_t *) 0 ; switch_event_t *arg3 = (switch_event_t *) 0 ;
switch_event_t *arg4 = (switch_event_t *) 0 ; switch_event_t *arg4 = (switch_event_t *) 0 ;
uint32_t arg5 ;
char *result = 0 ; char *result = 0 ;
arg1 = (switch_channel_t *)jarg1; arg1 = (switch_channel_t *)jarg1;
arg2 = (char *)jarg2; arg2 = (char *)jarg2;
arg3 = (switch_event_t *)jarg3; arg3 = (switch_event_t *)jarg3;
arg4 = (switch_event_t *)jarg4; arg4 = (switch_event_t *)jarg4;
result = (char *)switch_channel_expand_variables_check(arg1,(char const *)arg2,arg3,arg4); arg5 = (uint32_t)jarg5;
result = (char *)switch_channel_expand_variables_check(arg1,(char const *)arg2,arg3,arg4,arg5);
jresult = SWIG_csharp_string_callback((const char *)result); jresult = SWIG_csharp_string_callback((const char *)result);
return jresult; return jresult;
} }
@ -27577,19 +27611,21 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_set_body(void * jarg1, char * jar
} }
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_expand_headers_check(void * jarg1, char * jarg2, void * jarg3, void * jarg4) { SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_expand_headers_check(void * jarg1, char * jarg2, void * jarg3, void * jarg4, unsigned long jarg5) {
char * jresult ; char * jresult ;
switch_event_t *arg1 = (switch_event_t *) 0 ; switch_event_t *arg1 = (switch_event_t *) 0 ;
char *arg2 = (char *) 0 ; char *arg2 = (char *) 0 ;
switch_event_t *arg3 = (switch_event_t *) 0 ; switch_event_t *arg3 = (switch_event_t *) 0 ;
switch_event_t *arg4 = (switch_event_t *) 0 ; switch_event_t *arg4 = (switch_event_t *) 0 ;
uint32_t arg5 ;
char *result = 0 ; char *result = 0 ;
arg1 = (switch_event_t *)jarg1; arg1 = (switch_event_t *)jarg1;
arg2 = (char *)jarg2; arg2 = (char *)jarg2;
arg3 = (switch_event_t *)jarg3; arg3 = (switch_event_t *)jarg3;
arg4 = (switch_event_t *)jarg4; arg4 = (switch_event_t *)jarg4;
result = (char *)switch_event_expand_headers_check(arg1,(char const *)arg2,arg3,arg4); arg5 = (uint32_t)jarg5;
result = (char *)switch_event_expand_headers_check(arg1,(char const *)arg2,arg3,arg4,arg5);
jresult = SWIG_csharp_string_callback((const char *)result); jresult = SWIG_csharp_string_callback((const char *)result);
return jresult; return jresult;
} }
@ -31187,6 +31223,14 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_break(void * jarg1) {
} }
SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_flush(void * jarg1) {
switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
arg1 = (switch_rtp_t *)jarg1;
switch_rtp_flush(arg1);
}
SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_rtp_ready(void * jarg1) { SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_rtp_ready(void * jarg1) {
unsigned char jresult ; unsigned char jresult ;
switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
@ -32632,6 +32676,20 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_xml_toxml(void * jarg1, int jarg2) {
} }
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_xml_toxml_nolock(void * jarg1, int jarg2) {
char * jresult ;
switch_xml_t arg1 = (switch_xml_t) 0 ;
switch_bool_t arg2 ;
char *result = 0 ;
arg1 = (switch_xml_t)jarg1;
arg2 = (switch_bool_t)jarg2;
result = (char *)switch_xml_toxml_nolock(arg1,arg2);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_xml_toxml_buf(void * jarg1, char * jarg2, void * jarg3, void * jarg4, int jarg5) { SWIGEXPORT char * SWIGSTDCALL CSharp_switch_xml_toxml_buf(void * jarg1, char * jarg2, void * jarg3, void * jarg4, int jarg5) {
char * jresult ; char * jresult ;
switch_xml_t arg1 = (switch_xml_t) 0 ; switch_xml_t arg1 = (switch_xml_t) 0 ;

View File

@ -1131,6 +1131,11 @@ public class freeswitch {
freeswitchPINVOKE.switch_core_media_bug_set_read_replace_frame(SWIGTYPE_p_switch_media_bug.getCPtr(bug), switch_frame.getCPtr(frame)); freeswitchPINVOKE.switch_core_media_bug_set_read_replace_frame(SWIGTYPE_p_switch_media_bug.getCPtr(bug), switch_frame.getCPtr(frame));
} }
public static uint switch_core_cpu_count() {
uint ret = freeswitchPINVOKE.switch_core_cpu_count();
return ret;
}
public static switch_status_t switch_core_media_bug_remove(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_media_bug bug) { public static switch_status_t switch_core_media_bug_remove(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_media_bug bug) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_remove(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_media_bug.getCPtr(bug)); switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_remove(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_media_bug.getCPtr(bug));
return ret; return ret;
@ -3830,6 +3835,10 @@ public class freeswitch {
return ret; return ret;
} }
public static void switch_channel_check_zrtp(SWIGTYPE_p_switch_channel channel) {
freeswitchPINVOKE.switch_channel_check_zrtp(SWIGTYPE_p_switch_channel.getCPtr(channel));
}
public static switch_status_t switch_channel_perform_ring_ready_value(SWIGTYPE_p_switch_channel channel, switch_ring_ready_t rv, string file, string func, int line) { public static switch_status_t switch_channel_perform_ring_ready_value(SWIGTYPE_p_switch_channel channel, switch_ring_ready_t rv, string file, string func, int line) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_perform_ring_ready_value(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)rv, file, func, line); switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_perform_ring_ready_value(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)rv, file, func, line);
return ret; return ret;
@ -3949,8 +3958,8 @@ public class freeswitch {
freeswitchPINVOKE.switch_channel_event_set_extended_data(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_event.getCPtr(arg1)); freeswitchPINVOKE.switch_channel_event_set_extended_data(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_event.getCPtr(arg1));
} }
public static string switch_channel_expand_variables_check(SWIGTYPE_p_switch_channel channel, string arg1, switch_event var_list, switch_event api_list) { public static string switch_channel_expand_variables_check(SWIGTYPE_p_switch_channel channel, string arg1, switch_event var_list, switch_event api_list, uint recur) {
string ret = freeswitchPINVOKE.switch_channel_expand_variables_check(SWIGTYPE_p_switch_channel.getCPtr(channel), arg1, switch_event.getCPtr(var_list), switch_event.getCPtr(api_list)); string ret = freeswitchPINVOKE.switch_channel_expand_variables_check(SWIGTYPE_p_switch_channel.getCPtr(channel), arg1, switch_event.getCPtr(var_list), switch_event.getCPtr(api_list), recur);
return ret; return ret;
} }
@ -4332,8 +4341,8 @@ public class freeswitch {
return ret; return ret;
} }
public static string switch_event_expand_headers_check(switch_event arg0, string arg1, switch_event var_list, switch_event api_list) { public static string switch_event_expand_headers_check(switch_event arg0, string arg1, switch_event var_list, switch_event api_list, uint recur) {
string ret = freeswitchPINVOKE.switch_event_expand_headers_check(switch_event.getCPtr(arg0), arg1, switch_event.getCPtr(var_list), switch_event.getCPtr(api_list)); string ret = freeswitchPINVOKE.switch_event_expand_headers_check(switch_event.getCPtr(arg0), arg1, switch_event.getCPtr(var_list), switch_event.getCPtr(api_list), recur);
return ret; return ret;
} }
@ -5183,6 +5192,10 @@ public class freeswitch {
freeswitchPINVOKE.switch_rtp_break(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session)); freeswitchPINVOKE.switch_rtp_break(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
} }
public static void switch_rtp_flush(SWIGTYPE_p_switch_rtp rtp_session) {
freeswitchPINVOKE.switch_rtp_flush(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
}
public static byte switch_rtp_ready(SWIGTYPE_p_switch_rtp rtp_session) { public static byte switch_rtp_ready(SWIGTYPE_p_switch_rtp rtp_session) {
byte ret = freeswitchPINVOKE.switch_rtp_ready(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session)); byte ret = freeswitchPINVOKE.switch_rtp_ready(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
return ret; return ret;
@ -5495,6 +5508,11 @@ public class freeswitch {
return ret; return ret;
} }
public static string switch_xml_toxml_nolock(switch_xml xml, switch_bool_t prn_header) {
string ret = freeswitchPINVOKE.switch_xml_toxml_nolock(switch_xml.getCPtr(xml), (int)prn_header);
return ret;
}
public static string switch_xml_toxml_buf(switch_xml xml, string buf, SWIGTYPE_p_switch_size_t buflen, SWIGTYPE_p_switch_size_t offset, switch_bool_t prn_header) { public static string switch_xml_toxml_buf(switch_xml xml, string buf, SWIGTYPE_p_switch_size_t buflen, SWIGTYPE_p_switch_size_t offset, switch_bool_t prn_header) {
string ret = freeswitchPINVOKE.switch_xml_toxml_buf(switch_xml.getCPtr(xml), buf, SWIGTYPE_p_switch_size_t.getCPtr(buflen), SWIGTYPE_p_switch_size_t.getCPtr(offset), (int)prn_header); string ret = freeswitchPINVOKE.switch_xml_toxml_buf(switch_xml.getCPtr(xml), buf, SWIGTYPE_p_switch_size_t.getCPtr(buflen), SWIGTYPE_p_switch_size_t.getCPtr(offset), (int)prn_header);
if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
@ -7973,6 +7991,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_set_read_replace_frame")] [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_set_read_replace_frame")]
public static extern void switch_core_media_bug_set_read_replace_frame(HandleRef jarg1, HandleRef jarg2); public static extern void switch_core_media_bug_set_read_replace_frame(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_cpu_count")]
public static extern uint switch_core_cpu_count();
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_remove")] [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_remove")]
public static extern int switch_core_media_bug_remove(HandleRef jarg1, HandleRef jarg2); public static extern int switch_core_media_bug_remove(HandleRef jarg1, HandleRef jarg2);
@ -12419,6 +12440,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_mark_answered")] [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_mark_answered")]
public static extern int switch_channel_perform_mark_answered(HandleRef jarg1, string jarg2, string jarg3, int jarg4); public static extern int switch_channel_perform_mark_answered(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_check_zrtp")]
public static extern void switch_channel_check_zrtp(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_ring_ready_value")] [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_ring_ready_value")]
public static extern int switch_channel_perform_ring_ready_value(HandleRef jarg1, int jarg2, string jarg3, string jarg4, int jarg5); public static extern int switch_channel_perform_ring_ready_value(HandleRef jarg1, int jarg2, string jarg3, string jarg4, int jarg5);
@ -12492,7 +12516,7 @@ class freeswitchPINVOKE {
public static extern void switch_channel_event_set_extended_data(HandleRef jarg1, HandleRef jarg2); public static extern void switch_channel_event_set_extended_data(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_expand_variables_check")] [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_expand_variables_check")]
public static extern string switch_channel_expand_variables_check(HandleRef jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4); public static extern string switch_channel_expand_variables_check(HandleRef jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4, uint jarg5);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_build_param_string")] [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_build_param_string")]
public static extern string switch_channel_build_param_string(HandleRef jarg1, HandleRef jarg2, string jarg3); public static extern string switch_channel_build_param_string(HandleRef jarg1, HandleRef jarg2, string jarg3);
@ -12846,7 +12870,7 @@ class freeswitchPINVOKE {
public static extern int switch_event_set_body(HandleRef jarg1, string jarg2); public static extern int switch_event_set_body(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_event_expand_headers_check")] [DllImport("mod_managed", EntryPoint="CSharp_switch_event_expand_headers_check")]
public static extern string switch_event_expand_headers_check(HandleRef jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4); public static extern string switch_event_expand_headers_check(HandleRef jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4, uint jarg5);
[DllImport("mod_managed", EntryPoint="CSharp_switch_event_create_pres_in_detailed")] [DllImport("mod_managed", EntryPoint="CSharp_switch_event_create_pres_in_detailed")]
public static extern int switch_event_create_pres_in_detailed(string jarg1, string jarg2, int jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, int jarg11, string jarg12, string jarg13, string jarg14, string jarg15); public static extern int switch_event_create_pres_in_detailed(string jarg1, string jarg2, int jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, int jarg11, string jarg12, string jarg13, string jarg14, string jarg15);
@ -13577,6 +13601,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_break")] [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_break")]
public static extern void switch_rtp_break(HandleRef jarg1); public static extern void switch_rtp_break(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_flush")]
public static extern void switch_rtp_flush(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_ready")] [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_ready")]
public static extern byte switch_rtp_ready(HandleRef jarg1); public static extern byte switch_rtp_ready(HandleRef jarg1);
@ -13910,6 +13937,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_xml_toxml")] [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_toxml")]
public static extern string switch_xml_toxml(HandleRef jarg1, int jarg2); public static extern string switch_xml_toxml(HandleRef jarg1, int jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_xml_toxml_nolock")]
public static extern string switch_xml_toxml_nolock(HandleRef jarg1, int jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_xml_toxml_buf")] [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_toxml_buf")]
public static extern string switch_xml_toxml_buf(HandleRef jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4, int jarg5); public static extern string switch_xml_toxml_buf(HandleRef jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4, int jarg5);
@ -23022,6 +23052,8 @@ public enum switch_channel_flag_t {
CF_VIDEO_REFRESH_REQ, CF_VIDEO_REFRESH_REQ,
CF_SERVICE_AUDIO, CF_SERVICE_AUDIO,
CF_SERVICE_VIDEO, CF_SERVICE_VIDEO,
CF_ZRTP_HASH,
CF_ZRTP_PASS,
CF_FLAG_MAX CF_FLAG_MAX
} }
@ -24627,7 +24659,8 @@ namespace FreeSWITCH.Native {
SCF_CLEAR_SQL = (1 << 17), SCF_CLEAR_SQL = (1 << 17),
SCF_THREADED_SYSTEM_EXEC = (1 << 18), SCF_THREADED_SYSTEM_EXEC = (1 << 18),
SCF_SYNC_CLOCK_REQUESTED = (1 << 19), SCF_SYNC_CLOCK_REQUESTED = (1 << 19),
SCF_CORE_ODBC_REQ = (1 << 20) SCF_CORE_ODBC_REQ = (1 << 20),
SCF_DEBUG_SQL = (1 << 21)
} }
} }
@ -31284,7 +31317,8 @@ public enum switch_session_ctl_t {
SCSC_PAUSE_CHECK, SCSC_PAUSE_CHECK,
SCSC_READY_CHECK, SCSC_READY_CHECK,
SCSC_THREADED_SYSTEM_EXEC, SCSC_THREADED_SYSTEM_EXEC,
SCSC_SYNC_CLOCK_WHEN_IDLE SCSC_SYNC_CLOCK_WHEN_IDLE,
SCSC_DEBUG_SQL
} }
} }

View File

@ -1119,6 +1119,11 @@ public class freeswitch {
freeswitchPINVOKE.switch_core_media_bug_set_read_replace_frame(SWIGTYPE_p_switch_media_bug.getCPtr(bug), switch_frame.getCPtr(frame)); freeswitchPINVOKE.switch_core_media_bug_set_read_replace_frame(SWIGTYPE_p_switch_media_bug.getCPtr(bug), switch_frame.getCPtr(frame));
} }
public static uint switch_core_cpu_count() {
uint ret = freeswitchPINVOKE.switch_core_cpu_count();
return ret;
}
public static switch_status_t switch_core_media_bug_remove(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_media_bug bug) { public static switch_status_t switch_core_media_bug_remove(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_media_bug bug) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_remove(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_media_bug.getCPtr(bug)); switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_remove(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_media_bug.getCPtr(bug));
return ret; return ret;
@ -1168,6 +1173,11 @@ public class freeswitch {
return ret; return ret;
} }
public static switch_status_t switch_core_media_bug_set_pre_buffer_framecount(SWIGTYPE_p_switch_media_bug bug, uint framecount) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_set_pre_buffer_framecount(SWIGTYPE_p_switch_media_bug.getCPtr(bug), framecount);
return ret;
}
public static switch_status_t switch_core_port_allocator_new(ushort start, ushort end, uint flags, SWIGTYPE_p_p_switch_core_port_allocator new_allocator) { public static switch_status_t switch_core_port_allocator_new(ushort start, ushort end, uint flags, SWIGTYPE_p_p_switch_core_port_allocator new_allocator) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_port_allocator_new(start, end, flags, SWIGTYPE_p_p_switch_core_port_allocator.getCPtr(new_allocator)); switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_port_allocator_new(start, end, flags, SWIGTYPE_p_p_switch_core_port_allocator.getCPtr(new_allocator));
return ret; return ret;
@ -3813,6 +3823,10 @@ public class freeswitch {
return ret; return ret;
} }
public static void switch_channel_check_zrtp(SWIGTYPE_p_switch_channel channel) {
freeswitchPINVOKE.switch_channel_check_zrtp(SWIGTYPE_p_switch_channel.getCPtr(channel));
}
public static switch_status_t switch_channel_perform_ring_ready_value(SWIGTYPE_p_switch_channel channel, switch_ring_ready_t rv, string file, string func, int line) { public static switch_status_t switch_channel_perform_ring_ready_value(SWIGTYPE_p_switch_channel channel, switch_ring_ready_t rv, string file, string func, int line) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_perform_ring_ready_value(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)rv, file, func, line); switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_perform_ring_ready_value(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)rv, file, func, line);
return ret; return ret;
@ -3932,8 +3946,8 @@ public class freeswitch {
freeswitchPINVOKE.switch_channel_event_set_extended_data(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_event.getCPtr(arg1)); freeswitchPINVOKE.switch_channel_event_set_extended_data(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_event.getCPtr(arg1));
} }
public static string switch_channel_expand_variables_check(SWIGTYPE_p_switch_channel channel, string arg1, switch_event var_list, switch_event api_list) { public static string switch_channel_expand_variables_check(SWIGTYPE_p_switch_channel channel, string arg1, switch_event var_list, switch_event api_list, uint recur) {
string ret = freeswitchPINVOKE.switch_channel_expand_variables_check(SWIGTYPE_p_switch_channel.getCPtr(channel), arg1, switch_event.getCPtr(var_list), switch_event.getCPtr(api_list)); string ret = freeswitchPINVOKE.switch_channel_expand_variables_check(SWIGTYPE_p_switch_channel.getCPtr(channel), arg1, switch_event.getCPtr(var_list), switch_event.getCPtr(api_list), recur);
return ret; return ret;
} }
@ -4315,8 +4329,8 @@ public class freeswitch {
return ret; return ret;
} }
public static string switch_event_expand_headers_check(switch_event arg0, string arg1, switch_event var_list, switch_event api_list) { public static string switch_event_expand_headers_check(switch_event arg0, string arg1, switch_event var_list, switch_event api_list, uint recur) {
string ret = freeswitchPINVOKE.switch_event_expand_headers_check(switch_event.getCPtr(arg0), arg1, switch_event.getCPtr(var_list), switch_event.getCPtr(api_list)); string ret = freeswitchPINVOKE.switch_event_expand_headers_check(switch_event.getCPtr(arg0), arg1, switch_event.getCPtr(var_list), switch_event.getCPtr(api_list), recur);
return ret; return ret;
} }
@ -5166,6 +5180,10 @@ public class freeswitch {
freeswitchPINVOKE.switch_rtp_break(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session)); freeswitchPINVOKE.switch_rtp_break(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
} }
public static void switch_rtp_flush(SWIGTYPE_p_switch_rtp rtp_session) {
freeswitchPINVOKE.switch_rtp_flush(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
}
public static byte switch_rtp_ready(SWIGTYPE_p_switch_rtp rtp_session) { public static byte switch_rtp_ready(SWIGTYPE_p_switch_rtp rtp_session) {
byte ret = freeswitchPINVOKE.switch_rtp_ready(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session)); byte ret = freeswitchPINVOKE.switch_rtp_ready(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
return ret; return ret;
@ -5478,6 +5496,11 @@ public class freeswitch {
return ret; return ret;
} }
public static string switch_xml_toxml_nolock(switch_xml xml, switch_bool_t prn_header) {
string ret = freeswitchPINVOKE.switch_xml_toxml_nolock(switch_xml.getCPtr(xml), (int)prn_header);
return ret;
}
public static string switch_xml_toxml_buf(switch_xml xml, string buf, SWIGTYPE_p_switch_size_t buflen, SWIGTYPE_p_switch_size_t offset, switch_bool_t prn_header) { public static string switch_xml_toxml_buf(switch_xml xml, string buf, SWIGTYPE_p_switch_size_t buflen, SWIGTYPE_p_switch_size_t offset, switch_bool_t prn_header) {
string ret = freeswitchPINVOKE.switch_xml_toxml_buf(switch_xml.getCPtr(xml), buf, SWIGTYPE_p_switch_size_t.getCPtr(buflen), SWIGTYPE_p_switch_size_t.getCPtr(offset), (int)prn_header); string ret = freeswitchPINVOKE.switch_xml_toxml_buf(switch_xml.getCPtr(xml), buf, SWIGTYPE_p_switch_size_t.getCPtr(buflen), SWIGTYPE_p_switch_size_t.getCPtr(offset), (int)prn_header);
if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
@ -7952,6 +7975,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_set_read_replace_frame")] [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_set_read_replace_frame")]
public static extern void switch_core_media_bug_set_read_replace_frame(HandleRef jarg1, HandleRef jarg2); public static extern void switch_core_media_bug_set_read_replace_frame(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_cpu_count")]
public static extern uint switch_core_cpu_count();
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_remove")] [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_remove")]
public static extern int switch_core_media_bug_remove(HandleRef jarg1, HandleRef jarg2); public static extern int switch_core_media_bug_remove(HandleRef jarg1, HandleRef jarg2);
@ -7982,6 +8008,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_flush_all")] [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_flush_all")]
public static extern int switch_core_media_bug_flush_all(HandleRef jarg1); public static extern int switch_core_media_bug_flush_all(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_set_pre_buffer_framecount")]
public static extern int switch_core_media_bug_set_pre_buffer_framecount(HandleRef jarg1, uint jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_port_allocator_new")] [DllImport("mod_managed", EntryPoint="CSharp_switch_core_port_allocator_new")]
public static extern int switch_core_port_allocator_new(ushort jarg1, ushort jarg2, uint jarg3, HandleRef jarg4); public static extern int switch_core_port_allocator_new(ushort jarg1, ushort jarg2, uint jarg3, HandleRef jarg4);
@ -12395,6 +12424,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_mark_answered")] [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_mark_answered")]
public static extern int switch_channel_perform_mark_answered(HandleRef jarg1, string jarg2, string jarg3, int jarg4); public static extern int switch_channel_perform_mark_answered(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_check_zrtp")]
public static extern void switch_channel_check_zrtp(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_ring_ready_value")] [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_ring_ready_value")]
public static extern int switch_channel_perform_ring_ready_value(HandleRef jarg1, int jarg2, string jarg3, string jarg4, int jarg5); public static extern int switch_channel_perform_ring_ready_value(HandleRef jarg1, int jarg2, string jarg3, string jarg4, int jarg5);
@ -12468,7 +12500,7 @@ class freeswitchPINVOKE {
public static extern void switch_channel_event_set_extended_data(HandleRef jarg1, HandleRef jarg2); public static extern void switch_channel_event_set_extended_data(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_expand_variables_check")] [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_expand_variables_check")]
public static extern string switch_channel_expand_variables_check(HandleRef jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4); public static extern string switch_channel_expand_variables_check(HandleRef jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4, uint jarg5);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_build_param_string")] [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_build_param_string")]
public static extern string switch_channel_build_param_string(HandleRef jarg1, HandleRef jarg2, string jarg3); public static extern string switch_channel_build_param_string(HandleRef jarg1, HandleRef jarg2, string jarg3);
@ -12822,7 +12854,7 @@ class freeswitchPINVOKE {
public static extern int switch_event_set_body(HandleRef jarg1, string jarg2); public static extern int switch_event_set_body(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_event_expand_headers_check")] [DllImport("mod_managed", EntryPoint="CSharp_switch_event_expand_headers_check")]
public static extern string switch_event_expand_headers_check(HandleRef jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4); public static extern string switch_event_expand_headers_check(HandleRef jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4, uint jarg5);
[DllImport("mod_managed", EntryPoint="CSharp_switch_event_create_pres_in_detailed")] [DllImport("mod_managed", EntryPoint="CSharp_switch_event_create_pres_in_detailed")]
public static extern int switch_event_create_pres_in_detailed(string jarg1, string jarg2, int jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, int jarg11, string jarg12, string jarg13, string jarg14, string jarg15); public static extern int switch_event_create_pres_in_detailed(string jarg1, string jarg2, int jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, int jarg11, string jarg12, string jarg13, string jarg14, string jarg15);
@ -13553,6 +13585,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_break")] [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_break")]
public static extern void switch_rtp_break(HandleRef jarg1); public static extern void switch_rtp_break(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_flush")]
public static extern void switch_rtp_flush(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_ready")] [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_ready")]
public static extern byte switch_rtp_ready(HandleRef jarg1); public static extern byte switch_rtp_ready(HandleRef jarg1);
@ -13886,6 +13921,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_xml_toxml")] [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_toxml")]
public static extern string switch_xml_toxml(HandleRef jarg1, int jarg2); public static extern string switch_xml_toxml(HandleRef jarg1, int jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_xml_toxml_nolock")]
public static extern string switch_xml_toxml_nolock(HandleRef jarg1, int jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_xml_toxml_buf")] [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_toxml_buf")]
public static extern string switch_xml_toxml_buf(HandleRef jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4, int jarg5); public static extern string switch_xml_toxml_buf(HandleRef jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4, int jarg5);
@ -22958,6 +22996,8 @@ public enum switch_channel_flag_t {
CF_VIDEO_REFRESH_REQ, CF_VIDEO_REFRESH_REQ,
CF_SERVICE_AUDIO, CF_SERVICE_AUDIO,
CF_SERVICE_VIDEO, CF_SERVICE_VIDEO,
CF_ZRTP_HASH,
CF_ZRTP_PASS,
CF_FLAG_MAX CF_FLAG_MAX
} }
@ -24541,7 +24581,8 @@ namespace FreeSWITCH.Native {
SCF_CLEAR_SQL = (1 << 17), SCF_CLEAR_SQL = (1 << 17),
SCF_THREADED_SYSTEM_EXEC = (1 << 18), SCF_THREADED_SYSTEM_EXEC = (1 << 18),
SCF_SYNC_CLOCK_REQUESTED = (1 << 19), SCF_SYNC_CLOCK_REQUESTED = (1 << 19),
SCF_CORE_ODBC_REQ = (1 << 20) SCF_CORE_ODBC_REQ = (1 << 20),
SCF_DEBUG_SQL = (1 << 21)
} }
} }
@ -31108,7 +31149,8 @@ public enum switch_session_ctl_t {
SCSC_PAUSE_CHECK, SCSC_PAUSE_CHECK,
SCSC_READY_CHECK, SCSC_READY_CHECK,
SCSC_THREADED_SYSTEM_EXEC, SCSC_THREADED_SYSTEM_EXEC,
SCSC_SYNC_CLOCK_WHEN_IDLE SCSC_SYNC_CLOCK_WHEN_IDLE,
SCSC_DEBUG_SQL
} }
} }

View File

@ -479,7 +479,7 @@ SWITCH_DECLARE(void) switch_caller_extension_add_application_printf(switch_core_
char *p; char *p;
if ((p = strstr(data, "\\'"))) { if ((p = strstr(data, "\\'"))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "App not added, Invalid character sequence in data string [%s]\n", data); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "App not added, Invalid character sequence in data string [%s]\n", data);
free(data); free(data);
return; return;
} }
@ -505,7 +505,7 @@ SWITCH_DECLARE(void) switch_caller_extension_add_application(switch_core_session
if (caller_application->application_data && (p = strstr(caller_application->application_data, "\\'"))) { if (caller_application->application_data && (p = strstr(caller_application->application_data, "\\'"))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "App not added, Invalid character sequence in data string [%s]\n", switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "App not added, Invalid character sequence in data string [%s]\n",
caller_application->application_data); caller_application->application_data);
return; return;
} }

View File

@ -3345,15 +3345,19 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_answer(switch_channel_t *
memset(c, 0, olen - cpos);\ memset(c, 0, olen - cpos);\
}} \ }} \
SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *channel, const char *in, switch_event_t *var_list, switch_event_t *api_list) SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *channel, const char *in, switch_event_t *var_list, switch_event_t *api_list, uint32_t recur)
{ {
char *p, *c = NULL; char *p, *c = NULL;
char *data, *indup, *endof_indup; char *data, *indup, *endof_indup;
size_t sp = 0, len = 0, olen = 0, vtype = 0, br = 0, cpos, block = 128; size_t sp = 0, len = 0, olen = 0, vtype = 0, br = 0, cpos, block = 128;
char *cloned_sub_val = NULL, *sub_val = NULL; char *cloned_sub_val = NULL, *sub_val = NULL, *expanded_sub_val = NULL;
char *func_val = NULL, *sb = NULL; char *func_val = NULL, *sb = NULL;
int nv = 0; int nv = 0;
if (recur > 100) {
return (char *) in;
}
if (zstr(in)) { if (zstr(in)) {
return (char *) in; return (char *) in;
} }
@ -3482,8 +3486,8 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *c
int ooffset = 0; int ooffset = 0;
char *ptr; char *ptr;
int idx = -1; int idx = -1;
if ((expanded = switch_channel_expand_variables_check(channel, (char *) vname, var_list, api_list)) == vname) { if ((expanded = switch_channel_expand_variables_check(channel, (char *) vname, var_list, api_list, recur+1)) == vname) {
expanded = NULL; expanded = NULL;
} else { } else {
vname = expanded; vname = expanded;
@ -3508,6 +3512,12 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *c
sub_val = "INVALID"; sub_val = "INVALID";
} }
if ((expanded_sub_val = switch_channel_expand_variables_check(channel, sub_val, var_list, api_list, recur+1)) == sub_val) {
expanded_sub_val = NULL;
} else {
sub_val = expanded_sub_val;
}
if (offset || ooffset) { if (offset || ooffset) {
cloned_sub_val = strdup(sub_val); cloned_sub_val = strdup(sub_val);
switch_assert(cloned_sub_val); switch_assert(cloned_sub_val);
@ -3541,13 +3551,13 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *c
if (stream.data) { if (stream.data) {
char *expanded_vname = NULL; char *expanded_vname = NULL;
if ((expanded_vname = switch_channel_expand_variables_check(channel, (char *) vname, var_list, api_list)) == vname) { if ((expanded_vname = switch_channel_expand_variables_check(channel, (char *) vname, var_list, api_list, recur+1)) == vname) {
expanded_vname = NULL; expanded_vname = NULL;
} else { } else {
vname = expanded_vname; vname = expanded_vname;
} }
if ((expanded = switch_channel_expand_variables_check(channel, vval, var_list, api_list)) == vval) { if ((expanded = switch_channel_expand_variables_check(channel, vval, var_list, api_list, recur+1)) == vval) {
expanded = NULL; expanded = NULL;
} else { } else {
vval = expanded; vval = expanded;
@ -3587,6 +3597,7 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *c
switch_safe_free(func_val); switch_safe_free(func_val);
switch_safe_free(cloned_sub_val); switch_safe_free(cloned_sub_val);
switch_safe_free(expanded_sub_val);
sub_val = NULL; sub_val = NULL;
vname = NULL; vname = NULL;
vtype = 0; vtype = 0;

View File

@ -1885,7 +1885,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(switch_core_flag_t
return SWITCH_STATUS_GENERR; return SWITCH_STATUS_GENERR;
} }
switch_load_network_lists(SWITCH_FALSE);
switch_load_core_config("post_load_switch.conf"); switch_load_core_config("post_load_switch.conf");

View File

@ -531,7 +531,7 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_
switch_codec2str(read_codec, rc, sizeof(rc)); switch_codec2str(read_codec, rc, sizeof(rc));
if (vid_read_codec && vid_read_codec->implementation && switch_core_codec_ready(vid_read_codec)) { if (vid_read_codec && vid_read_codec->implementation && switch_core_codec_ready(vid_read_codec)) {
vrc[0] = ','; vrc[0] = ',';
switch_codec2str(read_codec, vrc + 1, sizeof(vrc) - 1); switch_codec2str(vid_read_codec, vrc + 1, sizeof(vrc) - 1);
switch_channel_set_variable(peer_channel, SWITCH_ORIGINATOR_VIDEO_CODEC_VARIABLE, vrc + 1); switch_channel_set_variable(peer_channel, SWITCH_ORIGINATOR_VIDEO_CODEC_VARIABLE, vrc + 1);
} }
@ -1465,7 +1465,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_uuid(switch_core_session
switch_mutex_lock(runtime.session_hash_mutex); switch_mutex_lock(runtime.session_hash_mutex);
if (switch_core_hash_find(session_manager.session_table, use_uuid)) { if (switch_core_hash_find(session_manager.session_table, use_uuid)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Duplicate UUID!\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Duplicate UUID!\n");
switch_mutex_unlock(runtime.session_hash_mutex); switch_mutex_unlock(runtime.session_hash_mutex);
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }

View File

@ -390,7 +390,7 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle(switch_cache_db_h
{ {
if (!switch_odbc_available()) { if (!switch_odbc_available()) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failure! ODBC NOT AVAILABLE!\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failure! ODBC NOT AVAILABLE! Can't connect to DSN %s\n", connection_options->odbc_options.dsn);
goto end; goto end;
} }
@ -415,7 +415,7 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle(switch_cache_db_h
} }
if (!db && !odbc_dbh) { if (!db && !odbc_dbh) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failure!\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failure to connect to %s %s!\n", db?"SQLITE":"ODBC", db?connection_options->core_db_options.db_path:connection_options->odbc_options.dsn);
goto end; goto end;
} }

View File

@ -1457,7 +1457,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_create_brackets(char *data, char a,
switch_event_t *e = *event; switch_event_t *e = *event;
char *var_array[1024] = { 0 }; char *var_array[1024] = { 0 };
int var_count = 0; int var_count = 0;
char *next; char *next = NULL, *vnext = NULL;
if (dup) { if (dup) {
vdatap = strdup(data); vdatap = strdup(data);
@ -1479,6 +1479,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_create_brackets(char *data, char a,
if (check_a) end = check_a; if (check_a) end = check_a;
if (end) { if (end) {
next = end;
vdata++; vdata++;
*end++ = '\0'; *end++ = '\0';
} else { } else {
@ -1494,13 +1495,17 @@ SWITCH_DECLARE(switch_status_t) switch_event_create_brackets(char *data, char a,
for (;;) { for (;;) {
if ((next = strchr(vdata, b))) { if (next) {
char *pnext; char *pnext;
*next++ = '\0'; *next++ = '\0';
if ((pnext = switch_strchr_strict(next, a, " "))) { if ((pnext = switch_strchr_strict(next, a, " "))) {
next = pnext + 1; next = pnext + 1;
} }
vnext = switch_find_end_paren(next, a, b);
next = NULL;
} }
@ -1525,8 +1530,8 @@ SWITCH_DECLARE(switch_status_t) switch_event_create_brackets(char *data, char a,
} }
} }
if (next) { if (vnext) {
vdata = next; vdata = vnext;
} else { } else {
break; break;
} }
@ -1987,17 +1992,21 @@ if ((dp = realloc(data, olen))) {\
memset(c, 0, olen - cpos);\ memset(c, 0, olen - cpos);\
}} \ }} \
SWITCH_DECLARE(char *) switch_event_expand_headers_check(switch_event_t *event, const char *in, switch_event_t *var_list, switch_event_t *api_list) SWITCH_DECLARE(char *) switch_event_expand_headers_check(switch_event_t *event, const char *in, switch_event_t *var_list, switch_event_t *api_list, uint32_t recur)
{ {
char *p, *c = NULL; char *p, *c = NULL;
char *data, *indup, *endof_indup; char *data, *indup, *endof_indup;
size_t sp = 0, len = 0, olen = 0, vtype = 0, br = 0, cpos, block = 128; size_t sp = 0, len = 0, olen = 0, vtype = 0, br = 0, cpos, block = 128;
const char *sub_val = NULL; const char *sub_val = NULL;
char *cloned_sub_val = NULL; char *cloned_sub_val = NULL, *expanded_sub_val = NULL;
char *func_val = NULL; char *func_val = NULL;
int nv = 0; int nv = 0;
char *gvar = NULL, *sb = NULL; char *gvar = NULL, *sb = NULL;
if (recur > 100) {
return (char *) in;
}
if (zstr(in)) { if (zstr(in)) {
return (char *) in; return (char *) in;
} }
@ -2127,7 +2136,7 @@ SWITCH_DECLARE(char *) switch_event_expand_headers_check(switch_event_t *event,
char *ptr; char *ptr;
int idx = -1; int idx = -1;
if ((expanded = switch_event_expand_headers_check(event, (char *) vname, var_list, api_list)) == vname) { if ((expanded = switch_event_expand_headers_check(event, (char *) vname, var_list, api_list, recur+1)) == vname) {
expanded = NULL; expanded = NULL;
} else { } else {
vname = expanded; vname = expanded;
@ -2156,23 +2165,30 @@ SWITCH_DECLARE(char *) switch_event_expand_headers_check(switch_event_t *event,
sub_val = "INVALID"; sub_val = "INVALID";
} }
}
if (offset || ooffset) { if ((expanded_sub_val = switch_event_expand_headers_check(event, sub_val, var_list, api_list, recur+1)) == sub_val) {
cloned_sub_val = strdup(sub_val); expanded_sub_val = NULL;
switch_assert(cloned_sub_val); } else {
sub_val = cloned_sub_val; sub_val = expanded_sub_val;
} }
if (offset >= 0) { if (offset || ooffset) {
sub_val += offset; cloned_sub_val = strdup(sub_val);
} else if ((size_t) abs(offset) <= strlen(sub_val)) { switch_assert(cloned_sub_val);
sub_val = cloned_sub_val + (strlen(cloned_sub_val) + offset); sub_val = cloned_sub_val;
} }
if (offset >= 0) {
sub_val += offset;
} else if ((size_t) abs(offset) <= strlen(sub_val)) {
sub_val = cloned_sub_val + (strlen(cloned_sub_val) + offset);
}
if (ooffset > 0 && (size_t) ooffset < strlen(sub_val)) { if (ooffset > 0 && (size_t) ooffset < strlen(sub_val)) {
if ((ptr = (char *) sub_val + ooffset)) { if ((ptr = (char *) sub_val + ooffset)) {
*ptr = '\0'; *ptr = '\0';
}
} }
} }
@ -2186,13 +2202,13 @@ SWITCH_DECLARE(char *) switch_event_expand_headers_check(switch_event_t *event,
if (stream.data) { if (stream.data) {
char *expanded_vname = NULL; char *expanded_vname = NULL;
if ((expanded_vname = switch_event_expand_headers_check(event, (char *) vname, var_list, api_list)) == vname) { if ((expanded_vname = switch_event_expand_headers_check(event, (char *) vname, var_list, api_list, recur+1)) == vname) {
expanded_vname = NULL; expanded_vname = NULL;
} else { } else {
vname = expanded_vname; vname = expanded_vname;
} }
if ((expanded = switch_event_expand_headers_check(event, vval, var_list, api_list)) == vval) { if ((expanded = switch_event_expand_headers_check(event, vval, var_list, api_list, recur+1)) == vval) {
expanded = NULL; expanded = NULL;
} else { } else {
vval = expanded; vval = expanded;
@ -2232,6 +2248,7 @@ SWITCH_DECLARE(char *) switch_event_expand_headers_check(switch_event_t *event,
switch_safe_free(func_val); switch_safe_free(func_val);
switch_safe_free(cloned_sub_val); switch_safe_free(cloned_sub_val);
switch_safe_free(expanded_sub_val);
sub_val = NULL; sub_val = NULL;
vname = NULL; vname = NULL;
vtype = 0; vtype = 0;

View File

@ -264,7 +264,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session,
if (args->input_callback) { if (args->input_callback) {
status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen); status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
} else if (args->buf) { } else if (args->buf) {
switch_copy_string((char *) args->buf, (void *) &dtmf, args->buflen); *((char *) args->buf) = dtmf.digit;
status = SWITCH_STATUS_BREAK; status = SWITCH_STATUS_BREAK;
} }
} }

View File

@ -644,7 +644,7 @@ SWITCH_DECLARE(void) switch_ivr_session_echo(switch_core_session_t *session, swi
if (args->input_callback) { if (args->input_callback) {
status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen); status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
} else { } else {
switch_copy_string((char *) args->buf, (void *) &dtmf, args->buflen); *((char *) args->buf) = dtmf.digit;
status = SWITCH_STATUS_BREAK; status = SWITCH_STATUS_BREAK;
} }
} }

View File

@ -70,7 +70,7 @@ static void *SWITCH_THREAD_FUNC video_bridge_thread(switch_thread_t *thread, voi
} }
switch_core_session_kill_channel(vh->session_b, SWITCH_SIG_BREAK); switch_core_session_kill_channel(vh->session_b, SWITCH_SIG_BREAK);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s video thread ended.\n", switch_channel_get_name(channel)); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(vh->session_a), SWITCH_LOG_DEBUG, "%s video thread ended.\n", switch_channel_get_name(channel));
vh->up = 0; vh->up = 0;
return NULL; return NULL;
@ -243,7 +243,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
if (bypass_media_after_bridge) { if (bypass_media_after_bridge) {
if (switch_stristr("loopback", switch_channel_get_name(chan_a)) || switch_stristr("loopback", switch_channel_get_name(chan_b))) { if (switch_stristr("loopback", switch_channel_get_name(chan_a)) || switch_stristr("loopback", switch_channel_get_name(chan_b))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot bypass media while bridged to a loopback address.\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a), SWITCH_LOG_WARNING, "Cannot bypass media while bridged to a loopback address.\n");
bypass_media_after_bridge = 0; bypass_media_after_bridge = 0;
} }
} }
@ -253,7 +253,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
switch_core_session_get_read_impl(session_a, &read_impl); switch_core_session_get_read_impl(session_a, &read_impl);
if (!switch_channel_media_ready(chan_a)) { if (!switch_channel_media_ready(chan_a)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Channel has no media!\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a), SWITCH_LOG_ERROR, "Channel has no media!\n");
goto end_of_bridge_loop; goto end_of_bridge_loop;
} }
@ -277,7 +277,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
silence_val = 0; silence_val = 0;
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setup generated silence from %s to %s at %d\n", switch_channel_get_name(chan_a), switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a), SWITCH_LOG_DEBUG, "Setup generated silence from %s to %s at %d\n", switch_channel_get_name(chan_a),
switch_channel_get_name(chan_b), silence_val); switch_channel_get_name(chan_b), silence_val);
silence_frame.codec = &silence_codec; silence_frame.codec = &silence_codec;
silence_frame.data = silence_data; silence_frame.data = silence_data;
@ -380,7 +380,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
if (cb_status == SWITCH_STATUS_IGNORE) { if (cb_status == SWITCH_STATUS_IGNORE) {
send_dtmf = 0; send_dtmf = 0;
} else if (cb_status != SWITCH_STATUS_SUCCESS) { } else if (cb_status != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s ended call via DTMF\n", switch_channel_get_name(chan_a)); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a), SWITCH_LOG_DEBUG, "%s ended call via DTMF\n", switch_channel_get_name(chan_a));
switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK); switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK);
goto end_of_bridge_loop; goto end_of_bridge_loop;
} }
@ -406,7 +406,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
} }
if (!ans_a && answer_limit && switch_epoch_time_now(NULL) > answer_limit) { if (!ans_a && answer_limit && switch_epoch_time_now(NULL) > answer_limit) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Answer timeout hit on %s.\n", switch_channel_get_name(chan_a)); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a), SWITCH_LOG_DEBUG, "Answer timeout hit on %s.\n", switch_channel_get_name(chan_a));
switch_channel_hangup(chan_a, SWITCH_CAUSE_ALLOTTED_TIMEOUT); switch_channel_hangup(chan_a, SWITCH_CAUSE_ALLOTTED_TIMEOUT);
} }
@ -415,13 +415,13 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
if (!ans_b && switch_channel_test_flag(chan_b, CF_ANSWERED)) { if (!ans_b && switch_channel_test_flag(chan_b, CF_ANSWERED)) {
switch_channel_pass_callee_id(chan_b, chan_a); switch_channel_pass_callee_id(chan_b, chan_a);
if (switch_channel_answer(chan_a) != SWITCH_STATUS_SUCCESS) { if (switch_channel_answer(chan_a) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Media Establishment Failed.\n", switch_channel_get_name(chan_a)); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a), SWITCH_LOG_DEBUG, "%s Media Establishment Failed.\n", switch_channel_get_name(chan_a));
goto end_of_bridge_loop; goto end_of_bridge_loop;
} }
ans_a = 1; ans_a = 1;
} else if (!pre_b && switch_channel_test_flag(chan_b, CF_EARLY_MEDIA)) { } else if (!pre_b && switch_channel_test_flag(chan_b, CF_EARLY_MEDIA)) {
if (switch_channel_pre_answer(chan_a) != SWITCH_STATUS_SUCCESS) { if (switch_channel_pre_answer(chan_a) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Media Establishment Failed.\n", switch_channel_get_name(chan_a)); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a), SWITCH_LOG_DEBUG, "%s Media Establishment Failed.\n", switch_channel_get_name(chan_a));
goto end_of_bridge_loop; goto end_of_bridge_loop;
} }
pre_b = 1; pre_b = 1;
@ -445,7 +445,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
} }
if (switch_channel_answer(un) != SWITCH_STATUS_SUCCESS) { if (switch_channel_answer(un) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Media Establishment Failed.\n", switch_channel_get_name(un)); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a), SWITCH_LOG_DEBUG, "%s Media Establishment Failed.\n", switch_channel_get_name(un));
goto end_of_bridge_loop; goto end_of_bridge_loop;
} }
@ -496,13 +496,13 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
if (status != SWITCH_STATUS_BREAK && !switch_channel_test_flag(chan_a, CF_HOLD)) { if (status != SWITCH_STATUS_BREAK && !switch_channel_test_flag(chan_a, CF_HOLD)) {
if (switch_core_session_write_frame(session_b, read_frame, SWITCH_IO_FLAG_NONE, stream_id) != SWITCH_STATUS_SUCCESS) { if (switch_core_session_write_frame(session_b, read_frame, SWITCH_IO_FLAG_NONE, stream_id) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a), SWITCH_LOG_DEBUG,
"%s ending bridge by request from write function\n", switch_channel_get_name(chan_b)); "%s ending bridge by request from write function\n", switch_channel_get_name(chan_b));
goto end_of_bridge_loop; goto end_of_bridge_loop;
} }
} }
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s ending bridge by request from read function\n", switch_channel_get_name(chan_a)); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a), SWITCH_LOG_DEBUG, "%s ending bridge by request from read function\n", switch_channel_get_name(chan_a));
goto end_of_bridge_loop; goto end_of_bridge_loop;
} }
} }
@ -516,7 +516,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
switch_channel_set_flag(chan_b, CF_NOT_READY); switch_channel_set_flag(chan_b, CF_NOT_READY);
switch_core_session_kill_channel(session_a, SWITCH_SIG_BREAK); switch_core_session_kill_channel(session_a, SWITCH_SIG_BREAK);
switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK); switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Ending video thread.\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a), SWITCH_LOG_DEBUG, "Ending video thread.\n");
} }
#endif #endif
@ -538,7 +538,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
} }
SWITCH_STANDARD_STREAM(stream); SWITCH_STANDARD_STREAM(stream);
switch_api_execute(cmd, arg, NULL, &stream); switch_api_execute(cmd, arg, NULL, &stream);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\nPost-Bridge Command %s(%s):\n%s\n", cmd, arg, switch_str_nil((char *) stream.data)); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a), SWITCH_LOG_DEBUG, "\nPost-Bridge Command %s(%s):\n%s\n", cmd, arg, switch_str_nil((char *) stream.data));
switch_safe_free(stream.data); switch_safe_free(stream.data);
} }
@ -546,7 +546,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
if ((app_name = switch_channel_get_variable(chan_a, SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE))) { if ((app_name = switch_channel_get_variable(chan_a, SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE))) {
switch_caller_extension_t *extension = NULL; switch_caller_extension_t *extension = NULL;
if ((extension = switch_caller_extension_new(session_a, app_name, app_name)) == 0) { if ((extension = switch_caller_extension_new(session_a, app_name, app_name)) == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "memory error!\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a), SWITCH_LOG_CRIT, "memory error!\n");
goto end; goto end;
} }
app_arg = switch_channel_get_variable(chan_a, SWITCH_EXEC_AFTER_BRIDGE_ARG_VARIABLE); app_arg = switch_channel_get_variable(chan_a, SWITCH_EXEC_AFTER_BRIDGE_ARG_VARIABLE);
@ -572,7 +572,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
switch_core_session_kill_channel(session_a, SWITCH_SIG_BREAK); switch_core_session_kill_channel(session_a, SWITCH_SIG_BREAK);
switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK); switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK);
} }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Ending video thread.\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a), SWITCH_LOG_DEBUG, "Ending video thread.\n");
switch_thread_join(&st, vid_thread); switch_thread_join(&st, vid_thread);
switch_channel_clear_flag(chan_a, CF_NOT_READY); switch_channel_clear_flag(chan_a, CF_NOT_READY);
switch_channel_clear_flag(chan_b, CF_NOT_READY); switch_channel_clear_flag(chan_b, CF_NOT_READY);
@ -583,7 +583,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
switch_core_session_reset(session_a, SWITCH_TRUE, SWITCH_TRUE); switch_core_session_reset(session_a, SWITCH_TRUE, SWITCH_TRUE);
switch_channel_set_variable(chan_a, SWITCH_BRIDGE_VARIABLE, NULL); switch_channel_set_variable(chan_a, SWITCH_BRIDGE_VARIABLE, NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "BRIDGE THREAD DONE [%s]\n", switch_channel_get_name(chan_a)); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a), SWITCH_LOG_DEBUG, "BRIDGE THREAD DONE [%s]\n", switch_channel_get_name(chan_a));
switch_channel_clear_flag(chan_a, CF_BRIDGED); switch_channel_clear_flag(chan_a, CF_BRIDGED);
if (switch_channel_test_flag(chan_a, CF_LEG_HOLDING) && switch_channel_ready(chan_b)) { if (switch_channel_test_flag(chan_a, CF_LEG_HOLDING) && switch_channel_ready(chan_b)) {
@ -625,7 +625,7 @@ static void transfer_after_bridge(switch_core_session_t *session, const char *wh
if ((argc = switch_separate_string(mydata, ':', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) { if ((argc = switch_separate_string(mydata, ':', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
switch_ivr_session_transfer(session, argv[0], argv[1], argv[2]); switch_ivr_session_transfer(session, argv[0], argv[1], argv[2]);
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No extension specified.\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No extension specified.\n");
} }
} }
} }
@ -684,7 +684,7 @@ static switch_status_t audio_bridge_on_routing(switch_core_session_t *session)
{ {
switch_channel_t *channel = switch_core_session_get_channel(session); switch_channel_t *channel = switch_core_session_get_channel(session);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CUSTOM ROUTING\n", switch_channel_get_name(channel)); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CUSTOM ROUTING\n", switch_channel_get_name(channel));
/* put the channel in a passive state so we can loop audio to it */ /* put the channel in a passive state so we can loop audio to it */
switch_channel_set_state(channel, CS_CONSUME_MEDIA); switch_channel_set_state(channel, CS_CONSUME_MEDIA);
@ -695,7 +695,7 @@ static switch_status_t audio_bridge_on_consume_media(switch_core_session_t *sess
{ {
switch_channel_t *channel = switch_core_session_get_channel(session); switch_channel_t *channel = switch_core_session_get_channel(session);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CUSTOM HOLD\n", switch_channel_get_name(channel)); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CUSTOM HOLD\n", switch_channel_get_name(channel));
/* put the channel in a passive state so we can loop audio to it */ /* put the channel in a passive state so we can loop audio to it */
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
@ -731,7 +731,7 @@ static switch_status_t uuid_bridge_on_reset(switch_core_session_t *session)
{ {
switch_channel_t *channel = switch_core_session_get_channel(session); switch_channel_t *channel = switch_core_session_get_channel(session);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CUSTOM RESET\n", switch_channel_get_name(channel)); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CUSTOM RESET\n", switch_channel_get_name(channel));
switch_channel_clear_flag(channel, CF_ORIGINATING); switch_channel_clear_flag(channel, CF_ORIGINATING);
@ -756,7 +756,7 @@ static switch_status_t uuid_bridge_on_soft_execute(switch_core_session_t *sessio
switch_core_session_t *other_session; switch_core_session_t *other_session;
const char *other_uuid = NULL; const char *other_uuid = NULL;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CUSTOM SOFT_EXECUTE\n", switch_channel_get_name(channel)); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CUSTOM SOFT_EXECUTE\n", switch_channel_get_name(channel));
switch_channel_clear_state_handler(channel, &uuid_bridge_state_handlers); switch_channel_clear_state_handler(channel, &uuid_bridge_state_handlers);
if (!switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) { if (!switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) {
@ -1383,7 +1383,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses
} }
if (status != SWITCH_STATUS_SUCCESS) { if (status != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Bridge Failed %s->%s\n", switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Bridge Failed %s->%s\n",
switch_channel_get_name(caller_channel), switch_channel_get_name(peer_channel) switch_channel_get_name(caller_channel), switch_channel_get_name(peer_channel)
); );
switch_channel_hangup(peer_channel, SWITCH_CAUSE_NO_ANSWER); switch_channel_hangup(peer_channel, SWITCH_CAUSE_NO_ANSWER);
@ -1511,7 +1511,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(const char *originator_uu
if (switch_channel_down_nosig(originator_channel)) { if (switch_channel_down_nosig(originator_channel)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s is hungup refusing to bridge.\n", switch_channel_get_name(originatee_channel)); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(originator_session), SWITCH_LOG_DEBUG, "%s is hungup refusing to bridge.\n", switch_channel_get_name(originatee_channel));
switch_core_session_rwunlock(originator_session); switch_core_session_rwunlock(originator_session);
switch_core_session_rwunlock(originatee_session); switch_core_session_rwunlock(originatee_session);
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
@ -1526,9 +1526,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(const char *originator_uu
swap_channel = originator_channel; swap_channel = originator_channel;
originator_channel = originatee_channel; originator_channel = originatee_channel;
originatee_channel = swap_channel; originatee_channel = swap_channel;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "reversing order of channels so this will work!\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(originatee_session), SWITCH_LOG_WARNING, "reversing order of channels so this will work!\n");
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Neither channel is answered, cannot bridge them.\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(originator_session), SWITCH_LOG_CRIT, "Neither channel is answered, cannot bridge them.\n");
switch_core_session_rwunlock(originator_session); switch_core_session_rwunlock(originator_session);
switch_core_session_rwunlock(originatee_session); switch_core_session_rwunlock(originatee_session);
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
@ -1627,11 +1627,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(const char *originator_uu
switch_core_session_rwunlock(originatee_session); switch_core_session_rwunlock(originatee_session);
} else { } else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(originator_session), SWITCH_LOG_DEBUG, "originatee uuid %s is not present\n", originatee_uuid);
switch_core_session_rwunlock(originator_session); switch_core_session_rwunlock(originator_session);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "originatee uuid %s is not present\n", originatee_uuid);
} }
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "originator uuid %s is not present\n", originator_uuid); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(originator_session), SWITCH_LOG_DEBUG, "originator uuid %s is not present\n", originator_uuid);
} }
return status; return status;
@ -1670,13 +1670,13 @@ SWITCH_DECLARE(void) switch_ivr_intercept_session(switch_core_session_t *session
if (switch_ivr_find_bridged_uuid(uuid, brto, sizeof(brto)) == SWITCH_STATUS_SUCCESS) { if (switch_ivr_find_bridged_uuid(uuid, brto, sizeof(brto)) == SWITCH_STATUS_SUCCESS) {
uuid = switch_core_session_strdup(session, brto); uuid = switch_core_session_strdup(session, brto);
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "no uuid bridged to %s\n", uuid); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "no uuid bridged to %s\n", uuid);
return; return;
} }
} }
if (zstr(uuid) || !(rsession = switch_core_session_locate(uuid))) { if (zstr(uuid) || !(rsession = switch_core_session_locate(uuid))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "no uuid %s\n", uuid); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "no uuid %s\n", uuid);
return; return;
} }

View File

@ -122,6 +122,7 @@ typedef struct {
int bridge_early_media; int bridge_early_media;
switch_thread_t *ethread; switch_thread_t *ethread;
switch_caller_profile_t *caller_profile_override; switch_caller_profile_t *caller_profile_override;
switch_bool_t check_vars;
switch_memory_pool_t *pool; switch_memory_pool_t *pool;
} originate_global_t; } originate_global_t;
@ -997,6 +998,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t
switch_core_file_seek(ringback.fh, &pos, 0, SEEK_SET); switch_core_file_seek(ringback.fh, &pos, 0, SEEK_SET);
switch_core_file_read(ringback.fh, write_frame.data, &olen); switch_core_file_read(ringback.fh, write_frame.data, &olen);
if (olen == 0) { if (olen == 0) {
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(caller_channel), SWITCH_LOG_ERROR,
"Failure to read or re-read after seeking to beginning on file [%s]\n", ringback.fh->file_path);
break; break;
} }
} }
@ -1202,7 +1205,7 @@ static switch_status_t setup_ringback(originate_global_t *oglobals, originate_st
read_codec->implementation->number_of_channels, read_codec->implementation->number_of_channels,
read_codec->implementation->actual_samples_per_second, read_codec->implementation->actual_samples_per_second,
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) { SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Playing File\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(oglobals->session), SWITCH_LOG_ERROR, "Error Playing File\n");
switch_safe_free(tmp_data); switch_safe_free(tmp_data);
switch_goto_status(SWITCH_STATUS_GENERR, end); switch_goto_status(SWITCH_STATUS_GENERR, end);
//switch_goto_status(SWITCH_STATUS_FALSE, end); //switch_goto_status(SWITCH_STATUS_FALSE, end);
@ -1224,12 +1227,12 @@ static switch_status_t setup_ringback(originate_global_t *oglobals, originate_st
teletone_init_session(&ringback->ts, 0, teletone_handler, ringback); teletone_init_session(&ringback->ts, 0, teletone_handler, ringback);
ringback->ts.rate = read_codec->implementation->actual_samples_per_second; ringback->ts.rate = read_codec->implementation->actual_samples_per_second;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Play Ringback Tone [%s]\n", ringback_data); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(oglobals->session), SWITCH_LOG_DEBUG, "Play Ringback Tone [%s]\n", ringback_data);
/* ringback->ts.debug = 1; /* ringback->ts.debug = 1;
ringback->ts.debug_stream = switch_core_get_console(); */ ringback->ts.debug_stream = switch_core_get_console(); */
if (teletone_run(&ringback->ts, ringback_data)) { if (teletone_run(&ringback->ts, ringback_data)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Playing Tone\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(oglobals->session), SWITCH_LOG_ERROR, "Error Playing Tone\n");
teletone_destroy_session(&ringback->ts); teletone_destroy_session(&ringback->ts);
switch_buffer_destroy(&ringback->audio_buffer); switch_buffer_destroy(&ringback->audio_buffer);
switch_goto_status(SWITCH_STATUS_GENERR, end); switch_goto_status(SWITCH_STATUS_GENERR, end);
@ -1410,7 +1413,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess
} }
/* extract channel variables, allowing multiple sets of braces */ /* extract channel variables, allowing multiple sets of braces */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Parsing ultra-global variables\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Parsing ultra-global variables\n");
while (*data == '<') { while (*data == '<') {
char *parsed = NULL; char *parsed = NULL;
@ -1762,6 +1765,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
caller_profile_override, ovars, flags, cancel_cause); caller_profile_override, ovars, flags, cancel_cause);
} }
oglobals.check_vars = SWITCH_TRUE;
oglobals.ringback_ok = 1; oglobals.ringback_ok = 1;
oglobals.bridge_early_media = -1; oglobals.bridge_early_media = -1;
oglobals.file = NULL; oglobals.file = NULL;
@ -1880,8 +1884,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
data++; data++;
} }
if ((ovars && switch_true(switch_event_get_header(ovars,"origination_nested_vars"))) ||
(caller_channel && switch_true(switch_channel_get_variable(caller_channel, "origination_nested_vars")))
|| switch_true(switch_core_get_variable("origination_nested_vars")) || switch_stristr("origination_nested_vars=true", data)) {
oglobals.check_vars = SWITCH_FALSE;
}
/* extract channel variables, allowing multiple sets of braces */ /* extract channel variables, allowing multiple sets of braces */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Parsing global variables\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Parsing global variables\n");
while (*data == '{') { while (*data == '{') {
char *parsed = NULL; char *parsed = NULL;
@ -2298,7 +2308,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
if (*chan_type == '[') { if (*chan_type == '[') {
switch_event_create_plain(&local_var_event, SWITCH_EVENT_CHANNEL_DATA); switch_event_create_plain(&local_var_event, SWITCH_EVENT_CHANNEL_DATA);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Parsing session specific variables\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Parsing session specific variables\n");
} }
while (*chan_type == '[') { while (*chan_type == '[') {
@ -2508,7 +2518,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
switch_event_header_t *header; switch_event_header_t *header;
/* install the vars from the {} params */ /* install the vars from the {} params */
for (header = var_event->headers; header; header = header->next) { for (header = var_event->headers; header; header = header->next) {
switch_channel_set_variable(originate_status[i].peer_channel, header->name, header->value); switch_channel_set_variable_var_check(originate_status[i].peer_channel, header->name, header->value, oglobals.check_vars);
} }
} }
} }
@ -2517,7 +2527,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
if (local_var_event) { if (local_var_event) {
switch_event_header_t *header; switch_event_header_t *header;
for (header = local_var_event->headers; header; header = header->next) { for (header = local_var_event->headers; header; header = header->next) {
switch_channel_set_variable(originate_status[i].peer_channel, header->name, header->value); switch_channel_set_variable_var_check(originate_status[i].peer_channel, header->name, header->value, oglobals.check_vars);
} }
switch_event_destroy(&local_var_event); switch_event_destroy(&local_var_event);
} }
@ -2527,7 +2537,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
switch_event_header_t *header; switch_event_header_t *header;
/* install the vars from the {} params */ /* install the vars from the {} params */
for (header = var_event->headers; header; header = header->next) { for (header = var_event->headers; header; header = header->next) {
switch_channel_set_variable(originate_status[i].peer_channel, header->name, header->value); switch_channel_set_variable_var_check(originate_status[i].peer_channel, header->name, header->value, oglobals.check_vars);
} }
} }
} }

View File

@ -1113,7 +1113,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
if (cur) { if (cur) {
fh->samples = sample_start = 0; fh->samples = sample_start = 0;
if (sleep_val_i) { if (sleep_val_i) {
switch_ivr_sleep(session, sleep_val_i, SWITCH_FALSE, args); status = switch_ivr_sleep(session, sleep_val_i, SWITCH_FALSE, args);
if(status != SWITCH_STATUS_SUCCESS) {
break;
}
} }
} }

View File

@ -543,7 +543,7 @@ SWITCH_DECLARE(void) switch_core_memory_reclaim_logger(void)
#ifdef SWITCH_LOG_RECYCLE #ifdef SWITCH_LOG_RECYCLE
void *pop; void *pop;
int size = switch_queue_size(LOG_RECYCLE_QUEUE); int size = switch_queue_size(LOG_RECYCLE_QUEUE);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Returning %d recycled log node(s) %d bytes\n", size, switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CONSOLE, "Returning %d recycled log node(s) %d bytes\n", size,
(int) sizeof(switch_log_node_t) * size); (int) sizeof(switch_log_node_t) * size);
while (switch_queue_trypop(LOG_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS) { while (switch_queue_trypop(LOG_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS) {
switch_log_node_free(&pop); switch_log_node_free(&pop);

View File

@ -286,14 +286,15 @@ static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_
{ {
#ifdef DEBUG_2833 #ifdef DEBUG_2833
if (rtp_session->dtmf_data.in_digit_sanity && !(rtp_session->dtmf_data.in_digit_sanity % 100)) { if (rtp_session->dtmf_data.in_digit_sanity && !(rtp_session->dtmf_data.in_digit_sanity % 100)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "sanity %d\n", rtp_session->dtmf_data.in_digit_sanity); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "sanity %d\n", rtp_session->dtmf_data.in_digit_sanity);
} }
#endif #endif
if (rtp_session->dtmf_data.in_digit_sanity && !--rtp_session->dtmf_data.in_digit_sanity) { if (rtp_session->dtmf_data.in_digit_sanity && !--rtp_session->dtmf_data.in_digit_sanity) {
switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
rtp_session->dtmf_data.last_digit = 0; rtp_session->dtmf_data.last_digit = 0;
rtp_session->dtmf_data.in_digit_ts = 0; rtp_session->dtmf_data.in_digit_ts = 0;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed DTMF sanity check.\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed DTMF sanity check.\n");
} }
/* RFC2833 ... like all RFC RE: VoIP, guaranteed to drive you to insanity! /* RFC2833 ... like all RFC RE: VoIP, guaranteed to drive you to insanity!
@ -312,13 +313,15 @@ static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_
uint32_t ts; uint32_t ts;
if (!(packet[0] || packet[1] || packet[2] || packet[3]) && len >= 8) { if (!(packet[0] || packet[1] || packet[2] || packet[3]) && len >= 8) {
switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
packet += 4; packet += 4;
len -= 4; len -= 4;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "DTMF payload offset by 4 bytes.\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "DTMF payload offset by 4 bytes.\n");
} }
if (!(packet[0] || packet[1] || packet[2] || packet[3])) { if (!(packet[0] || packet[1] || packet[2] || packet[3])) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed DTMF payload check.\n"); switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed DTMF payload check.\n");
rtp_session->dtmf_data.last_digit = 0; rtp_session->dtmf_data.last_digit = 0;
rtp_session->dtmf_data.in_digit_ts = 0; rtp_session->dtmf_data.in_digit_ts = 0;
rtp_session->dtmf_data.in_digit_sanity = 0; rtp_session->dtmf_data.in_digit_sanity = 0;
@ -336,7 +339,7 @@ static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_
} }
} }
#ifdef DEBUG_2833 #ifdef DEBUG_2833
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "packet[%d]: %02x %02x %02x %02x\n", (int) len, (unsigned) packet[0], (unsigned) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "packet[%d]: %02x %02x %02x %02x\n", (int) len, (unsigned) packet[0], (unsigned)
packet[1], (unsigned) packet[2], (unsigned) packet[3]); packet[1], (unsigned) packet[2], (unsigned) packet[3]);
#endif #endif
@ -345,7 +348,7 @@ static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_
rtp_session->dtmf_data.in_digit_seq = in_digit_seq; rtp_session->dtmf_data.in_digit_seq = in_digit_seq;
#ifdef DEBUG_2833 #ifdef DEBUG_2833
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "read: %c %u %u %u %u %d %d %s\n", switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "read: %c %u %u %u %u %d %d %s\n",
key, in_digit_seq, rtp_session->dtmf_data.in_digit_seq, key, in_digit_seq, rtp_session->dtmf_data.in_digit_seq,
ts, duration, rtp_session->recv_msg.header.m, end, end && !rtp_session->dtmf_data.in_digit_ts ? "ignored" : ""); ts, duration, rtp_session->recv_msg.header.m, end, end && !rtp_session->dtmf_data.in_digit_ts ? "ignored" : "");
#endif #endif
@ -354,7 +357,7 @@ static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_
rtp_session->dtmf_data.in_digit_ts) { rtp_session->dtmf_data.in_digit_ts) {
switch_dtmf_t dtmf = { key, switch_core_min_dtmf_duration(0), 0, SWITCH_DTMF_RTP }; switch_dtmf_t dtmf = { key, switch_core_min_dtmf_duration(0), 0, SWITCH_DTMF_RTP };
#ifdef DEBUG_2833 #ifdef DEBUG_2833
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Early Queuing digit %c:%d\n", dtmf.digit, dtmf.duration / 8); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Early Queuing digit %c:%d\n", dtmf.digit, dtmf.duration / 8);
#endif #endif
switch_rtp_queue_rfc2833_in(rtp_session, &dtmf); switch_rtp_queue_rfc2833_in(rtp_session, &dtmf);
rtp_session->dtmf_data.in_digit_queued = 1; rtp_session->dtmf_data.in_digit_queued = 1;
@ -373,7 +376,7 @@ static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_
if (end) { if (end) {
if (!rtp_session->dtmf_data.in_digit_ts && rtp_session->dtmf_data.last_in_digit_ts != ts) { if (!rtp_session->dtmf_data.in_digit_ts && rtp_session->dtmf_data.last_in_digit_ts != ts) {
#ifdef DEBUG_2833 #ifdef DEBUG_2833
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "start with end packet %d\n", ts); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "start with end packet %d\n", ts);
#endif #endif
rtp_session->dtmf_data.last_in_digit_ts = ts; rtp_session->dtmf_data.last_in_digit_ts = ts;
rtp_session->dtmf_data.in_digit_ts = ts; rtp_session->dtmf_data.in_digit_ts = ts;
@ -390,17 +393,17 @@ static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_
dtmf.duration += rtp_session->dtmf_data.flip * 0xFFFF; dtmf.duration += rtp_session->dtmf_data.flip * 0xFFFF;
rtp_session->dtmf_data.flip = 0; rtp_session->dtmf_data.flip = 0;
#ifdef DEBUG_2833 #ifdef DEBUG_2833
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "you're welcome!\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "you're welcome!\n");
#endif #endif
} }
#ifdef DEBUG_2833 #ifdef DEBUG_2833
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "done digit=%c ts=%u start_ts=%u dur=%u ddur=%u\n", switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "done digit=%c ts=%u start_ts=%u dur=%u ddur=%u\n",
dtmf.digit, ts, rtp_session->dtmf_data.in_digit_ts, duration, dtmf.duration); dtmf.digit, ts, rtp_session->dtmf_data.in_digit_ts, duration, dtmf.duration);
#endif #endif
if (!(rtp_session->rtp_bugs & RTP_BUG_IGNORE_DTMF_DURATION) && !rtp_session->dtmf_data.in_digit_queued) { if (!(rtp_session->rtp_bugs & RTP_BUG_IGNORE_DTMF_DURATION) && !rtp_session->dtmf_data.in_digit_queued) {
#ifdef DEBUG_2833 #ifdef DEBUG_2833
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Queuing digit %c:%d\n", dtmf.digit, dtmf.duration / 8); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Queuing digit %c:%d\n", dtmf.digit, dtmf.duration / 8);
#endif #endif
switch_rtp_queue_rfc2833_in(rtp_session, &dtmf); switch_rtp_queue_rfc2833_in(rtp_session, &dtmf);
} }
@ -421,7 +424,7 @@ static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_
} else if (!rtp_session->dtmf_data.in_digit_ts) { } else if (!rtp_session->dtmf_data.in_digit_ts) {
#ifdef DEBUG_2833 #ifdef DEBUG_2833
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "start %d\n", ts); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "start %d\n", ts);
#endif #endif
rtp_session->dtmf_data.in_digit_ts = ts; rtp_session->dtmf_data.in_digit_ts = ts;
rtp_session->dtmf_data.last_in_digit_ts = ts; rtp_session->dtmf_data.last_in_digit_ts = ts;
@ -432,7 +435,7 @@ static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_
rtp_session->dtmf_data.last_duration = duration; rtp_session->dtmf_data.last_duration = duration;
} else { } else {
#ifdef DEBUG_2833 #ifdef DEBUG_2833
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "drop: %c %u %u %u %u %d %d\n", switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "drop: %c %u %u %u %u %d %d\n",
key, in_digit_seq, rtp_session->dtmf_data.in_digit_seq, ts, duration, rtp_session->recv_msg.header.m, end); key, in_digit_seq, rtp_session->dtmf_data.in_digit_seq, ts, duration, rtp_session->recv_msg.header.m, end);
#endif #endif
switch_cond_next(); switch_cond_next();
@ -500,7 +503,7 @@ static switch_status_t do_stun_ping(switch_rtp_t *rtp_session)
elapsed = (unsigned int) ((switch_micro_time_now() - rtp_session->last_stun) / 1000); elapsed = (unsigned int) ((switch_micro_time_now() - rtp_session->last_stun) / 1000);
if (elapsed > 30000) { if (elapsed > 30000) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No stun for a long time (PUNT!)\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No stun for a long time (PUNT!)\n");
status = SWITCH_STATUS_FALSE; status = SWITCH_STATUS_FALSE;
goto end; goto end;
} }
@ -554,7 +557,8 @@ static switch_status_t ice_out(switch_rtp_t *rtp_session)
elapsed = (unsigned int) ((switch_micro_time_now() - rtp_session->last_stun) / 1000); elapsed = (unsigned int) ((switch_micro_time_now() - rtp_session->last_stun) / 1000);
if (elapsed > 30000) { if (elapsed > 30000) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No stun for a long time (PUNT!)\n"); switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No stun for a long time (PUNT!)\n");
status = SWITCH_STATUS_FALSE; status = SWITCH_STATUS_FALSE;
goto end; goto end;
} }
@ -610,7 +614,8 @@ static void handle_ice(switch_rtp_t *rtp_session, void *data, switch_size_t len)
memcpy(buf, data, cpylen); memcpy(buf, data, cpylen);
packet = switch_stun_packet_parse(buf, sizeof(buf)); packet = switch_stun_packet_parse(buf, sizeof(buf));
if (!packet) { if (!packet) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid STUN/ICE packet received\n"); switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid STUN/ICE packet received\n");
goto end; goto end;
} }
end_buf = buf + ((sizeof(buf) > packet->header.length) ? packet->header.length : sizeof(buf)); end_buf = buf + ((sizeof(buf) > packet->header.length) ? packet->header.length : sizeof(buf));
@ -755,14 +760,14 @@ static void zrtp_event_callback(zrtp_stream_t *stream, unsigned event)
#endif #endif
case ZRTP_EVENT_IS_CLIENT_ENROLLMENT: case ZRTP_EVENT_IS_CLIENT_ENROLLMENT:
{ {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Enrolled complete!\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Enrolled complete!\n");
switch_channel_set_variable_name_printf(channel, "true", "zrtp_enroll_complete_%s", type); switch_channel_set_variable_name_printf(channel, "true", "zrtp_enroll_complete_%s", type);
} }
break; break;
case ZRTP_EVENT_USER_ALREADY_ENROLLED: case ZRTP_EVENT_USER_ALREADY_ENROLLED:
{ {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "User already enrolled!\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "User already enrolled!\n");
switch_channel_set_variable_name_printf(channel, "true", "zrtp_already_enrolled_%s", type); switch_channel_set_variable_name_printf(channel, "true", "zrtp_already_enrolled_%s", type);
if (zrtp_status_ok == zrtp_session_get(stream->session, &zrtp_session_info)) { if (zrtp_status_ok == zrtp_session_get(stream->session, &zrtp_session_info)) {
@ -775,7 +780,7 @@ static void zrtp_event_callback(zrtp_stream_t *stream, unsigned event)
case ZRTP_EVENT_NEW_USER_ENROLLED: case ZRTP_EVENT_NEW_USER_ENROLLED:
{ {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "New user enrolled!\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "New user enrolled!\n");
switch_channel_set_variable_name_printf(channel, "true", "zrtp_new_user_enrolled_%s", type); switch_channel_set_variable_name_printf(channel, "true", "zrtp_new_user_enrolled_%s", type);
if (zrtp_status_ok == zrtp_session_get(stream->session, &zrtp_session_info)) { if (zrtp_status_ok == zrtp_session_get(stream->session, &zrtp_session_info)) {
@ -788,7 +793,7 @@ static void zrtp_event_callback(zrtp_stream_t *stream, unsigned event)
case ZRTP_EVENT_USER_UNENROLLED: case ZRTP_EVENT_USER_UNENROLLED:
{ {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "User unenrolled!\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "User unenrolled!\n");
switch_channel_set_variable_name_printf(channel, "true", "zrtp_user_unenrolled_%s", type); switch_channel_set_variable_name_printf(channel, "true", "zrtp_user_unenrolled_%s", type);
if (zrtp_status_ok == zrtp_session_get(stream->session, &zrtp_session_info)) { if (zrtp_status_ok == zrtp_session_get(stream->session, &zrtp_session_info)) {
@ -1025,9 +1030,10 @@ static switch_status_t enable_remote_rtcp_socket(switch_rtp_t *rtp_session, cons
} else { } else {
const char *host; const char *host;
char bufa[30]; char bufa[30];
switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
host = switch_get_addr(bufa, sizeof(bufa), rtp_session->rtcp_remote_addr); host = switch_get_addr(bufa, sizeof(bufa), rtp_session->rtcp_remote_addr);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setting RTCP remote addr to %s:%d\n", host, rtp_session->remote_rtcp_port); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Setting RTCP remote addr to %s:%d\n", host, rtp_session->remote_rtcp_port);
} }
if (!(rtp_session->rtcp_sock_input && rtp_session->rtcp_sock_output)) { if (!(rtp_session->rtcp_sock_input && rtp_session->rtcp_sock_output)) {
@ -1097,7 +1103,8 @@ static switch_status_t enable_local_rtcp_socket(switch_rtp_t *rtp_session, const
done: done:
if (*err) { if (*err) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error allocating rtcp [%s]\n", *err); switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error allocating rtcp [%s]\n", *err);
status = SWITCH_STATUS_FALSE; status = SWITCH_STATUS_FALSE;
} }
@ -1246,7 +1253,8 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_local_address(switch_rtp_t *rtp_s
SWITCH_DECLARE(void) switch_rtp_set_max_missed_packets(switch_rtp_t *rtp_session, uint32_t max) SWITCH_DECLARE(void) switch_rtp_set_max_missed_packets(switch_rtp_t *rtp_session, uint32_t max)
{ {
if (rtp_session->missed_count >= max) { if (rtp_session->missed_count >= max) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
"new max missed packets(%d->%d) greater than current missed packets(%d). RTP will timeout.\n", "new max missed packets(%d->%d) greater than current missed packets(%d). RTP will timeout.\n",
rtp_session->missed_count, max, rtp_session->missed_count); rtp_session->missed_count, max, rtp_session->missed_count);
} }
@ -1391,7 +1399,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess
uint32_t index, switch_rtp_crypto_key_type_t type, unsigned char *key, switch_size_t keylen) uint32_t index, switch_rtp_crypto_key_type_t type, unsigned char *key, switch_size_t keylen)
{ {
#ifndef ENABLE_SRTP #ifndef ENABLE_SRTP
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SRTP NOT SUPPORTED IN THIS BUILD!\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "SRTP NOT SUPPORTED IN THIS BUILD!\n");
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
#else #else
switch_rtp_crypto_key_t *crypto_key; switch_rtp_crypto_key_t *crypto_key;
@ -1466,10 +1474,10 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess
} }
if (status == SWITCH_STATUS_SUCCESS) { if (status == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Activating Secure RTP RECV\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Activating Secure RTP RECV\n");
switch_set_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV); switch_set_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV);
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error allocating srtp [%d]\n", stat); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error allocating srtp [%d]\n", stat);
return status; return status;
} }
} }
@ -1486,10 +1494,10 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess
} }
if (status == SWITCH_STATUS_SUCCESS) { if (status == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Activating Secure RTP SEND\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Activating Secure RTP SEND\n");
switch_set_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND); switch_set_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND);
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error allocating SRTP [%d]\n", stat); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error allocating SRTP [%d]\n", stat);
return status; return status;
} }
} }
@ -1543,11 +1551,13 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_change_interval(switch_rtp_t *rtp_ses
if ((status = switch_core_timer_init(&rtp_session->timer, if ((status = switch_core_timer_init(&rtp_session->timer,
rtp_session->timer_name, ms_per_packet / 1000, rtp_session->timer_name, ms_per_packet / 1000,
samples_per_interval, rtp_session->pool)) == SWITCH_STATUS_SUCCESS) { samples_per_interval, rtp_session->pool)) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
"RE-Starting timer [%s] %d bytes per %dms\n", rtp_session->timer_name, samples_per_interval, ms_per_packet / 1000); "RE-Starting timer [%s] %d bytes per %dms\n", rtp_session->timer_name, samples_per_interval, ms_per_packet / 1000);
} else { } else {
switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
memset(&rtp_session->timer, 0, sizeof(rtp_session->timer)); memset(&rtp_session->timer, 0, sizeof(rtp_session->timer));
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,
"Problem RE-Starting timer [%s] %d bytes per %dms\n", rtp_session->timer_name, samples_per_interval, ms_per_packet / 1000); "Problem RE-Starting timer [%s] %d bytes per %dms\n", rtp_session->timer_name, samples_per_interval, ms_per_packet / 1000);
} }
@ -1846,7 +1856,8 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_stun_ping(switch_rtp_t *rtp_
if (switch_sockaddr_info_get(&rtp_session->remote_stun_addr, stun_ip, SWITCH_UNSPEC, if (switch_sockaddr_info_get(&rtp_session->remote_stun_addr, stun_ip, SWITCH_UNSPEC,
stun_port, 0, rtp_session->pool) != SWITCH_STATUS_SUCCESS || !rtp_session->remote_stun_addr) { stun_port, 0, rtp_session->pool) != SWITCH_STATUS_SUCCESS || !rtp_session->remote_stun_addr) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error resolving stun ping addr\n"); switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error resolving stun ping addr\n");
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
@ -1998,10 +2009,12 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_rtcp(switch_rtp_t *rtp_sessi
} }
if (send_rate == -1) { if (send_rate == -1) {
switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
switch_set_flag(rtp_session, SWITCH_RTP_FLAG_RTCP_PASSTHRU); switch_set_flag(rtp_session, SWITCH_RTP_FLAG_RTCP_PASSTHRU);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "RTCP passthru enabled. Remote Port: %d\n", rtp_session->remote_rtcp_port); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "RTCP passthru enabled. Remote Port: %d\n", rtp_session->remote_rtcp_port);
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "RTCP send rate is: %d and packet rate is: %d Remote Port: %d\n", switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "RTCP send rate is: %d and packet rate is: %d Remote Port: %d\n",
send_rate, rtp_session->ms_per_packet, rtp_session->remote_rtcp_port); send_rate, rtp_session->ms_per_packet, rtp_session->remote_rtcp_port);
rtp_session->rtcp_interval = send_rate/(rtp_session->ms_per_packet/1000); rtp_session->rtcp_interval = send_rate/(rtp_session->ms_per_packet/1000);
} }
@ -2265,7 +2278,8 @@ SWITCH_DECLARE(void) switch_rtp_clear_flag(switch_rtp_t *rtp_session, switch_rtp
static void set_dtmf_delay(switch_rtp_t *rtp_session, uint32_t ms, uint32_t max_ms) static void set_dtmf_delay(switch_rtp_t *rtp_session, uint32_t ms, uint32_t max_ms)
{ {
int upsamp, max_upsamp; int upsamp, max_upsamp;
switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
if (!max_ms) max_ms = ms; if (!max_ms) max_ms = ms;
upsamp = ms * (rtp_session->samples_per_second / 1000); upsamp = ms * (rtp_session->samples_per_second / 1000);
@ -2277,7 +2291,7 @@ static void set_dtmf_delay(switch_rtp_t *rtp_session, uint32_t ms, uint32_t max_
rtp_session->max_next_write_samplecount = rtp_session->timer.samplecount + max_upsamp; rtp_session->max_next_write_samplecount = rtp_session->timer.samplecount + max_upsamp;
} }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Queue digit delay of %dms\n", ms); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Queue digit delay of %dms\n", ms);
} }
static void do_2833(switch_rtp_t *rtp_session, switch_core_session_t *session) static void do_2833(switch_rtp_t *rtp_session, switch_core_session_t *session)
@ -2481,7 +2495,7 @@ static void do_flush(switch_rtp_t *rtp_session)
switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session"); switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
if (!session) { if (!session) {
switch_clear_flag(rtp_session, SWITCH_RTP_FLAG_DEBUG_RTP_READ); switch_clear_flag(rtp_session, SWITCH_RTP_FLAG_DEBUG_RTP_READ);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "RTP HAS NO SESSION!\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "RTP HAS NO SESSION!\n");
} else { } else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session),
SWITCH_LOG_CONSOLE, "%s FLUSH\n", switch_channel_get_name(switch_core_session_get_channel(session)) SWITCH_LOG_CONSOLE, "%s FLUSH\n", switch_channel_get_name(switch_core_session_get_channel(session))
@ -2506,7 +2520,7 @@ static void do_flush(switch_rtp_t *rtp_session)
if (bytes > rtp_header_len && rtp_session->recv_te && rtp_session->recv_msg.header.pt == rtp_session->recv_te) { if (bytes > rtp_header_len && rtp_session->recv_te && rtp_session->recv_msg.header.pt == rtp_session->recv_te) {
handle_rfc2833(rtp_session, bytes, &do_cng); handle_rfc2833(rtp_session, bytes, &do_cng);
#ifdef DEBUG_2833 #ifdef DEBUG_2833
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "*** RTP packet handled in flush loop %d ***\n", do_cng); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "*** RTP packet handled in flush loop %d ***\n", do_cng);
#endif #endif
} }
@ -2557,29 +2571,29 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
switch_size_t num_missed = (switch_size_t)seq - (rtp_session->last_seq+1); switch_size_t num_missed = (switch_size_t)seq - (rtp_session->last_seq+1);
if (num_missed == 1) { /* We missed one packet */ if (num_missed == 1) { /* We missed one packet */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missed one RTP frame with sequence [%d]%s. Time since last read [%d]\n", switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Missed one RTP frame with sequence [%d]%s. Time since last read [%d]\n",
rtp_session->last_seq+1, (flushed_packets_diff == 1) ? " (flushed by FS)" : " (missed)", rtp_session->last_seq+1, (flushed_packets_diff == 1) ? " (flushed by FS)" : " (missed)",
rtp_session->last_read_time ? switch_micro_time_now()-rtp_session->last_read_time : 0); rtp_session->last_read_time ? switch_micro_time_now()-rtp_session->last_read_time : 0);
} else { /* We missed multiple packets */ } else { /* We missed multiple packets */
if (flushed_packets_diff == 0) { if (flushed_packets_diff == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,
"Missed %d RTP frames from sequence [%d] to [%d] (missed). Time since last read [%d]\n", "Missed %d RTP frames from sequence [%d] to [%d] (missed). Time since last read [%d]\n",
num_missed, rtp_session->last_seq+1, seq-1, num_missed, rtp_session->last_seq+1, seq-1,
rtp_session->last_read_time ? switch_micro_time_now()-rtp_session->last_read_time : 0); rtp_session->last_read_time ? switch_micro_time_now()-rtp_session->last_read_time : 0);
} else if (flushed_packets_diff == num_missed) { } else if (flushed_packets_diff == num_missed) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,
"Missed %d RTP frames from sequence [%d] to [%d] (flushed by FS). Time since last read [%d]\n", "Missed %d RTP frames from sequence [%d] to [%d] (flushed by FS). Time since last read [%d]\n",
num_missed, rtp_session->last_seq+1, seq-1, num_missed, rtp_session->last_seq+1, seq-1,
rtp_session->last_read_time ? switch_micro_time_now()-rtp_session->last_read_time : 0); rtp_session->last_read_time ? switch_micro_time_now()-rtp_session->last_read_time : 0);
} else if (num_missed > flushed_packets_diff) { } else if (num_missed > flushed_packets_diff) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,
"Missed %d RTP frames from sequence [%d] to [%d] (%d packets flushed by FS, %d packets missed)." "Missed %d RTP frames from sequence [%d] to [%d] (%d packets flushed by FS, %d packets missed)."
" Time since last read [%d]\n", " Time since last read [%d]\n",
num_missed, rtp_session->last_seq+1, seq-1, num_missed, rtp_session->last_seq+1, seq-1,
flushed_packets_diff, num_missed-flushed_packets_diff, flushed_packets_diff, num_missed-flushed_packets_diff,
rtp_session->last_read_time ? switch_micro_time_now()-rtp_session->last_read_time : 0); rtp_session->last_read_time ? switch_micro_time_now()-rtp_session->last_read_time : 0);
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,
"Missed %d RTP frames from sequence [%d] to [%d] (%d packets flushed by FS). Time since last read [%d]\n", "Missed %d RTP frames from sequence [%d] to [%d] (%d packets flushed by FS). Time since last read [%d]\n",
num_missed, rtp_session->last_seq+1, seq-1, num_missed, rtp_session->last_seq+1, seq-1,
flushed_packets_diff, rtp_session->last_read_time ? switch_micro_time_now()-rtp_session->last_read_time : 0); flushed_packets_diff, rtp_session->last_read_time ? switch_micro_time_now()-rtp_session->last_read_time : 0);
@ -2650,10 +2664,12 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
srtp_dealloc(rtp_session->recv_ctx); srtp_dealloc(rtp_session->recv_ctx);
rtp_session->recv_ctx = NULL; rtp_session->recv_ctx = NULL;
if ((stat = srtp_create(&rtp_session->recv_ctx, &rtp_session->recv_policy))) { if ((stat = srtp_create(&rtp_session->recv_ctx, &rtp_session->recv_policy))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error! RE-Activating Secure RTP RECV\n"); switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error! RE-Activating Secure RTP RECV\n");
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "RE-Activating Secure RTP RECV\n"); switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "RE-Activating Secure RTP RECV\n");
rtp_session->srtp_errs = 0; rtp_session->srtp_errs = 0;
} }
} }
@ -2664,7 +2680,8 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
if (stat && rtp_session->recv_msg.header.pt != rtp_session->recv_te && rtp_session->recv_msg.header.pt != rtp_session->cng_pt) { if (stat && rtp_session->recv_msg.header.pt != rtp_session->recv_te && rtp_session->recv_msg.header.pt != rtp_session->cng_pt) {
if (++rtp_session->srtp_errs >= MAX_SRTP_ERRS) { if (++rtp_session->srtp_errs >= MAX_SRTP_ERRS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,
"Error: SRTP unprotect failed with code %d%s\n", stat, "Error: SRTP unprotect failed with code %d%s\n", stat,
stat == err_status_replay_fail ? " (replay check failed)" : stat == stat == err_status_replay_fail ? " (replay check failed)" : stat ==
err_status_auth_fail ? " (auth check failed)" : ""); err_status_auth_fail ? " (auth check failed)" : "");
@ -2765,7 +2782,8 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t
if (stat) { if (stat) {
if (++rtp_session->srtp_errs >= MAX_SRTP_ERRS) { if (++rtp_session->srtp_errs >= MAX_SRTP_ERRS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,
"Error: SRTP RTCP unprotect failed with code %d%s\n", stat, "Error: SRTP RTCP unprotect failed with code %d%s\n", stat,
stat == err_status_replay_fail ? " (replay check failed)" : stat == stat == err_status_replay_fail ? " (replay check failed)" : stat ==
err_status_auth_fail ? " (auth check failed)" : ""); err_status_auth_fail ? " (auth check failed)" : "");
@ -2813,9 +2831,10 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t
if (*bytes) { if (*bytes) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10,"Received an RTCP packet of length %" SWITCH_SIZE_T_FMT " bytes\n", *bytes); switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10,"Received an RTCP packet of length %" SWITCH_SIZE_T_FMT " bytes\n", *bytes);
if (rtp_session->rtcp_recv_msg.header.version == 2) { if (rtp_session->rtcp_recv_msg.header.version == 2) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10,"RTCP packet type is %d\n", rtp_session->rtcp_recv_msg.header.type); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10,"RTCP packet type is %d\n", rtp_session->rtcp_recv_msg.header.type);
if (rtp_session->rtcp_recv_msg.header.type == 200) { if (rtp_session->rtcp_recv_msg.header.type == 200) {
struct switch_rtcp_senderinfo* sr = (struct switch_rtcp_senderinfo*)rtp_session->rtcp_recv_msg.body; struct switch_rtcp_senderinfo* sr = (struct switch_rtcp_senderinfo*)rtp_session->rtcp_recv_msg.body;
@ -2825,7 +2844,7 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t
rtp_session->stats.rtcp.octet_count += sr->oc; rtp_session->stats.rtcp.octet_count += sr->oc;
/* sender report */ /* sender report */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10,"Received a SR with %d report blocks, " \ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10,"Received a SR with %d report blocks, " \
"length in words = %d, " \ "length in words = %d, " \
"SSRC = 0x%X, " \ "SSRC = 0x%X, " \
"NTP MSW = %u, " \ "NTP MSW = %u, " \
@ -2843,7 +2862,7 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t
ntohl(sr->oc)); ntohl(sr->oc));
} }
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Received an unsupported RTCP packet version %d\nn", rtp_session->rtcp_recv_msg.header.version); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Received an unsupported RTCP packet version %d\nn", rtp_session->rtcp_recv_msg.header.version);
} }
status = SWITCH_STATUS_SUCCESS; status = SWITCH_STATUS_SUCCESS;
@ -2894,14 +2913,14 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
rtp_session->read_pollfd) { rtp_session->read_pollfd) {
if (switch_poll(rtp_session->read_pollfd, 1, &fdr, 0) == SWITCH_STATUS_SUCCESS) { if (switch_poll(rtp_session->read_pollfd, 1, &fdr, 0) == SWITCH_STATUS_SUCCESS) {
status = read_rtp_packet(rtp_session, &bytes, flags, SWITCH_FALSE); status = read_rtp_packet(rtp_session, &bytes, flags, SWITCH_FALSE);
/* switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Initial (%i) %d\n", status, bytes); */ /* switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Initial (%i) %d\n", status, bytes); */
if (status != SWITCH_STATUS_FALSE) { if (status != SWITCH_STATUS_FALSE) {
read_pretriggered = 1; read_pretriggered = 1;
} }
if (bytes) { if (bytes) {
if (switch_poll(rtp_session->read_pollfd, 1, &fdr, 0) == SWITCH_STATUS_SUCCESS) { if (switch_poll(rtp_session->read_pollfd, 1, &fdr, 0) == SWITCH_STATUS_SUCCESS) {
/* switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Trigger %d\n", rtp_session->hot_hits); */ /* switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Trigger %d\n", rtp_session->hot_hits); */
rtp_session->hot_hits += rtp_session->samples_per_interval; rtp_session->hot_hits += rtp_session->samples_per_interval;
} else { } else {
rtp_session->hot_hits = 0; rtp_session->hot_hits = 0;
@ -2923,7 +2942,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
} else { } else {
if (rtp_session->sync_packets) { if (rtp_session->sync_packets) {
#if 0 #if 0
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
"Auto-Flush catching up %d packets (%d)ms.\n", "Auto-Flush catching up %d packets (%d)ms.\n",
rtp_session->sync_packets, (rtp_session->ms_per_packet * rtp_session->sync_packets) / 1000); rtp_session->sync_packets, (rtp_session->ms_per_packet * rtp_session->sync_packets) / 1000);
#endif #endif
@ -2970,13 +2989,13 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
read_pretriggered = 0; read_pretriggered = 0;
} else { } else {
status = read_rtp_packet(rtp_session, &bytes, flags, SWITCH_TRUE); status = read_rtp_packet(rtp_session, &bytes, flags, SWITCH_TRUE);
/* switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Read bytes (%i) %d\n", status, bytes); */ /* switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Read bytes (%i) %d\n", status, bytes); */
} }
} else { } else {
if (!SWITCH_STATUS_IS_BREAK(poll_status) && poll_status != SWITCH_STATUS_TIMEOUT) { if (!SWITCH_STATUS_IS_BREAK(poll_status) && poll_status != SWITCH_STATUS_TIMEOUT) {
char tmp[128] = ""; char tmp[128] = "";
strerror_r(poll_status, tmp, sizeof(tmp)); strerror_r(poll_status, tmp, sizeof(tmp));
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Poll failed with error: %d [%s]\n", poll_status, tmp); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Poll failed with error: %d [%s]\n", poll_status, tmp);
ret = -1; ret = -1;
goto end; goto end;
} }
@ -3032,7 +3051,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
int sbytes = (int) rtcp_bytes; int sbytes = (int) rtcp_bytes;
int stat = srtp_protect_rtcp(other_rtp_session->send_ctx, &other_rtp_session->rtcp_send_msg.header, &sbytes); int stat = srtp_protect_rtcp(other_rtp_session->send_ctx, &other_rtp_session->rtcp_send_msg.header, &sbytes);
if (stat) { if (stat) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: SRTP RTCP protection failed with code %d\n", stat); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error: SRTP RTCP protection failed with code %d\n", stat);
} }
rtcp_bytes = sbytes; rtcp_bytes = sbytes;
} }
@ -3050,12 +3069,12 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
case zrtp_status_ok: case zrtp_status_ok:
break; break;
case zrtp_status_drop: case zrtp_status_drop:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection drop with code %d\n", stat); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error: zRTP protection drop with code %d\n", stat);
ret = (int) bytes; ret = (int) bytes;
goto end; goto end;
break; break;
case zrtp_status_fail: case zrtp_status_fail:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection fail with code %d\n", stat); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error: zRTP protection fail with code %d\n", stat);
break; break;
default: default:
break; break;
@ -3066,7 +3085,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
#endif #endif
if (switch_socket_sendto(other_rtp_session->rtcp_sock_output, other_rtp_session->rtcp_remote_addr, 0, if (switch_socket_sendto(other_rtp_session->rtcp_sock_output, other_rtp_session->rtcp_remote_addr, 0,
(const char*)&other_rtp_session->rtcp_send_msg, &rtcp_bytes ) != SWITCH_STATUS_SUCCESS) { (const char*)&other_rtp_session->rtcp_send_msg, &rtcp_bytes ) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"RTCP packet not written\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,"RTCP packet not written\n");
} }
@ -3148,7 +3167,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
if (!session) { if (!session) {
switch_clear_flag(rtp_session, SWITCH_RTP_FLAG_DEBUG_RTP_READ); switch_clear_flag(rtp_session, SWITCH_RTP_FLAG_DEBUG_RTP_READ);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "RTP HAS NO SESSION!\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "RTP HAS NO SESSION!\n");
} else { } else {
const char *tx_host; const char *tx_host;
const char *old_host; const char *old_host;
@ -3204,7 +3223,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
tx_host = switch_get_addr(bufa, sizeof(bufa), rtp_session->from_addr); tx_host = switch_get_addr(bufa, sizeof(bufa), rtp_session->from_addr);
old_host = switch_get_addr(bufb, sizeof(bufb), rtp_session->remote_addr); old_host = switch_get_addr(bufb, sizeof(bufb), rtp_session->remote_addr);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO,
"Auto Changing port from %s:%u to %s:%u\n", old_host, old, tx_host, "Auto Changing port from %s:%u to %s:%u\n", old_host, old, tx_host,
switch_sockaddr_get_port(rtp_session->from_addr)); switch_sockaddr_get_port(rtp_session->from_addr));
@ -3221,7 +3240,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_AUTOADJ); switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
} }
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Correct ip/port confirmed.\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Correct ip/port confirmed.\n");
switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_AUTOADJ); switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
rtp_session->auto_adj_used = 0; rtp_session->auto_adj_used = 0;
} }
@ -3249,7 +3268,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
rtp_session->missed_count = 0; rtp_session->missed_count = 0;
if (bytes < rtp_header_len) { if (bytes < rtp_header_len) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Ignoring invalid RTP packet size of %ld bytes.\n", (long)bytes); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Ignoring invalid RTP packet size of %ld bytes.\n", (long)bytes);
bytes = 0; bytes = 0;
goto do_continue; goto do_continue;
} }
@ -3903,22 +3922,24 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND_RESET)) { if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND_RESET)) {
switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND_RESET); switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND_RESET);
srtp_dealloc(rtp_session->send_ctx); srtp_dealloc(rtp_session->send_ctx);
rtp_session->send_ctx = NULL; rtp_session->send_ctx = NULL;
if ((stat = srtp_create(&rtp_session->send_ctx, &rtp_session->send_policy))) { if ((stat = srtp_create(&rtp_session->send_ctx, &rtp_session->send_policy))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error! RE-Activating Secure RTP SEND\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error! RE-Activating Secure RTP SEND\n");
ret = -1; ret = -1;
goto end; goto end;
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "RE-Activating Secure RTP SEND\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "RE-Activating Secure RTP SEND\n");
} }
} }
stat = srtp_protect(rtp_session->send_ctx, &send_msg->header, &sbytes); stat = srtp_protect(rtp_session->send_ctx, &send_msg->header, &sbytes);
if (stat) { if (stat) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: SRTP protection failed with code %d\n", stat); switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error: SRTP protection failed with code %d\n", stat);
} }
bytes = sbytes; bytes = sbytes;
@ -3929,6 +3950,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
if (zrtp_on && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA)) { if (zrtp_on && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA)) {
unsigned int sbytes = (int) bytes; unsigned int sbytes = (int) bytes;
zrtp_status_t stat = zrtp_status_fail; zrtp_status_t stat = zrtp_status_fail;
switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
stat = zrtp_process_rtp(rtp_session->zrtp_stream, (void *) send_msg, &sbytes); stat = zrtp_process_rtp(rtp_session->zrtp_stream, (void *) send_msg, &sbytes);
@ -3936,12 +3958,12 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
case zrtp_status_ok: case zrtp_status_ok:
break; break;
case zrtp_status_drop: case zrtp_status_drop:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection drop with code %d\n", stat); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error: zRTP protection drop with code %d\n", stat);
ret = (int) bytes; ret = (int) bytes;
goto end; goto end;
break; break;
case zrtp_status_fail: case zrtp_status_fail:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection fail with code %d\n", stat); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error: zRTP protection fail with code %d\n", stat);
break; break;
default: default:
break; break;
@ -3955,7 +3977,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
#ifdef RTP_DEBUG_WRITE_DELTA #ifdef RTP_DEBUG_WRITE_DELTA
{ {
int delta = (int) (now - rtp_session->send_time) / 1000; int delta = (int) (now - rtp_session->send_time) / 1000;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "WRITE %d delta %d\n", (int) bytes, delta); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "WRITE %d delta %d\n", (int) bytes, delta);
} }
#endif #endif
rtp_session->send_time = now; rtp_session->send_time = now;
@ -3965,7 +3987,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
if (!session) { if (!session) {
switch_clear_flag(rtp_session, SWITCH_RTP_FLAG_DEBUG_RTP_WRITE); switch_clear_flag(rtp_session, SWITCH_RTP_FLAG_DEBUG_RTP_WRITE);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "RTP HAS NO SESSION!\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "RTP HAS NO SESSION!\n");
} else { } else {
const char *tx_host; const char *tx_host;
const char *old_host; const char *old_host;
@ -4039,7 +4061,8 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
int sbytes = (int) rtcp_bytes; int sbytes = (int) rtcp_bytes;
int stat = srtp_protect_rtcp(rtp_session->send_ctx, &rtp_session->rtcp_send_msg.header, &sbytes); int stat = srtp_protect_rtcp(rtp_session->send_ctx, &rtp_session->rtcp_send_msg.header, &sbytes);
if (stat) { if (stat) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: SRTP RTCP protection failed with code %d\n", stat); switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error: SRTP RTCP protection failed with code %d\n", stat);
} }
rtcp_bytes = sbytes; rtcp_bytes = sbytes;
} }
@ -4074,7 +4097,8 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
if (switch_socket_sendto(rtp_session->rtcp_sock_output, rtp_session->rtcp_remote_addr, 0, if (switch_socket_sendto(rtp_session->rtcp_sock_output, rtp_session->rtcp_remote_addr, 0,
(const char*)&rtp_session->rtcp_send_msg, &rtcp_bytes ) != SWITCH_STATUS_SUCCESS) { (const char*)&rtp_session->rtcp_send_msg, &rtcp_bytes ) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"RTCP packet not written\n"); switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,"RTCP packet not written\n");
} }
} }
} }
@ -4143,10 +4167,10 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_enable_vad(switch_rtp_t *rtp_session,
codec->implementation->microseconds_per_packet / 1000, codec->implementation->microseconds_per_packet / 1000,
codec->implementation->number_of_channels, codec->implementation->number_of_channels,
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, rtp_session->pool) != SWITCH_STATUS_SUCCESS) { SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, rtp_session->pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't load codec?\n");
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Activate VAD codec %s %dms\n", codec->implementation->iananame, switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Activate VAD codec %s %dms\n", codec->implementation->iananame,
codec->implementation->microseconds_per_packet / 1000); codec->implementation->microseconds_per_packet / 1000);
rtp_session->vad_data.diff_level = 400; rtp_session->vad_data.diff_level = 400;
rtp_session->vad_data.hangunder = 15; rtp_session->vad_data.hangunder = 15;
@ -4260,7 +4284,8 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra
if (!fwd && !rtp_session->sending_dtmf && !rtp_session->queue_delay && if (!fwd && !rtp_session->sending_dtmf && !rtp_session->queue_delay &&
switch_test_flag(rtp_session, SWITCH_RTP_FLAG_RAW_WRITE) && (rtp_session->rtp_bugs & RTP_BUG_GEN_ONE_GEN_ALL)) { switch_test_flag(rtp_session, SWITCH_RTP_FLAG_RAW_WRITE) && (rtp_session->rtp_bugs & RTP_BUG_GEN_ONE_GEN_ALL)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Generating RTP locally but timestamp passthru is configured, disabling....\n"); switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Generating RTP locally but timestamp passthru is configured, disabling....\n");
switch_clear_flag(rtp_session, SWITCH_RTP_FLAG_RAW_WRITE); switch_clear_flag(rtp_session, SWITCH_RTP_FLAG_RAW_WRITE);
rtp_session->last_write_ts = RTP_TS_RESET; rtp_session->last_write_ts = RTP_TS_RESET;
} }
@ -4351,6 +4376,7 @@ SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session,
#ifdef ENABLE_SRTP #ifdef ENABLE_SRTP
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND)) { if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND)) {
switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
int sbytes = (int) bytes; int sbytes = (int) bytes;
err_status_t stat; err_status_t stat;
@ -4359,17 +4385,17 @@ SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session,
srtp_dealloc(rtp_session->send_ctx); srtp_dealloc(rtp_session->send_ctx);
rtp_session->send_ctx = NULL; rtp_session->send_ctx = NULL;
if ((stat = srtp_create(&rtp_session->send_ctx, &rtp_session->send_policy))) { if ((stat = srtp_create(&rtp_session->send_ctx, &rtp_session->send_policy))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error! RE-Activating Secure RTP SEND\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error! RE-Activating Secure RTP SEND\n");
ret = -1; ret = -1;
goto end; goto end;
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "RE-Activating Secure RTP SEND\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "RE-Activating Secure RTP SEND\n");
} }
} }
stat = srtp_protect(rtp_session->send_ctx, &rtp_session->write_msg.header, &sbytes); stat = srtp_protect(rtp_session->send_ctx, &rtp_session->write_msg.header, &sbytes);
if (stat) { if (stat) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: SRTP protection failed with code %d\n", stat); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error: SRTP protection failed with code %d\n", stat);
} }
bytes = sbytes; bytes = sbytes;
} }

View File

@ -758,10 +758,6 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to,
rval = SWITCH_FALSE; rval = SWITCH_FALSE;
} }
if (unlink(filename) != 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to delete file [%s]\n", filename);
}
if (zstr(err)) { if (zstr(err)) {
if (file) { if (file) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Emailed file [%s] to [%s]\n", filename, to); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Emailed file [%s] to [%s]\n", filename, to);
@ -777,6 +773,11 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to,
if (fd > -1) { if (fd > -1) {
close(fd); close(fd);
} }
if (unlink(filename) != 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to delete file [%s]\n", filename);
}
if (ifd > -1) { if (ifd > -1) {
close(ifd); close(ifd);
} }