From 794db40e526a22d8c8f5a4ebf322bf1de2b5d5fa Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 9 Nov 2010 11:49:07 -0600 Subject: [PATCH 01/45] refactor STFU a bit --- libs/stfu/stfu.c | 142 ++++++++++++++++++++++------------------------- libs/stfu/stfu.h | 2 +- src/switch_ivr.c | 2 +- src/switch_rtp.c | 2 +- 4 files changed, 70 insertions(+), 78 deletions(-) diff --git a/libs/stfu/stfu.c b/libs/stfu/stfu.c index f305a0f3df..7c30ab2ad4 100644 --- a/libs/stfu/stfu.c +++ b/libs/stfu/stfu.c @@ -38,7 +38,6 @@ struct stfu_queue { uint32_t array_size; uint32_t array_len; uint32_t wr_len; - uint32_t last_index; }; typedef struct stfu_queue stfu_queue_t; @@ -47,10 +46,12 @@ struct stfu_instance { struct stfu_queue b_queue; struct stfu_queue *in_queue; struct stfu_queue *out_queue; - uint32_t last_ts; + struct stfu_frame *last_frame; + uint32_t last_wr_ts; + uint32_t last_rd_ts; uint32_t interval; uint32_t miss_count; - uint8_t running; + uint32_t max_plc; }; @@ -112,7 +113,7 @@ stfu_status_t stfu_n_resize(stfu_instance_t *i, uint32_t qlen) return s; } -stfu_instance_t *stfu_n_init(uint32_t qlen) +stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_plc) { struct stfu_instance *i; @@ -125,6 +126,13 @@ stfu_instance_t *stfu_n_init(uint32_t qlen) stfu_n_init_aqueue(&i->b_queue, qlen); i->in_queue = &i->a_queue; i->out_queue = &i->b_queue; + + if (max_plc) { + i->max_plc = max_plc; + } else { + i->max_plc = qlen / 2; + } + return i; } @@ -135,10 +143,9 @@ void stfu_n_reset(stfu_instance_t *i) i->in_queue->array_len = 0; i->out_queue->array_len = 0; i->out_queue->wr_len = 0; - i->out_queue->last_index = 0; + i->last_frame = NULL; i->miss_count = 0; - i->last_ts = 0; - i->running = 0; + i->last_wr_ts = 0; i->miss_count = 0; i->interval = 0; } @@ -197,7 +204,7 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void i->in_queue->array_len = 0; i->out_queue->wr_len = 0; - i->out_queue->last_index = 0; + i->last_frame = NULL; i->miss_count = 0; if (stfu_n_process(i, i->out_queue) < 0) { @@ -222,6 +229,8 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void cplen = sizeof(frame->data); } + i->last_rd_ts = ts; + memcpy(frame->data, data, cplen); frame->pt = pt; frame->ts = ts; @@ -231,88 +240,71 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void return STFU_IT_WORKED; } +static int stfu_n_find_frame(stfu_queue_t *queue, uint32_t ts, stfu_frame_t **r_frame, uint32_t *index) +{ + uint32_t i = 0; + stfu_frame_t *frame = NULL; + + assert(r_frame); + assert(index); + + *r_frame = NULL; + + for(i = 0; i < queue->array_len; i++) { + frame = &queue->array[i]; + + if (frame->ts == ts) { + *r_frame = frame; + *index = i; + frame->was_read = 1; + return 1; + } + } + + return 0; +} + stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i) { - uint32_t index, index2; + uint32_t index; uint32_t should_have = 0; - stfu_frame_t *frame = NULL, *rframe = NULL; + stfu_frame_t *rframe = NULL; if (((i->out_queue->wr_len == i->out_queue->array_len) || !i->out_queue->array_len)) { return NULL; } - if (i->running) { - should_have = i->last_ts + i->interval; + if (i->last_wr_ts) { + should_have = i->last_wr_ts + i->interval; } else { should_have = i->out_queue->array[0].ts; } - for(index = 0; index < i->out_queue->array_len; index++) { - if (i->out_queue->array[index].was_read) { - continue; - } - - frame = &i->out_queue->array[index]; - - if (frame->ts != should_have) { - unsigned int tried = 0; - for (index2 = 0; index2 < i->out_queue->array_len; index2++) { - if (i->out_queue->array[index2].was_read) { - continue; - } - tried++; - if (i->out_queue->array[index2].ts == should_have) { - rframe = &i->out_queue->array[index2]; - i->out_queue->last_index = index2; - goto done; - } - } - for (index2 = 0; index2 < i->in_queue->array_len; index2++) { - if (i->in_queue->array[index2].was_read) { - continue; - } - tried++; - if (i->in_queue->array[index2].ts == should_have) { - rframe = &i->in_queue->array[index2]; - goto done; - } - } - - i->miss_count++; - - if (i->miss_count > 10 || (i->in_queue->array_len == i->in_queue->array_size) || - tried >= (i->in_queue->array_size + i->out_queue->array_size)) { - i->running = 0; - i->interval = 0; - i->out_queue->wr_len = i->out_queue->array_size; - return NULL; - } - - i->last_ts = should_have; - rframe = &i->out_queue->int_frame; - rframe->dlen = i->out_queue->array[i->out_queue->last_index].dlen; - /* poor man's plc.. Copy the last frame, but we flag it so you can use a better one if you wish */ - memcpy(rframe->data, i->out_queue->array[i->out_queue->last_index].data, rframe->dlen); - rframe->ts = should_have; - i->out_queue->wr_len++; - i->running = 1; - return rframe; - } else { - rframe = &i->out_queue->array[index]; - i->out_queue->last_index = index; - goto done; - } - } - -done: - - if (rframe) { + if (stfu_n_find_frame(i->out_queue, should_have, &rframe, &index) || stfu_n_find_frame(i->in_queue, should_have, &rframe, &index)) { + i->last_frame = rframe; i->out_queue->wr_len++; - i->last_ts = rframe->ts; + i->last_wr_ts = rframe->ts; rframe->was_read = 1; - i->running = 1; i->miss_count = 0; - } + } else { + i->last_wr_ts = should_have; + rframe = &i->out_queue->int_frame; + + if (i->last_frame && i->last_frame != rframe) { + rframe->dlen = i->last_frame->dlen; + /* poor man's plc.. Copy the last frame, but we flag it so you can use a better one if you wish */ + memcpy(rframe->data, i->last_frame->data, rframe->dlen); + } + + rframe->ts = should_have; + + if (++i->miss_count > i->max_plc) { + i->interval = 0; + i->out_queue->wr_len = i->out_queue->array_size; + i->last_wr_ts = 0; + rframe = NULL; + } + } return rframe; } diff --git a/libs/stfu/stfu.h b/libs/stfu/stfu.h index 17f01e3256..900db6f9ac 100644 --- a/libs/stfu/stfu.h +++ b/libs/stfu/stfu.h @@ -96,7 +96,7 @@ typedef struct { void stfu_n_report(stfu_instance_t *i, stfu_report_t *r); void stfu_n_destroy(stfu_instance_t **i); -stfu_instance_t *stfu_n_init(uint32_t qlen); +stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_plc); stfu_status_t stfu_n_resize(stfu_instance_t *i, uint32_t qlen); stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void *data, size_t datalen, int last); stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i); diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 744072c145..948401e53a 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -2190,7 +2190,7 @@ SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint3 qlen = delay_ms / (interval); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Setting delay to %dms (%d frames)\n", delay_ms, qlen); - jb = stfu_n_init(qlen); + jb = stfu_n_init(qlen, 0); write_frame.codec = switch_core_session_get_read_codec(session); diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 6a2fa51910..1792de08b3 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1616,7 +1616,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_stun_ping(switch_rtp_t *rtp_ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t *rtp_session, uint32_t queue_frames) { - rtp_session->jb = stfu_n_init(queue_frames); + rtp_session->jb = stfu_n_init(queue_frames, 0); return SWITCH_STATUS_SUCCESS; } From 7bd0a5a63d353c77c2ecfc2921af0cf956bcc043 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 9 Nov 2010 11:53:01 -0600 Subject: [PATCH 02/45] FS-2833 --- src/mod/applications/mod_commands/mod_commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 6c43f25d44..ba4b6d310d 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -4324,7 +4324,7 @@ SWITCH_STANDARD_API(uuid_loglevel) #define SQL_ESCAPE_SYNTAX "" SWITCH_STANDARD_API(sql_escape) { - if (zstr(cmd)) { + if (!cmd) { stream->write_function(stream, "-USAGE: %s\n", SQL_ESCAPE_SYNTAX); } else { stream->write_function(stream, "%q", cmd); From 28f5d287d44035da561d44825318d449a33c54d6 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Tue, 9 Nov 2010 14:11:02 -0500 Subject: [PATCH 03/45] fix previous merge side-effect in build files --- Freeswitch.2008.sln | 12 ++++++++++-- build/modules.conf.in | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Freeswitch.2008.sln b/Freeswitch.2008.sln index d31ca4a53e..01a4cf43c1 100644 --- a/Freeswitch.2008.sln +++ b/Freeswitch.2008.sln @@ -48,6 +48,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Debug", "Debug", "{6374D55C-FABE-4A02-9CF1-4145308A56C5}" ProjectSection(SolutionItems) = preProject debug\conf\freeswitch.xml = debug\conf\freeswitch.xml + debug\conf\vars.xml = debug\conf\vars.xml EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Build System", "_Build System", "{DB1024A8-41BF-4AD7-9AE6-13202230D1F3}" @@ -58,6 +59,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Build System", "_Build Sys configure.in = configure.in Makefile.am = Makefile.am build\modmake.rules.in = build\modmake.rules.in + build\modules.conf.in = build\modules.conf.in libs\win32\util.vbs = libs\win32\util.vbs EndProjectSection EndProject @@ -90,11 +92,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "autoload_configs", "autoloa conf\autoload_configs\limit.conf.xml = conf\autoload_configs\limit.conf.xml conf\autoload_configs\local_stream.conf.xml = conf\autoload_configs\local_stream.conf.xml conf\autoload_configs\logfile.conf.xml = conf\autoload_configs\logfile.conf.xml + conf\autoload_configs\modules.conf.xml = conf\autoload_configs\modules.conf.xml conf\autoload_configs\openmrcp.conf.xml = conf\autoload_configs\openmrcp.conf.xml conf\autoload_configs\portaudio.conf.xml = conf\autoload_configs\portaudio.conf.xml conf\autoload_configs\rss.conf.xml = conf\autoload_configs\rss.conf.xml conf\autoload_configs\sofia.conf.xml = conf\autoload_configs\sofia.conf.xml conf\autoload_configs\spidermonkey.conf.xml = conf\autoload_configs\spidermonkey.conf.xml + conf\autoload_configs\switch.conf.xml = conf\autoload_configs\switch.conf.xml conf\autoload_configs\syslog.conf.xml = conf\autoload_configs\syslog.conf.xml conf\autoload_configs\voicemail.conf.xml = conf\autoload_configs\voicemail.conf.xml conf\autoload_configs\wanpipe.conf.xml = conf\autoload_configs\wanpipe.conf.xml @@ -119,6 +123,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sip_profiles", "sip_profiles", "{8E2E8798-8B6F-4A55-8E4F-4E6FDE40ED26}" ProjectSection(SolutionItems) = preProject conf\sip_profiles\external.xml = conf\sip_profiles\external.xml + conf\sip_profiles\internal.xml = conf\sip_profiles\internal.xml conf\sip_profiles\nat.xml = conf\sip_profiles\nat.xml EndProjectSection EndProject @@ -207,6 +212,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "autoload_configs", "autoloa EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dialplan", "dialplan", "{D44DD429-FE98-42AA-B5B7-4B4EBE33AEFD}" ProjectSection(SolutionItems) = preProject + debug\conf\dialplan\default.xml = debug\conf\dialplan\default.xml debug\conf\dialplan\US.conf.xml = debug\conf\dialplan\US.conf.xml EndProjectSection EndProject @@ -2207,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/build/modules.conf.in b/build/modules.conf.in index 87b4718bd4..37244a188a 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -63,7 +63,7 @@ endpoints/mod_loopback #endpoints/mod_skypopen #endpoints/mod_h323 #../../libs/openzap/mod_openzap -../../libs/freetdm/mod_freetdm +#../../libs/freetdm/mod_freetdm #asr_tts/mod_unimrcp #asr_tts/mod_flite #asr_tts/mod_pocketsphinx From 31cc2502f7ae9adbfbd541d63eeac7651afeb7e5 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Tue, 9 Nov 2010 17:58:27 -0500 Subject: [PATCH 04/45] mod_sangoma_codec: register AMR --- .../mod_sangoma_codec/mod_sangoma_codec.c | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 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 21bfb958d4..63073ed189 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -98,6 +98,7 @@ vocallo_codec_t g_codec_map[] = /* FIXME: sampling rate seems wrong with this, audioooo soooundssssss sloooooow ... */ { SNGTC_CODEC_G722, 9, "G722", "Sangoma G722", 20, 64000, 20000, 160, 640, 160, 0 }, #endif + { SNGTC_CODEC_AMR_1220, 96, "AMR", "Sangoma AMR", 20, 12200, 20000, 160, 320, 0, 0}, { -1, -1, NULL, NULL, -1, -1, -1, -1, -1, -1 }, }; @@ -1227,12 +1228,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) /* Now add as many codec implementations as needed, just up to 40ms for now */ if (g_codec_map[c].autoinit) { + int ms = 0; for (i = 1; i <= 4; i++) { - - if ((g_codec_map[c].maxms/10) < i) { - continue; + ms = i * 10; + if (g_codec_map[c].maxms < ms) { + break; } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding %dms implementation of codec %s\n", ms, g_codec_map[c].fs_name); switch_core_codec_add_implementation(pool, codec_interface, /* the codec interface we allocated and we want to register with the core */ SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ g_codec_map[c].iana, /* the IANA code number, ie http://www.iana.org/assignments/rtp-parameters */ @@ -1253,7 +1256,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) switch_sangoma_destroy); /* deinitalize a codec handle using this implementation */ } - } else { /* custom implementation for some codecs */ @@ -1369,6 +1371,27 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) switch_sangoma_destroy); /* deinitalize a codec handle using this implementation */ break; + case SNGTC_CODEC_AMR_1220: + switch_core_codec_add_implementation(pool, codec_interface, /* the codec interface we allocated and we want to register with the core */ + SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ + g_codec_map[c].iana, /* the IANA code number, ie http://www.iana.org/assignments/rtp-parameters */ + g_codec_map[c].iana_name, /* the IANA code name */ + NULL, /* default fmtp to send (can be overridden by the init function), fmtp is used in SDP for format specific parameters */ + 8000, /* samples transferred per second */ + 8000, /* actual samples transferred per second */ + g_codec_map[c].bps, /* bits transferred per second */ + g_codec_map[c].mpf, /* microseconds per frame */ + g_codec_map[c].spf, /* samples per frame */ + g_codec_map[c].bpfd, /* number of bytes per frame decompressed */ + g_codec_map[c].bpfc, /* number of bytes per frame compressed */ + 1, /* number of channels represented */ + g_codec_map[c].spf, /* number of frames per network packet (I dont think this is used at all) */ + switch_sangoma_init, /* function to initialize a codec session using this implementation */ + switch_sangoma_encode, /* function to encode slinear data into encoded data */ + switch_sangoma_decode, /* function to decode encoded data into slinear data */ + switch_sangoma_destroy); /* deinitalize a codec handle using this implementation */ + break; + default: break; } From b1cf0d9a156fec620ca5d34d3f9a678b131cc046 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Wed, 10 Nov 2010 00:47:16 +0100 Subject: [PATCH 05/45] ftmod_libpri: Check if a span really has a D-Channel. Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index af5ab5f515..d8acf7e176 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -1294,7 +1294,7 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) } } } - if (!got_d) { + if (!got_d || !isdn_data->dchan) { ftdm_log(FTDM_LOG_ERROR, "Failed to get a D-channel in span %d\n", span->span_id); break; } @@ -1577,7 +1577,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) ftdm_span_set_trunk_type(span, FTDM_TRUNK_T1); } - for(i = 1; i <= span->chan_count; i++) { + for (i = 1; i <= span->chan_count; i++) { if (span->channels[i]->type == FTDM_CHAN_TYPE_DQ921) { if (x > 1) { snprintf(span->last_error, sizeof(span->last_error), "Span has more than 2 D-Channels!"); @@ -1590,16 +1590,15 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) x++; } #endif + x++; } } } - -#if 0 if (!x) { - snprintf(span->last_error, sizeof(span->last_error), "Span has no D-Channels!"); + ftdm_log(FTDM_LOG_ERROR, "Span has no D-Channel!\n"); + snprintf(span->last_error, sizeof(span->last_error), "Span has no D-Channel!"); return FTDM_FAIL; } -#endif isdn_data = ftdm_malloc(sizeof(*isdn_data)); assert(isdn_data != NULL); From 180feff1f4be0cc80f65b921d81ca25ce91fe3b8 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Wed, 10 Nov 2010 01:28:30 +0100 Subject: [PATCH 06/45] ftmod_libpri: Completely disable on_facility if AOC support is not available in libpri (= is too old). Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index ed6acda4bf..2abe761743 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -1107,7 +1107,6 @@ static int handle_facility_aoc_e(const struct pri_subcmd_aoc_e *aoc_e) ftdm_log(FTDM_LOG_INFO, "AOC-E:\n%s", tmp); return 0; } -#endif /** * \brief Handler for libpri facility events @@ -1132,7 +1131,6 @@ static int on_facility(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ev int res = -1; switch (sub->cmd) { -#ifdef HAVE_LIBPRI_AOC case PRI_SUBCMD_AOC_S: /* AOC-S: Start of call */ res = handle_facility_aoc_s(&sub->u.aoc_s); break; @@ -1151,7 +1149,6 @@ static int on_facility(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ev sub->u.aoc_request_response.charging_request, sub->u.aoc_request_response.charging_response); break; -#endif default: ftdm_log(FTDM_LOG_DEBUG, "FACILITY subcommand %d is not implemented, ignoring\n", sub->cmd); } @@ -1162,6 +1159,7 @@ static int on_facility(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ev ftdm_log(FTDM_LOG_DEBUG, "Caught Event on span %d %u (%s)\n", spri->span->span_id, event_type, lpwrap_pri_event_str(event_type)); return 0; } +#endif /** * \brief Handler for libpri dchan up event @@ -1354,8 +1352,9 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_INFO_RECEIVED, on_info); LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_RESTART, on_restart); LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_IO_FAIL, on_io_fail); +#ifdef HAVE_LIBPRI_AOC LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_FACILITY, on_facility); - +#endif if (down) { ftdm_log(FTDM_LOG_INFO, "PRI back up on span %d\n", isdn_data->spri.span->span_id); ftdm_set_state_all(span, FTDM_CHANNEL_STATE_RESTART); From d872408922ad785b5f2b9a05cffc26e83d61adee Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Tue, 9 Nov 2010 19:27:45 -0500 Subject: [PATCH 07/45] freetdm: do not declare some sangoma ISDN functions as inline as that does not work on gcc (Debian 4.3.2-1.1) 4.3.2 and probably other compilers when the inlined function is not defined in the same compilation unit --- .../ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h | 12 ++++++------ .../ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index e84392e22a..953bfee85a 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -266,16 +266,16 @@ extern ftdm_sngisdn_data_t g_sngisdn_data; ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *span); /* Support functions */ -FT_DECLARE_INLINE(uint32_t) get_unique_suInstId(int16_t cc_id); -FT_DECLARE_INLINE(void) clear_call_data(sngisdn_chan_data_t *sngisdn_info); -FT_DECLARE_INLINE(void) clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info); +FT_DECLARE(uint32_t) get_unique_suInstId(int16_t cc_id); +FT_DECLARE(void) clear_call_data(sngisdn_chan_data_t *sngisdn_info); +FT_DECLARE(void) clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info); void stack_hdr_init(Header *hdr); void stack_pst_init(Pst *pst); -FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_spInstId(int16_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data); -FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_suInstId(int16_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data); -FT_DECLARE_INLINE(ftdm_status_t) sng_isdn_set_avail_rate(ftdm_span_t *ftdmspan, sngisdn_avail_t avail); +FT_DECLARE(ftdm_status_t) get_ftdmchan_by_spInstId(int16_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data); +FT_DECLARE(ftdm_status_t) get_ftdmchan_by_suInstId(int16_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data); +FT_DECLARE(ftdm_status_t) sng_isdn_set_avail_rate(ftdm_span_t *ftdmspan, sngisdn_avail_t avail); /* Outbound Call Control functions */ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index f54f7db61c..aa34279813 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -49,7 +49,7 @@ ftdm_status_t sngisdn_check_free_ids(void); extern ftdm_sngisdn_data_t g_sngisdn_data; void get_memory_info(void); -FT_DECLARE_INLINE(void) clear_call_data(sngisdn_chan_data_t *sngisdn_info) +FT_DECLARE(void) clear_call_data(sngisdn_chan_data_t *sngisdn_info) { uint32_t cc_id = ((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->cc_id; @@ -66,7 +66,7 @@ FT_DECLARE_INLINE(void) clear_call_data(sngisdn_chan_data_t *sngisdn_info) return; } -FT_DECLARE_INLINE(void) clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info) +FT_DECLARE(void) clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info) { ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_DEBUG, "Clearing glare data (suId:%d suInstId:%u spInstId:%u actv-suInstId:%u actv-spInstId:%u)\n", sngisdn_info->glare.suId, @@ -91,7 +91,7 @@ FT_DECLARE_INLINE(void) clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info) } -FT_DECLARE_INLINE(uint32_t) get_unique_suInstId(int16_t cc_id) +FT_DECLARE(uint32_t) get_unique_suInstId(int16_t cc_id) { uint32_t suInstId; ftdm_assert_return((cc_id > 0 && cc_id <=MAX_VARIANTS), FTDM_FAIL, "Invalid cc_id\n"); @@ -113,7 +113,7 @@ FT_DECLARE_INLINE(uint32_t) get_unique_suInstId(int16_t cc_id) return 0; } -FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_suInstId(int16_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data) +FT_DECLARE(ftdm_status_t) get_ftdmchan_by_suInstId(int16_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data) { ftdm_assert_return((cc_id > 0 && cc_id <=MAX_VARIANTS), FTDM_FAIL, "Invalid cc_id\n"); ftdm_assert_return(g_sngisdn_data.ccs[cc_id].activation_done, FTDM_FAIL, "Trying to find call on unconfigured CC\n"); @@ -125,7 +125,7 @@ FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_suInstId(int16_t cc_id, uint32_ return FTDM_SUCCESS; } -FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_spInstId(int16_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data) +FT_DECLARE(ftdm_status_t) get_ftdmchan_by_spInstId(int16_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data) { ftdm_assert_return((cc_id > 0 && cc_id <=MAX_VARIANTS), FTDM_FAIL, "Invalid cc_id\n"); ftdm_assert_return(g_sngisdn_data.ccs[cc_id].activation_done, FTDM_FAIL, "Trying to find call on unconfigured CC\n"); From 6be15e958e3257a5e4efd6ad6fec3b8115104957 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Wed, 10 Nov 2010 10:32:50 -0500 Subject: [PATCH 08/45] freetdm:Fix for RDNIS not set --- .../src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c | 1 + .../src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c | 1 + 2 files changed, 2 insertions(+) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 7ca408538a..83a8faa465 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -135,6 +135,7 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) cpy_calling_num_from_stack(&ftdmchan->caller_data, &conEvnt->cgPtyNmb); cpy_called_num_from_stack(&ftdmchan->caller_data, &conEvnt->cdPtyNmb); cpy_calling_name_from_stack(&ftdmchan->caller_data, &conEvnt->display); + cpy_redir_num_from_stack(&ftdmchan->caller_data, &conEvnt->redirNmb); ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Incoming call: Called No:[%s] Calling No:[%s]\n", ftdmchan->caller_data.dnis.digits, ftdmchan->caller_data.cid_num.digits); if (conEvnt->bearCap[0].eh.pres) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 3284d54165..8367687aec 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -147,6 +147,7 @@ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) cpy_called_num_from_user(&conEvnt.cdPtyNmb, &ftdmchan->caller_data); cpy_calling_num_from_user(&conEvnt.cgPtyNmb, &ftdmchan->caller_data); + cpy_redir_num_from_user(&conEvnt.redirNmb, &ftdmchan->caller_data); cpy_calling_name_from_user(&conEvnt, ftdmchan); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending SETUP (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); From 42edb9cfe9a238b355e89afd7b80eedb1fe3738a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 10 Nov 2010 10:30:18 -0600 Subject: [PATCH 09/45] swig --- .../languages/mod_managed/freeswitch_wrap.cxx | 169 +++++++++++++++++- src/mod/languages/mod_managed/managed/swig.cs | 169 +++++++++++++++++- 2 files changed, 327 insertions(+), 11 deletions(-) diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index 82ad8ab61b..13136d99e8 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -13019,11 +13019,11 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_dow_cmp(char * jarg1, int jarg2) { int jresult ; char *arg1 = (char *) 0 ; int arg2 ; - int result; + switch_bool_t result; arg1 = (char *)jarg1; arg2 = (int)jarg2; - result = (int)switch_dow_cmp((char const *)arg1,arg2); + result = (switch_bool_t)switch_dow_cmp((char const *)arg1,arg2); jresult = result; return jresult; } @@ -15706,6 +15706,29 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_write_video_frame_get(vo } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_state_run_set(void * jarg1, void * jarg2) { + switch_io_routines *arg1 = (switch_io_routines *) 0 ; + switch_io_state_run_t arg2 = (switch_io_state_run_t) 0 ; + + arg1 = (switch_io_routines *)jarg1; + arg2 = (switch_io_state_run_t)jarg2; + if (arg1) (arg1)->state_run = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_state_run_get(void * jarg1) { + void * jresult ; + switch_io_routines *arg1 = (switch_io_routines *) 0 ; + switch_io_state_run_t result; + + arg1 = (switch_io_routines *)jarg1; + result = (switch_io_state_run_t) ((arg1)->state_run); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_resurrect_session_set(void * jarg1, void * jarg2) { switch_io_routines *arg1 = (switch_io_routines *) 0 ; switch_io_resurrect_session_t arg2 = (switch_io_resurrect_session_t) 0 ; @@ -27923,15 +27946,17 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_sound_test(void * jarg1) { } -SWIGEXPORT void SWIGSTDCALL CSharp_switch_process_import(void * jarg1, void * jarg2, char * jarg3) { +SWIGEXPORT void SWIGSTDCALL CSharp_switch_process_import(void * jarg1, void * jarg2, char * jarg3, char * jarg4) { switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; switch_channel_t *arg2 = (switch_channel_t *) 0 ; char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; arg1 = (switch_core_session_t *)jarg1; arg2 = (switch_channel_t *)jarg2; arg3 = (char *)jarg3; - switch_process_import(arg1,arg2,(char const *)arg3); + arg4 = (char *)jarg4; + switch_process_import(arg1,arg2,(char const *)arg3,(char const *)arg4); } @@ -27947,6 +27972,26 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_uuid_exists(char * jarg1) { } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_set_match_callback(void * jarg1, void * jarg2) { + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + switch_ivr_dmachine_callback_t arg2 = (switch_ivr_dmachine_callback_t) 0 ; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (switch_ivr_dmachine_callback_t)jarg2; + switch_ivr_dmachine_set_match_callback(arg1,arg2); +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_set_nonmatch_callback(void * jarg1, void * jarg2) { + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + switch_ivr_dmachine_callback_t arg2 = (switch_ivr_dmachine_callback_t) 0 ; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (switch_ivr_dmachine_callback_t)jarg2; + switch_ivr_dmachine_set_nonmatch_callback(arg1,arg2); +} + + 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 ; @@ -31234,6 +31279,71 @@ SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_state_change(void } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_state_run_state_run_set(void * jarg1, void * jarg2) { + switch_io_event_hook_state_run *arg1 = (switch_io_event_hook_state_run *) 0 ; + switch_state_run_hook_t arg2 = (switch_state_run_hook_t) 0 ; + + arg1 = (switch_io_event_hook_state_run *)jarg1; + arg2 = (switch_state_run_hook_t)jarg2; + if (arg1) (arg1)->state_run = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_state_run_state_run_get(void * jarg1) { + void * jresult ; + switch_io_event_hook_state_run *arg1 = (switch_io_event_hook_state_run *) 0 ; + switch_state_run_hook_t result; + + arg1 = (switch_io_event_hook_state_run *)jarg1; + result = (switch_state_run_hook_t) ((arg1)->state_run); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_state_run_next_set(void * jarg1, void * jarg2) { + switch_io_event_hook_state_run *arg1 = (switch_io_event_hook_state_run *) 0 ; + switch_io_event_hook_state_run *arg2 = (switch_io_event_hook_state_run *) 0 ; + + arg1 = (switch_io_event_hook_state_run *)jarg1; + arg2 = (switch_io_event_hook_state_run *)jarg2; + if (arg1) (arg1)->next = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_state_run_next_get(void * jarg1) { + void * jresult ; + switch_io_event_hook_state_run *arg1 = (switch_io_event_hook_state_run *) 0 ; + switch_io_event_hook_state_run *result = 0 ; + + arg1 = (switch_io_event_hook_state_run *)jarg1; + result = (switch_io_event_hook_state_run *) ((arg1)->next); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_event_hook_state_run() { + void * jresult ; + switch_io_event_hook_state_run *result = 0 ; + + result = (switch_io_event_hook_state_run *)new switch_io_event_hook_state_run(); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_state_run(void * jarg1) { + switch_io_event_hook_state_run *arg1 = (switch_io_event_hook_state_run *) 0 ; + + arg1 = (switch_io_event_hook_state_run *)jarg1; + delete arg1; + +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_resurrect_session_resurrect_session_set(void * jarg1, void * jarg2) { switch_io_event_hook_resurrect_session *arg1 = (switch_io_event_hook_resurrect_session *) 0 ; switch_resurrect_session_hook_t arg2 = (switch_resurrect_session_hook_t) 0 ; @@ -31552,6 +31662,29 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_state_change_get(void } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_state_run_set(void * jarg1, void * jarg2) { + switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ; + switch_io_event_hook_state_run_t *arg2 = (switch_io_event_hook_state_run_t *) 0 ; + + arg1 = (switch_io_event_hooks *)jarg1; + arg2 = (switch_io_event_hook_state_run_t *)jarg2; + if (arg1) (arg1)->state_run = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_state_run_get(void * jarg1) { + void * jresult ; + switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ; + switch_io_event_hook_state_run_t *result = 0 ; + + arg1 = (switch_io_event_hooks *)jarg1; + result = (switch_io_event_hook_state_run_t *) ((arg1)->state_run); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_resurrect_session_set(void * jarg1, void * jarg2) { switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ; switch_io_event_hook_resurrect_session_t *arg2 = (switch_io_event_hook_resurrect_session_t *) 0 ; @@ -31650,6 +31783,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_state_change(void * } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_state_run(void * jarg1, void * jarg2) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_state_run_hook_t arg2 = (switch_state_run_hook_t) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (switch_state_run_hook_t)jarg2; + result = (switch_status_t)switch_core_event_hook_add_state_run(arg1,arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_read_frame(void * jarg1, void * jarg2) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -31818,6 +31965,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_state_change(voi } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_state_run(void * jarg1, void * jarg2) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_state_run_hook_t arg2 = (switch_state_run_hook_t) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (switch_state_run_hook_t)jarg2; + result = (switch_status_t)switch_core_event_hook_remove_state_run(arg1,arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_read_frame(void * jarg1, void * jarg2) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index 2beb015ffc..e31d444669 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -2984,8 +2984,8 @@ public class freeswitch { return ret; } - public static int switch_dow_cmp(string exp, int val) { - int ret = freeswitchPINVOKE.switch_dow_cmp(exp, val); + public static switch_bool_t switch_dow_cmp(string exp, int val) { + switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_dow_cmp(exp, val); return ret; } @@ -4374,8 +4374,8 @@ public class freeswitch { return ret; } - public static void switch_process_import(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_switch_channel peer_channel, string varname) { - freeswitchPINVOKE.switch_process_import(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_switch_channel.getCPtr(peer_channel), varname); + public static void switch_process_import(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_switch_channel peer_channel, string varname, string prefix) { + freeswitchPINVOKE.switch_process_import(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_switch_channel.getCPtr(peer_channel), varname, prefix); } public static switch_bool_t switch_ivr_uuid_exists(string uuid) { @@ -4383,6 +4383,14 @@ public class freeswitch { return ret; } + public static void switch_ivr_dmachine_set_match_callback(SWIGTYPE_p_switch_ivr_dmachine dmachine, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t match_callback) { + freeswitchPINVOKE.switch_ivr_dmachine_set_match_callback(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(match_callback)); + } + + public static void switch_ivr_dmachine_set_nonmatch_callback(SWIGTYPE_p_switch_ivr_dmachine dmachine, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t nonmatch_callback) { + freeswitchPINVOKE.switch_ivr_dmachine_set_nonmatch_callback(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(nonmatch_callback)); + } + 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; @@ -5038,6 +5046,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_core_event_hook_add_state_run(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session__switch_status_t state_run) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_state_run(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(state_run)); + return ret; + } + public static switch_status_t switch_core_event_hook_add_read_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t read_frame) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_read_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(read_frame)); return ret; @@ -5098,6 +5111,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_core_event_hook_remove_state_run(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session__switch_status_t state_run) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_state_run(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(state_run)); + return ret; + } + public static switch_status_t switch_core_event_hook_remove_read_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t read_frame) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_read_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(read_frame)); return ret; @@ -9264,6 +9282,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_write_video_frame_get")] public static extern IntPtr switch_io_routines_write_video_frame_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_state_run_set")] + public static extern void switch_io_routines_state_run_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_state_run_get")] + public static extern IntPtr switch_io_routines_state_run_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_resurrect_session_set")] public static extern void switch_io_routines_resurrect_session_set(HandleRef jarg1, HandleRef jarg2); @@ -12121,11 +12145,17 @@ class freeswitchPINVOKE { public static extern int switch_ivr_sound_test(HandleRef jarg1); [DllImport("mod_managed", EntryPoint="CSharp_switch_process_import")] - public static extern void switch_process_import(HandleRef jarg1, HandleRef jarg2, string jarg3); + public static extern void switch_process_import(HandleRef jarg1, HandleRef jarg2, string jarg3, string jarg4); [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_set_match_callback")] + public static extern void switch_ivr_dmachine_set_match_callback(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_set_nonmatch_callback")] + public static extern void switch_ivr_dmachine_set_nonmatch_callback(HandleRef jarg1, HandleRef jarg2); + [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); @@ -12897,6 +12927,24 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_state_change")] public static extern void delete_switch_io_event_hook_state_change(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_state_run_state_run_set")] + public static extern void switch_io_event_hook_state_run_state_run_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_state_run_state_run_get")] + public static extern IntPtr switch_io_event_hook_state_run_state_run_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_state_run_next_set")] + public static extern void switch_io_event_hook_state_run_next_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_state_run_next_get")] + public static extern IntPtr switch_io_event_hook_state_run_next_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_event_hook_state_run")] + public static extern IntPtr new_switch_io_event_hook_state_run(); + + [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_state_run")] + public static extern void delete_switch_io_event_hook_state_run(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_resurrect_session_resurrect_session_set")] public static extern void switch_io_event_hook_resurrect_session_resurrect_session_set(HandleRef jarg1, HandleRef jarg2); @@ -12981,6 +13029,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_state_change_get")] public static extern IntPtr switch_io_event_hooks_state_change_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_state_run_set")] + public static extern void switch_io_event_hooks_state_run_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_state_run_get")] + public static extern IntPtr switch_io_event_hooks_state_run_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_resurrect_session_set")] public static extern void switch_io_event_hooks_resurrect_session_set(HandleRef jarg1, HandleRef jarg2); @@ -13005,6 +13059,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_state_change")] public static extern int switch_core_event_hook_add_state_change(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_state_run")] + public static extern int switch_core_event_hook_add_state_run(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_read_frame")] public static extern int switch_core_event_hook_add_read_frame(HandleRef jarg1, HandleRef jarg2); @@ -13041,6 +13098,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_state_change")] public static extern int switch_core_event_hook_remove_state_change(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_state_run")] + public static extern int switch_core_event_hook_remove_state_run(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_read_frame")] public static extern int switch_core_event_hook_remove_read_frame(HandleRef jarg1, HandleRef jarg2); @@ -21201,6 +21261,7 @@ public enum switch_channel_flag_t { CF_CONSUME_ON_ORIGINATE, CF_PASSTHRU_PTIME_MISMATCH, CF_BRIDGE_NOWRITE, + CF_RECOVERED, CF_FLAG_MAX } @@ -24310,7 +24371,8 @@ namespace FreeSWITCH.Native { SWITCH_FILE_CALLBACK = (1 << 12), SWITCH_FILE_DONE = (1 << 13), SWITCH_FILE_BUFFER_DONE = (1 << 14), - SWITCH_FILE_WRITE_APPEND = (1 << 15) + SWITCH_FILE_WRITE_APPEND = (1 << 15), + SWITCH_FILE_WRITE_OVER = (1 << 16) } } @@ -25990,6 +26052,17 @@ public class switch_io_event_hooks : IDisposable { } } + public switch_io_event_hook_state_run state_run { + set { + freeswitchPINVOKE.switch_io_event_hooks_state_run_set(swigCPtr, switch_io_event_hook_state_run.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_state_run_get(swigCPtr); + switch_io_event_hook_state_run ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_state_run(cPtr, false); + return ret; + } + } + public switch_io_event_hook_resurrect_session resurrect_session { set { freeswitchPINVOKE.switch_io_event_hooks_resurrect_session_set(swigCPtr, switch_io_event_hook_resurrect_session.getCPtr(value)); @@ -26158,6 +26231,75 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class switch_io_event_hook_state_run : IDisposable { + private HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal switch_io_event_hook_state_run(IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new HandleRef(this, cPtr); + } + + internal static HandleRef getCPtr(switch_io_event_hook_state_run obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } + + ~switch_io_event_hook_state_run() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_switch_io_event_hook_state_run(swigCPtr); + } + swigCPtr = new HandleRef(null, IntPtr.Zero); + GC.SuppressFinalize(this); + } + } + + public SWIGTYPE_p_f_p_switch_core_session__switch_status_t state_run { + set { + freeswitchPINVOKE.switch_io_event_hook_state_run_state_run_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_state_run_state_run_get(swigCPtr); + SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_state_run next { + set { + freeswitchPINVOKE.switch_io_event_hook_state_run_next_set(swigCPtr, switch_io_event_hook_state_run.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_state_run_next_get(swigCPtr); + switch_io_event_hook_state_run ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_state_run(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_state_run() : this(freeswitchPINVOKE.new_switch_io_event_hook_state_run(), 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 { + +using System; +using System.Runtime.InteropServices; + public class switch_io_event_hook_video_read_frame : IDisposable { private HandleRef swigCPtr; protected bool swigCMemOwn; @@ -26545,6 +26687,17 @@ public class switch_io_routines : IDisposable { } } + public SWIGTYPE_p_f_p_switch_core_session__switch_status_t state_run { + set { + freeswitchPINVOKE.switch_io_routines_state_run_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_state_run_get(swigCPtr); + SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false); + return ret; + } + } + public SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t resurrect_session { set { freeswitchPINVOKE.switch_io_routines_resurrect_session_set(swigCPtr, SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t.getCPtr(value)); @@ -27578,7 +27731,8 @@ namespace FreeSWITCH.Native { SMBF_STEREO = (1 << 5), SMBF_ANSWER_REQ = (1 << 6), SMBF_THREAD_LOCK = (1 << 7), - SMBF_PRUNE = (1 << 8) + SMBF_PRUNE = (1 << 8), + SMBF_NO_PAUSE = (1 << 9) } } @@ -29660,6 +29814,7 @@ public enum switch_status_t { SWITCH_STATUS_IGNORE, SWITCH_STATUS_TOO_SMALL, SWITCH_STATUS_FOUND, + SWITCH_STATUS_CONTINUE, SWITCH_STATUS_NOT_INITALIZED } From f331303404a854d2ea9970bdb3cc2023002744e4 Mon Sep 17 00:00:00 2001 From: "Paulo R. Panhoto" Date: Wed, 10 Nov 2010 16:27:43 -0200 Subject: [PATCH 10/45] mod_mp4 -- Supports playback of MP4 files. * depends on libmp4v2 (originally compiled against v1.6.1) * File format details: - Files must be hinted (mpeg4ip can be used to create the hint tracks). - Video track encoding must be supported by FS (e.g. H.263) - Audio track encoding must be PCMU/8000/Mono. The audio track can be created with this tool: --- src/mod/applications/mod_mp4/Makefile | 6 + src/mod/applications/mod_mp4/exception.hpp | 59 +++ src/mod/applications/mod_mp4/mod_mp4.cpp | 547 ++++++++++++++++++++ src/mod/applications/mod_mp4/mp4_helper.cpp | 133 +++++ src/mod/applications/mod_mp4/mp4_helper.hpp | 137 +++++ 5 files changed, 882 insertions(+) create mode 100644 src/mod/applications/mod_mp4/Makefile create mode 100644 src/mod/applications/mod_mp4/exception.hpp create mode 100644 src/mod/applications/mod_mp4/mod_mp4.cpp create mode 100644 src/mod/applications/mod_mp4/mp4_helper.cpp create mode 100644 src/mod/applications/mod_mp4/mp4_helper.hpp diff --git a/src/mod/applications/mod_mp4/Makefile b/src/mod/applications/mod_mp4/Makefile new file mode 100644 index 0000000000..8c7932ae30 --- /dev/null +++ b/src/mod/applications/mod_mp4/Makefile @@ -0,0 +1,6 @@ +LOCAL_LDFLAGS=-lmp4v2 +LOCAL_SOURCES=mp4_helper.cpp +LOCAL_OBJS=mp4_helper.o + +BASE=../../../.. +include $(BASE)/build/modmake.rules diff --git a/src/mod/applications/mod_mp4/exception.hpp b/src/mod/applications/mod_mp4/exception.hpp new file mode 100644 index 0000000000..75f84989a2 --- /dev/null +++ b/src/mod/applications/mod_mp4/exception.hpp @@ -0,0 +1,59 @@ +/* + +The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is MP4 Helper Library to Freeswitch MP4 module. + +The Initial Developer of the Original Code is +Paulo Rogério Panhoto . +Portions created by the Initial Developer are Copyright (C) +the Initial Developer. All Rights Reserved. + +*/ + +#ifndef EXCEPTION_HPP_ +#define EXCEPTION_HPP_ + +#include +#include + +class Exception: public std::exception { + public: + Exception() + { + } + + Exception(const std::string & message): message_(message) + { + } + + Exception(const std::exception & e): message_(e.what()) + { + } + + Exception(const Exception & e): message_(e.message_) + { + } + + virtual ~Exception() throw() + { + } + + const char * what() const throw() + { + return message_.c_str(); + } + + private: + std::string message_; +}; + +#endif \ No newline at end of file diff --git a/src/mod/applications/mod_mp4/mod_mp4.cpp b/src/mod/applications/mod_mp4/mod_mp4.cpp new file mode 100644 index 0000000000..a1114d1ffc --- /dev/null +++ b/src/mod/applications/mod_mp4/mod_mp4.cpp @@ -0,0 +1,547 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2010, Anthony Minessale II + * + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * + * The Initial Developer of the Original Code is + * Paulo Rogério Panhoto + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * mod_mp4 -- MP4 File Format support for video apps. + * + */ + +#include +#include "mp4_helper.hpp" +#include "exception.hpp" + + +#ifndef min +#define min(x, y) ((x) < (y) ? (x) : (y)) +#endif + +SWITCH_MODULE_LOAD_FUNCTION(mod_mp4_load); +SWITCH_MODULE_DEFINITION(mod_mp4, mod_mp4_load, NULL, NULL); + +#define VID_BIT (1 << 31) +#define VERSION 4201 + +/* +struct file_header { + int32_t version; + char video_codec_name[32]; + char video_fmtp[128]; + uint32_t audio_rate; + uint32_t audio_ptime; + switch_time_t created; +}; + +struct record_helper { + switch_core_session_t *session; + switch_mutex_t *mutex; + int fd; + int up; +}; +*/ + +struct AVParams { + switch_core_session_t * session; + switch_channel_t * channel; + switch_timer_t * timer; + switch_frame_t * frame; + switch_mutex_t * mutex; + bool video; + switch_payload_t pt; + MP4::Context * vc; + bool done; + bool * quit; +}; + +static void *SWITCH_THREAD_FUNC record_video_thread(switch_thread_t *thread, void *obj) +{ +/* + record_helper *eh = reinterpret_cast(obj); + switch_core_session_t *session = eh->session; + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_status_t status; + switch_frame_t *read_frame; + int bytes; + + eh->up = 1; + while (switch_channel_ready(channel)) { + status = switch_core_session_read_video_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); + + if (!SWITCH_READ_ACCEPTABLE(status)) { + break; + } + + if (switch_test_flag(read_frame, SFF_CNG)) { + continue; + } + + bytes = read_frame->packetlen | VID_BIT; + + switch_mutex_lock(eh->mutex); + + if (write(eh->fd, &bytes, sizeof(bytes)) != (int) sizeof(bytes)) { + switch_mutex_unlock(eh->mutex); + break; + } + + if (write(eh->fd, read_frame->packet, read_frame->packetlen) != (int) read_frame->packetlen) { + switch_mutex_unlock(eh->mutex); + break; + } + + switch_mutex_unlock(eh->mutex); + + switch_core_session_write_video_frame(session, read_frame, SWITCH_IO_FLAG_NONE, 0); + } + eh->up = 0; +*/ + return NULL; +} + +SWITCH_STANDARD_APP(record_mp4_function) +{ +/* + switch_status_t status; + switch_frame_t *read_frame; + switch_channel_t *channel = switch_core_session_get_channel(session); + struct record_helper eh = { 0 }; + switch_thread_t *thread; + switch_threadattr_t *thd_attr = NULL; + int fd; + switch_mutex_t *mutex = NULL; + switch_codec_t codec, *vid_codec; + switch_codec_implementation_t read_impl = { }; + int count = 0, sanity = 30; + + switch_core_session_get_read_impl(session, &read_impl); + switch_channel_answer(channel); + + + while (switch_channel_up(channel) && !switch_channel_test_flag(channel, CF_VIDEO)) { + switch_yield(10000); + + if (count) count--; + + if (count == 0) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "%s waiting for video.\n", switch_channel_get_name(channel)); + count = 100; + if (!--sanity) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s timeout waiting for video.\n", + switch_channel_get_name(channel)); + return; + } + } + } + + if (!switch_channel_ready(channel)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "%s not ready.\n", switch_channel_get_name(channel)); + return; + } + +/* + if ((fd = open((char *) data, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRUSR | S_IWUSR)) < 0) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Error opening file %s\n", (char *) data); + return; + } +** + + MP4::Context ctx(reinterpret_cast(data), true); + + if (switch_core_codec_init(&codec, + "L16", + NULL, + read_impl.samples_per_second, + read_impl.microseconds_per_packet / 1000, + 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, + NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) + { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Audio Codec Activation Success\n"); + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Audio Codec Activation Fail\n"); + goto end; + } + + switch_core_session_set_read_codec(session, &codec); + + if (switch_channel_test_flag(channel, CF_VIDEO)) { + struct file_header h; + memset(&h, 0, sizeof(h)); + vid_codec = switch_core_session_get_video_read_codec(session); + + h.version = VERSION; + h.created = switch_micro_time_now(); + switch_set_string(h.video_codec_name, vid_codec->implementation->iananame); + if (vid_codec->fmtp_in) { + switch_set_string(h.video_fmtp, vid_codec->fmtp_in); + } + h.audio_rate = read_impl.samples_per_second; + h.audio_ptime = read_impl.microseconds_per_packet / 1000; + + if (write(fd, &h, sizeof(h)) != sizeof(h)) { + goto end; + } + + switch_mutex_init(&mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session)); + eh.mutex = mutex; + eh.fd = fd; + eh.session = session; + switch_threadattr_create(&thd_attr, switch_core_session_get_pool(session)); + switch_threadattr_detach_set(thd_attr, 1); + switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); + switch_thread_create(&thread, thd_attr, record_video_thread, &eh, switch_core_session_get_pool(session)); + } + + + while (switch_channel_ready(channel)) { + + status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); + + if (!SWITCH_READ_ACCEPTABLE(status)) { + break; + } + + if (switch_test_flag(read_frame, SFF_CNG)) { + continue; + } + + if (mutex) { + switch_mutex_lock(mutex); + } + + if (write(fd, &read_frame->datalen, sizeof(read_frame->datalen)) != sizeof(read_frame->datalen)) { + if (mutex) { + switch_mutex_unlock(mutex); + } + break; + } + + if (write(fd, read_frame->data, read_frame->datalen) != (int) read_frame->datalen) { + if (mutex) { + switch_mutex_unlock(mutex); + } + break; + } + + if (mutex) { + switch_mutex_unlock(mutex); + } + } + + + end: + + if (eh.up) { + while (eh.up) { + switch_cond_next(); + } + } + + switch_core_session_set_read_codec(session, NULL); + switch_core_codec_destroy(&codec); +*/ +} + +static void *SWITCH_THREAD_FUNC play_video_function(switch_thread_t *thread, void *obj) +{ + AVParams * pt = reinterpret_cast(obj); + u_int next = 0, first = 0xffffffff; + u_int64_t ts = 0, control = 0; + + bool ok; + bool sent = true; + pt->done = false; + switch_time_t start = switch_time_now(); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pt->session), SWITCH_LOG_DEBUG, "Video thread Started\n"); + while (!*pt->quit && switch_channel_ready(pt->channel)) { + if (pt->video) { + if (sent) { + switch_mutex_lock(pt->mutex); + pt->frame->packetlen = pt->frame->buflen; + ok = pt->vc->getVideoPacket(pt->frame->packet, pt->frame->packetlen, next); + switch_mutex_unlock(pt->mutex); + sent = false; + if (ok) { + switch_rtp_hdr_t *hdr = reinterpret_cast(pt->frame->packet); + if(first == 0xffffffff) first = next; + next -= first; + control = next * 90000LL / pt->vc->videoTrack().track.clock; + control -= first; + hdr->ts = htonl(control); + control = control * 1000 / 90; + if (pt->pt) + hdr->pt = pt->pt; + } else break; + } + + ts = switch_time_now() - start; + int64_t wait = control > ts ? (control - ts) : 0; + + if (wait > 0) { + switch_cond_next(); + // wait the time for the next Video frame + switch_sleep(wait); + } + + if (switch_channel_test_flag(pt->channel, CF_VIDEO)) { + switch_byte_t *data = (switch_byte_t *) pt->frame->packet; + + pt->frame->data = data + 12; + pt->frame->datalen = pt->frame->packetlen - 12; + switch_core_session_write_video_frame(pt->session, pt->frame, SWITCH_IO_FLAG_NONE, 0); + sent = true; + } + + } + } + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pt->session), SWITCH_LOG_DEBUG, "Video thread ended\n"); + pt->done = true; + return NULL; +} + +static void *SWITCH_THREAD_FUNC play_audio_function(switch_thread_t *thread, void *obj) +{ + AVParams * pt = reinterpret_cast(obj); + u_int next = 0, first = 0xffffffff; + u_int64_t ts = 0, control = 0; + + bool ok; + bool sent = true; + switch_dtmf_t dtmf = {0}; + pt->done = false; + switch_frame_t * read_frame; + + while (!*pt->quit && switch_channel_ready(pt->channel)) { + // event processing. + // -- SEE switch_ivr_play_say.c:1231 && mod_dptools.c:1428 && mod_dptools.c:1919 + switch_core_session_read_frame(pt->session, &read_frame, SWITCH_IO_FLAG_SINGLE_READ, 0); + + if (switch_channel_test_flag(pt->channel, CF_BREAK)) { + switch_channel_clear_flag(pt->channel, CF_BREAK); + break; + } + + switch_ivr_parse_all_events(pt->session); + + if (switch_channel_has_dtmf(pt->channel)) { + switch_channel_dequeue_dtmf(pt->channel, &dtmf); + const char * terminators = switch_channel_get_variable(pt->channel, SWITCH_PLAYBACK_TERMINATORS_VARIABLE); + if (terminators && !strcasecmp(terminators, "none")) terminators = NULL; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pt->session), SWITCH_LOG_DEBUG, "Digit %c\n", dtmf.digit); + if (terminators && strchr(terminators, dtmf.digit)) { + std::string digit(&dtmf.digit, 0, 1); + switch_channel_set_variable(pt->channel, SWITCH_PLAYBACK_TERMINATOR_USED, digit.c_str()); + break; + } + } + + switch_mutex_lock(pt->mutex); + pt->frame->datalen = pt->frame->buflen; + ok = pt->vc->getAudioPacket(pt->frame->data, pt->frame->datalen, next); + switch_mutex_unlock(pt->mutex); + + if (ok) { + if (pt->frame->datalen > (int) pt->frame->buflen) + pt->frame->datalen = pt->frame->buflen; + + switch_core_session_write_frame(pt->session, pt->frame, SWITCH_IO_FLAG_NONE, 0); + switch_core_timer_next(pt->timer); + } + else break; + } + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pt->session), SWITCH_LOG_DEBUG, "Audio done\n"); + *pt->quit = pt->done = true; + return NULL; +} + +SWITCH_STANDARD_APP(play_mp4_function) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_frame_t write_frame = { 0 }, vid_frame = {0}; + switch_codec_t codec = { 0 }, vid_codec = {0}, *read_vid_codec; + unsigned char *aud_buffer; + unsigned char *vid_buffer; + switch_timer_t timer = { 0 }; + switch_codec_implementation_t read_impl = {}; + bool done = false; + + try { + MP4::Context vc((char *) data); + + switch_payload_t pt = 0; + + switch_core_session_get_read_impl(session, &read_impl); + + aud_buffer = (unsigned char *) switch_core_session_alloc(session, SWITCH_RECOMMENDED_BUFFER_SIZE); + vid_buffer = (unsigned char *) switch_core_session_alloc(session, SWITCH_RECOMMENDED_BUFFER_SIZE); + + /* + if (!vc.isOpen()) + { + char msgbuf[1024]; + sprintf(msgbuf, "PLAYBACK ERROR (%s): FILE NOT FOUND.", (char*) data); + switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, msgbuf); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Error opening file %s\n", (char *) data); + return; + } + + if(!vc.isSupported()) + { + char msgbuf[1024]; + sprintf(msgbuf, "PLAYBACK ERROR (%s): UNSUPPORTED FORMAT OR FILE NOT HINTED.", (char*) data); + switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, msgbuf); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, + "Error reading track info. Maybe this file is not hinted.\n"); + throw 1; + } + */ + + switch_channel_set_variable(channel, "sip_force_video_fmtp", vc.videoTrack().fmtp.c_str()); + switch_channel_answer(channel); + + if ((read_vid_codec = switch_core_session_get_video_read_codec(session))) { + pt = read_vid_codec->agreed_pt; + } + + write_frame.codec = &codec; + write_frame.data = aud_buffer; + write_frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE; + + vid_frame.codec = &vid_codec; + vid_frame.packet = vid_buffer; + vid_frame.data = vid_buffer + 12; + vid_frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE - 12; + switch_set_flag((&vid_frame), SFF_RAW_RTP); + switch_set_flag((&vid_frame), SFF_PROXY_PACKET); + + if (switch_core_timer_init(&timer, "soft", read_impl.microseconds_per_packet / 1000, + read_impl.samples_per_packet, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Timer Activation Fail\n"); + throw 2; + } + + if (switch_core_codec_init(&codec, + vc.audioTrack().codecName, + NULL, + vc.audioTrack().clock, + vc.audioTrack().packetLength, + 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, + NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Audio Codec Activation Success\n"); + } else { + throw Exception("Audio Codec Activation Fail"); + } + + if (switch_core_codec_init(&vid_codec, + vc.videoTrack().track.codecName, + NULL, + 0, + 0, + 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, + NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Video Codec Activation Success\n"); + } else + { + throw Exception("Video Codec Activation Fail"); + } + switch_core_session_set_read_codec(session, &codec); + + AVParams vpt; + vpt.session = session; + vpt.channel = channel; + vpt.frame = &vid_frame; + vpt.timer = &timer; + vpt.video = true; + vpt.pt = pt; + vpt.vc = &vc; + switch_mutex_init(&vpt.mutex, SWITCH_MUTEX_DEFAULT, switch_core_session_get_pool(session)); + vpt.quit = &done; + + switch_threadattr_t * thd_attr; + switch_threadattr_create(&thd_attr, switch_core_session_get_pool(session)); + switch_threadattr_detach_set(thd_attr, 1); + switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); + switch_thread_t *thread; + switch_thread_create(&thread, thd_attr, play_video_function, (void*)&vpt, switch_core_session_get_pool(session)); + + AVParams apt; + apt.session = session; + apt.channel = channel; + apt.frame = &write_frame; + apt.timer = &timer; + apt.video = false; + apt.vc = &vc; + apt.mutex = vpt.mutex; + apt.quit = &done; + play_audio_function(NULL, &apt); + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Waiting for video thread to join.\n"); + while (!vpt.done) { + switch_cond_next(); + } + + switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, "FILE PLAYED"); + } catch(const std::exception & e) + { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s\n", e.what()); + switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, + (std::string("PLAYBACK_FAILED - ") + e.what()).c_str()); + }catch(...) + { + switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, "PLAYBACK_FAILED - See FS logs for detail."); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Exception caught.\n"); + } + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "All done.\n"); + if (timer.interval) switch_core_timer_destroy(&timer); + + switch_core_session_set_read_codec(session, NULL); + + if (switch_core_codec_ready(&codec)) switch_core_codec_destroy(&codec); + + if (switch_core_codec_ready(&vid_codec)) switch_core_codec_destroy(&vid_codec); +} + +SWITCH_MODULE_LOAD_FUNCTION(mod_mp4_load) +{ + switch_application_interface_t *app_interface; + + /* connect my internal structure to the blank pointer passed to me */ + *module_interface = switch_loadable_module_create_module_interface(pool, modname); + + SWITCH_ADD_APP(app_interface, "play_mp4", "play an MP4 file", "play an MP4 file", play_mp4_function, "", SAF_NONE); + //SWITCH_ADD_APP(app_interface, "record_mp4", "record an MP4 file", "record an MP4 file", record_mp4_function, "", SAF_NONE); + + /* 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: + */ diff --git a/src/mod/applications/mod_mp4/mp4_helper.cpp b/src/mod/applications/mod_mp4/mp4_helper.cpp new file mode 100644 index 0000000000..a55f5dbeb5 --- /dev/null +++ b/src/mod/applications/mod_mp4/mp4_helper.cpp @@ -0,0 +1,133 @@ +/* + +The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is MP4 Helper Library to the Freeswitch MP4 Module. + +The Initial Developer of the Original Code is +Paulo Rogério Panhoto . +Portions created by the Initial Developer are Copyright (C) +the Initial Developer. All Rights Reserved. + + +*/ + +#include "mp4_helper.hpp" + +namespace MP4 +{ + + Context::Context(const char * file, bool newFile) + { + if(newFile) create(file); + else open(file); + } + + Context::~Context() + { + close(); + } + + void Context::open(const char * file) + { + fh = MP4Read(file, 0); + if (fh == MP4_INVALID_FILE_HANDLE) throw Exception(file, "Open failed"); + getTracks(file); + } + + void Context::create(const char * file) + { + fh = MP4Create(file); + if (fh == MP4_INVALID_FILE_HANDLE) throw Exception(file, "Create file failed"); + } + + void Context::close() + { + if (!isOpen()) return; + MP4Close(fh); + } + + void Context::getTracks(const char * file) + { + int i = 0; + bool audioTrack = false, videoTrack = false; + + if (!isOpen()) throw Exception(file, "File is closed."); + + for (;;) + { + TrackProperties track; + if((track.hint = MP4FindTrackId(fh, i++, MP4_HINT_TRACK_TYPE, 0)) == MP4_INVALID_TRACK_ID) break; + + MP4GetHintTrackRtpPayload(fh, track.hint, &track.codecName, &track.payload, NULL, NULL); + + track.track = MP4GetHintTrackReferenceTrackId(fh, track.hint); + if(track.track == MP4_INVALID_TRACK_ID) continue; + track.clock = MP4GetTrackTimeScale(fh, track.hint); + + if (!strcmp(MP4GetTrackType(fh, track.track), MP4_AUDIO_TRACK_TYPE)) { + audioTrack = true; + + if(!strncmp(track.codecName, "PCM", 3)) + track.packetLength = 20; + else + track.packetLength = track.clock = 0; + + audio = track; + } else if (!strcmp(MP4GetTrackType(fh, track.track), MP4_VIDEO_TRACK_TYPE)) { + videoTrack = true; + + const char * sdp = MP4GetHintTrackSdp(fh, track.hint); + const char * fmtp = strstr(sdp, "fmtp"); + + if (fmtp) { + // finds beginning of 'fmtp' value; + for(fmtp += 5; *fmtp != ' '; ++fmtp); + ++fmtp; + + const char * eol = fmtp; + for(;*eol != '\r' && *eol != '\n'; ++eol); + video.fmtp = std::string(fmtp, eol); + } + video.track = track; + } + } + + if (!audioTrack || !videoTrack) throw Exception(file, "Missing audio/video track."); + } + + bool Context::getVideoPacket(void * buffer, u_int & size, u_int & ts) + { + return getPacket(video.track.hint, video.track.runtime, true, buffer, size, ts); + } + + bool Context::getAudioPacket(void * buffer, u_int & size, u_int & ts) + { + return getPacket(audio.hint, audio.runtime, false, buffer, size, ts); + } + + bool Context::getPacket(MP4TrackId hint, RuntimeProperties & rt, + bool header, void * buffer, u_int & size, u_int & ts) + { + if (rt.frame == 0 || rt.packet == rt.packetsPerFrame) { + ++rt.frame; + if(!MP4ReadRtpHint(fh, hint, rt.frame, &rt.packetsPerFrame)) + return false; + rt.packet = 0; + rt.last_frame = MP4GetSampleTime(fh, hint, rt.frame); + } + + ts = rt.last_frame; + if (!MP4ReadRtpPacket(fh, hint, rt.packet, (u_int8_t **) &buffer, &size, 0, header, true)) return false; + ++rt.packet; + return true; + } +} \ No newline at end of file diff --git a/src/mod/applications/mod_mp4/mp4_helper.hpp b/src/mod/applications/mod_mp4/mp4_helper.hpp new file mode 100644 index 0000000000..e2da30733f --- /dev/null +++ b/src/mod/applications/mod_mp4/mp4_helper.hpp @@ -0,0 +1,137 @@ +/* + +The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is MP4 Helper Library to Freeswitch MP4 module. + +The Initial Developer of the Original Code is +Paulo Rogério Panhoto . +Portions created by the Initial Developer are Copyright (C) +the Initial Developer. All Rights Reserved. + +*/ + +#ifndef MP4_HELPER_HPP_ +#define MP4_HELPER_HPP_ + +#include +#include +#include +#include + +namespace MP4 +{ + class Exception: public std::exception { + public: + Exception(const std::string & file, const std::string & error) + : description_(file + ':' + error) + { + } + + const char * what() const throw() + { + return description_.c_str(); + } + + ~Exception() throw() + { + } + + private: + std::string description_; + }; + + struct RuntimeProperties { + u_int32_t frame; // sampleID + u_int16_t packetsPerFrame; + u_int16_t packet; // packetID + u_int32_t last_frame; // timestamp + + RuntimeProperties(): frame(0), packetsPerFrame(0), packet(0) + { + } + }; + + + struct TrackProperties { + MP4TrackId hint; + MP4TrackId track; + + char * codecName; + u_int8_t payload; + u_int32_t clock; + u_int32_t packetLength; // packet Length in time (ms) + + RuntimeProperties runtime; + + TrackProperties(): hint(MP4_INVALID_TRACK_ID), track(MP4_INVALID_TRACK_ID), + codecName(NULL), payload(0), clock(0), packetLength(0) + { + } + }; + + typedef TrackProperties AudioProperties; + + struct VideoProperties { + TrackProperties track; + std::string fmtp; + + VideoProperties() + { + } + + VideoProperties(const TrackProperties & rhs): track(rhs) + { + } + }; + + class Context { + public: + + Context(const char * file, bool create = false); + ~Context(); + + void open(const char * file); + + void create(const char * file); + + void close(); + + // returns: TRUE = has more data, FALSE = end-of-stream or failure + bool getVideoPacket(void * buffer, u_int & size, u_int & ts); + + // returns: TRUE = has more data, FALSE = end-of-stream or failure + bool getAudioPacket(void * buffer, u_int & size, u_int & ts); + + bool isOpen() const { return fh != MP4_INVALID_FILE_HANDLE; } + + bool isSupported() const { return audio.track != MP4_INVALID_TRACK_ID && video.track.track != MP4_INVALID_TRACK_ID; } + + const AudioProperties & audioTrack() const { return audio; } + + const VideoProperties & videoTrack() const { return video; } + + private: + MP4FileHandle fh; + AudioProperties audio; + + VideoProperties video; + + // Prevent copy construction. + Context(const Context &); + + bool getPacket(MP4TrackId hint, RuntimeProperties & rt, + bool header, void * buffer, u_int & size, u_int & ts); + + void getTracks(const char * file); + }; +} +#endif From 3df1476a6d8d66b21f1802628bcb747f476c879a Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Wed, 10 Nov 2010 21:17:02 +0100 Subject: [PATCH 11/45] ftmod_libpri: Major cleanup, enhance configuration checks - Check D and B-channel availability (could be extended to check B-channel count) - Drop usage of spri->private_info, use spri->span instead - Use accessor functions where possible - Rename ftdmchan to chan where possible - Various other cleanups Signed-off-by: Stefan Knoblich Tested-by: Stefan Knoblich --- .../src/ftmod/ftmod_libpri/ftmod_libpri.c | 492 ++++++++++-------- 1 file changed, 274 insertions(+), 218 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 2abe761743..822002d1ab 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2010, Stefan Knoblich * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,10 +34,30 @@ #include "private/ftdm_core.h" #include "ftmod_libpri.h" +/*** + * Move to core + ***/ #ifndef ARRAY_SIZE #define ARRAY_SIZE(x) (sizeof((x)) / sizeof((x)[0])) #endif +static ftdm_channel_state_t ftdm_channel_get_state(const ftdm_channel_t *chan) +{ + assert(chan); + return chan->state; +} + +static void _ftdm_channel_set_state_force(ftdm_channel_t *chan, const ftdm_channel_state_t state) +{ + assert(chan); + chan->state = state; +} + +static const char *ftdm_span_get_trunk_type_str(const ftdm_span_t *span) +{ + return ftdm_trunk_type2str(span->trunk_type); +} + /** * \brief Unloads libpri IO module * \return Success @@ -258,7 +279,7 @@ static FIO_API_FUNCTION(ftdm_libpri_api) goto done; } - ftdm_clear_flag((&isdn_data->spri), LPWRAP_PRI_READY); + ftdm_clear_flag(&(isdn_data->spri), LPWRAP_PRI_READY); stream->write_function(stream, "%s: +OK killed.\n", __FILE__); goto done; } else { @@ -452,140 +473,155 @@ static ftdm_state_map_t isdn_state_map = { * \brief Handler for channel state change * \param ftdmchan Channel to handle */ -static __inline__ void state_advance(ftdm_channel_t *ftdmchan) +static __inline__ void state_advance(ftdm_channel_t *chan) { - //Q931mes_Generic *gen = (Q931mes_Generic *) ftdmchan->caller_data.raw_data; - ftdm_libpri_data_t *isdn_data = ftdmchan->span->signal_data; + ftdm_libpri_data_t *isdn_data = chan->span->signal_data; + q931_call *call = (q931_call *)chan->call_data; ftdm_status_t status; ftdm_sigmsg_t sig; - q931_call *call = (q931_call *) ftdmchan->call_data; ftdm_log(FTDM_LOG_DEBUG, "%d:%d STATE [%s]\n", - ftdmchan->span_id, ftdmchan->chan_id, ftdm_channel_state2str(ftdmchan->state)); + ftdm_channel_get_span_id(chan), ftdm_channel_get_id(chan), ftdm_channel_get_state_str(chan)); #if 0 - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) && !call) { + if (!ftdm_test_flag(chan, FTDM_CHANNEL_OUTBOUND) && !call) { ftdm_log(FTDM_LOG_WARNING, "NO CALL!!!!\n"); } #endif - memset(&sig, 0, sizeof(sig)); - sig.chan_id = ftdmchan->chan_id; - sig.span_id = ftdmchan->span_id; - sig.channel = ftdmchan; + sig.chan_id = ftdm_channel_get_id(chan); + sig.span_id = ftdm_channel_get_span_id(chan); + sig.channel = chan; - - switch (ftdmchan->state) { + switch (ftdm_channel_get_state(chan)) { case FTDM_CHANNEL_STATE_DOWN: { - ftdmchan->call_data = NULL; - ftdm_channel_done(ftdmchan); + chan->call_data = NULL; + ftdm_channel_done(chan); } break; + case FTDM_CHANNEL_STATE_PROGRESS: { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + if (ftdm_test_flag(chan, FTDM_CHANNEL_OUTBOUND)) { sig.event_id = FTDM_SIGEVENT_PROGRESS; - if ((status = ftdm_span_send_signal(ftdmchan->span, &sig) != FTDM_SUCCESS)) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + if ((status = ftdm_span_send_signal(ftdm_channel_get_span(chan), &sig) != FTDM_SUCCESS)) { + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); } } else if (call) { - pri_progress(isdn_data->spri.pri, call, ftdmchan->chan_id, 1); + pri_progress(isdn_data->spri.pri, call, ftdm_channel_get_id(chan), 1); } else { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); } } break; + case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + if (ftdm_test_flag(chan, FTDM_CHANNEL_OUTBOUND)) { sig.event_id = FTDM_SIGEVENT_PROGRESS_MEDIA; - if ((status = ftdm_span_send_signal(ftdmchan->span, &sig) != FTDM_SUCCESS)) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + if ((status = ftdm_span_send_signal(ftdm_channel_get_span(chan), &sig) != FTDM_SUCCESS)) { + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); } } else if (call) { - pri_proceeding(isdn_data->spri.pri, call, ftdmchan->chan_id, 1); + pri_proceeding(isdn_data->spri.pri, call, ftdm_channel_get_id(chan), 1); } else { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); } } break; + case FTDM_CHANNEL_STATE_RING: { - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + if (!ftdm_test_flag(chan, FTDM_CHANNEL_OUTBOUND)) { if (call) { - pri_acknowledge(isdn_data->spri.pri, call, ftdmchan->chan_id, 0); + pri_acknowledge(isdn_data->spri.pri, call, ftdm_channel_get_id(chan), 0); sig.event_id = FTDM_SIGEVENT_START; - if ((status = ftdm_span_send_signal(ftdmchan->span, &sig) != FTDM_SUCCESS)) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + if ((status = ftdm_span_send_signal(ftdm_channel_get_span(chan), &sig) != FTDM_SUCCESS)) { + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); } } else { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); } } } break; + case FTDM_CHANNEL_STATE_RESTART: { - ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_UNSPECIFIED; + chan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_UNSPECIFIED; sig.event_id = FTDM_SIGEVENT_RESTART; - status = ftdm_span_send_signal(ftdmchan->span, &sig); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + status = ftdm_span_send_signal(ftdm_channel_get_span(chan), &sig); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_DOWN); } break; + case FTDM_CHANNEL_STATE_UP: { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + if (ftdm_test_flag(chan, FTDM_CHANNEL_OUTBOUND)) { sig.event_id = FTDM_SIGEVENT_UP; - if ((status = ftdm_span_send_signal(ftdmchan->span, &sig) != FTDM_SUCCESS)) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + if ((status = ftdm_span_send_signal(ftdm_channel_get_span(chan), &sig) != FTDM_SUCCESS)) { + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); } } else if (call) { pri_answer(isdn_data->spri.pri, call, 0, 1); } else { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); } } break; + case FTDM_CHANNEL_STATE_DIALING: if (isdn_data) { + ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); struct pri_sr *sr; - int dp; + int ton; if (!(call = pri_new_call(isdn_data->spri.pri))) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + ftdm_log(FTDM_LOG_ERROR, "Failed to create new call on channel %d:%d\n", + ftdm_channel_get_span_id(chan), ftdm_channel_get_id(chan)); + /* TODO: set hangup cause? */ + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); return; } - dp = ftdmchan->caller_data.dnis.type; - switch(dp) { + ton = caller_data->dnis.type; + switch (ton) { case FTDM_TON_NATIONAL: - dp = PRI_NATIONAL_ISDN; + ton = PRI_NATIONAL_ISDN; break; case FTDM_TON_INTERNATIONAL: - dp = PRI_INTERNATIONAL_ISDN; + ton = PRI_INTERNATIONAL_ISDN; break; case FTDM_TON_SUBSCRIBER_NUMBER: - dp = PRI_LOCAL_ISDN; + ton = PRI_LOCAL_ISDN; break; default: - dp = isdn_data->dp; + ton = isdn_data->dp; } - ftdmchan->call_data = call; + chan->call_data = call; + sr = pri_sr_new(); + if (!sr) { + ftdm_log(FTDM_LOG_ERROR, "Failed to create new setup request on channel %d:%d\n", + ftdm_channel_get_span_id(chan), ftdm_channel_get_id(chan)); + /* TODO: handle error properly */ + } assert(sr); - pri_sr_set_channel(sr, ftdmchan->chan_id, 0, 0); + + pri_sr_set_channel(sr, ftdm_channel_get_id(chan), 0, 0); pri_sr_set_bearer(sr, PRI_TRANS_CAP_SPEECH, isdn_data->l1); - pri_sr_set_called(sr, ftdmchan->caller_data.dnis.digits, dp, 1); - pri_sr_set_caller(sr, ftdmchan->caller_data.cid_num.digits, - (isdn_data->opts & FTMOD_LIBPRI_OPT_OMIT_DISPLAY_IE ? NULL : ftdmchan->caller_data.cid_name), - dp, - (ftdmchan->caller_data.pres != 1 ? PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN : PRES_PROHIB_USER_NUMBER_NOT_SCREENED)); + + pri_sr_set_called(sr, caller_data->dnis.digits, ton, 1); + pri_sr_set_caller(sr, caller_data->cid_num.digits, + ((isdn_data->opts & FTMOD_LIBPRI_OPT_OMIT_DISPLAY_IE) ? NULL : caller_data->cid_name), + ton, + ((caller_data->pres != 1) ? PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN : PRES_PROHIB_USER_NUMBER_NOT_SCREENED)); if (!(isdn_data->opts & FTMOD_LIBPRI_OPT_OMIT_REDIRECTING_NUMBER_IE)) { - pri_sr_set_redirecting(sr, ftdmchan->caller_data.cid_num.digits, dp, + pri_sr_set_redirecting(sr, caller_data->cid_num.digits, ton, PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN, PRI_REDIR_UNCONDITIONAL); } #ifdef HAVE_LIBPRI_AOC @@ -596,39 +632,40 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) } #endif if (pri_setup(isdn_data->spri.pri, call, sr)) { - ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_DESTINATION_OUT_OF_ORDER; - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + caller_data->hangup_cause = FTDM_CAUSE_DESTINATION_OUT_OF_ORDER; + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); } pri_sr_free(sr); } - break; + case FTDM_CHANNEL_STATE_HANGUP: { if (call) { - pri_hangup(isdn_data->spri.pri, call, ftdmchan->caller_data.hangup_cause); + ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); + + pri_hangup(isdn_data->spri.pri, call, caller_data->hangup_cause); pri_destroycall(isdn_data->spri.pri, call); - ftdmchan->call_data = NULL; + + chan->call_data = NULL; } - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_DOWN); } break; + case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: break; + case FTDM_CHANNEL_STATE_TERMINATING: { sig.event_id = FTDM_SIGEVENT_STOP; - status = ftdm_span_send_signal(ftdmchan->span, &sig); + status = ftdm_span_send_signal(ftdm_channel_get_span(chan), &sig); /* user moves us to HANGUP and from there we go to DOWN */ } default: break; } - - - - return; } /** @@ -642,15 +679,17 @@ static __inline__ void check_state(ftdm_span_t *span) ftdm_clear_flag_locked(span, FTDM_SPAN_STATE_CHANGE); - for (j = 1; j <= span->chan_count; j++) { - if (ftdm_test_flag((span->channels[j]), FTDM_CHANNEL_STATE_CHANGE)) { - ftdm_channel_lock(span->channels[j]); + for (j = 1; j <= ftdm_span_get_chan_count(span); j++) { + ftdm_channel_t *chan = ftdm_span_get_channel(span, j); - ftdm_clear_flag((span->channels[j]), FTDM_CHANNEL_STATE_CHANGE); - state_advance(span->channels[j]); - ftdm_channel_complete_state(span->channels[j]); + if (ftdm_test_flag(chan, FTDM_CHANNEL_STATE_CHANGE)) { + ftdm_channel_lock(chan); - ftdm_channel_unlock(span->channels[j]); + ftdm_clear_flag(chan, FTDM_CHANNEL_STATE_CHANGE); + state_advance(chan); + ftdm_channel_complete_state(chan); + + ftdm_channel_unlock(chan); } } } @@ -666,6 +705,7 @@ static __inline__ void check_state(ftdm_span_t *span) static int on_info(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) { ftdm_log(FTDM_LOG_DEBUG, "number is: %s\n", pevent->ring.callednum); + if (strlen(pevent->ring.callednum) > 3) { ftdm_log(FTDM_LOG_DEBUG, "final number is: %s\n", pevent->ring.callednum); pri_answer(spri->pri, pevent->ring.call, 0, 1); @@ -682,40 +722,40 @@ static int on_info(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event */ static int on_hangup(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) { - ftdm_span_t *span = spri->private_info; - ftdm_channel_t *ftdmchan = NULL; + ftdm_span_t *span = spri->span; + ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->hangup.channel); q931_call *call = NULL; - ftdmchan = span->channels[pevent->hangup.channel]; - 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); + if (!chan) { + ftdm_log(FTDM_LOG_CRIT, "-- Hangup on channel %d:%d %s but it's not in use?\n", ftdm_span_get_id(spri->span), pevent->hangup.channel); return 0; } - ftdm_channel_lock(ftdmchan); + ftdm_channel_lock(chan); - 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)); + if (ftdm_channel_get_state(chan) >= FTDM_CHANNEL_STATE_TERMINATING) { + ftdm_log_chan(chan, FTDM_LOG_DEBUG, "Ignoring remote hangup in state %s\n", ftdm_channel_get_state_str(chan)); 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)); + if (!chan->call_data) { + ftdm_log_chan(chan, FTDM_LOG_DEBUG, "Ignoring remote hangup in state %s with no call data\n", ftdm_channel_get_state_str(chan)); 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; + call = (q931_call *)chan->call_data; + + ftdm_log(FTDM_LOG_DEBUG, "-- Hangup on channel %d:%d\n", ftdm_span_get_id(spri->span), pevent->hangup.channel); + pri_release(spri->pri, call, 0); pri_destroycall(spri->pri, call); - ftdmchan->call_data = NULL; - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + + chan->caller_data.hangup_cause = pevent->hangup.cause; + chan->call_data = NULL; + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_TERMINATING); done: - - ftdm_channel_unlock(ftdmchan); - + ftdm_channel_unlock(chan); return 0; } @@ -728,18 +768,16 @@ done: */ static int on_answer(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) { - ftdm_span_t *span = spri->private_info; - ftdm_channel_t *ftdmchan = NULL; + ftdm_span_t *span = spri->span; + ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->answer.channel); - ftdmchan = span->channels[pevent->answer.channel]; - - if (ftdmchan) { - ftdm_log(FTDM_LOG_DEBUG, "-- Answer on channel %d:%d\n", spri->span->span_id, pevent->answer.channel); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); + if (chan) { + ftdm_log(FTDM_LOG_DEBUG, "-- Answer on channel %d:%d\n", ftdm_span_get_id(span), pevent->answer.channel); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_UP); } else { - ftdm_log(FTDM_LOG_DEBUG, "-- Answer on channel %d:%d %s but it's not in use?\n", spri->span->span_id, pevent->answer.channel, ftdmchan->chan_id); + ftdm_log(FTDM_LOG_DEBUG, "-- Answer on channel %d:%d but it's not in the span?\n", + ftdm_span_get_id(span), pevent->answer.channel); } - return 0; } @@ -752,19 +790,16 @@ static int on_answer(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_even */ static int on_proceed(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) { - ftdm_span_t *span = spri->private_info; - ftdm_channel_t *ftdmchan = NULL; + ftdm_span_t *span = spri->span; + ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->answer.channel); - ftdmchan = span->channels[pevent->proceeding.channel]; - - if (ftdmchan) { - ftdm_log(FTDM_LOG_DEBUG, "-- Proceeding on channel %d:%d\n", spri->span->span_id, pevent->proceeding.channel); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); + if (chan) { + ftdm_log(FTDM_LOG_DEBUG, "-- Proceeding on channel %d:%d\n", ftdm_span_get_id(span), pevent->proceeding.channel); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); } else { - ftdm_log(FTDM_LOG_DEBUG, "-- Proceeding on channel %d:%d %s but it's not in use?\n", spri->span->span_id, - pevent->proceeding.channel, ftdmchan->chan_id); + ftdm_log(FTDM_LOG_DEBUG, "-- Proceeding on channel %d:%d but it's not in the span?\n", + ftdm_span_get_id(span), pevent->proceeding.channel); } - return 0; } @@ -777,22 +812,20 @@ static int on_proceed(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_eve */ static int on_ringing(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) { - ftdm_span_t *span = spri->private_info; - ftdm_channel_t *ftdmchan = NULL; + ftdm_span_t *span = spri->span; + ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->ringing.channel); - ftdmchan = span->channels[pevent->ringing.channel]; - - if (ftdmchan) { - ftdm_log(FTDM_LOG_DEBUG, "-- Ringing on channel %d:%d\n", spri->span->span_id, pevent->ringing.channel); + if (chan) { + ftdm_log(FTDM_LOG_DEBUG, "-- Ringing on channel %d:%d\n", ftdm_span_get_id(span), pevent->ringing.channel); /* we may get on_ringing even when we're already in FTDM_CHANNEL_STATE_PROGRESS_MEDIA */ - if (ftdmchan->state == FTDM_CHANNEL_STATE_PROGRESS_MEDIA) { + if (ftdm_channel_get_state(chan) == FTDM_CHANNEL_STATE_PROGRESS_MEDIA) { /* dont try to move to STATE_PROGRESS to avoid annoying veto warning */ return 0; } - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_PROGRESS); } else { - ftdm_log(FTDM_LOG_DEBUG, "-- Ringing on channel %d:%d %s but it's not in use?\n", spri->span->span_id, - pevent->ringing.channel, ftdmchan->chan_id); + ftdm_log(FTDM_LOG_DEBUG, "-- Ringing on channel %d:%d but it's not in the span?\n", + ftdm_span_get_id(span), pevent->ringing.channel); } return 0; @@ -807,50 +840,49 @@ static int on_ringing(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_eve */ static int on_ring(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) { - ftdm_span_t *span = spri->private_info; - ftdm_channel_t *ftdmchan = NULL; + ftdm_span_t *span = spri->span; + ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->ring.channel); + ftdm_caller_data_t *caller_data = NULL; int ret = 0; - //switch_mutex_lock(globals.channel_mutex); - - ftdmchan = span->channels[pevent->ring.channel]; - if (!ftdmchan || ftdmchan->state != FTDM_CHANNEL_STATE_DOWN || ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)) { - ftdm_log(FTDM_LOG_WARNING, "--Duplicate Ring on channel %d:%d (ignored)\n", spri->span->span_id, pevent->ring.channel); - ret = 0; + if (!chan || ftdm_channel_get_state(chan) != FTDM_CHANNEL_STATE_DOWN || ftdm_test_flag(chan, FTDM_CHANNEL_INUSE)) { + ftdm_log(FTDM_LOG_WARNING, "--Duplicate Ring on channel %d:%d (ignored)\n", ftdm_span_get_id(span), pevent->ring.channel); goto done; } - if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_WARNING, "--Failure opening channel %d:%d (ignored)\n", spri->span->span_id, pevent->ring.channel); - ret = 0; + if (ftdm_channel_open_chan(chan) != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_WARNING, "--Failure opening channel %d:%d (ignored)\n", ftdm_span_get_id(span), pevent->ring.channel); goto done; } - ftdm_log(FTDM_LOG_NOTICE, "-- Ring on channel %d:%d (from %s to %s)\n", spri->span->span_id, pevent->ring.channel, + ftdm_log(FTDM_LOG_NOTICE, "-- Ring on channel %d:%d (from %s to %s)\n", ftdm_span_get_id(span), pevent->ring.channel, pevent->ring.callingnum, pevent->ring.callednum); - memset(&ftdmchan->caller_data, 0, sizeof(ftdmchan->caller_data)); + caller_data = ftdm_channel_get_caller_data(chan); + + memset(caller_data, 0, sizeof(*caller_data)); + + ftdm_set_string(caller_data->cid_num.digits, (char *)pevent->ring.callingnum); + ftdm_set_string(caller_data->ani.digits, (char *)pevent->ring.callingani); + ftdm_set_string(caller_data->dnis.digits, (char *)pevent->ring.callednum); - ftdm_set_string(ftdmchan->caller_data.cid_num.digits, (char *)pevent->ring.callingnum); if (!ftdm_strlen_zero((char *)pevent->ring.callingname)) { - ftdm_set_string(ftdmchan->caller_data.cid_name, (char *)pevent->ring.callingname); + ftdm_set_string(caller_data->cid_name, (char *)pevent->ring.callingname); } else { - ftdm_set_string(ftdmchan->caller_data.cid_name, (char *)pevent->ring.callingnum); + ftdm_set_string(caller_data->cid_name, (char *)pevent->ring.callingnum); } - ftdm_set_string(ftdmchan->caller_data.ani.digits, (char *)pevent->ring.callingani); - ftdm_set_string(ftdmchan->caller_data.dnis.digits, (char *)pevent->ring.callednum); if (pevent->ring.ani2 >= 0) { - snprintf(ftdmchan->caller_data.aniII, 5, "%.2d", pevent->ring.ani2); + snprintf(caller_data->aniII, 5, "%.2d", pevent->ring.ani2); } // scary to trust this pointer, you'd think they would give you a copy of the call data so you own it...... - ftdmchan->call_data = pevent->ring.call; + /* hurr, this valid as along as nobody releases the call */ + chan->call_data = pevent->ring.call; - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RING); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RING); done: - //switch_mutex_unlock(globals.channel_mutex); return ret; } @@ -867,15 +899,15 @@ static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *e ftdm_log(FTDM_LOG_DEBUG, "EVENT [%s][%d][%d:%d] STATE [%s]\n", ftdm_oob_event2str(event->enum_id), event->enum_id, - event->channel->span_id, - event->channel->chan_id, - ftdm_channel_state2str(event->channel->state)); + ftdm_channel_get_span_id(event->channel), + ftdm_channel_get_id(event->channel), + ftdm_channel_get_state_str(event->channel)); - switch(event->enum_id) { + switch (event->enum_id) { case FTDM_OOB_ALARM_TRAP: { - if (event->channel->state != FTDM_CHANNEL_STATE_DOWN) { - if (event->channel->type == FTDM_CHAN_TYPE_B) { + if (ftdm_channel_get_state(event->channel) != FTDM_CHANNEL_STATE_DOWN) { + if (ftdm_channel_get_type(event->channel) == FTDM_CHAN_TYPE_B) { ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_RESTART); } } @@ -883,23 +915,23 @@ static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *e ftdm_set_flag(event->channel, FTDM_CHANNEL_SUSPENDED); ftdm_channel_get_alarms(event->channel, &alarmbits); - ftdm_log(FTDM_LOG_WARNING, "channel %d:%d (%d:%d) has alarms! [%s]\n", - event->channel->span_id, event->channel->chan_id, - event->channel->physical_span_id, event->channel->physical_chan_id, - event->channel->last_error); + ftdm_log(FTDM_LOG_WARNING, "channel %d:%d (%d:%d) has alarms! [%s]\n", + ftdm_channel_get_span_id(event->channel), ftdm_channel_get_id(event->channel), + ftdm_channel_get_ph_span_id(event->channel), ftdm_channel_get_ph_id(event->channel), + ftdm_channel_get_last_error(event->channel)); } break; case FTDM_OOB_ALARM_CLEAR: { - ftdm_log(FTDM_LOG_WARNING, "channel %d:%d (%d:%d) alarms Cleared!\n", event->channel->span_id, event->channel->chan_id, - event->channel->physical_span_id, event->channel->physical_chan_id); + ftdm_log(FTDM_LOG_WARNING, "channel %d:%d (%d:%d) alarms Cleared!\n", + ftdm_channel_get_span_id(event->channel), ftdm_channel_get_id(event->channel), + ftdm_channel_get_ph_span_id(event->channel), ftdm_channel_get_ph_id(event->channel)); ftdm_clear_flag(event->channel, FTDM_CHANNEL_SUSPENDED); ftdm_channel_get_alarms(event->channel, &alarmbits); } break; } - return FTDM_SUCCESS; } @@ -913,7 +945,7 @@ static __inline__ void check_events(ftdm_span_t *span) status = ftdm_span_poll_event(span, 5, NULL); - switch(status) { + switch (status) { case FTDM_SUCCESS: { ftdm_event_t *event; @@ -946,7 +978,7 @@ static __inline__ void check_events(ftdm_span_t *span) */ static int check_flags(lpwrap_pri_t *spri) { - ftdm_span_t *span = spri->private_info; + ftdm_span_t *span = spri->span; if (!ftdm_running() || ftdm_test_flag(span, FTDM_SPAN_STOP_THREAD)) { return -1; @@ -966,24 +998,21 @@ static int check_flags(lpwrap_pri_t *spri) */ static int on_restart(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) { - ftdm_span_t *span = spri->private_info; - ftdm_channel_t *ftdmchan; + ftdm_span_t *span = spri->span; + ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->restart.channel); - ftdm_log(FTDM_LOG_NOTICE, "-- Restarting %d:%d\n", spri->span->span_id, pevent->restart.channel); + ftdm_log(FTDM_LOG_NOTICE, "-- Restarting %d:%d\n", ftdm_span_get_id(span), pevent->restart.channel); + _ftdm_channel_set_state_force(spri->dchan, FTDM_CHANNEL_STATE_UP); - spri->dchan->state = FTDM_CHANNEL_STATE_UP; - ftdmchan = span->channels[pevent->restart.channel]; - - if (!ftdmchan) { + if (!chan) { return 0; } if (pevent->restart.channel < 1) { - ftdm_set_state_all(ftdmchan->span, FTDM_CHANNEL_STATE_RESTART); + ftdm_set_state_all(span, FTDM_CHANNEL_STATE_RESTART); } else { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); } - return 0; } @@ -1156,7 +1185,7 @@ static int on_facility(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ev ftdm_log(FTDM_LOG_DEBUG, "FACILITY subcommand %d handler returned %d\n", sub->cmd, res); } - ftdm_log(FTDM_LOG_DEBUG, "Caught Event on span %d %u (%s)\n", spri->span->span_id, event_type, lpwrap_pri_event_str(event_type)); + ftdm_log(FTDM_LOG_DEBUG, "Caught Event on span %d %u (%s)\n", ftdm_span_get_id(spri->span), event_type, lpwrap_pri_event_str(event_type)); return 0; } #endif @@ -1172,27 +1201,27 @@ static int on_dchan_up(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ev { if (!ftdm_test_flag(spri, LPWRAP_PRI_READY)) { ftdm_signaling_status_t status = FTDM_SIG_STATE_UP; - ftdm_channel_t *ftdmchan = NULL; + ftdm_span_t *span = spri->span; ftdm_sigmsg_t sig; int i; - ftdm_log(FTDM_LOG_INFO, "Span %d D-Chan UP!\n", spri->span->span_id); + ftdm_log(FTDM_LOG_INFO, "Span %d D-Channel UP!\n", ftdm_span_get_id(span)); ftdm_set_flag(spri, LPWRAP_PRI_READY); - ftdm_set_state_all(spri->span, FTDM_CHANNEL_STATE_RESTART); + ftdm_set_state_all(span, FTDM_CHANNEL_STATE_RESTART); - ftdm_log(FTDM_LOG_NOTICE, "%d:Signaling link status changed to %s\n", spri->span->span_id, ftdm_signaling_status2str(status)); + ftdm_log(FTDM_LOG_NOTICE, "%d:Signaling link status changed to %s\n", ftdm_span_get_id(span), ftdm_signaling_status2str(status)); - for (i = 1; i <= spri->span->chan_count; i++) { - ftdmchan = spri->span->channels[i]; + for (i = 1; i <= ftdm_span_get_chan_count(span); i++) { + ftdm_channel_t *chan = ftdm_span_get_channel(span, i); memset(&sig, 0, sizeof(sig)); - sig.chan_id = ftdmchan->chan_id; - sig.span_id = ftdmchan->span_id; - sig.channel = ftdmchan; + sig.span_id = ftdm_channel_get_span_id(chan); + sig.chan_id = ftdm_channel_get_id(chan); + sig.channel = chan; sig.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; sig.raw_data = &status; - ftdm_span_send_signal(spri->span, &sig); + ftdm_span_send_signal(span, &sig); } } return 0; @@ -1209,27 +1238,27 @@ static int on_dchan_down(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ { if (ftdm_test_flag(spri, LPWRAP_PRI_READY)) { ftdm_signaling_status_t status = FTDM_SIG_STATE_DOWN; - ftdm_channel_t *ftdmchan = NULL; + ftdm_span_t *span = spri->span; ftdm_sigmsg_t sig; int i; - ftdm_log(FTDM_LOG_INFO, "Span %d D-Chan DOWN!\n", spri->span->span_id); + ftdm_log(FTDM_LOG_INFO, "Span %d D-Channel DOWN!\n", ftdm_span_get_id(span)); ftdm_clear_flag(spri, LPWRAP_PRI_READY); - ftdm_set_state_all(spri->span, FTDM_CHANNEL_STATE_RESTART); + ftdm_set_state_all(span, FTDM_CHANNEL_STATE_RESTART); - ftdm_log(FTDM_LOG_NOTICE, "%d:Signaling link status changed to %s\n", spri->span->span_id, ftdm_signaling_status2str(status)); + ftdm_log(FTDM_LOG_NOTICE, "%d:Signaling link status changed to %s\n", ftdm_span_get_id(span), ftdm_signaling_status2str(status)); - for (i = 1; i <= spri->span->chan_count; i++) { - ftdmchan = spri->span->channels[i]; + for (i = 1; i <= ftdm_span_get_chan_count(span); i++) { + ftdm_channel_t *chan = ftdm_span_get_channel(span, i); memset(&sig, 0, sizeof(sig)); - sig.chan_id = ftdmchan->chan_id; - sig.span_id = ftdmchan->span_id; - sig.channel = ftdmchan; + sig.span_id = ftdm_channel_get_span_id(chan); + sig.chan_id = ftdm_channel_get_id(chan); + sig.channel = chan; sig.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; sig.raw_data = &status; - ftdm_span_send_signal(spri->span, &sig); + ftdm_span_send_signal(span, &sig); } } @@ -1245,7 +1274,7 @@ static int on_dchan_down(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ */ static int on_anything(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) { - ftdm_log(FTDM_LOG_DEBUG, "Caught Event span %d %u (%s)\n", spri->span->span_id, event_type, lpwrap_pri_event_str(event_type)); + ftdm_log(FTDM_LOG_DEBUG, "Caught Event span %d %u (%s)\n", ftdm_span_get_id(spri->span), event_type, lpwrap_pri_event_str(event_type)); return 0; } @@ -1258,7 +1287,7 @@ static int on_anything(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ev */ static int on_io_fail(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) { - ftdm_log(FTDM_LOG_DEBUG, "Caught Event span %d %u (%s)\n", spri->span->span_id, event_type, lpwrap_pri_event_str(event_type)); + ftdm_log(FTDM_LOG_DEBUG, "Caught Event span %d %u (%s)\n", ftdm_span_get_id(spri->span), event_type, lpwrap_pri_event_str(event_type)); return 0; } @@ -1283,21 +1312,25 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) if (!got_d) { int i, x; - for (i = 1, x = 0; i <= span->chan_count; i++) { - if (span->channels[i]->type == FTDM_CHAN_TYPE_DQ921) { - if (ftdm_channel_open(span->span_id, i, &isdn_data->dchan) == FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_DEBUG, "opening d-channel #%d %d:%d\n", x, isdn_data->dchan->span_id, isdn_data->dchan->chan_id); + for (i = 1, x = 0; i <= ftdm_span_get_chan_count(span); i++) { + ftdm_channel_t *chan = ftdm_span_get_channel(span, i); + + if (ftdm_channel_get_type(chan) == FTDM_CHAN_TYPE_DQ921) { + if (ftdm_channel_open(ftdm_span_get_id(span), i, &isdn_data->dchan) == FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_DEBUG, "opening D-Channel #%d %d:%d\n", x, + ftdm_channel_get_span_id(isdn_data->dchan), ftdm_channel_get_id(isdn_data->dchan)); got_d = 1; x++; break; } else { - ftdm_log(FTDM_LOG_ERROR, "failed to open d-channel #%d %d:%d\n", x, span->channels[i]->span_id, span->channels[i]->chan_id); + ftdm_log(FTDM_LOG_ERROR, "failed to open D-Channel #%d %d:%d\n", x, + ftdm_channel_get_span_id(chan), ftdm_channel_get_id(chan)); } } } } if (!got_d || !isdn_data->dchan) { - ftdm_log(FTDM_LOG_ERROR, "Failed to get a D-channel in span %d\n", span->span_id); + ftdm_log(FTDM_LOG_ERROR, "Failed to get a D-Channel in span %d\n", ftdm_span_get_id(span)); break; } @@ -1356,26 +1389,28 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_FACILITY, on_facility); #endif if (down) { - ftdm_log(FTDM_LOG_INFO, "PRI back up on span %d\n", isdn_data->spri.span->span_id); + ftdm_log(FTDM_LOG_INFO, "PRI back up on span %d\n", ftdm_span_get_id(span)); ftdm_set_state_all(span, FTDM_CHANNEL_STATE_RESTART); down = 0; } isdn_data->spri.on_loop = check_flags; - isdn_data->spri.private_info = span; +// isdn_data->spri.private_info = span; lpwrap_run_pri(&isdn_data->spri); } else { - snprintf(span->last_error, sizeof(span->last_error), "PRI init FAIL!"); + ftdm_log(FTDM_LOG_CRIT, "PRI init failed!\n"); + snprintf(span->last_error, sizeof(span->last_error), "PRI init failed!"); + break; } if (!ftdm_running() || ftdm_test_flag(span, FTDM_SPAN_STOP_THREAD)) { break; } - ftdm_log(FTDM_LOG_CRIT, "PRI down on span %d\n", isdn_data->spri.span->span_id); + ftdm_log(FTDM_LOG_CRIT, "PRI down on span %d\n", ftdm_span_get_id(span)); if (isdn_data->spri.dchan) { - isdn_data->spri.dchan->state = FTDM_CHANNEL_STATE_DOWN; + _ftdm_channel_set_state_force(isdn_data->spri.dchan, FTDM_CHANNEL_STATE_DOWN); } if (!down) { @@ -1386,11 +1421,11 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) check_state(span); check_events(span); - down++; + down = 1; ftdm_sleep(5000); } out: - ftdm_log(FTDM_LOG_DEBUG, "PRI thread ended on span %d\n", span->span_id); + ftdm_log(FTDM_LOG_DEBUG, "PRI thread ended on span %d\n", ftdm_span_get_id(span)); ftdm_clear_flag(span, FTDM_SPAN_IN_THREAD); ftdm_clear_flag(isdn_data, FTMOD_LIBPRI_RUNNING); @@ -1437,8 +1472,8 @@ static ftdm_status_t ftdm_libpri_stop(ftdm_span_t *span) */ static ftdm_status_t ftdm_libpri_start(ftdm_span_t *span) { - ftdm_status_t ret; ftdm_libpri_data_t *isdn_data = span->signal_data; + ftdm_status_t ret; if (ftdm_test_flag(isdn_data, FTMOD_LIBPRI_RUNNING)) { return FTDM_FAIL; @@ -1569,39 +1604,60 @@ static uint32_t parse_opts(const char *in) */ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) { - uint32_t i, x = 0; + uint32_t i; + uint32_t bchan_count = 0; + uint32_t dchan_count = 0; uint32_t paramindex = 0; - //ftdm_channel_t *dchans[2] = {0}; + //ftdm_channel_t *dchan = NULL; ftdm_libpri_data_t *isdn_data; const char *var, *val; if (ftdm_span_get_trunk_type(span) >= FTDM_TRUNK_NONE) { - ftdm_log(FTDM_LOG_WARNING, "Invalid trunk type '%s' defaulting to T1.\n", ftdm_trunk_type2str(ftdm_span_get_trunk_type(span))); + ftdm_log(FTDM_LOG_WARNING, "Invalid trunk type '%s' defaulting to T1.\n", ftdm_span_get_trunk_type_str(span)); ftdm_span_set_trunk_type(span, FTDM_TRUNK_T1); } - for (i = 1; i <= span->chan_count; i++) { - if (span->channels[i]->type == FTDM_CHAN_TYPE_DQ921) { - if (x > 1) { + for (i = 1; i <= ftdm_span_get_chan_count(span); i++) { + ftdm_channel_t *chan = ftdm_span_get_channel(span, i); + + switch (ftdm_channel_get_type(chan)) { + case FTDM_CHAN_TYPE_DQ921: + if (dchan_count > 1) { + ftdm_log(FTDM_LOG_ERROR, "Span has more than 2 D-Channels!\n"); snprintf(span->last_error, sizeof(span->last_error), "Span has more than 2 D-Channels!"); return FTDM_FAIL; } else { #if 0 - if (ftdm_channel_open(span->span_id, i, &dchans[x]) == FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_DEBUG, "opening d-channel #%d %d:%d\n", x, dchans[x]->span_id, dchans[x]->chan_id); - dchans[x]->state = FTDM_CHANNEL_STATE_UP; - x++; + if (ftdm_channel_open(ftdm_span_get_id(span), i, &dchan) == FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_DEBUG, "opening D-Channel %d:%d\n", ftdm_channel_get_span_id(dchan), ftdm_channel_get_id(dchan)); + _ftdm_channel_set_state_force(dchan, FTDM_CHANNEL_STATE_UP); + } else { + ftdm_log(FTDM_LOG_ERROR, "Failed to open D-Channel %d:%d\n", ftdm_channel_get_span_id(chan), ftdm_channel_getid(chan)); + snprintf(span->last_error, sizeof(span->last_error), "Failed to open D-Channel %d:%d\n", ftdm_channel_get_span_id(chan), ftdm_channel_getid(chan)); + return FTDM_FAIL; } #endif - x++; + dchan_count++; } + break; + + case FTDM_CHAN_TYPE_B: + bchan_count++; + break; + default: /* Ignore other channel types */ + break; } } - if (!x) { + if (!dchan_count) { ftdm_log(FTDM_LOG_ERROR, "Span has no D-Channel!\n"); snprintf(span->last_error, sizeof(span->last_error), "Span has no D-Channel!"); return FTDM_FAIL; } + if (!bchan_count) { + ftdm_log(FTDM_LOG_ERROR, "Span has no B-Channels!\n"); + snprintf(span->last_error, sizeof(span->last_error), "Span has no B-Channels!"); + return FTDM_FAIL; + } isdn_data = ftdm_malloc(sizeof(*isdn_data)); assert(isdn_data != NULL); @@ -1611,8 +1667,8 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) case FTDM_TRUNK_BRI: case FTDM_TRUNK_BRI_PTMP: #ifndef HAVE_LIBPRI_BRI - ftdm_log(FTDM_LOG_ERROR, "Unsupported trunk type: '%s', libpri too old\n", ftdm_trunk_type2str(ftdm_span_get_trunk_type(span))); - snprintf(span->last_error, sizeof(span->last_error), "Unsupported trunk type [%s], libpri too old", ftdm_trunk_type2str(ftdm_span_get_trunk_type(span))); + ftdm_log(FTDM_LOG_ERROR, "Unsupported trunk type: '%s', libpri too old\n", ftdm_span_get_trunk_type_str(span)); + snprintf(span->last_error, sizeof(span->last_error), "Unsupported trunk type [%s], libpri too old", ftdm_span_get_trunk_type_str(span)); return FTDM_FAIL; #endif case FTDM_TRUNK_E1: @@ -1625,8 +1681,8 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) isdn_data->l1 = PRI_LAYER_1_ULAW; break; default: - ftdm_log(FTDM_LOG_ERROR, "Invalid trunk type: '%s'\n", ftdm_trunk_type2str(ftdm_span_get_trunk_type(span))); - snprintf(span->last_error, sizeof(span->last_error), "Invalid trunk type [%s]", ftdm_trunk_type2str(ftdm_span_get_trunk_type(span))); + ftdm_log(FTDM_LOG_ERROR, "Invalid trunk type: '%s'\n", ftdm_span_get_trunk_type_str(span)); + snprintf(span->last_error, sizeof(span->last_error), "Invalid trunk type [%s]", ftdm_span_get_trunk_type_str(span)); return FTDM_FAIL; } From 1074f006a06c09719319797aad6dbee4b837d087 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Wed, 10 Nov 2010 22:42:18 +0100 Subject: [PATCH 12/45] ftmod_libpri: Clean up misnamed parameters and variables, remove unused. - Add alias names for parameters: "node" -> "mode" "dp" -> "ton" "switch" -> "dialect" "l1" -> "layer1" (Switching between ftmod_libpri and ftmod_isdn is easier now.) - Removed unused members from struct ftdm_libpri_data and rename misnamed ones Signed-off-by: Stefan Knoblich --- .../src/ftmod/ftmod_libpri/ftmod_libpri.c | 93 +++++++++---------- .../src/ftmod/ftmod_libpri/ftmod_libpri.h | 27 ++---- 2 files changed, 48 insertions(+), 72 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 822002d1ab..fff3f45c94 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -191,7 +191,7 @@ static const struct ftdm_libpri_debug { * \param in Debug string to parse for * \return Flags or -1 if nothing matched */ -static int parse_debug(const char *in, int *flags) +static int parse_debug(const char *in, uint32_t *flags) { int res = -1; int i; @@ -295,7 +295,7 @@ static FIO_API_FUNCTION(ftdm_libpri_api) if (ftdm_span_find_by_name(argv[1], &span) == FTDM_SUCCESS) { ftdm_libpri_data_t *isdn_data = span->signal_data; - int flags = 0; + uint32_t flags = 0; if (span->start != ftdm_libpri_start) { stream->write_function(stream, "%s: -ERR invalid span.\n", __FILE__); @@ -598,7 +598,7 @@ static __inline__ void state_advance(ftdm_channel_t *chan) ton = PRI_LOCAL_ISDN; break; default: - ton = isdn_data->dp; + ton = isdn_data->ton; } chan->call_data = call; @@ -612,7 +612,7 @@ static __inline__ void state_advance(ftdm_channel_t *chan) assert(sr); pri_sr_set_channel(sr, ftdm_channel_get_id(chan), 0, 0); - pri_sr_set_bearer(sr, PRI_TRANS_CAP_SPEECH, isdn_data->l1); + pri_sr_set_bearer(sr, PRI_TRANS_CAP_SPEECH, isdn_data->layer1); pri_sr_set_called(sr, caller_data->dnis.digits, ton, 1); pri_sr_set_caller(sr, caller_data->cid_num.digits, @@ -1340,18 +1340,18 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) case FTDM_TRUNK_T1: case FTDM_TRUNK_J1: res = lpwrap_init_pri(&isdn_data->spri, span, isdn_data->dchan, - isdn_data->pswitch, isdn_data->node, isdn_data->debug); + isdn_data->dialect, isdn_data->mode, isdn_data->debug_mask); break; case FTDM_TRUNK_BRI: res = lpwrap_init_bri(&isdn_data->spri, span, isdn_data->dchan, - isdn_data->pswitch, isdn_data->node, 1, isdn_data->debug); + isdn_data->dialect, isdn_data->mode, 1, isdn_data->debug_mask); #ifndef HAVE_LIBPRI_BRI goto out; #endif break; case FTDM_TRUNK_BRI_PTMP: res = lpwrap_init_bri(&isdn_data->spri, span, isdn_data->dchan, - isdn_data->pswitch, isdn_data->node, 0, isdn_data->debug); + isdn_data->dialect, isdn_data->mode, 0, isdn_data->debug_mask); #ifndef HAVE_LIBPRI_BRI goto out; #endif @@ -1395,7 +1395,6 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) } isdn_data->spri.on_loop = check_flags; -// isdn_data->spri.private_info = span; lpwrap_run_pri(&isdn_data->spri); } else { @@ -1473,7 +1472,6 @@ static ftdm_status_t ftdm_libpri_stop(ftdm_span_t *span) static ftdm_status_t ftdm_libpri_start(ftdm_span_t *span) { ftdm_libpri_data_t *isdn_data = span->signal_data; - ftdm_status_t ret; if (ftdm_test_flag(isdn_data, FTMOD_LIBPRI_RUNNING)) { return FTDM_FAIL; @@ -1483,13 +1481,8 @@ static ftdm_status_t ftdm_libpri_start(ftdm_span_t *span) ftdm_clear_flag(span, FTDM_SPAN_IN_THREAD); ftdm_set_flag(isdn_data, FTMOD_LIBPRI_RUNNING); - ret = ftdm_thread_create_detached(ftdm_libpri_run, span); - if (ret != FTDM_SUCCESS) { - return ret; - } - - return ret; + return ftdm_thread_create_detached(ftdm_libpri_run, span); } /** @@ -1497,12 +1490,13 @@ static ftdm_status_t ftdm_libpri_start(ftdm_span_t *span) * \param node Node string to convert * \return -1 on failure, node value on success */ -static int parse_node(const char *node) +static int parse_mode(const char *mode) { - if (!strcasecmp(node, "cpe") || !strcasecmp(node, "user")) + if (!strcasecmp(mode, "cpe") || !strcasecmp(mode, "user")) return PRI_CPE; - if (!strcasecmp(node, "network") || !strcasecmp(node, "net")) + if (!strcasecmp(mode, "network") || !strcasecmp(mode, "net")) return PRI_NETWORK; + return -1; } @@ -1511,23 +1505,23 @@ static int parse_node(const char *node) * \param swtype Swtype string to convert * \return Switch value */ -static int parse_switch(const char *swtype) +static int parse_dialect(const char *dialect) { - if (!strcasecmp(swtype, "ni1")) + if (!strcasecmp(dialect, "ni1")) return PRI_SWITCH_NI1; - if (!strcasecmp(swtype, "ni2")) + if (!strcasecmp(dialect, "ni2")) return PRI_SWITCH_NI2; - if (!strcasecmp(swtype, "dms100")) + if (!strcasecmp(dialect, "dms100")) return PRI_SWITCH_DMS100; - if (!strcasecmp(swtype, "lucent5e") || !strcasecmp(swtype, "5ess")) + if (!strcasecmp(dialect, "lucent5e") || !strcasecmp(dialect, "5ess")) return PRI_SWITCH_LUCENT5E; - if (!strcasecmp(swtype, "att4ess") || !strcasecmp(swtype, "4ess")) + if (!strcasecmp(dialect, "att4ess") || !strcasecmp(dialect, "4ess")) return PRI_SWITCH_ATT4ESS; - if (!strcasecmp(swtype, "euroisdn")) + if (!strcasecmp(dialect, "euroisdn") || !strcasecmp(dialect, "q931")) return PRI_SWITCH_EUROISDN_E1; - if (!strcasecmp(swtype, "gr303eoc")) + if (!strcasecmp(dialect, "gr303eoc")) return PRI_SWITCH_GR303_EOC; - if (!strcasecmp(swtype, "gr303tmc")) + if (!strcasecmp(dialect, "gr303tmc")) return PRI_SWITCH_GR303_TMC; return PRI_SWITCH_DMS100; @@ -1538,9 +1532,9 @@ static int parse_switch(const char *swtype) * \param l1 L1 string to convert * \return L1 value */ -static int parse_l1(const char *l1) +static int parse_layer1(const char *val) { - if (!strcasecmp(l1, "alaw")) + if (!strcasecmp(val, "alaw")) return PRI_LAYER_1_ALAW; return PRI_LAYER_1_ULAW; @@ -1551,17 +1545,17 @@ static int parse_l1(const char *l1) * \param dp DP string to convert * \return DP value */ -static int parse_numplan(const char *dp) +static int parse_ton(const char *ton) { - if (!strcasecmp(dp, "international")) + if (!strcasecmp(ton, "international")) return PRI_INTERNATIONAL_ISDN; - if (!strcasecmp(dp, "national")) + if (!strcasecmp(ton, "national")) return PRI_NATIONAL_ISDN; - if (!strcasecmp(dp, "local")) + if (!strcasecmp(ton, "local")) return PRI_LOCAL_ISDN; - if (!strcasecmp(dp, "private")) + if (!strcasecmp(ton, "private")) return PRI_PRIVATE; - if (!strcasecmp(dp, "unknown")) + if (!strcasecmp(ton, "unknown")) return PRI_UNKNOWN; return PRI_UNKNOWN; @@ -1673,12 +1667,12 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) #endif case FTDM_TRUNK_E1: ftdm_log(FTDM_LOG_NOTICE, "Setting default Layer 1 to ALAW since this is an E1/BRI/BRI PTMP trunk\n"); - isdn_data->l1 = PRI_LAYER_1_ALAW; + isdn_data->layer1 = PRI_LAYER_1_ALAW; break; case FTDM_TRUNK_T1: case FTDM_TRUNK_J1: ftdm_log(FTDM_LOG_NOTICE, "Setting default Layer 1 to ULAW since this is a T1/J1 trunk\n"); - isdn_data->l1 = PRI_LAYER_1_ULAW; + isdn_data->layer1 = PRI_LAYER_1_ULAW; break; default: ftdm_log(FTDM_LOG_ERROR, "Invalid trunk type: '%s'\n", ftdm_span_get_trunk_type_str(span)); @@ -1696,28 +1690,28 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) return FTDM_FAIL; } - if (!strcasecmp(var, "node")) { - if ((isdn_data->node = parse_node(val)) == -1) { + if (!strcasecmp(var, "node") || !strcasecmp(var, "mode")) { + if ((isdn_data->mode = parse_mode(val)) == -1) { ftdm_log(FTDM_LOG_ERROR, "Unknown node type '%s', defaulting to CPE mode\n", val); - isdn_data->node = PRI_CPE; + isdn_data->mode = PRI_CPE; } } - else if (!strcasecmp(var, "switch")) { - isdn_data->pswitch = parse_switch(val); + else if (!strcasecmp(var, "switch") || !strcasecmp(var, "dialect")) { + isdn_data->dialect = parse_dialect(val); } else if (!strcasecmp(var, "opts")) { isdn_data->opts = parse_opts(val); } - else if (!strcasecmp(var, "dp")) { - isdn_data->dp = parse_numplan(val); + else if (!strcasecmp(var, "dp") || !strcasecmp(var, "ton")) { + isdn_data->ton = parse_ton(val); } - else if (!strcasecmp(var, "l1")) { - isdn_data->l1 = parse_l1(val); + else if (!strcasecmp(var, "l1") || !strcasecmp(var, "layer1")) { + isdn_data->layer1 = parse_layer1(val); } else if (!strcasecmp(var, "debug")) { - if (parse_debug(val, &isdn_data->debug) == -1) { + if (parse_debug(val, &isdn_data->debug_mask) == -1) { ftdm_log(FTDM_LOG_ERROR, "Invalid debug flag, ignoring parameter\n"); - isdn_data->debug = 0; + isdn_data->debug_mask = 0; } } else { @@ -1730,9 +1724,6 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) span->start = ftdm_libpri_start; span->stop = ftdm_libpri_stop; span->signal_cb = sig_cb; - //isdn_data->dchans[0] = dchans[0]; - //isdn_data->dchans[1] = dchans[1]; - //isdn_data->dchan = isdn_data->dchans[0]; span->signal_data = isdn_data; span->signal_type = FTDM_SIGTYPE_ISDN; diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h index b11baec6c5..3f47cd2888 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h @@ -54,35 +54,20 @@ typedef enum { struct ftdm_libpri_data { ftdm_channel_t *dchan; - ftdm_channel_t *dchans[2]; - struct ftdm_sigmsg sigmsg; - uint32_t flags; - int32_t mode; ftdm_isdn_opts_t opts; + uint32_t flags; + uint32_t debug_mask; - int node; - int pswitch; - char *dialplan; - unsigned int l1; - unsigned int dp; - - int debug; + int mode; + int dialect; + unsigned int layer1; + unsigned int ton; lpwrap_pri_t spri; }; typedef struct ftdm_libpri_data ftdm_libpri_data_t; - -/* b-channel private data */ -struct ftdm_isdn_bchan_data -{ - int32_t digit_timeout; -}; - -typedef struct ftdm_isdn_bchan_data ftdm_isdn_bchan_data_t; - - #endif /* For Emacs: From ca8c23361bd365dd180a35c4d50241c53c08f246 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Wed, 10 Nov 2010 17:27:27 -0500 Subject: [PATCH 13/45] mod_sangoma_codec: add G722 --- .../mod_sangoma_codec/mod_sangoma_codec.c | 76 +++++++------------ 1 file changed, 29 insertions(+), 47 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 63073ed189..0bc02829df 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -78,6 +78,8 @@ typedef struct vocallo_codec_s { int bpfd; /* bytes per frame decompressed */ int bpfc; /* bytes per frame compressed */ + int sampling_rate; /* declared sampling rate */ + int actual_sampling_rate; /* true sampling rate */ int autoinit; /* initialize on start loop or manually */ } vocallo_codec_t; @@ -85,21 +87,22 @@ typedef struct vocallo_codec_s { #define ILBC_152_PAYLOAD 98 vocallo_codec_t g_codec_map[] = { - { SNGTC_CODEC_PCMU, 0, "PCMU", "Sangoma PCMU", 40, 64000, 10000, 80, 160, 80, 1 }, - { SNGTC_CODEC_PCMA, 8, "PCMA", "Sangoma PCMA", 40, 64000, 10000, 80, 160, 80, 1 }, - { SNGTC_CODEC_L16_1, 10, "L16", "Sangoma L16", 40, 120000, 10000, 80, 160, 160, 1 }, - { SNGTC_CODEC_G729AB, 18, "G729", "Sangoma G729", 40, 8000, 10000, 80, 160, 10, 1 }, - { SNGTC_CODEC_G726_32, 122, "G726-32", "Sangoma G.726 32k", 40, 32000, 10000, 80, 160, 40, 1 }, - { SNGTC_CODEC_GSM_FR, 3, "GSM", "Sangoma GSM", 20, 13200, 20000, 160, 320, 33, 0 }, - { SNGTC_CODEC_ILBC_133, ILBC_133_PAYLOAD, "iLBC", "Sangoma iLBC", -1, -1, -1, -1, -1, -1, 0 }, - { SNGTC_CODEC_ILBC_152, ILBC_152_PAYLOAD, "iLBC", "Sangoma iLBC", -1, -1, -1, -1, -1, -1, 0 }, - { SNGTC_CODEC_G723_1_63, 4, "G723", "Sangoma G723", 90, 6300, 30000, 240, 480, 24, 0}, -#if 0 - /* FIXME: sampling rate seems wrong with this, audioooo soooundssssss sloooooow ... */ - { SNGTC_CODEC_G722, 9, "G722", "Sangoma G722", 20, 64000, 20000, 160, 640, 160, 0 }, -#endif - { SNGTC_CODEC_AMR_1220, 96, "AMR", "Sangoma AMR", 20, 12200, 20000, 160, 320, 0, 0}, - { -1, -1, NULL, NULL, -1, -1, -1, -1, -1, -1 }, + /* auto-init codecs */ + { SNGTC_CODEC_PCMU, 0, "PCMU", "Sangoma PCMU", 40, 64000, 10000, 80, 160, 80, 8000, 8000, 1 }, + { SNGTC_CODEC_PCMA, 8, "PCMA", "Sangoma PCMA", 40, 64000, 10000, 80, 160, 80, 8000, 8000, 1 }, + { SNGTC_CODEC_L16_1, 10, "L16", "Sangoma L16", 40, 120000, 10000, 80, 160, 160, 8000, 8000, 0 }, + { SNGTC_CODEC_L16_2, 10, "L16", "Sangoma L16 2", 40, 320000, 10000, 80, 320, 320, 16000, 16000, 0 }, + { SNGTC_CODEC_G729AB, 18, "G729", "Sangoma G729", 40, 8000, 10000, 80, 160, 10, 8000, 8000, 1 }, + { SNGTC_CODEC_G726_32, 122, "G726-32", "Sangoma G.726 32k", 40, 32000, 10000, 80, 160, 40, 8000, 8000, 1 }, + { SNGTC_CODEC_G722, 9, "G722", "Sangoma G722", 20, 64000, 10000, 160, 320, 80, 8000, 16000, 1 }, + + /* manually initialized */ + { SNGTC_CODEC_GSM_FR, 3, "GSM", "Sangoma GSM", 20, 13200, 20000, 160, 320, 33, 8000, 8000, 0 }, + { SNGTC_CODEC_G723_1_63, 4, "G723", "Sangoma G723", 90, 6300, 30000, 240, 480, 24, 8000, 8000, 0 }, + { SNGTC_CODEC_AMR_1220, 96, "AMR", "Sangoma AMR", 20, 12200, 20000, 160, 320, 0, 8000, 8000, 0 }, + { SNGTC_CODEC_ILBC_133, ILBC_133_PAYLOAD, "iLBC", "Sangoma iLBC", -1, -1, -1, -1, -1, -1, -1, -1, 0 }, + { SNGTC_CODEC_ILBC_152, ILBC_152_PAYLOAD, "iLBC", "Sangoma iLBC", -1, -1, -1, -1, -1, -1, -1, -1, 0 }, + { -1, -1, NULL, NULL, -1, -1, -1, -1, -1, -1, -1, -1, 0 }, }; /* RFC3389 RTP Payload for Comfort Noise */ @@ -323,7 +326,8 @@ static switch_status_t switch_sangoma_init(switch_codec_t *codec, switch_codec_f if (encoding) { sess->encoder.request.usr_priv = sess; sess->encoder.request.a.host_ip = g_rtpip; - sess->encoder.request.a.codec_id = SNGTC_CODEC_L16_1; + sess->encoder.request.a.codec_id = vcodec->actual_sampling_rate == 16000 + ? SNGTC_CODEC_L16_2 : SNGTC_CODEC_L16_1; sess->encoder.request.a.ms = codec->implementation->microseconds_per_packet/1000; sess->encoder.request.b.host_ip = g_rtpip; @@ -338,7 +342,8 @@ static switch_status_t switch_sangoma_init(switch_codec_t *codec, switch_codec_f sess->decoder.request.a.ms = codec->implementation->microseconds_per_packet/1000; sess->decoder.request.b.host_ip = g_rtpip; - sess->decoder.request.b.codec_id = SNGTC_CODEC_L16_1; + sess->decoder.request.b.codec_id = vcodec->actual_sampling_rate == 16000 + ? SNGTC_CODEC_L16_2 : SNGTC_CODEC_L16_1; sess->decoder.request.b.ms = codec->implementation->microseconds_per_packet/1000; } @@ -787,7 +792,6 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses } } 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); } @@ -1191,7 +1195,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading codecs, register='%s', noregister='%s'\n", g_codec_register_list, g_codec_noregister_list); for (c = 0; g_codec_map[c].codec_id != -1; c++) { - if (g_codec_map[c].codec_id == SNGTC_CODEC_L16_1) { + if (g_codec_map[c].codec_id == SNGTC_CODEC_L16_1 || g_codec_map[c].codec_id == SNGTC_CODEC_L16_2) { /* registering L16 does not make any sense */ continue; } @@ -1241,8 +1245,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) g_codec_map[c].iana, /* the IANA code number, ie http://www.iana.org/assignments/rtp-parameters */ g_codec_map[c].iana_name, /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function), fmtp is used in SDP for format specific parameters */ - 8000, /* samples transferred per second */ - 8000, /* actual samples transferred per second */ + g_codec_map[c].sampling_rate, /* samples transferred per second */ + g_codec_map[c].actual_sampling_rate, /* actual samples transferred per second */ g_codec_map[c].bps, /* bits transferred per second */ g_codec_map[c].mpf * i, /* microseconds per frame */ g_codec_map[c].spf * i, /* samples per frame */ @@ -1333,8 +1337,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) g_codec_map[c].iana, /* the IANA code number, ie http://www.iana.org/assignments/rtp-parameters */ g_codec_map[c].iana_name, /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function), fmtp is used in SDP for format specific parameters */ - 8000, /* samples transferred per second */ - 8000, /* actual samples transferred per second */ + g_codec_map[c].sampling_rate, /* samples transferred per second */ + g_codec_map[c].actual_sampling_rate, /* actual samples transferred per second */ g_codec_map[c].bps, /* bits transferred per second */ g_codec_map[c].mpf * i, /* microseconds per frame */ g_codec_map[c].spf * i, /* samples per frame */ @@ -1349,36 +1353,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) } break; - - case SNGTC_CODEC_G722: - switch_core_codec_add_implementation(pool, codec_interface, /* the codec interface we allocated and we want to register with the core */ - SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - g_codec_map[c].iana, /* the IANA code number, ie http://www.iana.org/assignments/rtp-parameters */ - g_codec_map[c].iana_name, /* the IANA code name */ - NULL, /* default fmtp to send (can be overridden by the init function), fmtp is used in SDP for format specific parameters */ - 8000, /* samples transferred per second */ - 16000, /* actual samples transferred per second */ - g_codec_map[c].bps, /* bits transferred per second */ - g_codec_map[c].mpf, /* microseconds per frame */ - g_codec_map[c].spf, /* samples per frame */ - g_codec_map[c].bpfd, /* number of bytes per frame decompressed */ - g_codec_map[c].bpfc, /* number of bytes per frame compressed */ - 1, /* number of channels represented */ - g_codec_map[c].spf, /* number of frames per network packet (I dont think this is used at all) */ - switch_sangoma_init, /* function to initialize a codec session using this implementation */ - switch_sangoma_encode, /* function to encode slinear data into encoded data */ - switch_sangoma_decode, /* function to decode encoded data into slinear data */ - switch_sangoma_destroy); /* deinitalize a codec handle using this implementation */ - break; - case SNGTC_CODEC_AMR_1220: switch_core_codec_add_implementation(pool, codec_interface, /* the codec interface we allocated and we want to register with the core */ SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ g_codec_map[c].iana, /* the IANA code number, ie http://www.iana.org/assignments/rtp-parameters */ g_codec_map[c].iana_name, /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function), fmtp is used in SDP for format specific parameters */ - 8000, /* samples transferred per second */ - 8000, /* actual samples transferred per second */ + g_codec_map[c].sampling_rate, /* samples transferred per second */ + g_codec_map[c].actual_sampling_rate, /* actual samples transferred per second */ g_codec_map[c].bps, /* bits transferred per second */ g_codec_map[c].mpf, /* microseconds per frame */ g_codec_map[c].spf, /* samples per frame */ From b278dd2379e455ef1f256b703fdec1c292bf4179 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 10 Nov 2010 16:55:56 -0600 Subject: [PATCH 14/45] add manual_rtp_bugs to profile and chan var and 3 new RTP bugs SEND_LINEAR_TIMESTAMPS|START_SEQ_AT_ZERO|NEVER_SEND_MARKER RTP_BUG_SEND_LINEAR_TIMESTAMPS = (1 << 3), Our friends at Sonus get real mad when the timestamps are not in perfect sequence even during periods of silence. With this flag, we will only increment the timestamp when write packets even if they are eons apart. RTP_BUG_START_SEQ_AT_ZERO = (1 << 4), Our friends at Sonus also get real mad if the sequence number does not start at 0. Typically, we set this to a random starting value for your saftey. This is a security risk you take upon yourself when you enable this flag. RTP_BUG_NEVER_SEND_MARKER = (1 << 5), Our friends at Sonus are on a roll, They also get easily dumbfounded by marker bits. This flag will never send any. Sheesh.... --- src/include/switch_types.h | 30 +++++++++++- src/mod/endpoints/mod_sofia/mod_sofia.h | 2 + src/mod/endpoints/mod_sofia/sofia.c | 41 +++------------- src/mod/endpoints/mod_sofia/sofia_glue.c | 62 +++++++++++++++++++++++- src/switch_rtp.c | 21 +++++--- 5 files changed, 112 insertions(+), 44 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 272d435068..c01638089f 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -596,7 +596,7 @@ typedef enum { */ - RTP_BUG_IGNORE_MARK_BIT = (1 << 2) + RTP_BUG_IGNORE_MARK_BIT = (1 << 2), /* A Huawei SBC has been discovered that sends the mark bit on every single RTP packet. @@ -606,6 +606,34 @@ typedef enum { */ + + RTP_BUG_SEND_LINEAR_TIMESTAMPS = (1 << 3), + + /* + Our friends at Sonus get real mad when the timestamps are not in perfect sequence even during periods of silence. + With this flag, we will only increment the timestamp when write packets even if they are eons apart. + + */ + + RTP_BUG_START_SEQ_AT_ZERO = (1 << 4), + + /* + Our friends at Sonus also get real mad if the sequence number does not start at 0. + Typically, we set this to a random starting value for your saftey. + This is a security risk you take upon yourself when you enable this flag. + */ + + + RTP_BUG_NEVER_SEND_MARKER = (1 << 5), + + /* + Our friends at Sonus are on a roll, They also get easily dumbfounded by marker bits. + This flag will never send any. Sheesh.... + */ + + + + } switch_rtp_bug_flag_t; diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 6978e34ffc..750fb60c15 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -558,6 +558,7 @@ struct sofia_profile { char *user_agent_filter; uint32_t max_registrations_perext; switch_rtp_bug_flag_t auto_rtp_bugs; + switch_rtp_bug_flag_t manual_rtp_bugs; uint32_t ib_calls; uint32_t ob_calls; uint32_t ib_failed_calls; @@ -1035,3 +1036,4 @@ 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); void sofia_glue_check_dtmf_type(private_object_t *tech_pvt); +void sofia_glue_parse_rtp_bugs(uint32_t *flag_pole, const char *str); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 7cb4c5b528..e5672061bd 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2220,39 +2220,6 @@ static void parse_domain_tag(sofia_profile_t *profile, switch_xml_t x_domain_tag } } -static void parse_rtp_bugs(sofia_profile_t *profile, const char *str) -{ - - if (switch_stristr("clear", str)) { - profile->auto_rtp_bugs = 0; - } - - if (switch_stristr("CISCO_SKIP_MARK_BIT_2833", str)) { - profile->auto_rtp_bugs |= RTP_BUG_CISCO_SKIP_MARK_BIT_2833; - } - - if (switch_stristr("~CISCO_SKIP_MARK_BIT_2833", str)) { - profile->auto_rtp_bugs &= ~RTP_BUG_CISCO_SKIP_MARK_BIT_2833; - } - - if (switch_stristr("SONUS_SEND_INVALID_TIMESTAMP_2833", str)) { - profile->auto_rtp_bugs |= RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833; - } - - if (switch_stristr("~SONUS_SEND_INVALID_TIMESTAMP_2833", str)) { - profile->auto_rtp_bugs &= ~RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833; - } - - if (switch_stristr("IGNORE_MARK_BIT", str)) { - profile->auto_rtp_bugs |= RTP_BUG_IGNORE_MARK_BIT; - } - - if (switch_stristr("~IGNORE_MARK_BIT", str)) { - profile->auto_rtp_bugs &= ~RTP_BUG_IGNORE_MARK_BIT; - } - -} - switch_status_t reconfig_sofia(sofia_profile_t *profile) { switch_xml_t cfg, xml = NULL, xprofile, profiles, gateways_tag, domain_tag, domains_tag, aliases_tag, alias_tag, settings, param; @@ -2382,7 +2349,9 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) sofia_clear_pflag(profile, PFLAG_MESSAGE_QUERY_ON_FIRST_REGISTER); } } else if (!strcasecmp(var, "auto-rtp-bugs")) { - parse_rtp_bugs(profile, val); + sofia_glue_parse_rtp_bugs(&profile->auto_rtp_bugs, val); + } else if (!strcasecmp(var, "manual-rtp-bugs")) { + sofia_glue_parse_rtp_bugs(&profile->manual_rtp_bugs, val); } else if (!strcasecmp(var, "user-agent-string")) { profile->user_agent = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "auto-restart")) { @@ -3103,7 +3072,9 @@ switch_status_t config_sofia(int reload, char *profile_name) profile->rport_level = 2; } } else if (!strcasecmp(var, "auto-rtp-bugs")) { - parse_rtp_bugs(profile, val); + sofia_glue_parse_rtp_bugs(&profile->auto_rtp_bugs, val); + } else if (!strcasecmp(var, "manual-rtp-bugs")) { + sofia_glue_parse_rtp_bugs(&profile->manual_rtp_bugs, val); } else if (!strcasecmp(var, "dbname")) { profile->dbname = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "presence-hosts")) { diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index fbd270d41b..6e9aacb126 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -3106,7 +3106,11 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f tech_pvt->rtp_bugs |= RTP_BUG_IGNORE_MARK_BIT; } - switch_rtp_intentional_bugs(tech_pvt->rtp_session, tech_pvt->rtp_bugs); + if ((val = switch_channel_get_variable(tech_pvt->channel, "rtp_manual_rtp_bugs"))) { + sofia_glue_parse_rtp_bugs(&tech_pvt->rtp_bugs, val); + } + + switch_rtp_intentional_bugs(tech_pvt->rtp_session, tech_pvt->rtp_bugs | tech_pvt->profile->manual_rtp_bugs); if ((vad_in && inb) || (vad_out && !inb)) { switch_rtp_enable_vad(tech_pvt->rtp_session, tech_pvt->session, &tech_pvt->read_codec, SWITCH_VAD_FLAG_TALKING); @@ -5990,6 +5994,62 @@ void sofia_glue_build_vid_refresh_message(switch_core_session_t *session, const } +void sofia_glue_parse_rtp_bugs(uint32_t *flag_pole, const char *str) +{ + + if (switch_stristr("clear", str)) { + *flag_pole = 0; + } + + if (switch_stristr("CISCO_SKIP_MARK_BIT_2833", str)) { + *flag_pole |= RTP_BUG_CISCO_SKIP_MARK_BIT_2833; + } + + if (switch_stristr("~CISCO_SKIP_MARK_BIT_2833", str)) { + *flag_pole &= ~RTP_BUG_CISCO_SKIP_MARK_BIT_2833; + } + + if (switch_stristr("SONUS_SEND_INVALID_TIMESTAMP_2833", str)) { + *flag_pole |= RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833; + } + + if (switch_stristr("~SONUS_SEND_INVALID_TIMESTAMP_2833", str)) { + *flag_pole &= ~RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833; + } + + if (switch_stristr("IGNORE_MARK_BIT", str)) { + *flag_pole |= RTP_BUG_IGNORE_MARK_BIT; + } + + if (switch_stristr("~IGNORE_MARK_BIT", str)) { + *flag_pole &= ~RTP_BUG_IGNORE_MARK_BIT; + } + + if (switch_stristr("SEND_LINEAR_TIMESTAMPS", str)) { + *flag_pole |= RTP_BUG_SEND_LINEAR_TIMESTAMPS; + } + + if (switch_stristr("~SEND_LINEAR_TIMESTAMPS", str)) { + *flag_pole &= ~RTP_BUG_SEND_LINEAR_TIMESTAMPS; + } + + if (switch_stristr("START_SEQ_AT_ZERO", str)) { + *flag_pole |= RTP_BUG_START_SEQ_AT_ZERO; + } + + if (switch_stristr("~START_SEQ_AT_ZERO", str)) { + *flag_pole &= ~RTP_BUG_START_SEQ_AT_ZERO; + } + + if (switch_stristr("NEVER_SEND_MARKER", str)) { + *flag_pole |= RTP_BUG_NEVER_SEND_MARKER; + } + + if (switch_stristr("~NEVER_SEND_MARKER", str)) { + *flag_pole &= ~RTP_BUG_NEVER_SEND_MARKER; + } +} + diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 1792de08b3..f0eead3c42 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1366,7 +1366,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_ENABLE_RTCP)) { switch_sockaddr_info_get(&rtp_session->rtcp_from_addr, NULL, SWITCH_UNSPEC, 0, 0, pool); } - rtp_session->seq = (uint16_t) rand(); + rtp_session->seq = (rtp_session->rtp_bugs & RTP_BUG_START_SEQ_AT_ZERO) ? 0 : (uint16_t) rand(); rtp_session->ssrc = (uint32_t) ((intptr_t) rtp_session + (uint32_t) switch_epoch_time_now(NULL)); rtp_session->send_msg.header.ssrc = htonl(rtp_session->ssrc); @@ -3179,10 +3179,15 @@ static int rtp_common_write(switch_rtp_t *rtp_session, send_msg = &rtp_session->send_msg; send_msg->header.pt = payload; - if (timestamp) { + if (rtp_session->rtp_bugs & RTP_BUG_SEND_LINEAR_TIMESTAMPS) { + rtp_session->ts += rtp_session->samples_per_interval; + if (rtp_session->ts <= rtp_session->last_write_ts && rtp_session->ts > 0) { + rtp_session->ts = rtp_session->last_write_ts + rtp_session->samples_per_interval; + } + } else if (timestamp) { rtp_session->ts = (uint32_t) timestamp; /* Send marker bit if timestamp is lower/same as before (resetted/new timer) */ - if (rtp_session->ts <= rtp_session->last_write_ts) { + if (rtp_session->ts <= rtp_session->last_write_ts && !(rtp_session->rtp_bugs & RTP_BUG_NEVER_SEND_MARKER)) { m++; } } else if (rtp_session->timer.timer_interface) { @@ -3216,8 +3221,8 @@ static int rtp_common_write(switch_rtp_t *rtp_session, rtp_session->cn = 0; m++; } - - send_msg->header.m = m ? 1 : 0; + + send_msg->header.m = (m && !(rtp_session->rtp_bugs & RTP_BUG_NEVER_SEND_MARKER)) ? 1 : 0; memcpy(send_msg->body, data, datalen); bytes = datalen + rtp_header_len; @@ -3287,7 +3292,9 @@ static int rtp_common_write(switch_rtp_t *rtp_session, if (diff >= rtp_session->vad_data.diff_level || ++rtp_session->vad_data.hangunder_hits >= rtp_session->vad_data.hangunder) { switch_set_flag(&rtp_session->vad_data, SWITCH_VAD_FLAG_TALKING); - send_msg->header.m = 1; + if (!(rtp_session->rtp_bugs & RTP_BUG_NEVER_SEND_MARKER)) { + send_msg->header.m = 1; + } rtp_session->vad_data.hangover_hits = rtp_session->vad_data.hangunder_hits = rtp_session->vad_data.cng_count = 0; if (switch_test_flag(&rtp_session->vad_data, SWITCH_VAD_FLAG_EVENTS_TALK)) { switch_event_t *event; @@ -3755,7 +3762,7 @@ SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session, rtp_session->write_msg.header.seq = htons(++rtp_session->seq); rtp_session->write_msg.header.ts = htonl(ts); rtp_session->write_msg.header.pt = payload; - rtp_session->write_msg.header.m = m ? 1 : 0; + rtp_session->write_msg.header.m = (m && !(rtp_session->rtp_bugs & RTP_BUG_NEVER_SEND_MARKER)) ? 1 : 0; memcpy(rtp_session->write_msg.body, data, datalen); bytes = rtp_header_len + datalen; From 9ff4cfd5699f4f9c6fc6ae0c60c5114ee9557069 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Thu, 11 Nov 2010 00:03:06 +0100 Subject: [PATCH 15/45] ftmod_libpri: "ftdm libpri debug " now prints the current debug flags Signed-off-by: Stefan Knoblich --- .../src/ftmod/ftmod_libpri/ftmod_libpri.c | 49 +++++++++++++++++-- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index fff3f45c94..79159ebd0d 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -167,19 +167,23 @@ static void s_pri_message(struct pri *pri, char *s) ftdm_log(FTDM_LOG_DEBUG, "%s", s); } +#define PRI_DEBUG_Q921_ALL (PRI_DEBUG_Q921_RAW | PRI_DEBUG_Q921_DUMP | PRI_DEBUG_Q921_STATE) +#define PRI_DEBUG_Q931_ALL (PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q931_STATE | PRI_DEBUG_Q931_ANOMALY) + static const struct ftdm_libpri_debug { const char *name; const int flags; } ftdm_libpri_debug[] = { + /* NOTE: order is important for print_debug() */ + { "q921_all", PRI_DEBUG_Q921_ALL }, { "q921_raw", PRI_DEBUG_Q921_RAW }, { "q921_dump", PRI_DEBUG_Q921_DUMP }, { "q921_state", PRI_DEBUG_Q921_STATE }, - { "q921_all", (PRI_DEBUG_Q921_RAW | PRI_DEBUG_Q921_DUMP | PRI_DEBUG_Q921_STATE) }, + { "q931_all", PRI_DEBUG_Q931_ALL }, { "q931_dump", PRI_DEBUG_Q931_DUMP }, { "q931_state", PRI_DEBUG_Q931_STATE }, { "q931_anomaly", PRI_DEBUG_Q931_ANOMALY }, - { "q931_all", (PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q931_STATE | PRI_DEBUG_Q931_ANOMALY) }, { "config", PRI_DEBUG_CONFIG }, { "apdu", PRI_DEBUG_APDU }, @@ -217,13 +221,43 @@ static int parse_debug(const char *in, uint32_t *flags) return res; } +static int print_debug(uint32_t flags, char *tmp, const int size) +{ + int offset = 0; + int res = 0; + int i; + + if ((flags & PRI_DEBUG_ALL) == PRI_DEBUG_ALL) { + strcat(tmp, "all"); + return 0; + } + else if (!flags) { + strcat(tmp, "none"); + return 0; + } + + for (i = 0; i < ARRAY_SIZE(ftdm_libpri_debug); i++) { + if ((flags & ftdm_libpri_debug[i].flags) == ftdm_libpri_debug[i].flags) { + res = snprintf(&tmp[offset], size - offset, "%s,", ftdm_libpri_debug[i].name); + if (res <= 0 || res == (size - offset)) + goto out; + offset += res; + flags &= ~ftdm_libpri_debug[i].flags; /* remove detected flags to make *_all work correctly */ + } + } + +out: + tmp[offset - 1] = '\0'; + return 0; +} + static ftdm_status_t ftdm_libpri_start(ftdm_span_t *span); static ftdm_io_interface_t ftdm_libpri_interface; static const char *ftdm_libpri_usage = "Usage:\n" "libpri kill \n" - "libpri debug \n" + "libpri debug [all|none|flag,...flagN]\n" "\n" "Possible debug flags:\n" "\tq921_raw - Q.921 Raw messages\n" @@ -289,7 +323,7 @@ static FIO_API_FUNCTION(ftdm_libpri_api) } } - if (argc > 2) { + if (argc >= 2) { if (!strcasecmp(argv[0], "debug")) { ftdm_span_t *span = NULL; @@ -302,6 +336,13 @@ static FIO_API_FUNCTION(ftdm_libpri_api) goto done; } + if (argc == 2) { + char tmp[100] = { 0 }; + print_debug(pri_get_debug(isdn_data->spri.pri), tmp, sizeof(tmp)); + stream->write_function(stream, "%s: +OK current debug flags: '%s'\n", __FILE__, tmp); + goto done; + } + if (parse_debug(argv[2], &flags) == -1) { stream->write_function(stream, "%s: -ERR invalid debug flags given\n", __FILE__); goto done; From a2e16ce83c4a4adb81ae1b24361a57f7004de01f Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Thu, 11 Nov 2010 00:16:25 +0100 Subject: [PATCH 16/45] ftmod_libpri: Minor cleanups in ftdm_libpri_configure_span(). Move some things around and remove 'paramindex' var (just use 'i' for that too). Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 79159ebd0d..787e995ecc 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -1639,13 +1639,11 @@ static uint32_t parse_opts(const char *in) */ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) { - uint32_t i; + ftdm_libpri_data_t *isdn_data = NULL; + //ftdm_channel_t *dchan = NULL; uint32_t bchan_count = 0; uint32_t dchan_count = 0; - uint32_t paramindex = 0; - //ftdm_channel_t *dchan = NULL; - ftdm_libpri_data_t *isdn_data; - const char *var, *val; + uint32_t i; if (ftdm_span_get_trunk_type(span) >= FTDM_TRUNK_NONE) { ftdm_log(FTDM_LOG_WARNING, "Invalid trunk type '%s' defaulting to T1.\n", ftdm_span_get_trunk_type_str(span)); @@ -1721,9 +1719,9 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) return FTDM_FAIL; } - for (paramindex = 0; paramindex < 10 && ftdm_parameters[paramindex].var; paramindex++) { - var = ftdm_parameters[paramindex].var; - val = ftdm_parameters[paramindex].val; + for (i = 0; i < 10 && ftdm_parameters[i].var; i++) { + const char *var = ftdm_parameters[i].var; + const char *val = ftdm_parameters[i].val; if (!val) { ftdm_log(FTDM_LOG_ERROR, "Parameter '%s' has no value\n", var); From 588a5cee03c497b2715a68037a424976a76f015f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 10 Nov 2010 18:08:55 -0600 Subject: [PATCH 17/45] update --- src/switch_rtp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index f0eead3c42..ee1c4acf5e 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -772,6 +772,11 @@ SWITCH_DECLARE(switch_port_t) switch_rtp_request_port(const char *ip) SWITCH_DECLARE(void) switch_rtp_intentional_bugs(switch_rtp_t *rtp_session, switch_rtp_bug_flag_t bugs) { rtp_session->rtp_bugs = bugs; + + if ((rtp_session->rtp_bugs & RTP_BUG_START_SEQ_AT_ZERO)) { + rtp_session->seq = 0; + } + } @@ -1366,7 +1371,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_ENABLE_RTCP)) { switch_sockaddr_info_get(&rtp_session->rtcp_from_addr, NULL, SWITCH_UNSPEC, 0, 0, pool); } - rtp_session->seq = (rtp_session->rtp_bugs & RTP_BUG_START_SEQ_AT_ZERO) ? 0 : (uint16_t) rand(); + rtp_session->seq = (uint16_t) rand(); rtp_session->ssrc = (uint32_t) ((intptr_t) rtp_session + (uint32_t) switch_epoch_time_now(NULL)); rtp_session->send_msg.header.ssrc = htonl(rtp_session->ssrc); From 8b68da37ae026257c9b3ca4f1595f1e839756b02 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Wed, 10 Nov 2010 19:51:28 -0500 Subject: [PATCH 18/45] mod_sangoma_codec: fix G722 --- src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c | 2 +- 1 file changed, 1 insertion(+), 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 0bc02829df..6e6fe58af6 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -94,7 +94,7 @@ vocallo_codec_t g_codec_map[] = { SNGTC_CODEC_L16_2, 10, "L16", "Sangoma L16 2", 40, 320000, 10000, 80, 320, 320, 16000, 16000, 0 }, { SNGTC_CODEC_G729AB, 18, "G729", "Sangoma G729", 40, 8000, 10000, 80, 160, 10, 8000, 8000, 1 }, { SNGTC_CODEC_G726_32, 122, "G726-32", "Sangoma G.726 32k", 40, 32000, 10000, 80, 160, 40, 8000, 8000, 1 }, - { SNGTC_CODEC_G722, 9, "G722", "Sangoma G722", 20, 64000, 10000, 160, 320, 80, 8000, 16000, 1 }, + { SNGTC_CODEC_G722, 9, "G722", "Sangoma G722", 20, 64000, 10000, 80, 160, 80, 8000, 8000, 1 }, /* manually initialized */ { SNGTC_CODEC_GSM_FR, 3, "GSM", "Sangoma GSM", 20, 13200, 20000, 160, 320, 33, 8000, 8000, 0 }, From 70dca6dd4b05092a5564bba916b66a3f7b27e7dc Mon Sep 17 00:00:00 2001 From: root Date: Thu, 11 Nov 2010 10:56:10 +0300 Subject: [PATCH 19/45] Makefile changes for x86_64 arch, thnx Steven Ayre and ptlib include path fix. --- src/mod/endpoints/mod_h323/Makefile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_h323/Makefile b/src/mod/endpoints/mod_h323/Makefile index 8287b34cad..57668ee8dd 100644 --- a/src/mod/endpoints/mod_h323/Makefile +++ b/src/mod/endpoints/mod_h323/Makefile @@ -1,7 +1,11 @@ BASE=../../../.. -LOCAL_CFLAGS+=-g -ggdb -I/usr/local/include/ptlib -I/usr/local/include/openh323 -I. -DPTRACING=1 -D_REENTRANT -fno-exceptions -LOCAL_LDFLAGS= -lopenh323 -lpt -lrt + +export PTLIBDIR = $(shell /usr/bin/ptlib-config --ptlibdir) +LOCAL_CFLAGS+=-g -I$PTLIBDIR -I/usr/include/openh323 -I. -DPTRACING=1 -D_REENTRANT -fno-exceptions +LOCAL_LDFLAGS= -L/usr/lib -lopenh323 -lpt -lrt + +ifeq ($(shell uname -m),x86_64) +LOCAL_CFLAGS+=-DP_64BIT +endif include $(BASE)/build/modmake.rules - - From f079f898cb4c0ead58f1e668b711e0fef640e1a4 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 11 Nov 2010 10:49:02 -0600 Subject: [PATCH 20/45] declinatio mortuus obfirmo! --- src/mod/endpoints/mod_sofia/sofia_reg.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 67641ae616..571c1673eb 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1490,6 +1490,7 @@ void sofia_reg_handle_sip_i_register(nua_t *nua, sofia_profile_t *profile, nua_h int network_port = 0; char *is_nat = NULL; +#if 0 /* This seems to cause undesirable effects so nevermind */ if (sip->sip_to && sip->sip_to->a_url && sip->sip_to->a_url->url_host) { const char *to_host = sip->sip_to->a_url->url_host; if (profile->reg_db_domain) { @@ -1500,6 +1501,7 @@ void sofia_reg_handle_sip_i_register(nua_t *nua, sofia_profile_t *profile, nua_h } } } +#endif sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port); From 3be3cd762acdd9750c2b7efe0855c201112ff723 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 11 Nov 2010 10:54:04 -0600 Subject: [PATCH 21/45] add send_silence_when_idle and dmachine honoring to park loop --- src/switch_ivr.c | 246 ++++++++++++++++++++++++++++++----------------- 1 file changed, 157 insertions(+), 89 deletions(-) diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 948401e53a..b5c56320b6 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -702,7 +702,40 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session, time_t expires = 0; switch_codec_implementation_t read_impl = { 0 }; switch_call_cause_t timeout_cause = SWITCH_CAUSE_NORMAL_CLEARING; + switch_codec_t codec = { 0 }; + int sval = 0; + const char *var; + switch_frame_t write_frame = { 0 }; + unsigned char *abuf = NULL; + switch_codec_implementation_t imp = { 0 }; + if ((var = switch_channel_get_variable(channel, SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE)) && (sval = atoi(var))) { + switch_core_session_get_read_impl(session, &imp); + + if (switch_core_codec_init(&codec, + "L16", + NULL, + imp.samples_per_second, + imp.microseconds_per_packet / 1000, + imp.number_of_channels, + SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, + switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec Error L16@%uhz %u channels %dms\n", + imp.samples_per_second, imp.number_of_channels, imp.microseconds_per_packet / 1000); + return SWITCH_STATUS_FALSE; + } + + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Codec Activated L16@%uhz %u channels %dms\n", + imp.samples_per_second, imp.number_of_channels, imp.microseconds_per_packet / 1000); + + write_frame.codec = &codec; + switch_zmalloc(abuf, SWITCH_RECOMMENDED_BUFFER_SIZE); + write_frame.data = abuf; + write_frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE; + write_frame.datalen = imp.decoded_bytes_per_packet; + write_frame.samples = write_frame.datalen / sizeof(int16_t); + } if (switch_channel_test_flag(channel, CF_CONTROLLED)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot park channels that are under control already.\n"); @@ -746,7 +779,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session, } if (rate) { - status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, stream_id); + if (switch_channel_test_flag(channel, CF_SERVICE)) { + switch_cond_next(); + status = SWITCH_STATUS_SUCCESS; + } else { + status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, stream_id); + } } else { switch_yield(20000); @@ -760,111 +798,141 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session, if (!SWITCH_READ_ACCEPTABLE(status)) { break; - } else { - if (expires && switch_epoch_time_now(NULL) >= expires) { - switch_channel_hangup(channel, timeout_cause); - break; + } + + if (write_frame.data) { + 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); + } + + if (expires && switch_epoch_time_now(NULL) >= expires) { + switch_channel_hangup(channel, timeout_cause); + break; + } + + if (switch_channel_test_flag(channel, CF_UNICAST)) { + if (!switch_channel_media_ready(channel)) { + if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) { + return SWITCH_STATUS_FALSE; + } } - if (switch_channel_test_flag(channel, CF_UNICAST)) { - if (!switch_channel_media_ready(channel)) { - if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) { - return SWITCH_STATUS_FALSE; - } - } - - if (!conninfo) { - if (!(conninfo = switch_channel_get_private(channel, "unicast"))) { - switch_channel_clear_flag(channel, CF_UNICAST); - } - - if (conninfo) { - unicast_thread_launch(conninfo); - } + if (!conninfo) { + if (!(conninfo = switch_channel_get_private(channel, "unicast"))) { + switch_channel_clear_flag(channel, CF_UNICAST); } if (conninfo) { - switch_size_t len = 0; - uint32_t flags = 0; - switch_byte_t decoded[SWITCH_RECOMMENDED_BUFFER_SIZE]; - uint32_t dlen = sizeof(decoded); - switch_status_t tstatus; - switch_byte_t *sendbuf = NULL; - uint32_t sendlen = 0; - - switch_assert(read_frame); - - if (switch_test_flag(read_frame, SFF_CNG)) { - sendlen = bpf; - switch_assert(sendlen <= SWITCH_RECOMMENDED_BUFFER_SIZE); - memset(decoded, 255, sendlen); - sendbuf = decoded; - tstatus = SWITCH_STATUS_SUCCESS; - } else { - if (switch_test_flag(conninfo, SUF_NATIVE)) { - tstatus = SWITCH_STATUS_NOOP; - } else { - switch_codec_t *read_codec = switch_core_session_get_read_codec(session); - tstatus = switch_core_codec_decode(read_codec, - &conninfo->read_codec, - read_frame->data, - read_frame->datalen, read_impl.actual_samples_per_second, decoded, &dlen, &rate, &flags); - } - switch (tstatus) { - case SWITCH_STATUS_NOOP: - case SWITCH_STATUS_BREAK: - sendbuf = read_frame->data; - sendlen = read_frame->datalen; - tstatus = SWITCH_STATUS_SUCCESS; - break; - case SWITCH_STATUS_SUCCESS: - sendbuf = decoded; - sendlen = dlen; - tstatus = SWITCH_STATUS_SUCCESS; - break; - default: - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Codec Error\n"); - switch_ivr_deactivate_unicast(session); - break; - } - } - - if (tstatus == SWITCH_STATUS_SUCCESS) { - len = sendlen; - if (switch_socket_sendto(conninfo->socket, conninfo->remote_addr, 0, (void *) sendbuf, &len) != SWITCH_STATUS_SUCCESS) { - switch_ivr_deactivate_unicast(session); - } - } + unicast_thread_launch(conninfo); } } - switch_ivr_parse_all_events(session); + if (conninfo) { + switch_size_t len = 0; + uint32_t flags = 0; + switch_byte_t decoded[SWITCH_RECOMMENDED_BUFFER_SIZE]; + uint32_t dlen = sizeof(decoded); + switch_status_t tstatus; + switch_byte_t *sendbuf = NULL; + uint32_t sendlen = 0; + switch_assert(read_frame); - if (switch_channel_has_dtmf(channel)) { - switch_dtmf_t dtmf = { 0 }; - switch_channel_dequeue_dtmf(channel, &dtmf); - if (args && args->input_callback) { - if ((status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen)) != SWITCH_STATUS_SUCCESS) { - break; - } - } - } - - if (switch_core_session_dequeue_event(session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { - if (args && args->input_callback) { - if ((status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen)) != SWITCH_STATUS_SUCCESS) { - break; - } + if (switch_test_flag(read_frame, SFF_CNG)) { + sendlen = bpf; + switch_assert(sendlen <= SWITCH_RECOMMENDED_BUFFER_SIZE); + memset(decoded, 255, sendlen); + sendbuf = decoded; + tstatus = SWITCH_STATUS_SUCCESS; } else { - switch_channel_event_set_data(channel, event); - switch_event_fire(&event); + if (switch_test_flag(conninfo, SUF_NATIVE)) { + tstatus = SWITCH_STATUS_NOOP; + } else { + switch_codec_t *read_codec = switch_core_session_get_read_codec(session); + tstatus = switch_core_codec_decode(read_codec, + &conninfo->read_codec, + read_frame->data, + read_frame->datalen, read_impl.actual_samples_per_second, decoded, &dlen, &rate, &flags); + } + switch (tstatus) { + case SWITCH_STATUS_NOOP: + case SWITCH_STATUS_BREAK: + sendbuf = read_frame->data; + sendlen = read_frame->datalen; + tstatus = SWITCH_STATUS_SUCCESS; + break; + case SWITCH_STATUS_SUCCESS: + sendbuf = decoded; + sendlen = dlen; + tstatus = SWITCH_STATUS_SUCCESS; + break; + default: + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Codec Error\n"); + switch_ivr_deactivate_unicast(session); + break; + } + } + + if (tstatus == SWITCH_STATUS_SUCCESS) { + len = sendlen; + if (switch_socket_sendto(conninfo->socket, conninfo->remote_addr, 0, (void *) sendbuf, &len) != SWITCH_STATUS_SUCCESS) { + switch_ivr_deactivate_unicast(session); + } } } } + switch_ivr_parse_all_events(session); + + + if (switch_channel_has_dtmf(channel)) { + switch_dtmf_t dtmf = { 0 }; + + if (!args->input_callback && !args->buf && !args->dmachine) { + status = SWITCH_STATUS_BREAK; + break; + } + + switch_channel_dequeue_dtmf(channel, &dtmf); + + 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 && args->input_callback) { + if ((status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen)) != SWITCH_STATUS_SUCCESS) { + break; + } + } + } + + if (switch_core_session_dequeue_event(session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { + if (args && args->input_callback) { + if ((status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen)) != SWITCH_STATUS_SUCCESS) { + break; + } + } else { + switch_channel_event_set_data(channel, event); + switch_event_fire(&event); + } + } + + if (args && args->dmachine) { + if ((status = switch_ivr_dmachine_ping(args->dmachine, NULL)) != SWITCH_STATUS_SUCCESS) { + break; + } + } + + } + if (write_frame.codec) { + switch_core_codec_destroy(&codec); + } + + switch_safe_free(abuf); + switch_channel_clear_flag(channel, CF_CONTROLLED); switch_channel_clear_flag(channel, CF_PARK); From cd95138427e1ad55641fadd60c161e3899c2b98f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 11 Nov 2010 12:32:29 -0600 Subject: [PATCH 22/45] FS-2839 --- src/mod/applications/mod_avmd/buffer.h | 6 +++--- src/mod/applications/mod_avmd/mod_avmd.c | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_avmd/buffer.h b/src/mod/applications/mod_avmd/buffer.h index bb5b1b1d84..b6676767e1 100644 --- a/src/mod/applications/mod_avmd/buffer.h +++ b/src/mod/applications/mod_avmd/buffer.h @@ -78,18 +78,18 @@ extern size_t next_power_of_2(size_t v); #define CALC_BUFF_LEN(fl, bl) (((fl) >= (bl))? next_power_of_2((fl) << 1): next_power_of_2((bl) << 1)) -#define INIT_CIRC_BUFFER(bf, bl, fl) \ +#define INIT_CIRC_BUFFER(bf, bl, fl, s) \ { \ (bf)->buf_len = CALC_BUFF_LEN((fl), (bl)); \ (bf)->mask = (bf)->buf_len - 1; \ - (bf)->buf = (BUFF_TYPE *)calloc((bf)->buf_len, sizeof(BUFF_TYPE)); \ + (bf)->buf = (BUFF_TYPE *) switch_core_session_alloc(s, (bf)->buf_len * sizeof(BUFF_TYPE)); \ assert((bf)->buf != NULL); \ (bf)->pos = 0; \ (bf)->lpos = 0; \ (bf)->backlog = 0; \ } -#define DESTROY_CIRC_BUFFER(b) free((b)->buf) +//#define DESTROY_CIRC_BUFFER(b) free((b)->buf) #define GET_BACKLOG_POS(b) ((b)->lpos - (b)->backlog) #define GET_CURRENT_POS(b) ((b)->lpos) #define GET_CURRENT_SAMPLE(b) GET_SAMPLE((b), GET_CURRENT_POS((b))) diff --git a/src/mod/applications/mod_avmd/mod_avmd.c b/src/mod/applications/mod_avmd/mod_avmd.c index 74372a0c2d..8e6f2e124d 100644 --- a/src/mod/applications/mod_avmd/mod_avmd.c +++ b/src/mod/applications/mod_avmd/mod_avmd.c @@ -130,7 +130,7 @@ static void init_avmd_session_data(avmd_session_t *avmd_session, switch_core_se { /*! This is a worst case sample rate estimate */ avmd_session->rate = 48000; - INIT_CIRC_BUFFER(&avmd_session->b, BEEP_LEN(avmd_session->rate), FRAME_LEN(avmd_session->rate)); + INIT_CIRC_BUFFER(&avmd_session->b, BEEP_LEN(avmd_session->rate), FRAME_LEN(avmd_session->rate), fs_session); avmd_session->session = fs_session; avmd_session->pos = 0; @@ -176,6 +176,7 @@ static switch_bool_t avmd_callback(switch_media_bug_t * bug, void *user_data, sw case SWITCH_ABC_TYPE_READ_PING: break; case SWITCH_ABC_TYPE_CLOSE: + break; case SWITCH_ABC_TYPE_READ: break; From e0961aee3a46001633c51053f6fca71317d2265b Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Thu, 11 Nov 2010 22:17:09 +0100 Subject: [PATCH 23/45] ftmod_libpri: Dereference facility event correctly, add debug message. Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 787e995ecc..69e007d7bb 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -1187,12 +1187,14 @@ static int handle_facility_aoc_e(const struct pri_subcmd_aoc_e *aoc_e) */ static int on_facility(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) { - struct pri_event_facility *pfac = (struct pri_event_facility *)pevent; + struct pri_event_facility *pfac = (struct pri_event_facility *)&pevent->facility; int i = 0; if (!pevent) return 0; + ftdm_log(FTDM_LOG_DEBUG, "Got a FACILITY event on span %d:%d\n", ftdm_span_get_id(spri->span), pfac->channel); + if (!pfac->subcmds || pfac->subcmds->counter_subcmd <= 0) return 0; From 1e777c2ce9c70e34bbb27968f4727a92a4f0f249 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Thu, 11 Nov 2010 22:21:18 +0100 Subject: [PATCH 24/45] ftmod_libpri: While we're at it, drop the cast too Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 69e007d7bb..1d1685f840 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -1187,7 +1187,7 @@ static int handle_facility_aoc_e(const struct pri_subcmd_aoc_e *aoc_e) */ static int on_facility(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) { - struct pri_event_facility *pfac = (struct pri_event_facility *)&pevent->facility; + struct pri_event_facility *pfac = &pevent->facility; int i = 0; if (!pevent) From 0100eff6352f26627acf4c22cd1ce108b475c86f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 11 Nov 2010 15:37:48 -0600 Subject: [PATCH 25/45] update --- src/switch_core_file.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/switch_core_file.c b/src/switch_core_file.c index af3897e48c..76b6b29fad 100644 --- a/src/switch_core_file.c +++ b/src/switch_core_file.c @@ -411,7 +411,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_seek(switch_file_handle_t *fh, int ok = 1; switch_assert(fh != NULL); - switch_assert(fh->file_interface != NULL); if (!switch_test_flag(fh, SWITCH_FILE_OPEN) || !fh->file_interface->file_seek) { ok = 0; From b2f80417907503d55bdc0857a2c9e7e9edc0771f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 11 Nov 2010 16:48:59 -0600 Subject: [PATCH 26/45] fix file string when being used in ringback --- .../formats/mod_file_string/mod_file_string.c | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/mod/formats/mod_file_string/mod_file_string.c b/src/mod/formats/mod_file_string/mod_file_string.c index f706000a8a..a222f7bc1d 100644 --- a/src/mod/formats/mod_file_string/mod_file_string.c +++ b/src/mod/formats/mod_file_string/mod_file_string.c @@ -71,7 +71,7 @@ static int next_file(switch_file_handle_t *handle) switch_core_file_close(&context->fh); } - if (context->index == context->argc) { + if (context->index >= context->argc) { return 0; } @@ -110,6 +110,24 @@ static int next_file(switch_file_handle_t *handle) return 1; } + +static switch_status_t file_string_file_seek(switch_file_handle_t *handle, unsigned int *cur_sample, int64_t samples, int whence) +{ + file_string_context_t *context = handle->private_info; + + if (samples == 0 && whence == SEEK_SET) { + context->index = -1; + return SWITCH_STATUS_SUCCESS; + } + + if (!handle->seekable) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "File is not seekable\n"); + return SWITCH_STATUS_NOTIMPL; + } + + return switch_core_file_seek(&context->fh, cur_sample, samples, whence); +} + static switch_status_t file_string_file_open(switch_file_handle_t *handle, const char *path) { file_string_context_t *context; @@ -185,6 +203,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_file_string_load) file_interface->file_open = file_string_file_open; file_interface->file_close = file_string_file_close; file_interface->file_read = file_string_file_read; + file_interface->file_seek = file_string_file_seek; memset(&globals, 0, sizeof(globals)); /* indicate that the module should continue to be loaded */ From eeaab3a02e507f273bf140845a1962b4c757895d Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Thu, 11 Nov 2010 23:53:19 +0100 Subject: [PATCH 27/45] mod_freetdm: Avoid overflowing the spanparameters array of libpri spans, and make other span types use ftdm_array_len() too. Signed-off-by: Stefan Knoblich --- libs/freetdm/mod_freetdm/mod_freetdm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 0a35913ec4..879dd05155 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -2594,7 +2594,7 @@ static switch_status_t load_config(void) char *var = (char *) switch_xml_attr_soft(param, "name"); char *val = (char *) switch_xml_attr_soft(param, "value"); - if (sizeof(spanparameters)/sizeof(spanparameters[0]) == paramindex) { + if (ftdm_array_len(spanparameters) == paramindex) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Too many parameters for ss7 span, ignoring any parameter after %s\n", var); break; } @@ -3106,6 +3106,11 @@ static switch_status_t load_config(void) char *var = (char *) switch_xml_attr_soft(param, "name"); char *val = (char *) switch_xml_attr_soft(param, "value"); + if (ftdm_array_len(spanparameters) == paramindex) { + ftdm_log(FTDM_LOG_ERROR, "Too many parameters for libpri span, ignoring everything after '%s'\n", var); + break; + } + if (!strcasecmp(var, "context")) { context = val; } else if (!strcasecmp(var, "dialplan")) { @@ -3165,7 +3170,8 @@ static switch_status_t load_config(void) for (param = switch_xml_child(myspan, "param"); param; param = param->next) { char *var = (char *) switch_xml_attr_soft(param, "name"); char *val = (char *) switch_xml_attr_soft(param, "value"); - if (sizeof(spanparameters)/sizeof(spanparameters[0]) == paramindex) { + + if (ftdm_array_len(spanparameters) == paramindex) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Too many parameters for boost span, ignoring any parameter after %s\n", var); break; } From 025c82e76f296253a112896471f54fac9d14d5d5 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Thu, 11 Nov 2010 20:21:35 -0500 Subject: [PATCH 28/45] ivr_enterprise_originate: Fix export of variable from the originator channel to the called channels --- src/switch_ivr_originate.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 007d7d9fc1..da76cf6cbc 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -1391,6 +1391,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess data++; } + if (session) { + switch_caller_profile_t *cpp = NULL; + channel = switch_core_session_get_channel(session); + if ((cpp = switch_channel_get_caller_profile(channel))) { + cp = switch_caller_profile_dup(pool, cpp); + } + } + if (ovars) { var_event = ovars; } else { @@ -1436,14 +1444,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess switch_goto_status(SWITCH_STATUS_FALSE, end); } - if (session) { - switch_caller_profile_t *cpp = NULL; - channel = switch_core_session_get_channel(session); - if ((cpp = switch_channel_get_caller_profile(channel))) { - cp = switch_caller_profile_dup(pool, cpp); - } - } - switch_threadattr_create(&thd_attr, pool); switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); From 197e4b71d6eff64a8d3843d58ba99ead4fca970f Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Fri, 12 Nov 2010 11:36:29 +0100 Subject: [PATCH 29/45] mod_freetdm: Really avoid overwriting the last element of spanparameters. "if (ftdm_array_len(spanparameters) == paramindex)" is still off-by-one, we want to stop at "ftdm_array_len(spanparameters) - 1", before we overwrite the last (= terminating, NULL) element. NOTE: i'd prefer an "argc, argv"-style interface here Signed-off-by: Stefan Knoblich --- libs/freetdm/mod_freetdm/mod_freetdm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 879dd05155..4fda283aeb 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -2434,7 +2434,7 @@ static void parse_bri_pri_spans(switch_xml_t cfg, switch_xml_t spans) char *var = (char *) switch_xml_attr_soft(param, "name"); char *val = (char *) switch_xml_attr_soft(param, "value"); - if (ftdm_array_len(spanparameters) == paramindex) { + if (ftdm_array_len(spanparameters) - 1 == paramindex) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Too many parameters for ss7 span, ignoring any parameter after %s\n", var); break; } @@ -2594,7 +2594,7 @@ static switch_status_t load_config(void) char *var = (char *) switch_xml_attr_soft(param, "name"); char *val = (char *) switch_xml_attr_soft(param, "value"); - if (ftdm_array_len(spanparameters) == paramindex) { + if (ftdm_array_len(spanparameters) - 1 == paramindex) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Too many parameters for ss7 span, ignoring any parameter after %s\n", var); break; } @@ -3106,7 +3106,7 @@ static switch_status_t load_config(void) char *var = (char *) switch_xml_attr_soft(param, "name"); char *val = (char *) switch_xml_attr_soft(param, "value"); - if (ftdm_array_len(spanparameters) == paramindex) { + if (ftdm_array_len(spanparameters) - 1 == paramindex) { ftdm_log(FTDM_LOG_ERROR, "Too many parameters for libpri span, ignoring everything after '%s'\n", var); break; } @@ -3171,7 +3171,7 @@ static switch_status_t load_config(void) char *var = (char *) switch_xml_attr_soft(param, "name"); char *val = (char *) switch_xml_attr_soft(param, "value"); - if (ftdm_array_len(spanparameters) == paramindex) { + if (ftdm_array_len(spanparameters) - 1 == paramindex) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Too many parameters for boost span, ignoring any parameter after %s\n", var); break; } From b160942bc0e3c9d8c2a7d4f377c2295d3d5ff655 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 12 Nov 2010 11:43:18 -0600 Subject: [PATCH 30/45] test --- src/mod/endpoints/mod_sofia/sofia_presence.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 71a827f80b..dc02ca47ae 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1259,7 +1259,6 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * char *to = NULL; char *open; char *prpid; - char *sql; time_t exptime = switch_epoch_time_now(NULL) + 3600; int is_dialog = 0; sofia_profile_t *ext_profile = NULL, *profile = helper->profile; @@ -1617,15 +1616,16 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * } + /* commenting to test if (helper->event){ const char *uuid = switch_event_get_header_nil(helper->event, "unique-id"); if (!zstr(uuid) && strchr(uuid, '-')) { - sql = switch_mprintf("update sip_dialogs set rpid='%q',status='%q' where uuid='%q'", rpid, status_line, uuid); + char *sql = switch_mprintf("update sip_dialogs set rpid='%q',status='%q' where uuid='%q'", rpid, status_line, uuid); sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE); } } - + */ nua_handle_bind(nh, &mod_sofia_globals.keep_private); From c12f81cd0f24a8ea5cf7ce26cf83f88e3ffcd4a4 Mon Sep 17 00:00:00 2001 From: Brian West Date: Fri, 12 Nov 2010 13:50:12 -0600 Subject: [PATCH 31/45] Use the right variable --- scripts/lua/zrtp_agent.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/lua/zrtp_agent.lua b/scripts/lua/zrtp_agent.lua index c657359fba..2ce8b3e0a6 100644 --- a/scripts/lua/zrtp_agent.lua +++ b/scripts/lua/zrtp_agent.lua @@ -8,7 +8,7 @@ session:sleep(3000); -- Give the agent time to bring up ZRTP. local zrtp_secure_media_confirmed = session:getVariable("zrtp_secure_media_confirmed_audio"); -local zrtp_new_user_enrolled = session:getVariable("zrtp_new_user_enrolled"); +local zrtp_new_user_enrolled = session:getVariable("zrtp_new_user_enrolled_audio"); local zrtp_already_enrolled = session:getVariable("zrtp_already_enrolled_audio"); if zrtp_secure_media_confirmed == "true" then From 47af9933c425e2921d4350dfc78206b27ca01be7 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Sun, 14 Nov 2010 15:44:50 +0100 Subject: [PATCH 32/45] freetdm: convert ftmod_isdn to use (+ pri_spans) to use ftdm_configure_span_signaling() interface. Signed-off-by: Stefan Knoblich --- libs/freetdm/mod_freetdm/mod_freetdm.c | 101 ++------- .../freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c | 213 +++++++++++------- 2 files changed, 150 insertions(+), 164 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 4fda283aeb..aaddbf69f0 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -2923,102 +2923,49 @@ static switch_status_t load_config(void) if ((spans = switch_xml_child(cfg, "pri_spans"))) { for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) { - char *id = (char *) switch_xml_attr(myspan, "id"); char *name = (char *) switch_xml_attr(myspan, "name"); + ftdm_conf_parameter_t spanparameters[10]; ftdm_status_t zstatus = FTDM_FAIL; const char *context = "default"; const char *dialplan = "XML"; - //Q921NetUser_t mode = Q931_TE; - //Q931Dialect_t dialect = Q931_Dialect_National; - char *mode = NULL; - char *dialect = NULL; - uint32_t span_id = 0; + unsigned paramindex = 0; ftdm_span_t *span = NULL; - const char *tonegroup = NULL; - char *digit_timeout = NULL; - const char *opts = "none"; - uint32_t to = 0; - int q921loglevel = -1; - int q931loglevel = -1; - - // quick debug - //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ID: '%s', Name:'%s'\n",id,name); + uint32_t span_id = 0; - for (param = switch_xml_child(myspan, "param"); param; param = param->next) { + if (!name) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "span missing required attribute 'name'\n"); + continue; + } + + for (param = switch_xml_child(myspan, "param"); param && paramindex < 10; param = param->next) { char *var = (char *) switch_xml_attr_soft(param, "name"); char *val = (char *) switch_xml_attr_soft(param, "value"); - if (!strcasecmp(var, "tonegroup")) { - tonegroup = val; - } else if (!strcasecmp(var, "mode")) { - mode = val; - } else if (!strcasecmp(var, "dialect")) { - dialect = val; - } else if (!strcasecmp(var, "q921loglevel")) { - if ((q921loglevel = switch_log_str2level(val)) == SWITCH_LOG_INVALID) { - q921loglevel = -1; - } - } else if (!strcasecmp(var, "q931loglevel")) { - if ((q931loglevel = switch_log_str2level(val)) == SWITCH_LOG_INVALID) { - q931loglevel = -1; - } - } else if (!strcasecmp(var, "context")) { + if (ftdm_array_len(spanparameters) == paramindex) { + ftdm_log(FTDM_LOG_ERROR, "Too many parameters for pri span '%s', ignoring everything after '%s'\n", name, var); + break; + } + + if (!strcasecmp(var, "context")) { context = val; - } else if (!strcasecmp(var, "opts")) { - opts = val; } else if (!strcasecmp(var, "dialplan")) { dialplan = val; - } else if (!strcasecmp(var, "digit_timeout") || !strcasecmp(var, "digit-timeout")) { - digit_timeout = val; - } - } - - if (!id && !name) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "span missing required param 'id'\n"); - continue; - } - - if (name) { - zstatus = ftdm_span_find_by_name(name, &span); - } else { - if (switch_is_number(id)) { - span_id = atoi(id); - zstatus = ftdm_span_find(span_id, &span); - } - - if (zstatus != FTDM_SUCCESS) { - zstatus = ftdm_span_find_by_name(id, &span); + } else { + spanparameters[paramindex].var = var; + spanparameters[paramindex].val = val; + paramindex++; } } - if (digit_timeout) { - to = atoi(digit_timeout); - } - + zstatus = ftdm_span_find_by_name(name, &span); if (zstatus != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error finding FreeTDM span id:%s name:%s\n", switch_str_nil(id), switch_str_nil(name)); + ftdm_log(FTDM_LOG_ERROR, "Error finding FreeTDM span %s\n", name); continue; } - if (!span_id) { - span_id = ftdm_span_get_id(span); - } - - if (!tonegroup) { - tonegroup = "us"; - } - - if (ftdm_configure_span(span, "isdn", on_clear_channel_signal, - "mode", mode, - "dialect", dialect, - "digit_timeout", &to, - "opts", opts, - "tonemap", tonegroup, - "q921loglevel", q921loglevel, - "q931loglevel", q931loglevel, - FTDM_TAG_END) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error starting FreeTDM span %d mode: %s dialect: %s error: %s\n", span_id, - mode, dialect, ftdm_span_get_last_error(span)); + span_id = ftdm_span_get_id(span); + if (ftdm_configure_span_signaling(span, "isdn", on_clear_channel_signal, spanparameters) != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_ERROR, "Error configuring FreeTDM span %s\n", name); continue; } diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c index 2b34552950..c5294bf1b2 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -54,6 +54,11 @@ #define DEFAULT_NATIONAL_PREFIX "0" #define DEFAULT_INTERNATIONAL_PREFIX "00" +static const char *ftdm_span_get_trunk_type_str(const ftdm_span_t *span) +{ + return ftdm_trunk_type2str(span->trunk_type); +} + /***************************************************************************************** * PCAP * Based on Helmut Kuper's () implementation, @@ -2266,9 +2271,8 @@ static ftdm_status_t ftdm_isdn_start(ftdm_span_t *span) static int32_t parse_loglevel(const char *level) { - if (!level) { + if (!level) return -1; - } if (!strcasecmp(level, "debug")) { return FTDM_LOG_LEVEL_DEBUG; @@ -2291,53 +2295,53 @@ static int32_t parse_loglevel(const char *level) } } -static uint32_t parse_opts(const char *in) +static int parse_opts(const char *in, uint32_t *flags) { - uint32_t flags = 0; - - if (!in) { - return 0; - } + if (!in || !flags) + return -1; if (strstr(in, "suggest_channel")) { - flags |= FTDM_ISDN_OPT_SUGGEST_CHANNEL; + *flags |= FTDM_ISDN_OPT_SUGGEST_CHANNEL; } - if (strstr(in, "omit_display")) { - flags |= FTDM_ISDN_OPT_OMIT_DISPLAY_IE; + *flags |= FTDM_ISDN_OPT_OMIT_DISPLAY_IE; } - if (strstr(in, "disable_tones")) { - flags |= FTDM_ISDN_OPT_DISABLE_TONES; + *flags |= FTDM_ISDN_OPT_DISABLE_TONES; } - return flags; + return 0; } -static uint32_t parse_dialect(const char *in) +static int parse_dialect(const char *in, uint32_t *dialect) { - if (!in) { - return Q931_Dialect_Count; - } + if (!in || !dialect) + return -1; #if __UNSUPPORTED__ if (!strcasecmp(in, "national")) { - return Q931_Dialect_National; + *dialect = Q931_Dialect_National; + return 0; } if (!strcasecmp(in, "dms")) { - return Q931_Dialect_DMS; + *dialect = Q931_Dialect_DMS; + return 0; } #endif if (!strcasecmp(in, "5ess")) { - return Q931_Dialect_5ESS; + *dialect = Q931_Dialect_5ESS; + return 0; } - if (!strcasecmp(in, "dss1")) { - return Q931_Dialect_DSS1; + if (!strcasecmp(in, "dss1") || !strcasecmp(in, "euroisdn")) { + *dialect = Q931_Dialect_DSS1; + return 0; } if (!strcasecmp(in, "q931")) { - return Q931_Dialect_Q931; + *dialect = Q931_Dialect_Q931; + return 0; } - return Q931_Dialect_Count; + + return -1; } @@ -2563,44 +2567,80 @@ done: return FTDM_SUCCESS; } -static FIO_SIG_CONFIGURE_FUNCTION(isdn_configure_span) +static int parse_mode(const char *mode) +{ + if (!mode) + return -1; + + if (!strcasecmp(mode, "user") || !strcasecmp(mode, "cpe")) { + return Q931_TE; + } + if (!strcasecmp(mode, "net") || !strcasecmp(mode, "network")) { + return Q931_NT; + } + + return -1; +} + +static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(isdn_configure_span) { - uint32_t i, x = 0; - ftdm_channel_t *dchans[2] = { 0 }; - ftdm_isdn_data_t *isdn_data; - const char *tonemap = "us"; - char *var, *val; Q931Dialect_t dialect = Q931_Dialect_National; + ftdm_channel_t *dchan = NULL; + ftdm_isdn_data_t *isdn_data; int32_t digit_timeout = 0; + const char *tonemap = "us"; + int dchan_count = 0, bchan_count = 0; int q921loglevel = -1; int q931loglevel = -1; + uint32_t i; if (span->signal_type) { - snprintf(span->last_error, sizeof(span->last_error), "Span is already configured for signalling [%d].", span->signal_type); + ftdm_log(FTDM_LOG_ERROR, "Span is already configured for signalling [%d]\n", span->signal_type); + snprintf(span->last_error, sizeof(span->last_error), "Span is already configured for signalling [%d]", span->signal_type); return FTDM_FAIL; } - if (span->trunk_type >= FTDM_TRUNK_NONE) { - ftdm_log(FTDM_LOG_WARNING, "Invalid trunk type '%s' defaulting to T1.\n", ftdm_trunk_type2str(span->trunk_type)); + if (ftdm_span_get_trunk_type(span) >= FTDM_TRUNK_NONE) { + ftdm_log(FTDM_LOG_WARNING, "Invalid trunk type '%s' defaulting to T1\n", ftdm_span_get_trunk_type_str(span)); span->trunk_type = FTDM_TRUNK_T1; } - for(i = 1; i <= span->chan_count; i++) { - if (span->channels[i]->type == FTDM_CHAN_TYPE_DQ921) { - if (x > 1) { - snprintf(span->last_error, sizeof(span->last_error), "Span has more than 2 D-Channels!"); + for (i = 1; i <= ftdm_span_get_chan_count(span); i++) { + ftdm_channel_t *chan = ftdm_span_get_channel(span, i); + + switch (ftdm_channel_get_type(chan)) { + case FTDM_CHAN_TYPE_DQ921: + if (dchan_count > 1) { + ftdm_log(FTDM_LOG_ERROR, "Span has more than 1 D-Channel!\n"); + snprintf(span->last_error, sizeof(span->last_error), "Span has more than 1 D-Channel!"); return FTDM_FAIL; } - if (ftdm_channel_open(span->span_id, i, &dchans[x]) == FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_DEBUG, "opening d-channel #%d %d:%d\n", x, dchans[x]->span_id, dchans[x]->chan_id); - dchans[x]->state = FTDM_CHANNEL_STATE_UP; - x++; + if (ftdm_channel_open(ftdm_span_get_id(span), i, &dchan) == FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_DEBUG, "opening d-channel #%d %d:%d\n", dchan_count, + ftdm_channel_get_span_id(dchan), ftdm_channel_get_id(dchan)); + dchan->state = FTDM_CHANNEL_STATE_UP; } + + dchan_count++; + break; + + case FTDM_CHAN_TYPE_B: + bchan_count++; + break; + + default: + break; } } - if (!x) { - snprintf(span->last_error, sizeof(span->last_error), "Span has no D-Channels!"); + if (!dchan_count) { + ftdm_log(FTDM_LOG_ERROR, "Span has no D-Channel!\n"); + snprintf(span->last_error, sizeof(span->last_error), "Span has no D-Channel!"); + return FTDM_FAIL; + } + if (!bchan_count) { + ftdm_log(FTDM_LOG_ERROR, "Span has no B-Channels!\n"); + snprintf(span->last_error, sizeof(span->last_error), "Span has no B-Channels!"); return FTDM_FAIL; } @@ -2611,52 +2651,55 @@ static FIO_SIG_CONFIGURE_FUNCTION(isdn_configure_span) isdn_data->mode = Q931_TE; dialect = Q931_Dialect_Q931; - while((var = va_arg(ap, char *))) { + for (i = 0; ftdm_parameters[i].var; i++) { + const char *var = ftdm_parameters[i].var; + const char *val = ftdm_parameters[i].val; + + if (!val) { + ftdm_log(FTDM_LOG_ERROR, "Variable '%s' has no value\n", var); + return FTDM_FAIL; + } + if (!strcasecmp(var, "mode")) { - if (!(val = va_arg(ap, char *))) { - break; + if ((isdn_data->mode = parse_mode(val)) < 0) { + ftdm_log(FTDM_LOG_ERROR, "Invalid/unknown mode '%s'\n", val); + snprintf(span->last_error, sizeof(span->last_error), "Invalid/unknown mode [%s]!", val); + return FTDM_FAIL; } - isdn_data->mode = strcasecmp(val, "net") ? Q931_TE : Q931_NT; } else if (!strcasecmp(var, "dialect")) { - if (!(val = va_arg(ap, char *))) { - break; - } - dialect = parse_dialect(val); - if (dialect == Q931_Dialect_Count) { + if (parse_dialect(val, &dialect) < 0) { + ftdm_log(FTDM_LOG_ERROR, "Invalid/unknown dialect '%s'\n", val); snprintf(span->last_error, sizeof(span->last_error), "Invalid/unknown dialect [%s]!", val); return FTDM_FAIL; } } else if (!strcasecmp(var, "opts")) { - if (!(val = va_arg(ap, char *))) { - break; + if (parse_opts(val, &isdn_data->opts) < 0) { + ftdm_log(FTDM_LOG_ERROR, "Invalid/unknown options '%s'\n", val); + snprintf(span->last_error, sizeof(span->last_error), "Invalid/unknown options [%s]!", val); + return FTDM_FAIL; } - isdn_data->opts = parse_opts(val); } else if (!strcasecmp(var, "tonemap")) { - if (!(val = va_arg(ap, char *))) { - break; - } tonemap = (const char *)val; } else if (!strcasecmp(var, "digit_timeout")) { - int *optp; - if (!(optp = va_arg(ap, int *))) { - break; + digit_timeout = atoi(val); + if (digit_timeout < 3000 || digit_timeout > 30000) { + ftdm_log(FTDM_LOG_WARNING, "Digit timeout %d ms outside of range (3000 - 30000 ms), using default (10000 ms)\n", digit_timeout); + digit_timeout = DEFAULT_DIGIT_TIMEOUT; } - digit_timeout = *optp; } else if (!strcasecmp(var, "q921loglevel")) { - q921loglevel = va_arg(ap, int); - if (q921loglevel < Q921_LOG_NONE) { - q921loglevel = Q921_LOG_NONE; - } else if (q921loglevel > Q921_LOG_DEBUG) { - q921loglevel = Q921_LOG_DEBUG; + if ((q921loglevel = parse_loglevel(val)) < 0) { + ftdm_log(FTDM_LOG_ERROR, "Invalid/unknown loglevel '%s'\n", val); + snprintf(span->last_error, sizeof(span->last_error), "Invalid/unknown loglevel [%s]!", val); + return FTDM_FAIL; } } else if (!strcasecmp(var, "q931loglevel")) { - q931loglevel = va_arg(ap, int); - if (q931loglevel < Q931_LOG_NONE) { - q931loglevel = Q931_LOG_NONE; - } else if (q931loglevel > Q931_LOG_DEBUG) { - q931loglevel = Q931_LOG_DEBUG; + if ((q931loglevel = parse_loglevel(val)) < 0) { + ftdm_log(FTDM_LOG_ERROR, "Invalid/unknown loglevel '%s'\n", val); + snprintf(span->last_error, sizeof(span->last_error), "Invalid/unknown loglevel [%s]!", val); + return FTDM_FAIL; } } else { + ftdm_log(FTDM_LOG_ERROR, "Unknown parameter '%s'\n", var); snprintf(span->last_error, sizeof(span->last_error), "Unknown parameter [%s]", var); return FTDM_FAIL; } @@ -2665,39 +2708,35 @@ static FIO_SIG_CONFIGURE_FUNCTION(isdn_configure_span) if (!digit_timeout) { digit_timeout = DEFAULT_DIGIT_TIMEOUT; } - else if (digit_timeout < 3000 || digit_timeout > 30000) { - ftdm_log(FTDM_LOG_WARNING, "Digit timeout %d ms outside of range (3000 - 30000 ms), using default (10000 ms)\n", digit_timeout); - digit_timeout = DEFAULT_DIGIT_TIMEOUT; - } /* allocate per b-chan data */ if (isdn_data->mode == Q931_NT) { ftdm_isdn_bchan_data_t *data; - data = malloc(span->chan_count * sizeof(ftdm_isdn_bchan_data_t)); + data = malloc(bchan_count * sizeof(ftdm_isdn_bchan_data_t)); if (!data) { return FTDM_FAIL; } - for (i = 1; i <= span->chan_count; i++, data++) { - if (span->channels[i]->type == FTDM_CHAN_TYPE_B) { - span->channels[i]->mod_data = data; + for (i = 1; i <= ftdm_span_get_chan_count(span); i++, data++) { + ftdm_channel_t *chan = ftdm_span_get_channel(span, i); + + if (ftdm_channel_get_type(chan) == FTDM_CHAN_TYPE_B) { + chan->mod_data = data; memset(data, 0, sizeof(ftdm_isdn_bchan_data_t)); } } } - isdn_data->sig_cb = sig_cb; - isdn_data->dchans[0] = dchans[0]; - isdn_data->dchans[1] = dchans[1]; - isdn_data->dchan = isdn_data->dchans[0]; + isdn_data->sig_cb = sig_cb; + isdn_data->dchan = dchan; isdn_data->digit_timeout = digit_timeout; Q921_InitTrunk(&isdn_data->q921, 0, 0, isdn_data->mode, - span->trunk_type == FTDM_TRUNK_BRI_PTMP ? Q921_PTMP : Q921_PTP, + (ftdm_span_get_trunk_type(span) == FTDM_TRUNK_BRI_PTMP) ? Q921_PTMP : Q921_PTP, 0, ftdm_isdn_921_21, (Q921Tx23CB_t)ftdm_isdn_921_23, @@ -2798,7 +2837,7 @@ ftdm_module_t ftdm_module = { .io_unload = NULL, .sig_load = isdn_load, .sig_unload = isdn_unload, - .sig_configure = isdn_configure_span + .configure_span_signaling = isdn_configure_span }; /* For Emacs: From b0cca151e60063868b929b5826533850569d718b Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Sun, 14 Nov 2010 16:45:35 +0100 Subject: [PATCH 33/45] ftmod_isdn: Major cleanup: use accessor functions, coding-style, etc. Signed-off-by: Stefan Knoblich --- .../freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c | 424 ++++++++++-------- 1 file changed, 227 insertions(+), 197 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c index c5294bf1b2..03c027e664 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -56,9 +56,22 @@ static const char *ftdm_span_get_trunk_type_str(const ftdm_span_t *span) { + assert(span); return ftdm_trunk_type2str(span->trunk_type); } +static int ftdm_channel_get_state(const ftdm_channel_t *chan) +{ + assert(chan); + return chan->state; +} + +static int ftdm_channel_get_last_state(const ftdm_channel_t *chan) +{ + assert(chan); + return chan->last_state; +} + /***************************************************************************************** * PCAP * Based on Helmut Kuper's () implementation, @@ -95,13 +108,8 @@ static ftdm_status_t isdn_pcap_open(struct ftdm_isdn_data *isdn, char *filename) { struct pcap_context *pcap = NULL; - if (!isdn) { + if (!isdn || ftdm_strlen_zero(filename)) return FTDM_FAIL; - } - - if (ftdm_strlen_zero(filename)) { - return FTDM_FAIL; - } pcap = malloc(sizeof(struct pcap_context)); if (!pcap) { @@ -121,23 +129,20 @@ static ftdm_status_t isdn_pcap_open(struct ftdm_isdn_data *isdn, char *filename) pcap->dump = pcap_dump_open(pcap->handle, pcap->filename); if (!pcap->dump) { - ftdm_log(FTDM_LOG_ERROR, "Failed to open capture file: %s\n", pcap_geterr(pcap->handle)); + ftdm_log(FTDM_LOG_ERROR, "Failed to open capture file: '%s'\n", pcap_geterr(pcap->handle)); goto error; } - ftdm_log(FTDM_LOG_INFO, "Capture file \"%s\" opened\n", pcap->filename); + ftdm_log(FTDM_LOG_INFO, "Capture file '%s' opened\n", pcap->filename); isdn->pcap = pcap; return FTDM_SUCCESS; - error: - if (pcap->handle) { + if (pcap->handle) pcap_close(pcap->handle); - } - if (pcap->filename) { + if (pcap->filename) free(pcap->filename); - } free(pcap); @@ -149,9 +154,9 @@ static ftdm_status_t isdn_pcap_close(struct ftdm_isdn_data *isdn) struct pcap_context *pcap = NULL; long size; - if (!isdn || !isdn->pcap) { + if (!isdn || !isdn->pcap) return FTDM_FAIL; - } + pcap = isdn->pcap; isdn->flags &= ~(FTDM_ISDN_CAPTURE | FTDM_ISDN_CAPTURE_L3ONLY); @@ -160,7 +165,7 @@ static ftdm_status_t isdn_pcap_close(struct ftdm_isdn_data *isdn) pcap_dump_flush(pcap->dump); size = pcap_dump_ftell(pcap->dump); - ftdm_log(FTDM_LOG_INFO, "File \"%s\" captured %ld bytes of data\n", pcap->filename, size); + ftdm_log(FTDM_LOG_INFO, "File '%s' captured %ld bytes of data\n", pcap->filename, size); pcap_dump_close(pcap->dump); pcap_close(pcap->handle); @@ -214,9 +219,8 @@ static ftdm_status_t isdn_pcap_write(struct ftdm_isdn_data *isdn, unsigned char int offset = sizeof(struct isdn_sll_hdr); int nbytes; - if (!isdn || !isdn->pcap || !buf || !len) { + if (!isdn || !isdn->pcap || !buf || !len) return FTDM_FAIL; - } pcap = isdn->pcap; @@ -436,7 +440,7 @@ static FIO_CHANNEL_REQUEST_FUNCTION(isdn_channel_request) isdn_data->outbound_crv[gen->CRV] = caller_data; //isdn_data->channels_local_crv[gen->CRV] = ftdmchan; - while(ftdm_running() && caller_data->call_state == FTDM_CALLER_STATE_DIALING) { + while (ftdm_running() && caller_data->call_state == FTDM_CALLER_STATE_DIALING) { ftdm_sleep(1); if (!--sanity) { @@ -451,8 +455,8 @@ static FIO_CHANNEL_REQUEST_FUNCTION(isdn_channel_request) int fail = 1; new_chan = NULL; - if (caller_data->chan_id < FTDM_MAX_CHANNELS_SPAN && caller_data->chan_id <= span->chan_count) { - new_chan = span->channels[caller_data->chan_id]; + if (caller_data->chan_id > 0 && caller_data->chan_id <= ftdm_span_get_chan_count(span)) { + new_chan = ftdm_span_get_channel(span, caller_data->chan_id); } if (new_chan && (status = ftdm_channel_open_chan(new_chan) == FTDM_SUCCESS)) { @@ -570,10 +574,8 @@ static void ftdm_isdn_call_event(struct Q931_Call *call, struct Q931_CallEvent * /* * Global event */ - ftdm_log(FTDM_LOG_DEBUG, "Received global event from Q.931\n"); - } - else { + } else { ftdm_channel_t *ftdmchan = NULL; ftdm_sigmsg_t sig; int call_crv = Q931CallGetCRV(call); @@ -716,9 +718,8 @@ static void __isdn_get_number(const char *digits, const int ton, char *buf, int { int offset = 0; - if (!digits || !buf || size <= 0) { + if (!digits || !buf || size <= 0) return; - } switch (ton) { case Q931_TON_NATIONAL: @@ -747,24 +748,23 @@ static void __isdn_get_number(const char *digits, const int ton, char *buf, int */ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic *msg, int mlen) { + Q931mes_Generic *gen = (Q931mes_Generic *) msg; ftdm_span_t *span = (ftdm_span_t *) pvt; ftdm_isdn_data_t *isdn_data = span->signal_data; - Q931mes_Generic *gen = (Q931mes_Generic *) msg; + ftdm_channel_t *ftdmchan = NULL; int chan_id = 0; int chan_hunt = 0; - ftdm_channel_t *ftdmchan = NULL; -// ftdm_caller_data_t *caller_data = NULL; if (Q931IsIEPresent(gen->ChanID)) { Q931ie_ChanID *chanid = Q931GetIEPtr(gen->ChanID, gen->buf); - if(chanid->IntType) + if (chanid->IntType) chan_id = chanid->ChanSlot; else chan_id = chanid->InfoChanSel; /* "any" channel specified */ - if(chanid->InfoChanSel == 3) { + if (chanid->InfoChanSel == 3) { chan_hunt++; } } else if (FTDM_SPAN_IS_NT(span)) { @@ -810,9 +810,7 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic case Q931mes_ALERTING: case Q931mes_PROGRESS: case Q931mes_CONNECT: - { - caller_data->call_state = FTDM_CALLER_STATE_SUCCESS; - } + caller_data->call_state = FTDM_CALLER_STATE_SUCCESS; break; default: caller_data->call_state = FTDM_CALLER_STATE_FAIL; @@ -829,8 +827,12 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic ftdmchan = isdn_data->channels_remote_crv[gen->CRV]; } - ftdm_log(FTDM_LOG_DEBUG, "ftdmchan %x (%d:%d) source isdn_data->channels_%s_crv[%#hx]\n", ftdmchan, ftdmchan ? ftdmchan->span_id : -1, ftdmchan ? ftdmchan->chan_id : -1, gen->CRVFlag ? "local" : "remote", gen->CRV); - + ftdm_log(FTDM_LOG_DEBUG, "ftdmchan %x (%d:%d) source isdn_data->channels_%s_crv[%#hx]\n", + ftdmchan, + ((ftdmchan) ? ftdm_channel_get_span_id(ftdmchan) : -1), + ((ftdmchan) ? ftdm_channel_get_id(ftdmchan) : -1), + ((gen->CRVFlag) ? "local" : "remote"), + gen->CRV); if (gen->ProtDisc == 3) { switch(gen->MesType) { @@ -842,7 +844,9 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic case 0: /* change status to "in service" */ { ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_SUSPENDED); - ftdm_log(FTDM_LOG_DEBUG, "Channel %d:%d in service\n", ftdmchan->span_id, ftdmchan->chan_id); + ftdm_log(FTDM_LOG_DEBUG, "Channel %d:%d in service\n", + ftdm_channel_get_span_id(ftdmchan), + ftdm_channel_get_id(ftdmchan)); ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); } break; @@ -874,19 +878,20 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic case Q931mes_RESTART: { if (chan_id) { - ftdmchan = span->channels[chan_id]; + ftdmchan = ftdm_span_get_channel(span, chan_id); } if (ftdmchan) { ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); } else { uint32_t i; - for (i = 1; i < span->chan_count; i++) { + for (i = 1; i < ftdm_span_get_chan_count(span); i++) { /* Skip channels that are down and D-Channels (#OpenZAP-39) */ - if (span->channels[i]->state == FTDM_CHANNEL_STATE_DOWN || span->channels[i]->type == FTDM_CHAN_TYPE_DQ921) + if (ftdm_channel_get_state(span->channels[i]) == FTDM_CHANNEL_STATE_DOWN || + ftdm_channel_get_type(span->channels[i]) == FTDM_CHAN_TYPE_DQ921) continue; - ftdm_set_state_locked((span->channels[i]), FTDM_CHANNEL_STATE_RESTART); + ftdm_set_state_locked(span->channels[i], FTDM_CHANNEL_STATE_RESTART); } } } @@ -896,15 +901,17 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic { const char *what = gen->MesType == Q931mes_RELEASE ? "Release" : "Release Complete"; if (ftdmchan) { - if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING || ftdmchan->state == FTDM_CHANNEL_STATE_HANGUP) { + if (ftdm_channel_get_state(ftdmchan) == FTDM_CHANNEL_STATE_TERMINATING || + ftdm_channel_get_state(ftdmchan) == FTDM_CHANNEL_STATE_HANGUP) + { if (gen->MesType == Q931mes_RELEASE) { ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); } else { ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); } } - else if((gen->MesType == Q931mes_RELEASE && ftdmchan->state <= FTDM_CHANNEL_STATE_UP) || - (gen->MesType == Q931mes_RELEASE_COMPLETE && ftdmchan->state == FTDM_CHANNEL_STATE_DIALING)) { + else if ((gen->MesType == Q931mes_RELEASE && ftdm_channel_get_state(ftdmchan) <= FTDM_CHANNEL_STATE_UP) || + (gen->MesType == Q931mes_RELEASE_COMPLETE && ftdm_channel_get_state(ftdmchan) == FTDM_CHANNEL_STATE_DIALING)) { /* * Don't keep inbound channels open if the remote side hangs up before we answered @@ -914,18 +921,20 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic ftdm_status_t status; memset(&sig, 0, sizeof(sig)); - sig.chan_id = ftdmchan->chan_id; - sig.span_id = ftdmchan->span_id; + sig.span_id = ftdm_channel_get_span_id(ftdmchan); + sig.chan_id = ftdm_channel_get_id(ftdmchan); sig.channel = ftdmchan; sig.channel->caller_data.hangup_cause = (cause) ? cause->Value : FTDM_CAUSE_NORMAL_UNSPECIFIED; sig.event_id = FTDM_SIGEVENT_STOP; status = isdn_data->sig_cb(&sig); - ftdm_log(FTDM_LOG_DEBUG, "Received %s in state %s, requested hangup for channel %d:%d\n", what, ftdm_channel_state2str(ftdmchan->state), ftdmchan->span_id, chan_id); - } - else { - ftdm_log(FTDM_LOG_DEBUG, "Ignoring %s on channel %d\n", what, chan_id); + ftdm_log(FTDM_LOG_DEBUG, "Received %s in state %s, requested hangup for channel %d:%d\n", what, + ftdm_channel_get_state_str(ftdmchan), + ftdm_channel_get_span_id(ftdmchan), + ftdm_channel_get_id(ftdmchan)); + } else { + ftdm_log(FTDM_LOG_DEBUG, "Ignoring %s on channel %d\n", what, ftdm_channel_get_id(ftdmchan)); } } else { ftdm_log(FTDM_LOG_CRIT, "Received %s with no matching channel %d\n", what, chan_id); @@ -982,18 +991,18 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic { Q931ie_CallingNum *callingnum = Q931GetIEPtr(gen->CallingNum, gen->buf); Q931ie_CalledNum *callednum = Q931GetIEPtr(gen->CalledNum, gen->buf); - int fail = 1; - int fail_cause = 0; - int overlap_dial = 0; uint32_t cplen = mlen; + int overlap_dial = 0; + int fail_cause = 0; + int fail = 1; - if(ftdmchan && ftdmchan == isdn_data->channels_remote_crv[gen->CRV]) { + if (ftdmchan && ftdmchan == isdn_data->channels_remote_crv[gen->CRV]) { ftdm_log(FTDM_LOG_INFO, "Duplicate SETUP message(?) for Channel %d:%d ~ %d:%d in state %s [ignoring]\n", - ftdmchan->span_id, - ftdmchan->chan_id, - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id, - ftdm_channel_state2str(ftdmchan->state)); + ftdm_channel_get_span_id(ftdmchan), + ftdm_channel_get_id(ftdmchan), + ftdm_channel_get_ph_span_id(ftdmchan), + ftdm_channel_get_ph_id(ftdmchan), + ftdm_channel_get_state_str(ftdmchan)); break; } @@ -1008,10 +1017,10 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic * In NT-mode with channel selection "any", * try to find a free channel */ - for (x = 1; x <= span->chan_count; x++) { - ftdm_channel_t *zc = span->channels[x]; + for (x = 1; x <= ftdm_span_get_chan_count(span); x++) { + ftdm_channel_t *zc = ftdm_span_get_channel(span, x); - if (!ftdm_test_flag(zc, FTDM_CHANNEL_INUSE) && zc->state == FTDM_CHANNEL_STATE_DOWN) { + if (!ftdm_test_flag(zc, FTDM_CHANNEL_INUSE) && ftdm_channel_get_state(zc) == FTDM_CHANNEL_STATE_DOWN) { ftdmchan = zc; break; } @@ -1032,8 +1041,8 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic * TODO: NT mode is abled to select a different channel if the one chosen * by the TE side is already in use */ - if (chan_id > 0 && chan_id < FTDM_MAX_CHANNELS_SPAN && chan_id <= span->chan_count) { - ftdmchan = span->channels[chan_id]; + if (chan_id > 0 && chan_id < FTDM_MAX_CHANNELS_SPAN && chan_id <= ftdm_span_get_chan_count(span)) { + ftdmchan = ftdm_span_get_channel(span, chan_id); } else { /* invalid channel id */ @@ -1047,22 +1056,22 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic if (FTDM_SPAN_IS_NT(span)) { ftdm_log(FTDM_LOG_NOTICE, "No destination number found, assuming overlap dial\n"); overlap_dial++; - } - else { + } else { ftdm_log(FTDM_LOG_ERROR, "No destination number found\n"); ftdmchan = NULL; } } if (ftdmchan) { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE) || ftdmchan->state != FTDM_CHANNEL_STATE_DOWN) { - if (ftdmchan->state == FTDM_CHANNEL_STATE_DOWN || ftdmchan->state >= FTDM_CHANNEL_STATE_TERMINATING) { + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE) || ftdm_channel_get_state(ftdmchan) != FTDM_CHANNEL_STATE_DOWN) { + if (ftdm_channel_get_state(ftdmchan) == FTDM_CHANNEL_STATE_DOWN || ftdm_channel_get_state(ftdmchan) >= FTDM_CHANNEL_STATE_TERMINATING) + { int x = 0; ftdm_log(FTDM_LOG_WARNING, "Channel %d:%d ~ %d:%d is already in use waiting for it to become available.\n", - ftdmchan->span_id, - ftdmchan->chan_id, - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id); + ftdm_channel_get_span_id(ftdmchan), + ftdm_channel_get_id(ftdmchan), + ftdm_channel_get_ph_span_id(ftdmchan), + ftdm_channel_get_ph_id(ftdmchan)); for (x = 0; x < 200; x++) { if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)) { @@ -1073,16 +1082,17 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic } if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)) { ftdm_log(FTDM_LOG_ERROR, "Channel %d:%d ~ %d:%d is already in use.\n", - ftdmchan->span_id, - ftdmchan->chan_id, - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id - ); + ftdm_channel_get_span_id(ftdmchan), + ftdm_channel_get_id(ftdmchan), + ftdm_channel_get_ph_span_id(ftdmchan), + ftdm_channel_get_ph_id(ftdmchan)); ftdmchan = NULL; } } - if (ftdmchan && ftdmchan->state == FTDM_CHANNEL_STATE_DOWN) { + if (ftdmchan && ftdm_channel_get_state(ftdmchan) == FTDM_CHANNEL_STATE_DOWN) { + ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(ftdmchan); + isdn_data->channels_remote_crv[gen->CRV] = ftdmchan; memset(&ftdmchan->caller_data, 0, sizeof(ftdmchan->caller_data)); @@ -1091,34 +1101,32 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic } /* copy number readd prefix as needed */ - isdn_get_number(callingnum, ftdmchan->caller_data.cid_num.digits); - isdn_get_number(callingnum, ftdmchan->caller_data.cid_name); - isdn_get_number(callingnum, ftdmchan->caller_data.ani.digits); + isdn_get_number(callingnum, caller_data->cid_num.digits); + isdn_get_number(callingnum, caller_data->cid_name); + isdn_get_number(callingnum, caller_data->ani.digits); -// ftdm_set_string(ftdmchan->caller_data.cid_num.digits, (char *)callingnum->Digit); -// ftdm_set_string(ftdmchan->caller_data.cid_name, (char *)callingnum->Digit); -// ftdm_set_string(ftdmchan->caller_data.ani.digits, (char *)callingnum->Digit); if (!overlap_dial) { -// ftdm_set_string(ftdmchan->caller_data.dnis.digits, (char *)callednum->Digit); - isdn_get_number(callednum, ftdmchan->caller_data.dnis.digits); + isdn_get_number(callednum, caller_data->dnis.digits); } #ifdef __TODO_OR_REMOVE__ ftdmchan->caller_data.CRV = gen->CRV; #endif - if (cplen > sizeof(ftdmchan->caller_data.raw_data)) { - cplen = sizeof(ftdmchan->caller_data.raw_data); + if (cplen > sizeof(caller_data->raw_data)) { + cplen = sizeof(caller_data->raw_data); } gen->CRVFlag = !(gen->CRVFlag); - memcpy(ftdmchan->caller_data.raw_data, msg, cplen); - ftdmchan->caller_data.raw_data_len = cplen; + memcpy(caller_data->raw_data, msg, cplen); + caller_data->raw_data_len = cplen; fail = 0; } } if (fail) { Q931ie_Cause cause; + gen->MesType = Q931mes_DISCONNECT; gen->CRVFlag = 1; /* inbound call */ + cause.IEId = Q931ie_CAUSE; cause.Size = sizeof(Q931ie_Cause); cause.CodStand = Q931_CODING_ITU; @@ -1149,12 +1157,12 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic Q931InitIEChanID(&ChanID); ChanID.IntType = FTDM_SPAN_IS_BRI(ftdmchan->span) ? 0 : 1; /* PRI = 1, BRI = 0 */ ChanID.PrefExcl = FTDM_SPAN_IS_NT(ftdmchan->span) ? 1 : 0; /* Exclusive in NT-mode = 1, Preferred otherwise = 0 */ - if(ChanID.IntType) { + if (ChanID.IntType) { ChanID.InfoChanSel = 1; /* None = 0, See Slot = 1, Any = 3 */ ChanID.ChanMapType = 3; /* B-Chan */ - ChanID.ChanSlot = (unsigned char)ftdmchan->chan_id; + ChanID.ChanSlot = (unsigned char)ftdm_channel_get_id(ftdmchan); } else { - ChanID.InfoChanSel = (unsigned char)ftdmchan->chan_id & 0x03; /* None = 0, B1 = 1, B2 = 2, Any = 3 */ + ChanID.InfoChanSel = (unsigned char)ftdm_channel_get_id(ftdmchan) & 0x03; /* None = 0, B1 = 1, B2 = 2, Any = 3 */ } gen->ChanID = Q931AppendIE(gen, (L3UCHAR *) &ChanID); @@ -1192,7 +1200,7 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic case Q931mes_CALL_PROCEEDING: { if (ftdmchan) { - ftdm_log(FTDM_LOG_CRIT, "Received CALL PROCEEDING message for channel %d\n", chan_id); + ftdm_log(FTDM_LOG_CRIT, "Received CALL PROCEEDING message for channel %d\n", ftdm_channel_get_id(ftdmchan)); ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); } else { ftdm_log(FTDM_LOG_CRIT, "Received CALL PROCEEDING with no matching channel %d\n", chan_id); @@ -1202,7 +1210,7 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic case Q931mes_CONNECT_ACKNOWLEDGE: { if (ftdmchan) { - ftdm_log(FTDM_LOG_DEBUG, "Received CONNECT_ACK message for channel %d\n", chan_id); + ftdm_log(FTDM_LOG_DEBUG, "Received CONNECT_ACK message for channel %d\n", ftdm_channel_get_id(ftdmchan)); } else { ftdm_log(FTDM_LOG_DEBUG, "Received CONNECT_ACK with no matching channel %d\n", chan_id); } @@ -1212,9 +1220,9 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic case Q931mes_INFORMATION: { if (ftdmchan) { - ftdm_log(FTDM_LOG_CRIT, "Received INFORMATION message for channel %d\n", ftdmchan->chan_id); + ftdm_log(FTDM_LOG_CRIT, "Received INFORMATION message for channel %d\n", ftdm_channel_get_id(ftdmchan)); - if (ftdmchan->state == FTDM_CHANNEL_STATE_DIALTONE) { + if (ftdm_channel_get_state(ftdmchan) == FTDM_CHANNEL_STATE_DIALTONE) { char digit = '\0'; /* @@ -1232,7 +1240,7 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic /* TODO: make this more safe with strncat() */ pos = strlen(ftdmchan->caller_data.dnis.digits); - strcat(&ftdmchan->caller_data.dnis.digits[pos], (char *)callednum->Digit); + strcat(&ftdmchan->caller_data.dnis.digits[pos], (char *)callednum->Digit); /* update timer */ data->digit_timeout = ftdm_time_now() + isdn_data->digit_timeout; @@ -1312,14 +1320,16 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) ftdm_status_t status; ftdm_log(FTDM_LOG_DEBUG, "%d:%d STATE [%s]\n", - ftdmchan->span_id, ftdmchan->chan_id, ftdm_channel_state2str(ftdmchan->state)); + ftdm_channel_get_span_id(ftdmchan), + ftdm_channel_get_id(ftdmchan), + ftdm_channel_get_state_str(ftdmchan)); memset(&sig, 0, sizeof(sig)); - sig.chan_id = ftdmchan->chan_id; - sig.span_id = ftdmchan->span_id; + sig.span_id = ftdm_channel_get_span_id(ftdmchan); + sig.chan_id = ftdm_channel_get_id(ftdmchan); sig.channel = ftdmchan; - switch (ftdmchan->state) { + switch (ftdm_channel_get_state(ftdmchan)) { case FTDM_CHANNEL_STATE_DOWN: { if (gen->CRV) { @@ -1348,22 +1358,22 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) gen->CRV = crv; gen->CRVFlag = 1; /* inbound */ - if (FTDM_SPAN_IS_NT(ftdmchan->span)) { + if (FTDM_SPAN_IS_NT(ftdm_channel_get_span(ftdmchan))) { Q931ie_ChanID ChanID; /* * Set new Channel ID */ Q931InitIEChanID(&ChanID); - ChanID.IntType = FTDM_SPAN_IS_BRI(ftdmchan->span) ? 0 : 1; /* PRI = 1, BRI = 0 */ + ChanID.IntType = FTDM_SPAN_IS_BRI(ftdm_channel_get_span(ftdmchan)) ? 0 : 1; /* PRI = 1, BRI = 0 */ ChanID.PrefExcl = 1; /* always exclusive in NT-mode */ - if(ChanID.IntType) { + if (ChanID.IntType) { ChanID.InfoChanSel = 1; /* None = 0, See Slot = 1, Any = 3 */ ChanID.ChanMapType = 3; /* B-Chan */ - ChanID.ChanSlot = (unsigned char)ftdmchan->chan_id; + ChanID.ChanSlot = (unsigned char)ftdm_channel_get_id(ftdmchan); } else { - ChanID.InfoChanSel = (unsigned char)ftdmchan->chan_id & 0x03; /* None = 0, B1 = 1, B2 = 2, Any = 3 */ + ChanID.InfoChanSel = (unsigned char)ftdm_channel_get_id(ftdmchan) & 0x03; /* None = 0, B1 = 1, B2 = 2, Any = 3 */ } gen->ChanID = Q931AppendIE(gen, (L3UCHAR *) &ChanID); } @@ -1442,6 +1452,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) break; case FTDM_CHANNEL_STATE_DIALING: if (!(isdn_data->opts & FTDM_ISDN_OPT_SUGGEST_CHANNEL)) { + ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(ftdmchan); Q931ie_BearerCap BearerCap; Q931ie_ChanID ChanID; Q931ie_CallingNum CallingNum; @@ -1456,7 +1467,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) /* * get codec type */ - ftdm_channel_command(ftdmchan->span->channels[ftdmchan->chan_id], FTDM_COMMAND_GET_NATIVE_CODEC, &codec); + ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_NATIVE_CODEC, &codec); /* * Q.931 Setup Message @@ -1481,14 +1492,14 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) * ChannelID IE */ Q931InitIEChanID(&ChanID); - ChanID.IntType = FTDM_SPAN_IS_BRI(ftdmchan->span) ? 0 : 1; /* PRI = 1, BRI = 0 */ - ChanID.PrefExcl = FTDM_SPAN_IS_NT(ftdmchan->span) ? 1 : 0; /* Exclusive in NT-mode = 1, Preferred otherwise = 0 */ - if(ChanID.IntType) { + ChanID.IntType = FTDM_SPAN_IS_BRI(ftdm_channel_get_span(ftdmchan)) ? 0 : 1; /* PRI = 1, BRI = 0 */ + ChanID.PrefExcl = FTDM_SPAN_IS_NT(ftdm_channel_get_span(ftdmchan)) ? 1 : 0; /* Exclusive in NT-mode = 1, Preferred otherwise = 0 */ + if (ChanID.IntType) { ChanID.InfoChanSel = 1; /* None = 0, See Slot = 1, Any = 3 */ ChanID.ChanMapType = 3; /* B-Chan */ - ChanID.ChanSlot = (unsigned char)ftdmchan->chan_id; + ChanID.ChanSlot = (unsigned char)ftdm_channel_get_id(ftdmchan); } else { - ChanID.InfoChanSel = (unsigned char)ftdmchan->chan_id & 0x03; /* None = 0, B1 = 1, B2 = 2, Any = 3 */ + ChanID.InfoChanSel = (unsigned char)ftdm_channel_get_id(ftdmchan) & 0x03; /* None = 0, B1 = 1, B2 = 2, Any = 3 */ } gen->ChanID = Q931AppendIE(gen, (L3UCHAR *) &ChanID); @@ -1504,26 +1515,26 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) /* * Display IE */ - if (!(isdn_data->opts & FTDM_ISDN_OPT_OMIT_DISPLAY_IE) && FTDM_SPAN_IS_NT(ftdmchan->span)) { + if (!(isdn_data->opts & FTDM_ISDN_OPT_OMIT_DISPLAY_IE) && FTDM_SPAN_IS_NT(ftdm_channel_get_span(ftdmchan))) { Q931InitIEDisplay(&Display); - Display.Size = Display.Size + (unsigned char)strlen(ftdmchan->caller_data.cid_name); + Display.Size = Display.Size + (unsigned char)strlen(caller_data->cid_name); gen->Display = Q931AppendIE(gen, (L3UCHAR *) &Display); ptrDisplay = Q931GetIEPtr(gen->Display, gen->buf); - ftdm_copy_string((char *)ptrDisplay->Display, ftdmchan->caller_data.cid_name, strlen(ftdmchan->caller_data.cid_name)+1); + ftdm_copy_string((char *)ptrDisplay->Display, caller_data->cid_name, strlen(caller_data->cid_name) + 1); } /* * CallingNum IE */ Q931InitIECallingNum(&CallingNum); - CallingNum.TypNum = ftdmchan->caller_data.ani.type; + CallingNum.TypNum = caller_data->ani.type; CallingNum.NumPlanID = Q931_NUMPLAN_E164; CallingNum.PresInd = Q931_PRES_ALLOWED; CallingNum.ScreenInd = Q931_SCREEN_USER_NOT_SCREENED; - CallingNum.Size = CallingNum.Size + (unsigned char)strlen(ftdmchan->caller_data.cid_num.digits); + CallingNum.Size = CallingNum.Size + (unsigned char)strlen(caller_data->cid_num.digits); gen->CallingNum = Q931AppendIE(gen, (L3UCHAR *) &CallingNum); ptrCallingNum = Q931GetIEPtr(gen->CallingNum, gen->buf); - ftdm_copy_string((char *)ptrCallingNum->Digit, ftdmchan->caller_data.cid_num.digits, strlen(ftdmchan->caller_data.cid_num.digits)+1); + ftdm_copy_string((char *)ptrCallingNum->Digit, caller_data->cid_num.digits, strlen(caller_data->cid_num.digits) + 1); /* * CalledNum IE @@ -1531,10 +1542,10 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) Q931InitIECalledNum(&CalledNum); CalledNum.TypNum = Q931_TON_UNKNOWN; CalledNum.NumPlanID = Q931_NUMPLAN_E164; - CalledNum.Size = CalledNum.Size + (unsigned char)strlen(ftdmchan->caller_data.ani.digits); + CalledNum.Size = CalledNum.Size + (unsigned char)strlen(caller_data->ani.digits); gen->CalledNum = Q931AppendIE(gen, (L3UCHAR *) &CalledNum); ptrCalledNum = Q931GetIEPtr(gen->CalledNum, gen->buf); - ftdm_copy_string((char *)ptrCalledNum->Digit, ftdmchan->caller_data.ani.digits, strlen(ftdmchan->caller_data.ani.digits)+1); + ftdm_copy_string((char *)ptrCalledNum->Digit, caller_data->ani.digits, strlen(caller_data->ani.digits) + 1); /* * High-Layer Compatibility IE (Note: Required for AVM FritzBox) @@ -1559,7 +1570,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) call = Q931GetCallByCRV(&isdn_data->q931, gen->CRV); if (call) { ftdm_log(FTDM_LOG_DEBUG, "Storing reference to current span in call %d [0x%x]\n", gen->CRV, gen->CRV); - Q931CallSetPrivate(call, ftdmchan->span); + Q931CallSetPrivate(call, ftdm_channel_get_span(ftdmchan)); } } } @@ -1567,7 +1578,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: { /* reply RELEASE with RELEASE_COMPLETE message */ - if(ftdmchan->last_state == FTDM_CHANNEL_STATE_HANGUP) { + if (ftdm_channel_get_last_state(ftdmchan) == FTDM_CHANNEL_STATE_HANGUP) { gen->MesType = Q931mes_RELEASE_COMPLETE; Q931Rx43(&isdn_data->q931, gen, gen->Size); @@ -1577,6 +1588,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) break; case FTDM_CHANNEL_STATE_HANGUP: { + ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(ftdmchan); Q931ie_Cause cause; ftdm_log(FTDM_LOG_DEBUG, "Hangup: Direction %s\n", ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) ? "Outbound" : "Inbound"); @@ -1593,7 +1605,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) * BRI PTMP needs special handling here... * TODO: cleanup / refine (see above) */ - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_RING) { + if (ftdm_channel_get_last_state(ftdmchan) == FTDM_CHANNEL_STATE_RING) { /* * inbound call [was: number unknown (= not found in routing state)] * (in Q.931 spec terms: Reject request) @@ -1601,7 +1613,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) gen->MesType = Q931mes_RELEASE_COMPLETE; //cause.Value = (unsigned char) FTDM_CAUSE_UNALLOCATED; - cause.Value = (unsigned char) ftdmchan->caller_data.hangup_cause; + cause.Value = (unsigned char) caller_data->hangup_cause; *cause.Diag = '\0'; gen->Cause = Q931AppendIE(gen, (L3UCHAR *) &cause); Q931Rx43(&isdn_data->q931, gen, gen->Size); @@ -1610,13 +1622,13 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) //ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); } - else if (ftdmchan->last_state <= FTDM_CHANNEL_STATE_PROGRESS) { + else if (ftdm_channel_get_last_state(ftdmchan) <= FTDM_CHANNEL_STATE_PROGRESS) { /* * just release all unanswered calls [was: inbound call, remote side hung up before we answered] */ gen->MesType = Q931mes_RELEASE; - cause.Value = (unsigned char) ftdmchan->caller_data.hangup_cause; + cause.Value = (unsigned char) caller_data->hangup_cause; *cause.Diag = '\0'; gen->Cause = Q931AppendIE(gen, (L3UCHAR *) &cause); Q931Rx43(&isdn_data->q931, gen, gen->Size); @@ -1630,7 +1642,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) */ gen->MesType = Q931mes_DISCONNECT; - cause.Value = (unsigned char) ftdmchan->caller_data.hangup_cause; + cause.Value = (unsigned char) caller_data->hangup_cause; *cause.Diag = '\0'; gen->Cause = Q931AppendIE(gen, (L3UCHAR *) &cause); Q931Rx43(&isdn_data->q931, gen, gen->Size); @@ -1643,6 +1655,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) sig.event_id = FTDM_SIGEVENT_STOP; status = isdn_data->sig_cb(&sig); + gen->MesType = Q931mes_RELEASE; gen->CRVFlag = ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) ? 0 : 1; Q931Rx43(&isdn_data->q931, gen, gen->Size); @@ -1654,19 +1667,25 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) static __inline__ void check_state(ftdm_span_t *span) { - if (ftdm_test_flag(span, FTDM_SPAN_STATE_CHANGE)) { - uint32_t j; - ftdm_clear_flag_locked(span, FTDM_SPAN_STATE_CHANGE); - 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_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); - } - } - } + if (ftdm_test_flag(span, FTDM_SPAN_STATE_CHANGE)) { + uint32_t j; + + ftdm_clear_flag_locked(span, FTDM_SPAN_STATE_CHANGE); + + for (j = 1; j <= ftdm_span_get_chan_count(span); j++) { + ftdm_channel_t *chan = ftdm_span_get_channel(span, j); + + if (ftdm_test_flag(chan, FTDM_CHANNEL_STATE_CHANGE)) { + ftdm_channel_lock(chan); + + ftdm_clear_flag(chan, FTDM_CHANNEL_STATE_CHANGE); + state_advance(chan); + ftdm_channel_complete_state(chan); + + ftdm_channel_unlock(chan); + } + } + } } @@ -1677,27 +1696,33 @@ static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *e ftdm_sigmsg_t sig; memset(&sig, 0, sizeof(sig)); - sig.chan_id = event->channel->chan_id; - sig.span_id = event->channel->span_id; + sig.span_id = ftdm_channel_get_span_id(event->channel); + sig.chan_id = ftdm_channel_get_id(event->channel); sig.channel = event->channel; ftdm_log(FTDM_LOG_DEBUG, "EVENT [%s][%d:%d] STATE [%s]\n", - ftdm_oob_event2str(event->enum_id), event->channel->span_id, event->channel->chan_id, ftdm_channel_state2str(event->channel->state)); + ftdm_oob_event2str(event->enum_id), + ftdm_channel_get_span_id(event->channel), + ftdm_channel_get_id(event->channel), + ftdm_channel_get_state_str(event->channel)); - switch(event->enum_id) { + switch (event->enum_id) { case FTDM_OOB_ALARM_TRAP: { sig.event_id = FTDM_OOB_ALARM_TRAP; - if (event->channel->state != FTDM_CHANNEL_STATE_DOWN) { + if (ftdm_channel_get_state(event->channel) != FTDM_CHANNEL_STATE_DOWN) { ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_RESTART); } ftdm_set_flag(event->channel, FTDM_CHANNEL_SUSPENDED); ftdm_channel_get_alarms(event->channel, &alarmbits); isdn_data->sig_cb(&sig); + ftdm_log(FTDM_LOG_WARNING, "channel %d:%d (%d:%d) has alarms [%s]\n", - event->channel->span_id, event->channel->chan_id, - event->channel->physical_span_id, event->channel->physical_chan_id, - event->channel->last_error); + ftdm_channel_get_span_id(event->channel), + ftdm_channel_get_id(event->channel), + ftdm_channel_get_ph_span_id(event->channel), + ftdm_channel_get_ph_id(event->channel), + ftdm_channel_get_last_error(event->channel)); } break; case FTDM_OOB_ALARM_CLEAR: @@ -1713,7 +1738,7 @@ static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *e { const char * digit_str = (const char *)event->data; - if(digit_str) { + if (digit_str) { fio_event_cb_t event_callback = NULL; ftdm_channel_queue_dtmf(event->channel, digit_str); @@ -1744,14 +1769,13 @@ static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *e static __inline__ void check_events(ftdm_span_t *span) { - ftdm_status_t status; + ftdm_status_t status = ftdm_span_poll_event(span, 5, NULL); - status = ftdm_span_poll_event(span, 5, NULL); - - switch(status) { + switch (status) { case FTDM_SUCCESS: { ftdm_event_t *event; + while (ftdm_span_next_event(span, &event) == FTDM_SUCCESS) { if (event->enum_id == FTDM_OOB_NOOP) { continue; @@ -1781,6 +1805,7 @@ static int teletone_handler(teletone_generation_session_t *ts, teletone_tone_map if (!dt_buffer) { return -1; } + wrote = teletone_mux_tones(ts, map); ftdm_buffer_write(dt_buffer, ts->buffer, wrote * 2); return 0; @@ -1807,9 +1832,11 @@ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) ftdm_buffer_set_loops(dt_buffer, -1); /* get a tone generation friendly interval to avoid distortions */ - for (x = 1; x <= span->chan_count; x++) { - if (span->channels[x]->type != FTDM_CHAN_TYPE_DQ921) { - ftdm_channel_command(span->channels[x], FTDM_COMMAND_GET_INTERVAL, &interval); + for (x = 1; x <= ftdm_span_get_chan_count(span); x++) { + ftdm_channel_t *chan = ftdm_span_get_channel(span, x); + + if (ftdm_channel_get_type(chan) != FTDM_CHAN_TYPE_DQ921) { + ftdm_channel_command(chan, FTDM_COMMAND_GET_INTERVAL, &interval); break; } } @@ -1824,7 +1851,7 @@ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) ts.duration = ts.rate; /* main loop */ - while(ftdm_running() && ftdm_test_flag(isdn_data, FTDM_ISDN_RUNNING)) { + while (ftdm_running() && ftdm_test_flag(isdn_data, FTDM_ISDN_RUNNING)) { ftdm_wait_flag_t flags; ftdm_status_t status; int last_chan_state = 0; @@ -1834,11 +1861,11 @@ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) /* * check b-channel states and generate & send tones if neccessary */ - for (x = 1; x <= span->chan_count; x++) { - ftdm_channel_t *ftdmchan = span->channels[x]; + for (x = 1; x <= ftdm_span_get_chan_count(span); x++) { + ftdm_channel_t *chan = ftdm_span_get_channel(span, x); ftdm_size_t len = sizeof(frame), rlen; - if (ftdmchan->type == FTDM_CHAN_TYPE_DQ921) { + if (ftdm_channel_get_type(chan) == FTDM_CHAN_TYPE_DQ921) { continue; } @@ -1847,40 +1874,41 @@ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) * (Recycle buffer content if succeeding channels share the * same state, this saves some cpu cycles) */ - switch (ftdmchan->state) { + switch (ftdm_channel_get_state(chan)) { case FTDM_CHANNEL_STATE_DIALTONE: { - ftdm_isdn_bchan_data_t *data = (ftdm_isdn_bchan_data_t *)ftdmchan->mod_data; + ftdm_isdn_bchan_data_t *data = (ftdm_isdn_bchan_data_t *)chan->mod_data; + ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); /* check overlap dial timeout first before generating tone */ if (data && data->digit_timeout && data->digit_timeout <= now) { - if (strlen(ftdmchan->caller_data.dnis.digits) > 0) { + if (strlen(caller_data->dnis.digits) > 0) { ftdm_log(FTDM_LOG_DEBUG, "Overlap dial timeout, advancing to RING state\n"); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RING); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RING); } else { /* no digits received, hangup */ ftdm_log(FTDM_LOG_DEBUG, "Overlap dial timeout, no digits received, going to HANGUP state\n"); - ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_RECOVERY_ON_TIMER_EXPIRE; /* TODO: probably wrong cause value */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + caller_data->hangup_cause = FTDM_CAUSE_RECOVERY_ON_TIMER_EXPIRE; /* TODO: probably wrong cause value */ + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); } data->digit_timeout = 0; continue; } - if (last_chan_state != ftdmchan->state) { + if (last_chan_state != ftdm_channel_get_state(chan)) { ftdm_buffer_zero(dt_buffer); - teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_DIAL]); - last_chan_state = ftdmchan->state; + teletone_run(&ts, span->tone_map[FTDM_TONEMAP_DIAL]); + last_chan_state = ftdm_channel_get_state(chan); } } break; case FTDM_CHANNEL_STATE_RING: { - if (last_chan_state != ftdmchan->state) { + if (last_chan_state != ftdm_channel_get_state(chan)) { ftdm_buffer_zero(dt_buffer); - teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_RING]); - last_chan_state = ftdmchan->state; + teletone_run(&ts, span->tone_map[FTDM_TONEMAP_RING]); + last_chan_state = ftdm_channel_get_state(chan); } } break; @@ -1889,18 +1917,20 @@ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) continue; } - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { - if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + if (!ftdm_test_flag(chan, FTDM_CHANNEL_OPEN)) { + if (ftdm_channel_open_chan(chan) != FTDM_SUCCESS) { + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); continue; } - ftdm_log(FTDM_LOG_NOTICE, "Successfully opened channel %d:%d\n", ftdmchan->span_id, ftdmchan->chan_id); + ftdm_log(FTDM_LOG_NOTICE, "Successfully opened channel %d:%d\n", + ftdm_channel_get_span_id(chan), + ftdm_channel_get_id(chan)); } flags = FTDM_READ; - status = ftdm_channel_wait(ftdmchan, &flags, (gated) ? 0 : interval); - switch(status) { + status = ftdm_channel_wait(chan, &flags, (gated) ? 0 : interval); + switch (status) { case FTDM_FAIL: continue; @@ -1915,12 +1945,12 @@ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) } gated = 1; - status = ftdm_channel_read(ftdmchan, frame, &len); + status = ftdm_channel_read(chan, frame, &len); if (status != FTDM_SUCCESS || len <= 0) { continue; } - if (ftdmchan->effective_codec != FTDM_CODEC_SLIN) { + if (chan->effective_codec != FTDM_CODEC_SLIN) { len *= 2; } @@ -1929,23 +1959,23 @@ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) rlen = ftdm_buffer_read_loop(dt_buffer, frame, len); - if (ftdmchan->effective_codec != FTDM_CODEC_SLIN) { + if (chan->effective_codec != FTDM_CODEC_SLIN) { fio_codec_t codec_func = NULL; - if (ftdmchan->native_codec == FTDM_CODEC_ULAW) { + if (chan->native_codec == FTDM_CODEC_ULAW) { codec_func = fio_slin2ulaw; - } else if (ftdmchan->native_codec == FTDM_CODEC_ALAW) { + } else if (chan->native_codec == FTDM_CODEC_ALAW) { codec_func = fio_slin2alaw; } if (codec_func) { status = codec_func(frame, sizeof(frame), &rlen); } else { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "codec error!"); + snprintf(chan->last_error, sizeof(chan->last_error), "codec error!"); goto done; } } - ftdm_channel_write(ftdmchan, frame, sizeof(frame), &rlen); + ftdm_channel_write(chan, frame, sizeof(frame), &rlen); } /* @@ -1994,7 +2024,7 @@ static void *ftdm_isdn_run(ftdm_thread_t *me, void *obj) Q921Start(&isdn_data->q921); Q931Start(&isdn_data->q931); - while(ftdm_running() && ftdm_test_flag(isdn_data, FTDM_ISDN_RUNNING)) { + while (ftdm_running() && ftdm_test_flag(isdn_data, FTDM_ISDN_RUNNING)) { ftdm_wait_flag_t flags = FTDM_READ; ftdm_status_t status = ftdm_channel_wait(isdn_data->dchan, &flags, 100); @@ -2006,7 +2036,7 @@ static void *ftdm_isdn_run(ftdm_thread_t *me, void *obj) /* * */ - switch(status) { + switch (status) { case FTDM_FAIL: { ftdm_log(FTDM_LOG_ERROR, "D-Chan Read Error!\n"); @@ -2045,8 +2075,8 @@ static void *ftdm_isdn_run(ftdm_thread_t *me, void *obj) } done: - ftdm_channel_close(&isdn_data->dchans[0]); - ftdm_channel_close(&isdn_data->dchans[1]); +// ftdm_channel_close(&isdn_data->dchans[0]); +// ftdm_channel_close(&isdn_data->dchans[1]); ftdm_clear_flag(isdn_data, FTDM_ISDN_RUNNING); #ifdef WIN32 @@ -2228,11 +2258,11 @@ static ftdm_status_t ftdm_isdn_stop(ftdm_span_t *span) ftdm_set_flag(isdn_data, FTDM_ISDN_STOP); - while(ftdm_test_flag(isdn_data, FTDM_ISDN_RUNNING)) { + while (ftdm_test_flag(isdn_data, FTDM_ISDN_RUNNING)) { ftdm_sleep(100); } - while(ftdm_test_flag(isdn_data, FTDM_ISDN_TONES_RUNNING)) { + while (ftdm_test_flag(isdn_data, FTDM_ISDN_TONES_RUNNING)) { ftdm_sleep(100); } @@ -2244,8 +2274,8 @@ static ftdm_status_t ftdm_isdn_stop(ftdm_span_t *span) */ static ftdm_status_t ftdm_isdn_start(ftdm_span_t *span) { - ftdm_status_t ret; ftdm_isdn_data_t *isdn_data = span->signal_data; + ftdm_status_t ret; if (ftdm_test_flag(isdn_data, FTDM_ISDN_RUNNING)) { return FTDM_FAIL; @@ -2429,7 +2459,7 @@ static FIO_API_FUNCTION(isdn_api) if (!strcasecmp(argv[2], "q921")) { layer = 0x01; - } else if(!strcasecmp(argv[2], "q931")) { + } else if (!strcasecmp(argv[2], "q931")) { layer = 0x02; } else if (!strcasecmp(argv[2], "all")) { layer = 0x03; @@ -2517,7 +2547,7 @@ static FIO_API_FUNCTION(isdn_api) stream->write_function(stream, "+OK capture started.\n"); goto done; } - else if(!strcasecmp(argv[2], "stop")) { + else if (!strcasecmp(argv[2], "stop")) { if (!isdn_pcap_is_open(isdn_data)) { stream->write_function(stream, "-ERR capture is not running.\n"); @@ -2530,7 +2560,7 @@ static FIO_API_FUNCTION(isdn_api) stream->write_function(stream, "+OK capture stopped.\n"); goto done; } - else if(!strcasecmp(argv[2], "suspend")) { + else if (!strcasecmp(argv[2], "suspend")) { if (!isdn_pcap_is_open(isdn_data)) { stream->write_function(stream, "-ERR capture is not running.\n"); @@ -2541,7 +2571,7 @@ static FIO_API_FUNCTION(isdn_api) stream->write_function(stream, "+OK capture suspended.\n"); goto done; } - else if(!strcasecmp(argv[2], "resume")) { + else if (!strcasecmp(argv[2], "resume")) { if (!isdn_pcap_is_open(isdn_data)) { stream->write_function(stream, "-ERR capture is not running.\n"); From e17201bbac873aa79679fd0ca14f1edaa0747eff Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Sun, 14 Nov 2010 17:43:38 +0100 Subject: [PATCH 34/45] freetdm: Add ftdm_channel_get_state(), ftdm_channel_get_last_state() and ftdm_span_get_trunk_type_str(). Remove custom versions from ftmod_isdn and ftmod_libpri. Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftdm_io.c | 23 +++++++++++++++++++ .../freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c | 18 --------------- .../src/ftmod/ftmod_libpri/ftmod_libpri.c | 14 ----------- libs/freetdm/src/include/freetdm.h | 9 ++++++++ 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index f02c9c48db..1dada451be 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -1915,6 +1915,11 @@ FT_DECLARE(ftdm_trunk_type_t) ftdm_span_get_trunk_type(const ftdm_span_t *span) return span->trunk_type; } +FT_DECLARE(const char *) ftdm_span_get_trunk_type_str(const ftdm_span_t *span) +{ + return ftdm_trunk_type2str(span->trunk_type); +} + FT_DECLARE(uint32_t) ftdm_span_get_id(const ftdm_span_t *span) { return span->span_id; @@ -2114,6 +2119,15 @@ FT_DECLARE(ftdm_caller_data_t *) ftdm_channel_get_caller_data(ftdm_channel_t *ft return &ftdmchan->caller_data; } +FT_DECLARE(int) ftdm_channel_get_state(const ftdm_channel_t *ftdmchan) +{ + int state; + ftdm_channel_lock(ftdmchan); + state = ftdmchan->state; + ftdm_channel_unlock(ftdmchan); + return state; +} + FT_DECLARE(const char *) ftdm_channel_get_state_str(const ftdm_channel_t *ftdmchan) { const char *state; @@ -2123,6 +2137,15 @@ FT_DECLARE(const char *) ftdm_channel_get_state_str(const ftdm_channel_t *ftdmch return state; } +FT_DECLARE(int) ftdm_channel_get_last_state(const ftdm_channel_t *ftdmchan) +{ + int last_state; + ftdm_channel_lock(ftdmchan); + last_state = ftdmchan->last_state; + ftdm_channel_unlock(ftdmchan); + return last_state; +} + FT_DECLARE(const char *) ftdm_channel_get_last_state_str(const ftdm_channel_t *ftdmchan) { const char *state; diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c index 03c027e664..1f90d486f3 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -54,24 +54,6 @@ #define DEFAULT_NATIONAL_PREFIX "0" #define DEFAULT_INTERNATIONAL_PREFIX "00" -static const char *ftdm_span_get_trunk_type_str(const ftdm_span_t *span) -{ - assert(span); - return ftdm_trunk_type2str(span->trunk_type); -} - -static int ftdm_channel_get_state(const ftdm_channel_t *chan) -{ - assert(chan); - return chan->state; -} - -static int ftdm_channel_get_last_state(const ftdm_channel_t *chan) -{ - assert(chan); - return chan->last_state; -} - /***************************************************************************************** * PCAP * Based on Helmut Kuper's () implementation, diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 1d1685f840..fdfdf79a93 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -34,30 +34,16 @@ #include "private/ftdm_core.h" #include "ftmod_libpri.h" -/*** - * Move to core - ***/ #ifndef ARRAY_SIZE #define ARRAY_SIZE(x) (sizeof((x)) / sizeof((x)[0])) #endif -static ftdm_channel_state_t ftdm_channel_get_state(const ftdm_channel_t *chan) -{ - assert(chan); - return chan->state; -} - static void _ftdm_channel_set_state_force(ftdm_channel_t *chan, const ftdm_channel_state_t state) { assert(chan); chan->state = state; } -static const char *ftdm_span_get_trunk_type_str(const ftdm_span_t *span) -{ - return ftdm_trunk_type2str(span->trunk_type); -} - /** * \brief Unloads libpri IO module * \return Success diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 64ecc2e357..31bc88b9ca 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -1240,6 +1240,9 @@ FT_DECLARE(void) ftdm_span_set_trunk_type(ftdm_span_t *span, ftdm_trunk_type_t t */ FT_DECLARE(ftdm_trunk_type_t) ftdm_span_get_trunk_type(const ftdm_span_t *span); +/*! \brief For display debugging purposes you can display this string which describes the trunk type of a span */ +FT_DECLARE(const char *) ftdm_span_get_trunk_type_str(const ftdm_span_t *span); + /*! * \brief Return the channel identified by the provided id * @@ -1259,6 +1262,12 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_set_caller_data(ftdm_channel_t *ftdmchan, /*! \brief Get the caller data for a channel, typically you need this when receiving FTDM_SIGEVENT_START */ FT_DECLARE(ftdm_caller_data_t *) ftdm_channel_get_caller_data(ftdm_channel_t *channel); +/*! \brief Get current state of a channel */ +FT_DECLARE(int) ftdm_channel_get_state(const ftdm_channel_t *ftdmchan); + +/*! \brief Get last state of a channel */ +FT_DECLARE(int) ftdm_channel_get_last_state(const ftdm_channel_t *ftdmchan); + /*! \brief For display debugging purposes you can display this string which describes the current channel internal state */ FT_DECLARE(const char *) ftdm_channel_get_state_str(const ftdm_channel_t *channel); From 96b0ef9ce9ac14fadace32dd3a087d37b34c1c05 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Sun, 14 Nov 2010 17:48:53 +0100 Subject: [PATCH 35/45] ftmod_libpri: Use ftdm_array_len(), remove custom ARRAY_SIZE macro. Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index fdfdf79a93..b423c51776 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -34,10 +34,6 @@ #include "private/ftdm_core.h" #include "ftmod_libpri.h" -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(x) (sizeof((x)) / sizeof((x)[0])) -#endif - static void _ftdm_channel_set_state_force(ftdm_channel_t *chan, const ftdm_channel_state_t state) { assert(chan); @@ -198,7 +194,7 @@ static int parse_debug(const char *in, uint32_t *flags) return 0; } - for (i = 0; i < ARRAY_SIZE(ftdm_libpri_debug); i++) { + for (i = 0; i < ftdm_array_len(ftdm_libpri_debug); i++) { if (strstr(in, ftdm_libpri_debug[i].name)) { *flags |= ftdm_libpri_debug[i].flags; res = 0; @@ -222,7 +218,7 @@ static int print_debug(uint32_t flags, char *tmp, const int size) return 0; } - for (i = 0; i < ARRAY_SIZE(ftdm_libpri_debug); i++) { + for (i = 0; i < ftdm_array_len(ftdm_libpri_debug); i++) { if ((flags & ftdm_libpri_debug[i].flags) == ftdm_libpri_debug[i].flags) { res = snprintf(&tmp[offset], size - offset, "%s,", ftdm_libpri_debug[i].name); if (res <= 0 || res == (size - offset)) From 0286af421bb0ff4f391f56938ebbb25e99e84b46 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Sun, 14 Nov 2010 18:04:19 +0100 Subject: [PATCH 36/45] freeswitch: Update .gitignore file (libcodec2, esl binaries, mod_hash + mod_osp autogenerated files) Signed-off-by: Stefan Knoblich --- .gitignore | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 824abfc65f..adcfda37f4 100644 --- a/.gitignore +++ b/.gitignore @@ -108,5 +108,26 @@ libs/freetdm/testpri libs/freetdm/testr2 libs/freetdm/testsangomaboost libs/freetdm/testtones +libs/esl/fs_cli +libs/esl/ivrd +libs/esl/testserver +libs/esl/testclient +libs/libcodec2/Makefile +libs/libcodec2/Makefile.in +libs/libcodec2/config.guess +libs/libcodec2/config.sub +libs/libcodec2/configure +libs/libcodec2/depcomp +libs/libcodec2/install-sh +libs/libcodec2/libtool +libs/libcodec2/ltmain.sh +libs/libcodec2/missing +libs/libcodec2/src/Makefile +libs/libcodec2/src/Makefile.in +libs/libcodec2/unittest/Makefile +libs/libcodec2/unittest/Makefile.in src/mod/applications/mod_osp/Makefile - +src/mod/applications/mod_osp/Makefile.in +src/mod/applications/mod_hash/Makefile +src/mod/applications/mod_hash/Makefile.in +src/mod/applications/mod_hash/mod_hash.log From c1517e99d196754bd4089bfc4cdd344c126530e9 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Sun, 14 Nov 2010 23:38:16 +0100 Subject: [PATCH 37/45] ftmod_zt: B-Channels need to have audio mode disabled upon closing the channel. Preparation for fixing channel handling for BRI PTMP (Point-To-MultiPoint) setups. Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c index 692b505716..ddf7b3ffab 100644 --- a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c +++ b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c @@ -658,6 +658,14 @@ static FIO_OPEN_FUNCTION(zt_open) */ static FIO_CLOSE_FUNCTION(zt_close) { + if (ftdmchan->type == FTDM_CHAN_TYPE_B) { + int value = 0; /* disable audio mode */ + if (ioctl(ftdmchan->sockfd, codes.AUDIOMODE, &value)) { + snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "%s", strerror(errno)); + ftdm_log(FTDM_LOG_ERROR, "%s\n", ftdmchan->last_error); + return FTDM_FAIL; + } + } return FTDM_SUCCESS; } From e98b4a6b8dccbd22e2bcccb04ae992633f7fee3c Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Mon, 15 Nov 2010 11:38:45 +0100 Subject: [PATCH 38/45] ftmod_libpri: Set RDNIS Signed-off-by: lakshmanan ganapathy Reviewed-by: Stefan Knoblich --- libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index b423c51776..2d6623586a 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -888,6 +888,7 @@ static int on_ring(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event ftdm_set_string(caller_data->cid_num.digits, (char *)pevent->ring.callingnum); ftdm_set_string(caller_data->ani.digits, (char *)pevent->ring.callingani); ftdm_set_string(caller_data->dnis.digits, (char *)pevent->ring.callednum); + ftdm_set_string(caller_data->rdnis.digits, (char *)pevent->ring.redirectingnum); if (!ftdm_strlen_zero((char *)pevent->ring.callingname)) { ftdm_set_string(caller_data->cid_name, (char *)pevent->ring.callingname); From ced7c9ae43af218f2e02bf44032916498f7b90ab Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Mon, 15 Nov 2010 12:33:58 +0100 Subject: [PATCH 39/45] freetdm: Another round of parameter handling fixes (ftmod_{libpri,isdn,pritap}) ftmod_pritap: Abort before overflowing spanparameters array and initialize to all zero ftmod_isdn: Fix overflow check, skip over parameters without name or value, initialize spanparameters array to all zero. ftmod_libpri: Skip over parameters without name or value, initialize spanparameters array to all zero and drop "i < 10" hardcoded check. This should fix: 2010-11-15 09:24:34.609515 [ERR] ftmod_libpri.c:1741 Unknown parameter '', aborting configuration 2010-11-15 09:24:34.609515 [ERR] mod_freetdm.c:3080 Error configuring FreeTDM span BRI_1 Signed-off-by: Stefan Knoblich Reported-by: Ingmar Schraub --- libs/freetdm/mod_freetdm/mod_freetdm.c | 29 ++++++++++++++++--- .../freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c | 7 ++++- .../src/ftmod/ftmod_libpri/ftmod_libpri.c | 9 ++++-- 3 files changed, 38 insertions(+), 7 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index aaddbf69f0..a410e4eac6 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -2937,15 +2937,22 @@ static switch_status_t load_config(void) continue; } - for (param = switch_xml_child(myspan, "param"); param && paramindex < 10; param = param->next) { + memset(spanparameters, 0, sizeof(spanparameters)); + + for (param = switch_xml_child(myspan, "param"); param; param = param->next) { char *var = (char *) switch_xml_attr_soft(param, "name"); char *val = (char *) switch_xml_attr_soft(param, "value"); - if (ftdm_array_len(spanparameters) == paramindex) { + if (ftdm_array_len(spanparameters) - 1 == paramindex) { ftdm_log(FTDM_LOG_ERROR, "Too many parameters for pri span '%s', ignoring everything after '%s'\n", name, var); break; } + if (ftdm_strlen_zero(var) || ftdm_strlen_zero(val)) { + ftdm_log(FTDM_LOG_WARNING, "Skipping parameter with empty name or value\n"); + continue; + } + if (!strcasecmp(var, "context")) { context = val; } else if (!strcasecmp(var, "dialplan")) { @@ -2995,11 +3002,18 @@ static switch_status_t load_config(void) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "span missing required attribute 'name'\n"); continue; } - + + memset(spanparameters, 0, sizeof(spanparameters)); + for (param = switch_xml_child(myspan, "param"); param; param = param->next) { char *var = (char *) switch_xml_attr_soft(param, "name"); char *val = (char *) switch_xml_attr_soft(param, "value"); + if (ftdm_array_len(spanparameters) - 1 == paramindex) { + ftdm_log(FTDM_LOG_ERROR, "Too many parameters for pritap span '%s', ignoring everything after '%s'\n", name, var); + break; + } + if (!strcasecmp(var, "context")) { context = val; } else if (!strcasecmp(var, "dialplan")) { @@ -3049,7 +3063,9 @@ static switch_status_t load_config(void) continue; } - for (param = switch_xml_child(myspan, "param"); param && paramindex < 10; param = param->next) { + memset(spanparameters, 0, sizeof(spanparameters)); + + for (param = switch_xml_child(myspan, "param"); param; param = param->next) { char *var = (char *) switch_xml_attr_soft(param, "name"); char *val = (char *) switch_xml_attr_soft(param, "value"); @@ -3058,6 +3074,11 @@ static switch_status_t load_config(void) break; } + if (ftdm_strlen_zero(var) || ftdm_strlen_zero(val)) { + ftdm_log(FTDM_LOG_WARNING, "Skipping parameter with empty name or value\n"); + continue; + } + if (!strcasecmp(var, "context")) { context = val; } else if (!strcasecmp(var, "dialplan")) { diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c index 1f90d486f3..491ef886fa 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -2667,7 +2667,12 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(isdn_configure_span) const char *var = ftdm_parameters[i].var; const char *val = ftdm_parameters[i].val; - if (!val) { + if (ftdm_strlen_zero(var)) { + ftdm_log(FTDM_LOG_WARNING, "Skipping variable with no name\n"); + continue; + } + + if (ftdm_strlen_zero(val)) { ftdm_log(FTDM_LOG_ERROR, "Variable '%s' has no value\n", var); return FTDM_FAIL; } diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 2d6623586a..21d6674717 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -1704,11 +1704,16 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) return FTDM_FAIL; } - for (i = 0; i < 10 && ftdm_parameters[i].var; i++) { + for (i = 0; ftdm_parameters[i].var; i++) { const char *var = ftdm_parameters[i].var; const char *val = ftdm_parameters[i].val; - if (!val) { + if (ftdm_strlen_zero(var)) { + ftdm_log(FTDM_LOG_WARNING, "Skipping parameter with no name\n"); + continue; + } + + if (ftdm_strlen_zero(val)) { ftdm_log(FTDM_LOG_ERROR, "Parameter '%s' has no value\n", var); snprintf(span->last_error, sizeof(span->last_error), "Parameter [%s] has no value", var); return FTDM_FAIL; From a09bce346eec10bd282385100dc1ec9733ba3c2e Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Mon, 15 Nov 2010 11:46:47 -0500 Subject: [PATCH 40/45] Fix for compilation errors due to some functions defined as extern --- .../ftmod_sangoma_isdn/ftmod_sangoma_isdn.c | 3 --- .../ftmod_sangoma_isdn/ftmod_sangoma_isdn.h | 19 ++++++++++++++ .../ftmod_sangoma_isdn_stack_hndl.c | 5 ---- .../ftmod_sangoma_isdn_stack_out.c | 4 --- .../ftmod_sangoma_isdn_stack_rcv.c | 4 --- .../ftmod_sangoma_isdn_support.c | 26 ++++++------------- 6 files changed, 27 insertions(+), 34 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 22c89cb920..a7656267f2 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -56,9 +56,6 @@ static sng_isdn_event_interface_t g_sngisdn_event_interface; ftdm_sngisdn_data_t g_sngisdn_data; -extern ftdm_status_t sng_isdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trace_opt); -extern ftdm_status_t sngisdn_check_free_ids(void); - ftdm_state_map_t sangoma_isdn_state_map = { { { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 953bfee85a..336ffe9538 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -273,10 +273,21 @@ FT_DECLARE(void) clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info); void stack_hdr_init(Header *hdr); void stack_pst_init(Pst *pst); + FT_DECLARE(ftdm_status_t) get_ftdmchan_by_spInstId(int16_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data); FT_DECLARE(ftdm_status_t) get_ftdmchan_by_suInstId(int16_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data); FT_DECLARE(ftdm_status_t) sng_isdn_set_avail_rate(ftdm_span_t *ftdmspan, sngisdn_avail_t avail); +FT_DECLARE(ftdm_status_t) cpy_calling_num_from_stack(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb); +FT_DECLARE(ftdm_status_t) cpy_called_num_from_stack(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb); +FT_DECLARE(ftdm_status_t) cpy_redir_num_from_stack(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb); +FT_DECLARE(ftdm_status_t) cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *display); + +FT_DECLARE(ftdm_status_t) cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm); +FT_DECLARE(ftdm_status_t) cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm); +FT_DECLARE(ftdm_status_t) cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm); +FT_DECLARE(ftdm_status_t) cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan); + /* Outbound Call Control functions */ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan); void sngisdn_snd_setup_ack(ftdm_channel_t *ftdmchan); @@ -331,6 +342,14 @@ void sngisdn_process_rst_ind (sngisdn_event_data_t *sngisdn_event); void sngisdn_rcv_phy_ind(SuId suId, Reason reason); void sngisdn_rcv_q921_ind(BdMngmt *status); + +void sngisdn_trace_q921(char* str, uint8_t* data, uint32_t data_len); +void sngisdn_trace_q931(char* str, uint8_t* data, uint32_t data_len); +void get_memory_info(void); + +ftdm_status_t sng_isdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trace_opt); +ftdm_status_t sngisdn_check_free_ids(void); + void sngisdn_rcv_q921_trace(BdMngmt *trc, Buffer *mBuf); void sngisdn_rcv_q931_ind(InMngmt *status); void sngisdn_rcv_q931_trace(InMngmt *trc, Buffer *mBuf); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 83a8faa465..8408c673ef 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -34,11 +34,6 @@ #include "ftmod_sangoma_isdn.h" -extern ftdm_status_t cpy_calling_num_from_stack(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb); -extern ftdm_status_t cpy_called_num_from_stack(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb); -extern ftdm_status_t cpy_redir_num_from_stack(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb); -extern ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *display); - /* Remote side transmit a SETUP */ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 8367687aec..124cd965b4 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -34,10 +34,6 @@ #include "ftmod_sangoma_isdn.h" -extern ftdm_status_t cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm); -extern ftdm_status_t cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm); -extern ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan); - void sngisdn_snd_setup(ftdm_channel_t *ftdmchan); void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan); void sngisdn_snd_progress(ftdm_channel_t *ftdmchan); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c index 5580f3a950..7c375f7c64 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c @@ -34,10 +34,6 @@ #include "ftmod_sangoma_isdn.h" -extern void sngisdn_trace_q921(char* str, uint8_t* data, uint32_t data_len); -extern void sngisdn_trace_q931(char* str, uint8_t* data, uint32_t data_len); -extern void get_memory_info(void); - #define MAX_DECODE_STR_LEN 2000 diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index aa34279813..e8e27687b4 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -34,16 +34,6 @@ #include "ftmod_sangoma_isdn.h" -ftdm_status_t cpy_calling_num_from_stack(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb); -ftdm_status_t cpy_called_num_from_stack(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb); -ftdm_status_t cpy_redir_num_from_stack(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb); -ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *display); - -ftdm_status_t cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm); -ftdm_status_t cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm); -ftdm_status_t cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm); -ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan); - ftdm_status_t sngisdn_check_free_ids(void); extern ftdm_sngisdn_data_t g_sngisdn_data; @@ -157,7 +147,7 @@ ftdm_status_t sng_isdn_set_avail_rate(ftdm_span_t *span, sngisdn_avail_t avail) return FTDM_SUCCESS; } -ftdm_status_t cpy_calling_num_from_stack(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb) +FT_DECLARE(ftdm_status_t) cpy_calling_num_from_stack(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb) { if (cgPtyNmb->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; @@ -184,7 +174,7 @@ ftdm_status_t cpy_calling_num_from_stack(ftdm_caller_data_t *ftdm, CgPtyNmb *cgP return FTDM_SUCCESS; } -ftdm_status_t cpy_called_num_from_stack(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb) +FT_DECLARE(ftdm_status_t) cpy_called_num_from_stack(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb) { if (cdPtyNmb->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; @@ -206,7 +196,7 @@ ftdm_status_t cpy_called_num_from_stack(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPt return FTDM_SUCCESS; } -ftdm_status_t cpy_redir_num_from_stack(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb) +FT_DECLARE(ftdm_status_t) cpy_redir_num_from_stack(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb) { if (redirNmb->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; @@ -226,7 +216,7 @@ ftdm_status_t cpy_redir_num_from_stack(ftdm_caller_data_t *ftdm, RedirNmb *redir return FTDM_SUCCESS; } -ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *display) +FT_DECLARE(ftdm_status_t) cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *display) { if (display->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; @@ -239,7 +229,7 @@ ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *dis return FTDM_SUCCESS; } -ftdm_status_t cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm) +FT_DECLARE(ftdm_status_t) cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm) { uint8_t len = strlen(ftdm->cid_num.digits); if (!len) { @@ -267,7 +257,7 @@ ftdm_status_t cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t * return FTDM_SUCCESS; } -ftdm_status_t cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm) +FT_DECLARE(ftdm_status_t) cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm) { uint8_t len = strlen(ftdm->dnis.digits); if (!len) { @@ -297,7 +287,7 @@ ftdm_status_t cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *f return FTDM_SUCCESS; } -ftdm_status_t cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm) +FT_DECLARE(ftdm_status_t) cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm) { uint8_t len = strlen(ftdm->rdnis.digits); if (!len) { @@ -329,7 +319,7 @@ ftdm_status_t cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ft } -ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan) +FT_DECLARE(ftdm_status_t) cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan) { uint8_t len; ftdm_caller_data_t *ftdm = &ftdmchan->caller_data; From 0eb33e57617079f0d3d9a8891f99439d45ffd29a Mon Sep 17 00:00:00 2001 From: Brian West Date: Mon, 15 Nov 2010 11:12:50 -0600 Subject: [PATCH 41/45] FS-2844: Patch debian init.d script to set ulimit values --- debian/freeswitch.init | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/debian/freeswitch.init b/debian/freeswitch.init index 1eb71ac6d6..ddde2f5518 100755 --- a/debian/freeswitch.init +++ b/debian/freeswitch.init @@ -48,6 +48,24 @@ fi # Depend on lsb-base (>= 3.0-6) to ensure that this file is present. . /lib/lsb/init-functions +# +# Function that sets ulimit values for the daemon +# +do_setlimits() { + ulimit -c unlimited + ulimit -d unlimited + ulimit -f unlimited + ulimit -i unlimited + ulimit -n 999999 + ulimit -q unlimited + ulimit -u unlimited + ulimit -v unlimited + ulimit -x unlimited + ulimit -s 240 + ulimit -l unlimited + return 0 +} + # # Function that starts the daemon/service # @@ -59,6 +77,7 @@ do_start() # 2 if daemon could not be started start-stop-daemon -d $WORKDIR -c $USER --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ || return 1 + do_setlimits start-stop-daemon -d $WORKDIR -c $USER --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ $FREESWITCH_PARAMS \ || return 2 From 04e57577b3561e2fa76f86ff4053fad6b0f9c6b7 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 15 Nov 2010 11:22:25 -0600 Subject: [PATCH 42/45] FS-2801 --- src/mod/endpoints/mod_sofia/sofia.c | 19 +++++++++---------- src/switch_ivr.c | 28 +++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index e5672061bd..5bb2ff0d66 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -4671,9 +4671,8 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, if (!switch_channel_get_variable(other_channel, SWITCH_B_SDP_VARIABLE)) { switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, r_sdp); } - switch_mutex_unlock(tech_pvt->sofia_mutex); - switch_channel_pre_answer(other_channel); - switch_mutex_lock(tech_pvt->sofia_mutex); + //switch_channel_pre_answer(other_channel); + switch_core_session_queue_indication(other_session, SWITCH_MESSAGE_INDICATE_PROGRESS); switch_core_session_rwunlock(other_session); } goto done; @@ -5100,10 +5099,9 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) { if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) { - other_channel = switch_core_session_get_channel(other_session); - switch_mutex_unlock(tech_pvt->sofia_mutex); - switch_channel_answer(other_channel); - switch_mutex_lock(tech_pvt->sofia_mutex); + //other_channel = switch_core_session_get_channel(other_session); + //switch_channel_answer(other_channel); + switch_core_session_queue_indication(other_session, SWITCH_MESSAGE_INDICATE_ANSWER); switch_core_session_rwunlock(other_session); } } @@ -5132,9 +5130,10 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, if (!switch_channel_get_variable(other_channel, SWITCH_B_SDP_VARIABLE)) { switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, r_sdp); } - switch_mutex_unlock(tech_pvt->sofia_mutex); - switch_channel_answer(other_channel); - switch_mutex_lock(tech_pvt->sofia_mutex); + + //switch_channel_answer(other_channel); + switch_core_session_queue_indication(other_session, SWITCH_MESSAGE_INDICATE_ANSWER); + switch_core_session_rwunlock(other_session); } goto done; diff --git a/src/switch_ivr.c b/src/switch_ivr.c index b5c56320b6..e599839e16 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -658,12 +658,38 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_next_event(switch_core_session_ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_all_messages(switch_core_session_t *session) { switch_core_session_message_t *message; + switch_channel_t *channel = switch_core_session_get_channel(session); int i = 0; while (switch_core_session_dequeue_message(session, &message) == SWITCH_STATUS_SUCCESS) { i++; - switch_core_session_receive_message(session, message); + + switch(message->message_id) { + case SWITCH_MESSAGE_INDICATE_ANSWER: + if (switch_channel_answer(channel) != SWITCH_STATUS_SUCCESS) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + } + switch_core_session_free_message(&message); + break; + case SWITCH_MESSAGE_INDICATE_PROGRESS: + if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + } + switch_core_session_free_message(&message); + break; + case SWITCH_MESSAGE_INDICATE_RINGING: + if (switch_channel_ring_ready(channel) != SWITCH_STATUS_SUCCESS) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + } + switch_core_session_free_message(&message); + break; + default: + switch_core_session_receive_message(session, message); + break; + } + message = NULL; + } return i ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; From 6941c6eb71cdb38fbcacae03c00a65d0b0c6724f Mon Sep 17 00:00:00 2001 From: Andrew Thompson Date: Mon, 15 Nov 2010 12:39:54 -0500 Subject: [PATCH 43/45] FS-2775 Rewrite XML fetch conditional wait to be more sane (Reported by James Aimonetti) --- .../mod_erlang_event/handle_msg.c | 104 +++++++++--------- .../mod_erlang_event/mod_erlang_event.c | 64 +++++------ .../mod_erlang_event/mod_erlang_event.h | 2 +- 3 files changed, 84 insertions(+), 86 deletions(-) diff --git a/src/mod/event_handlers/mod_erlang_event/handle_msg.c b/src/mod/event_handlers/mod_erlang_event/handle_msg.c index 1a8b64fdb4..bb37cddc59 100644 --- a/src/mod/event_handlers/mod_erlang_event/handle_msg.c +++ b/src/mod/event_handlers/mod_erlang_event/handle_msg.c @@ -173,68 +173,74 @@ static switch_status_t handle_msg_fetch_reply(listener_t *listener, ei_x_buff * ei_x_encode_atom(rbuf, "error"); ei_x_encode_atom(rbuf, "badarg"); } else { - ei_x_buff *nbuf = malloc(sizeof(nbuf)); - nbuf->buff = malloc(buf->buffsz); - memcpy(nbuf->buff, buf->buff, buf->buffsz); - nbuf->index = buf->index; - nbuf->buffsz = buf->buffsz; + /* TODO - maybe use a rwlock instead */ + if ((p = switch_core_hash_find_locked(globals.fetch_reply_hash, uuid_str, globals.fetch_reply_mutex))) { + /* try to lock the mutex, so no other responder can */ + if (switch_mutex_trylock(p->mutex) == SWITCH_STATUS_SUCCESS) { + if (p->state == reply_waiting) { + /* alright, we've got the lock and we're the first to reply */ - switch_mutex_lock(globals.fetch_reply_mutex); - if ((p = switch_core_hash_find(globals.fetch_reply_hash, uuid_str))) { - /* Get the status and release the lock ASAP. */ - enum { is_timeout, is_waiting, is_filled } status; - if (p->state == reply_not_ready) { - switch_thread_cond_wait(p->ready_or_found, globals.fetch_reply_mutex); - } + /* clone the reply so it doesn't get destroyed on us */ + ei_x_buff *nbuf = malloc(sizeof(nbuf)); + nbuf->buff = malloc(buf->buffsz); + memcpy(nbuf->buff, buf->buff, buf->buffsz); + nbuf->index = buf->index; + nbuf->buffsz = buf->buffsz; - if (p->state == reply_waiting) { - /* update the key with a reply */ - status = is_waiting; - p->reply = nbuf; - p->state = reply_found; - strncpy(p->winner, listener->peer_nodename, MAXNODELEN); - switch_thread_cond_broadcast(p->ready_or_found); - } else if (p->state == reply_timeout) { - status = is_timeout; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Got reply for %s\n", uuid_str); + + /* copy info into the reply struct */ + p->state = reply_found; + p->reply = nbuf; + strncpy(p->winner, listener->peer_nodename, MAXNODELEN); + + /* signal waiting thread that its time to wake up */ + switch_thread_cond_signal(p->ready_or_found); + + /* reply OK */ + ei_x_encode_tuple_header(rbuf, 2); + ei_x_encode_atom(rbuf, "ok"); + _ei_x_encode_string(rbuf, uuid_str); + + /* unlock */ + switch_mutex_unlock(p->mutex); + } else { + if (p->state == reply_found) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Reply for already complete request %s\n", uuid_str); + ei_x_encode_tuple_header(rbuf, 3); + ei_x_encode_atom(rbuf, "error"); + _ei_x_encode_string(rbuf, uuid_str); + ei_x_encode_atom(rbuf, "duplicate_response"); + } else if (p->state == reply_timeout) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Reply for timed out request %s\n", uuid_str); + ei_x_encode_tuple_header(rbuf, 3); + ei_x_encode_atom(rbuf, "error"); + _ei_x_encode_string(rbuf, uuid_str); + ei_x_encode_atom(rbuf, "timeout"); + } else if (p->state == reply_not_ready) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Request %s is not ready?!\n", uuid_str); + ei_x_encode_tuple_header(rbuf, 3); + ei_x_encode_atom(rbuf, "error"); + _ei_x_encode_string(rbuf, uuid_str); + ei_x_encode_atom(rbuf, "not_ready"); + } + switch_mutex_unlock(p->mutex); + } } else { - status = is_filled; - } - - put_reply_unlock(p, uuid_str); - - /* Relay the status back to the fetch responder. */ - if (status == is_waiting) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found waiting slot for %s\n", uuid_str); - ei_x_encode_tuple_header(rbuf, 2); - ei_x_encode_atom(rbuf, "ok"); - _ei_x_encode_string(rbuf, uuid_str); - /* Return here to avoid freeing the reply. */ - return SWITCH_STATUS_SUCCESS; - } else if (status == is_timeout) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Handler for %s timed out\n", uuid_str); - ei_x_encode_tuple_header(rbuf, 3); - ei_x_encode_atom(rbuf, "error"); - _ei_x_encode_string(rbuf, uuid_str); - ei_x_encode_atom(rbuf, "timeout"); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found filled slot for %s\n", uuid_str); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Could not lock mutex for reply %s\n", uuid_str); ei_x_encode_tuple_header(rbuf, 3); ei_x_encode_atom(rbuf, "error"); _ei_x_encode_string(rbuf, uuid_str); ei_x_encode_atom(rbuf, "duplicate_response"); } } else { - /* nothing in the hash */ - switch_mutex_unlock(globals.fetch_reply_mutex); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Empty slot for %s\n", uuid_str); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Could not find request for reply %s\n", uuid_str); ei_x_encode_tuple_header(rbuf, 2); ei_x_encode_atom(rbuf, "error"); ei_x_encode_atom(rbuf, "invalid_uuid"); } - - switch_safe_free(nbuf->buff); - switch_safe_free(nbuf); } + return SWITCH_STATUS_SUCCESS; } @@ -1052,7 +1058,7 @@ static switch_status_t handle_ref_tuple(listener_t *listener, erlang_msg * msg, if (se->spawn_reply->state == reply_waiting) { se->spawn_reply->pid = pid; - switch_thread_cond_broadcast(se->spawn_reply->ready_or_found); + switch_thread_cond_signal(se->spawn_reply->ready_or_found); ei_x_encode_atom(rbuf, "ok"); switch_thread_rwlock_unlock(listener->session_rwlock); switch_mutex_unlock(se->spawn_reply->mutex); diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index 8565e1afa7..e375515f4f 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -366,13 +366,21 @@ static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, c ei_x_buff buf; ei_x_new_with_version(&buf); + switch_uuid_get(&uuid); + switch_uuid_format(uuid_str, &uuid); + + ei_x_encode_tuple_header(&buf, 7); + ei_x_encode_atom(&buf, "fetch"); + ei_x_encode_atom(&buf, sectionstr); + _ei_x_encode_string(&buf, tag_name ? tag_name : "undefined"); + _ei_x_encode_string(&buf, key_name ? key_name : "undefined"); + _ei_x_encode_string(&buf, key_value ? key_value : "undefined"); + _ei_x_encode_string(&buf, uuid_str); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "looking for bindings\n"); section = switch_xml_parse_section_string((char *) sectionstr); - switch_uuid_get(&uuid); - switch_uuid_format(uuid_str, &uuid); - for (ptr = bindings.head; ptr; ptr = ptr->next) { if (ptr->section != section) continue; @@ -384,13 +392,6 @@ static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, c switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "binding for %s in section %s with key %s and value %s requested from node %s\n", tag_name, sectionstr, key_name, key_value, ptr->process.pid.node); - ei_x_encode_tuple_header(&buf, 7); - ei_x_encode_atom(&buf, "fetch"); - ei_x_encode_atom(&buf, sectionstr); - _ei_x_encode_string(&buf, tag_name ? tag_name : "undefined"); - _ei_x_encode_string(&buf, key_name ? key_name : "undefined"); - _ei_x_encode_string(&buf, key_value ? key_value : "undefined"); - _ei_x_encode_string(&buf, uuid_str); if (params) { ei_encode_switch_event_headers(&buf, params); } else { @@ -401,41 +402,42 @@ static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, c /* Create a new fetch object. */ p = malloc(sizeof(*p)); switch_thread_cond_create(&p->ready_or_found, module_pool); - p->usecount = 1; + switch_mutex_init(&p->mutex, SWITCH_MUTEX_UNNESTED, module_pool); p->state = reply_not_ready; p->reply = NULL; switch_core_hash_insert_locked(globals.fetch_reply_hash, uuid_str, p, globals.fetch_reply_mutex); + p->state = reply_waiting; now = switch_micro_time_now(); } /* We don't need to lock here because everybody is waiting on our condition before the action starts. */ - p->usecount ++; switch_mutex_lock(ptr->listener->sock_mutex); ei_sendto(ptr->listener->ec, ptr->listener->sockfd, &ptr->process, &buf); switch_mutex_unlock(ptr->listener->sock_mutex); } + ei_x_free(&buf); + if (!p) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "no binding for %s\n", sectionstr); goto cleanup; } /* Tell the threads to be ready, and wait five seconds for a reply. */ - switch_mutex_lock(globals.fetch_reply_mutex); - p->state = reply_waiting; - switch_thread_cond_broadcast(p->ready_or_found); + switch_mutex_lock(p->mutex); + //p->state = reply_waiting; switch_thread_cond_timedwait(p->ready_or_found, - globals.fetch_reply_mutex, 5000000); + p->mutex, 5000000); if (!p->reply) { p->state = reply_timeout; - switch_mutex_unlock(globals.fetch_reply_mutex); + switch_mutex_unlock(p->mutex); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Timed out after %d milliseconds when waiting for XML fetch response for %s\n", (int) (switch_micro_time_now() - now) / 1000, uuid_str); goto cleanup; } rep = p->reply; - switch_mutex_unlock(globals.fetch_reply_mutex); + switch_mutex_unlock(p->mutex); ei_get_type(rep->buff, &rep->index, &type, &size); @@ -450,7 +452,6 @@ static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, c goto cleanup; } - if (!(xmlstr = malloc(size + 1))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error\n"); goto cleanup; @@ -471,29 +472,20 @@ static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, c /* cleanup */ cleanup: if (p) { - switch_mutex_lock(globals.fetch_reply_mutex); - put_reply_unlock(p, uuid_str); + /* lock so nothing can have it while we delete it */ + switch_mutex_lock(p->mutex); + switch_core_hash_delete_locked(globals.fetch_reply_hash, uuid_str, globals.fetch_reply_mutex); + switch_mutex_unlock(p->mutex); + switch_mutex_destroy(p->mutex); + switch_thread_cond_destroy(p->ready_or_found); + switch_safe_free(p->reply); + switch_safe_free(p); } return xml; } -void put_reply_unlock(fetch_reply_t *p, char *uuid_str) -{ - if (-- p->usecount == 0) { - switch_core_hash_delete(globals.fetch_reply_hash, uuid_str); - switch_thread_cond_destroy(p->ready_or_found); - if (p->reply) { - switch_safe_free(p->reply->buff); - switch_safe_free(p->reply); - } - switch_safe_free(p); - } - switch_mutex_unlock(globals.fetch_reply_mutex); -} - - static switch_status_t notify_new_session(listener_t *listener, session_elem_t *session_element) { int result; diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h index 248e66b056..eb36612ce6 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h @@ -60,7 +60,7 @@ enum reply_state { reply_not_ready, reply_waiting, reply_found, reply_timeout }; struct fetch_reply_struct { switch_thread_cond_t *ready_or_found; - int usecount; + switch_mutex_t *mutex; enum reply_state state; ei_x_buff *reply; char winner[MAXNODELEN + 1]; From db91f0e81ff9cd6705f51dd58582d393aeeae267 Mon Sep 17 00:00:00 2001 From: Brian West Date: Mon, 15 Nov 2010 11:37:07 -0600 Subject: [PATCH 44/45] FS-2842: ACL for IPv6 address and swigall to boot --- src/include/switch_utils.h | 10 +- .../languages/mod_managed/freeswitch_wrap.cxx | 135 +++++++++++++++- src/mod/languages/mod_managed/managed/swig.cs | 144 +++++++++++++++++- src/mod/languages/mod_perl/mod_perl_wrap.cpp | 6 +- src/switch_core.c | 31 +++- src/switch_utils.c | 124 ++++++++++++--- 6 files changed, 407 insertions(+), 43 deletions(-) diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 3a4f8b253b..e2a7335226 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -54,6 +54,13 @@ SWITCH_DECLARE(int) switch_isspace(int c); SWITCH_DECLARE(int) switch_isupper(int c); SWITCH_DECLARE(int) switch_isxdigit(int c); +typedef union{ + uint32_t v4; + struct in6_addr v6; +} ip_t; + +SWITCH_DECLARE(switch_bool_t) switch_testv6_subnet(ip_t _ip, ip_t _net, ip_t _mask); + #define switch_goto_status(_status, _label) status = _status; goto _label #define switch_goto_int(_n, _i, _label) _n = _i; goto _label #define switch_samples_per_packet(rate, interval) ((uint32_t)((float)rate / (1000.0f / (float)interval))) @@ -694,7 +701,7 @@ SWITCH_DECLARE(char *) switch_find_end_paren(const char *s, char open, char clos -SWITCH_DECLARE(int) switch_parse_cidr(const char *string, uint32_t *ip, uint32_t *mask, uint32_t *bitp); +SWITCH_DECLARE(int) switch_parse_cidr(const char *string, ip_t *ip, ip_t *mask, uint32_t *bitp); SWITCH_DECLARE(switch_status_t) switch_network_list_create(switch_network_list_t **list, const char *name, switch_bool_t default_type, switch_memory_pool_t *pool); SWITCH_DECLARE(switch_status_t) switch_network_list_add_cidr_token(switch_network_list_t *list, const char *cidr_str, switch_bool_t ok, const char *token); @@ -703,6 +710,7 @@ SWITCH_DECLARE(switch_status_t) switch_network_list_add_cidr_token(switch_networ SWITCH_DECLARE(switch_status_t) switch_network_list_add_host_mask(switch_network_list_t *list, const char *host, const char *mask_str, switch_bool_t ok); SWITCH_DECLARE(switch_bool_t) switch_network_list_validate_ip_token(switch_network_list_t *list, uint32_t ip, const char **token); +SWITCH_DECLARE(switch_bool_t) switch_network_list_validate_ip6_token(switch_network_list_t *list, ip_t ip, const char **token); #define switch_network_list_validate_ip(_list, _ip) switch_network_list_validate_ip_token(_list, _ip, NULL); #define switch_test_subnet(_ip, _net, _mask) (_mask ? ((_net & _mask) == (_ip & _mask)) : _net ? _net == _ip : 1) diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index 13136d99e8..ca001f64b1 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -11949,6 +11949,111 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_isxdigit(int jarg1) { } +SWIGEXPORT void SWIGSTDCALL CSharp_ip_t_v4_set(void * jarg1, unsigned long jarg2) { + ip_t *arg1 = (ip_t *) 0 ; + uint32_t arg2 ; + + arg1 = (ip_t *)jarg1; + arg2 = (uint32_t)jarg2; + if (arg1) (arg1)->v4 = arg2; + +} + + +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_ip_t_v4_get(void * jarg1) { + unsigned long jresult ; + ip_t *arg1 = (ip_t *) 0 ; + uint32_t result; + + arg1 = (ip_t *)jarg1; + result = (uint32_t) ((arg1)->v4); + jresult = (unsigned long)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_ip_t_v6_set(void * jarg1, void * jarg2) { + ip_t *arg1 = (ip_t *) 0 ; + in6_addr arg2 ; + in6_addr *argp2 ; + + arg1 = (ip_t *)jarg1; + argp2 = (in6_addr *)jarg2; + if (!argp2) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null in6_addr", 0); + return ; + } + arg2 = *argp2; + if (arg1) (arg1)->v6 = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_ip_t_v6_get(void * jarg1) { + void * jresult ; + ip_t *arg1 = (ip_t *) 0 ; + in6_addr result; + + arg1 = (ip_t *)jarg1; + result = ((arg1)->v6); + jresult = new in6_addr((in6_addr &)result); + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_new_ip_t() { + void * jresult ; + ip_t *result = 0 ; + + result = (ip_t *)new ip_t(); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_delete_ip_t(void * jarg1) { + ip_t *arg1 = (ip_t *) 0 ; + + arg1 = (ip_t *)jarg1; + delete arg1; + +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_testv6_subnet(void * jarg1, void * jarg2, void * jarg3) { + int jresult ; + ip_t arg1 ; + ip_t arg2 ; + ip_t arg3 ; + switch_bool_t result; + ip_t *argp1 ; + ip_t *argp2 ; + ip_t *argp3 ; + + argp1 = (ip_t *)jarg1; + if (!argp1) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null ip_t", 0); + return 0; + } + arg1 = *argp1; + argp2 = (ip_t *)jarg2; + if (!argp2) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null ip_t", 0); + return 0; + } + arg2 = *argp2; + argp3 = (ip_t *)jarg3; + if (!argp3) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null ip_t", 0); + return 0; + } + arg3 = *argp3; + result = (switch_bool_t)switch_testv6_subnet(arg1,arg2,arg3); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_SMAX_get() { int jresult ; int result; @@ -12906,14 +13011,14 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_file_path(char * jarg1) { SWIGEXPORT int SWIGSTDCALL CSharp_switch_parse_cidr(char * jarg1, void * jarg2, void * jarg3, void * jarg4) { int jresult ; char *arg1 = (char *) 0 ; - uint32_t *arg2 = (uint32_t *) 0 ; - uint32_t *arg3 = (uint32_t *) 0 ; + ip_t *arg2 = (ip_t *) 0 ; + ip_t *arg3 = (ip_t *) 0 ; uint32_t *arg4 = (uint32_t *) 0 ; int result; arg1 = (char *)jarg1; - arg2 = (uint32_t *)jarg2; - arg3 = (uint32_t *)jarg3; + arg2 = (ip_t *)jarg2; + arg3 = (ip_t *)jarg3; arg4 = (uint32_t *)jarg4; result = (int)switch_parse_cidr((char const *)arg1,arg2,arg3,arg4); jresult = result; @@ -12991,6 +13096,28 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_network_list_validate_ip_token(void * j } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_network_list_validate_ip6_token(void * jarg1, void * jarg2, void * jarg3) { + int jresult ; + switch_network_list_t *arg1 = (switch_network_list_t *) 0 ; + ip_t arg2 ; + char **arg3 = (char **) 0 ; + switch_bool_t result; + ip_t *argp2 ; + + arg1 = (switch_network_list_t *)jarg1; + argp2 = (ip_t *)jarg2; + if (!argp2) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null ip_t", 0); + return 0; + } + arg2 = *argp2; + arg3 = (char **)jarg3; + result = (switch_bool_t)switch_network_list_validate_ip6_token(arg1,arg2,(char const **)arg3); + jresult = result; + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_switch_dow_int2str(int jarg1) { char * jresult ; int arg1 ; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index e31d444669..bd901911ed 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -2643,6 +2643,12 @@ public class freeswitch { return ret; } + public static switch_bool_t switch_testv6_subnet(ip_t _ip, ip_t _net, ip_t _mask) { + switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_testv6_subnet(ip_t.getCPtr(_ip), ip_t.getCPtr(_net), ip_t.getCPtr(_mask)); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + public static int _zstr(string s) { int ret = freeswitchPINVOKE._zstr(s); return ret; @@ -2949,8 +2955,8 @@ public class freeswitch { return ret; } - public static int switch_parse_cidr(string arg0, SWIGTYPE_p_unsigned_long ip, SWIGTYPE_p_unsigned_long mask, SWIGTYPE_p_unsigned_long bitp) { - int ret = freeswitchPINVOKE.switch_parse_cidr(arg0, SWIGTYPE_p_unsigned_long.getCPtr(ip), SWIGTYPE_p_unsigned_long.getCPtr(mask), SWIGTYPE_p_unsigned_long.getCPtr(bitp)); + public static int switch_parse_cidr(string arg0, ip_t ip, ip_t mask, SWIGTYPE_p_unsigned_long bitp) { + int ret = freeswitchPINVOKE.switch_parse_cidr(arg0, ip_t.getCPtr(ip), ip_t.getCPtr(mask), SWIGTYPE_p_unsigned_long.getCPtr(bitp)); return ret; } @@ -2974,6 +2980,12 @@ public class freeswitch { return ret; } + public static switch_bool_t switch_network_list_validate_ip6_token(SWIGTYPE_p_switch_network_list list, ip_t ip, ref string token) { + switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_network_list_validate_ip6_token(SWIGTYPE_p_switch_network_list.getCPtr(list), ip_t.getCPtr(ip), ref token); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + public static string switch_dow_int2str(int val) { string ret = freeswitchPINVOKE.switch_dow_int2str(val); return ret; @@ -8430,6 +8442,27 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_isxdigit")] public static extern int switch_isxdigit(int jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_ip_t_v4_set")] + public static extern void ip_t_v4_set(HandleRef jarg1, uint jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_ip_t_v4_get")] + public static extern uint ip_t_v4_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_ip_t_v6_set")] + public static extern void ip_t_v6_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_ip_t_v6_get")] + public static extern IntPtr ip_t_v6_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_new_ip_t")] + public static extern IntPtr new_ip_t(); + + [DllImport("mod_managed", EntryPoint="CSharp_delete_ip_t")] + public static extern void delete_ip_t(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_testv6_subnet")] + public static extern int switch_testv6_subnet(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SMAX_get")] public static extern int SWITCH_SMAX_get(); @@ -8628,6 +8661,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_network_list_validate_ip_token")] public static extern int switch_network_list_validate_ip_token(HandleRef jarg1, uint jarg2, ref string jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_network_list_validate_ip6_token")] + public static extern int switch_network_list_validate_ip6_token(HandleRef jarg1, HandleRef jarg2, ref string jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_dow_int2str")] public static extern string switch_dow_int2str(int jarg1); @@ -13785,6 +13821,75 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class ip_t : IDisposable { + private HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ip_t(IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new HandleRef(this, cPtr); + } + + internal static HandleRef getCPtr(ip_t obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } + + ~ip_t() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_ip_t(swigCPtr); + } + swigCPtr = new HandleRef(null, IntPtr.Zero); + GC.SuppressFinalize(this); + } + } + + public uint v4 { + set { + freeswitchPINVOKE.ip_t_v4_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.ip_t_v4_get(swigCPtr); + return ret; + } + } + + public SWIGTYPE_p_in6_addr v6 { + set { + freeswitchPINVOKE.ip_t_v6_set(swigCPtr, SWIGTYPE_p_in6_addr.getCPtr(value)); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + } + get { + SWIGTYPE_p_in6_addr ret = new SWIGTYPE_p_in6_addr(freeswitchPINVOKE.ip_t_v6_get(swigCPtr), true); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public ip_t() : this(freeswitchPINVOKE.new_ip_t(), 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 { + +using System; +using System.Runtime.InteropServices; + public class IvrMenu : IDisposable { private HandleRef swigCPtr; protected bool swigCMemOwn; @@ -16398,6 +16503,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_in6_addr { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_in6_addr(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_in6_addr() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_in6_addr 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_int { private HandleRef swigCPtr; @@ -28053,7 +28188,10 @@ public enum switch_rtp_bug_flag_t { RTP_BUG_NONE = 0, RTP_BUG_CISCO_SKIP_MARK_BIT_2833 = (1 << 0), RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833 = (1 << 1), - RTP_BUG_IGNORE_MARK_BIT = (1 << 2) + RTP_BUG_IGNORE_MARK_BIT = (1 << 2), + RTP_BUG_SEND_LINEAR_TIMESTAMPS = (1 << 3), + RTP_BUG_START_SEQ_AT_ZERO = (1 << 4), + RTP_BUG_NEVER_SEND_MARKER = (1 << 5) } } diff --git a/src/mod/languages/mod_perl/mod_perl_wrap.cpp b/src/mod/languages/mod_perl/mod_perl_wrap.cpp index 2efbdf1abc..370c88bc99 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/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/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/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/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/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/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); diff --git a/src/switch_core.c b/src/switch_core.c index bd4b00d2ed..0c1263ac95 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -901,16 +901,25 @@ static switch_ip_list_t IP_LIST = { 0 }; SWITCH_DECLARE(switch_bool_t) switch_check_network_list_ip_token(const char *ip_str, const char *list_name, const char **token) { switch_network_list_t *list; - uint32_t ip, net, mask, bits; + ip_t ip, mask, net; + uint32_t bits; + char *ipv6 = strchr(ip_str,':'); switch_bool_t ok = SWITCH_FALSE; switch_mutex_lock(runtime.global_mutex); - switch_inet_pton(AF_INET, ip_str, &ip); - - ip = htonl(ip); + if (ipv6) { + switch_inet_pton(AF_INET6, ip_str, &ip); + } else { + switch_inet_pton(AF_INET, ip_str, &ip); + ip.v4 = htonl(ip.v4); + } if ((list = switch_core_hash_find(IP_LIST.hash, list_name))) { - ok = switch_network_list_validate_ip_token(list, ip, token); + if (ipv6) { + ok = switch_network_list_validate_ip6_token(list, ip, token); + } else { + ok = switch_network_list_validate_ip_token(list, ip.v4, token); + } } else if (strchr(list_name, '/')) { if (strchr(list_name, ',')) { char *list_name_dup = strdup(list_name); @@ -923,15 +932,21 @@ SWITCH_DECLARE(switch_bool_t) switch_check_network_list_ip_token(const char *ip_ int i; for (i = 0; i < argc; i++) { switch_parse_cidr(argv[i], &net, &mask, &bits); - if ((ok = switch_test_subnet(ip, net, mask))) { - break; + if (ipv6) { + if ((ok = switch_testv6_subnet(ip, net, mask))){ + break; + } + } else { + if ((ok = switch_test_subnet(ip.v4, net.v4, mask.v4))) { + break; + } } } } free(list_name_dup); } else { switch_parse_cidr(list_name, &net, &mask, &bits); - ok = switch_test_subnet(ip, net, mask); + ok = switch_test_subnet(ip.v4, net.v4, mask.v4); } } switch_mutex_unlock(runtime.global_mutex); diff --git a/src/switch_utils.c b/src/switch_utils.c index 2872f10a6e..75be02a31f 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -39,9 +39,10 @@ #define ESCAPE_META '\\' struct switch_network_node { - uint32_t ip; - uint32_t mask; + ip_t ip; + ip_t mask; uint32_t bits; + int family; switch_bool_t ok; char *token; char *str; @@ -140,6 +141,50 @@ SWITCH_DECLARE(switch_status_t) switch_network_list_create(switch_network_list_t return SWITCH_STATUS_SUCCESS; } +#define IN6_AND_MASK(result, ip, mask) \ + ((uint32_t *) (result))[0] =((const uint32_t *) (ip))[0] & ((const uint32_t *)(mask))[0]; \ + ((uint32_t *) (result))[1] =((const uint32_t *) (ip))[1] & ((const uint32_t *)(mask))[1]; \ + ((uint32_t *) (result))[2] =((const uint32_t *) (ip))[2] & ((const uint32_t *)(mask))[2]; \ + ((uint32_t *) (result))[3] =((const uint32_t *) (ip))[3] & ((const uint32_t *)(mask))[3]; +SWITCH_DECLARE(switch_bool_t) switch_testv6_subnet(ip_t _ip, ip_t _net, ip_t _mask) { + if (!IN6_IS_ADDR_UNSPECIFIED(&_mask.v6)) { + struct in6_addr a, b; + IN6_AND_MASK(&a, &_net, &_mask); + IN6_AND_MASK(&b, &_ip, &_mask); + return !memcmp(&a,&b, sizeof(struct in6_addr)); + } else { + if (!IN6_IS_ADDR_UNSPECIFIED(&_net.v6)) { + return !memcmp(&_net,&_ip,sizeof(struct in6_addr)); + } + else return SWITCH_TRUE; + } +} +SWITCH_DECLARE(switch_bool_t) switch_network_list_validate_ip6_token(switch_network_list_t *list, ip_t ip, const char **token) +{ + switch_network_node_t *node; + switch_bool_t ok = list->default_type; + uint32_t bits = 0; + + for (node = list->node_head; node; node = node->next) { + if (node->family == AF_INET) continue; + if (node->bits > bits && switch_testv6_subnet(ip, node->ip, node->mask)) { + if (node->ok) { + ok = SWITCH_TRUE; + } else { + ok = SWITCH_FALSE; + } + + bits = node->bits; + + if (token) { + *token = node->token; + } + } + } + + return ok; +} + SWITCH_DECLARE(switch_bool_t) switch_network_list_validate_ip_token(switch_network_list_t *list, uint32_t ip, const char **token) { switch_network_node_t *node; @@ -147,7 +192,8 @@ SWITCH_DECLARE(switch_bool_t) switch_network_list_validate_ip_token(switch_netwo uint32_t bits = 0; for (node = list->node_head; node; node = node->next) { - if (node->bits > bits && switch_test_subnet(ip, node->ip, node->mask)) { + if (node->family == AF_INET6) continue; /* want AF_INET */ + if (node->bits > bits && switch_test_subnet(ip, node->ip.v4, node->mask.v4)) { if (node->ok) { ok = SWITCH_TRUE; } else { @@ -168,7 +214,8 @@ SWITCH_DECLARE(switch_bool_t) switch_network_list_validate_ip_token(switch_netwo SWITCH_DECLARE(switch_status_t) switch_network_list_perform_add_cidr_token(switch_network_list_t *list, const char *cidr_str, switch_bool_t ok, const char *token) { - uint32_t ip, mask, bits; + ip_t ip, mask; + uint32_t bits; switch_network_node_t *node; if (switch_parse_cidr(cidr_str, &ip, &mask, &bits)) { @@ -185,6 +232,12 @@ SWITCH_DECLARE(switch_status_t) switch_network_list_perform_add_cidr_token(switc node->bits = bits; node->str = switch_core_strdup(list->pool, cidr_str); + if (strchr(cidr_str,':')) { + node->family = AF_INET6; + } else { + node->family = AF_INET; + } + if (!zstr(token)) { node->token = switch_core_strdup(list->pool, token); } @@ -227,7 +280,7 @@ SWITCH_DECLARE(switch_status_t) switch_network_list_add_cidr_token(switch_networ SWITCH_DECLARE(switch_status_t) switch_network_list_add_host_mask(switch_network_list_t *list, const char *host, const char *mask_str, switch_bool_t ok) { - int ip, mask; + ip_t ip, mask; switch_network_node_t *node; switch_inet_pton(AF_INET, host, &ip); @@ -235,14 +288,15 @@ SWITCH_DECLARE(switch_status_t) switch_network_list_add_host_mask(switch_network node = switch_core_alloc(list->pool, sizeof(*node)); - node->ip = ntohl(ip); - node->mask = ntohl(mask); + node->ip.v4 = ntohl(ip.v4); + node->mask.v4 = ntohl(mask.v4); node->ok = ok; /* http://graphics.stanford.edu/~seander/bithacks.html */ - mask = mask - ((mask >> 1) & 0x55555555); - mask = (mask & 0x33333333) + ((mask >> 2) & 0x33333333); - node->bits = (((mask + (mask >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24; + mask.v4 = mask.v4 - ((mask.v4 >> 1) & 0x55555555); + mask.v4 = (mask.v4 & 0x33333333) + ((mask.v4 >> 2) & 0x33333333); + node->bits = (((mask.v4 + (mask.v4 >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24; + node->str = switch_core_sprintf(list->pool, "%s:%s", host, mask_str); node->next = list->node_head; @@ -252,13 +306,16 @@ SWITCH_DECLARE(switch_status_t) switch_network_list_add_host_mask(switch_network } -SWITCH_DECLARE(int) switch_parse_cidr(const char *string, uint32_t *ip, uint32_t *mask, uint32_t *bitp) +SWITCH_DECLARE(int) switch_parse_cidr(const char *string, ip_t *ip, ip_t *mask, uint32_t *bitp) { char host[128]; char *bit_str; int32_t bits; + const char *ipv6; + ip_t *maskv = mask; + ip_t *ipv = ip; - switch_copy_string(host, string, sizeof(host)); + memcpy(host, string, sizeof(host)); bit_str = strchr(host, '/'); if (!bit_str) { @@ -267,17 +324,36 @@ SWITCH_DECLARE(int) switch_parse_cidr(const char *string, uint32_t *ip, uint32_t *bit_str++ = '\0'; bits = atoi(bit_str); + ipv6 = strchr(string, ':'); + if (ipv6) { + int i,n; + if (bits < 0 || bits > 128) { + return -2; + } + bits = atoi(bit_str); + switch_inet_pton(AF_INET6, host, (unsigned char *)ip); + for (n=bits,i=0 ;i < 16; i++){ + if (n >= 8) { + maskv->v6.s6_addr[i] = 0xFF; + n -= 8; + } else if (n < 8) { + maskv->v6.s6_addr[i] = 0xFF & ~(0xFF >> n); + n -= n; + } else if (n == 0) { + maskv->v6.s6_addr[i] = 0x00; + } + } + } else { + if (bits < 0 || bits > 32) { + return -2; + } - if (bits < 0 || bits > 32) { - return -2; + bits = atoi(bit_str); + switch_inet_pton(AF_INET, host, (unsigned char *)ip); + ipv->v4 = htonl(ipv->v4); + + maskv->v4 = 0xFFFFFFFF & ~(0xFFFFFFFF >> bits); } - - bits = atoi(bit_str); - switch_inet_pton(AF_INET, host, ip); - *ip = htonl(*ip); - - *mask = 0xFFFFFFFF & ~(0xFFFFFFFF >> bits); - *bitp = bits; return 0; @@ -394,7 +470,7 @@ SWITCH_DECLARE(switch_status_t) switch_b64_encode(unsigned char *in, switch_size if (++y != 72) { continue; } - //out[bytes++] = '\n'; + /* out[bytes++] = '\n'; */ y = 0; } } @@ -963,7 +1039,7 @@ static int get_netmask(struct sockaddr_in *me, int *mask) if (ip.s_addr == me->sin_addr.s_addr) { ioctl(sock, SIOCGIFNETMASK, &ifreqs[i]); sin = (struct sockaddr_in *) &ifreqs[i].ifr_addr; - //mask = sin->sin_addr; + /* mask = sin->sin_addr; */ *mask = sin->sin_addr.s_addr; r = 0; break; @@ -1094,7 +1170,7 @@ SWITCH_DECLARE(switch_status_t) switch_find_local_ip(char *buf, int len, int *ma break; case AF_INET6: switch_copy_string(buf, "::1", len); - base = "2001:503:BA3E::2:30"; // DNS Root server A + base = "2001:503:BA3E::2:30"; /* DNS Root server A */ break; default: base = "127.0.0.1"; From 97c65a004ee9e9b88dad7ff4ac1b2ec893b8c5ba Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Mon, 15 Nov 2010 12:22:09 -0600 Subject: [PATCH 45/45] reswig --- .../mod_managed/freeswitch_wrap.2010.cxx | 134 ++- .../mod_managed/managed/swig.2010.cs | 790 +++++++++++------- 2 files changed, 594 insertions(+), 330 deletions(-) diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx index c55a6d63ed..4a0b52efec 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make @@ -11634,6 +11634,108 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_isxdigit(int jarg1) { } +SWIGEXPORT void SWIGSTDCALL CSharp_ip_t_v4_set(void * jarg1, unsigned long jarg2) { + ip_t *arg1 = (ip_t *) 0 ; + uint32_t arg2 ; + + arg1 = (ip_t *)jarg1; + arg2 = (uint32_t)jarg2; + if (arg1) (arg1)->v4 = arg2; +} + + +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_ip_t_v4_get(void * jarg1) { + unsigned long jresult ; + ip_t *arg1 = (ip_t *) 0 ; + uint32_t result; + + arg1 = (ip_t *)jarg1; + result = (uint32_t) ((arg1)->v4); + jresult = (unsigned long)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_ip_t_v6_set(void * jarg1, void * jarg2) { + ip_t *arg1 = (ip_t *) 0 ; + in6_addr arg2 ; + in6_addr *argp2 ; + + arg1 = (ip_t *)jarg1; + argp2 = (in6_addr *)jarg2; + if (!argp2) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null in6_addr", 0); + return ; + } + arg2 = *argp2; + if (arg1) (arg1)->v6 = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_ip_t_v6_get(void * jarg1) { + void * jresult ; + ip_t *arg1 = (ip_t *) 0 ; + in6_addr result; + + arg1 = (ip_t *)jarg1; + result = ((arg1)->v6); + jresult = new in6_addr((const in6_addr &)result); + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_new_ip_t() { + void * jresult ; + ip_t *result = 0 ; + + result = (ip_t *)new ip_t(); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_delete_ip_t(void * jarg1) { + ip_t *arg1 = (ip_t *) 0 ; + + arg1 = (ip_t *)jarg1; + delete arg1; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_testv6_subnet(void * jarg1, void * jarg2, void * jarg3) { + int jresult ; + ip_t arg1 ; + ip_t arg2 ; + ip_t arg3 ; + ip_t *argp1 ; + ip_t *argp2 ; + ip_t *argp3 ; + switch_bool_t result; + + argp1 = (ip_t *)jarg1; + if (!argp1) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null ip_t", 0); + return 0; + } + arg1 = *argp1; + argp2 = (ip_t *)jarg2; + if (!argp2) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null ip_t", 0); + return 0; + } + arg2 = *argp2; + argp3 = (ip_t *)jarg3; + if (!argp3) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null ip_t", 0); + return 0; + } + arg3 = *argp3; + result = (switch_bool_t)switch_testv6_subnet(arg1,arg2,arg3); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_SMAX_get() { int jresult ; int result; @@ -12589,14 +12691,14 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_file_path(char * jarg1) { SWIGEXPORT int SWIGSTDCALL CSharp_switch_parse_cidr(char * jarg1, void * jarg2, void * jarg3, void * jarg4) { int jresult ; char *arg1 = (char *) 0 ; - uint32_t *arg2 = (uint32_t *) 0 ; - uint32_t *arg3 = (uint32_t *) 0 ; + ip_t *arg2 = (ip_t *) 0 ; + ip_t *arg3 = (ip_t *) 0 ; uint32_t *arg4 = (uint32_t *) 0 ; int result; arg1 = (char *)jarg1; - arg2 = (uint32_t *)jarg2; - arg3 = (uint32_t *)jarg3; + arg2 = (ip_t *)jarg2; + arg3 = (ip_t *)jarg3; arg4 = (uint32_t *)jarg4; result = (int)switch_parse_cidr((char const *)arg1,arg2,arg3,arg4); jresult = result; @@ -12674,6 +12776,28 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_network_list_validate_ip_token(void * j } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_network_list_validate_ip6_token(void * jarg1, void * jarg2, void * jarg3) { + int jresult ; + switch_network_list_t *arg1 = (switch_network_list_t *) 0 ; + ip_t arg2 ; + char **arg3 = (char **) 0 ; + ip_t *argp2 ; + switch_bool_t result; + + arg1 = (switch_network_list_t *)jarg1; + argp2 = (ip_t *)jarg2; + if (!argp2) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null ip_t", 0); + return 0; + } + arg2 = *argp2; + arg3 = (char **)jarg3; + result = (switch_bool_t)switch_network_list_validate_ip6_token(arg1,arg2,(char const **)arg3); + jresult = result; + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_switch_dow_int2str(int jarg1) { char * jresult ; int arg1 ; diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index 8c307fc679..2897fef1e5 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -64,7 +64,7 @@ public class Api : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -80,7 +80,7 @@ public enum cache_db_flag_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -432,7 +432,7 @@ public class CoreSession : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -448,7 +448,7 @@ public enum dm_match_type_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -517,7 +517,7 @@ public class DTMF : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -532,7 +532,7 @@ public enum dtmf_flag_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -660,7 +660,7 @@ public partial class Event : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -792,7 +792,7 @@ public class EventConsumer : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -2653,6 +2653,12 @@ public class freeswitch { return ret; } + public static switch_bool_t switch_testv6_subnet(ip_t _ip, ip_t _net, ip_t _mask) { + switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_testv6_subnet(ip_t.getCPtr(_ip), ip_t.getCPtr(_net), ip_t.getCPtr(_mask)); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + public static int _zstr(string s) { int ret = freeswitchPINVOKE._zstr(s); return ret; @@ -2959,8 +2965,8 @@ public class freeswitch { return ret; } - public static int switch_parse_cidr(string arg0, SWIGTYPE_p_unsigned_long ip, SWIGTYPE_p_unsigned_long mask, SWIGTYPE_p_unsigned_long bitp) { - int ret = freeswitchPINVOKE.switch_parse_cidr(arg0, SWIGTYPE_p_unsigned_long.getCPtr(ip), SWIGTYPE_p_unsigned_long.getCPtr(mask), SWIGTYPE_p_unsigned_long.getCPtr(bitp)); + public static int switch_parse_cidr(string arg0, ip_t ip, ip_t mask, SWIGTYPE_p_unsigned_long bitp) { + int ret = freeswitchPINVOKE.switch_parse_cidr(arg0, ip_t.getCPtr(ip), ip_t.getCPtr(mask), SWIGTYPE_p_unsigned_long.getCPtr(bitp)); return ret; } @@ -2984,6 +2990,12 @@ public class freeswitch { return ret; } + public static switch_bool_t switch_network_list_validate_ip6_token(SWIGTYPE_p_switch_network_list list, ip_t ip, ref string token) { + switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_network_list_validate_ip6_token(SWIGTYPE_p_switch_network_list.getCPtr(list), ip_t.getCPtr(ip), ref token); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + public static string switch_dow_int2str(int val) { string ret = freeswitchPINVOKE.switch_dow_int2str(val); return ret; @@ -5437,7 +5449,7 @@ public class freeswitch { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -8444,6 +8456,27 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_isxdigit")] public static extern int switch_isxdigit(int jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_ip_t_v4_set")] + public static extern void ip_t_v4_set(HandleRef jarg1, uint jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_ip_t_v4_get")] + public static extern uint ip_t_v4_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_ip_t_v6_set")] + public static extern void ip_t_v6_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_ip_t_v6_get")] + public static extern IntPtr ip_t_v6_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_new_ip_t")] + public static extern IntPtr new_ip_t(); + + [DllImport("mod_managed", EntryPoint="CSharp_delete_ip_t")] + public static extern void delete_ip_t(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_testv6_subnet")] + public static extern int switch_testv6_subnet(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SMAX_get")] public static extern int SWITCH_SMAX_get(); @@ -8642,6 +8675,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_network_list_validate_ip_token")] public static extern int switch_network_list_validate_ip_token(HandleRef jarg1, uint jarg2, ref string jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_network_list_validate_ip6_token")] + public static extern int switch_network_list_validate_ip6_token(HandleRef jarg1, HandleRef jarg2, ref string jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_dow_int2str")] public static extern string switch_dow_int2str(int jarg1); @@ -13698,7 +13734,7 @@ class freeswitchPINVOKE { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -13790,7 +13826,78 @@ public class input_callback_state_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 + * + * 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 ip_t : IDisposable { + private HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ip_t(IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new HandleRef(this, cPtr); + } + + internal static HandleRef getCPtr(ip_t obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } + + ~ip_t() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if (swigCPtr.Handle != IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_ip_t(swigCPtr); + } + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + GC.SuppressFinalize(this); + } + } + + public uint v4 { + set { + freeswitchPINVOKE.ip_t_v4_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.ip_t_v4_get(swigCPtr); + return ret; + } + } + + public SWIGTYPE_p_in6_addr v6 { + set { + freeswitchPINVOKE.ip_t_v6_set(swigCPtr, SWIGTYPE_p_in6_addr.getCPtr(value)); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + } + get { + SWIGTYPE_p_in6_addr ret = new SWIGTYPE_p_in6_addr(freeswitchPINVOKE.ip_t_v6_get(swigCPtr), true); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public ip_t() : this(freeswitchPINVOKE.new_ip_t(), true) { + } + +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -13847,7 +13954,7 @@ public class IvrMenu : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -13901,7 +14008,7 @@ public partial class ManagedSession : CoreSession { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -13918,7 +14025,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -13979,7 +14086,7 @@ public partial class Stream : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14009,7 +14116,7 @@ public class SWIGTYPE_p_apr_pool_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14039,7 +14146,7 @@ public class SWIGTYPE_p_FILE { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14069,7 +14176,7 @@ public class SWIGTYPE_p_float { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14099,7 +14206,7 @@ public class SWIGTYPE_p_f_p_char_enum_switch_management_action_t_p_char_switch_s } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14129,7 +14236,7 @@ public class SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_ } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14159,7 +14266,7 @@ public class SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__swi } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14189,7 +14296,7 @@ public class SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_p_switch_console_cal } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14219,7 +14326,7 @@ public class SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_co } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14249,7 +14356,7 @@ public class SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_co } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14279,7 +14386,7 @@ public class SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_unsigned_long__int { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14309,7 +14416,7 @@ public class SWIGTYPE_p_f_p_q_const__char_p_q_const__char__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14339,7 +14446,7 @@ public class SWIGTYPE_p_f_p_q_const__char_p_switch_codec_fmtp__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14369,7 +14476,7 @@ public class SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_ } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14399,7 +14506,7 @@ public class SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__ } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14429,7 +14536,7 @@ public class SWIGTYPE_p_f_p_q_const__void_p_q_const__void_p_void__switch_bool_t } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14459,7 +14566,7 @@ public class SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14489,7 +14596,7 @@ public class SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14519,7 +14626,7 @@ public class SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14549,7 +14656,7 @@ public class SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_s } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14579,7 +14686,7 @@ public class SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__cha } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14609,7 +14716,7 @@ public class SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__s } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14639,7 +14746,7 @@ public class SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14669,7 +14776,7 @@ public class SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14699,7 +14806,7 @@ public class SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_lon } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14729,7 +14836,7 @@ public class SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14759,7 +14866,7 @@ public class SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_uns } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14789,7 +14896,7 @@ public class SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_s } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14819,7 +14926,7 @@ public class SWIGTYPE_p_f_p_switch_codec__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14849,7 +14956,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14879,7 +14986,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_char_p_switch_say_args_t_p_swi } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14909,7 +15016,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_i } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14939,7 +15046,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char_ } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14969,7 +15076,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char_ } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14999,7 +15106,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char_ } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15029,7 +15136,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15059,7 +15166,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_sw } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15089,7 +15196,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t__switch } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15119,7 +15226,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__s } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15149,7 +15256,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_p } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15179,7 +15286,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_p } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15209,7 +15316,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15239,7 +15346,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_p_void__switch_st } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15269,7 +15376,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15299,7 +15406,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_ } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15329,7 +15436,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_t_p_void_p_switch_caller_profile } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15359,7 +15466,7 @@ public class SWIGTYPE_p_f_p_switch_core_session__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15389,7 +15496,7 @@ public class SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char_p_char__switch } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15419,7 +15526,7 @@ public class SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char__switch_status } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15449,7 +15556,7 @@ public class SWIGTYPE_p_f_p_switch_directory_handle_p_p_char_p_p_char__switch_st } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15479,7 +15586,7 @@ public class SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15509,7 +15616,7 @@ public class SWIGTYPE_p_f_p_switch_event__void { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15539,7 +15646,7 @@ public class SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_con } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15569,7 +15676,7 @@ public class SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15599,7 +15706,7 @@ public class SWIGTYPE_p_f_p_switch_file_handle_long_long__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15629,7 +15736,7 @@ public class SWIGTYPE_p_f_p_switch_file_handle_p_q_const__char__switch_status_t } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15659,7 +15766,7 @@ public class SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__swi } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15689,7 +15796,7 @@ public class SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_st } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15719,7 +15826,7 @@ public class SWIGTYPE_p_f_p_switch_file_handle__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15749,7 +15856,7 @@ public class SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15779,7 +15886,7 @@ public class SWIGTYPE_p_f_p_switch_ivr_menu_p_char_p_char_size_t_p_void__switch_ } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15809,7 +15916,7 @@ public class SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__swit } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15839,7 +15946,7 @@ public class SWIGTYPE_p_f_p_switch_rtp_p_switch_socket_t_p_void_switch_size_t_p_ } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15869,7 +15976,7 @@ public class SWIGTYPE_p_f_p_switch_scheduler_task__void { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15899,7 +16006,7 @@ public class SWIGTYPE_p_f_p_switch_speech_handle_p_char_double__void { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15929,7 +16036,7 @@ public class SWIGTYPE_p_f_p_switch_speech_handle_p_char_int__void { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15959,7 +16066,7 @@ public class SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_q_const__char__void { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15989,7 +16096,7 @@ public class SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_ } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16019,7 +16126,7 @@ public class SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_unsigned_ } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16049,7 +16156,7 @@ public class SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__switch_status_ } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16079,7 +16186,7 @@ public class SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsign } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16109,7 +16216,7 @@ public class SWIGTYPE_p_f_p_switch_speech_handle__void { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16139,7 +16246,7 @@ public class SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______switch_ } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16169,7 +16276,7 @@ public class SWIGTYPE_p_f_p_switch_stream_handle_p_unsigned_char_switch_size_t__ } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16199,7 +16306,7 @@ public class SWIGTYPE_p_f_p_switch_thread_t_p_void__p_void { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16229,7 +16336,7 @@ public class SWIGTYPE_p_f_p_switch_timer_enum_switch_bool_t__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16259,7 +16366,7 @@ public class SWIGTYPE_p_f_p_switch_timer__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16289,7 +16396,7 @@ public class SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16319,7 +16426,7 @@ public class SWIGTYPE_p_f_p_void_p_q_const__char__int { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16349,7 +16456,7 @@ public class SWIGTYPE_p_f_p_void__void { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16379,7 +16486,7 @@ public class SWIGTYPE_p_f_void__p_char { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16409,7 +16516,7 @@ public class SWIGTYPE_p_f_void__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16439,7 +16546,37 @@ public class SWIGTYPE_p_HashElem { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 + * + * 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_in6_addr { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_in6_addr(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_in6_addr() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_in6_addr 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.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16469,7 +16606,7 @@ public class SWIGTYPE_p_int { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16499,7 +16636,7 @@ public class SWIGTYPE_p_p_apr_pool_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16529,7 +16666,7 @@ public class SWIGTYPE_p_p_char { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16559,7 +16696,7 @@ public class SWIGTYPE_p_p_p_char { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16589,7 +16726,7 @@ public class SWIGTYPE_p_p_real_pcre { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16619,7 +16756,7 @@ public class SWIGTYPE_p_p_sqlite3 { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16649,7 +16786,7 @@ public class SWIGTYPE_p_p_sqlite3_stmt { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16679,7 +16816,7 @@ public class SWIGTYPE_p_p_switch_audio_resampler_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16709,7 +16846,7 @@ public class SWIGTYPE_p_p_switch_buffer { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16739,7 +16876,7 @@ public class SWIGTYPE_p_p_switch_cache_db_handle_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16769,7 +16906,7 @@ public class SWIGTYPE_p_p_switch_caller_extension { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16799,7 +16936,7 @@ public class SWIGTYPE_p_p_switch_channel { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16829,7 +16966,7 @@ public class SWIGTYPE_p_p_switch_codec_implementation { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16859,7 +16996,7 @@ public class SWIGTYPE_p_p_switch_console_callback_match { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16889,7 +17026,7 @@ public class SWIGTYPE_p_p_switch_core_port_allocator { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16919,7 +17056,7 @@ public class SWIGTYPE_p_p_switch_core_session { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16949,7 +17086,7 @@ public class SWIGTYPE_p_p_switch_core_session_message { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16979,7 +17116,7 @@ public class SWIGTYPE_p_p_switch_event { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17009,7 +17146,7 @@ public class SWIGTYPE_p_p_switch_event_node { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17039,7 +17176,7 @@ public class SWIGTYPE_p_p_switch_frame { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17069,7 +17206,7 @@ public class SWIGTYPE_p_p_switch_hash { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17099,7 +17236,7 @@ public class SWIGTYPE_p_p_switch_ivr_digit_stream { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17129,7 +17266,7 @@ public class SWIGTYPE_p_p_switch_ivr_digit_stream_parser { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17159,7 +17296,7 @@ public class SWIGTYPE_p_p_switch_ivr_dmachine { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17189,7 +17326,7 @@ public class SWIGTYPE_p_p_switch_ivr_dmachine_match { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17219,7 +17356,7 @@ public class SWIGTYPE_p_p_switch_ivr_menu { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17249,7 +17386,7 @@ public class SWIGTYPE_p_p_switch_ivr_menu_xml_ctx { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17279,7 +17416,7 @@ public class SWIGTYPE_p_p_switch_log_node_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17309,7 +17446,7 @@ public class SWIGTYPE_p_p_switch_media_bug { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17339,7 +17476,7 @@ public class SWIGTYPE_p_p_switch_network_list { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17369,7 +17506,7 @@ public class SWIGTYPE_p_p_switch_rtp { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17399,7 +17536,7 @@ public class SWIGTYPE_p_p_switch_xml { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17429,7 +17566,7 @@ public class SWIGTYPE_p_p_switch_xml_binding { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17459,7 +17596,7 @@ public class SWIGTYPE_p_p_void { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17489,7 +17626,7 @@ public class SWIGTYPE_p_real_pcre { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17519,7 +17656,7 @@ public class SWIGTYPE_p_short { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17549,7 +17686,7 @@ public class SWIGTYPE_p_sockaddr { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17579,7 +17716,7 @@ public class SWIGTYPE_p_sockaddr_in6 { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17609,7 +17746,7 @@ public class SWIGTYPE_p_socklen_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17639,7 +17776,7 @@ public class SWIGTYPE_p_sqlite3 { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17669,7 +17806,7 @@ public class SWIGTYPE_p_sqlite3_stmt { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17699,7 +17836,7 @@ public class SWIGTYPE_p_switch_buffer { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17729,7 +17866,7 @@ public class SWIGTYPE_p_switch_call_cause_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17759,7 +17896,7 @@ public class SWIGTYPE_p_switch_channel { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17789,7 +17926,7 @@ public class SWIGTYPE_p_switch_core_port_allocator { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17819,7 +17956,7 @@ public class SWIGTYPE_p_switch_core_session { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17849,7 +17986,7 @@ public class SWIGTYPE_p_switch_event_types_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17879,7 +18016,7 @@ public class SWIGTYPE_p_switch_file_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17909,7 +18046,7 @@ public class SWIGTYPE_p_switch_hash { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17939,7 +18076,7 @@ public class SWIGTYPE_p_switch_interval_time_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17969,7 +18106,7 @@ public class SWIGTYPE_p_switch_ivr_action_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17999,7 +18136,7 @@ public class SWIGTYPE_p_switch_ivr_digit_stream { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18029,7 +18166,7 @@ public class SWIGTYPE_p_switch_ivr_digit_stream_parser { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18059,7 +18196,7 @@ public class SWIGTYPE_p_switch_ivr_dmachine { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18089,7 +18226,7 @@ public class SWIGTYPE_p_switch_ivr_menu { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18119,7 +18256,7 @@ public class SWIGTYPE_p_switch_ivr_menu_xml_ctx { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18149,7 +18286,7 @@ public class SWIGTYPE_p_switch_media_bug { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18179,7 +18316,7 @@ public class SWIGTYPE_p_switch_mutex_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18209,7 +18346,7 @@ public class SWIGTYPE_p_switch_network_list { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18239,7 +18376,7 @@ public class SWIGTYPE_p_switch_odbc_handle { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18269,7 +18406,7 @@ public class SWIGTYPE_p_switch_pollfd_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18299,7 +18436,7 @@ public class SWIGTYPE_p_switch_queue_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18329,7 +18466,7 @@ public class SWIGTYPE_p_switch_rtcp_frame { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18359,7 +18496,7 @@ public class SWIGTYPE_p_switch_rtp { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18389,7 +18526,7 @@ public class SWIGTYPE_p_switch_size_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18419,7 +18556,7 @@ public class SWIGTYPE_p_switch_sockaddr_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18449,7 +18586,7 @@ public class SWIGTYPE_p_switch_socket_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18479,7 +18616,7 @@ public class SWIGTYPE_p_switch_ssize_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18509,7 +18646,7 @@ public class SWIGTYPE_p_switch_thread_rwlock_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18539,7 +18676,7 @@ public class SWIGTYPE_p_switch_time_exp_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18569,7 +18706,7 @@ public class SWIGTYPE_p_switch_time_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18599,7 +18736,7 @@ public class SWIGTYPE_p_switch_xml_binding { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18629,7 +18766,7 @@ public class SWIGTYPE_p_time_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18659,7 +18796,7 @@ public class SWIGTYPE_p_unsigned_char { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18689,7 +18826,7 @@ public class SWIGTYPE_p_unsigned_int { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18719,7 +18856,7 @@ public class SWIGTYPE_p_unsigned_long { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18749,7 +18886,7 @@ public class SWIGTYPE_p_unsigned_short { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18779,7 +18916,7 @@ public class SWIGTYPE_p_void { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18800,7 +18937,7 @@ public enum switch_abc_type_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18944,7 +19081,7 @@ public class switch_api_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18962,7 +19099,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -19126,7 +19263,7 @@ public class switch_application_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -19206,7 +19343,7 @@ public class switch_app_log : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -19226,7 +19363,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -19368,7 +19505,7 @@ public class switch_asr_handle : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -19624,7 +19761,7 @@ public class switch_asr_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -19644,7 +19781,7 @@ public enum switch_audio_col_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -19775,7 +19912,7 @@ public class switch_audio_resampler_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -19797,7 +19934,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -19813,7 +19950,7 @@ public enum switch_bitpack_mode_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -19994,7 +20131,7 @@ public class switch_bitpack_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -20010,7 +20147,7 @@ public enum switch_bool_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -20081,7 +20218,7 @@ public class switch_cache_db_connection_options_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -20140,7 +20277,7 @@ public class switch_cache_db_core_db_options_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -20305,7 +20442,7 @@ public class switch_cache_db_handle_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -20321,7 +20458,7 @@ public enum switch_cache_db_handle_type_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -20392,7 +20529,7 @@ public class switch_cache_db_native_handle_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -20471,7 +20608,7 @@ public class switch_cache_db_odbc_options_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -20562,7 +20699,7 @@ public class switch_caller_application : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -20686,7 +20823,7 @@ public class switch_caller_extension : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -21083,7 +21220,7 @@ public class switch_caller_profile : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -21101,7 +21238,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -21179,7 +21316,7 @@ public enum switch_call_cause_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -21195,7 +21332,7 @@ public enum switch_call_direction_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -21211,7 +21348,7 @@ public enum switch_channel_app_flag_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -21232,7 +21369,7 @@ public enum switch_channel_callstate_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -21250,7 +21387,7 @@ public enum switch_channel_cap_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -21320,7 +21457,7 @@ public enum switch_channel_flag_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -21348,7 +21485,7 @@ public enum switch_channel_state_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -21504,7 +21641,7 @@ public class switch_channel_timetable : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -21628,7 +21765,7 @@ public class switch_chat_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -21783,7 +21920,7 @@ public class switch_codec : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -21806,7 +21943,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -21896,7 +22033,7 @@ public class switch_codec_fmtp : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -22150,7 +22287,7 @@ public class switch_codec_implementation : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -22295,7 +22432,7 @@ public class switch_codec_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -22354,7 +22491,7 @@ public class switch_codec_settings : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -22372,7 +22509,7 @@ public enum switch_codec_type_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -22512,7 +22649,7 @@ public class switch_config : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -22603,7 +22740,7 @@ public class switch_console_callback_match : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -22673,7 +22810,7 @@ public class switch_console_callback_match_node : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -22703,7 +22840,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -22945,7 +23082,7 @@ public class switch_core_session_message : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -22962,7 +23099,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -23009,7 +23146,7 @@ public enum switch_core_session_message_types_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -23112,7 +23249,7 @@ public class switch_core_thread_session : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -23231,7 +23368,7 @@ public class switch_core_time_duration : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -23355,7 +23492,7 @@ public class switch_dialplan_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -23534,7 +23671,7 @@ public class switch_directories : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -23549,7 +23686,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -23641,7 +23778,7 @@ public class switch_directory_handle : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -23809,7 +23946,7 @@ public class switch_directory_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -23825,7 +23962,7 @@ public enum switch_dtmf_direction_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -23904,7 +24041,7 @@ public class switch_dtmf_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -23922,7 +24059,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -24068,7 +24205,7 @@ public class switch_endpoint_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -24242,7 +24379,7 @@ public class switch_event : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -24257,7 +24394,7 @@ public enum switch_event_flag_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -24347,7 +24484,7 @@ public class switch_event_header : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -24441,7 +24578,7 @@ public enum switch_event_types_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -24472,7 +24609,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -24932,7 +25069,7 @@ public class switch_file_handle : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -25142,7 +25279,7 @@ public class switch_file_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -25357,7 +25494,7 @@ public class switch_frame : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -25381,7 +25518,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -25495,7 +25632,7 @@ public class switch_input_args_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -25511,7 +25648,7 @@ public enum switch_input_type_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -25703,7 +25840,7 @@ public class switch_io_event_hooks : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -25774,7 +25911,7 @@ public class switch_io_event_hook_kill_channel : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -25845,7 +25982,7 @@ public class switch_io_event_hook_outgoing_channel : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -25916,7 +26053,7 @@ public class switch_io_event_hook_read_frame : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -25987,7 +26124,7 @@ public class switch_io_event_hook_receive_event : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26058,7 +26195,7 @@ public class switch_io_event_hook_receive_message : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26129,7 +26266,7 @@ public class switch_io_event_hook_recv_dtmf : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26200,7 +26337,7 @@ public class switch_io_event_hook_resurrect_session : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26271,7 +26408,7 @@ public class switch_io_event_hook_send_dtmf : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26342,7 +26479,7 @@ public class switch_io_event_hook_state_change : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26413,7 +26550,7 @@ public class switch_io_event_hook_state_run : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26484,7 +26621,7 @@ public class switch_io_event_hook_video_read_frame : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26555,7 +26692,7 @@ public class switch_io_event_hook_video_write_frame : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26626,7 +26763,7 @@ public class switch_io_event_hook_write_frame : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26643,7 +26780,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26835,7 +26972,7 @@ public class switch_io_routines : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26860,7 +26997,7 @@ public enum switch_io_routine_name_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26881,7 +27018,7 @@ public enum switch_ivr_action_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26982,7 +27119,7 @@ public class switch_ivr_dmachine_match : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26999,7 +27136,7 @@ public enum switch_ivr_menu_flags { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -27016,7 +27153,7 @@ public enum switch_ivr_option_enum_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -27195,7 +27332,7 @@ public class switch_limit_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -27297,7 +27434,7 @@ public class switch_loadable_module_function_table_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -27542,7 +27679,7 @@ public class switch_loadable_module_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -27575,7 +27712,7 @@ public enum switch_log_level_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -27716,7 +27853,7 @@ public class switch_log_node_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -27733,7 +27870,7 @@ public enum switch_management_action_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -27857,7 +27994,7 @@ public class switch_management_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -27882,7 +28019,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -27906,7 +28043,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -27922,7 +28059,7 @@ public enum switch_module_flag_enum_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -27950,7 +28087,7 @@ public enum switch_module_interface_name_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -27970,7 +28107,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -27987,7 +28124,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28004,7 +28141,7 @@ public enum switch_priority_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28021,7 +28158,7 @@ public enum switch_ring_ready_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28120,7 +28257,7 @@ public class switch_rtcp_hdr_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28189,7 +28326,7 @@ public class switch_rtcp_numbers_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28201,13 +28338,16 @@ public enum switch_rtp_bug_flag_t { RTP_BUG_NONE = 0, RTP_BUG_CISCO_SKIP_MARK_BIT_2833 = (1 << 0), RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833 = (1 << 1), - RTP_BUG_IGNORE_MARK_BIT = (1 << 2) + RTP_BUG_IGNORE_MARK_BIT = (1 << 2), + RTP_BUG_SEND_LINEAR_TIMESTAMPS = (1 << 3), + RTP_BUG_START_SEQ_AT_ZERO = (1 << 4), + RTP_BUG_NEVER_SEND_MARKER = (1 << 5) } } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28224,7 +28364,7 @@ public enum switch_rtp_crypto_direction_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28327,7 +28467,7 @@ public class switch_rtp_crypto_key : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28345,7 +28485,7 @@ public enum switch_rtp_crypto_key_type_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28391,7 +28531,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28408,7 +28548,7 @@ public enum switch_rtp_flush_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28547,7 +28687,7 @@ public class switch_rtp_hdr_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28704,7 +28844,7 @@ public class switch_rtp_numbers_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28786,7 +28926,7 @@ public class switch_rtp_stats_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28865,7 +29005,7 @@ public class switch_say_args_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28882,7 +29022,7 @@ public enum switch_say_gender_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29006,7 +29146,7 @@ public class switch_say_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29024,7 +29164,7 @@ public enum switch_say_method_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29057,7 +29197,7 @@ public enum switch_say_type_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29075,7 +29215,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29185,7 +29325,7 @@ public class switch_scheduler_task : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29225,7 +29365,7 @@ public enum switch_session_ctl_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29243,7 +29383,7 @@ public enum switch_signal_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29265,7 +29405,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29492,7 +29632,7 @@ public class switch_speech_handle : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29693,7 +29833,7 @@ public class switch_speech_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29710,7 +29850,7 @@ public enum switch_stack_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29725,7 +29865,7 @@ public enum switch_state_handler_flag_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29751,7 +29891,7 @@ public enum switch_state_handler_name_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29953,7 +30093,7 @@ public class switch_state_handler_table : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29989,7 +30129,7 @@ public enum switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -30141,7 +30281,7 @@ public class switch_stream_handle : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -30330,7 +30470,7 @@ public class switch_t38_options_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -30348,7 +30488,7 @@ public enum switch_text_channel_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -30494,7 +30634,7 @@ public class switch_timer : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -30509,7 +30649,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -30529,7 +30669,7 @@ public enum switch_timer_func_name_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -30708,7 +30848,7 @@ public class switch_timer_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -30925,7 +31065,7 @@ public class switch_unicast_conninfo : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -30943,7 +31083,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -30960,7 +31100,7 @@ public enum switch_uri_flags { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -30978,7 +31118,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -31153,7 +31293,7 @@ public class switch_xml : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -31171,7 +31311,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead.