From e7cafae29d0720f06280255a55cc94548e7e12a4 Mon Sep 17 00:00:00 2001 From: Brian West Date: Tue, 5 Oct 2010 09:59:13 -0500 Subject: [PATCH 01/46] tweak --- src/include/switch_types.h | 2 ++ src/switch_channel.c | 8 ++++++++ src/switch_core_io.c | 3 ++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 32fb141d42..5aecca7498 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -123,6 +123,7 @@ SWITCH_BEGIN_EXTERN_C #define SWITCH_CURRENT_APPLICATION_VARIABLE "current_application" #define SWITCH_CURRENT_APPLICATION_DATA_VARIABLE "current_application_data" #define SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE "current_application_response" +#define SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE "passthru_ptime_mismatch" #define SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE "enable_heartbeat_events" #define SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE "bypass_media_after_bridge" #define SWITCH_READ_RESULT_VARIABLE "read_result" @@ -1055,6 +1056,7 @@ typedef enum { CF_EARLY_HANGUP, CF_MEDIA_SET, CF_CONSUME_ON_ORIGINATE, + CF_PASSTHRU_PTIME_MISMATCH, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ CF_FLAG_MAX } switch_channel_flag_t; diff --git a/src/switch_channel.c b/src/switch_channel.c index 81baa2f40d..df5fd9627e 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2559,6 +2559,10 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_ switch_core_session_execute_application(channel->session, app, arg); } + if ((var = switch_channel_get_variable(channel, SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE))) { + switch_channel_set_flag(channel, CF_PASSTHRU_PTIME_MISMATCH); + } + /* if we're the child of another channel and the other channel is in a blocking read they will never realize we have answered so send a SWITCH_SIG_BREAK to interrupt any blocking reads on that channel */ @@ -2686,6 +2690,10 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan switch_core_session_rwunlock(other_session); } + if ((var = switch_channel_get_variable(channel, SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE))) { + switch_channel_set_flag(channel, CF_PASSTHRU_PTIME_MISMATCH); + } + if ((var = switch_channel_get_variable(channel, SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE))) { uint32_t seconds = 60; int tmp; diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 1eb224bda1..4ca8b2d8cb 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -653,7 +653,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess if (session->write_impl.codec_id == frame->codec->implementation->codec_id || session->write_impl.microseconds_per_packet != frame->codec->implementation->microseconds_per_packet) { ptime_mismatch = TRUE; - if (switch_test_flag(frame->codec, SWITCH_CODEC_FLAG_PASSTHROUGH) || switch_test_flag(session->read_codec, SWITCH_CODEC_FLAG_PASSTHROUGH)) { + if ((switch_test_flag(frame->codec, SWITCH_CODEC_FLAG_PASSTHROUGH) || switch_test_flag(session->read_codec, SWITCH_CODEC_FLAG_PASSTHROUGH)) || + switch_channel_test_flag(session->channel, CF_PASSTHRU_PTIME_MISMATCH)) { status = perform_write(session, frame, flags, stream_id); goto error; } From b24231587c8035bf080e3c15b50ed443b2fe1afd Mon Sep 17 00:00:00 2001 From: Brian West Date: Tue, 5 Oct 2010 10:12:28 -0500 Subject: [PATCH 02/46] FS-2755 --- src/mod/say/mod_say_ja/mod_say_ja.c | 502 ++++++++++++++++++++++++++++ 1 file changed, 502 insertions(+) create mode 100644 src/mod/say/mod_say_ja/mod_say_ja.c diff --git a/src/mod/say/mod_say_ja/mod_say_ja.c b/src/mod/say/mod_say_ja/mod_say_ja.c new file mode 100644 index 0000000000..407d2d4a91 --- /dev/null +++ b/src/mod/say/mod_say_ja/mod_say_ja.c @@ -0,0 +1,502 @@ +/* + * Copyright (c) 2007, Anthony Minessale II + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of the original author; nor the names of any contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The Initial Developer of the Original Code is + * Anthony Minessale II + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Anthony Minessale II + * Braga Bruno + * + * + * mod_say_ja.c -- Say for Japanese. + * + */ + +#include +#include +#include +#include + +SWITCH_MODULE_LOAD_FUNCTION(mod_say_ja_load); +SWITCH_MODULE_DEFINITION(mod_say_ja, mod_say_ja_load, NULL, NULL); + +#define say_num(num, meth) { \ + char tmp[80]; \ + switch_status_t tstatus; \ + switch_say_method_t smeth = say_args->method; \ + switch_say_type_t stype = say_args->type; \ + say_args->type = SST_ITEMS; say_args->method = meth; \ + switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \ + if ((tstatus = \ + ja_say_general_count(session, tmp, say_args, args)) \ + != SWITCH_STATUS_SUCCESS) { \ + return tstatus; \ + } \ + say_args->method = smeth; say_args->type = stype; \ + } \ + +#define say_file(...) { \ + char tmp[80]; \ + switch_status_t tstatus; \ + switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__); \ + if ((tstatus = \ + switch_ivr_play_file(session, NULL, tmp, args)) \ + != SWITCH_STATUS_SUCCESS){ \ + return tstatus; \ + } \ + if (!switch_channel_ready(switch_core_session_get_channel(session))) { \ + return SWITCH_STATUS_FALSE; \ + }} \ + +static switch_status_t ja_say_general_count(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +{ + int in; + char sbuf[13] = ""; + char digits[11]; + int i; + + if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); + return SWITCH_STATUS_GENERR; + } + + in = atoi(tosay); + + if (in != 0) { + snprintf(digits, sizeof(digits), "%10.10d", in); + switch (say_args->method) { + case SSM_COUNTED: + say_file("digits/ordinal.wav"); + /* Fall through */ + case SSM_PRONOUNCED: + for (i = 0; i <= 9; i++) { + switch (i) { + case 0: + /* Billions column */ + if (digits[i] != '0') { + if (digits[i] != '1') + say_file("digits/%c.wav", digits[i]); + say_file("digits/10.wav"); + if (memcmp(digits + 1, "0", 1) == 0) + say_file("digits/100000000.wav", digits[i]); + } + break; + case 1: + /* Hundred millions columns */ + if (digits[i] != '0') { + say_file("digits/%c.wav", digits[i]); + say_file("digits/100000000.wav", digits[i]); + } + break; + case 2: + /* Ten millions column */ + if (digits[i] != '0') { + say_file("digits/%c.wav", digits[i]); + say_file("digits/1000.wav"); + if (memcmp(digits + 3, "000", 3) == 0) + say_file("digits/10000.wav", digits[i]); + } + break; + case 3: + /* Millions column */ + if (digits[i] != '0') { + say_file("digits/%c.wav", digits[i]); + say_file("digits/100.wav"); + if (memcmp(digits + 4, "00", 2) == 0) + say_file("digits/10000.wav", digits[i]); + } + break; + case 4: + /* Hundred thousands column */ + if (digits[i] != '0') { + if (digits[i] != '1') + say_file("digits/%c.wav", digits[i]); + say_file("digits/10.wav"); + if (memcmp(digits + 5, "0", 1) == 0) + say_file("digits/10000.wav", digits[i]); + } + break; + + case 5: + /* Ten thousands column */ + if (digits[i] != '0') { + say_file("digits/%c.wav", digits[i]); + say_file("digits/10000.wav"); + } + break; + case 6: + /* thousands column */ + if (digits[i] != '0') { + + switch (digits[i]) { + case '1': + if (memcmp(digits, "000000", 6) != 0) { + say_file("digits/1000s.wav"); + } else { + say_file("digits/1000.wav"); + } + break; + case '3': + say_file("digits/3000.wav"); + break; + default: + say_file("digits/%c.wav", digits[i]); + say_file("digits/1000.wav"); + break; + } + } + break; + case 7: + /* hundreds column */ + if (digits[i] != '0') { + switch (digits[i]) { + case '1': + say_file("digits/100.wav"); + break; + case '3': + say_file("digits/300.wav"); + break; + case '6': + say_file("digits/600.wav"); + break; + case '8': + say_file("digits/800.wav"); + break; + default: + say_file("digits/%c.wav", digits[i]); + say_file("digits/100.wav"); + break; + } + } + break; + case 8: + /* Tens column */ + if (digits[i] != '0') { + if (digits[i] != '1') + say_file("digits/%c.wav", digits[i]); + say_file("digits/10.wav"); + } + break; + case 9: + /* Units column */ + if (digits[i] != '0') + say_file("digits/%c.wav", digits[i]); + break; + } + } + break; + case SSM_ITERATED: + { + char *p; + for (p = tosay; p && *p; p++) + say_file("digits/%c.wav", *p); + } + break; + default: + break; + } + } else { + say_file("digits/0.wav"); + } + + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t ja_say_time(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +{ + int32_t t; + switch_time_t target = 0; + switch_time_exp_t tm; + uint8_t say_date = 0; + uint8_t say_time = 0; + + int mod_min; + char buffer[3]; + + + if (say_args->type == SST_TIME_MEASUREMENT) { + int64_t hours = 0; + int64_t minutes = 0; + int64_t seconds = 0; + int64_t r = 0; + if (strchr(tosay, ':')) { + char *tme = switch_core_session_strdup(session, tosay); + char *p; + + if ((p = strrchr(tme, ':'))) { + *p++ = '\0'; + seconds = atoi(p); + if ((p = strchr(tme, ':'))) { + *p++ = '\0'; + minutes = atoi(p); + if (tme) { + hours = atoi(tme); + } + } else { + minutes = atoi(tme); + } + } + } else { + if ((seconds = atoi(tosay)) <= 0) { + seconds = (int64_t) switch_epoch_time_now(NULL); + } + + if (seconds >= 60) { + minutes = seconds / 60; + r = seconds % 60; + seconds = r; + } + + if (minutes >= 60) { + hours = minutes / 60; + r = minutes % 60; + minutes = r; + } + } + + if (hours) { + say_num(hours, SSM_PRONOUNCED); + say_file("time/hours.wav"); + } + if (minutes) { + say_num(minutes, SSM_PRONOUNCED); + say_file("time/minute.wav"); + } else { + if (hours) { + say_file("digits/0.wav"); + say_file("time/minute.wav"); + } + } + + if (seconds) { + say_num(hours, SSM_PRONOUNCED); + say_file("time/seconds.wav"); + } else { + if (hours || minutes) { + say_file("digits/0.wav"); + say_file("time/second.wav"); + } + } + + return SWITCH_STATUS_SUCCESS; + } + + if ((t = atoi(tosay)) > 0) + target = switch_time_make(t, 0); + else + target = switch_micro_time_now(); + switch_time_exp_lt(&tm, target); + + switch (say_args->type) { + case SST_CURRENT_DATE_TIME: + say_date = say_time = 1; + break; + case SST_CURRENT_DATE: + say_date = 1; + break; + case SST_CURRENT_TIME: + say_time = 1; + break; + default: + break; + } + + if (say_date) { + say_num(tm.tm_year + 1900, SSM_PRONOUNCED); + say_file("time/year.wav"); + say_file("time/month-%d.wav", tm.tm_mon); + say_file("time/day-%d.wav", tm.tm_mday); + } + + if (say_time) { + int32_t hour = tm.tm_hour; + + if (hour < 12) { + say_file("time/am.wav"); + } else { + say_file("time/pm.wav"); + } + say_file("time/hour-%d.wav", tm.tm_hour); + if (tm.tm_min > 10) { + int temp; + char tch[1+1]; + mod_min = tm.tm_min % 10; + memset(buffer,0,sizeof(buffer)); + memset(tch,0,sizeof(tch)); + sprintf(buffer, "%d", tm.tm_min); + memcpy(tch,buffer,1); + temp = atoi(tch); + if (temp > 1){ + say_num(temp,SSM_PRONOUNCED); + } + if (mod_min != 0){ + say_file("digits/10.wav"); + } + else{ + mod_min = 10; + } + } else { + mod_min = tm.tm_min; + } + switch(mod_min) { + case 0: + say_file("time/oclock.wav", mod_min); + break; + case 1: + case 3: + case 4: + case 6: + case 8: + case 10: + say_file("time/min-%d.wav", mod_min); + break; + default: + say_num(mod_min, SSM_PRONOUNCED); + say_file("time/minute.wav"); + break; + } + } + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t ja_say_money(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +{ + char sbuf[16] = ""; /* enough for 999,999,999,999.99 (w/o the commas or leading $) */ + char *dollars = NULL; + char *cents = NULL; + + if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); + return SWITCH_STATUS_GENERR; + } + + dollars = sbuf; + + if ((cents = strchr(sbuf, '.'))) { + *cents++ = '\0'; + if (strlen(cents) > 2) { + cents[2] = '\0'; + } + } + + /* If positive sign - skip over" */ + if (sbuf[0] == '+') { + dollars++; + } + + /* If negative say "negative" */ + if (sbuf[0] == '-') { + say_file("currency/negative.wav"); + dollars++; + } + + /* Say dollar amount */ + ja_say_general_count(session, dollars, say_args, args); + say_file("currency/dollar.wav"); + + /* Say cents */ + if (cents) { + ja_say_general_count(session, cents, say_args, args); + } else { + say_file("digits/0.wav"); + } + say_file("currency/cent.wav"); + + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t ja_say(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +{ + switch_say_callback_t say_cb = NULL; + + switch (say_args->type) { + case SST_NUMBER: + case SST_ITEMS: + case SST_PERSONS: + case SST_MESSAGES: + say_cb = ja_say_general_count; + break; + case SST_TIME_MEASUREMENT: + case SST_CURRENT_DATE: + case SST_CURRENT_TIME: + case SST_CURRENT_DATE_TIME: + say_cb = ja_say_time; + break; + case SST_IP_ADDRESS: + return switch_ivr_say_ip(session, tosay, ja_say_general_count, say_args, args); + break; + case SST_NAME_SPELLED: + case SST_NAME_PHONETIC: + return switch_ivr_say_spell(session, tosay, say_args, args); + break; + case SST_CURRENCY: + say_cb = ja_say_money; + break; + default: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", say_args->type); + break; + } + + if (say_cb) { + return say_cb(session, tosay, say_args, args); + } + + return SWITCH_STATUS_FALSE; +} + +SWITCH_MODULE_LOAD_FUNCTION(mod_say_ja_load) +{ + switch_say_interface_t *say_interface; + /* connect my internal structure to the blank pointer passed to me */ + *module_interface = switch_loadable_module_create_module_interface(pool, modname); + say_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_SAY_INTERFACE); + say_interface->interface_name = "ja"; + say_interface->say_function = ja_say; + + /* indicate that the module should continue to be loaded */ + return SWITCH_STATUS_SUCCESS; +} + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4: + */ From 748b82f640fdd674f6d5eaf7f7b63c500a7a33f4 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 5 Oct 2010 10:50:07 -0500 Subject: [PATCH 03/46] minor tweaks --- src/switch_ivr_async.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 1fee5f99ab..cfb6a60e28 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -71,8 +71,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_create(switch_ivr_dmachine_t switch_byte_t my_pool = !!pool; switch_ivr_dmachine_t *dmachine; - if (digit_timeout_ms < 1 || input_timeout_ms < 1) return SWITCH_STATUS_FALSE; - if (!pool) { switch_core_new_memory_pool(&pool); } @@ -229,9 +227,13 @@ static switch_bool_t switch_ivr_dmachine_check_timeout(switch_ivr_dmachine_t *dm { switch_time_t now = switch_time_now(); uint32_t timeout = dmachine->cur_digit_len ? dmachine->digit_timeout_ms : dmachine->input_timeout_ms; - - if ((uint32_t)((now - dmachine->last_digit_time) / 1000) > timeout) { - return SWITCH_TRUE; + + if (!dmachine->last_digit_time) dmachine->last_digit_time = now; + + if (timeout) { + if ((uint32_t)((now - dmachine->last_digit_time) / 1000) > timeout) { + return SWITCH_TRUE; + } } return SWITCH_FALSE; @@ -253,7 +255,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t * dm_match_t is_match = switch_ivr_dmachine_check_match(dmachine, is_timeout); switch_status_t r; - if (!dmachine->last_digit_time) { + if (zstr(dmachine->digits) && !is_timeout) { r = SWITCH_STATUS_SUCCESS; } else if (dmachine->cur_digit_len > dmachine->max_digit_len) { r = SWITCH_STATUS_FALSE; From 80883ebeb81c73a3dc5c4ee65050d57e2c6ccf00 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 5 Oct 2010 11:11:21 -0500 Subject: [PATCH 04/46] don't force wake thread --- src/switch_core_sqldb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 7e427b5f03..c467a23a62 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -871,7 +871,7 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_db_thread(switch_thread_t *threa while (sql_manager.db_thread_running == 1) { if (++sec == SQL_CACHE_TIMEOUT) { sql_close(switch_epoch_time_now(NULL)); - wake_thread(1); + wake_thread(0); sec = 0; } switch_yield(1000); @@ -1425,7 +1425,7 @@ static void core_event_handler(switch_event_t *event) switch_queue_push(sql_manager.sql_queue[0], sql[i]); } sql[i] = NULL; - wake_thread(1); + wake_thread(0); } } } @@ -1705,7 +1705,7 @@ void switch_core_sqldb_stop(void) switch_queue_push(sql_manager.sql_queue[0], NULL); switch_queue_push(sql_manager.sql_queue[1], NULL); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Waiting for unfinished SQL transactions\n"); - wake_thread(1); + wake_thread(0); } sql_manager.thread_running = -1; From c9ab6f3355a41373dfabe854a90fa20cfb1d40f8 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Tue, 5 Oct 2010 13:12:43 -0400 Subject: [PATCH 05/46] freetdm: libpri update --- .../src/ftmod/ftmod_libpri/ftmod_libpri.c | 49 +++++++++++++------ 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index bb62f07754..cc25c702ef 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -605,10 +605,9 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) if (call) { pri_hangup(isdn_data->spri.pri, call, ftdmchan->caller_data.hangup_cause); pri_destroycall(isdn_data->spri.pri, call); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } else { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - } + ftdmchan->call_data = NULL; + } + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); } break; case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: @@ -617,8 +616,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) { sig.event_id = FTDM_SIGEVENT_STOP; status = ftdm_span_send_signal(ftdmchan->span, &sig); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - + /* user moves us to HANGUP and from there we go to DOWN */ } default: break; @@ -641,10 +639,12 @@ static __inline__ void check_state(ftdm_span_t *span) for(j = 1; j <= span->chan_count; j++) { if (ftdm_test_flag((span->channels[j]), FTDM_CHANNEL_STATE_CHANGE)) { ftdm_mutex_lock(span->channels[j]->mutex); + ftdm_channel_lock(span->channels[j]); ftdm_clear_flag((span->channels[j]), FTDM_CHANNEL_STATE_CHANGE); state_advance(span->channels[j]); ftdm_channel_complete_state(span->channels[j]); ftdm_mutex_unlock(span->channels[j]->mutex); + ftdm_channel_unlock(span->channels[j]); } } } @@ -682,18 +682,35 @@ static int on_hangup(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_even q931_call *call = NULL; ftdmchan = span->channels[pevent->hangup.channel]; - if (ftdmchan) { - call = (q931_call *) ftdmchan->call_data; - ftdm_log(FTDM_LOG_DEBUG, "-- Hangup on channel %d:%d\n", spri->span->span_id, pevent->hangup.channel); - ftdmchan->caller_data.hangup_cause = pevent->hangup.cause; - pri_release(spri->pri, call, 0); - pri_destroycall(spri->pri, call); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - } else { - ftdm_log(FTDM_LOG_DEBUG, "-- Hangup on channel %d:%d %s but it's not in use?\n", spri->span->span_id, - pevent->hangup.channel, ftdmchan->chan_id); + if (!ftdmchan) { + ftdm_log(FTDM_LOG_CRIT, "-- Hangup on channel %d:%d %s but it's not in use?\n", spri->span->span_id, pevent->hangup.channel); + return 0; } + ftdm_channel_lock(ftdmchan); + + if (ftdmchan->state >= FTDM_CHANNEL_STATE_TERMINATING) { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Ignoring remote hangup in state %s\n", ftdm_channel_state2str(ftdmchan->state)); + goto done; + } + + if (!ftdmchan->call_data) { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Ignoring remote hangup in state %s with no call data\n", ftdm_channel_state2str(ftdmchan->state)); + goto done; + } + + call = (q931_call *) ftdmchan->call_data; + ftdm_log(FTDM_LOG_DEBUG, "-- Hangup on channel %d:%d\n", spri->span->span_id, pevent->hangup.channel); + ftdmchan->caller_data.hangup_cause = pevent->hangup.cause; + pri_release(spri->pri, call, 0); + pri_destroycall(spri->pri, call); + ftdmchan->call_data = NULL; + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + +done: + + ftdm_channel_unlock(ftdmchan); + return 0; } From 7be271cfec0eedad1839d579871a08bcbcfdbf59 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Tue, 5 Oct 2010 13:44:55 -0400 Subject: [PATCH 06/46] mod_sangoma_codec: remove global pool reference --- src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index ae7468ebcc..d5ce08b3fc 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -65,9 +65,6 @@ unsigned long long g_next_session_id = 0; /* hash of sessions (I think a linked list suits better here, but FS does not have the data type) */ static switch_hash_t *g_sessions_hash = NULL; -/* global memory pool provided by FS */ -static switch_memory_pool_t *g_pool = NULL; - typedef struct vocallo_codec_s { int codec_id; /* vocallo codec ID */ int iana; /* IANA code to register in FS */ @@ -894,8 +891,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) return SWITCH_STATUS_FALSE; } - g_pool = pool; - g_init_cfg.log = sangoma_logger; g_init_cfg.create_rtp = sangoma_create_rtp; g_init_cfg.create_rtp_port = sangoma_create_rtp_port; From d427b3df774b19c895ee0a21f0259d9a7a143d6a Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Tue, 5 Oct 2010 13:59:31 -0400 Subject: [PATCH 07/46] freetdm: allow libpri transition from terminating to hangup --- libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index cc25c702ef..444b907911 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -374,7 +374,7 @@ static ftdm_state_map_t isdn_state_map = { ZSD_OUTBOUND, ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_END}, - {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_DOWN, FTDM_END} + {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_DOWN, FTDM_END} }, { ZSD_OUTBOUND, @@ -424,7 +424,7 @@ static ftdm_state_map_t isdn_state_map = { ZSD_INBOUND, ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_END}, - {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_DOWN, FTDM_END}, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_DOWN, FTDM_END}, }, { ZSD_INBOUND, From e3587c36a22a7847940c9c66b420ba02e11d31ea Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Tue, 5 Oct 2010 10:58:26 -0400 Subject: [PATCH 08/46] mod_sangoma_codec: print rtp address in stats --- .../codecs/mod_sangoma_codec/mod_sangoma_codec.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index d5ce08b3fc..4e3339bea2 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -737,10 +737,14 @@ SWITCH_STANDARD_API(sangoma_function) stream->write_function(stream, "Failed to find session %lu\n", sessid); goto done; } - stream->write_function(stream, "Session: %lu\n", sessid); + stream->write_function(stream, "Stats for transcoding session: %lu\n", sessid); if (sess->encoder.rxrtp) { stats = switch_rtp_get_stats(sess->encoder.rxrtp, NULL); + stream->write_function(stream, "=== Encoder ===\n"); + + stream->write_function(stream, "Remote address: %s:%d\n\n", switch_rtp_get_remote_host(sess->encoder.rxrtp), switch_rtp_get_remote_port(sess->encoder.rxrtp)); + stream->write_function(stream, "-- Encoder Inbound Stats --\n"); stream->write_function(stream, "Rx Discarded: %lu\n", sess->encoder.rxdiscarded); sangoma_print_stats(stream, &stats->inbound); @@ -749,10 +753,16 @@ SWITCH_STANDARD_API(sangoma_function) stats = switch_rtp_get_stats(sess->encoder.txrtp, NULL); stream->write_function(stream, "-- Encoder Outbound Stats --\n"); sangoma_print_stats(stream, &stats->outbound); + } else { + stream->write_function(stream, "\n=== No Encoder ===\n\n"); } if (sess->decoder.rxrtp) { stats = switch_rtp_get_stats(sess->decoder.rxrtp, NULL); + + stream->write_function(stream, "=== Decoder ===\n"); + stream->write_function(stream, "Remote address: %s:%d\n\n", switch_rtp_get_remote_host(sess->decoder.rxrtp), switch_rtp_get_remote_port(sess->decoder.rxrtp)); + stream->write_function(stream, "-- Decoder Inbound Stats --\n"); stream->write_function(stream, "Rx Discarded: %lu\n", sess->decoder.rxdiscarded); sangoma_print_stats(stream, &stats->inbound); @@ -760,6 +770,8 @@ SWITCH_STANDARD_API(sangoma_function) stats = switch_rtp_get_stats(sess->decoder.txrtp, NULL); stream->write_function(stream, "-- Decoder Outbound Stats --\n"); sangoma_print_stats(stream, &stats->outbound); + } else { + stream->write_function(stream, "\n=== No Decoder ===\n\n"); } } else { stream->write_function(stream, "Unknown Command [%s]\n", argv[0]); From 3716cf6f791b59ac8f9a566c724e493ab2f4d315 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 5 Oct 2010 16:23:41 -0500 Subject: [PATCH 09/46] add more proto --- src/include/switch_ivr.h | 4 ++-- src/switch_ivr_async.c | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index 5fee7baefa..ac9d8f9c1b 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -860,8 +860,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_feed(switch_ivr_dmachine_t * SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_clear(switch_ivr_dmachine_t *dmachine); SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t *dmachine, switch_ivr_dmachine_match_t **match_p); SWITCH_DECLARE(switch_ivr_dmachine_match_t *) switch_ivr_dmachine_get_match(switch_ivr_dmachine_t *dmachine); - - +SWITCH_DECLARE(void) switch_ivr_dmachine_set_digit_timeout_ms(switch_ivr_dmachine_t *dmachine, uint32_t digit_timeout_ms); +SWITCH_DECLARE(void) switch_ivr_dmachine_set_input_timeout_ms(switch_ivr_dmachine_t *dmachine, uint32_t input_timeout_ms); /** @} */ diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index cfb6a60e28..04972b3efa 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -87,6 +87,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_create(switch_ivr_dmachine_t } +SWITCH_DECLARE(void) switch_ivr_dmachine_set_digit_timeout_ms(switch_ivr_dmachine_t *dmachine, uint32_t digit_timeout_ms) +{ + dmachine->digit_timeout_ms = digit_timeout_ms; +} + +SWITCH_DECLARE(void) switch_ivr_dmachine_set_input_timeout_ms(switch_ivr_dmachine_t *dmachine, uint32_t input_timeout_ms) +{ + dmachine->input_timeout_ms = input_timeout_ms; +} + SWITCH_DECLARE(void) switch_ivr_dmachine_destroy(switch_ivr_dmachine_t **dmachine) { switch_memory_pool_t *pool; From 02ccd111fa2e5c1d5e72bf03bbe9f08bef4388cf Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Tue, 5 Oct 2010 15:04:02 -0700 Subject: [PATCH 10/46] Add sounds, update ChangeLog through 2010-10-05 --- docs/ChangeLog | 47 +++++++++++++++++++++++++++++++++++++++ docs/phrase/phrase_en.xml | 3 +++ 2 files changed, 50 insertions(+) diff --git a/docs/ChangeLog b/docs/ChangeLog index 412ab9ff18..d6fddd6bfa 100644 --- a/docs/ChangeLog +++ b/docs/ChangeLog @@ -16,6 +16,9 @@ freeswitch (1.0.7) build: VS 2010 - Change to V4 framework, add SWIG v2.0 files to fix release build exceptions(temp fix till we upgrade all SWIG files) (r:812f4309) build: Windows VS2010 build - remove strange characters (r:ba1546e0/FSBUILD-297) build: Make bootstrap.sh Bourne shell compatible (r:8dbd62ff/FSBUILD-301) + build: add mod_osp Makefile to configure generated Makefiles (r:dc06a039/FS-122) + build: Remove mod_spidermonkey from windows 2008 x64 builds - does not work (r:280e894d) + build: fix warnings on windows x64 builds src and mods projects - only libsofia included on the libs side (r:45ecbc2f) codec2: working prototype, still for testing only (r:04ca0751) config: move limit.conf to db.conf config: Update VM phrase macros to voice option then action on main, config menus @@ -26,6 +29,7 @@ freeswitch (1.0.7) config: move enum to the bottom of default. (r:4d448c97) config: Add att_xfer example to default dialplan (r:20ec962a) config: default example to resolve some issues with SCA in cases where host and ip are mixed causing the phone to be confused. (r:0279261b) + config: Fix phrase files, still missing a sound file (r:6741f350/FS-2742) core: Add RTCP support (FSRTP-14) core: handle some errors on missing db handle conditions core: add ... and shutdown as a fail-safe when no modules are loaded @@ -95,7 +99,19 @@ freeswitch (1.0.7) core: avoid segfault when sofia tries to update the callee id at the same time as the outbound call is transferred (r:df63657e) core: make code more automagic to shut up the dude on the list (r:d093a4a4) core: Fix memory leak if we fail to enqueue new event to EVENT_QUEUE in switch_event.c (r:ef773e07/FS-2148) + core: fix endless loop on startup when specifying -nosql (r:b6a533ee) + core: Buffer for url encode in switch_ivr_set_xml_chan_vars() too small by 1 (r:0cc28f37/FS-2167) + core: fix switch_ivr_collect_digits_callback to allow an args pointer with null callback to work like other apis (r:89d99a91) + core: ERROR_PARTIAL and BAD_PARTIAL are regarded as PARTIAL in switch_regex_match_partial (r:b4548a60/FS-2238) + core: sprinkle digit_timeout into switch_ivr_read and switch_ivr_play_and_get_digits and the higher level variants (r:cfa30468) + core: Fix parse of variable absolute_codec_string when inside [] (r:54bf6575/FS-2126) + core: Fix SWITCH_IO_FLAG_NOBLOCK needed for mod_sangoma_codec (r:bc304153/FS-2017) + core: fix coredump in rtcp socket handling (r:6c1070ea/FS-2009) + core: add bitrate patch from moc with some extra stuff for late neg mode (r:633f193d) + core: refactor fmtp parser as a core func (r:56f8c11f) + core: add switch_ivr_dmachine async digit parser to core (r:7f3319dc) lang: Improve French phrase files (FSCONFIG-23) + libapr: Fix issue where after a bridge with a member, uuid of Agent is set to single quote character ' (r:3fee704d/FS-2738) libdingaling: fix race on shutdown causing crash (FSMOD-47) libdingaling: Fix crash in new GV interface when exceeding 24 calls (r:be00609a/FS-2171) libesl: Fix potential race condition (ESL-36) @@ -113,9 +129,11 @@ freeswitch (1.0.7) libfreetdm: implemented freetdm config nodes and ss7 initial configuration libfreetdm: fix codec for CAS signaling (r:b76e7f18) libfreetdm: freetdm: ss7- added support for incoming group blocks, started adding support for ansi (r:c219a73c) + libgnutls: link to libgcrypt as well, please report any platforms this breaks, but it should be portable (r:c569fb0f/FS-1248) libopenzap: Add CLI tracing libs: Merged OpenZAP and FreeTDM into the FreeSWITCH tree. libs: Add support for TLS on Windows using openssl (r:1abe3b93/MODSOFIA-92) + libs: fix bsd shell incompatibility (r:e2b85e94/FS-287) libsofiasip: Fix random crashes (r:c15ee980/SFSIP-219) libsofiasip: Fix T.38 bug in sofia_glue (r:2843f1ad/MODSOFIA-94) libsofiasip: VS2010 sofia posix problem (r:46dd24c2/SFSIP-220) @@ -139,6 +157,8 @@ freeswitch (1.0.7) mod_callcenter: Add more channel variable and event and fix a mem leak (r:2d3d8c8d) mod_callcenter: Make more sence to bridge the caller to the agent. Before, in the xml_cdr you saw it it like the agent initiated the call to the member (r:0be95658) mod_callcenter: Added max-wait-time and max-wait-time-with-no-agent param to a queue. (r:3482f95e) + mod_callcenter: Make sure we fail to load if config is not present (r:e1fb79a1) + mod_callcenter: Fix invalid update of agent field (r:426a448f/FS-2738) mod_cidlookup: null xml is bad (r:095815f8) mod_cid_lookup: honor skipcitystate when using whitepages (r:a66654de/FSMOD-53) mod_commands: make break uuid_break and add cascade flag @@ -152,6 +172,7 @@ freeswitch (1.0.7) mod_commands: Fix user_data returning the first value found instead of the last. Also add support to get variable from the group. (r:402f2391) mod_commands: Allow cond API to return empty false value (r:c8a897b9) mod_commands: ***BEHAVIOUR CHANGE*** reloadacl, load , reload will now explicitly call reloadxml (r:42c9df72) + mod_commands: add nat_map usage (r:7577b8aa) mod_conference: Fix reporting of volume up/down (MODAPP-419) mod_conference: add last talking time per member to conference xml list mod_conference: add terminate-on-silence conference param @@ -170,6 +191,7 @@ freeswitch (1.0.7) mod_dptools: add eavesdrop_enable_dtmf chan var (r:596c0012) mod_dptools: Make park app not send 183 session progress (r:76932995/FSCORE-567) mod_dptools: add block_dtmf and unblock_dtmf apps (r:d9eb0197) + mod_dptools: refactor export code and add new bridge_export app which is like export but exports across when one channel bridges another (r:4aa9a838) mod_erlang_event: Make XML fetch reply ACKs distinguishable, update freeswitch.erl (r:9d44ed04) mod_erlang_event: Add 3 new commands; session_event, session_noevents, session_nixevent (r:698fa045) mod_erlang_event: generate long node names the same as erlang does (r:9ad509c2) @@ -181,6 +203,7 @@ freeswitch (1.0.7) mod_fifo: add taking_calls param to fifo member add and config file (r:821488bf) mod_fifo: add nomedia flag (r:2d30a8c2) mod_fifo: Fix inconsistency between the fifo queue and the channels (num callers in queue can become "-1") (r:07487114/FS-1659) + mod_fifo: fix issue leaving stale records in fifo_bridge table (r:b36d015f) mod_freetdm: Fix for TON and NPI not passed through to channel variables on incoming calls mod_freetdm: add pvt data to freetdm channels fix fxs features (r:9d456900) mod_freetdm: export and import boost custom data (r:edb2d582) @@ -244,6 +267,7 @@ freeswitch (1.0.7) mod_lcr: don't count twice (r:eaeabc7b/FS-1810) mod_loopback: add loopback_bowout_on_execute var to make 1 legged loopback calls bow out of the picture mod_loopback: only execute app once in app mode (r:64f58f2d) + mod_loopback: fix bug in mod_loopback where bowout=false (r:e9ab5368) mod_lua: Add switch_core_sqldb functionality from inside Lua script (r:26f2e095/FS-1384) mod_lua: Made 2nd arg to freeswitch.Dbh:query (cb func) optional (r:87db11af) mod_lua: Added SAF_ROUTING_EXEC flag to lua app, so it can be run inline (r:7d5ca1c0) @@ -268,6 +292,7 @@ freeswitch (1.0.7) mod_sangoma_codec: rename load/noload to register/noregister mod_sangoma_codec: silence suppression (r:73d9d56f) mod_say_es: fix grammar when saying dates and time (r:6bed19b2/MODAPP-429) + mod_say_ja: initial commit, still needs sound files (r:b2423158/FS-2755) mod_say_ru: Fix saying time with +1 hour of current time (r:68d74c31/MODAPP-444) mod_say_zh: Number reading should now be OK for the whole range of integers for Cantonese and Mandarin mod_silk: Fix mod_silk compliance and performance issues (r:2ddbc457/MODCODEC-20) @@ -350,6 +375,22 @@ freeswitch (1.0.7) mod_sofia: add inline lists for tab complete db using ::[a:b syntax (r:445731ee) mod_sofia: add sofia profile gwlist up|down to list up or downed profiles for feeding into mod distributor to exclude dead gateways (r:0477cb67) mod_sofia: add 'sofia global siptrace on' so we don't have to always teach people to enable sip trace on each profile (r:09fa6678) + mod_sofia: fix seg on subscribe with no contact host (r:c236541e) + mod_sofia: fix typo and printf specifier resulting in incorrect output of call counts on profiles and gateways (r:29ea6e29) + mod_sofia: fix t38 passthru when port changes on re-invite (r:72baaf6d) + mod_sofia: let ~ signify that multipart content will contain headers (r:3548168d) + mod_sofia: Fix rash with rxfax when no remote host (r:a9446ac1/FS-677) + mod_sofia: Handle incorrectly formatted T.38 booleans (r:8f731f42/FS-957) + mod_sofia: fix crash in sofia_reg_find_gateway_by_realm__ (r:721c8019/FS-488) + mod_sofia: Handle 301 moved permanently. (r:ba59c51d/FS-2739) + mod_sofia: don't passthru when its proxy media, bypass media or there is no rtp session, fixes seg (r:45e2b99d) + mod_sofia: improve video support for new polycom phones (r:84a383fe) + mod_sofia: Forward unsolicited MWI nofity (r:e946da9a/FS-861) + mod_sofia: Support display updates for Cisco SIP endpoints (tested on SPA series) (r:6937ca39/FS-884) + mod_sofia: BLF compliance with RFC-4235: dialog-info 'version=' field is reset to 0 on every new call instead of being incremented (r:589502d3/FS-2747) + mod_sofia: fix parsing of sofia tracelevel param, moved param from profile params to global_settings as its global, and it only worked on reparse before anyways. Please correct any documentation on this issue on the wiki (r:82c4c4cc/FS-523) + mod_sofia: fix nat acl count check to check against the number of nat acls (r:e11550e7/FS-502) + mod_sofia: add sofia_glue_find_parameter_value function to get a specific value from a url params string (r:c701d41c) mod_spandsp: initial checkin of mod_fax/mod_voipcodecs merge into mod_spandsp (r:fa9a59a8) mod_spandsp: rework of new mod_spandsp to have functions broken up into different c files (r:65400642) mod_spandsp: improve duplicate digit detection and add 'min_dup_digit_spacing_ms' channel variable for use with the dtmf detector (r:eab4f246/FSMOD-45) @@ -358,6 +399,9 @@ freeswitch (1.0.7) mod_spandsp: Moved spandsp to a more recent version. A huge number of little changes occur here, as recently spandsp lost all the $Id$ entries the source files had for the dark old days of CVS (r:f029f7ef) mod_spandsp: move app flag into 'T38' namespace for the sake of housekeeping (r:0d0b4b43) mod_spandsp: make t38 terminal mode more reliable (r:83da7bd3) + mod_spandsp: deadlock in mod_spandsp (mod_spandsp_fax.c) (r:b02c69bb/FS-1690) + mod_spandsp: T.38 reINVITE glare condition causes FAX processing to stop. (r:04aa7ef9/FS-1682) + mod_spandsp: improve nat handling when using stun or host as ext-rtp-ip (r:03e74c51/FS-526) mod_spidermonkey: allow vars to be set containing vars from languages (r:5cd072a3) mod_spidermonkey: fix seg in js hangup (r:7d554c11) mod_spidermonkey: Fix mod_spidermonkey build on FreeBSD, (Undefined symbol PR_LocalTimeParameters). (r:3edb8419) @@ -366,6 +410,7 @@ freeswitch (1.0.7) mod_unimrcp: fix fortify findings for mod_unimrcp (r:336f0b4e/FSMOD-67) mod_valet_parking: add event data to valet parking hold event mod_valet_parking: add event for Valet Parking action exit + mod_valet_parking: pass hold class on transfer (r:76a065ec) mod_voicemail: Fix vm_prefs profile lock (MODAPP-417) mod_voicemail: add 'vm-enabled' param (default true) mod_voicemail: fix vm msg being deleted when pressing key to forward to email (MODAPP-403) @@ -374,11 +419,13 @@ freeswitch (1.0.7) mod_voicemail: Allow to forward a message or send it via email key during the playback of the recording, not just when the menu is playing. (r:83aeda79) mod_voicemail: fix vm_inject to a group and change syntax for sending to a whole domain to domain= for clarity sake (r:f30a1cc6) mod_voicemail: add quotes to vm_cc command generated internally to escape spaces in the caller id name (r:5f012813) + mod_voicemail: Play caller id of callee prior to playing a vmail (r:e7b97907/FS-2719) mod_xml_cdr: add force_process_cdr var to process b leg cdr on a case by case basis when b leg cdr is disabled (XML-17) mod_xml_cdr: add leg param to query string (XML-24) mod_xml_cdr: fix locked sessions (XML-26) mod_xml_cdr: fix minor memory leaks and config bug (r:19253d83/MODEVENT-62) mod_xml_rpc: Fix crash if unauthorized XML RPC is attempted (r:9835395c/FS-184) + scripts: added honeypot.pl and blacklist.pl which add extra SIP security options (r:b6a81ba7) sofia-sip: fix null derefernce segfault in soa (r:f356c5e6) sofia-sip: extend timeout for session expires on short timeouts to be 90% of timeout instead of 1/3 to handle devices that do not refresh in time such as polycom (r:a7f48928/SFSIP-212) diff --git a/docs/phrase/phrase_en.xml b/docs/phrase/phrase_en.xml index 6d582e77a1..318aba18dd 100644 --- a/docs/phrase/phrase_en.xml +++ b/docs/phrase/phrase_en.xml @@ -419,6 +419,9 @@ + + + From 3bae1e7ab2805042c35570c268e7b8e49d6fccac Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 6 Oct 2010 08:38:32 -0500 Subject: [PATCH 11/46] refactor --- src/mod/endpoints/mod_sofia/mod_sofia.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 13d304d9ce..f2cc05d053 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -242,14 +242,15 @@ static switch_status_t sofia_on_execute(switch_core_session_t *session) return SWITCH_STATUS_SUCCESS; } -char *generate_pai_str(switch_core_session_t *session) +char *generate_pai_str(private_object_t *tech_pvt) { - private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session); + switch_core_session_t *session = tech_pvt->session; const char *callee_name = NULL, *callee_number = NULL; const char *var, *header, *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent"); char *pai = NULL; - if (!sofia_test_pflag(tech_pvt->profile, PFLAG_CID_IN_1XX) || + + if (!sofia_test_pflag(tech_pvt->profile, PFLAG_PASS_CALLEE_ID) || !sofia_test_pflag(tech_pvt->profile, PFLAG_CID_IN_1XX) || ((var = switch_channel_get_variable(tech_pvt->channel, "sip_cid_in_1xx")) && switch_false(var))) { return NULL; } @@ -521,7 +522,7 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session) switch_channel_set_variable(channel, "sip_hangup_disposition", "send_refuse"); } if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) { - char *cid = generate_pai_str(session); + char *cid = generate_pai_str(tech_pvt); nua_respond(tech_pvt->nh, sip_cause, sip_status_phrase(sip_cause), TAG_IF(!zstr(reason), SIPTAG_REASON_STR(reason)), @@ -703,9 +704,9 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session) char *extra_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_RESPONSE_HEADER_PREFIX); char *cid = NULL; - if (sofia_test_pflag(tech_pvt->profile, PFLAG_PASS_CALLEE_ID)) { - cid = generate_pai_str(session); - } + + cid = generate_pai_str(tech_pvt); + if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) && tech_pvt->early_sdp && strcmp(tech_pvt->early_sdp, tech_pvt->local_sdp_str)) { /* The SIP RFC for SOA forbids sending a 183 with one sdp then a 200 with another but it won't do us much good unless @@ -1968,7 +1969,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi } else if (code == 484 && msg->numeric_arg) { const char *to = switch_channel_get_variable(channel, "sip_to_uri"); const char *max_forwards = switch_channel_get_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE); - char *cid = generate_pai_str(session); + char *cid = generate_pai_str(tech_pvt); char *to_uri = NULL; if (to) { @@ -2066,7 +2067,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi !switch_channel_test_flag(channel, CF_EARLY_MEDIA) && !switch_channel_test_flag(channel, CF_ANSWERED)) { char *extra_header = sofia_glue_get_extra_headers(channel, SOFIA_SIP_PROGRESS_HEADER_PREFIX); const char *call_info = switch_channel_get_variable(channel, "presence_call_info_full"); - char *cid = generate_pai_str(session); + char *cid = generate_pai_str(tech_pvt); switch (ring_ready_val) { @@ -2187,9 +2188,8 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi char *extra_header = sofia_glue_get_extra_headers(channel, SOFIA_SIP_PROGRESS_HEADER_PREFIX); char *cid = NULL; - if (sofia_test_pflag(tech_pvt->profile, PFLAG_PASS_CALLEE_ID)) { - cid = generate_pai_str(session); - } + cid = generate_pai_str(tech_pvt); + if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) && tech_pvt->early_sdp && strcmp(tech_pvt->early_sdp, tech_pvt->local_sdp_str)) { From fea856b67c3bd29c840faad2c28cc76fa7c99a18 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 6 Oct 2010 08:48:33 -0500 Subject: [PATCH 12/46] swigall --- src/mod/endpoints/mod_sofia/mod_sofia.c | 3 +- .../languages/mod_managed/freeswitch_wrap.cxx | 346 +++++++++++++++- src/mod/languages/mod_managed/managed/swig.cs | 371 +++++++++++++++++- src/mod/languages/mod_perl/mod_perl_wrap.cpp | 6 +- 4 files changed, 708 insertions(+), 18 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index f2cc05d053..4cb59704c1 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -249,12 +249,13 @@ char *generate_pai_str(private_object_t *tech_pvt) const char *var, *header, *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent"); char *pai = NULL; + printf("WTF %s %d\n", tech_pvt->profile->name, sofia_test_pflag(tech_pvt->profile, PFLAG_PASS_CALLEE_ID)); if (!sofia_test_pflag(tech_pvt->profile, PFLAG_PASS_CALLEE_ID) || !sofia_test_pflag(tech_pvt->profile, PFLAG_CID_IN_1XX) || ((var = switch_channel_get_variable(tech_pvt->channel, "sip_cid_in_1xx")) && switch_false(var))) { return NULL; } - + printf("BOOL FUCKEDUP\n"); if (zstr((callee_name = switch_channel_get_variable(tech_pvt->channel, "effective_callee_id_name"))) && zstr((callee_name = switch_channel_get_variable(tech_pvt->channel, "sip_callee_id_name")))) { diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index b3696899ac..ad4d63d1f0 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -1070,6 +1070,17 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABL } +SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE_get() { + char * jresult ; + char *result = 0 ; + + result = (char *) "passthru_ptime_mismatch"; + + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE_get() { char * jresult ; char *result = 0 ; @@ -1422,6 +1433,17 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_EXPORT_VARS_VARIABLE_get() { } +SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_BRIDGE_EXPORT_VARS_VARIABLE_get() { + char * jresult ; + char *result = 0 ; + + result = (char *) "bridge_export_vars"; + + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_R_SDP_VARIABLE_get() { char * jresult ; char *result = 0 ; @@ -4053,6 +4075,123 @@ SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_console_callback_match(void * j } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_match_dmachine_set(void * jarg1, void * jarg2) { + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + switch_ivr_dmachine_t *arg2 = (switch_ivr_dmachine_t *) 0 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + arg2 = (switch_ivr_dmachine_t *)jarg2; + if (arg1) (arg1)->dmachine = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_ivr_dmachine_match_dmachine_get(void * jarg1) { + void * jresult ; + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + switch_ivr_dmachine_t *result = 0 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + result = (switch_ivr_dmachine_t *) ((arg1)->dmachine); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_match_match_digits_set(void * jarg1, char * jarg2) { + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + char *arg2 = (char *) 0 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + arg2 = (char *)jarg2; + { + if (arg2) { + arg1->match_digits = (char const *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->match_digits, (const char *)arg2); + } else { + arg1->match_digits = 0; + } + } +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_ivr_dmachine_match_match_digits_get(void * jarg1) { + char * jresult ; + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + char *result = 0 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + result = (char *) ((arg1)->match_digits); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_match_match_key_set(void * jarg1, int jarg2) { + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + int32_t arg2 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + arg2 = (int32_t)jarg2; + if (arg1) (arg1)->match_key = arg2; + +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_match_match_key_get(void * jarg1) { + int jresult ; + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + int32_t result; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + result = (int32_t) ((arg1)->match_key); + jresult = result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_match_user_data_set(void * jarg1, void * jarg2) { + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + void *arg2 = (void *) 0 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + arg2 = (void *)jarg2; + if (arg1) (arg1)->user_data = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_ivr_dmachine_match_user_data_get(void * jarg1) { + void * jresult ; + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + void *result = 0 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + result = (void *) ((arg1)->user_data); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_ivr_dmachine_match() { + void * jresult ; + switch_ivr_dmachine_match *result = 0 ; + + result = (switch_ivr_dmachine_match *)new switch_ivr_dmachine_match(); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_ivr_dmachine_match(void * jarg1) { + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + delete arg1; + +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_input_args_t_input_callback_set(void * jarg1, void * jarg2) { switch_input_args_t *arg1 = (switch_input_args_t *) 0 ; switch_input_callback_function_t arg2 = (switch_input_callback_function_t) 0 ; @@ -4168,6 +4307,29 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_input_args_t_user_data_get(void * ja } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_input_args_t_dmachine_set(void * jarg1, void * jarg2) { + switch_input_args_t *arg1 = (switch_input_args_t *) 0 ; + switch_ivr_dmachine_t *arg2 = (switch_ivr_dmachine_t *) 0 ; + + arg1 = (switch_input_args_t *)jarg1; + arg2 = (switch_ivr_dmachine_t *)jarg2; + if (arg1) (arg1)->dmachine = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_input_args_t_dmachine_get(void * jarg1) { + void * jresult ; + switch_input_args_t *arg1 = (switch_input_args_t *) 0 ; + switch_ivr_dmachine_t *result = 0 ; + + arg1 = (switch_input_args_t *)jarg1; + result = (switch_ivr_dmachine_t *) ((arg1)->dmachine); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_input_args_t() { void * jresult ; switch_input_args_t *result = 0 ; @@ -4279,7 +4441,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_API_VERSION_get() { int jresult ; int result; - result = (int) 4; + result = (int) 5; jresult = result; return jresult; @@ -8198,6 +8360,24 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_copy(void * jarg1, void * ja } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_parse_fmtp(char * jarg1, char * jarg2, unsigned long jarg3, void * jarg4) { + int jresult ; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + uint32_t arg3 ; + switch_codec_fmtp_t *arg4 = (switch_codec_fmtp_t *) 0 ; + switch_status_t result; + + arg1 = (char *)jarg1; + arg2 = (char *)jarg2; + arg3 = (uint32_t)jarg3; + arg4 = (switch_codec_fmtp_t *)jarg4; + result = (switch_status_t)switch_core_codec_parse_fmtp((char const *)arg1,(char const *)arg2,arg3,arg4); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_reset(void * jarg1) { int jresult ; switch_codec_t *arg1 = (switch_codec_t *) 0 ; @@ -11836,6 +12016,18 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_digit_string(char * jarg1) { } +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_known_bitrate(unsigned char jarg1) { + unsigned long jresult ; + switch_payload_t arg1 ; + uint32_t result; + + arg1 = (switch_payload_t)jarg1; + result = (uint32_t)switch_known_bitrate(arg1); + jresult = (unsigned long)result; + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_switch_fd_read_line(int jarg1, char * jarg2, void * jarg3) { void * jresult ; int arg1 ; @@ -22988,36 +23180,54 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_get_variable_partner(void * } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_export_variable_var_check(void * jarg1, char * jarg2, char * jarg3, int jarg4) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_export_variable_var_check(void * jarg1, char * jarg2, char * jarg3, char * jarg4, int jarg5) { int jresult ; switch_channel_t *arg1 = (switch_channel_t *) 0 ; char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; - switch_bool_t arg4 ; + char *arg4 = (char *) 0 ; + switch_bool_t arg5 ; switch_status_t result; arg1 = (switch_channel_t *)jarg1; arg2 = (char *)jarg2; arg3 = (char *)jarg3; - arg4 = (switch_bool_t)jarg4; - result = (switch_status_t)switch_channel_export_variable_var_check(arg1,(char const *)arg2,(char const *)arg3,arg4); + arg4 = (char *)jarg4; + arg5 = (switch_bool_t)jarg5; + result = (switch_status_t)switch_channel_export_variable_var_check(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5); jresult = result; return jresult; } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_export_variable_printf(void * jarg1, char * jarg2, char * jarg3) { +SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_process_export(void * jarg1, void * jarg2, void * jarg3, char * jarg4) { + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + switch_channel_t *arg2 = (switch_channel_t *) 0 ; + switch_event_t *arg3 = (switch_event_t *) 0 ; + char *arg4 = (char *) 0 ; + + arg1 = (switch_channel_t *)jarg1; + arg2 = (switch_channel_t *)jarg2; + arg3 = (switch_event_t *)jarg3; + arg4 = (char *)jarg4; + switch_channel_process_export(arg1,arg2,arg3,(char const *)arg4); +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_export_variable_printf(void * jarg1, char * jarg2, char * jarg3, char * jarg4) { int jresult ; switch_channel_t *arg1 = (switch_channel_t *) 0 ; char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; - void *arg4 = 0 ; + char *arg4 = (char *) 0 ; + void *arg5 = 0 ; switch_status_t result; arg1 = (switch_channel_t *)jarg1; arg2 = (char *)jarg2; arg3 = (char *)jarg3; - result = (switch_status_t)switch_channel_export_variable_printf(arg1,(char const *)arg2,(char const *)arg3,arg4); + arg4 = (char *)jarg4; + result = (switch_status_t)switch_channel_export_variable_printf(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5); jresult = result; return jresult; } @@ -27646,6 +27856,126 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_uuid_exists(char * jarg1) { } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_create(void * jarg1, void * jarg2, unsigned long jarg3, unsigned long jarg4) { + int jresult ; + switch_ivr_dmachine_t **arg1 = (switch_ivr_dmachine_t **) 0 ; + switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ; + uint32_t arg3 ; + uint32_t arg4 ; + switch_status_t result; + + arg1 = (switch_ivr_dmachine_t **)jarg1; + arg2 = (switch_memory_pool_t *)jarg2; + arg3 = (uint32_t)jarg3; + arg4 = (uint32_t)jarg4; + result = (switch_status_t)switch_ivr_dmachine_create(arg1,arg2,arg3,arg4); + jresult = result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_destroy(void * jarg1) { + switch_ivr_dmachine_t **arg1 = (switch_ivr_dmachine_t **) 0 ; + + arg1 = (switch_ivr_dmachine_t **)jarg1; + switch_ivr_dmachine_destroy(arg1); +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_bind(void * jarg1, char * jarg2, int jarg3, void * jarg4, void * jarg5) { + int jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + char *arg2 = (char *) 0 ; + int32_t arg3 ; + switch_ivr_dmachine_callback_t arg4 = (switch_ivr_dmachine_callback_t) 0 ; + void *arg5 = (void *) 0 ; + switch_status_t result; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (int32_t)jarg3; + arg4 = (switch_ivr_dmachine_callback_t)jarg4; + arg5 = (void *)jarg5; + result = (switch_status_t)switch_ivr_dmachine_bind(arg1,(char const *)arg2,arg3,arg4,arg5); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_feed(void * jarg1, char * jarg2, void * jarg3) { + int jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_ivr_dmachine_match_t **arg3 = (switch_ivr_dmachine_match_t **) 0 ; + switch_status_t result; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (switch_ivr_dmachine_match_t **)jarg3; + result = (switch_status_t)switch_ivr_dmachine_feed(arg1,(char const *)arg2,arg3); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_clear(void * jarg1) { + int jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + switch_status_t result; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + result = (switch_status_t)switch_ivr_dmachine_clear(arg1); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_ping(void * jarg1, void * jarg2) { + int jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + switch_ivr_dmachine_match_t **arg2 = (switch_ivr_dmachine_match_t **) 0 ; + switch_status_t result; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (switch_ivr_dmachine_match_t **)jarg2; + result = (switch_status_t)switch_ivr_dmachine_ping(arg1,arg2); + jresult = result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_ivr_dmachine_get_match(void * jarg1) { + void * jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + switch_ivr_dmachine_match_t *result = 0 ; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + result = (switch_ivr_dmachine_match_t *)switch_ivr_dmachine_get_match(arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_set_digit_timeout_ms(void * jarg1, unsigned long jarg2) { + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + uint32_t arg2 ; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (uint32_t)jarg2; + switch_ivr_dmachine_set_digit_timeout_ms(arg1,arg2); +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_set_input_timeout_ms(void * jarg1, unsigned long jarg2) { + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + uint32_t arg2 ; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (uint32_t)jarg2; + switch_ivr_dmachine_set_input_timeout_ms(arg1,arg2); +} + + SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RTP_MAX_BUF_LEN_get() { int jresult ; int result; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index f30750a191..a1b556bb8a 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -1673,6 +1673,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_core_codec_parse_fmtp(string codec_name, string fmtp, uint rate, switch_codec_fmtp codec_fmtp) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_codec_parse_fmtp(codec_name, fmtp, rate, switch_codec_fmtp.getCPtr(codec_fmtp)); + return ret; + } + public static switch_status_t switch_core_codec_reset(switch_codec codec) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_codec_reset(switch_codec.getCPtr(codec)); return ret; @@ -2635,6 +2640,11 @@ public class freeswitch { return ret; } + public static uint switch_known_bitrate(byte payload) { + uint ret = freeswitchPINVOKE.switch_known_bitrate(payload); + return ret; + } + public static SWIGTYPE_p_switch_size_t switch_fd_read_line(int fd, string buf, SWIGTYPE_p_switch_size_t len) { SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_fd_read_line(fd, buf, SWIGTYPE_p_switch_size_t.getCPtr(len)), true); if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); @@ -3178,13 +3188,17 @@ public class freeswitch { return ret; } - public static switch_status_t switch_channel_export_variable_var_check(SWIGTYPE_p_switch_channel channel, string varname, string value, switch_bool_t var_check) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_export_variable_var_check(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, value, (int)var_check); + public static switch_status_t switch_channel_export_variable_var_check(SWIGTYPE_p_switch_channel channel, string varname, string val, string export_varname, switch_bool_t var_check) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_export_variable_var_check(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, val, export_varname, (int)var_check); return ret; } - public static switch_status_t switch_channel_export_variable_printf(SWIGTYPE_p_switch_channel channel, string varname, string fmt) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_export_variable_printf(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, fmt); + public static void switch_channel_process_export(SWIGTYPE_p_switch_channel channel, SWIGTYPE_p_switch_channel peer_channel, switch_event var_event, string export_varname) { + freeswitchPINVOKE.switch_channel_process_export(SWIGTYPE_p_switch_channel.getCPtr(channel), SWIGTYPE_p_switch_channel.getCPtr(peer_channel), switch_event.getCPtr(var_event), export_varname); + } + + public static switch_status_t switch_channel_export_variable_printf(SWIGTYPE_p_switch_channel channel, string varname, string export_varname, string fmt) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_export_variable_printf(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, export_varname, fmt); return ret; } @@ -4324,6 +4338,49 @@ public class freeswitch { return ret; } + public static switch_status_t switch_ivr_dmachine_create(SWIGTYPE_p_p_switch_ivr_dmachine dmachine_p, SWIGTYPE_p_apr_pool_t pool, uint digit_timeout, uint input_timeout) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_create(SWIGTYPE_p_p_switch_ivr_dmachine.getCPtr(dmachine_p), SWIGTYPE_p_apr_pool_t.getCPtr(pool), digit_timeout, input_timeout); + return ret; + } + + public static void switch_ivr_dmachine_destroy(SWIGTYPE_p_p_switch_ivr_dmachine dmachine) { + freeswitchPINVOKE.switch_ivr_dmachine_destroy(SWIGTYPE_p_p_switch_ivr_dmachine.getCPtr(dmachine)); + } + + public static switch_status_t switch_ivr_dmachine_bind(SWIGTYPE_p_switch_ivr_dmachine dmachine, string digits, int key, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t callback, SWIGTYPE_p_void user_data) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_bind(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), digits, key, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(callback), SWIGTYPE_p_void.getCPtr(user_data)); + return ret; + } + + public static switch_status_t switch_ivr_dmachine_feed(SWIGTYPE_p_switch_ivr_dmachine dmachine, string digits, SWIGTYPE_p_p_switch_ivr_dmachine_match match) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_feed(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), digits, SWIGTYPE_p_p_switch_ivr_dmachine_match.getCPtr(match)); + return ret; + } + + public static switch_status_t switch_ivr_dmachine_clear(SWIGTYPE_p_switch_ivr_dmachine dmachine) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_clear(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine)); + return ret; + } + + public static switch_status_t switch_ivr_dmachine_ping(SWIGTYPE_p_switch_ivr_dmachine dmachine, SWIGTYPE_p_p_switch_ivr_dmachine_match match_p) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_ping(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), SWIGTYPE_p_p_switch_ivr_dmachine_match.getCPtr(match_p)); + return ret; + } + + public static switch_ivr_dmachine_match switch_ivr_dmachine_get_match(SWIGTYPE_p_switch_ivr_dmachine dmachine) { + IntPtr cPtr = freeswitchPINVOKE.switch_ivr_dmachine_get_match(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine)); + switch_ivr_dmachine_match ret = (cPtr == IntPtr.Zero) ? null : new switch_ivr_dmachine_match(cPtr, false); + return ret; + } + + public static void switch_ivr_dmachine_set_digit_timeout_ms(SWIGTYPE_p_switch_ivr_dmachine dmachine, uint digit_timeout_ms) { + freeswitchPINVOKE.switch_ivr_dmachine_set_digit_timeout_ms(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), digit_timeout_ms); + } + + public static void switch_ivr_dmachine_set_input_timeout_ms(SWIGTYPE_p_switch_ivr_dmachine dmachine, uint input_timeout_ms) { + freeswitchPINVOKE.switch_ivr_dmachine_set_input_timeout_ms(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), input_timeout_ms); + } + public static switch_status_t switch_rtp_add_crypto_key(SWIGTYPE_p_switch_rtp rtp_session, switch_rtp_crypto_direction_t direction, uint index, switch_rtp_crypto_key_type_t type, SWIGTYPE_p_unsigned_char key, SWIGTYPE_p_switch_size_t keylen) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_add_crypto_key(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), (int)direction, index, (int)type, SWIGTYPE_p_unsigned_char.getCPtr(key), SWIGTYPE_p_switch_size_t.getCPtr(keylen)); if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); @@ -5164,6 +5221,7 @@ public class freeswitch { public static readonly string SWITCH_CURRENT_APPLICATION_VARIABLE = freeswitchPINVOKE.SWITCH_CURRENT_APPLICATION_VARIABLE_get(); public static readonly string SWITCH_CURRENT_APPLICATION_DATA_VARIABLE = freeswitchPINVOKE.SWITCH_CURRENT_APPLICATION_DATA_VARIABLE_get(); public static readonly string SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE = freeswitchPINVOKE.SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE_get(); + public static readonly string SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE = freeswitchPINVOKE.SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE_get(); public static readonly string SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE = freeswitchPINVOKE.SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE_get(); public static readonly string SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE = freeswitchPINVOKE.SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE_get(); public static readonly string SWITCH_READ_RESULT_VARIABLE = freeswitchPINVOKE.SWITCH_READ_RESULT_VARIABLE_get(); @@ -5196,6 +5254,7 @@ public class freeswitch { public static readonly string SWITCH_ENDPOINT_DISPOSITION_VARIABLE = freeswitchPINVOKE.SWITCH_ENDPOINT_DISPOSITION_VARIABLE_get(); public static readonly string SWITCH_HOLD_MUSIC_VARIABLE = freeswitchPINVOKE.SWITCH_HOLD_MUSIC_VARIABLE_get(); public static readonly string SWITCH_EXPORT_VARS_VARIABLE = freeswitchPINVOKE.SWITCH_EXPORT_VARS_VARIABLE_get(); + public static readonly string SWITCH_BRIDGE_EXPORT_VARS_VARIABLE = freeswitchPINVOKE.SWITCH_BRIDGE_EXPORT_VARS_VARIABLE_get(); public static readonly string SWITCH_R_SDP_VARIABLE = freeswitchPINVOKE.SWITCH_R_SDP_VARIABLE_get(); public static readonly string SWITCH_L_SDP_VARIABLE = freeswitchPINVOKE.SWITCH_L_SDP_VARIABLE_get(); public static readonly string SWITCH_B_SDP_VARIABLE = freeswitchPINVOKE.SWITCH_B_SDP_VARIABLE_get(); @@ -5685,6 +5744,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE_get")] public static extern string SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE_get")] + public static extern string SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE_get")] public static extern string SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE_get(); @@ -5781,6 +5843,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_EXPORT_VARS_VARIABLE_get")] public static extern string SWITCH_EXPORT_VARS_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_BRIDGE_EXPORT_VARS_VARIABLE_get")] + public static extern string SWITCH_BRIDGE_EXPORT_VARS_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_R_SDP_VARIABLE_get")] public static extern string SWITCH_R_SDP_VARIABLE_get(); @@ -6438,6 +6503,36 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_console_callback_match")] public static extern void delete_switch_console_callback_match(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_dmachine_set")] + public static extern void switch_ivr_dmachine_match_dmachine_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_dmachine_get")] + public static extern IntPtr switch_ivr_dmachine_match_dmachine_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_match_digits_set")] + public static extern void switch_ivr_dmachine_match_match_digits_set(HandleRef jarg1, string jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_match_digits_get")] + public static extern string switch_ivr_dmachine_match_match_digits_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_match_key_set")] + public static extern void switch_ivr_dmachine_match_match_key_set(HandleRef jarg1, int jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_match_key_get")] + public static extern int switch_ivr_dmachine_match_match_key_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_user_data_set")] + public static extern void switch_ivr_dmachine_match_user_data_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_user_data_get")] + public static extern IntPtr switch_ivr_dmachine_match_user_data_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_ivr_dmachine_match")] + public static extern IntPtr new_switch_ivr_dmachine_match(); + + [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_ivr_dmachine_match")] + public static extern void delete_switch_ivr_dmachine_match(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_input_callback_set")] public static extern void switch_input_args_t_input_callback_set(HandleRef jarg1, HandleRef jarg2); @@ -6468,6 +6563,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_user_data_get")] public static extern IntPtr switch_input_args_t_user_data_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_dmachine_set")] + public static extern void switch_input_args_t_dmachine_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_dmachine_get")] + public static extern IntPtr switch_input_args_t_dmachine_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_input_args_t")] public static extern IntPtr new_switch_input_args_t(); @@ -7401,6 +7502,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_copy")] public static extern int switch_core_codec_copy(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_parse_fmtp")] + public static extern int switch_core_codec_parse_fmtp(string jarg1, string jarg2, uint jarg3, HandleRef jarg4); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_reset")] public static extern int switch_core_codec_reset(HandleRef jarg1); @@ -8253,6 +8357,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_is_digit_string")] public static extern int switch_is_digit_string(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_known_bitrate")] + public static extern uint switch_known_bitrate(byte jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_fd_read_line")] public static extern IntPtr switch_fd_read_line(int jarg1, string jarg2, HandleRef jarg3); @@ -10966,10 +11073,13 @@ class freeswitchPINVOKE { public static extern string switch_channel_get_variable_partner(HandleRef jarg1, string jarg2); [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_export_variable_var_check")] - public static extern int switch_channel_export_variable_var_check(HandleRef jarg1, string jarg2, string jarg3, int jarg4); + public static extern int switch_channel_export_variable_var_check(HandleRef jarg1, string jarg2, string jarg3, string jarg4, int jarg5); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_process_export")] + public static extern void switch_channel_process_export(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, string jarg4); [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_export_variable_printf")] - public static extern int switch_channel_export_variable_printf(HandleRef jarg1, string jarg2, string jarg3); + public static extern int switch_channel_export_variable_printf(HandleRef jarg1, string jarg2, string jarg3, string jarg4); [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_variable_dup")] public static extern string switch_channel_get_variable_dup(HandleRef jarg1, string jarg2, int jarg3); @@ -11931,6 +12041,33 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_uuid_exists")] public static extern int switch_ivr_uuid_exists(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_create")] + public static extern int switch_ivr_dmachine_create(HandleRef jarg1, HandleRef jarg2, uint jarg3, uint jarg4); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_destroy")] + public static extern void switch_ivr_dmachine_destroy(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_bind")] + public static extern int switch_ivr_dmachine_bind(HandleRef jarg1, string jarg2, int jarg3, HandleRef jarg4, HandleRef jarg5); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_feed")] + public static extern int switch_ivr_dmachine_feed(HandleRef jarg1, string jarg2, HandleRef jarg3); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_clear")] + public static extern int switch_ivr_dmachine_clear(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_ping")] + public static extern int switch_ivr_dmachine_ping(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_get_match")] + public static extern IntPtr switch_ivr_dmachine_get_match(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_set_digit_timeout_ms")] + public static extern void switch_ivr_dmachine_set_digit_timeout_ms(HandleRef jarg1, uint jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_set_input_timeout_ms")] + public static extern void switch_ivr_dmachine_set_input_timeout_ms(HandleRef jarg1, uint jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RTP_MAX_BUF_LEN_get")] public static extern int SWITCH_RTP_MAX_BUF_LEN_get(); @@ -15417,6 +15554,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t { private HandleRef swigCPtr; @@ -16767,6 +16934,66 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_p_switch_ivr_dmachine { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_ivr_dmachine(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_ivr_dmachine() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_dmachine obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + +public class SWIGTYPE_p_p_switch_ivr_dmachine_match { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_ivr_dmachine_match(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_ivr_dmachine_match() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_dmachine_match obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_p_switch_ivr_menu { private HandleRef swigCPtr; @@ -17607,6 +17834,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_switch_ivr_dmachine { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_ivr_dmachine(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_ivr_dmachine() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_switch_ivr_dmachine obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_switch_ivr_menu_action_function_t { private HandleRef swigCPtr; @@ -20848,6 +21105,7 @@ public enum switch_channel_flag_t { CF_EARLY_HANGUP, CF_MEDIA_SET, CF_CONSUME_ON_ORIGINATE, + CF_PASSTHRU_PTIME_MISMATCH, CF_FLAG_MAX } @@ -24949,6 +25207,17 @@ public class switch_input_args_t : IDisposable { } } + public SWIGTYPE_p_switch_ivr_dmachine dmachine { + set { + freeswitchPINVOKE.switch_input_args_t_dmachine_set(swigCPtr, SWIGTYPE_p_switch_ivr_dmachine.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_input_args_t_dmachine_get(swigCPtr); + SWIGTYPE_p_switch_ivr_dmachine ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_ivr_dmachine(cPtr, false); + return ret; + } + } + public switch_input_args_t() : this(freeswitchPINVOKE.new_switch_input_args_t(), true) { } @@ -26230,6 +26499,95 @@ public enum switch_ivr_action_t { namespace FreeSWITCH.Native { +using System; +using System.Runtime.InteropServices; + +public class switch_ivr_dmachine_match : IDisposable { + private HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal switch_ivr_dmachine_match(IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new HandleRef(this, cPtr); + } + + internal static HandleRef getCPtr(switch_ivr_dmachine_match obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } + + ~switch_ivr_dmachine_match() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_switch_ivr_dmachine_match(swigCPtr); + } + swigCPtr = new HandleRef(null, IntPtr.Zero); + GC.SuppressFinalize(this); + } + } + + public SWIGTYPE_p_switch_ivr_dmachine dmachine { + set { + freeswitchPINVOKE.switch_ivr_dmachine_match_dmachine_set(swigCPtr, SWIGTYPE_p_switch_ivr_dmachine.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_ivr_dmachine_match_dmachine_get(swigCPtr); + SWIGTYPE_p_switch_ivr_dmachine ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_ivr_dmachine(cPtr, false); + return ret; + } + } + + public string match_digits { + set { + freeswitchPINVOKE.switch_ivr_dmachine_match_match_digits_set(swigCPtr, value); + } + get { + string ret = freeswitchPINVOKE.switch_ivr_dmachine_match_match_digits_get(swigCPtr); + return ret; + } + } + + public int match_key { + set { + freeswitchPINVOKE.switch_ivr_dmachine_match_match_key_set(swigCPtr, value); + } + get { + int ret = freeswitchPINVOKE.switch_ivr_dmachine_match_match_key_get(swigCPtr); + return ret; + } + } + + public SWIGTYPE_p_void user_data { + set { + freeswitchPINVOKE.switch_ivr_dmachine_match_user_data_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_ivr_dmachine_match_user_data_get(swigCPtr); + SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false); + return ret; + } + } + + public switch_ivr_dmachine_match() : this(freeswitchPINVOKE.new_switch_ivr_dmachine_match(), true) { + } + +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + public enum switch_ivr_menu_flags { SWITCH_IVR_MENU_FLAG_FALLTOMAIN = (1 << 0), SWITCH_IVR_MENU_FLAG_FREEPOOL = (1 << 1), @@ -29186,6 +29544,7 @@ public enum switch_status_t { SWITCH_STATUS_NOUNLOAD, SWITCH_STATUS_IGNORE, SWITCH_STATUS_TOO_SMALL, + SWITCH_STATUS_FOUND, SWITCH_STATUS_NOT_INITALIZED } diff --git a/src/mod/languages/mod_perl/mod_perl_wrap.cpp b/src/mod/languages/mod_perl/mod_perl_wrap.cpp index 370c88bc99..2efbdf1abc 100644 --- a/src/mod/languages/mod_perl/mod_perl_wrap.cpp +++ b/src/mod/languages/mod_perl/mod_perl_wrap.cpp @@ -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); From 51cc00a5f9e943b759eb2f85358ddaa75a7256b0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 6 Oct 2010 11:07:41 -0500 Subject: [PATCH 13/46] doh --- src/mod/endpoints/mod_sofia/mod_sofia.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 4cb59704c1..5bc1b4e8a2 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -249,13 +249,10 @@ char *generate_pai_str(private_object_t *tech_pvt) const char *var, *header, *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent"); char *pai = NULL; - printf("WTF %s %d\n", tech_pvt->profile->name, sofia_test_pflag(tech_pvt->profile, PFLAG_PASS_CALLEE_ID)); - if (!sofia_test_pflag(tech_pvt->profile, PFLAG_PASS_CALLEE_ID) || !sofia_test_pflag(tech_pvt->profile, PFLAG_CID_IN_1XX) || ((var = switch_channel_get_variable(tech_pvt->channel, "sip_cid_in_1xx")) && switch_false(var))) { return NULL; } - printf("BOOL FUCKEDUP\n"); if (zstr((callee_name = switch_channel_get_variable(tech_pvt->channel, "effective_callee_id_name"))) && zstr((callee_name = switch_channel_get_variable(tech_pvt->channel, "sip_callee_id_name")))) { From fadcbd9268ed00ab444a3e2583d14ed193397dea Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 6 Oct 2010 13:41:59 -0500 Subject: [PATCH 14/46] watchdog_step_timeout watchdog_event_timeout (milliseconds) to detect a problem in sofia and shutdown instantly --- src/mod/endpoints/mod_sofia/mod_sofia.h | 4 +++ src/mod/endpoints/mod_sofia/sofia.c | 38 +++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index f0ebb55a46..ea62398f8a 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -562,6 +562,10 @@ struct sofia_profile { char *contact_user; char *local_network; uint32_t trans_timeout; + switch_time_t last_sip_event; + switch_time_t last_root_step; + uint32_t step_timeout; + uint32_t event_timeout; }; struct private_object { diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 38e62de4f8..aa4c5175b3 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -731,6 +731,7 @@ void sofia_event_callback(nua_event_t event, int locked = 0; int check_destroy = 1; + profile->last_sip_event = switch_time_now(); /* sofia_private will be == &mod_sofia_globals.keep_private whenever a request is done with a new handle that has to be freed whenever the request is done */ @@ -1309,6 +1310,33 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread } if (++loops >= 1000) { + uint32_t diff = 0, fail = 0; + + if (profile->step_timeout) { + diff = (uint32_t) ((switch_time_now() - profile->last_root_step) / 1000); + if (diff > profile->step_timeout) { + fail = 1; + } + } + + if (profile->event_timeout) { + diff = (uint32_t) ((switch_time_now() - profile->last_sip_event) / 1000); + if (diff > profile->event_timeout) { + fail = 1; + } + } + + if (fail) { + int arg = 1; + switch_session_ctl_t command = SCSC_SHUTDOWN_NOW; + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Profile %s: SIP STACK FAILURE DETECTED!\n" + "GOODBYE CRUEL WORLD, I'M LEAVING YOU TODAY....GOODBYE, GOODBYE, GOOD BYE\n", profile->name); + switch_yield(2000); + switch_core_session_ctl(command, &arg); + } + + if (++ireg_loops >= IREG_SECONDS) { time_t now = switch_epoch_time_now(NULL); sofia_reg_check_expire(profile, now, 0); @@ -1548,6 +1576,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void while (mod_sofia_globals.running == 1 && sofia_test_pflag(profile, PFLAG_RUNNING) && sofia_test_pflag(profile, PFLAG_WORKER_RUNNING)) { su_root_step(profile->s_root, 1000); + profile->last_root_step = switch_time_now(); } sofia_clear_pflag_locked(profile, PFLAG_RUNNING); @@ -2298,6 +2327,10 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) } else { sofia_clear_pflag(profile, PFLAG_DEL_SUBS_ON_REG); } + } else if (!strcasecmp(var, "watchdog_step_timeout")) { + profile->step_timeout = (unsigned long) atol(val); + } else if (!strcasecmp(var, "watchdog_event_timeout")) { + profile->event_timeout = (unsigned long) atol(val); } else if (!strcasecmp(var, "in-dialog-chat")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_IN_DIALOG_CHAT); @@ -2978,6 +3011,11 @@ switch_status_t config_sofia(int reload, char *profile_name) } else { sofia_clear_pflag(profile, PFLAG_LOG_AUTH_FAIL); } + } else if (!strcasecmp(var, "watchdog_step_timeout")) { + profile->step_timeout = atoi(val); + } else if (!strcasecmp(var, "watchdog_event_timeout")) { + profile->event_timeout = atoi(val); + } else if (!strcasecmp(var, "in-dialog-chat")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_IN_DIALOG_CHAT); From 3bb90ac41c5a6d0cf446cb43afc6b78a077ee036 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 6 Oct 2010 15:16:09 -0500 Subject: [PATCH 15/46] fix some edge cases --- .../applications/mod_conference/mod_conference.c | 15 ++++++++++++--- src/switch_core_codec.c | 4 +++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index e1570a7af5..ed62da107b 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -2580,7 +2580,10 @@ static void conference_loop_output(conference_member_t *member) if (member->fnode) { member_add_file_data(member, write_frame.data, write_frame.datalen); } - switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0); + if (switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + break; + } } } @@ -2590,7 +2593,10 @@ static void conference_loop_output(conference_member_t *member) write_frame.samples = samples; memset(write_frame.data, 255, write_frame.datalen); member_add_file_data(member, write_frame.data, write_frame.datalen); - switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0); + if (switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + break; + } } else if (!switch_test_flag(member->conference, CFLAG_WASTE_BANDWIDTH)) { if (switch_test_flag(member, MFLAG_WASTE_BANDWIDTH)) { if (member->conference->comfort_noise_level) { @@ -2603,7 +2609,10 @@ static void conference_loop_output(conference_member_t *member) write_frame.samples = samples; write_frame.timestamp = timer.samplecount; - switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0); + if (switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + break; + } } } diff --git a/src/switch_core_codec.c b/src/switch_core_codec.c index d45d73ed76..9b607ea873 100644 --- a/src/switch_core_codec.c +++ b/src/switch_core_codec.c @@ -137,9 +137,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(switch_core_s memset(&session->read_impl, 0, sizeof(session->read_impl)); } old->next = NULL; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Restore previous codec %s:%d.\n", switch_channel_get_name(session->channel), - session->read_codec->implementation->iananame, session->read_codec->implementation->ianacode); + session->read_impl.iananame ? session->read_impl.iananame : "N/A", session->read_impl.ianacode); + } else if (session->real_read_codec) { session->read_codec = session->real_read_codec; From 8f13eb89666585cc05eae62c788629c33db9f251 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 6 Oct 2010 15:17:48 -0500 Subject: [PATCH 16/46] FS-2762 --- conf/sip_profiles/internal.xml | 20 ++++++++++++ src/mod/endpoints/mod_sofia/mod_sofia.c | 41 +++++++++++++++++++----- src/mod/endpoints/mod_sofia/mod_sofia.h | 2 ++ src/mod/endpoints/mod_sofia/sofia.c | 14 +++++--- src/mod/endpoints/mod_sofia/sofia_glue.c | 20 ++++++++++++ 5 files changed, 84 insertions(+), 13 deletions(-) diff --git a/conf/sip_profiles/internal.xml b/conf/sip_profiles/internal.xml index 50833bfbec..93558a3584 100644 --- a/conf/sip_profiles/internal.xml +++ b/conf/sip_profiles/internal.xml @@ -42,6 +42,26 @@ + + + + + + diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 5bc1b4e8a2..323702e3c5 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3174,6 +3174,17 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t goto done; } + if (!strcasecmp(argv[1], "watchdog")) { + if (argc > 2) { + int value = switch_true(argv[2]); + profile->watchdog_enabled = value; + stream->write_function(stream, "%s sip debugging on %s", value ? "Enabled" : "Disabled", profile->name); + } else { + stream->write_function(stream, "Usage: sofia profile watchdog \n"); + } + goto done; + } + if (!strcasecmp(argv[1], "gwlist")) { int up = 1; @@ -3510,12 +3521,14 @@ SWITCH_STANDARD_API(sofia_function) "[register|unregister] [|all]|" "killgw |" "[stun-auto-disable|stun-enabled] [true|false]]|" - "siptrace [on|off]\n" + "siptrace |" + "watchdog \n" "sofia status|xmlstatus profile [ reg ] | [ pres ] | [ user ]\n" "sofia status|xmlstatus gateway \n" "sofia loglevel [0-9]\n" "sofia tracelevel \n" - "sofa global siptrace [on|off]\n" + "sofia global siptrace |" + "watchdog \n" "--------------------------------------------------------------------------------\n"; if (session) { @@ -3572,21 +3585,30 @@ SWITCH_STANDARD_API(sofia_function) stream->write_function(stream, "%s", usage_string); goto done; } else if (!strcasecmp(argv[0], "global")) { - int on = -1; + int ston = -1; + int wdon = -1; if (argc > 1) { if (!strcasecmp(argv[1], "siptrace")) { if (argc > 2) { - on = switch_true(argv[2]); + ston = switch_true(argv[2]); + } + } + if (!strcasecmp(argv[1], "watchdog")) { + if (argc > 2) { + wdon = switch_true(argv[2]); } } } - if (on != -1) { - sofia_glue_global_siptrace(on); - stream->write_function(stream, "+OK Global siptrace %s", on ? "on" : "off"); + if (ston != -1) { + sofia_glue_global_siptrace(ston); + stream->write_function(stream, "+OK Global siptrace %s", ston ? "on" : "off"); + } else if (wdon != -1) { + sofia_glue_global_watchdog(wdon); + stream->write_function(stream, "+OK Global watchdog %s", wdon ? "on" : "off"); } else { - stream->write_function(stream, "-ERR Usage: siptrace on|off"); + stream->write_function(stream, "-ERR Usage: siptrace |watchdog "); } goto done; @@ -4668,6 +4690,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) switch_console_set_complete("add sofia tracelevel ::[console:alert:crit:err:warning:notice:info:debug"); switch_console_set_complete("add sofia global siptrace ::[on:off"); + switch_console_set_complete("add sofia global watchdog ::[on:off"); switch_console_set_complete("add sofia profile"); switch_console_set_complete("add sofia profile restart all"); @@ -4683,6 +4706,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) switch_console_set_complete("add sofia profile ::sofia::list_profiles killgw ::sofia::list_profile_gateway"); switch_console_set_complete("add sofia profile ::sofia::list_profiles siptrace on"); switch_console_set_complete("add sofia profile ::sofia::list_profiles siptrace off"); + switch_console_set_complete("add sofia profile ::sofia::list_profiles watchdog on"); + switch_console_set_complete("add sofia profile ::sofia::list_profiles watchdog off"); switch_console_set_complete("add sofia profile ::sofia::list_profiles gwlist up"); switch_console_set_complete("add sofia profile ::sofia::list_profiles gwlist down"); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index ea62398f8a..cf4b9a3759 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -566,6 +566,7 @@ struct sofia_profile { switch_time_t last_root_step; uint32_t step_timeout; uint32_t event_timeout; + int watchdog_enabled; }; struct private_object { @@ -1020,6 +1021,7 @@ void sofia_glue_tech_simplify(private_object_t *tech_pvt); switch_console_callback_match_t *sofia_reg_find_reg_url_multi(sofia_profile_t *profile, const char *user, const char *host); switch_bool_t sofia_glue_profile_exists(const char *key); void sofia_glue_global_siptrace(switch_bool_t on); +void sofia_glue_global_watchdog(switch_bool_t on); void sofia_glue_proxy_codec(switch_core_session_t *session, const char *r_sdp); switch_status_t sofia_glue_sdp_map(const char *r_sdp, switch_event_t **fmtp, switch_event_t **pt); void sofia_glue_build_vid_refresh_message(switch_core_session_t *session, const char *pl); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index aa4c5175b3..0598624c63 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1326,7 +1326,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread } } - if (fail) { + if (profile->watchdog_enabled && fail) { int arg = 1; switch_session_ctl_t command = SCSC_SHUTDOWN_NOW; @@ -2327,9 +2327,11 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) } else { sofia_clear_pflag(profile, PFLAG_DEL_SUBS_ON_REG); } - } else if (!strcasecmp(var, "watchdog_step_timeout")) { + } else if (!strcasecmp(var, "watchdog-enabled")) { + profile->watchdog_enabled = switch_true(val); + } else if (!strcasecmp(var, "watchdog-step-timeout")) { profile->step_timeout = (unsigned long) atol(val); - } else if (!strcasecmp(var, "watchdog_event_timeout")) { + } else if (!strcasecmp(var, "watchdog-event-timeout")) { profile->event_timeout = (unsigned long) atol(val); } else if (!strcasecmp(var, "in-dialog-chat")) { if (switch_true(val)) { @@ -3011,9 +3013,11 @@ switch_status_t config_sofia(int reload, char *profile_name) } else { sofia_clear_pflag(profile, PFLAG_LOG_AUTH_FAIL); } - } else if (!strcasecmp(var, "watchdog_step_timeout")) { + } else if (!strcasecmp(var, "watchdog-enabled")) { + profile->watchdog_enabled = switch_true(val); + } else if (!strcasecmp(var, "watchdog-step-timeout")) { profile->step_timeout = atoi(val); - } else if (!strcasecmp(var, "watchdog_event_timeout")) { + } else if (!strcasecmp(var, "watchdog-event-timeout")) { profile->event_timeout = atoi(val); } else if (!strcasecmp(var, "in-dialog-chat")) { diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 9d6cff78e7..7464a42825 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -4752,6 +4752,26 @@ void sofia_glue_global_siptrace(switch_bool_t on) } +void sofia_glue_global_watchdog(switch_bool_t on) +{ + switch_hash_index_t *hi; + const void *var; + void *val; + sofia_profile_t *pptr; + + switch_mutex_lock(mod_sofia_globals.hash_mutex); + if (mod_sofia_globals.profile_hash) { + for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) { + switch_hash_this(hi, &var, NULL, &val); + if ((pptr = (sofia_profile_t *) val)) { + pptr->watchdog_enabled = (on ? 1 : 0); + } + } + } + switch_mutex_unlock(mod_sofia_globals.hash_mutex); + +} + void sofia_glue_del_profile(sofia_profile_t *profile) { sofia_gateway_t *gp; From dc4d19e9f6507cbcc39c1a517b54ed1fae9cfa3e Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Wed, 6 Oct 2010 12:36:40 -0400 Subject: [PATCH 17/46] mod_sangoma_codec: do not return 0 len frames and return silence instead when there is no transcoding output update stats only when we really receive a frame --- .../mod_sangoma_codec/mod_sangoma_codec.c | 83 +++++++++++-------- 1 file changed, 49 insertions(+), 34 deletions(-) diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index 4e3339bea2..c84dac4509 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -447,25 +447,31 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec *encoded_data_len = encoded_frame.datalen; } - /* update encoding stats */ - sess->encoder.rx++; - - now_time = switch_micro_time_now(); - if (!sess->encoder.last_rx_time) { - sess->encoder.last_rx_time = now_time; - } else { - difftime = now_time - sess->encoder.last_rx_time; - sess->encoder.avgrxus = sess->encoder.avgrxus ? ((sess->encoder.avgrxus + difftime)/2) : difftime; - sess->encoder.last_rx_time = now_time; - } - - /* check sequence and bump lost rx packets count if needed */ - if (sess->encoder.lastrxseqno >= 0) { - if (encoded_frame.seq > (sess->encoder.lastrxseqno + 2) ) { - sess->encoder.rxlost += encoded_frame.seq - sess->encoder.lastrxseqno - 1; + /* update encoding stats if we received a frame */ + if (*encoded_data_len) { + if (*encoded_data_len != codec->implementation->encoded_bytes_per_packet) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Returning odd encoded frame of %d bytes intead of %d bytes\n", *encoded_data_len, codec->implementation->encoded_bytes_per_packet); } + sess->encoder.rx++; + now_time = switch_micro_time_now(); + if (!sess->encoder.last_rx_time) { + sess->encoder.last_rx_time = now_time; + } else { + difftime = now_time - sess->encoder.last_rx_time; + sess->encoder.avgrxus = sess->encoder.avgrxus ? ((sess->encoder.avgrxus + difftime)/2) : difftime; + sess->encoder.last_rx_time = now_time; + } + + /* check sequence and bump lost rx packets count if needed */ + if (sess->encoder.lastrxseqno >= 0) { + if (encoded_frame.seq > (sess->encoder.lastrxseqno + 2) ) { + sess->encoder.rxlost += encoded_frame.seq - sess->encoder.lastrxseqno - 1; + } + } + sess->encoder.lastrxseqno = encoded_frame.seq; + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No output from sangoma encoder\n"); } - sess->encoder.lastrxseqno = encoded_frame.seq; return SWITCH_STATUS_SUCCESS; } @@ -570,25 +576,34 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses *decoded_data_len = i * 2; } - /* update decoding stats */ - sess->decoder.rx++; - - now_time = switch_micro_time_now(); - if (!sess->decoder.last_rx_time) { - sess->decoder.last_rx_time = now_time; - } else { - difftime = now_time - sess->decoder.last_rx_time; - sess->decoder.avgrxus = sess->decoder.avgrxus ? ((sess->decoder.avgrxus + difftime)/2) : difftime; - sess->decoder.last_rx_time = now_time; - } - - /* check sequence and bump lost rx packets count if needed */ - if (sess->decoder.lastrxseqno >= 0) { - if (ulaw_frame.seq > (sess->decoder.lastrxseqno + 2) ) { - sess->decoder.rxlost += ulaw_frame.seq - sess->decoder.lastrxseqno - 1; + if (*decoded_data_len) { + if (*decoded_data_len != codec->implementation->decoded_bytes_per_packet) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Returning odd decoded frame of %d bytes intead of %d bytes\n", *decoded_data_len, codec->implementation->decoded_bytes_per_packet); } + /* update decoding stats */ + sess->decoder.rx++; + + now_time = switch_micro_time_now(); + if (!sess->decoder.last_rx_time) { + sess->decoder.last_rx_time = now_time; + } else { + difftime = now_time - sess->decoder.last_rx_time; + sess->decoder.avgrxus = sess->decoder.avgrxus ? ((sess->decoder.avgrxus + difftime)/2) : difftime; + sess->decoder.last_rx_time = now_time; + } + + /* check sequence and bump lost rx packets count if needed */ + if (sess->decoder.lastrxseqno >= 0) { + if (ulaw_frame.seq > (sess->decoder.lastrxseqno + 2) ) { + sess->decoder.rxlost += ulaw_frame.seq - sess->decoder.lastrxseqno - 1; + } + } + sess->decoder.lastrxseqno = ulaw_frame.seq; + } else { + *decoded_data_len = codec->implementation->decoded_bytes_per_packet; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No output from sangoma decoder, returning silent frame of %d bytes\n", *decoded_data_len); + memset(dbuf_linear, 0, *decoded_data_len); } - sess->decoder.lastrxseqno = ulaw_frame.seq; return SWITCH_STATUS_SUCCESS; } From 6c4cb07bac6dd8ecb18759bf71fd911752bc1e08 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 6 Oct 2010 16:04:42 -0500 Subject: [PATCH 18/46] fix memory leak caused by regression from FS-2747 --- src/mod/endpoints/mod_sofia/sofia_presence.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 3a01e1e003..b47fbd8bd3 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -742,8 +742,8 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) } sofia_glue_execute_sql_callback(profile, NULL, sql, sofia_presence_sub_callback, &helper); - - + switch_safe_free(sql); + sql = switch_mprintf("update sip_subscriptions set version=version+1 where event='dialog' and sub_to_user='%q' " "and (sub_to_host='%q' or presence_hosts like '%%%q%%') " "and (profile_name = '%q' or presence_hosts != sub_to_host)", @@ -757,8 +757,6 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) event->event_id == SWITCH_EVENT_PRESENCE_IN ? "IN" : "OUT", profile->name); } - switch_safe_free(sql); - if (!zstr((char *) helper.stream.data)) { char *this_sql = (char *) helper.stream.data; char *next = NULL; From 430fb980507cf47cc9f1f97a00f1a7c284801dba Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 6 Oct 2010 16:05:00 -0500 Subject: [PATCH 19/46] update watchdog code --- src/mod/endpoints/mod_sofia/sofia.c | 53 ++++++++++++++++------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 0598624c63..4007187e26 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1310,33 +1310,40 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread } if (++loops >= 1000) { - uint32_t diff = 0, fail = 0; + - if (profile->step_timeout) { - diff = (uint32_t) ((switch_time_now() - profile->last_root_step) / 1000); - if (diff > profile->step_timeout) { - fail = 1; + + if (profile->watchdog_enabled) { + uint32_t event_diff = 0, step_diff = 0, event_fail = 0, step_fail = 0; + + if (profile->step_timeout) { + step_diff = (uint32_t) ((switch_time_now() - profile->last_root_step) / 1000); + + if (step_diff > profile->step_timeout) { + step_fail = 1; + } + } + + if (profile->event_timeout) { + event_diff = (uint32_t) ((switch_time_now() - profile->last_sip_event) / 1000); + + if (event_diff > profile->event_timeout) { + event_fail = 1; + } + } + + if (step_fail && profile->event_timeout && !event_fail) { + step_fail = 0; + } + + if (event_fail || step_fail) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Profile %s: SIP STACK FAILURE DETECTED!\n" + "GOODBYE CRUEL WORLD, I'M LEAVING YOU TODAY....GOODBYE, GOODBYE, GOOD BYE\n", profile->name); + switch_yield(2000); + abort(); } } - if (profile->event_timeout) { - diff = (uint32_t) ((switch_time_now() - profile->last_sip_event) / 1000); - if (diff > profile->event_timeout) { - fail = 1; - } - } - - if (profile->watchdog_enabled && fail) { - int arg = 1; - switch_session_ctl_t command = SCSC_SHUTDOWN_NOW; - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Profile %s: SIP STACK FAILURE DETECTED!\n" - "GOODBYE CRUEL WORLD, I'M LEAVING YOU TODAY....GOODBYE, GOODBYE, GOOD BYE\n", profile->name); - switch_yield(2000); - switch_core_session_ctl(command, &arg); - } - - if (++ireg_loops >= IREG_SECONDS) { time_t now = switch_epoch_time_now(NULL); sofia_reg_check_expire(profile, now, 0); From 3bd09b34c512ee2338dfbd277123a60cc9e16ec1 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Thu, 7 Oct 2010 01:07:12 -0400 Subject: [PATCH 20/46] mod_voicemail: Simple correction to the app description of voicemail --- src/mod/applications/mod_voicemail/mod_voicemail.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 860f89788b..e55cd8a2f4 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -3213,7 +3213,7 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p #define VM_DESC "voicemail" -#define VM_USAGE "[check|auth] []" +#define VM_USAGE "[check] [auth] []" SWITCH_STANDARD_APP(voicemail_function) { From 761cec8fb1e40ff816bcfb8acd044d0018c70ef6 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Thu, 7 Oct 2010 08:25:41 -0500 Subject: [PATCH 21/46] FS-2766 spandsp t38 fax receiving error in win XP - regression from f029f7ef --- libs/spandsp/src/spandsp/t38_core.h | 2 +- libs/spandsp/src/t38_core.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/spandsp/src/spandsp/t38_core.h b/libs/spandsp/src/spandsp/t38_core.h index 1476969eeb..3d8e864513 100644 --- a/libs/spandsp/src/spandsp/t38_core.h +++ b/libs/spandsp/src/spandsp/t38_core.h @@ -286,7 +286,7 @@ SPAN_DECLARE(int) t38_core_send_data_multi_field(t38_core_state_t *s, int data_t \param len The length of the packet contents. \param seq_no The packet sequence number. \return 0 for OK, else -1. */ -SPAN_DECLARE(int) t38_core_rx_ifp_packet(t38_core_state_t *s, const uint8_t *buf, int len, uint16_t seq_no); +SPAN_DECLARE_NONSTD(int) t38_core_rx_ifp_packet(t38_core_state_t *s, const uint8_t *buf, int len, uint16_t seq_no); /*! Set the method to be used for data rate management, as per the T.38 spec. \param s The T.38 context. diff --git a/libs/spandsp/src/t38_core.c b/libs/spandsp/src/t38_core.c index 551d6c0155..e7ee967e93 100644 --- a/libs/spandsp/src/t38_core.c +++ b/libs/spandsp/src/t38_core.c @@ -325,7 +325,7 @@ static __inline__ int classify_seq_no_offset(int expected, int actual) } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) t38_core_rx_ifp_packet(t38_core_state_t *s, const uint8_t *buf, int len, uint16_t seq_no) +SPAN_DECLARE_NONSTD(int) t38_core_rx_ifp_packet(t38_core_state_t *s, const uint8_t *buf, int len, uint16_t seq_no) { int i; int t30_indicator; From f499c0cdd7af66b9166eaa16cb190122f19d57b2 Mon Sep 17 00:00:00 2001 From: Brian West Date: Thu, 7 Oct 2010 10:27:25 -0500 Subject: [PATCH 22/46] send em on over now. --- src/tone2wav.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tone2wav.c b/src/tone2wav.c index 4415860802..8d4978a57c 100644 --- a/src/tone2wav.c +++ b/src/tone2wav.c @@ -171,7 +171,7 @@ int main(int argc, char *argv[]) teletone_destroy_session(&ts); switch_core_file_close(&fh); - printf("File: %s generated.....\n\nPlease support:\nFreeSWITCH http://www.freeswitch.org\nClueCon http://www.cluecon.com\n", file); + printf("File: %s generated...\n\nPlease support:\nFreeSWITCH http://www.freeswitch.org\nClueCon http://www.cluecon.com\n", file); end: From 53be013a5d2539918829938770486d76b48e8443 Mon Sep 17 00:00:00 2001 From: Mathieu Parent Date: Thu, 7 Oct 2010 21:24:37 +0200 Subject: [PATCH 23/46] Skinny: Correct OffHook softkeys --- conf/skinny_profiles/internal.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/skinny_profiles/internal.xml b/conf/skinny_profiles/internal.xml index 5feac1ffbf..52da89741d 100644 --- a/conf/skinny_profiles/internal.xml +++ b/conf/skinny_profiles/internal.xml @@ -16,7 +16,7 @@ - + From 3cead32f1305660731127091dfcba692cf87637f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 7 Oct 2010 15:51:56 -0500 Subject: [PATCH 24/46] presence again --- src/mod/endpoints/mod_sofia/sofia_presence.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index b47fbd8bd3..55b0c5c5ca 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -571,22 +571,22 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) switch_safe_free(sql); - sql = switch_mprintf("select sip_registrations.sip_user, sip_registrations.orig_hostname, sip_registrations.status, " + sql = switch_mprintf("select sip_registrations.sip_user, sip_registrations.sip_host, sip_registrations.status, " "sip_registrations.rpid,'', sip_dialogs.uuid, sip_dialogs.state, sip_dialogs.direction, " "sip_dialogs.sip_to_user, sip_dialogs.sip_to_host, sip_presence.status,sip_presence.rpid,sip_presence.open_closed," "'%q','%q' " "from sip_registrations left join sip_dialogs on " "(sip_dialogs.sip_from_user = sip_registrations.sip_user " - "and (sip_dialogs.sip_from_host = sip_registrations.orig_hostname or " + "and (sip_dialogs.sip_from_host = sip_registrations.orig_server_host or " "sip_dialogs.sip_from_host = sip_registrations.sip_host) ) " "left join sip_presence on " - "(sip_registrations.sip_user=sip_presence.sip_user and sip_registrations.orig_hostname=sip_presence.sip_host and " + "(sip_registrations.sip_user=sip_presence.sip_user and sip_registrations.orig_server_host=sip_presence.sip_host and " "sip_registrations.profile_name=sip_presence.profile_name) " "where sip_registrations.sip_user='%q' and " - "(sip_registrations.orig_hostname='%q' or sip_registrations.sip_host='%q' " + "(sip_registrations.orig_server_host='%q' or sip_registrations.sip_host='%q' " "or sip_registrations.presence_hosts like '%%%q%%')", dh.status, dh.rpid, probe_euser, probe_host, probe_host, probe_host); switch_assert(sql); From 82f268cce628c205573ae6a77a477c9d961d7844 Mon Sep 17 00:00:00 2001 From: Michal Bielicki Date: Thu, 7 Oct 2010 23:35:00 +0200 Subject: [PATCH 25/46] celt is now 0.7.1 so bumped it up in spec file --- freeswitch.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freeswitch.spec b/freeswitch.spec index 52e6226830..c4bfa8431b 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -54,7 +54,7 @@ Vendor: http://www.freeswitch.org/ # ###################################################################################################################### Source0: http://files.freeswitch.org/%{name}-%{version}.tar.bz2 -Source1: http://files.freeswitch.org/downloads/libs/celt-0.7.0.tar.gz +Source1: http://files.freeswitch.org/downloads/libs/celt-0.7.1.tar.gz Source2: http://files.freeswitch.org/downloads/libs/flite-1.3.99-latest.tar.gz Source3: http://files.freeswitch.org/downloads/libs/lame-3.97.tar.gz Source4: http://files.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz From 9537197b4df5011fdf5c31638b8eba041f903b77 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 7 Oct 2010 18:30:07 -0500 Subject: [PATCH 26/46] add some goodies --- src/include/private/switch_core_pvt.h | 1 + src/include/switch_core.h | 3 +- src/include/switch_ivr.h | 1 + src/include/switch_types.h | 1 + .../applications/mod_dptools/mod_dptools.c | 122 ++++++++++++++++++ src/mod/endpoints/mod_sofia/sofia.c | 2 +- src/switch_core_io.c | 16 ++- src/switch_core_session.c | 14 ++ src/switch_ivr_async.c | 24 ++-- src/switch_ivr_bridge.c | 31 +++++ 10 files changed, 200 insertions(+), 15 deletions(-) diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index e77d5f74ef..6a9bdc35a0 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -167,6 +167,7 @@ struct switch_core_session { uint32_t track_id; switch_log_level_t loglevel; uint32_t soft_lock; + switch_ivr_dmachine_t *dmachine; }; struct switch_media_bug { diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 466dc51186..04991ed186 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -704,7 +704,8 @@ SWITCH_DECLARE(switch_log_level_t) switch_core_session_get_loglevel(switch_core_ SWITCH_DECLARE(void) switch_core_session_soft_lock(switch_core_session_t *session, uint32_t sec); SWITCH_DECLARE(void) switch_core_session_soft_unlock(switch_core_session_t *session); - +SWITCH_DECLARE(void) switch_core_session_set_dmachine(switch_core_session_t *session, switch_ivr_dmachine_t *dmachine); +SWITCH_DECLARE(switch_ivr_dmachine_t *) switch_core_session_get_dmachine(switch_core_session_t *session); /*! \brief Retrieve the unique identifier from the core diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index ac9d8f9c1b..1fed73ca67 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -557,6 +557,7 @@ SWITCH_DECLARE(uint32_t) switch_ivr_schedule_broadcast(time_t runtime, const cha \return SWITCH_STATUS_SUCCESS if all is well */ SWITCH_DECLARE(switch_status_t) switch_ivr_broadcast(const char *uuid, const char *path, switch_media_flag_t flags); +SWITCH_DECLARE(void) switch_ivr_broadcast_in_thread(switch_core_session_t *session, const char *app, int flags); /*! \brief Transfer variables from one session to another diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 5aecca7498..d67d972e92 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1057,6 +1057,7 @@ typedef enum { CF_MEDIA_SET, CF_CONSUME_ON_ORIGINATE, CF_PASSTHRU_PTIME_MISMATCH, + CF_BRIDGE_NOWRITE, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ CF_FLAG_MAX } switch_channel_flag_t; diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 9fb6b1b454..675cde4884 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -95,6 +95,120 @@ SWITCH_STANDARD_DIALPLAN(inline_dialplan_hunt) return extension; } +struct action_binding { + char *input; + char *string; + char *value; + switch_core_session_t *session; +}; + +static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match) +{ + struct action_binding *act = (struct action_binding *) match->user_data; + switch_event_t *event; + switch_status_t status; + int exec = 0; + char *string = act->string; + switch_channel_t *channel = switch_core_session_get_channel(act->session); + + if (switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(act->session), SWITCH_LOG_DEBUG, "%s Digit match binding [%s][%s]\n", + switch_channel_get_name(channel), act->string, act->value); + + if (!strncasecmp(string, "exec:", 5)) { + string += 5; + exec = 1; + } + + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, string, act->value); + + if (exec) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute", exec == 2 ? "non-blocking" : "blocking"); + } + + if ((status = switch_core_session_queue_event(act->session, &event)) != SWITCH_STATUS_SUCCESS) { + switch_event_destroy(&event); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(act->session), SWITCH_LOG_WARNING, "%s event queue faiure.\n", + switch_core_session_get_name(act->session)); + } + } + + if (exec) { + char *cmd = switch_core_session_sprintf(act->session, "%s::%s", string, act->value); + switch_ivr_broadcast_in_thread(act->session, cmd, SMF_ECHO_ALEG|SMF_HOLD_BLEG); + } + + return SWITCH_STATUS_SUCCESS; +} + +#define CLEAR_DIGIT_ACTION_USAGE "" +SWITCH_STANDARD_APP(clear_digit_action_function) +{ + //switch_channel_t *channel = switch_core_session_get_channel(session); + switch_ivr_dmachine_t *dmachine; + + if ((dmachine = switch_core_session_get_dmachine(session))) { + switch_core_session_set_dmachine(session, NULL); + switch_ivr_dmachine_destroy(&dmachine); + } +} + +#define BIND_DIGIT_ACTION_USAGE ",," +SWITCH_STANDARD_APP(bind_digit_action_function) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_ivr_dmachine_t *dmachine; + char *mydata; + int argc = 0; + char *argv[3] = { 0 }; + struct action_binding *act; + + if (zstr(data)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Syntax Error, USAGE %s\n", BIND_DIGIT_ACTION_USAGE); + return; + } + + if (!(dmachine = switch_core_session_get_dmachine(session))) { + uint32_t digit_timeout = 1500; + uint32_t input_timeout = 0; + const char *var; + uint32_t tmp; + + if ((var = switch_channel_get_variable(channel, "bind_digit_digit_timeout"))) { + tmp = (uint32_t) atol(var); + if (tmp < 0) tmp = 0; + digit_timeout = tmp; + } + + if ((var = switch_channel_get_variable(channel, "bind_digit_input_timeout"))) { + tmp = (uint32_t) atol(var); + if (tmp < 0) tmp = 0; + input_timeout = tmp; + } + + switch_ivr_dmachine_create(&dmachine, NULL, digit_timeout, input_timeout); + switch_core_session_set_dmachine(session, dmachine); + } + + mydata = switch_core_session_strdup(session, data); + + argc = switch_separate_string(mydata, ',', argv, (sizeof(argv) / sizeof(argv[0]))); + + if (argc < 3 || zstr(argv[0]) || zstr(argv[1]) || zstr(argv[2])) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Syntax Error, USAGE %s\n", BIND_DIGIT_ACTION_USAGE); + return; + } + + act = switch_core_session_alloc(session, sizeof(*act)); + act->input = argv[0]; + act->string = argv[1]; + act->value = argv[2]; + act->session = session; + + switch_ivr_dmachine_bind(dmachine, act->input, 0, digit_action_callback, act); +} + + #define DETECT_SPEECH_SYNTAX " [] OR grammar [] OR pause OR resume" SWITCH_STANDARD_APP(detect_speech_function) { @@ -3277,6 +3391,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) SWITCH_ADD_API(api_interface, "chat", "chat", chat_api_function, "||||[]"); SWITCH_ADD_API(api_interface, "strftime", "strftime", strftime_api_function, ""); SWITCH_ADD_API(api_interface, "presence", "presence", presence_api_function, PRESENCE_USAGE); + + SWITCH_ADD_APP(app_interface, "bind_digit_action", "bind a key sequence or regex to an action", + "bind a key sequence or regex to an action", bind_digit_action_function, BIND_DIGIT_ACTION_USAGE, SAF_SUPPORT_NOMEDIA); + + SWITCH_ADD_APP(app_interface, "clear_digit_action", "clear all digit bindings", "", + clear_digit_action_function, CLEAR_DIGIT_ACTION_USAGE, SAF_SUPPORT_NOMEDIA); + + SWITCH_ADD_APP(app_interface, "privacy", "Set privacy on calls", "Set caller privacy on calls.", privacy_function, "off|on|name|full|number", SAF_SUPPORT_NOMEDIA); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 4007187e26..0d69bdb4bb 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -5077,7 +5077,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, } if (channel) { - if (sofia_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) { + if (sofia_test_flag(tech_pvt, TFLAG_EARLY_MEDIA) && !sofia_test_flag(tech_pvt, TFLAG_ANS)) { sofia_set_flag_locked(tech_pvt, TFLAG_ANS); sofia_set_flag(tech_pvt, TFLAG_SDP); switch_channel_mark_answered(channel); diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 4ca8b2d8cb..15b8f417d4 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -126,7 +126,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi switch_mutex_lock(session->read_codec->mutex); top: - + + if (session->dmachine && !switch_channel_test_flag(session->channel, CF_BROADCAST)) { + switch_ivr_dmachine_ping(session->dmachine, NULL); + } + if (switch_channel_down(session->channel) || !switch_core_codec_ready(session->read_codec)) { *frame = NULL; status = SWITCH_STATUS_FALSE; @@ -1150,6 +1154,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_recv_dtmf(switch_core_sessio switch_io_event_hook_recv_dtmf_t *ptr; switch_status_t status; switch_dtmf_t new_dtmf; + int fed = 0; if (switch_channel_down(session->channel)) { return SWITCH_STATUS_FALSE; @@ -1171,12 +1176,19 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_recv_dtmf(switch_core_sessio new_dtmf.duration = switch_core_default_dtmf_duration(0); } + if (session->dmachine && !switch_channel_test_flag(session->channel, CF_BROADCAST)) { + char str[2] = { dtmf->digit, '\0' }; + switch_ivr_dmachine_feed(session->dmachine, str, NULL); + fed = 1; + } + for (ptr = session->event_hooks.recv_dtmf; ptr; ptr = ptr->next) { if ((status = ptr->recv_dtmf(session, &new_dtmf, SWITCH_DTMF_RECV)) != SWITCH_STATUS_SUCCESS) { return status; } } - return SWITCH_STATUS_SUCCESS; + + return fed ? SWITCH_STATUS_FALSE : SWITCH_STATUS_SUCCESS; } SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf) diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 9e942fea5e..c8aca7dbc6 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -38,6 +38,16 @@ struct switch_session_manager session_manager; +SWITCH_DECLARE(void) switch_core_session_set_dmachine(switch_core_session_t *session, switch_ivr_dmachine_t *dmachine) +{ + session->dmachine = dmachine; +} + +SWITCH_DECLARE(switch_ivr_dmachine_t *) switch_core_session_get_dmachine(switch_core_session_t *session) +{ + return session->dmachine; +} + SWITCH_DECLARE(void) switch_core_session_soft_lock(switch_core_session_t *session, uint32_t sec) { session->soft_lock = sec; @@ -1094,6 +1104,10 @@ SWITCH_DECLARE(void) switch_core_session_perform_destroy(switch_core_session_t * switch_ivr_clear_speech_cache(*session); switch_channel_uninit((*session)->channel); + if ((*session)->dmachine) { + switch_ivr_dmachine_destroy(&(*session)->dmachine); + } + pool = (*session)->pool; //#ifndef NDEBUG //memset(*session, 0, sizeof(switch_core_session_t)); diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 04972b3efa..57b4569346 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -150,10 +150,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_bind(switch_ivr_dmachine_t * } if (binding->is_regex) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "binding regex: %s key: %.4d callback: %p data: %p\n", + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "binding regex: %s key: %.4d callback: %p data: %p\n", digits, key, (void *)(intptr_t) callback, user_data); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "binding digits: %4s key: %.4d callback: %p data: %p\n", + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "binding digits: %4s key: %.4d callback: %p data: %p\n", digits, key, (void *)(intptr_t) callback, user_data); } @@ -264,27 +264,25 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t * switch_bool_t is_timeout = switch_ivr_dmachine_check_timeout(dmachine); dm_match_t is_match = switch_ivr_dmachine_check_match(dmachine, is_timeout); switch_status_t r; - + int exec = 0; + if (zstr(dmachine->digits) && !is_timeout) { r = SWITCH_STATUS_SUCCESS; } else if (dmachine->cur_digit_len > dmachine->max_digit_len) { r = SWITCH_STATUS_FALSE; } else if (is_match == DM_MATCH_EXACT || (is_match == DM_MATCH_BOTH && is_timeout)) { r = SWITCH_STATUS_FOUND; - + dmachine->match.match_digits = dmachine->last_matching_digits; dmachine->match.match_key = dmachine->last_matching_binding->key; dmachine->match.user_data = dmachine->last_matching_binding->user_data; - - if (dmachine->last_matching_binding->callback) { - dmachine->last_matching_binding->callback(&dmachine->match); - } - + if (match_p) { *match_p = &dmachine->match; } dmachine->is_match = 1; + exec = 1; } else if (is_timeout) { r = SWITCH_STATUS_TIMEOUT; } else if (dmachine->cur_digit_len == dmachine->max_digit_len) { @@ -297,6 +295,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t * switch_ivr_dmachine_clear(dmachine); } + if (exec && dmachine->last_matching_binding->callback) { + dmachine->last_matching_binding->callback(&dmachine->match); + } + return r; } @@ -2501,7 +2503,7 @@ static void *SWITCH_THREAD_FUNC bcast_thread(switch_thread_t *thread, void *obj) return NULL; } -static void broadcast_in_thread(switch_core_session_t *session, const char *app, int flags) +SWITCH_DECLARE(void) switch_ivr_broadcast_in_thread(switch_core_session_t *session, const char *app, int flags) { switch_thread_t *thread; switch_threadattr_t *thd_attr = NULL; @@ -2606,7 +2608,7 @@ static switch_status_t meta_on_dtmf(switch_core_session_t *session, const switch switch_channel_get_name(channel), dtmf->digit, md->sr[direction].map[dval].app); if (switch_channel_test_flag(channel, CF_PROXY_MODE)) { - broadcast_in_thread(session, md->sr[direction].map[dval].app, flags | SMF_REBRIDGE); + switch_ivr_broadcast_in_thread(session, md->sr[direction].map[dval].app, flags | SMF_REBRIDGE); } else { switch_ivr_broadcast(switch_core_session_get_uuid(session), md->sr[direction].map[dval].app, flags); } diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index f92e254008..165df886fd 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -468,6 +468,10 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) continue; } + if (switch_channel_test_flag(chan_a, CF_BRIDGE_NOWRITE)) { + continue; + } + 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) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, @@ -839,13 +843,26 @@ static switch_status_t hanguphook(switch_core_session_t *session) { switch_core_session_message_t msg = { 0 }; switch_channel_t *channel = NULL; + switch_event_t *event; + switch_channel_state_t state; channel = switch_core_session_get_channel(session); + state = switch_channel_get_state(channel); msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE; msg.from = __FILE__; msg.string_arg = switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE); + if (state == CS_ROUTING) { + if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) { + switch_channel_clear_flag_recursive(channel, CF_BRIDGE_ORIGINATOR); + if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == SWITCH_STATUS_SUCCESS) { + switch_channel_event_set_data(channel, event); + switch_event_fire(&event); + } + } + } + switch_core_session_receive_message(session, &msg); switch_core_event_hook_remove_state_change(session, hanguphook); @@ -859,6 +876,7 @@ static switch_status_t signal_bridge_on_hibernate(switch_core_session_t *session const char *key; switch_core_session_message_t msg = { 0 }; switch_event_t *event = NULL; + switch_ivr_dmachine_t *dmachine; channel = switch_core_session_get_channel(session); switch_assert(channel != NULL); @@ -886,6 +904,19 @@ static switch_status_t signal_bridge_on_hibernate(switch_core_session_t *session } } + if ((dmachine = switch_core_session_get_dmachine(session))) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, + "%s not hibernating due to active digit parser, semi-hibernation engaged.\n", switch_channel_get_name(channel)); + + while(switch_channel_ready(channel) && switch_channel_get_state(channel) == CS_HIBERNATE) { + if (!switch_channel_test_flag(channel, CF_BROADCAST)) { + switch_ivr_dmachine_ping(dmachine, NULL); + } + switch_yield(20000); + } + } + + return SWITCH_STATUS_SUCCESS; } From 413dcc4cd29be42c421a81453d0e36d783f17d72 Mon Sep 17 00:00:00 2001 From: Brian West Date: Fri, 8 Oct 2010 09:03:43 -0500 Subject: [PATCH 27/46] ESL-50: Call close on connection handle if the connection fails --- libs/esl/src/esl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/esl/src/esl.c b/libs/esl/src/esl.c index 75a52d6bd2..4a02a8fe38 100644 --- a/libs/esl/src/esl.c +++ b/libs/esl/src/esl.c @@ -765,6 +765,7 @@ ESL_DECLARE(esl_status_t) esl_connect_timeout(esl_handle_t *handle, const char * fail: handle->connected = 0; + esl_disconnect(handle); return ESL_FAIL; } From 8a7f8cd22ee4b9d367cd1c18d80f9a351f3ecc93 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 8 Oct 2010 11:05:29 -0500 Subject: [PATCH 28/46] fix carbon copy delete after emailing paradox --- .../mod_voicemail/mod_voicemail.c | 54 +++++++++++-------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index e55cd8a2f4..fea8b83be9 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -2317,7 +2317,7 @@ static switch_status_t deliver_vm(vm_profile_t *profile, const char *caller_id_name, const char *caller_id_number, const char *forwarded_by, - switch_bool_t copy, const char *use_uuid) + switch_bool_t copy, const char *use_uuid, switch_core_session_t *session) { char *file_path = NULL, *dir_path = NULL; const char *myid = switch_xml_attr(x_user, "id"); @@ -2342,6 +2342,8 @@ static switch_status_t deliver_vm(vm_profile_t *profile, switch_status_t ret = SWITCH_STATUS_SUCCESS; char *convert_cmd = profile->convert_cmd; char *convert_ext = profile->convert_ext; + int del_file = 0; + char *id = switch_core_session_strdup(session, switch_xml_attr(x_user, "id")); if (!params) { switch_event_create(&local_event, SWITCH_EVENT_REQUEST_PARAMS); @@ -2634,14 +2636,35 @@ static switch_status_t deliver_vm(vm_profile_t *profile, } if (!insert_db) { - if (unlink(file_path) != 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to delete file [%s]\n", file_path); + del_file = 1; + } + } + + if (session) { + switch_channel_t *channel = switch_core_session_get_channel(session); + const char *vm_cc; + + if ((vm_cc = switch_channel_get_variable(channel, "vm_cc"))) { + char *cmd = switch_core_session_sprintf(session, "%s %s %s '%s' %s@%s %s", + vm_cc, file_path, caller_id_number, caller_id_name, id, domain_name, read_flags); + + if (voicemail_inject(cmd, session) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Sent Carbon Copy to %s\n", vm_cc); + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to Carbon Copy to %s\n", vm_cc); } } } + failed: + if (del_file && file_path) { + if (unlink(file_path) != 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to delete file [%s]\n", file_path); + } + } + switch_event_destroy(&local_event); switch_safe_free(dir_path); @@ -2785,7 +2808,7 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t switch_event_create(&my_params, SWITCH_EVENT_REQUEST_PARAMS); status = deliver_vm(profile, ux, domain, path, 0, read_flags, my_params, pool, cid_name, cid_num, forwarded_by, - SWITCH_TRUE, session ? switch_core_session_get_uuid(session) : NULL); + SWITCH_TRUE, session ? switch_core_session_get_uuid(session) : NULL, NULL); switch_event_destroy(&my_params); } continue; @@ -2794,7 +2817,7 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t switch_event_create(&my_params, SWITCH_EVENT_REQUEST_PARAMS); status = deliver_vm(profile, ut, domain, path, 0, read_flags, my_params, pool, cid_name, cid_num, forwarded_by, SWITCH_TRUE, - session ? switch_core_session_get_uuid(session) : NULL); + session ? switch_core_session_get_uuid(session) : NULL, NULL); switch_event_destroy(&my_params); } } @@ -2817,7 +2840,7 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t switch_event_create(&my_params, SWITCH_EVENT_REQUEST_PARAMS); status = deliver_vm(profile, ut, domain, path, 0, read_flags, my_params, pool, cid_name, cid_num, forwarded_by, SWITCH_TRUE, - session ? switch_core_session_get_uuid(session) : NULL); + session ? switch_core_session_get_uuid(session) : NULL, NULL); switch_event_destroy(&my_params); } } @@ -2831,7 +2854,7 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t switch_event_create(&my_params, SWITCH_EVENT_REQUEST_PARAMS); status = deliver_vm(profile, ut, domain, path, 0, read_flags, my_params, pool, cid_name, cid_num, forwarded_by, SWITCH_TRUE, - session ? switch_core_session_get_uuid(session) : NULL); + session ? switch_core_session_get_uuid(session) : NULL, NULL); switch_event_destroy(&my_params); } else { status = SWITCH_STATUS_FALSE; @@ -2889,7 +2912,7 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p const char *caller_id_number = NULL; switch_xml_t x_user = NULL, x_params = NULL, x_param = NULL; switch_event_t *vars = NULL; - const char *vm_cc = NULL, *vtmp, *vm_ext = NULL; + const char *vtmp, *vm_ext = NULL; int disk_quota = 0; switch_bool_t skip_greeting = switch_true(switch_channel_get_variable(channel, "skip_greeting")); switch_bool_t skip_instructions = switch_true(switch_channel_get_variable(channel, "skip_instructions")); @@ -3175,20 +3198,9 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p switch_channel_get_variables(channel, &vars); status = deliver_vm(profile, x_user, domain_name, file_path, message_len, read_flags, vars, switch_core_session_get_pool(session), caller_id_name, caller_id_number, NULL, SWITCH_FALSE, - session ? switch_core_session_get_uuid(session) : NULL); + session ? switch_core_session_get_uuid(session) : NULL, session); switch_event_destroy(&vars); - if (status == SWITCH_STATUS_SUCCESS) { - if ((vm_cc = switch_channel_get_variable(channel, "vm_cc"))) { - char *cmd = switch_core_session_sprintf(session, "%s %s %s '%s' %s@%s %s", - vm_cc, file_path, caller_id_number, caller_id_name, id, domain_name, read_flags); - - if (voicemail_inject(cmd, session) == SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Sent Carbon Copy to %s\n", vm_cc); - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to Carbon Copy to %s\n", vm_cc); - } - } - } else { + if (status != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to deliver message\n"); TRY_CODE(switch_ivr_phrase_macro(session, VM_ACK_MACRO, "deleted", NULL, NULL)); } From 1d921b1cfae8567a6467e2dd25515efefd1453d7 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 8 Oct 2010 13:50:15 -0500 Subject: [PATCH 29/46] improve dmachine stuff some more --- src/include/switch_ivr.h | 21 ++- src/include/switch_types.h | 13 ++ .../applications/mod_dptools/mod_dptools.c | 84 +++++++--- src/switch_channel.c | 7 +- src/switch_core_io.c | 18 ++- src/switch_ivr_async.c | 153 ++++++++++++++---- 6 files changed, 233 insertions(+), 63 deletions(-) diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index 1fed73ca67..fb023848ec 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -846,24 +846,31 @@ SWITCH_DECLARE(switch_bool_t) switch_ivr_uuid_exists(const char *uuid); SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_create(switch_ivr_dmachine_t **dmachine_p, - switch_memory_pool_t *pool, - uint32_t digit_timeout, uint32_t input_timeout); + const char *name, + switch_memory_pool_t *pool, + uint32_t digit_timeout, uint32_t input_timeout, + switch_ivr_dmachine_callback_t match_callback, + switch_ivr_dmachine_callback_t nonmatch_callback, + void *user_data); SWITCH_DECLARE(void) switch_ivr_dmachine_destroy(switch_ivr_dmachine_t **dmachine); SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_bind(switch_ivr_dmachine_t *dmachine, - const char *digits, - int32_t key, - switch_ivr_dmachine_callback_t callback, - void *user_data); + const char *realm, + const char *digits, + int32_t key, + switch_ivr_dmachine_callback_t callback, + void *user_data); SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_feed(switch_ivr_dmachine_t *dmachine, const char *digits, switch_ivr_dmachine_match_t **match); SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_clear(switch_ivr_dmachine_t *dmachine); SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t *dmachine, switch_ivr_dmachine_match_t **match_p); SWITCH_DECLARE(switch_ivr_dmachine_match_t *) switch_ivr_dmachine_get_match(switch_ivr_dmachine_t *dmachine); +SWITCH_DECLARE(const char *) switch_ivr_dmachine_get_failed_digits(switch_ivr_dmachine_t *dmachine); SWITCH_DECLARE(void) switch_ivr_dmachine_set_digit_timeout_ms(switch_ivr_dmachine_t *dmachine, uint32_t digit_timeout_ms); SWITCH_DECLARE(void) switch_ivr_dmachine_set_input_timeout_ms(switch_ivr_dmachine_t *dmachine, uint32_t input_timeout_ms); - +SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_clear_realm(switch_ivr_dmachine_t *dmachine, const char *realm); +SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_set_realm(switch_ivr_dmachine_t *dmachine, const char *realm); /** @} */ diff --git a/src/include/switch_types.h b/src/include/switch_types.h index d67d972e92..b1fc627354 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -190,9 +190,14 @@ SWITCH_BEGIN_EXTERN_C #define SWITCH_DTMF_LOG_LEN 1000 typedef uint8_t switch_byte_t; +typedef enum { + DTMF_FLAG_SKIP_PROCESS = (1 << 0) +} dtmf_flag_t; + typedef struct { char digit; uint32_t duration; + int32_t flags; } switch_dtmf_t; typedef enum { @@ -1689,6 +1694,13 @@ typedef switch_status_t (*switch_input_callback_function_t) (switch_core_session typedef switch_status_t (*switch_read_frame_callback_function_t) (switch_core_session_t *session, switch_frame_t *frame, void *user_data); typedef struct switch_say_interface switch_say_interface_t; +#define DMACHINE_MAX_DIGIT_LEN 512 + +typedef enum { + DM_MATCH_POSITIVE, + DM_MATCH_NEGATIVE +} dm_match_type_t; + struct switch_ivr_dmachine; typedef struct switch_ivr_dmachine switch_ivr_dmachine_t; @@ -1696,6 +1708,7 @@ struct switch_ivr_dmachine_match { switch_ivr_dmachine_t *dmachine; const char *match_digits; int32_t match_key; + dm_match_type_t type; void *user_data; }; diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 675cde4884..f444f63cb2 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -96,12 +96,30 @@ SWITCH_STANDARD_DIALPLAN(inline_dialplan_hunt) } struct action_binding { + char *realm; char *input; char *string; char *value; switch_core_session_t *session; }; +static switch_status_t digit_nomatch_action_callback(switch_ivr_dmachine_match_t *match) +{ + switch_core_session_t *session = (switch_core_session_t *) match->user_data; + switch_channel_t *channel = switch_core_session_get_channel(session); + char str[DMACHINE_MAX_DIGIT_LEN + 2]; + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Digit NOT match binding [%s]\n", + switch_channel_get_name(channel), match->match_digits); + + /* send it back around flagged to skip the dmachine */ + switch_snprintf(str, sizeof(str), "!%s", match->match_digits); + + switch_channel_queue_dtmf_string(channel, str); + + return SWITCH_STATUS_SUCCESS; +} + static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match) { struct action_binding *act = (struct action_binding *) match->user_data; @@ -141,32 +159,64 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match) return SWITCH_STATUS_SUCCESS; } -#define CLEAR_DIGIT_ACTION_USAGE "" +#define CLEAR_DIGIT_ACTION_USAGE "|all" SWITCH_STANDARD_APP(clear_digit_action_function) { //switch_channel_t *channel = switch_core_session_get_channel(session); switch_ivr_dmachine_t *dmachine; - + char *realm = (char *) data; + if ((dmachine = switch_core_session_get_dmachine(session))) { - switch_core_session_set_dmachine(session, NULL); - switch_ivr_dmachine_destroy(&dmachine); + if (zstr(realm) || !strcasecmp(realm, "all")) { + switch_core_session_set_dmachine(session, NULL); + switch_ivr_dmachine_destroy(&dmachine); + } else { + switch_ivr_dmachine_clear_realm(dmachine, realm); + } } } -#define BIND_DIGIT_ACTION_USAGE ",," +#define DIGIT_ACTION_SET_REALM_USAGE "" +SWITCH_STANDARD_APP(digit_action_set_realm_function) +{ + switch_ivr_dmachine_t *dmachine; + char *realm = (char *) data; + + if (zstr(data)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Syntax Error, USAGE %s\n", DIGIT_ACTION_SET_REALM_USAGE); + return; + } + + if ((dmachine = switch_core_session_get_dmachine(session))) { + switch_ivr_dmachine_set_realm(dmachine, realm); + } + +} + +#define BIND_DIGIT_ACTION_USAGE ",,," SWITCH_STANDARD_APP(bind_digit_action_function) { switch_channel_t *channel = switch_core_session_get_channel(session); switch_ivr_dmachine_t *dmachine; char *mydata; int argc = 0; - char *argv[3] = { 0 }; + char *argv[4] = { 0 }; struct action_binding *act; if (zstr(data)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Syntax Error, USAGE %s\n", BIND_DIGIT_ACTION_USAGE); return; } + + mydata = switch_core_session_strdup(session, data); + + argc = switch_separate_string(mydata, ',', argv, (sizeof(argv) / sizeof(argv[0]))); + + if (argc < 4 || zstr(argv[0]) || zstr(argv[1]) || zstr(argv[2]) || zstr(argv[3])) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Syntax Error, USAGE %s\n", BIND_DIGIT_ACTION_USAGE); + return; + } + if (!(dmachine = switch_core_session_get_dmachine(session))) { uint32_t digit_timeout = 1500; @@ -186,26 +236,19 @@ SWITCH_STANDARD_APP(bind_digit_action_function) input_timeout = tmp; } - switch_ivr_dmachine_create(&dmachine, NULL, digit_timeout, input_timeout); + switch_ivr_dmachine_create(&dmachine, "DPTOOLS", NULL, digit_timeout, input_timeout, NULL, digit_nomatch_action_callback, session); switch_core_session_set_dmachine(session, dmachine); } - mydata = switch_core_session_strdup(session, data); - - argc = switch_separate_string(mydata, ',', argv, (sizeof(argv) / sizeof(argv[0]))); - if (argc < 3 || zstr(argv[0]) || zstr(argv[1]) || zstr(argv[2])) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Syntax Error, USAGE %s\n", BIND_DIGIT_ACTION_USAGE); - return; - } - act = switch_core_session_alloc(session, sizeof(*act)); - act->input = argv[0]; - act->string = argv[1]; - act->value = argv[2]; + act->realm = argv[0]; + act->input = argv[1]; + act->string = argv[2]; + act->value = argv[3]; act->session = session; - switch_ivr_dmachine_bind(dmachine, act->input, 0, digit_action_callback, act); + switch_ivr_dmachine_bind(dmachine, act->realm, act->input, 0, digit_action_callback, act); } @@ -3398,6 +3441,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) SWITCH_ADD_APP(app_interface, "clear_digit_action", "clear all digit bindings", "", clear_digit_action_function, CLEAR_DIGIT_ACTION_USAGE, SAF_SUPPORT_NOMEDIA); + SWITCH_ADD_APP(app_interface, "digit_action_set_realm", "change binding realm", "", + digit_action_set_realm_function, DIGIT_ACTION_SET_REALM_USAGE, SAF_SUPPORT_NOMEDIA); + SWITCH_ADD_APP(app_interface, "privacy", "Set privacy on calls", "Set caller privacy on calls.", privacy_function, "off|on|name|full|number", SAF_SUPPORT_NOMEDIA); diff --git a/src/switch_channel.c b/src/switch_channel.c index df5fd9627e..213f385b28 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -400,7 +400,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf(switch_channel_t *chan SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf_string(switch_channel_t *channel, const char *dtmf_string) { char *p; - switch_dtmf_t dtmf = { 0, switch_core_default_dtmf_duration(0) }; + switch_dtmf_t dtmf = { 0, switch_core_default_dtmf_duration(0), 0}; int sent = 0, dur; char *string; int i, argc; @@ -410,6 +410,11 @@ SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf_string(switch_channel_ return SWITCH_STATUS_FALSE; } + if (*dtmf_string == '!') { + dtmf_string++; + dtmf.flags = DTMF_FLAG_SKIP_PROCESS; + } + string = switch_core_session_strdup(channel->session, dtmf_string); argc = switch_separate_string(string, '+', argv, (sizeof(argv) / sizeof(argv[0]))); diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 15b8f417d4..4e6d2fc6a2 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -1176,15 +1176,17 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_recv_dtmf(switch_core_sessio new_dtmf.duration = switch_core_default_dtmf_duration(0); } - if (session->dmachine && !switch_channel_test_flag(session->channel, CF_BROADCAST)) { - char str[2] = { dtmf->digit, '\0' }; - switch_ivr_dmachine_feed(session->dmachine, str, NULL); - fed = 1; - } + if (!switch_test_flag(dtmf, DTMF_FLAG_SKIP_PROCESS)) { + if (session->dmachine && !switch_channel_test_flag(session->channel, CF_BROADCAST)) { + char str[2] = { dtmf->digit, '\0' }; + switch_ivr_dmachine_feed(session->dmachine, str, NULL); + fed = 1; + } - for (ptr = session->event_hooks.recv_dtmf; ptr; ptr = ptr->next) { - if ((status = ptr->recv_dtmf(session, &new_dtmf, SWITCH_DTMF_RECV)) != SWITCH_STATUS_SUCCESS) { - return status; + for (ptr = session->event_hooks.recv_dtmf; ptr; ptr = ptr->next) { + if ((status = ptr->recv_dtmf(session, &new_dtmf, SWITCH_DTMF_RECV)) != SWITCH_STATUS_SUCCESS) { + return status; + } } } diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 57b4569346..9bfa27eae7 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -45,28 +45,41 @@ struct switch_ivr_dmachine_binding { }; typedef struct switch_ivr_dmachine_binding switch_ivr_dmachine_binding_t; -#define DM_MAX_DIGIT_LEN 512 +typedef struct { + switch_ivr_dmachine_binding_t *binding_list; + switch_ivr_dmachine_binding_t *tail; +} dm_binding_head_t; struct switch_ivr_dmachine { switch_memory_pool_t *pool; switch_byte_t my_pool; + char *name; uint32_t digit_timeout_ms; uint32_t input_timeout_ms; - switch_ivr_dmachine_binding_t *binding_list; - switch_ivr_dmachine_binding_t *tail; - switch_ivr_dmachine_binding_t *last_matching_binding; + switch_hash_t *binding_hash; switch_ivr_dmachine_match_t match; - char digits[DM_MAX_DIGIT_LEN]; - char last_matching_digits[DM_MAX_DIGIT_LEN]; + char digits[DMACHINE_MAX_DIGIT_LEN]; + char last_matching_digits[DMACHINE_MAX_DIGIT_LEN]; + char last_failed_digits[DMACHINE_MAX_DIGIT_LEN]; uint32_t cur_digit_len; uint32_t max_digit_len; switch_time_t last_digit_time; switch_byte_t is_match; + switch_ivr_dmachine_callback_t match_callback; + switch_ivr_dmachine_callback_t nonmatch_callback; + dm_binding_head_t *realm; + switch_ivr_dmachine_binding_t *last_matching_binding; + void *user_data; }; SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_create(switch_ivr_dmachine_t **dmachine_p, - switch_memory_pool_t *pool, - uint32_t digit_timeout_ms, uint32_t input_timeout_ms) + const char *name, + switch_memory_pool_t *pool, + uint32_t digit_timeout_ms, + uint32_t input_timeout_ms, + switch_ivr_dmachine_callback_t match_callback, + switch_ivr_dmachine_callback_t nonmatch_callback, + void *user_data) { switch_byte_t my_pool = !!pool; switch_ivr_dmachine_t *dmachine; @@ -81,8 +94,22 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_create(switch_ivr_dmachine_t dmachine->digit_timeout_ms = digit_timeout_ms; dmachine->input_timeout_ms = input_timeout_ms; dmachine->match.dmachine = dmachine; - *dmachine_p = dmachine; + dmachine->name = switch_core_strdup(dmachine->pool, name); + + switch_core_hash_init(&dmachine->binding_hash, dmachine->pool); + + if (match_callback) { + dmachine->match_callback = match_callback; + } + if (nonmatch_callback) { + dmachine->nonmatch_callback = nonmatch_callback; + } + + dmachine->user_data = user_data; + + *dmachine_p = dmachine; + return SWITCH_STATUS_SUCCESS; } @@ -105,12 +132,42 @@ SWITCH_DECLARE(void) switch_ivr_dmachine_destroy(switch_ivr_dmachine_t **dmachin pool = (*dmachine)->pool; + switch_core_hash_destroy(&(*dmachine)->binding_hash); + if ((*dmachine)->my_pool) { switch_core_destroy_memory_pool(&pool); } } +SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_set_realm(switch_ivr_dmachine_t *dmachine, const char *realm) +{ + dm_binding_head_t *headp = switch_core_hash_find(dmachine->binding_hash, realm); + + if (headp) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Digit parser %s: Setting realm to %s\n", dmachine->name, realm); + dmachine->realm = headp; + return SWITCH_STATUS_SUCCESS; + } + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Digit parser %s: Error Setting realm to %s\n", dmachine->name, realm); + + return SWITCH_STATUS_FALSE; +} + +SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_clear_realm(switch_ivr_dmachine_t *dmachine, const char *realm) +{ + if (zstr(realm)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Digit parser %s: Error unknown realm: %s\n", dmachine->name, realm); + return SWITCH_STATUS_FALSE; + } + + /* pool alloc'd just ditch it and it will give back the memory when we destroy ourselves */ + switch_core_hash_delete(dmachine->binding_hash, realm); + return SWITCH_STATUS_SUCCESS; +} + SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_bind(switch_ivr_dmachine_t *dmachine, + const char *realm, const char *digits, int32_t key, switch_ivr_dmachine_callback_t callback, @@ -118,43 +175,59 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_bind(switch_ivr_dmachine_t * { switch_ivr_dmachine_binding_t *binding; switch_size_t len; + dm_binding_head_t *headp; - if (strlen(digits) > DM_MAX_DIGIT_LEN -1) { + if (strlen(digits) > DMACHINE_MAX_DIGIT_LEN -1) { return SWITCH_STATUS_FALSE; } + if (zstr(realm)) { + realm = "default"; + } + + if (!(headp = switch_core_hash_find(dmachine->binding_hash, realm))) { + headp = switch_core_alloc(dmachine->pool, sizeof(*headp)); + switch_core_hash_insert(dmachine->binding_hash, realm, headp); + } + binding = switch_core_alloc(dmachine->pool, sizeof(*binding)); + if (*digits == '~') { binding->is_regex = 1; digits++; } + binding->key = key; binding->digits = switch_core_strdup(dmachine->pool, digits); binding->callback = callback; binding->user_data = user_data; - if (dmachine->tail) { - dmachine->tail->next = binding; + if (headp->tail) { + headp->tail->next = binding; } else { - dmachine->binding_list = binding; + headp->binding_list = binding; } - dmachine->tail = binding; + headp->tail = binding; len = strlen(digits); - if (binding->is_regex && dmachine->max_digit_len != DM_MAX_DIGIT_LEN -1) { - dmachine->max_digit_len = DM_MAX_DIGIT_LEN -1; + if (dmachine->realm != headp) { + switch_ivr_dmachine_set_realm(dmachine, realm); + } + + if (binding->is_regex && dmachine->max_digit_len != DMACHINE_MAX_DIGIT_LEN -1) { + dmachine->max_digit_len = DMACHINE_MAX_DIGIT_LEN -1; } else if (len > dmachine->max_digit_len) { dmachine->max_digit_len = (uint32_t) len; } if (binding->is_regex) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "binding regex: %s key: %.4d callback: %p data: %p\n", - digits, key, (void *)(intptr_t) callback, user_data); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Digit parser %s: binding realm: %s regex: %s key: %.4d callback: %p data: %p\n", + dmachine->name, realm, digits, key, (void *)(intptr_t) callback, user_data); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "binding digits: %4s key: %.4d callback: %p data: %p\n", - digits, key, (void *)(intptr_t) callback, user_data); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Digit parser %s: binding realm %s digits: %4s key: %.4d callback: %p data: %p\n", + dmachine->name, realm, digits, key, (void *)(intptr_t) callback, user_data); } return SWITCH_STATUS_SUCCESS; @@ -175,9 +248,9 @@ static dm_match_t switch_ivr_dmachine_check_match(switch_ivr_dmachine_t *dmachin int exact_count = 0, partial_count = 0, both_count = 0; - if (!dmachine->cur_digit_len) goto end; + if (!dmachine->cur_digit_len || !dmachine->realm) goto end; - for(bp = dmachine->binding_list; bp; bp = bp->next) { + for(bp = dmachine->realm->binding_list; bp; bp = bp->next) { if (bp->is_regex) { switch_status_t r_status = switch_regex_match(dmachine->digits, bp->digits); @@ -259,12 +332,17 @@ SWITCH_DECLARE(switch_ivr_dmachine_match_t *) switch_ivr_dmachine_get_match(swit return NULL; } +SWITCH_DECLARE(const char *) switch_ivr_dmachine_get_failed_digits(switch_ivr_dmachine_t *dmachine) +{ + + return dmachine->last_failed_digits; +} + SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t *dmachine, switch_ivr_dmachine_match_t **match_p) { switch_bool_t is_timeout = switch_ivr_dmachine_check_timeout(dmachine); dm_match_t is_match = switch_ivr_dmachine_check_match(dmachine, is_timeout); switch_status_t r; - int exec = 0; if (zstr(dmachine->digits) && !is_timeout) { r = SWITCH_STATUS_SUCCESS; @@ -282,7 +360,18 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t * } dmachine->is_match = 1; - exec = 1; + + dmachine->match.type = DM_MATCH_POSITIVE; + + if (dmachine->last_matching_binding->callback) { + dmachine->last_matching_binding->callback(&dmachine->match); + } + + if (dmachine->match_callback) { + dmachine->match.user_data = dmachine->user_data; + dmachine->match_callback(&dmachine->match); + } + } else if (is_timeout) { r = SWITCH_STATUS_TIMEOUT; } else if (dmachine->cur_digit_len == dmachine->max_digit_len) { @@ -291,14 +380,22 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t * r = SWITCH_STATUS_SUCCESS; } + if (r != SWITCH_STATUS_FOUND && r != SWITCH_STATUS_SUCCESS) { + switch_set_string(dmachine->last_failed_digits, dmachine->digits); + dmachine->match.match_digits = dmachine->last_failed_digits; + + dmachine->match.type = DM_MATCH_NEGATIVE; + + if (dmachine->nonmatch_callback) { + dmachine->match.user_data = dmachine->user_data; + dmachine->nonmatch_callback(&dmachine->match); + } + } + if (r != SWITCH_STATUS_SUCCESS) { switch_ivr_dmachine_clear(dmachine); } - if (exec && dmachine->last_matching_binding->callback) { - dmachine->last_matching_binding->callback(&dmachine->match); - } - return r; } From f13fa0c1a59a0b343c848abc23bdc4a3d8acaf3e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 8 Oct 2010 15:38:01 -0500 Subject: [PATCH 30/46] FS-2763 --- src/mod/endpoints/mod_sofia/mod_sofia.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 323702e3c5..36954d2904 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3531,10 +3531,6 @@ SWITCH_STANDARD_API(sofia_function) "watchdog \n" "--------------------------------------------------------------------------------\n"; - if (session) { - return SWITCH_STATUS_FALSE; - } - if (zstr(cmd)) { stream->write_function(stream, "%s", usage_string); goto done; From fdba0e07faafafe90be5336626b1ca8ec8d98bf0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 8 Oct 2010 15:59:22 -0500 Subject: [PATCH 31/46] make parens optional on functions as vars ${foo(bar)} is now the same as ${foo bar} --- src/switch_channel.c | 5 +++-- src/switch_event.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/switch_channel.c b/src/switch_channel.c index 213f385b28..9e76b46a5a 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2907,14 +2907,15 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables(switch_channel_t *channel } p = e > endof_indup ? endof_indup : e; - if ((vval = strchr(vname, '('))) { + if ((vval = strchr(vname, '(')) || (vval = strchr(vname, ' '))) { + if (*vval == '(') br = 1; e = vval - 1; *vval++ = '\0'; while (*e == ' ') { *e-- = '\0'; } e = vval; - br = 1; + while (e && *e) { if (*e == '(') { br++; diff --git a/src/switch_event.c b/src/switch_event.c index 4b1e28aebf..f782c15900 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -1644,14 +1644,15 @@ SWITCH_DECLARE(char *) switch_event_expand_headers(switch_event_t *event, const } p = e > endof_indup ? endof_indup : e; - if ((vval = strchr(vname, '('))) { + if ((vval = strchr(vname, '(')) || (vval = strchr(vname, ' '))) { + if (*vval == '(') br = 1; e = vval - 1; *vval++ = '\0'; while (*e == ' ') { *e-- = '\0'; } e = vval; - br = 1; + while (e && *e) { if (*e == '(') { br++; From e3c427ad288e41485c32a96c56e682b1566837be Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 8 Oct 2010 17:04:22 -0500 Subject: [PATCH 32/46] fix default ptime for iLBC and make new configurable global map in switch.conf.xml --- conf/autoload_configs/switch.conf.xml | 5 +++ src/include/private/switch_core_pvt.h | 1 + src/include/switch_core.h | 1 + src/include/switch_utils.h | 9 ----- src/switch_core.c | 47 +++++++++++++++++++++++++++ 5 files changed, 54 insertions(+), 9 deletions(-) diff --git a/conf/autoload_configs/switch.conf.xml b/conf/autoload_configs/switch.conf.xml index 7a68a7f2bd..e861b1b61a 100644 --- a/conf/autoload_configs/switch.conf.xml +++ b/conf/autoload_configs/switch.conf.xml @@ -15,6 +15,11 @@ + + + + + diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index 6a9bdc35a0..ea02f22fa0 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -199,6 +199,7 @@ struct switch_runtime { int64_t offset; switch_event_t *global_vars; switch_hash_t *mime_types; + switch_hash_t *ptimes; switch_memory_pool_t *memory_pool; const switch_state_handler_table_t *state_handlers[SWITCH_MAX_STATE_HANDLERS]; int state_handler_index; diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 04991ed186..3f636d00c4 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -2168,6 +2168,7 @@ SWITCH_DECLARE(uint32_t) switch_core_debug_level(void); SWITCH_DECLARE(void) switch_cache_db_flush_handles(void); SWITCH_DECLARE(const char *) switch_core_banner(void); SWITCH_DECLARE(switch_bool_t) switch_core_session_in_thread(switch_core_session_t *session); +SWITCH_DECLARE(uint32_t) switch_default_ptime(const char *name, uint32_t number); SWITCH_END_EXTERN_C #endif diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index e5d70c43cc..945583ee07 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -376,15 +376,6 @@ switch_mutex_unlock(obj->flag_mutex); #define switch_set_string(_dst, _src) switch_copy_string(_dst, _src, sizeof(_dst)) -static inline uint32_t switch_default_ptime(const char *name, uint32_t number) -{ - if (!strcasecmp(name, "G723")) { - return 30; - } - - return 20; -} - static inline char *switch_sanitize_number(char *number) { char *p = number, *q; diff --git a/src/switch_core.c b/src/switch_core.c index 2c33b341de..567fcfd14a 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1275,6 +1275,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc switch_core_session_init(runtime.memory_pool); switch_event_create_plain(&runtime.global_vars, SWITCH_EVENT_CHANNEL_DATA); switch_core_hash_init(&runtime.mime_types, runtime.memory_pool); + switch_core_hash_init_case(&runtime.ptimes, runtime.memory_pool, SWITCH_FALSE); load_mime_types(); runtime.flags |= flags; runtime.sps_total = 30; @@ -1405,13 +1406,58 @@ static void handle_SIGHUP(int sig) } +SWITCH_DECLARE(uint32_t) switch_default_ptime(const char *name, uint32_t number) +{ + uint32_t *p; + + if ((p = switch_core_hash_find(runtime.ptimes, name))) { + return *p; + } + + return 20; +} + +static uint32_t d_30 = 30; + static void switch_load_core_config(const char *file) { switch_xml_t xml = NULL, cfg = NULL; + switch_core_hash_insert(runtime.ptimes, "ilbc", &d_30); + switch_core_hash_insert(runtime.ptimes, "G723", &d_30); + + + if ((xml = switch_xml_open_cfg(file, &cfg, NULL))) { switch_xml_t settings, param; + if ((settings = switch_xml_child(cfg, "default-ptimes"))) { + for (param = switch_xml_child(settings, "codec"); param; param = param->next) { + const char *var = switch_xml_attr_soft(param, "name"); + const char *val = switch_xml_attr_soft(param, "ptime"); + + if (!zstr(var) && !zstr(val)) { + uint32_t *p; + uint32_t v = (unsigned long) atol(val); + + if (!strcasecmp(var, "G723") || !strcasecmp(var, "iLBC")) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error adding %s, defaults cannot be changed\n", var); + continue; + } + + if (v < 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error adding %s, invalid ptime\n", var); + continue; + } + + p = switch_core_alloc(runtime.memory_pool, sizeof(*p)); + *p = v; + switch_core_hash_insert(runtime.ptimes, var, p); + } + + } + } + if ((settings = switch_xml_child(cfg, "settings"))) { for (param = switch_xml_child(settings, "param"); param; param = param->next) { const char *var = switch_xml_attr_soft(param, "name"); @@ -1973,6 +2019,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(void) switch_safe_free(SWITCH_GLOBAL_dirs.temp_dir); switch_event_destroy(&runtime.global_vars); + switch_core_hash_destroy(&runtime.ptimes); switch_core_hash_destroy(&runtime.mime_types); if (IP_LIST.hash) { From 4a3c726affd569ebeec6013ee146eaf637a14095 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 8 Oct 2010 17:05:09 -0500 Subject: [PATCH 33/46] whitespace --- src/switch_core.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/switch_core.c b/src/switch_core.c index 567fcfd14a..1275b906e7 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1425,8 +1425,6 @@ static void switch_load_core_config(const char *file) switch_core_hash_insert(runtime.ptimes, "ilbc", &d_30); switch_core_hash_insert(runtime.ptimes, "G723", &d_30); - - if ((xml = switch_xml_open_cfg(file, &cfg, NULL))) { switch_xml_t settings, param; From 37298f56bd85e16922b774cf6fc2a48c88b880d7 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 8 Oct 2010 17:45:40 -0500 Subject: [PATCH 34/46] add event data --- src/mod/applications/mod_dptools/mod_dptools.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index f444f63cb2..06f545928d 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -108,10 +108,22 @@ static switch_status_t digit_nomatch_action_callback(switch_ivr_dmachine_match_t switch_core_session_t *session = (switch_core_session_t *) match->user_data; switch_channel_t *channel = switch_core_session_get_channel(session); char str[DMACHINE_MAX_DIGIT_LEN + 2]; + switch_event_t *event; + switch_status_t status; switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Digit NOT match binding [%s]\n", switch_channel_get_name(channel), match->match_digits); + if (switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "digits", match->match_digits); + + if ((status = switch_core_session_queue_event(session, &event)) != SWITCH_STATUS_SUCCESS) { + switch_event_destroy(&event); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s event queue faiure.\n", + switch_core_session_get_name(session)); + } + } + /* send it back around flagged to skip the dmachine */ switch_snprintf(str, sizeof(str), "!%s", match->match_digits); @@ -139,6 +151,7 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match) } switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, string, act->value); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "digits", match->match_digits); if (exec) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute", exec == 2 ? "non-blocking" : "blocking"); From 4be25000bf2246f57f1dbc2189930e5f19bf192a Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Fri, 8 Oct 2010 21:48:14 -0500 Subject: [PATCH 35/46] swig vs2010 --- .../mod_managed/freeswitch_wrap.2010.cxx | 431 +++++++++++++++- .../mod_managed/managed/swig.2010.cs | 465 +++++++++++++++++- 2 files changed, 874 insertions(+), 22 deletions(-) diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx index 882f0626f4..5a2a757e57 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx @@ -1011,6 +1011,16 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABL } +SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE_get() { + char * jresult ; + char *result = 0 ; + + result = (char *)("passthru_ptime_mismatch"); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE_get() { char * jresult ; char *result = 0 ; @@ -1685,6 +1695,28 @@ SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_dtmf_t_duration_get(void * ja } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_dtmf_t_flags_set(void * jarg1, int jarg2) { + switch_dtmf_t *arg1 = (switch_dtmf_t *) 0 ; + int32_t arg2 ; + + arg1 = (switch_dtmf_t *)jarg1; + arg2 = (int32_t)jarg2; + if (arg1) (arg1)->flags = arg2; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_dtmf_t_flags_get(void * jarg1) { + int jresult ; + switch_dtmf_t *arg1 = (switch_dtmf_t *) 0 ; + int32_t result; + + arg1 = (switch_dtmf_t *)jarg1; + result = (int32_t) ((arg1)->flags); + jresult = result; + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_dtmf_t() { void * jresult ; switch_dtmf_t *result = 0 ; @@ -3860,6 +3892,151 @@ SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_console_callback_match(void * j } +SWIGEXPORT int SWIGSTDCALL CSharp_DMACHINE_MAX_DIGIT_LEN_get() { + int jresult ; + int result; + + result = (int)(512); + jresult = result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_match_dmachine_set(void * jarg1, void * jarg2) { + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + switch_ivr_dmachine_t *arg2 = (switch_ivr_dmachine_t *) 0 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + arg2 = (switch_ivr_dmachine_t *)jarg2; + if (arg1) (arg1)->dmachine = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_ivr_dmachine_match_dmachine_get(void * jarg1) { + void * jresult ; + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + switch_ivr_dmachine_t *result = 0 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + result = (switch_ivr_dmachine_t *) ((arg1)->dmachine); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_match_match_digits_set(void * jarg1, char * jarg2) { + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + char *arg2 = (char *) 0 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + arg2 = (char *)jarg2; + { + if (arg2) { + arg1->match_digits = (char const *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->match_digits, (const char *)arg2); + } else { + arg1->match_digits = 0; + } + } +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_ivr_dmachine_match_match_digits_get(void * jarg1) { + char * jresult ; + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + char *result = 0 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + result = (char *) ((arg1)->match_digits); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_match_match_key_set(void * jarg1, int jarg2) { + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + int32_t arg2 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + arg2 = (int32_t)jarg2; + if (arg1) (arg1)->match_key = arg2; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_match_match_key_get(void * jarg1) { + int jresult ; + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + int32_t result; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + result = (int32_t) ((arg1)->match_key); + jresult = result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_match_type_set(void * jarg1, int jarg2) { + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + dm_match_type_t arg2 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + arg2 = (dm_match_type_t)jarg2; + if (arg1) (arg1)->type = arg2; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_match_type_get(void * jarg1) { + int jresult ; + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + dm_match_type_t result; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + result = (dm_match_type_t) ((arg1)->type); + jresult = result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_match_user_data_set(void * jarg1, void * jarg2) { + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + void *arg2 = (void *) 0 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + arg2 = (void *)jarg2; + if (arg1) (arg1)->user_data = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_ivr_dmachine_match_user_data_get(void * jarg1) { + void * jresult ; + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + void *result = 0 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + result = (void *) ((arg1)->user_data); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_ivr_dmachine_match() { + void * jresult ; + switch_ivr_dmachine_match *result = 0 ; + + result = (switch_ivr_dmachine_match *)new switch_ivr_dmachine_match(); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_ivr_dmachine_match(void * jarg1) { + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + delete arg1; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_input_args_t_input_callback_set(void * jarg1, void * jarg2) { switch_input_args_t *arg1 = (switch_input_args_t *) 0 ; switch_input_callback_function_t arg2 = (switch_input_callback_function_t) 0 ; @@ -3970,6 +4147,28 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_input_args_t_user_data_get(void * ja } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_input_args_t_dmachine_set(void * jarg1, void * jarg2) { + switch_input_args_t *arg1 = (switch_input_args_t *) 0 ; + switch_ivr_dmachine_t *arg2 = (switch_ivr_dmachine_t *) 0 ; + + arg1 = (switch_input_args_t *)jarg1; + arg2 = (switch_ivr_dmachine_t *)jarg2; + if (arg1) (arg1)->dmachine = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_input_args_t_dmachine_get(void * jarg1) { + void * jresult ; + switch_input_args_t *arg1 = (switch_input_args_t *) 0 ; + switch_ivr_dmachine_t *result = 0 ; + + arg1 = (switch_input_args_t *)jarg1; + result = (switch_ivr_dmachine_t *) ((arg1)->dmachine); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_input_args_t() { void * jresult ; switch_input_args_t *result = 0 ; @@ -6841,6 +7040,28 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_soft_unlock(void * jarg1) } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_set_dmachine(void * jarg1, void * jarg2) { + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_ivr_dmachine_t *arg2 = (switch_ivr_dmachine_t *) 0 ; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (switch_ivr_dmachine_t *)jarg2; + switch_core_session_set_dmachine(arg1,arg2); +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_dmachine(void * jarg1) { + void * jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_ivr_dmachine_t *result = 0 ; + + arg1 = (switch_core_session_t *)jarg1; + result = (switch_ivr_dmachine_t *)switch_core_session_get_dmachine(arg1); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_get_uuid() { char * jresult ; char *result = 0 ; @@ -10211,6 +10432,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_in_thread(void * jarg1) { } +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_default_ptime(char * jarg1, unsigned long jarg2) { + unsigned long jresult ; + char *arg1 = (char *) 0 ; + uint32_t arg2 ; + uint32_t result; + + arg1 = (char *)jarg1; + arg2 = (uint32_t)jarg2; + result = (uint32_t)switch_default_ptime((char const *)arg1,arg2); + jresult = (unsigned long)result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_module_name_set(void * jarg1, char * jarg2) { switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; char *arg2 = (char *) 0 ; @@ -11833,20 +12068,6 @@ SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_char_to_rfc2833(char jarg1) { } -SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_default_ptime(char * jarg1, unsigned long jarg2) { - unsigned long jresult ; - char *arg1 = (char *) 0 ; - uint32_t arg2 ; - uint32_t result; - - arg1 = (char *)jarg1; - arg2 = (uint32_t)jarg2; - result = (uint32_t)switch_default_ptime((char const *)arg1,arg2); - jresult = (unsigned long)result; - return jresult; -} - - SWIGEXPORT char * SWIGSTDCALL CSharp_switch_sanitize_number(char * jarg1) { char * jresult ; char *arg1 = (char *) 0 ; @@ -26366,6 +26587,18 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_broadcast(char * jarg1, char * jarg } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_broadcast_in_thread(void * jarg1, char * jarg2, int jarg3) { + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + int arg3 ; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (int)jarg3; + switch_ivr_broadcast_in_thread(arg1,(char const *)arg2,arg3); +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_transfer_variable(void * jarg1, void * jarg2, char * jarg3) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -27026,6 +27259,176 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_uuid_exists(char * jarg1) { } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_create(void * jarg1, char * jarg2, void * jarg3, unsigned long jarg4, unsigned long jarg5, void * jarg6, void * jarg7, void * jarg8) { + int jresult ; + switch_ivr_dmachine_t **arg1 = (switch_ivr_dmachine_t **) 0 ; + char *arg2 = (char *) 0 ; + switch_memory_pool_t *arg3 = (switch_memory_pool_t *) 0 ; + uint32_t arg4 ; + uint32_t arg5 ; + switch_ivr_dmachine_callback_t arg6 = (switch_ivr_dmachine_callback_t) 0 ; + switch_ivr_dmachine_callback_t arg7 = (switch_ivr_dmachine_callback_t) 0 ; + void *arg8 = (void *) 0 ; + switch_status_t result; + + arg1 = (switch_ivr_dmachine_t **)jarg1; + arg2 = (char *)jarg2; + arg3 = (switch_memory_pool_t *)jarg3; + arg4 = (uint32_t)jarg4; + arg5 = (uint32_t)jarg5; + arg6 = (switch_ivr_dmachine_callback_t)jarg6; + arg7 = (switch_ivr_dmachine_callback_t)jarg7; + arg8 = (void *)jarg8; + result = (switch_status_t)switch_ivr_dmachine_create(arg1,(char const *)arg2,arg3,arg4,arg5,arg6,arg7,arg8); + jresult = result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_destroy(void * jarg1) { + switch_ivr_dmachine_t **arg1 = (switch_ivr_dmachine_t **) 0 ; + + arg1 = (switch_ivr_dmachine_t **)jarg1; + switch_ivr_dmachine_destroy(arg1); +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_bind(void * jarg1, char * jarg2, char * jarg3, int jarg4, void * jarg5, void * jarg6) { + int jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + int32_t arg4 ; + switch_ivr_dmachine_callback_t arg5 = (switch_ivr_dmachine_callback_t) 0 ; + void *arg6 = (void *) 0 ; + switch_status_t result; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + arg4 = (int32_t)jarg4; + arg5 = (switch_ivr_dmachine_callback_t)jarg5; + arg6 = (void *)jarg6; + result = (switch_status_t)switch_ivr_dmachine_bind(arg1,(char const *)arg2,(char const *)arg3,arg4,arg5,arg6); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_feed(void * jarg1, char * jarg2, void * jarg3) { + int jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_ivr_dmachine_match_t **arg3 = (switch_ivr_dmachine_match_t **) 0 ; + switch_status_t result; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (switch_ivr_dmachine_match_t **)jarg3; + result = (switch_status_t)switch_ivr_dmachine_feed(arg1,(char const *)arg2,arg3); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_clear(void * jarg1) { + int jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + switch_status_t result; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + result = (switch_status_t)switch_ivr_dmachine_clear(arg1); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_ping(void * jarg1, void * jarg2) { + int jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + switch_ivr_dmachine_match_t **arg2 = (switch_ivr_dmachine_match_t **) 0 ; + switch_status_t result; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (switch_ivr_dmachine_match_t **)jarg2; + result = (switch_status_t)switch_ivr_dmachine_ping(arg1,arg2); + jresult = result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_ivr_dmachine_get_match(void * jarg1) { + void * jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + switch_ivr_dmachine_match_t *result = 0 ; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + result = (switch_ivr_dmachine_match_t *)switch_ivr_dmachine_get_match(arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_ivr_dmachine_get_failed_digits(void * jarg1) { + char * jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + char *result = 0 ; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + result = (char *)switch_ivr_dmachine_get_failed_digits(arg1); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_set_digit_timeout_ms(void * jarg1, unsigned long jarg2) { + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + uint32_t arg2 ; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (uint32_t)jarg2; + switch_ivr_dmachine_set_digit_timeout_ms(arg1,arg2); +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_set_input_timeout_ms(void * jarg1, unsigned long jarg2) { + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + uint32_t arg2 ; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (uint32_t)jarg2; + switch_ivr_dmachine_set_input_timeout_ms(arg1,arg2); +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_clear_realm(void * jarg1, char * jarg2) { + int jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (char *)jarg2; + result = (switch_status_t)switch_ivr_dmachine_clear_realm(arg1,(char const *)arg2); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_set_realm(void * jarg1, char * jarg2) { + int jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (char *)jarg2; + result = (switch_status_t)switch_ivr_dmachine_set_realm(arg1,(char const *)arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RTP_MAX_BUF_LEN_get() { int jresult ; int result; diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index 1d89787ebb..682b3bd0c5 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -440,6 +440,22 @@ public class CoreSession : IDisposable { namespace FreeSWITCH.Native { +public enum dm_match_type_t { + DM_MATCH_POSITIVE, + DM_MATCH_NEGATIVE +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.0 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + using System; using System.Runtime.InteropServices; @@ -509,6 +525,21 @@ public class DTMF : IDisposable { namespace FreeSWITCH.Native { +public enum dtmf_flag_t { + DTMF_FLAG_SKIP_PROCESS = (1 << 0) +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.0 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + using System; using System.Runtime.InteropServices; @@ -1301,6 +1332,16 @@ public class freeswitch { freeswitchPINVOKE.switch_core_session_soft_unlock(SWIGTYPE_p_switch_core_session.getCPtr(session)); } + public static void switch_core_session_set_dmachine(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_switch_ivr_dmachine dmachine) { + freeswitchPINVOKE.switch_core_session_set_dmachine(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine)); + } + + public static SWIGTYPE_p_switch_ivr_dmachine switch_core_session_get_dmachine(SWIGTYPE_p_switch_core_session session) { + IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_dmachine(SWIGTYPE_p_switch_core_session.getCPtr(session)); + SWIGTYPE_p_switch_ivr_dmachine ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_ivr_dmachine(cPtr, false); + return ret; + } + public static string switch_core_get_uuid() { string ret = freeswitchPINVOKE.switch_core_get_uuid(); return ret; @@ -2314,6 +2355,11 @@ public class freeswitch { return ret; } + public static uint switch_default_ptime(string name, uint number) { + uint ret = freeswitchPINVOKE.switch_default_ptime(name, number); + return ret; + } + public static switch_status_t switch_loadable_module_init(switch_bool_t autoload) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_init((int)autoload); return ret; @@ -2735,11 +2781,6 @@ public class freeswitch { return ret; } - public static uint switch_default_ptime(string name, uint number) { - uint ret = freeswitchPINVOKE.switch_default_ptime(name, number); - return ret; - } - public static string switch_sanitize_number(string number) { string ret = freeswitchPINVOKE.switch_sanitize_number(number); return ret; @@ -4144,6 +4185,10 @@ public class freeswitch { return ret; } + public static void switch_ivr_broadcast_in_thread(SWIGTYPE_p_switch_core_session session, string app, int flags) { + freeswitchPINVOKE.switch_ivr_broadcast_in_thread(SWIGTYPE_p_switch_core_session.getCPtr(session), app, flags); + } + public static switch_status_t switch_ivr_transfer_variable(SWIGTYPE_p_switch_core_session sessa, SWIGTYPE_p_switch_core_session sessb, string var) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_transfer_variable(SWIGTYPE_p_switch_core_session.getCPtr(sessa), SWIGTYPE_p_switch_core_session.getCPtr(sessb), var); return ret; @@ -4348,6 +4393,64 @@ public class freeswitch { return ret; } + public static switch_status_t switch_ivr_dmachine_create(SWIGTYPE_p_p_switch_ivr_dmachine dmachine_p, string name, SWIGTYPE_p_apr_pool_t pool, uint digit_timeout, uint input_timeout, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t match_callback, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t nonmatch_callback, SWIGTYPE_p_void user_data) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_create(SWIGTYPE_p_p_switch_ivr_dmachine.getCPtr(dmachine_p), name, SWIGTYPE_p_apr_pool_t.getCPtr(pool), digit_timeout, input_timeout, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(match_callback), SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(nonmatch_callback), SWIGTYPE_p_void.getCPtr(user_data)); + return ret; + } + + public static void switch_ivr_dmachine_destroy(SWIGTYPE_p_p_switch_ivr_dmachine dmachine) { + freeswitchPINVOKE.switch_ivr_dmachine_destroy(SWIGTYPE_p_p_switch_ivr_dmachine.getCPtr(dmachine)); + } + + public static switch_status_t switch_ivr_dmachine_bind(SWIGTYPE_p_switch_ivr_dmachine dmachine, string realm, string digits, int key, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t callback, SWIGTYPE_p_void user_data) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_bind(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), realm, digits, key, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(callback), SWIGTYPE_p_void.getCPtr(user_data)); + return ret; + } + + public static switch_status_t switch_ivr_dmachine_feed(SWIGTYPE_p_switch_ivr_dmachine dmachine, string digits, SWIGTYPE_p_p_switch_ivr_dmachine_match match) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_feed(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), digits, SWIGTYPE_p_p_switch_ivr_dmachine_match.getCPtr(match)); + return ret; + } + + public static switch_status_t switch_ivr_dmachine_clear(SWIGTYPE_p_switch_ivr_dmachine dmachine) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_clear(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine)); + return ret; + } + + public static switch_status_t switch_ivr_dmachine_ping(SWIGTYPE_p_switch_ivr_dmachine dmachine, SWIGTYPE_p_p_switch_ivr_dmachine_match match_p) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_ping(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), SWIGTYPE_p_p_switch_ivr_dmachine_match.getCPtr(match_p)); + return ret; + } + + public static switch_ivr_dmachine_match switch_ivr_dmachine_get_match(SWIGTYPE_p_switch_ivr_dmachine dmachine) { + IntPtr cPtr = freeswitchPINVOKE.switch_ivr_dmachine_get_match(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine)); + switch_ivr_dmachine_match ret = (cPtr == IntPtr.Zero) ? null : new switch_ivr_dmachine_match(cPtr, false); + return ret; + } + + public static string switch_ivr_dmachine_get_failed_digits(SWIGTYPE_p_switch_ivr_dmachine dmachine) { + string ret = freeswitchPINVOKE.switch_ivr_dmachine_get_failed_digits(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine)); + return ret; + } + + public static void switch_ivr_dmachine_set_digit_timeout_ms(SWIGTYPE_p_switch_ivr_dmachine dmachine, uint digit_timeout_ms) { + freeswitchPINVOKE.switch_ivr_dmachine_set_digit_timeout_ms(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), digit_timeout_ms); + } + + public static void switch_ivr_dmachine_set_input_timeout_ms(SWIGTYPE_p_switch_ivr_dmachine dmachine, uint input_timeout_ms) { + freeswitchPINVOKE.switch_ivr_dmachine_set_input_timeout_ms(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), input_timeout_ms); + } + + public static switch_status_t switch_ivr_dmachine_clear_realm(SWIGTYPE_p_switch_ivr_dmachine dmachine, string realm) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_clear_realm(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), realm); + return ret; + } + + public static switch_status_t switch_ivr_dmachine_set_realm(SWIGTYPE_p_switch_ivr_dmachine dmachine, string realm) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_set_realm(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), realm); + return ret; + } + public static switch_status_t switch_rtp_add_crypto_key(SWIGTYPE_p_switch_rtp rtp_session, switch_rtp_crypto_direction_t direction, uint index, switch_rtp_crypto_key_type_t type, SWIGTYPE_p_unsigned_char key, SWIGTYPE_p_switch_size_t keylen) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_add_crypto_key(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), (int)direction, index, (int)type, SWIGTYPE_p_unsigned_char.getCPtr(key), SWIGTYPE_p_switch_size_t.getCPtr(keylen)); if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); @@ -5188,6 +5291,7 @@ public class freeswitch { public static readonly string SWITCH_CURRENT_APPLICATION_VARIABLE = freeswitchPINVOKE.SWITCH_CURRENT_APPLICATION_VARIABLE_get(); public static readonly string SWITCH_CURRENT_APPLICATION_DATA_VARIABLE = freeswitchPINVOKE.SWITCH_CURRENT_APPLICATION_DATA_VARIABLE_get(); public static readonly string SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE = freeswitchPINVOKE.SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE_get(); + public static readonly string SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE = freeswitchPINVOKE.SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE_get(); public static readonly string SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE = freeswitchPINVOKE.SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE_get(); public static readonly string SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE = freeswitchPINVOKE.SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE_get(); public static readonly string SWITCH_READ_RESULT_VARIABLE = freeswitchPINVOKE.SWITCH_READ_RESULT_VARIABLE_get(); @@ -5264,6 +5368,7 @@ public class freeswitch { public static readonly int SWITCH_CORE_QUEUE_LEN = freeswitchPINVOKE.SWITCH_CORE_QUEUE_LEN_get(); public static readonly int SWITCH_MAX_MANAGEMENT_BUFFER_LEN = freeswitchPINVOKE.SWITCH_MAX_MANAGEMENT_BUFFER_LEN_get(); public static readonly int SWITCH_RTP_CNG_PAYLOAD = freeswitchPINVOKE.SWITCH_RTP_CNG_PAYLOAD_get(); + public static readonly int DMACHINE_MAX_DIGIT_LEN = freeswitchPINVOKE.DMACHINE_MAX_DIGIT_LEN_get(); public static readonly int SWITCH_API_VERSION = freeswitchPINVOKE.SWITCH_API_VERSION_get(); public static readonly int SWITCH_CORE_DB_OK = freeswitchPINVOKE.SWITCH_CORE_DB_OK_get(); public static readonly int SWITCH_CORE_DB_ERROR = freeswitchPINVOKE.SWITCH_CORE_DB_ERROR_get(); @@ -5714,6 +5819,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE_get")] public static extern string SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE_get")] + public static extern string SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE_get")] public static extern string SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE_get(); @@ -5915,6 +6023,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_dtmf_t_duration_get")] public static extern uint switch_dtmf_t_duration_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_dtmf_t_flags_set")] + public static extern void switch_dtmf_t_flags_set(HandleRef jarg1, int jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_dtmf_t_flags_get")] + public static extern int switch_dtmf_t_flags_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_dtmf_t")] public static extern IntPtr new_switch_dtmf_t(); @@ -6470,6 +6584,45 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_console_callback_match")] public static extern void delete_switch_console_callback_match(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_DMACHINE_MAX_DIGIT_LEN_get")] + public static extern int DMACHINE_MAX_DIGIT_LEN_get(); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_dmachine_set")] + public static extern void switch_ivr_dmachine_match_dmachine_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_dmachine_get")] + public static extern IntPtr switch_ivr_dmachine_match_dmachine_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_match_digits_set")] + public static extern void switch_ivr_dmachine_match_match_digits_set(HandleRef jarg1, string jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_match_digits_get")] + public static extern string switch_ivr_dmachine_match_match_digits_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_match_key_set")] + public static extern void switch_ivr_dmachine_match_match_key_set(HandleRef jarg1, int jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_match_key_get")] + public static extern int switch_ivr_dmachine_match_match_key_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_type_set")] + public static extern void switch_ivr_dmachine_match_type_set(HandleRef jarg1, int jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_type_get")] + public static extern int switch_ivr_dmachine_match_type_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_user_data_set")] + public static extern void switch_ivr_dmachine_match_user_data_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_user_data_get")] + public static extern IntPtr switch_ivr_dmachine_match_user_data_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_ivr_dmachine_match")] + public static extern IntPtr new_switch_ivr_dmachine_match(); + + [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_ivr_dmachine_match")] + public static extern void delete_switch_ivr_dmachine_match(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_input_callback_set")] public static extern void switch_input_args_t_input_callback_set(HandleRef jarg1, HandleRef jarg2); @@ -6500,6 +6653,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_user_data_get")] public static extern IntPtr switch_input_args_t_user_data_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_dmachine_set")] + public static extern void switch_input_args_t_dmachine_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_dmachine_get")] + public static extern IntPtr switch_input_args_t_dmachine_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_input_args_t")] public static extern IntPtr new_switch_input_args_t(); @@ -7202,6 +7361,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_soft_unlock")] public static extern void switch_core_session_soft_unlock(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_dmachine")] + public static extern void switch_core_session_set_dmachine(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_dmachine")] + public static extern IntPtr switch_core_session_get_dmachine(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_get_uuid")] public static extern string switch_core_get_uuid(); @@ -7970,6 +8135,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_in_thread")] public static extern int switch_core_session_in_thread(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_default_ptime")] + public static extern uint switch_default_ptime(string jarg1, uint jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_module_name_set")] public static extern void switch_loadable_module_interface_module_name_set(HandleRef jarg1, string jarg2); @@ -8336,9 +8504,6 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_char_to_rfc2833")] public static extern byte switch_char_to_rfc2833(char jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_switch_default_ptime")] - public static extern uint switch_default_ptime(string jarg1, uint jarg2); - [DllImport("mod_managed", EntryPoint="CSharp_switch_sanitize_number")] public static extern string switch_sanitize_number(string jarg1); @@ -11849,6 +12014,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_broadcast")] public static extern int switch_ivr_broadcast(string jarg1, string jarg2, uint jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_broadcast_in_thread")] + public static extern void switch_ivr_broadcast_in_thread(HandleRef jarg1, string jarg2, int jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_transfer_variable")] public static extern int switch_ivr_transfer_variable(HandleRef jarg1, HandleRef jarg2, string jarg3); @@ -11972,6 +12140,42 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_uuid_exists")] public static extern int switch_ivr_uuid_exists(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_create")] + public static extern int switch_ivr_dmachine_create(HandleRef jarg1, string jarg2, HandleRef jarg3, uint jarg4, uint jarg5, HandleRef jarg6, HandleRef jarg7, HandleRef jarg8); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_destroy")] + public static extern void switch_ivr_dmachine_destroy(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_bind")] + public static extern int switch_ivr_dmachine_bind(HandleRef jarg1, string jarg2, string jarg3, int jarg4, HandleRef jarg5, HandleRef jarg6); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_feed")] + public static extern int switch_ivr_dmachine_feed(HandleRef jarg1, string jarg2, HandleRef jarg3); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_clear")] + public static extern int switch_ivr_dmachine_clear(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_ping")] + public static extern int switch_ivr_dmachine_ping(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_get_match")] + public static extern IntPtr switch_ivr_dmachine_get_match(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_get_failed_digits")] + public static extern string switch_ivr_dmachine_get_failed_digits(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_set_digit_timeout_ms")] + public static extern void switch_ivr_dmachine_set_digit_timeout_ms(HandleRef jarg1, uint jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_set_input_timeout_ms")] + public static extern void switch_ivr_dmachine_set_input_timeout_ms(HandleRef jarg1, uint jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_clear_realm")] + public static extern int switch_ivr_dmachine_clear_realm(HandleRef jarg1, string jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_set_realm")] + public static extern int switch_ivr_dmachine_set_realm(HandleRef jarg1, string jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RTP_MAX_BUF_LEN_get")] public static extern int SWITCH_RTP_MAX_BUF_LEN_get(); @@ -15466,6 +15670,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.0 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_f_p_switch_ivr_menu_p_char_p_char_size_t_p_void__switch_ivr_action_t { private HandleRef swigCPtr; @@ -16846,6 +17080,66 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_p_switch_ivr_dmachine { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_ivr_dmachine(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_ivr_dmachine() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_dmachine obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.0 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + +public class SWIGTYPE_p_p_switch_ivr_dmachine_match { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_ivr_dmachine_match(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_ivr_dmachine_match() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_dmachine_match obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.0 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_p_switch_ivr_menu { private HandleRef swigCPtr; @@ -17686,6 +17980,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_switch_ivr_dmachine { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_ivr_dmachine(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_ivr_dmachine() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_switch_ivr_dmachine obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.0 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_switch_ivr_menu { private HandleRef swigCPtr; @@ -20927,6 +21251,8 @@ public enum switch_channel_flag_t { CF_EARLY_HANGUP, CF_MEDIA_SET, CF_CONSUME_ON_ORIGINATE, + CF_PASSTHRU_PTIME_MISMATCH, + CF_BRIDGE_NOWRITE, CF_FLAG_MAX } @@ -23499,6 +23825,16 @@ public class switch_dtmf_t : IDisposable { } } + public int flags { + set { + freeswitchPINVOKE.switch_dtmf_t_flags_set(swigCPtr, value); + } + get { + int ret = freeswitchPINVOKE.switch_dtmf_t_flags_get(swigCPtr); + return ret; + } + } + public switch_dtmf_t() : this(freeswitchPINVOKE.new_switch_dtmf_t(), true) { } @@ -25078,6 +25414,17 @@ public class switch_input_args_t : IDisposable { } } + public SWIGTYPE_p_switch_ivr_dmachine dmachine { + set { + freeswitchPINVOKE.switch_input_args_t_dmachine_set(swigCPtr, SWIGTYPE_p_switch_ivr_dmachine.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_input_args_t_dmachine_get(swigCPtr); + SWIGTYPE_p_switch_ivr_dmachine ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_ivr_dmachine(cPtr, false); + return ret; + } + } + public switch_input_args_t() : this(freeswitchPINVOKE.new_switch_input_args_t(), true) { } @@ -26387,6 +26734,107 @@ public enum switch_ivr_action_t { namespace FreeSWITCH.Native { +using System; +using System.Runtime.InteropServices; + +public class switch_ivr_dmachine_match : IDisposable { + private HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal switch_ivr_dmachine_match(IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new HandleRef(this, cPtr); + } + + internal static HandleRef getCPtr(switch_ivr_dmachine_match obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } + + ~switch_ivr_dmachine_match() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if (swigCPtr.Handle != IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_switch_ivr_dmachine_match(swigCPtr); + } + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + GC.SuppressFinalize(this); + } + } + + public SWIGTYPE_p_switch_ivr_dmachine dmachine { + set { + freeswitchPINVOKE.switch_ivr_dmachine_match_dmachine_set(swigCPtr, SWIGTYPE_p_switch_ivr_dmachine.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_ivr_dmachine_match_dmachine_get(swigCPtr); + SWIGTYPE_p_switch_ivr_dmachine ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_ivr_dmachine(cPtr, false); + return ret; + } + } + + public string match_digits { + set { + freeswitchPINVOKE.switch_ivr_dmachine_match_match_digits_set(swigCPtr, value); + } + get { + string ret = freeswitchPINVOKE.switch_ivr_dmachine_match_match_digits_get(swigCPtr); + return ret; + } + } + + public int match_key { + set { + freeswitchPINVOKE.switch_ivr_dmachine_match_match_key_set(swigCPtr, value); + } + get { + int ret = freeswitchPINVOKE.switch_ivr_dmachine_match_match_key_get(swigCPtr); + return ret; + } + } + + public dm_match_type_t type { + set { + freeswitchPINVOKE.switch_ivr_dmachine_match_type_set(swigCPtr, (int)value); + } + get { + dm_match_type_t ret = (dm_match_type_t)freeswitchPINVOKE.switch_ivr_dmachine_match_type_get(swigCPtr); + return ret; + } + } + + public SWIGTYPE_p_void user_data { + set { + freeswitchPINVOKE.switch_ivr_dmachine_match_user_data_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_ivr_dmachine_match_user_data_get(swigCPtr); + SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false); + return ret; + } + } + + public switch_ivr_dmachine_match() : this(freeswitchPINVOKE.new_switch_ivr_dmachine_match(), true) { + } + +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.0 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + public enum switch_ivr_menu_flags { SWITCH_IVR_MENU_FLAG_FALLTOMAIN = (1 << 0), SWITCH_IVR_MENU_FLAG_FREEPOOL = (1 << 1), @@ -29377,6 +29825,7 @@ public enum switch_status_t { SWITCH_STATUS_NOUNLOAD, SWITCH_STATUS_IGNORE, SWITCH_STATUS_TOO_SMALL, + SWITCH_STATUS_FOUND, SWITCH_STATUS_NOT_INITALIZED } From 55960b558c1264ca10080162c39a33919a7eea42 Mon Sep 17 00:00:00 2001 From: Michal Bielicki Date: Sat, 9 Oct 2010 05:10:52 +0200 Subject: [PATCH 36/46] first go at new codecs and fretdm --- freeswitch.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/freeswitch.spec b/freeswitch.spec index c4bfa8431b..69daa1d29c 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -65,7 +65,7 @@ Source8: http://files.freeswitch.org/downloads/libs/soundtouch-1.3.1.tar.gz Source9: http://files.freeswitch.org/downloads/libs/sphinxbase-0.4.99-20091212.tar.gz Source10: http://files.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.tar.gz Source11: http://files.freeswitch.org/downloads/libs/libmemcached-0.32.tar.gz -Prefix: %{prefix} +Prefix: %{prefix} ###################################################################################################################### @@ -115,6 +115,8 @@ Requires: openldap Requires: db4 Requires: gdbm Requires: zlib +Requires: libtiff +Requires: python %if %{?suse_version:1}0 %if 0%{?suse_version} > 910 @@ -342,7 +344,8 @@ ASR_TTS_MODULES="asr_tts/mod_pocketsphinx asr_tts/mod_flite asr_tts/mod_unimrcp" # Codecs # ###################################################################################################################### -CODECS_MODULES="codecs/mod_ilbc codecs/mod_h26x codecs/mod_speex codecs/mod_celt codecs/mod_siren codecs/mod_bv" +CODECS_MODULES="codecs/mod_bv codecs/mod_h26x codecs/mod_speex codecs/mod_celt codecs/mod_codec2 codecs/mod_ilbc codecs/mod_mp4 \ + codec/mod_silk codecs/mod_siren codecs/mod_theora" ###################################################################################################################### # # Dialplan Modules From 1a4ee982fbf3bcfd348c8928d85dd4410aa3d48c Mon Sep 17 00:00:00 2001 From: Michal Bielicki Date: Sat, 9 Oct 2010 09:07:48 +0200 Subject: [PATCH 37/46] freeswitch.spec moved to support freetdm instead of openzap including hooks to compile with libsng_isdn and wanpipe. Added mod_silk, mod_codec2 mod_cidlookup, mod_mp4v. Added runtime requirements and build dependencies. This one is a major change --- freeswitch.spec | 107 ++++++++++++++++++++++++++++++------------------ 1 file changed, 67 insertions(+), 40 deletions(-) diff --git a/freeswitch.spec b/freeswitch.spec index 69daa1d29c..a2c975b5a9 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -5,7 +5,7 @@ # # includes module(s): freeswitch-devel freeswitch-codec-passthru-amr freeswitch-codec-passthru-amrwb freeswitch-codec-passthru-g729 # freeswitch-codec-passthru-g7231 freeswitch-lua freeswitch-perl freeswitch-python freeswitch-spidermonkey -# freeswitch-lan-de freeswitch-lang-en freeswitch-lang-fr freeswitch-lang-ru freeswitch-openzap +# freeswitch-lan-de freeswitch-lang-en freeswitch-lang-fr freeswitch-lang-ru freeswitch-freetdm # # Initial Version Copyright (C) 2007 Peter Nixon and Michal Bielicki, All Rights Reserved. # @@ -54,23 +54,23 @@ Vendor: http://www.freeswitch.org/ # ###################################################################################################################### Source0: http://files.freeswitch.org/%{name}-%{version}.tar.bz2 -Source1: http://files.freeswitch.org/downloads/libs/celt-0.7.1.tar.gz -Source2: http://files.freeswitch.org/downloads/libs/flite-1.3.99-latest.tar.gz -Source3: http://files.freeswitch.org/downloads/libs/lame-3.97.tar.gz -Source4: http://files.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz -Source5: http://files.freeswitch.org/downloads/libs/mpg123.tar.gz -Source6: http://files.freeswitch.org/downloads/libs/openldap-2.4.11.tar.gz -Source7: http://files.freeswitch.org/downloads/libs/pocketsphinx-0.5.99-20091212.tar.gz -Source8: http://files.freeswitch.org/downloads/libs/soundtouch-1.3.1.tar.gz -Source9: http://files.freeswitch.org/downloads/libs/sphinxbase-0.4.99-20091212.tar.gz -Source10: http://files.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.tar.gz -Source11: http://files.freeswitch.org/downloads/libs/libmemcached-0.32.tar.gz -Prefix: %{prefix} +Source1: http://files.freeswitch.org/downloads/libs/celt-0.7.1.tar.gz +Source2: http://files.freeswitch.org/downloads/libs/flite-1.3.99-latest.tar.gz +Source3: http://files.freeswitch.org/downloads/libs/lame-3.97.tar.gz +Source4: http://files.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz +Source5: http://files.freeswitch.org/downloads/libs/mpg123.tar.gz +Source6: http://files.freeswitch.org/downloads/libs/openldap-2.4.11.tar.gz +Source7: http://files.freeswitch.org/downloads/libs/pocketsphinx-0.5.99-20091212.tar.gz +Source8: http://files.freeswitch.org/downloads/libs/soundtouch-1.3.1.tar.gz +Source9: http://files.freeswitch.org/downloads/libs/sphinxbase-0.4.99-20091212.tar.gz +Source10: http://files.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.tar.gz +Source11: http://files.freeswitch.org/downloads/libs/libmemcached-0.32.tar.gz +Prefix: %{prefix} ###################################################################################################################### # -# Build Dependencies +# Build Dependencies # ###################################################################################################################### @@ -103,6 +103,7 @@ BuildRequires: alsa-lib-devel BuildRequires: which BuildRequires: zlib-devel BuildRequires: e2fsprogs-devel +BuildRequires: libtheora-devel Requires: alsa-lib Requires: libogg Requires: libvorbis @@ -117,6 +118,7 @@ Requires: gdbm Requires: zlib Requires: libtiff Requires: python +Requires: libtheora %if %{?suse_version:1}0 %if 0%{?suse_version} > 910 @@ -271,13 +273,17 @@ Group: System/LibrariesRequires: %{name} = %{version}-%{release} German language phrases module and directory structure for say module and voicemail -%package openzap +%package freetdm Summary: Provides a unified interface to hardware TDM cards and ss7 stacks for FreeSWITCH Group: System/Libraries Requires: %{name} = %{version}-%{release} +%{?with_sang_isdn: Requires: wanpipe } +%{?with_sang_isdn: Requires: libsng_isdn } +%{?with_sang_isdn: BuildRequires: wanpipe } +%{?with_sang_isdn: BuildRequires: libang_isdn } -%description openzap -OpenZAP +%description freetdm +FreeTDM ###################################################################################################################### # @@ -324,13 +330,15 @@ export QA_RPATHS=$[ 0x0001|0x0002 ] # Application Modules # ###################################################################################################################### -APPLICATION_MODULES_AE="applications/mod_avmd applications/mod_callcenter applications/mod_cluechoo applications/mod_commands applications/mod_conference applications/mod_db applications/mod_directory applications/mod_distributor applications/mod_dptools applications/mod_easyroute applications/mod_enum applications/mod_esf applications/mod_expr" - -APPLICATION_MODULES_FM="applications/mod_fifo applications/mod_fsv applications/mod_hash applications/mod_lcr applications/mod_limit applications/mod_memcache" - -APPLICATION_MODULES_NY="applications/mod_nibblebill applications/mod_redis applications/mod_rss applications/mod_soundtouch applications/mod_spandsp applications/mod_stress applications/mod_spy " - -APPLICATION_MODULES_VZ="applications/mod_valet_parking applications/mod_vmd applications/mod_voicemail" +APPLICATION_MODULES_AE="applications/mod_avmd applications/mod_callcenter applications/mod_cidlookup applications/mod_cluechoo \ + applications/mod_commands applications/mod_conference applications/mod_db applications/mod_directory \ + applications/mod_distributor applications/mod_dptools applications/mod_easyroute applications/mod_enum \ + applications/mod_esf applications/mod_expr" +APPLICATION_MODULES_FM="applications/mod_fifo applications/mod_fsv applications/mod_hash applications/mod_lcr applications/mod_limit \ + applications/mod_memcache" +APPLICATION_MODULES_NY="applications/mod_nibblebill applications/mod_redis applications/mod_rss applications/mod_snom \ + applications/mod_soundtouch applications/mod_spandsp applications/mod_spy applications/mod_stress \ + applications/mod_valet_parking applications/mod_vmd applications/mod_voicemail" APPLICATIONS_MODULES="$APPLICATION_MODULES_AE $APPLICATION_MODULES_FM $APPLICATION_MODULES_NY $APPLICATION_MODULES_VZ" ###################################################################################################################### @@ -344,8 +352,8 @@ ASR_TTS_MODULES="asr_tts/mod_pocketsphinx asr_tts/mod_flite asr_tts/mod_unimrcp" # Codecs # ###################################################################################################################### -CODECS_MODULES="codecs/mod_bv codecs/mod_h26x codecs/mod_speex codecs/mod_celt codecs/mod_codec2 codecs/mod_ilbc codecs/mod_mp4 \ - codec/mod_silk codecs/mod_siren codecs/mod_theora" +CODECS_MODULES="codecs/mod_bv codecs/mod_h26x codecs/mod_speex codecs/mod_celt codecs/mod_codec2 codecs/mod_ilbc codecs/mod_mp4v \ + codecs/mod_silk codecs/mod_siren codecs/mod_theora" ###################################################################################################################### # # Dialplan Modules @@ -363,19 +371,23 @@ DIRECTORIES_MODULES="" # Endpoints # ###################################################################################################################### -ENDPOINTS_MODULES="endpoints/mod_dingaling endpoints/mod_portaudio endpoints/mod_sofia ../../libs/openzap/mod_openzap endpoints/mod_loopback" +ENDPOINTS_MODULES="endpoints/mod_dingaling endpoints/mod_loopback ../../libs/freetdm/mod_freetdm endpoints/mod_portaudio \ + endpoints/mod_sofia" + ###################################################################################################################### # # Event Handlers # ###################################################################################################################### -EVENT_HANDLERS_MODULES="event_handlers/mod_event_multicast event_handlers/mod_event_socket event_handlers/mod_cdr_csv" +EVENT_HANDLERS_MODULES="event_handlers/mod_cdr_csv event_handlers/mod_event_socket event_handlers/mod_event_multicast" ###################################################################################################################### # # File and Audio Format Handlers # ###################################################################################################################### -FORMATS_MODULES="formats/mod_local_stream formats/mod_native_file formats/mod_sndfile formats/mod_portaudio_stream formats/mod_tone_stream formats/mod_shout formats/mod_file_string" +FORMATS_MODULES="formats/mod_file_string formats/mod_local_stream formats/mod_native_file formats/mod_portaudio_stream \ + formats/mod_shout formats/mod_sndfile formats/mod_tone_stream" + ###################################################################################################################### # # Embedded Languages @@ -417,7 +429,9 @@ XML_INT_MODULES="xml_int/mod_xml_cdr xml_int/mod_xml_curl xml_int/mod_xml_rpc" # Create one environment variable out of all the module defs # ###################################################################################################################### -MYMODULES="$PASSTHRU_CODEC_MODULES $APPLICATIONS_MODULES $CODECS_MODULES $DIALPLANS_MODULES $DIRECTORIES_MODULES $ENDPOINTS_MODULES $ASR_TTS_MODULES $EVENT_HANDLERS_MODULES $FORMATS_MODULES $LANGUAGES_MODULES $LOGGERS_MODULES $SAY_MODULES $TIMERS_MODULES $XML_INT_MODULES" +MYMODULES="$PASSTHRU_CODEC_MODULES $APPLICATIONS_MODULES $CODECS_MODULES $DIALPLANS_MODULES $DIRECTORIES_MODULES \ +$ENDPOINTS_MODULES $ASR_TTS_MODULES $EVENT_HANDLERS_MODULES $FORMATS_MODULES $LANGUAGES_MODULES $LOGGERS_MODULES \ +$SAY_MODULES $TIMERS_MODULES $XML_INT_MODULES" ###################################################################################################################### # @@ -450,10 +464,10 @@ fi --prefix=%{prefix} \ --infodir=%{_infodir} \ --mandir=%{_mandir} \ - --sysconfdir=%{sysconfdir} \ - --libdir=%{prefix}/lib \ - --enable-core-libedit-support \ - --enable-core-odbc-support \ + --sysconfdir=%{sysconfdir} \ + --libdir=%{prefix}/lib \ + --enable-core-libedit-support \ + --enable-core-odbc-support \ %ifos linux %if 0%{?fedora_version} >= 8 %else @@ -733,7 +747,9 @@ fi %{prefix}/mod/mod_callcenter.so* %{prefix}/mod/mod_cdr_csv.so* %{prefix}/mod/mod_celt.so* +%{prefix}/mod/mod_cidlookup.so* %{prefix}/mod/mod_cluechoo.so* +%{prefix}/mod/mod_codec2.so* %{prefix}/mod/mod_console.so* %{prefix}/mod/mod_commands.so* %{prefix}/mod/mod_conference.so* @@ -764,6 +780,7 @@ fi %{prefix}/mod/mod_logfile.so* %{prefix}/mod/mod_loopback.so* %{prefix}/mod/mod_memcache.so* +%{prefix}/mod/mod_mp4v.so* %{prefix}/mod/mod_native_file.so* %{prefix}/mod/mod_nibblebill.so* %{prefix}/mod/mod_pocketsphinx.so* @@ -772,8 +789,10 @@ fi %{prefix}/mod/mod_redis.so* %{prefix}/mod/mod_rss.so* %{prefix}/mod/mod_shout.so* +%{prefix}/mod/mod_silk.so* %{prefix}/mod/mod_siren.so* %{prefix}/mod/mod_sndfile.so* +%{prefix}/mod/mod_snom.so* %{prefix}/mod/mod_sofia.so* %{prefix}/mod/mod_soundtouch.so* %{prefix}/mod/mod_spandsp.so* @@ -781,6 +800,7 @@ fi %{prefix}/mod/mod_spy.so* %{prefix}/mod/mod_stress.so* %{prefix}/mod/mod_syslog.so* +%{prefix}/mod/mod_theora.so* %{prefix}/mod/mod_tone_stream.so* %{prefix}/mod/mod_unimrcp.so* %{prefix}/mod/mod_valet_parking.so* @@ -807,17 +827,17 @@ fi # OpenZAP Module for TDM Interaction # ###################################################################################################################### -%files openzap +%files freetdm %defattr(-, freeswitch, daemon) %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/tones.conf -%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/openzap.conf.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/freetdm.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/pika.conf -%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/openzap.conf +%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/freetdm.conf %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/wanpipe.conf %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/zt.conf -%{prefix}/lib/libopenzap.so* -%{prefix}/mod/mod_openzap.so* -%{prefix}/mod/ozmod_*.so* +%{prefix}/lib/libfreetdm.so* +%{prefix}/mod/mod_freetdm.so* +%{prefix}/mod/ftm*.so* ###################################################################################################################### # @@ -929,6 +949,13 @@ fi # ###################################################################################################################### %changelog +* Sat Oct 09 2010 - michal.bielicki@seventhsignal.de +- added mod_silk +- added mod_codec2 +- moved from openzap to freetdm to make way for inclusion of libsng_isdn and wanpipe +- added mod_freetdm +- added mod_cidlookup +- added more runtime dependencies * Thu Sep 30 2010 - michal.bielicki@seventhsignal.de - added mod_nibblebill to standard modules * Sun Sep 26 2010 - michal.bielicki@seventhsignal.de From a82d424fbf320556a15923afb5059bcc5613ddf5 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 9 Oct 2010 09:00:23 -0500 Subject: [PATCH 38/46] swigall --- .../languages/mod_managed/freeswitch_wrap.cxx | 197 +++++++++++++++--- src/mod/languages/mod_managed/managed/swig.cs | 143 +++++++++++-- 2 files changed, 298 insertions(+), 42 deletions(-) diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index ad4d63d1f0..82ad8ab61b 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -1820,6 +1820,29 @@ SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_dtmf_t_duration_get(void * ja } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_dtmf_t_flags_set(void * jarg1, int jarg2) { + switch_dtmf_t *arg1 = (switch_dtmf_t *) 0 ; + int32_t arg2 ; + + arg1 = (switch_dtmf_t *)jarg1; + arg2 = (int32_t)jarg2; + if (arg1) (arg1)->flags = arg2; + +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_dtmf_t_flags_get(void * jarg1) { + int jresult ; + switch_dtmf_t *arg1 = (switch_dtmf_t *) 0 ; + int32_t result; + + arg1 = (switch_dtmf_t *)jarg1; + result = (int32_t) ((arg1)->flags); + jresult = result; + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_dtmf_t() { void * jresult ; switch_dtmf_t *result = 0 ; @@ -4075,6 +4098,17 @@ SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_console_callback_match(void * j } +SWIGEXPORT int SWIGSTDCALL CSharp_DMACHINE_MAX_DIGIT_LEN_get() { + int jresult ; + int result; + + result = (int) 512; + + jresult = result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_match_dmachine_set(void * jarg1, void * jarg2) { switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; switch_ivr_dmachine_t *arg2 = (switch_ivr_dmachine_t *) 0 ; @@ -4150,6 +4184,29 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_match_match_key_get(void * } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_match_type_set(void * jarg1, int jarg2) { + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + dm_match_type_t arg2 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + arg2 = (dm_match_type_t)jarg2; + if (arg1) (arg1)->type = arg2; + +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_match_type_get(void * jarg1) { + int jresult ; + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + dm_match_type_t result; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + result = (dm_match_type_t) ((arg1)->type); + jresult = result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_match_user_data_set(void * jarg1, void * jarg2) { switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; void *arg2 = (void *) 0 ; @@ -7273,6 +7330,28 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_soft_unlock(void * jarg1) } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_set_dmachine(void * jarg1, void * jarg2) { + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_ivr_dmachine_t *arg2 = (switch_ivr_dmachine_t *) 0 ; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (switch_ivr_dmachine_t *)jarg2; + switch_core_session_set_dmachine(arg1,arg2); +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_dmachine(void * jarg1) { + void * jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_ivr_dmachine_t *result = 0 ; + + arg1 = (switch_core_session_t *)jarg1; + result = (switch_ivr_dmachine_t *)switch_core_session_get_dmachine(arg1); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_get_uuid() { char * jresult ; char *result = 0 ; @@ -10649,6 +10728,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_in_thread(void * jarg1) { } +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_default_ptime(char * jarg1, unsigned long jarg2) { + unsigned long jresult ; + char *arg1 = (char *) 0 ; + uint32_t arg2 ; + uint32_t result; + + arg1 = (char *)jarg1; + arg2 = (uint32_t)jarg2; + result = (uint32_t)switch_default_ptime((char const *)arg1,arg2); + jresult = (unsigned long)result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_module_name_set(void * jarg1, char * jarg2) { switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; char *arg2 = (char *) 0 ; @@ -12292,20 +12385,6 @@ SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_char_to_rfc2833(char jarg1) { } -SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_default_ptime(char * jarg1, unsigned long jarg2) { - unsigned long jresult ; - char *arg1 = (char *) 0 ; - uint32_t arg2 ; - uint32_t result; - - arg1 = (char *)jarg1; - arg2 = (uint32_t)jarg2; - result = (uint32_t)switch_default_ptime((char const *)arg1,arg2); - jresult = (unsigned long)result; - return jresult; -} - - SWIGEXPORT char * SWIGSTDCALL CSharp_switch_sanitize_number(char * jarg1) { char * jresult ; char *arg1 = (char *) 0 ; @@ -27196,6 +27275,18 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_broadcast(char * jarg1, char * jarg } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_broadcast_in_thread(void * jarg1, char * jarg2, int jarg3) { + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + int arg3 ; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (int)jarg3; + switch_ivr_broadcast_in_thread(arg1,(char const *)arg2,arg3); +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_transfer_variable(void * jarg1, void * jarg2, char * jarg3) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -27856,19 +27947,27 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_uuid_exists(char * jarg1) { } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_create(void * jarg1, void * jarg2, unsigned long jarg3, unsigned long jarg4) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_create(void * jarg1, char * jarg2, void * jarg3, unsigned long jarg4, unsigned long jarg5, void * jarg6, void * jarg7, void * jarg8) { int jresult ; switch_ivr_dmachine_t **arg1 = (switch_ivr_dmachine_t **) 0 ; - switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ; - uint32_t arg3 ; + char *arg2 = (char *) 0 ; + switch_memory_pool_t *arg3 = (switch_memory_pool_t *) 0 ; uint32_t arg4 ; + uint32_t arg5 ; + switch_ivr_dmachine_callback_t arg6 = (switch_ivr_dmachine_callback_t) 0 ; + switch_ivr_dmachine_callback_t arg7 = (switch_ivr_dmachine_callback_t) 0 ; + void *arg8 = (void *) 0 ; switch_status_t result; arg1 = (switch_ivr_dmachine_t **)jarg1; - arg2 = (switch_memory_pool_t *)jarg2; - arg3 = (uint32_t)jarg3; + arg2 = (char *)jarg2; + arg3 = (switch_memory_pool_t *)jarg3; arg4 = (uint32_t)jarg4; - result = (switch_status_t)switch_ivr_dmachine_create(arg1,arg2,arg3,arg4); + arg5 = (uint32_t)jarg5; + arg6 = (switch_ivr_dmachine_callback_t)jarg6; + arg7 = (switch_ivr_dmachine_callback_t)jarg7; + arg8 = (void *)jarg8; + result = (switch_status_t)switch_ivr_dmachine_create(arg1,(char const *)arg2,arg3,arg4,arg5,arg6,arg7,arg8); jresult = result; return jresult; } @@ -27882,21 +27981,23 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_destroy(void * jarg1) { } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_bind(void * jarg1, char * jarg2, int jarg3, void * jarg4, void * jarg5) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_bind(void * jarg1, char * jarg2, char * jarg3, int jarg4, void * jarg5, void * jarg6) { int jresult ; switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; char *arg2 = (char *) 0 ; - int32_t arg3 ; - switch_ivr_dmachine_callback_t arg4 = (switch_ivr_dmachine_callback_t) 0 ; - void *arg5 = (void *) 0 ; + char *arg3 = (char *) 0 ; + int32_t arg4 ; + switch_ivr_dmachine_callback_t arg5 = (switch_ivr_dmachine_callback_t) 0 ; + void *arg6 = (void *) 0 ; switch_status_t result; arg1 = (switch_ivr_dmachine_t *)jarg1; arg2 = (char *)jarg2; - arg3 = (int32_t)jarg3; - arg4 = (switch_ivr_dmachine_callback_t)jarg4; - arg5 = (void *)jarg5; - result = (switch_status_t)switch_ivr_dmachine_bind(arg1,(char const *)arg2,arg3,arg4,arg5); + arg3 = (char *)jarg3; + arg4 = (int32_t)jarg4; + arg5 = (switch_ivr_dmachine_callback_t)jarg5; + arg6 = (void *)jarg6; + result = (switch_status_t)switch_ivr_dmachine_bind(arg1,(char const *)arg2,(char const *)arg3,arg4,arg5,arg6); jresult = result; return jresult; } @@ -27956,6 +28057,18 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_ivr_dmachine_get_match(void * jarg1) } +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_ivr_dmachine_get_failed_digits(void * jarg1) { + char * jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + char *result = 0 ; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + result = (char *)switch_ivr_dmachine_get_failed_digits(arg1); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_set_digit_timeout_ms(void * jarg1, unsigned long jarg2) { switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; uint32_t arg2 ; @@ -27976,6 +28089,34 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_set_input_timeout_ms(void } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_clear_realm(void * jarg1, char * jarg2) { + int jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (char *)jarg2; + result = (switch_status_t)switch_ivr_dmachine_clear_realm(arg1,(char const *)arg2); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_set_realm(void * jarg1, char * jarg2) { + int jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (char *)jarg2; + result = (switch_status_t)switch_ivr_dmachine_set_realm(arg1,(char const *)arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RTP_MAX_BUF_LEN_get() { int jresult ; int result; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index a1b556bb8a..2beb015ffc 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -436,6 +436,22 @@ public class CoreSession : IDisposable { namespace FreeSWITCH.Native { +public enum dm_match_type_t { + DM_MATCH_POSITIVE, + DM_MATCH_NEGATIVE +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + using System; using System.Runtime.InteropServices; @@ -503,6 +519,21 @@ public class DTMF : IDisposable { namespace FreeSWITCH.Native { +public enum dtmf_flag_t { + DTMF_FLAG_SKIP_PROCESS = (1 << 0) +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + using System; using System.Runtime.InteropServices; @@ -1291,6 +1322,16 @@ public class freeswitch { freeswitchPINVOKE.switch_core_session_soft_unlock(SWIGTYPE_p_switch_core_session.getCPtr(session)); } + public static void switch_core_session_set_dmachine(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_switch_ivr_dmachine dmachine) { + freeswitchPINVOKE.switch_core_session_set_dmachine(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine)); + } + + public static SWIGTYPE_p_switch_ivr_dmachine switch_core_session_get_dmachine(SWIGTYPE_p_switch_core_session session) { + IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_dmachine(SWIGTYPE_p_switch_core_session.getCPtr(session)); + SWIGTYPE_p_switch_ivr_dmachine ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_ivr_dmachine(cPtr, false); + return ret; + } + public static string switch_core_get_uuid() { string ret = freeswitchPINVOKE.switch_core_get_uuid(); return ret; @@ -2304,6 +2345,11 @@ public class freeswitch { return ret; } + public static uint switch_default_ptime(string name, uint number) { + uint ret = freeswitchPINVOKE.switch_default_ptime(name, number); + return ret; + } + public static switch_status_t switch_loadable_module_init(switch_bool_t autoload) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_init((int)autoload); return ret; @@ -2725,11 +2771,6 @@ public class freeswitch { return ret; } - public static uint switch_default_ptime(string name, uint number) { - uint ret = freeswitchPINVOKE.switch_default_ptime(name, number); - return ret; - } - public static string switch_sanitize_number(string number) { string ret = freeswitchPINVOKE.switch_sanitize_number(number); return ret; @@ -4134,6 +4175,10 @@ public class freeswitch { return ret; } + public static void switch_ivr_broadcast_in_thread(SWIGTYPE_p_switch_core_session session, string app, int flags) { + freeswitchPINVOKE.switch_ivr_broadcast_in_thread(SWIGTYPE_p_switch_core_session.getCPtr(session), app, flags); + } + public static switch_status_t switch_ivr_transfer_variable(SWIGTYPE_p_switch_core_session sessa, SWIGTYPE_p_switch_core_session sessb, string var) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_transfer_variable(SWIGTYPE_p_switch_core_session.getCPtr(sessa), SWIGTYPE_p_switch_core_session.getCPtr(sessb), var); return ret; @@ -4338,8 +4383,8 @@ public class freeswitch { return ret; } - public static switch_status_t switch_ivr_dmachine_create(SWIGTYPE_p_p_switch_ivr_dmachine dmachine_p, SWIGTYPE_p_apr_pool_t pool, uint digit_timeout, uint input_timeout) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_create(SWIGTYPE_p_p_switch_ivr_dmachine.getCPtr(dmachine_p), SWIGTYPE_p_apr_pool_t.getCPtr(pool), digit_timeout, input_timeout); + public static switch_status_t switch_ivr_dmachine_create(SWIGTYPE_p_p_switch_ivr_dmachine dmachine_p, string name, SWIGTYPE_p_apr_pool_t pool, uint digit_timeout, uint input_timeout, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t match_callback, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t nonmatch_callback, SWIGTYPE_p_void user_data) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_create(SWIGTYPE_p_p_switch_ivr_dmachine.getCPtr(dmachine_p), name, SWIGTYPE_p_apr_pool_t.getCPtr(pool), digit_timeout, input_timeout, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(match_callback), SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(nonmatch_callback), SWIGTYPE_p_void.getCPtr(user_data)); return ret; } @@ -4347,8 +4392,8 @@ public class freeswitch { freeswitchPINVOKE.switch_ivr_dmachine_destroy(SWIGTYPE_p_p_switch_ivr_dmachine.getCPtr(dmachine)); } - public static switch_status_t switch_ivr_dmachine_bind(SWIGTYPE_p_switch_ivr_dmachine dmachine, string digits, int key, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t callback, SWIGTYPE_p_void user_data) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_bind(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), digits, key, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(callback), SWIGTYPE_p_void.getCPtr(user_data)); + public static switch_status_t switch_ivr_dmachine_bind(SWIGTYPE_p_switch_ivr_dmachine dmachine, string realm, string digits, int key, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t callback, SWIGTYPE_p_void user_data) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_bind(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), realm, digits, key, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(callback), SWIGTYPE_p_void.getCPtr(user_data)); return ret; } @@ -4373,6 +4418,11 @@ public class freeswitch { return ret; } + public static string switch_ivr_dmachine_get_failed_digits(SWIGTYPE_p_switch_ivr_dmachine dmachine) { + string ret = freeswitchPINVOKE.switch_ivr_dmachine_get_failed_digits(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine)); + return ret; + } + public static void switch_ivr_dmachine_set_digit_timeout_ms(SWIGTYPE_p_switch_ivr_dmachine dmachine, uint digit_timeout_ms) { freeswitchPINVOKE.switch_ivr_dmachine_set_digit_timeout_ms(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), digit_timeout_ms); } @@ -4381,6 +4431,16 @@ public class freeswitch { freeswitchPINVOKE.switch_ivr_dmachine_set_input_timeout_ms(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), input_timeout_ms); } + public static switch_status_t switch_ivr_dmachine_clear_realm(SWIGTYPE_p_switch_ivr_dmachine dmachine, string realm) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_clear_realm(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), realm); + return ret; + } + + public static switch_status_t switch_ivr_dmachine_set_realm(SWIGTYPE_p_switch_ivr_dmachine dmachine, string realm) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_set_realm(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), realm); + return ret; + } + public static switch_status_t switch_rtp_add_crypto_key(SWIGTYPE_p_switch_rtp rtp_session, switch_rtp_crypto_direction_t direction, uint index, switch_rtp_crypto_key_type_t type, SWIGTYPE_p_unsigned_char key, SWIGTYPE_p_switch_size_t keylen) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_add_crypto_key(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), (int)direction, index, (int)type, SWIGTYPE_p_unsigned_char.getCPtr(key), SWIGTYPE_p_switch_size_t.getCPtr(keylen)); if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); @@ -5298,6 +5358,7 @@ public class freeswitch { public static readonly int SWITCH_CORE_QUEUE_LEN = freeswitchPINVOKE.SWITCH_CORE_QUEUE_LEN_get(); public static readonly int SWITCH_MAX_MANAGEMENT_BUFFER_LEN = freeswitchPINVOKE.SWITCH_MAX_MANAGEMENT_BUFFER_LEN_get(); public static readonly int SWITCH_RTP_CNG_PAYLOAD = freeswitchPINVOKE.SWITCH_RTP_CNG_PAYLOAD_get(); + public static readonly int DMACHINE_MAX_DIGIT_LEN = freeswitchPINVOKE.DMACHINE_MAX_DIGIT_LEN_get(); public static readonly int SWITCH_API_VERSION = freeswitchPINVOKE.SWITCH_API_VERSION_get(); public static readonly int SWITCH_CORE_DB_OK = freeswitchPINVOKE.SWITCH_CORE_DB_OK_get(); public static readonly int SWITCH_CORE_DB_ERROR = freeswitchPINVOKE.SWITCH_CORE_DB_ERROR_get(); @@ -5948,6 +6009,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_dtmf_t_duration_get")] public static extern uint switch_dtmf_t_duration_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_dtmf_t_flags_set")] + public static extern void switch_dtmf_t_flags_set(HandleRef jarg1, int jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_dtmf_t_flags_get")] + public static extern int switch_dtmf_t_flags_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_dtmf_t")] public static extern IntPtr new_switch_dtmf_t(); @@ -6503,6 +6570,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_console_callback_match")] public static extern void delete_switch_console_callback_match(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_DMACHINE_MAX_DIGIT_LEN_get")] + public static extern int DMACHINE_MAX_DIGIT_LEN_get(); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_dmachine_set")] public static extern void switch_ivr_dmachine_match_dmachine_set(HandleRef jarg1, HandleRef jarg2); @@ -6521,6 +6591,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_match_key_get")] public static extern int switch_ivr_dmachine_match_match_key_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_type_set")] + public static extern void switch_ivr_dmachine_match_type_set(HandleRef jarg1, int jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_type_get")] + public static extern int switch_ivr_dmachine_match_type_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_user_data_set")] public static extern void switch_ivr_dmachine_match_user_data_set(HandleRef jarg1, HandleRef jarg2); @@ -7271,6 +7347,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_soft_unlock")] public static extern void switch_core_session_soft_unlock(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_dmachine")] + public static extern void switch_core_session_set_dmachine(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_dmachine")] + public static extern IntPtr switch_core_session_get_dmachine(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_get_uuid")] public static extern string switch_core_get_uuid(); @@ -8039,6 +8121,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_in_thread")] public static extern int switch_core_session_in_thread(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_default_ptime")] + public static extern uint switch_default_ptime(string jarg1, uint jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_module_name_set")] public static extern void switch_loadable_module_interface_module_name_set(HandleRef jarg1, string jarg2); @@ -8405,9 +8490,6 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_char_to_rfc2833")] public static extern byte switch_char_to_rfc2833(char jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_switch_default_ptime")] - public static extern uint switch_default_ptime(string jarg1, uint jarg2); - [DllImport("mod_managed", EntryPoint="CSharp_switch_sanitize_number")] public static extern string switch_sanitize_number(string jarg1); @@ -11918,6 +12000,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_broadcast")] public static extern int switch_ivr_broadcast(string jarg1, string jarg2, uint jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_broadcast_in_thread")] + public static extern void switch_ivr_broadcast_in_thread(HandleRef jarg1, string jarg2, int jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_transfer_variable")] public static extern int switch_ivr_transfer_variable(HandleRef jarg1, HandleRef jarg2, string jarg3); @@ -12042,13 +12127,13 @@ class freeswitchPINVOKE { public static extern int switch_ivr_uuid_exists(string jarg1); [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_create")] - public static extern int switch_ivr_dmachine_create(HandleRef jarg1, HandleRef jarg2, uint jarg3, uint jarg4); + public static extern int switch_ivr_dmachine_create(HandleRef jarg1, string jarg2, HandleRef jarg3, uint jarg4, uint jarg5, HandleRef jarg6, HandleRef jarg7, HandleRef jarg8); [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_destroy")] public static extern void switch_ivr_dmachine_destroy(HandleRef jarg1); [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_bind")] - public static extern int switch_ivr_dmachine_bind(HandleRef jarg1, string jarg2, int jarg3, HandleRef jarg4, HandleRef jarg5); + public static extern int switch_ivr_dmachine_bind(HandleRef jarg1, string jarg2, string jarg3, int jarg4, HandleRef jarg5, HandleRef jarg6); [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_feed")] public static extern int switch_ivr_dmachine_feed(HandleRef jarg1, string jarg2, HandleRef jarg3); @@ -12062,12 +12147,21 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_get_match")] public static extern IntPtr switch_ivr_dmachine_get_match(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_get_failed_digits")] + public static extern string switch_ivr_dmachine_get_failed_digits(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_set_digit_timeout_ms")] public static extern void switch_ivr_dmachine_set_digit_timeout_ms(HandleRef jarg1, uint jarg2); [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_set_input_timeout_ms")] public static extern void switch_ivr_dmachine_set_input_timeout_ms(HandleRef jarg1, uint jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_clear_realm")] + public static extern int switch_ivr_dmachine_clear_realm(HandleRef jarg1, string jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_set_realm")] + public static extern int switch_ivr_dmachine_set_realm(HandleRef jarg1, string jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RTP_MAX_BUF_LEN_get")] public static extern int SWITCH_RTP_MAX_BUF_LEN_get(); @@ -21106,6 +21200,7 @@ public enum switch_channel_flag_t { CF_MEDIA_SET, CF_CONSUME_ON_ORIGINATE, CF_PASSTHRU_PTIME_MISMATCH, + CF_BRIDGE_NOWRITE, CF_FLAG_MAX } @@ -23642,6 +23737,16 @@ public class switch_dtmf_t : IDisposable { } } + public int flags { + set { + freeswitchPINVOKE.switch_dtmf_t_flags_set(swigCPtr, value); + } + get { + int ret = freeswitchPINVOKE.switch_dtmf_t_flags_get(swigCPtr); + return ret; + } + } + public switch_dtmf_t() : this(freeswitchPINVOKE.new_switch_dtmf_t(), true) { } @@ -26561,6 +26666,16 @@ public class switch_ivr_dmachine_match : IDisposable { } } + public dm_match_type_t type { + set { + freeswitchPINVOKE.switch_ivr_dmachine_match_type_set(swigCPtr, (int)value); + } + get { + dm_match_type_t ret = (dm_match_type_t)freeswitchPINVOKE.switch_ivr_dmachine_match_type_get(swigCPtr); + return ret; + } + } + public SWIGTYPE_p_void user_data { set { freeswitchPINVOKE.switch_ivr_dmachine_match_user_data_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value)); From 5b2664c0a9bc1d43a0b4bf808ce492a90deabec5 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Sat, 9 Oct 2010 22:19:22 -0500 Subject: [PATCH 39/46] tweak swig script for mod_managed --- src/mod/languages/mod_managed/runswig.2010.cmd | 10 ++++++++++ src/mod/languages/mod_managed/runswig.cmd | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 src/mod/languages/mod_managed/runswig.2010.cmd diff --git a/src/mod/languages/mod_managed/runswig.2010.cmd b/src/mod/languages/mod_managed/runswig.2010.cmd new file mode 100644 index 0000000000..288c420efe --- /dev/null +++ b/src/mod/languages/mod_managed/runswig.2010.cmd @@ -0,0 +1,10 @@ +move freeswitch_wrap.cxx freeswitch_wrap.bak +\dev\swig20\swig.exe -I..\..\..\include -v -O -c++ -csharp -namespace FreeSWITCH.Native -dllimport mod_managed -DSWIG_CSHARP_NO_STRING_HELPER freeswitch.i +del swig.csx +move freeswitch_wrap.cxx freeswitch_wrap.2010.cxx +move freeswitch_wrap.bak freeswitch_wrap.cxx +@ECHO OFF +for %%X in (*.cs) do type %%X >> swig.csx +@ECHO ON +move swig.csx managed\swig.2010.cs +del *.cs diff --git a/src/mod/languages/mod_managed/runswig.cmd b/src/mod/languages/mod_managed/runswig.cmd index 9b1a659061..631a507a20 100644 --- a/src/mod/languages/mod_managed/runswig.cmd +++ b/src/mod/languages/mod_managed/runswig.cmd @@ -1,4 +1,4 @@ -\dev\swig\swig.exe -I..\..\..\include -v -O -c++ -csharp -namespace FreeSWITCH.Native -dllimport mod_managed -DSWIG_CSHARP_NO_STRING_HELPER freeswitch.i +\dev\swig135\swig.exe -I..\..\..\include -v -O -c++ -csharp -namespace FreeSWITCH.Native -dllimport mod_managed -DSWIG_CSHARP_NO_STRING_HELPER freeswitch.i del swig.csx @ECHO OFF for %%X in (*.cs) do type %%X >> swig.csx From 4b6ef3021831b98dcd2cb1905b17dc876cf94da4 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Sun, 10 Oct 2010 11:23:43 -0500 Subject: [PATCH 40/46] Move FreeSWITCH.Managed to correct location --- Freeswitch.2008.sln | 6 ++++-- .../managed/FreeSWITCH.Managed.csproj | 20 +++++++++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Freeswitch.2008.sln b/Freeswitch.2008.sln index 27c94a2dc4..8e6df5cc57 100644 --- a/Freeswitch.2008.sln +++ b/Freeswitch.2008.sln @@ -2213,10 +2213,12 @@ Global {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.All|x64.ActiveCfg = Release|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|Win32.ActiveCfg = Debug|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|Win32.Build.0 = Debug|Any CPU - {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x64.ActiveCfg = Debug|Any CPU + {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x64.ActiveCfg = Debug|x64 + {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x64.Build.0 = Debug|x64 {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|Win32.ActiveCfg = Release|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|Win32.Build.0 = Release|Any CPU - {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x64.ActiveCfg = Release|Any CPU + {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x64.ActiveCfg = Release|x64 + {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x64.Build.0 = Release|x64 {E796E337-DE78-4303-8614-9A590862EE95}.All|Win32.ActiveCfg = Release|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.All|Win32.Build.0 = Release|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.All|x64.ActiveCfg = Release|Win32 diff --git a/src/mod/languages/mod_managed/managed/FreeSWITCH.Managed.csproj b/src/mod/languages/mod_managed/managed/FreeSWITCH.Managed.csproj index 7875d8e6a8..9b8f827202 100644 --- a/src/mod/languages/mod_managed/managed/FreeSWITCH.Managed.csproj +++ b/src/mod/languages/mod_managed/managed/FreeSWITCH.Managed.csproj @@ -19,7 +19,7 @@ true full false - ..\..\..\..\..\managed\debug\ + ..\..\..\..\..\Debug\mod\ DEBUG;TRACE prompt 4 @@ -27,11 +27,27 @@ pdbonly true - ..\..\..\..\..\managed\release\ + ..\..\..\..\..\Release\mod\ TRACE prompt 4 + + true + ..\..\..\..\..\x64\Debug\mod\ + DEBUG;TRACE + full + x64 + prompt + + + ..\..\..\..\..\x64\Release\mod\ + TRACE + true + pdbonly + x64 + prompt + From bac79ba18c9e008f0f85b959716ec99599c27dfb Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Sun, 10 Oct 2010 13:32:45 -0500 Subject: [PATCH 41/46] Add mod_distributor to VS2010 - not built by default --- Freeswitch.2010.sln | 10 ++ .../mod_distributor.2010.vcxproj | 130 ++++++++++++++++++ 2 files changed, 140 insertions(+) create mode 100644 src/mod/applications/mod_distributor/mod_distributor.2010.vcxproj diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln index c865b6861a..4729745778 100644 --- a/Freeswitch.2010.sln +++ b/Freeswitch.2010.sln @@ -703,6 +703,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_directory", "src\mod\ap EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_h323", "src\mod\endpoints\mod_h323\mod_h323.2010.vcxproj", "{05C9FB27-480E-4D53-B3B7-7338E2514666}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_distributor", "src\mod\applications\mod_distributor\mod_distributor.2010.vcxproj", "{5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -2424,6 +2426,13 @@ Global {05C9FB27-480E-4D53-B3B7-7338E2514666}.Debug|x64.ActiveCfg = Debug|x64 {05C9FB27-480E-4D53-B3B7-7338E2514666}.Release|Win32.ActiveCfg = Release|Win32 {05C9FB27-480E-4D53-B3B7-7338E2514666}.Release|x64.ActiveCfg = Release|x64 + {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.All|Win32.ActiveCfg = Release|x64 + {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.All|x64.ActiveCfg = Release|x64 + {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.All|x64.Build.0 = Release|x64 + {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.Debug|Win32.ActiveCfg = Debug|Win32 + {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.Debug|x64.ActiveCfg = Debug|x64 + {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.Release|Win32.ActiveCfg = Release|Win32 + {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.Release|x64.ActiveCfg = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2470,6 +2479,7 @@ Global {1E21AFE0-6FDB-41D2-942D-863607C24B91} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {2E250296-0C08-4342-9C8A-BCBDD0E7DF65} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {B889A18E-70A7-44B5-B2C9-47798D4F43B3} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} + {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {07113B25-D3AF-4E04-BA77-4CD1171F022C} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4} {A27CCA23-1541-4337-81A4-F0A6413078A0} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4} {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4} diff --git a/src/mod/applications/mod_distributor/mod_distributor.2010.vcxproj b/src/mod/applications/mod_distributor/mod_distributor.2010.vcxproj new file mode 100644 index 0000000000..368cfa18d7 --- /dev/null +++ b/src/mod/applications/mod_distributor/mod_distributor.2010.vcxproj @@ -0,0 +1,130 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + mod_distributor + {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F} + mod_distributor + Win32Proj + + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + + + + + + + + false + + + + + + + X64 + + + + + + + false + + + MachineX64 + + + + + + + + + false + + + + + + + X64 + + + + + + + false + + + MachineX64 + + + + + + + + {202d7a4e-760d-4d0e-afa1-d7459ced30ff} + + + + + + \ No newline at end of file From 57cd1c98503496b458614e462f51a8b904ccf709 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 11 Oct 2010 12:31:50 -0500 Subject: [PATCH 42/46] fix regression --- src/mod/applications/mod_voicemail/mod_voicemail.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index fea8b83be9..758e5dcf25 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -2343,8 +2343,8 @@ static switch_status_t deliver_vm(vm_profile_t *profile, char *convert_cmd = profile->convert_cmd; char *convert_ext = profile->convert_ext; int del_file = 0; - char *id = switch_core_session_strdup(session, switch_xml_attr(x_user, "id")); + if (!params) { switch_event_create(&local_event, SWITCH_EVENT_REQUEST_PARAMS); params = local_event; @@ -2646,7 +2646,7 @@ static switch_status_t deliver_vm(vm_profile_t *profile, if ((vm_cc = switch_channel_get_variable(channel, "vm_cc"))) { char *cmd = switch_core_session_sprintf(session, "%s %s %s '%s' %s@%s %s", - vm_cc, file_path, caller_id_number, caller_id_name, id, domain_name, read_flags); + vm_cc, file_path, caller_id_number, caller_id_name, myid, domain_name, read_flags); if (voicemail_inject(cmd, session) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Sent Carbon Copy to %s\n", vm_cc); From c0fddf054c2c7fe0bb077293808f2046521ee305 Mon Sep 17 00:00:00 2001 From: Mathieu Rene Date: Mon, 11 Oct 2010 13:42:58 -0400 Subject: [PATCH 43/46] runtime/shutdown mixed up --- src/mod/applications/mod_redis/mod_redis.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_redis/mod_redis.c b/src/mod/applications/mod_redis/mod_redis.c index 75dfd6fdd7..d20ab934f3 100755 --- a/src/mod/applications/mod_redis/mod_redis.c +++ b/src/mod/applications/mod_redis/mod_redis.c @@ -34,7 +34,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_redis_load); SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_redis_shutdown); -SWITCH_MODULE_DEFINITION(mod_redis, mod_redis_load, NULL, mod_redis_shutdown); +SWITCH_MODULE_DEFINITION(mod_redis, mod_redis_load, mod_redis_shutdown, NULL); static struct{ char *host; From 20d17baae2cf9cbe39b60d3b4942f9433139c919 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 11 Oct 2010 16:36:04 -0500 Subject: [PATCH 44/46] set idle pattern to 255 instead of 0 to prevent clipping sound on short frames from mod_native_file FS-2772 --- src/switch_ivr_play_say.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index c5b7a61000..fd2f1a98fb 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -1292,7 +1292,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess if (framelen > FILE_STARTSAMPLES) { framelen = FILE_STARTSAMPLES; } - memset(abuf, 0, framelen); + memset(abuf, 255, framelen); olen = ilen; do_speed = 0; } else if (fh->sp_audio_buffer && (eof || (switch_buffer_inuse(fh->sp_audio_buffer) > (switch_size_t) (framelen)))) { @@ -1305,7 +1305,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess } if (bread < framelen) { - memset(abuf + bread, 0, framelen - bread); + memset(abuf + bread, 255, framelen - bread); } olen = asis ? framelen : ilen; @@ -1320,7 +1320,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess } if (bread < framelen) { - memset(abuf + bread, 0, framelen - bread); + memset(abuf + bread, 255, framelen - bread); } olen = asis ? framelen : ilen; @@ -1408,10 +1408,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess last_speed = fh->speed; continue; } - + if (olen < llen) { uint8_t *dp = (uint8_t *) write_frame.data; - memset(dp + (int) olen, 0, (int) (llen - olen)); + memset(dp + (int) olen, 255, (int) (llen - olen)); olen = llen; } @@ -1476,7 +1476,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess } #endif #endif - if (fh->vol) { + if (!asis && fh->vol) { switch_change_sln_volume(write_frame.data, write_frame.datalen / 2, fh->vol); } From ec9fddacceaf86ebddc32095e458aceb832333db Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 11 Oct 2010 18:38:30 -0500 Subject: [PATCH 45/46] add some more dmachine code for args parsing --- src/switch_ivr.c | 21 ++++++++++++++++++--- src/switch_ivr_play_say.c | 6 +++--- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/switch_ivr.c b/src/switch_ivr.c index ef360d3148..744072c145 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -232,7 +232,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session, if you return anything but SWITCH_STATUS_SUCCESS the playback will stop. */ if (switch_channel_has_dtmf(channel)) { - if (!args->input_callback && !args->buf) { + if (!args->input_callback && !args->buf && !args->dmachine) { status = SWITCH_STATUS_BREAK; break; } @@ -271,6 +271,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session, break; } + if (args && args->dmachine) { + if ((status = switch_ivr_dmachine_ping(args->dmachine, NULL)) != SWITCH_STATUS_SUCCESS) { + break; + } + } + if (sval && write_frame.datalen) { switch_generate_sln_silence((int16_t *) write_frame.data, write_frame.samples, sval); switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0); @@ -923,12 +929,21 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_s if (switch_channel_has_dtmf(channel)) { - if (!args->input_callback && !args->buf) { + if (!args->input_callback && !args->buf && !args->dmachine) { status = SWITCH_STATUS_BREAK; break; } switch_channel_dequeue_dtmf(channel, &dtmf); - status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen); + + if (args->dmachine) { + char ds[2] = {dtmf.digit, '\0'}; + if ((status = switch_ivr_dmachine_feed(args->dmachine, ds, NULL)) != SWITCH_STATUS_SUCCESS) { + break; + } + } else if (args->input_callback) { + status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen); + } + if (digit_timeout) { digit_started = switch_micro_time_now(); } diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index fd2f1a98fb..c99745d57c 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -842,7 +842,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *sessi if you return anything but SWITCH_STATUS_SUCCESS the playback will stop. */ if (switch_channel_has_dtmf(channel)) { - if (!args->input_callback && !args->buf) { + if (!args->input_callback && !args->buf && !args->dmachine) { status = SWITCH_STATUS_BREAK; done = 1; break; @@ -1253,7 +1253,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess if you return anything but SWITCH_STATUS_SUCCESS the playback will stop. */ if (switch_channel_has_dtmf(channel)) { - if (!args->input_callback && !args->buf) { + if (!args->input_callback && !args->buf && !args->dmachine) { status = SWITCH_STATUS_BREAK; done = 1; break; @@ -1959,7 +1959,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session * if you return anything but SWITCH_STATUS_SUCCESS the playback will stop. */ if (switch_channel_has_dtmf(channel)) { - if (!args->input_callback && !args->buf) { + if (!args->input_callback && !args->buf && !args->dmachine) { status = SWITCH_STATUS_BREAK; done = 1; break; From 14361c09074f43ca87484d87212c5f24055a9769 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 12 Oct 2010 09:32:15 -0500 Subject: [PATCH 46/46] FS-620 --- src/mod/endpoints/mod_sofia/sofia_glue.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 7464a42825..cb8b257e58 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1425,9 +1425,12 @@ void sofia_glue_tech_patch_sdp(private_object_t *tech_pvt) } if (tech_pvt->adv_sdp_audio_ip && !strncmp("c=IN IP", p, 7)) { - strncpy(q, p, 9); - p += 9; - q += 9; + strncpy(q, p, 7); + p += 7; + q += 7; + strncpy(q, strchr(tech_pvt->adv_sdp_audio_ip, ':') ? "6 " : "4 ", 2); + p +=2; + q +=2; strncpy(q, tech_pvt->adv_sdp_audio_ip, strlen(tech_pvt->adv_sdp_audio_ip)); q += strlen(tech_pvt->adv_sdp_audio_ip);