Merge branch 'master' into arnaldo.span_event_refactor

Conflicts:

	libs/freetdm/src/ftdm_io.c
This commit is contained in:
Arnaldo Pereira 2010-12-22 20:08:05 -02:00
commit 3e32e6ad7b
21 changed files with 288 additions and 87 deletions

View File

@ -1,7 +1,7 @@
<include>
<user id="default"> <!--if id is numeric mailbox param is not necessary-->
<!--
ATTENTION PLEASE READ THIS... (I know you won't but you've been warrned)
ATTENTION PLEASE READ THIS... (I know you won't but you've been warned)
Let it be known that this user can register without a password but since we do not assign
this user a user_context and we don't authenticate this user they will be put in context 'public'.

View File

@ -206,6 +206,7 @@
<X-PRE-PROCESS cmd="set" data="ru-ring=%(800,3200,425,0)"/>
<X-PRE-PROCESS cmd="set" data="de-ring=%(1000,4000,425,0)"/>
<X-PRE-PROCESS cmd="set" data="dz-ring=%(1500,3500,425.0,0.0)"/>
<X-PRE-PROCESS cmd="set" data="pl-ring=%(1000,4000,425,0)"/>
<X-PRE-PROCESS cmd="set" data="bong-ring=v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1400,0,350,440)"/>
<X-PRE-PROCESS cmd="set" data="sit=%(274,0,913.8);%(274,0,1370.6);%(380,0,1776.7)"/>
<!--

View File

@ -1153,20 +1153,26 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_read_event(ftdm_channel_t *ftdmchan, ftdm
ftdm_span_t *span = ftdmchan->span;
ftdm_assert_return(span->fio != NULL, FTDM_FAIL, "No I/O module attached to this span!\n");
ftdm_channel_lock(ftdmchan);
if (!span->fio->channel_next_event) {
ftdm_log(FTDM_LOG_ERROR, "channel_next_event method not implemented in module %s!", span->fio->name);
return FTDM_NOTIMPL;
status = FTDM_NOTIMPL;
goto done;
}
status = span->fio->channel_next_event(ftdmchan, event);
if (status != FTDM_SUCCESS) {
return status;
goto done;
}
status = ftdm_event_handle_oob(*event);
if (status != FTDM_SUCCESS) {
ftdm_log(FTDM_LOG_ERROR, "failed to send SIGEVENT signal to user\n");
}
done:
ftdm_channel_unlock(ftdmchan);
return status;
}

View File

@ -468,9 +468,10 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(r2_outgoing_call)
}
callstatus = openr2_chan_make_call(R2CALL(ftdmchan)->r2chan,
ftdmchan->caller_data.pres == FTDM_PRES_ALLOWED ? ftdmchan->caller_data.cid_num.digits : NULL,
ftdmchan->caller_data.cid_num.digits,
ftdmchan->caller_data.dnis.digits,
category);
category,
ftdmchan->caller_data.pres == FTDM_PRES_ALLOWED ? 0 : 1);
if (callstatus) {
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Failed to make call in R2 channel, openr2_chan_make_call failed\n");
@ -666,12 +667,14 @@ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan)
static void dump_mf(openr2_chan_t *r2chan);
/* only called for incoming calls when the ANI, DNIS etc is complete and the user has to decide either to accept or reject the call */
static void ftdm_r2_on_call_offered(openr2_chan_t *r2chan, const char *ani, const char *dnis, openr2_calling_party_category_t category)
static void ftdm_r2_on_call_offered(openr2_chan_t *r2chan, const char *ani, const char *dnis,
openr2_calling_party_category_t category, int ani_restricted)
{
ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan);
ftdm_r2_data_t *r2data = ftdmchan->span->signal_data;
ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Call offered with ANI = %s, DNIS = %s, Category = (%d)\n", ani, dnis, category);
ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Call offered with ANI = %s, DNIS = %s, Category = %d, ANI restricted = %s\n",
ani, dnis, category, ani_restricted ? "Yes" : "No");
/* nothing went wrong during call setup, MF has ended, we can and must disable the MF dump */
if (r2data->mf_dump_size) {
@ -687,6 +690,7 @@ static void ftdm_r2_on_call_offered(openr2_chan_t *r2chan, const char *ani, cons
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING);
}
ftdmchan->caller_data.cpc = ftdm_openr2_cpc_to_r2_ftdm_cpc(category);
ftdmchan->caller_data.pres = ani_restricted ? FTDM_PRES_RESTRICTED : FTDM_PRES_ALLOWED;
}
/*

View File

@ -187,6 +187,7 @@ static ftdm_socket_t CONTROL_FD = ZT_INVALID_SOCKET;
FIO_SPAN_NEXT_EVENT_FUNCTION(zt_next_event);
FIO_SPAN_POLL_EVENT_FUNCTION(zt_poll_event);
FIO_CHANNEL_NEXT_EVENT_FUNCTION(zt_channel_next_event);
/**
* \brief Initialises codec, and rx/tx gains
@ -991,6 +992,107 @@ FIO_SPAN_POLL_EVENT_FUNCTION(zt_poll_event)
return k ? FTDM_SUCCESS : FTDM_FAIL;
}
/**
* \brief Retrieves an event from a ftdm channel
* \param ftdmchan Channel to retrieve event from
* \param event FreeTDM event to return
* \return Success or failure
*/
FIO_CHANNEL_NEXT_EVENT_FUNCTION(zt_channel_next_event)
{
uint32_t i, event_id = FTDM_OOB_INVALID;
zt_event_t zt_event_id = 0;
ftdm_span_t *span = ftdmchan->span;
if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_EVENT)) {
ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_EVENT);
}
if (ioctl(ftdmchan->sockfd, codes.GETEVENT, &zt_event_id) == -1) {
ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed retrieving event from channel: %s\n",
strerror(errno));
return FTDM_FAIL;
}
switch(zt_event_id) {
case ZT_EVENT_RINGEROFF:
{
return FTDM_FAIL;
}
break;
case ZT_EVENT_RINGERON:
{
return FTDM_FAIL;
}
break;
case ZT_EVENT_RINGBEGIN:
{
event_id = FTDM_OOB_RING_START;
}
break;
case ZT_EVENT_ONHOOK:
{
event_id = FTDM_OOB_ONHOOK;
}
break;
case ZT_EVENT_WINKFLASH:
{
if (ftdmchan->state == FTDM_CHANNEL_STATE_DOWN || ftdmchan->state == FTDM_CHANNEL_STATE_DIALING) {
event_id = FTDM_OOB_WINK;
} else {
event_id = FTDM_OOB_FLASH;
}
}
break;
case ZT_EVENT_RINGOFFHOOK:
{
if (ftdmchan->type == FTDM_CHAN_TYPE_FXS || (ftdmchan->type == FTDM_CHAN_TYPE_EM && ftdmchan->state != FTDM_CHANNEL_STATE_UP)) {
ftdm_set_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK);
event_id = FTDM_OOB_OFFHOOK;
} else if (ftdmchan->type == FTDM_CHAN_TYPE_FXO) {
event_id = FTDM_OOB_RING_START;
} else {
event_id = FTDM_OOB_NOOP;
}
}
break;
case ZT_EVENT_ALARM:
{
event_id = FTDM_OOB_ALARM_TRAP;
}
break;
case ZT_EVENT_NOALARM:
{
event_id = FTDM_OOB_ALARM_CLEAR;
}
break;
case ZT_EVENT_BITSCHANGED:
{
event_id = FTDM_OOB_CAS_BITS_CHANGE;
int bits = 0;
int err = ioctl(ftdmchan->sockfd, codes.GETRXBITS, &bits);
if (err) {
return FTDM_FAIL;
}
ftdmchan->rx_cas_bits = bits;
}
break;
default:
{
ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Unhandled event %d for %d:%d\n", zt_event_id, span->span_id, i);
event_id = FTDM_OOB_INVALID;
}
break;
}
ftdmchan->last_event_time = 0;
span->event_header.e_type = FTDM_EVENT_OOB;
span->event_header.enum_id = event_id;
span->event_header.channel = ftdmchan;
*event = &span->event_header;
return FTDM_SUCCESS;
}
/**
* \brief Retrieves an event from a ftdmtel span
* \param span Span to retrieve event from

View File

@ -730,26 +730,6 @@ static __inline__ int ftdm_check_state_all(ftdm_span_t *span, ftdm_channel_state
return 1;
}
static __inline__ void ftdm_set_flag_all(ftdm_span_t *span, uint32_t flag)
{
uint32_t j;
ftdm_mutex_lock(span->mutex);
for(j = 1; j <= span->chan_count; j++) {
ftdm_set_flag_locked((span->channels[j]), flag);
}
ftdm_mutex_unlock(span->mutex);
}
static __inline__ void ftdm_clear_flag_all(ftdm_span_t *span, uint32_t flag)
{
uint32_t j;
ftdm_mutex_lock(span->mutex);
for(j = 1; j <= span->chan_count; j++) {
ftdm_clear_flag_locked((span->channels[j]), flag);
}
ftdm_mutex_unlock(span->mutex);
}
static __inline__ int16_t ftdm_saturated_add(int16_t sample1, int16_t sample2)
{
int addres;

View File

@ -100,7 +100,9 @@ struct stfu_instance {
uint32_t sync_out;
uint32_t sync_in;
int32_t ts_offset;
int32_t ts_drift;
int32_t ts_diff;
int32_t last_ts_diff;
int32_t same_ts;
@ -126,6 +128,11 @@ static void default_logger(const char *file, const char *func, int line, int lev
stfu_logger_t stfu_log = null_logger;
int32_t stfu_n_get_drift(stfu_instance_t *i)
{
return i->ts_drift;
}
void stfu_global_set_logger(stfu_logger_t logger)
{
if (logger) {
@ -376,7 +383,7 @@ static void stfu_n_swap(stfu_instance_t *i)
i->out_queue->last_jitter = 0;
}
stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void *data, size_t datalen, int last)
stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void *data, size_t datalen, uint32_t timer_ts, int last)
{
uint32_t index = 0;
stfu_frame_t *frame;
@ -402,6 +409,12 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void
}
}
if (timer_ts && ts && !i->ts_offset) {
i->ts_offset = timer_ts - ts;
}
i->ts_drift = ts + (i->ts_offset - timer_ts);
if (i->sync_in) {
good_ts = 1;
i->sync_in = 0;
@ -480,12 +493,12 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void
if (stfu_log != null_logger && i->debug) {
stfu_log(STFU_LOG_EMERG, "%s %u i=%u/%u - g:%u/%u c:%u/%u b:%u - %u:%u - %u %d %u %u %d %d\n", i->name,
i->qlen, i->period_packet_in_count, i->period_time, i->consecutive_good_count,
i->decrement_time, i->period_clean_count, i->decrement_time, i->consecutive_bad_count,
ts, ts / i->samples_per_packet,
i->period_missing_count, i->period_need_range_avg,
i->last_wr_ts, ts, i->diff, i->diff_total / least1(i->period_packet_in_count));
stfu_log(STFU_LOG_EMERG, "I: %s %u i=%u/%u - g:%u/%u c:%u/%u b:%u - %u:%u - %u %d %u %u %d %d %d\n", i->name,
i->qlen, i->period_packet_in_count, i->period_time, i->consecutive_good_count,
i->decrement_time, i->period_clean_count, i->decrement_time, i->consecutive_bad_count,
ts, ts / i->samples_per_packet,
i->period_missing_count, i->period_need_range_avg,
i->last_wr_ts, ts, i->diff, i->diff_total / least1(i->period_packet_in_count), i->ts_drift);
}
if (last || i->in_queue->array_len == i->in_queue->array_size) {

View File

@ -181,15 +181,16 @@ void stfu_n_report(stfu_instance_t *i, stfu_report_t *r);
void stfu_n_destroy(stfu_instance_t **i);
stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_qlen, uint32_t samples_per_packet, uint32_t samples_per_second);
stfu_status_t stfu_n_resize(stfu_instance_t *i, uint32_t qlen);
stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void *data, size_t datalen, int last);
stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void *data, size_t datalen, uint32_t timer_ts, int last);
stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i);
void stfu_n_reset(stfu_instance_t *i);
stfu_status_t stfu_n_sync(stfu_instance_t *i, uint32_t packets);
void stfu_n_call_me(stfu_instance_t *i, stfu_n_call_me_t callback, void *udata);
void stfu_n_debug(stfu_instance_t *i, const char *name);
int32_t stfu_n_get_drift(stfu_instance_t *i);
#define stfu_im_done(i) stfu_n_add_data(i, 0, NULL, 0, 1)
#define stfu_n_eat(i,t,p,d,l) stfu_n_add_data(i, t, p, d, l, 0)
#define stfu_im_done(i) stfu_n_add_data(i, 0, NULL, 0, 0, 1)
#define stfu_n_eat(i,t,p,d,l,tt) stfu_n_add_data(i, t, p, d, l, tt, 0)
#ifdef __cplusplus
}

View File

@ -622,7 +622,7 @@ SWITCH_DECLARE(unsigned int) switch_separate_string(_In_ char *buf, char delim,
SWITCH_DECLARE(unsigned int) switch_separate_string_string(char *buf, char *delim, _Post_count_(return) char **array, unsigned int arraylen);
SWITCH_DECLARE(switch_bool_t) switch_is_number(const char *str);
SWITCH_DECLARE(char *) switch_strip_spaces(const char *str);
SWITCH_DECLARE(char *) switch_strip_spaces(char *str, switch_bool_t dup);
SWITCH_DECLARE(char *) switch_strip_whitespace(const char *str);
SWITCH_DECLARE(char *) switch_strip_commas(char *in, char *out, switch_size_t len);
SWITCH_DECLARE(char *) switch_strip_nonnumerics(char *in, char *out, switch_size_t len);

View File

@ -1428,8 +1428,8 @@ SWITCH_STANDARD_API(cond_function)
int a_is_num, b_is_num;
*expr++ = '\0';
b = expr;
s_a = switch_strip_spaces(a);
s_b = switch_strip_spaces(b);
s_a = switch_strip_spaces(a, SWITCH_TRUE);
s_b = switch_strip_spaces(b, SWITCH_TRUE);
a_is_num = switch_is_number(s_a);
b_is_num = switch_is_number(s_b);

View File

@ -30,6 +30,7 @@
* Chris Danielson <chris at maxpowersoft dot com>
* Rupa Schomaker <rupa@rupa.com>
* David Weekly <david@weekly.org>
* Joao Mesquita <jmesquita@gmail.com>
*
* mod_conference.c -- Software Conference Bridge
*
@ -689,8 +690,14 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe
}
if (!switch_channel_test_app_flag_key("conf_silent", channel, CONF_SILENT_REQ) && !zstr(conference->enter_sound)) {
conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session),
switch_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1);
const char * enter_sound = switch_channel_get_variable(channel, "conference_enter_sound");
if (!zstr(enter_sound)) {
conference_play_file(conference, (char *)enter_sound, CONF_DEFAULT_LEADIN,
switch_core_session_get_channel(member->session), !switch_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1);
} else {
conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session),
!switch_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1);
}
}
}

View File

@ -1065,6 +1065,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
if (exptime && v_event && *v_event) {
char *exp_var;
char *allow_multireg = NULL;
int force_connectile = 0;
allow_multireg = switch_event_get_header(*v_event, "sip-allow-multiple-registrations");
if (allow_multireg && switch_false(allow_multireg)) {
@ -1081,8 +1082,13 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
to_user = force_user;
}
if ((v_contact_str = switch_event_get_header(*v_event, "sip-force-contact"))) {
if (!strcasecmp(v_contact_str, "NDLB-connectile-dysfunction-2.0")) {
if (profile->rport_level == 3 && sip->sip_user_agent &&
sip->sip_user_agent->g_string && !strncasecmp(sip->sip_user_agent->g_string, "Polycom", 7)) {
force_connectile = 1;
}
if ((v_contact_str = switch_event_get_header(*v_event, "sip-force-contact")) || force_connectile) {
if ((!strcasecmp(v_contact_str, "NDLB-connectile-dysfunction-2.0")) || force_connectile) {
char *path_encoded;
size_t path_encoded_len;
char my_contact_str[1024];

View File

@ -12406,13 +12406,15 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_number(char * jarg1) {
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_strip_spaces(char * jarg1) {
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_strip_spaces(char * jarg1, int jarg2) {
char * jresult ;
char *arg1 = (char *) 0 ;
switch_bool_t arg2 ;
char *result = 0 ;
arg1 = (char *)jarg1;
result = (char *)switch_strip_spaces((char const *)arg1);
arg2 = (switch_bool_t)jarg2;
result = (char *)switch_strip_spaces(arg1,arg2);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
@ -22969,6 +22971,16 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_caller_extension(void * ja
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_sort_cid(void * jarg1, int jarg2) {
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
switch_bool_t arg2 ;
arg1 = (switch_channel_t *)jarg1;
arg2 = (switch_bool_t)jarg2;
switch_channel_sort_cid(arg1,arg2);
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_caller_extension(void * jarg1) {
void * jresult ;
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
@ -28310,6 +28322,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_activate_jitter_buffer(void * jarg1
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_debug_jitter_buffer(void * jarg1, char * jarg2) {
int jresult ;
switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
char *arg2 = (char *) 0 ;
switch_status_t result;
arg1 = (switch_rtp_t *)jarg1;
arg2 = (char *)jarg2;
result = (switch_status_t)switch_rtp_debug_jitter_buffer(arg1,(char const *)arg2);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_deactivate_jitter_buffer(void * jarg1) {
int jresult ;
switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;

View File

@ -12726,13 +12726,15 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_number(char * jarg1) {
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_strip_spaces(char * jarg1) {
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_strip_spaces(char * jarg1, int jarg2) {
char * jresult ;
char *arg1 = (char *) 0 ;
switch_bool_t arg2 ;
char *result = 0 ;
arg1 = (char *)jarg1;
result = (char *)switch_strip_spaces((char const *)arg1);
arg2 = (switch_bool_t)jarg2;
result = (char *)switch_strip_spaces(arg1,arg2);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
@ -23624,6 +23626,16 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_caller_extension(void * ja
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_sort_cid(void * jarg1, int jarg2) {
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
switch_bool_t arg2 ;
arg1 = (switch_channel_t *)jarg1;
arg2 = (switch_bool_t)jarg2;
switch_channel_sort_cid(arg1,arg2);
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_caller_extension(void * jarg1) {
void * jresult ;
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
@ -29013,6 +29025,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_activate_jitter_buffer(void * jarg1
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_debug_jitter_buffer(void * jarg1, char * jarg2) {
int jresult ;
switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
char *arg2 = (char *) 0 ;
switch_status_t result;
arg1 = (switch_rtp_t *)jarg1;
arg2 = (char *)jarg2;
result = (switch_status_t)switch_rtp_debug_jitter_buffer(arg1,(char const *)arg2);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_deactivate_jitter_buffer(void * jarg1) {
int jresult ;
switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;

View File

@ -2877,8 +2877,8 @@ public class freeswitch {
return ret;
}
public static string switch_strip_spaces(string str) {
string ret = freeswitchPINVOKE.switch_strip_spaces(str);
public static string switch_strip_spaces(string str, switch_bool_t dup) {
string ret = freeswitchPINVOKE.switch_strip_spaces(str, (int)dup);
return ret;
}
@ -3328,6 +3328,10 @@ public class freeswitch {
freeswitchPINVOKE.switch_channel_set_caller_extension(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_caller_extension.getCPtr(caller_extension));
}
public static void switch_channel_sort_cid(SWIGTYPE_p_switch_channel channel, switch_bool_t arg1) {
freeswitchPINVOKE.switch_channel_sort_cid(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)arg1);
}
public static switch_caller_extension switch_channel_get_caller_extension(SWIGTYPE_p_switch_channel channel) {
IntPtr cPtr = freeswitchPINVOKE.switch_channel_get_caller_extension(SWIGTYPE_p_switch_channel.getCPtr(channel));
switch_caller_extension ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_extension(cPtr, false);
@ -4645,6 +4649,11 @@ public class freeswitch {
return ret;
}
public static switch_status_t switch_rtp_debug_jitter_buffer(SWIGTYPE_p_switch_rtp rtp_session, string name) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_debug_jitter_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), name);
return ret;
}
public static switch_status_t switch_rtp_deactivate_jitter_buffer(SWIGTYPE_p_switch_rtp rtp_session) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_deactivate_jitter_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
return ret;
@ -8661,7 +8670,7 @@ class freeswitchPINVOKE {
public static extern int switch_is_number(string jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_strip_spaces")]
public static extern string switch_strip_spaces(string jarg1);
public static extern string switch_strip_spaces(string jarg1, int jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_strip_whitespace")]
public static extern string switch_strip_whitespace(string jarg1);
@ -11327,6 +11336,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_caller_extension")]
public static extern void switch_channel_set_caller_extension(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_sort_cid")]
public static extern void switch_channel_sort_cid(HandleRef jarg1, int jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_caller_extension")]
public static extern IntPtr switch_channel_get_caller_extension(HandleRef jarg1);
@ -12455,6 +12467,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_activate_jitter_buffer")]
public static extern int switch_rtp_activate_jitter_buffer(HandleRef jarg1, uint jarg2, uint jarg3, uint jarg4, uint jarg5);
[DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_debug_jitter_buffer")]
public static extern int switch_rtp_debug_jitter_buffer(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_deactivate_jitter_buffer")]
public static extern int switch_rtp_deactivate_jitter_buffer(HandleRef jarg1);
@ -21563,6 +21578,7 @@ public enum switch_channel_flag_t {
CF_BRIDGE_NOWRITE,
CF_RECOVERED,
CF_JITTERBUFFER,
CF_DIALPLAN,
CF_FLAG_MAX
}

View File

@ -2867,8 +2867,8 @@ public class freeswitch {
return ret;
}
public static string switch_strip_spaces(string str) {
string ret = freeswitchPINVOKE.switch_strip_spaces(str);
public static string switch_strip_spaces(string str, switch_bool_t dup) {
string ret = freeswitchPINVOKE.switch_strip_spaces(str, (int)dup);
return ret;
}
@ -3318,6 +3318,10 @@ public class freeswitch {
freeswitchPINVOKE.switch_channel_set_caller_extension(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_caller_extension.getCPtr(caller_extension));
}
public static void switch_channel_sort_cid(SWIGTYPE_p_switch_channel channel, switch_bool_t arg1) {
freeswitchPINVOKE.switch_channel_sort_cid(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)arg1);
}
public static switch_caller_extension switch_channel_get_caller_extension(SWIGTYPE_p_switch_channel channel) {
IntPtr cPtr = freeswitchPINVOKE.switch_channel_get_caller_extension(SWIGTYPE_p_switch_channel.getCPtr(channel));
switch_caller_extension ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_extension(cPtr, false);
@ -4635,6 +4639,11 @@ public class freeswitch {
return ret;
}
public static switch_status_t switch_rtp_debug_jitter_buffer(SWIGTYPE_p_switch_rtp rtp_session, string name) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_debug_jitter_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), name);
return ret;
}
public static switch_status_t switch_rtp_deactivate_jitter_buffer(SWIGTYPE_p_switch_rtp rtp_session) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_deactivate_jitter_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
return ret;
@ -8647,7 +8656,7 @@ class freeswitchPINVOKE {
public static extern int switch_is_number(string jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_strip_spaces")]
public static extern string switch_strip_spaces(string jarg1);
public static extern string switch_strip_spaces(string jarg1, int jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_strip_whitespace")]
public static extern string switch_strip_whitespace(string jarg1);
@ -11313,6 +11322,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_caller_extension")]
public static extern void switch_channel_set_caller_extension(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_sort_cid")]
public static extern void switch_channel_sort_cid(HandleRef jarg1, int jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_caller_extension")]
public static extern IntPtr switch_channel_get_caller_extension(HandleRef jarg1);
@ -12441,6 +12453,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_activate_jitter_buffer")]
public static extern int switch_rtp_activate_jitter_buffer(HandleRef jarg1, uint jarg2, uint jarg3, uint jarg4, uint jarg5);
[DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_debug_jitter_buffer")]
public static extern int switch_rtp_debug_jitter_buffer(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_deactivate_jitter_buffer")]
public static extern int switch_rtp_deactivate_jitter_buffer(HandleRef jarg1);
@ -21509,6 +21524,7 @@ public enum switch_channel_flag_t {
CF_BRIDGE_NOWRITE,
CF_RECOVERED,
CF_JITTERBUFFER,
CF_DIALPLAN,
CF_FLAG_MAX
}

View File

@ -9732,17 +9732,17 @@ XS(SWIG_init) {
SWIG_TypeClientData(SWIGTYPE_p_IVRMenu, (void*) "freeswitch::IVRMenu");
SWIG_TypeClientData(SWIGTYPE_p_API, (void*) "freeswitch::API");
SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void*) "freeswitch::input_callback_state_t");
/*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
/*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "S_HUP", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_HUP)));
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
/*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
/*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "S_FREE", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_FREE)));
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
/*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
/*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "S_RDLOCK", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_RDLOCK)));
SvREADONLY_on(sv);

View File

@ -2285,7 +2285,7 @@ SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint3
break;
}
stfu_n_eat(jb, ts, read_frame->payload, read_frame->data, read_frame->datalen);
stfu_n_eat(jb, ts, read_frame->payload, read_frame->data, read_frame->datalen, 0);
ts += interval;
if ((jb_frame = stfu_n_read_a_frame(jb))) {

View File

@ -1874,6 +1874,11 @@ SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t
status = SWITCH_STATUS_SUCCESS;
}
if ((min_digits == 0) && (strlen(digit_buffer) == 0) && switch_channel_get_variable(channel, SWITCH_READ_TERMINATOR_USED_VARIABLE) != 0)
{
return SWITCH_STATUS_SUCCESS;
}
if (!(status == SWITCH_STATUS_TOO_SMALL && strlen(digit_buffer) == 0)) {
if (status == SWITCH_STATUS_SUCCESS) {
if (!zstr(digit_buffer)) {

View File

@ -174,6 +174,7 @@ struct switch_rtp {
void *private_data;
uint32_t ts;
uint32_t last_write_ts;
uint32_t last_read_ts;
uint32_t last_write_samplecount;
uint32_t next_write_samplecount;
switch_time_t last_write_timestamp;
@ -2135,19 +2136,6 @@ static void do_flush(switch_rtp_t *rtp_session)
flushed++;
#ifdef _MSC_VER
#pragma warning(push) /* remove this stuff when "if (0" is removed */
#pragma warning(disable:4127)
#endif
if (0 && rtp_session->jb) {
stfu_n_eat(rtp_session->jb, ntohl(rtp_session->recv_msg.header.ts),
rtp_session->recv_msg.header.pt,
rtp_session->recv_msg.body, bytes - rtp_header_len);
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
rtp_session->stats.inbound.raw_bytes += bytes;
rtp_session->stats.inbound.flush_packet_count++;
rtp_session->stats.inbound.packet_count++;
@ -2196,12 +2184,15 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
rtp_session->stats.inbound.packet_count++;
}
if ((rtp_session->recv_te && rtp_session->recv_msg.header.pt == rtp_session->recv_te) ||
*bytes < rtp_header_len ||
(*bytes < rtp_header_len && *bytes > 0) ||
switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_UDPTL)) {
return SWITCH_STATUS_SUCCESS;
}
rtp_session->last_read_ts = ntohl(rtp_session->recv_msg.header.ts);
if (rtp_session->jb && rtp_session->recv_msg.header.version == 2 && *bytes) {
if (rtp_session->recv_msg.header.m && rtp_session->recv_msg.header.pt != rtp_session->recv_te &&
@ -2209,16 +2200,17 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
stfu_n_reset(rtp_session->jb);
}
stfu_n_eat(rtp_session->jb, ntohl(rtp_session->recv_msg.header.ts),
stfu_n_eat(rtp_session->jb, rtp_session->last_read_ts,
rtp_session->recv_msg.header.pt,
rtp_session->recv_msg.body, *bytes - rtp_header_len);
rtp_session->recv_msg.body, *bytes - rtp_header_len, rtp_session->timer.samplecount);
*bytes = 0;
status = SWITCH_STATUS_FALSE;
}
if (rtp_session->jb) {
if (rtp_session->jb && !rtp_session->checked_jb) {
if ((jb_frame = stfu_n_read_a_frame(rtp_session->jb))) {
memcpy(rtp_session->recv_msg.body, jb_frame->data, jb_frame->dlen);
if (jb_frame->plc) {
(*flags) |= SFF_PLC;
} else {
@ -2229,6 +2221,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
rtp_session->recv_msg.header.pt = jb_frame->pt;
status = SWITCH_STATUS_SUCCESS;
}
rtp_session->checked_jb++;
}
@ -2385,7 +2378,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
rtp_session->read_pollfd) {
if (switch_poll(rtp_session->read_pollfd, 1, &fdr, 0) == SWITCH_STATUS_SUCCESS) {
rtp_session->hot_hits += rtp_session->samples_per_interval;
if (rtp_session->hot_hits >= rtp_session->samples_per_second * 5) {
switch_set_flag(rtp_session, SWITCH_RTP_FLAG_FLUSH);
hot_socket = 1;
@ -2927,12 +2920,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
if (do_cng) {
uint8_t *data = (uint8_t *) rtp_session->recv_msg.body;
int fdr;
if ((poll_status = switch_poll(rtp_session->read_pollfd, 1, &fdr, 0)) == SWITCH_STATUS_SUCCESS) {
goto recvfrom;
}
memset(data, 0, 2);
data[0] = 65;
rtp_session->recv_msg.header.pt = (uint32_t) rtp_session->cng_pt ? rtp_session->cng_pt : SWITCH_RTP_CNG_PAYLOAD;

View File

@ -831,9 +831,9 @@ SWITCH_DECLARE(char *) switch_strip_whitespace(const char *str)
return s;
}
SWITCH_DECLARE(char *) switch_strip_spaces(const char *str)
SWITCH_DECLARE(char *) switch_strip_spaces(char *str, switch_bool_t dup)
{
const char *sp = str;
char *sp = str;
char *p, *s = NULL;
if (!sp)
@ -843,7 +843,11 @@ SWITCH_DECLARE(char *) switch_strip_spaces(const char *str)
sp++;
}
s = strdup(sp);
if (dup) {
s = strdup(sp);
} else {
s = sp;
}
if (!s)
return NULL;