From b8e14cb9b520a4eece6b093a2f5fe9032dfd6288 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 20 Aug 2019 23:37:49 +0400 Subject: [PATCH 001/118] version bump --- build/next-release.txt | 2 +- configure.ac | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/next-release.txt b/build/next-release.txt index 3334f6d4e0..de4df648d8 100644 --- a/build/next-release.txt +++ b/build/next-release.txt @@ -1 +1 @@ -1.10.1-dev +1.10.2-dev diff --git a/configure.ac b/configure.ac index 9b6cef9027..1d9c27eebd 100644 --- a/configure.ac +++ b/configure.ac @@ -3,10 +3,10 @@ # Must change all of the below together # For a release, set revision for that tagged release as well and uncomment -AC_INIT([freeswitch], [1.10.1-dev], bugs@freeswitch.org) +AC_INIT([freeswitch], [1.10.2-dev], bugs@freeswitch.org) AC_SUBST(SWITCH_VERSION_MAJOR, [1]) AC_SUBST(SWITCH_VERSION_MINOR, [10]) -AC_SUBST(SWITCH_VERSION_MICRO, [1-dev]) +AC_SUBST(SWITCH_VERSION_MICRO, [2-dev]) AC_SUBST(SWITCH_VERSION_REVISION, []) AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, []) From 8c1697b9b23bbe65c3c5d9fa9d76f6f6f4737e51 Mon Sep 17 00:00:00 2001 From: Mike Jerris Date: Thu, 22 Aug 2019 10:40:39 -0600 Subject: [PATCH 002/118] FS-12021: [mod_signalwire] Remove ascii art on mod_signalwire token line --- src/mod/applications/mod_signalwire/mod_signalwire.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_signalwire/mod_signalwire.c b/src/mod/applications/mod_signalwire/mod_signalwire.c index 71dc8b7e39..46f459372c 100644 --- a/src/mod/applications/mod_signalwire/mod_signalwire.c +++ b/src/mod/applications/mod_signalwire/mod_signalwire.c @@ -459,7 +459,7 @@ SWITCH_STANDARD_API(mod_signalwire_api_function) " /____/_/\\__, /_/ /_/\\__,_/_/ |__/|__/_/_/ \\___/\n" " /____/\n" "\n /=====================================================================\\\n" - "| Connection Token: %s |\n" + " Connection Token: %s\n" " \\=====================================================================/\n" " Go to https://signalwire.com to set up your Connector now!\n", globals.adoption_token); } else { From 759783532dc7c34b4f8ab27e63438a350bfbc256 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dtalo=20Rossi?= Date: Thu, 22 Aug 2019 16:35:34 -0300 Subject: [PATCH 003/118] FS-12022: [mod_event_socket] Add Job-Owner-UUID with session uuid when using bgapi inside outbound socket --- src/mod/event_handlers/mod_event_socket/mod_event_socket.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index a9234222cf..f0137412d8 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -375,6 +375,9 @@ static void event_handler(switch_event_t *event) if (!uuid || (l->session && strcmp(uuid, switch_core_session_get_uuid(l->session)))) { send = 0; } + if (!strcmp(switch_core_session_get_uuid(l->session), switch_event_get_header_nil(event, "Job-Owner-UUID"))) { + send = 1; + } } if (send) { @@ -1499,6 +1502,7 @@ struct api_command_struct { listener_t *listener; char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1]; int bg; + char bg_owner_uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1]; int ack; int console_execute; switch_memory_pool_t *pool; @@ -1557,6 +1561,7 @@ static void *SWITCH_THREAD_FUNC api_exec(switch_thread_t *thread, void *obj) if (switch_event_create(&event, SWITCH_EVENT_BACKGROUND_JOB) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Job-UUID", acs->uuid_str); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Job-Owner-UUID", acs->bg_owner_uuid_str); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Job-Command", acs->api_cmd); if (acs->arg) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Job-Command-Arg", acs->arg); @@ -2357,6 +2362,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even switch_uuid_get(&uuid); switch_uuid_format(acs->uuid_str, &uuid); } + switch_copy_string(acs->bg_owner_uuid_str, switch_core_session_get_uuid(listener->session), sizeof(acs->bg_owner_uuid_str)); switch_snprintf(reply, reply_len, "~Reply-Text: +OK Job-UUID: %s\nJob-UUID: %s\n\n", acs->uuid_str, acs->uuid_str); switch_thread_create(&thread, thd_attr, api_exec, acs, acs->pool); sanity = 2000; From 7a4a988dcbc39c89b5cdfaacc514cfb1c4748197 Mon Sep 17 00:00:00 2001 From: David Grant Date: Tue, 13 Aug 2019 13:44:26 -0500 Subject: [PATCH 004/118] FS-11993 [mod_http_cache][mod_smpp] fix gcc errors when building on rpi4 buster (strncpy to snprintf) FS-11993 [mod_http_cache][mod_smpp] fix gcc errors when building on rpi4 buster (strncpy to snprintf) --- src/mod/applications/mod_http_cache/mod_http_cache.c | 4 ++-- src/mod/event_handlers/mod_smpp/mod_smpp_gateway.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mod/applications/mod_http_cache/mod_http_cache.c b/src/mod/applications/mod_http_cache/mod_http_cache.c index e3f8d06493..7144e54da7 100644 --- a/src/mod/applications/mod_http_cache/mod_http_cache.c +++ b/src/mod/applications/mod_http_cache/mod_http_cache.c @@ -273,7 +273,7 @@ static void parse_domain(const char *url, char *domain_buf, int domain_buf_len) if (!*start) { return; } - strncpy(domain_buf, start, domain_buf_len); + snprintf(domain_buf, domain_buf_len, "%s", start); end = strchr(domain_buf, '/'); if (end) { *end = '\0'; @@ -985,7 +985,7 @@ static char *cached_url_filename_create(url_cache_t *cache, const char *url, cha /* filename is constructed from UUID and is stored in cache dir (first 2 characters of UUID) */ switch_uuid_get(&uuid); switch_uuid_format(uuid_str, &uuid); - strncpy(uuid_dir, uuid_str, 2); + snprintf(uuid_dir, sizeof(uuid_dir), "%.2s", uuid_str); dirname = switch_mprintf("%s%s%s", cache->location, SWITCH_PATH_SEPARATOR, uuid_dir); /* create sub-directory if it doesn't exist */ diff --git a/src/mod/event_handlers/mod_smpp/mod_smpp_gateway.c b/src/mod/event_handlers/mod_smpp/mod_smpp_gateway.c index ed96586039..4be9790083 100644 --- a/src/mod/event_handlers/mod_smpp/mod_smpp_gateway.c +++ b/src/mod/event_handlers/mod_smpp/mod_smpp_gateway.c @@ -112,15 +112,15 @@ switch_status_t mod_smpp_gateway_authenticate(mod_smpp_gateway_t *gateway) { strncpy( (char *)req_b->address_range, gateway->host, sizeof(req_b->address_range)); if ( gateway->system_id ) { - strncpy((char *)req_b->system_id, gateway->system_id, sizeof(req_b->system_id)); + snprintf((char *)req_b->system_id, sizeof(req_b->system_id), "%s", gateway->system_id); } if ( gateway->password ) { - strncpy((char *)req_b->password, gateway->password, sizeof(req_b->password)); + snprintf((char *)req_b->password, sizeof(req_b->password), "%s", gateway->password); } if ( gateway->system_type ) { - strncpy((char *)req_b->system_type, gateway->system_type, sizeof(req_b->system_type)); + snprintf((char *)req_b->system_type, sizeof(req_b->system_type), "%s", gateway->system_type); } req_b->interface_version = SMPP_VERSION; From fd2f12cf94c4445843a299ef8b87ce2d15d77072 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 27 Aug 2019 01:13:10 +0400 Subject: [PATCH 005/118] FS-11995: [mod_fifo, mod_directory] Fix database availability check. --- src/mod/applications/mod_directory/mod_directory.c | 4 ++-- src/mod/applications/mod_fifo/mod_fifo.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_directory/mod_directory.c b/src/mod/applications/mod_directory/mod_directory.c index 1e19adb6f7..3046558c5d 100644 --- a/src/mod/applications/mod_directory/mod_directory.c +++ b/src/mod/applications/mod_directory/mod_directory.c @@ -468,10 +468,10 @@ static switch_status_t load_config(switch_bool_t reload) char *val = (char *) switch_xml_attr_soft(param, "value"); if (!strcasecmp(var, "odbc-dsn") && !zstr(val)) { - if (switch_database_available(val)) { + if (switch_database_available(val) == SWITCH_STATUS_SUCCESS) { switch_set_string(globals.odbc_dsn, val); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DATABASE IS NOT AVAILABLE!\n"); } } else if (!strcasecmp(var, "dbname") && !zstr(val)) { globals.dbname = switch_core_strdup(globals.pool, val); diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 8749eb8486..1087427b36 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -4392,10 +4392,10 @@ static switch_status_t read_config_file(switch_xml_t *xml, switch_xml_t *cfg) { if (!strcasecmp(var, "outbound-strategy") && !zstr(val)) { globals.default_strategy = parse_strategy(val); } else if (!strcasecmp(var, "odbc-dsn") && !zstr(val)) { - if (switch_database_available(val)) { + if (switch_database_available(val) == SWITCH_STATUS_SUCCESS) { switch_set_string(globals.odbc_dsn, val); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DATABASE IS NOT AVAILABLE!\n"); } } else if (!strcasecmp(var, "dbname") && !zstr(val)) { globals.dbname = switch_core_strdup(globals.pool, val); From 44199e91b5319dc13424e1138ebc48c48423ed5d Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Tue, 27 Aug 2019 11:28:51 +0000 Subject: [PATCH 006/118] FS-12026 [mod_httapi] fix multichannel file download and play --- src/mod/applications/mod_httapi/mod_httapi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_httapi/mod_httapi.c b/src/mod/applications/mod_httapi/mod_httapi.c index fed78535e2..b0e4e4803c 100644 --- a/src/mod/applications/mod_httapi/mod_httapi.c +++ b/src/mod/applications/mod_httapi/mod_httapi.c @@ -3004,7 +3004,8 @@ static switch_status_t file_open(switch_file_handle_t *handle, const char *path, handle->seekable = context->fh.seekable; handle->speed = context->fh.speed; handle->interval = context->fh.interval; - handle->channels = context->fh.real_channels; + handle->channels = context->fh.channels; + handle->cur_channels = context->fh.real_channels; handle->flags |= SWITCH_FILE_NOMUX; if (switch_test_flag((&context->fh), SWITCH_FILE_NATIVE)) { From aaacaa19deb6ef764acdfabefb625f3ddc4e2324 Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Tue, 27 Aug 2019 11:30:05 +0000 Subject: [PATCH 007/118] FS-12026 [mod_http_cache] fix multichannel file download and play --- src/mod/applications/mod_http_cache/mod_http_cache.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/applications/mod_http_cache/mod_http_cache.c b/src/mod/applications/mod_http_cache/mod_http_cache.c index e3f8d06493..ca681d091d 100644 --- a/src/mod/applications/mod_http_cache/mod_http_cache.c +++ b/src/mod/applications/mod_http_cache/mod_http_cache.c @@ -1754,6 +1754,7 @@ static switch_status_t http_cache_file_open(switch_file_handle_t *handle, const handle->speed = context->fh.speed; handle->interval = context->fh.interval; handle->channels = context->fh.channels; + handle->cur_channels = context->fh.real_channels; handle->flags |= SWITCH_FILE_NOMUX; handle->pre_buffer_datalen = 0; From 4d4afbeb5d9a6aa2d8fced093aeba9b27c1e5623 Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Tue, 28 Mar 2017 14:50:22 +0100 Subject: [PATCH 008/118] FS-10191: don't send "video-floor-change" event for audio-only conference --- src/mod/applications/mod_conference/conference_loop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_conference/conference_loop.c b/src/mod/applications/mod_conference/conference_loop.c index 49377312c6..cf284ac2a6 100644 --- a/src/mod/applications/mod_conference/conference_loop.c +++ b/src/mod/applications/mod_conference/conference_loop.c @@ -1189,7 +1189,7 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob member->last_score = member->score; - if (member->id == member->conference->floor_holder) { + if ((switch_channel_test_flag(channel, CF_VIDEO) || member->avatar_png_img) && (member->id == member->conference->floor_holder)) { if (member->id != member->conference->video_floor_holder && (member->floor_packets > member->conference->video_floor_packets || member->energy_level == 0)) { conference_video_set_floor_holder(member->conference, member, SWITCH_FALSE); From d45e9df88349a26a18426fd98409845316d131fb Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 23 Aug 2019 12:16:22 +0400 Subject: [PATCH 009/118] FS-12025: [mod_spandsp] FreeSWITCH crashes on reloadxml when spandsp tone detection is running. --- .../applications/mod_spandsp/mod_spandsp.c | 2 +- .../applications/mod_spandsp/mod_spandsp.h | 1 + .../mod_spandsp/mod_spandsp_dsp.c | 65 +++++++++++++++++-- 3 files changed, 63 insertions(+), 5 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.c b/src/mod/applications/mod_spandsp/mod_spandsp.c index f674d14811..35d0cb585f 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp.c @@ -485,7 +485,7 @@ static void destroy_descriptor(void *ptr) { tone_descriptor_t *d = (tone_descriptor_t *) ptr; - super_tone_rx_free_descriptor(d->spandsp_tone_descriptor); + tone_descriptor_destroy(d); } switch_status_t load_configuration(switch_bool_t reload) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.h b/src/mod/applications/mod_spandsp/mod_spandsp.h index 7ffd334ef3..0863831b3c 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.h +++ b/src/mod/applications/mod_spandsp/mod_spandsp.h @@ -133,6 +133,7 @@ typedef struct tone_descriptor tone_descriptor_t; switch_status_t tone_descriptor_create(tone_descriptor_t **descriptor, const char *name, switch_memory_pool_t *memory_pool); +void tone_descriptor_destroy(tone_descriptor_t *descriptor); int tone_descriptor_add_tone(tone_descriptor_t *descriptor, const char *name); switch_status_t tone_descriptor_add_tone_element(tone_descriptor_t *descriptor, int tone_id, int freq1, int freq2, int min, int max); diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c index 9a43271c99..fca74635e8 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c @@ -637,6 +637,20 @@ switch_status_t tone_descriptor_create(tone_descriptor_t **descriptor, const cha return SWITCH_STATUS_SUCCESS; } +/** + * Destroy the tone descriptor + * + * @param descriptor the descriptor to create + * @return void + */ +void tone_descriptor_destroy(tone_descriptor_t *descriptor) +{ + if (descriptor->spandsp_tone_descriptor) { + super_tone_rx_free_descriptor(descriptor->spandsp_tone_descriptor); + descriptor->spandsp_tone_descriptor = NULL; + } +} + /** * Add a tone to the tone descriptor * @@ -711,6 +725,48 @@ static void tone_segment_callback(void *user_data, int f1, int f2, int duration) } } +/** + * Duplicate the tone descriptor + * + * @param descriptor the descriptor to use + * @param memory_pool the pool to use + * @return pointer to a copy of descriptor + */ +static tone_descriptor_t *tone_descriptor_dup(tone_descriptor_t *descriptor, switch_memory_pool_t *pool) +{ + tone_descriptor_t *desc = NULL; + int t = 0, s = 0, tone_count = 0; + + if (descriptor && pool) { + if (tone_descriptor_create(&desc, descriptor->name, pool) != SWITCH_STATUS_SUCCESS) { + return NULL; + } + + tone_count = descriptor->idx + 1; + + for (t = 0; t < tone_count; t++) { + int tone_id = tone_descriptor_add_tone(desc, descriptor->tone_keys[t]); + if (-1 != tone_id) { + int step = descriptor->spandsp_tone_descriptor->tone_segs[tone_id]; + for (s = 0; s < step; s++) { + super_tone_rx_segment_t segment = descriptor->spandsp_tone_descriptor->tone_list[tone_id][s]; + int f1 = (segment.f1 == -1 ? 0 : descriptor->spandsp_tone_descriptor->pitches[segment.f1][0]); + int f2 = (segment.f2 == -1 ? 0 : descriptor->spandsp_tone_descriptor->pitches[segment.f2][0]); + int min = segment.min_duration / 8; + int max = (segment.max_duration == 0x7FFFFFFF ? 0 : segment.max_duration / 8); + tone_descriptor_add_tone_element(desc, tone_id, f1, f2, min, max); + } + } else { + tone_descriptor_destroy(desc); + desc = NULL; + break; + } + } + } + + return desc; +} + /** * Allocate the tone detector * @@ -723,11 +779,8 @@ static void tone_segment_callback(void *user_data, int f1, int f2, int duration) static switch_status_t tone_detector_create(switch_core_session_t *session, tone_detector_t **detector, tone_descriptor_t *descriptor) { tone_detector_t *ldetector = switch_core_session_alloc(session, sizeof(tone_detector_t)); - tone_descriptor_t *desc = switch_core_session_alloc(session, sizeof(tone_descriptor_t)); - memcpy(desc, descriptor, sizeof(tone_descriptor_t)); - - ldetector->descriptor = desc; + ldetector->descriptor = tone_descriptor_dup(descriptor, switch_core_session_get_pool(session)); ldetector->debug = spandsp_globals.tonedebug; ldetector->session = session; *detector = ldetector; @@ -777,6 +830,10 @@ static void tone_detector_destroy(tone_detector_t *detector) super_tone_rx_free(detector->spandsp_detector); detector->spandsp_detector = NULL; } + if (detector->descriptor) { + tone_descriptor_destroy(detector->descriptor); + detector->descriptor = NULL; + } } } From f00d285b5eef6c697ba8bc3ecfde82fc7c2dba65 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 6 Sep 2019 17:50:16 +0400 Subject: [PATCH 010/118] FS-12039: [Core] Fix memory leak on ssl shutdown. --- src/switch_core_cert.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/switch_core_cert.c b/src/switch_core_cert.c index 5bcc046fe4..0cc992b9ed 100644 --- a/src/switch_core_cert.c +++ b/src/switch_core_cert.c @@ -91,6 +91,10 @@ SWITCH_DECLARE(void) switch_ssl_destroy_ssl_locks(void) OPENSSL_free(ssl_mutexes); ssl_count--; } + + if (ssl_pool) { + switch_core_destroy_memory_pool(&ssl_pool); + } } static const EVP_MD *get_evp_by_name(const char *name) From 7ee53a6ec1753204d5f17e1f7d2b9429b8ab1342 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 6 Sep 2019 18:01:55 +0400 Subject: [PATCH 011/118] FS-12040: [mod_sofia] Fix potential leak if realloc fails. --- src/mod/endpoints/mod_sofia/sofia.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 0b0b1b82a0..6e4727d51c 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -821,8 +821,13 @@ void sofia_handle_sip_i_notify(switch_core_session_t *session, int status, while ((call_info = call_info->ci_next) != NULL) { char *tmp = sip_header_as_string(nua_handle_home(nh), (void *) call_info); size_t tmp_len = strlen(tmp); - hold = realloc(hold, cur_len + tmp_len + 2); - switch_assert(hold); + char *tmp_hold = realloc(hold, cur_len + tmp_len + 2); + if (!tmp_hold) { + /* Avoid leak if realloc failed */ + free(hold); + } + switch_assert(tmp_hold); + hold = tmp_hold; strncpy(hold + cur_len, ",", 2); strncpy(hold + cur_len + 1, tmp, tmp_len +1); su_free(nua_handle_home(nh), tmp); From 20a893fd0683de64353ee2c111aa9c61a867886d Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 6 Sep 2019 17:02:52 +0400 Subject: [PATCH 012/118] FS-12038: [mod_sofia, core] Fix potential leak and race in chat_hash, add switch_core_hash_insert_auto_free(). --- src/include/switch_core.h | 10 ++++++++++ src/mod/endpoints/mod_sofia/mod_sofia.c | 11 ++--------- src/mod/endpoints/mod_sofia/sofia.c | 7 ++++--- src/mod/endpoints/mod_sofia/sofia_presence.c | 2 +- src/switch_core_hash.c | 9 +++++++++ 5 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 8dcea8acf3..bc7b70318b 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -1424,6 +1424,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_init_case(_Out_ switch_hash_t * */ SWITCH_DECLARE(switch_status_t) switch_core_hash_destroy(_Inout_ switch_hash_t **hash); +/*! + \brief Insert data into a hash and set flags so the value is automatically freed on delete + \param hash the hash to add data to + \param key the name of the key to add the data to + \param data the data to add + \return SWITCH_STATUS_SUCCESS if the data is added + \note the string key must be a constant or a dynamic string +*/ +SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_auto_free(switch_hash_t *hash, const char *key, const void *data); + /*! \brief Insert data into a hash \param hash the hash to add data to diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 848f1e6924..72ac5b01b9 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -360,7 +360,6 @@ switch_status_t sofia_on_destroy(switch_core_session_t *session) { private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session); switch_channel_t *channel = switch_core_session_get_channel(session); - char *uuid; switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s SOFIA DESTROY\n", switch_channel_get_name(channel)); @@ -376,13 +375,7 @@ switch_status_t sofia_on_destroy(switch_core_session_t *session) } if (!zstr(tech_pvt->call_id)) { - switch_mutex_lock(tech_pvt->profile->flag_mutex); - if ((uuid = switch_core_hash_find(tech_pvt->profile->chat_hash, tech_pvt->call_id))) { - free(uuid); - uuid = NULL; - switch_core_hash_delete(tech_pvt->profile->chat_hash, tech_pvt->call_id); - } - switch_mutex_unlock(tech_pvt->profile->flag_mutex); + switch_core_hash_delete_locked(tech_pvt->profile->chat_hash, tech_pvt->call_id, tech_pvt->profile->flag_mutex); } @@ -461,7 +454,7 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session) switch_channel_get_name(channel), switch_channel_cause2str(cause)); if (tech_pvt->hash_key && !sofia_test_pflag(tech_pvt->profile, PFLAG_DESTROY)) { - switch_core_hash_delete(tech_pvt->profile->chat_hash, tech_pvt->hash_key); + switch_core_hash_delete_locked(tech_pvt->profile->chat_hash, tech_pvt->hash_key, tech_pvt->profile->flag_mutex); } if (session && tech_pvt->profile->pres_type) { diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 0b0b1b82a0..5c3a781153 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2430,7 +2430,7 @@ void sofia_event_callback(nua_event_t event, tech_pvt->nh = NULL; sofia_set_flag(tech_pvt, TFLAG_BYE); switch_mutex_lock(profile->flag_mutex); - switch_core_hash_insert(profile->chat_hash, tech_pvt->call_id, strdup(switch_core_session_get_uuid(session))); + switch_core_hash_insert_auto_free(profile->chat_hash, tech_pvt->call_id, strdup(switch_core_session_get_uuid(session))); switch_mutex_unlock(profile->flag_mutex); nua_handle_destroy(nh); } else { @@ -2519,10 +2519,11 @@ void sofia_event_callback(nua_event_t event, if (sip->sip_call_id && sip->sip_call_id->i_id) { - char *uuid; + char *uuid = NULL, *tmp; switch_mutex_lock(profile->flag_mutex); - if ((uuid = (char *) switch_core_hash_find(profile->chat_hash, sip->sip_call_id->i_id))) { + if ((tmp = (char *) switch_core_hash_find(profile->chat_hash, sip->sip_call_id->i_id))) { + uuid = strdup(tmp); switch_core_hash_delete(profile->chat_hash, sip->sip_call_id->i_id); } switch_mutex_unlock(profile->flag_mutex); diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index de3d360703..6e5d15b381 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -5000,7 +5000,7 @@ void sofia_presence_handle_sip_i_message(int status, abort(); } - if (sofia_test_pflag(profile, PFLAG_IN_DIALOG_CHAT) && (tech_pvt = (private_object_t *) switch_core_hash_find(profile->chat_hash, hash_key))) { + if (sofia_test_pflag(profile, PFLAG_IN_DIALOG_CHAT) && (tech_pvt = (private_object_t *) switch_core_hash_find_locked(profile->chat_hash, hash_key, profile->flag_mutex))) { switch_core_session_queue_event(tech_pvt->session, &event); } else { switch_core_chat_send(proto, event); diff --git a/src/switch_core_hash.c b/src/switch_core_hash.c index a81747bb9f..1655aac726 100644 --- a/src/switch_core_hash.c +++ b/src/switch_core_hash.c @@ -55,6 +55,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_destroy(switch_hash_t **hash) return SWITCH_STATUS_SUCCESS; } +SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_auto_free(switch_hash_t *hash, const char *key, const void *data) +{ + int r = 0; + + r = switch_hashtable_insert_destructor(hash, strdup(key), (void *)data, HASHTABLE_FLAG_FREE_KEY | HASHTABLE_FLAG_FREE_VALUE | HASHTABLE_DUP_CHECK, NULL); + + return r ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; +} + SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_destructor(switch_hash_t *hash, const char *key, const void *data, hashtable_destructor_t destructor) { int r = 0; From 70831a7140343cd4bf9ae76337458a0644dde103 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Sat, 7 Sep 2019 03:10:20 +0400 Subject: [PATCH 013/118] FS-12041: [Core] Fix memory leak on msrp shutdown --- src/switch_msrp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/switch_msrp.c b/src/switch_msrp.c index 6cf2974d3e..bc680d11ca 100644 --- a/src/switch_msrp.c +++ b/src/switch_msrp.c @@ -108,6 +108,10 @@ static void msrp_deinit_ssl() SSL_CTX_free(globals.ssl_ctx); globals.ssl_ctx = NULL; } + if (globals.ssl_client_ctx) { + SSL_CTX_free(globals.ssl_client_ctx); + globals.ssl_client_ctx = NULL; + } } static void msrp_init_ssl() From 583bf0441d8d6730d4570cad9cc6f93d3c955394 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Mon, 9 Sep 2019 20:48:13 +0400 Subject: [PATCH 014/118] FS-12042: [sofia-sip] Fix typo in sresolv. --- libs/sofia-sip/.update | 2 +- libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index 8fcd3faae4..3f2302fd37 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Mon Aug 19 16:25:57 CDT 2019 +Mon Sep 09 11:45:57 CDT 2019 diff --git a/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c b/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c index bc03a69cfb..9dd0e3f347 100644 --- a/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c +++ b/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c @@ -904,7 +904,7 @@ sres_sip_log_answers(sres_sip_t *srs, SU_DEBUG_5(("srs(%p): %s IN CNAME %s\n", (void *)srs, domain, cname)); } #if SU_HAVE_IN6 - else if (type == sres_type_cname) { + else if (type == sres_type_aaaa) { sres_aaaa_record_t const *aaaa = sr->sr_aaaa; su_inet_ntop(AF_INET6, &aaaa->aaaa_addr, addr, sizeof(addr)); SU_DEBUG_5(("srs(%p): %s IN AAAA %s\n", (void *)srs, domain, addr)); From 6704d3aabeacdfa9a652f700379b072b6166f5a0 Mon Sep 17 00:00:00 2001 From: Sergey Safarov Date: Mon, 8 Jul 2019 14:19:03 +0300 Subject: [PATCH 015/118] FS-11917: [mod_event_socket] Added error logging if cannot parse IP address --- src/mod/event_handlers/mod_event_socket/mod_event_socket.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index f0137412d8..23915d4a37 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -2934,8 +2934,10 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_socket_runtime) while (!prefs.done) { rv = switch_sockaddr_info_get(&sa, prefs.ip, SWITCH_UNSPEC, prefs.port, 0, pool); - if (rv) + if (rv) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot get information about IP address %s\n", prefs.ip); goto fail; + } rv = switch_socket_create(&listen_list.sock, switch_sockaddr_get_family(sa), SOCK_STREAM, SWITCH_PROTO_TCP, pool); if (rv) goto sock_fail; From 1711450e98e6c2da9777de2476f03e5890db7bae Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 24 Sep 2019 22:14:35 +0400 Subject: [PATCH 016/118] Add initial README.md --- README.md | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000000..814c2cd92d --- /dev/null +++ b/README.md @@ -0,0 +1,63 @@ +# FreeSWITCH + +FreeSWITCH is a Software Defined Telecom Stack enabling the digital transformation from proprietary telecom switches to a versatile software implementation that runs on any commodity hardware. From a Raspberry PI to a multi-core server, FreeSWITCH can unlock the telecommunications potential of any device. Combined with our hosted cloud platform, SignalWire, FreeSWITCH can interconnect with the outside world and scale to any size. + +Visit [https://signalwire.com](https://signalwire.com/) or https://github.com/signalwire for more info. + +## Getting Started + +FreeSWITCH is available on [Github](https://github.com/signalwire/freeswitch) in source code format. You can checkout the development branch and build for many poplular platforms including Linux, Windows, MacOSX and BSD. There is an issue tracker and pull request system available as part of the repo online. + +See [https://freeswitch.com/#getting-started](https://freeswitch.com/#getting-started) for more detailed instructions. + +## Additional Help + +If you need assistance or have an interest in using a commercially supported build, you can contact coreteam@freeswitch.com to learn about professional services to support your project. + +## Voice-over-IP services - SIP / SMS - App Integrations + +[SignalWire](https://signalwire.com) is the primary sponsor of the FreeSWITCH project and was founded by the original developers of FreeSWITCH. SignalWire provides scalable services to enhance and scale your project such as SMS, SIP, Serverless Application hosting as well as programmable telecom. mod_signalwire which is distributed in this code base allows you to instantly pair with SignalWire and extend your FreeSWITCH. + +## Documentation + +The main index for documentation is available at: + + * https://freeswitch.org/confluence/ + +### Release notes: + + * https://freeswitch.org/confluence/display/FREESWITCH/Release+Notes + +### Installation + +Step by step tutorials to install FreeSWITCH from packages or source code are available at: + + * [Debian 10 Buster](https://freeswitch.org/confluence/display/FREESWITCH/Debian+10+Buster) [Recommended] + * [Raspberry Pi](https://freeswitch.org/confluence/display/FREESWITCH/Raspberry+Pi) + * [CentOS 7](https://freeswitch.org/confluence/display/FREESWITCH/CentOS+7+and+RHEL+7) + +## Downloads + + * [Tarballs](https://files.freeswitch.org/releases/freeswitch/) + * [Windows Installer](http://files.freeswitch.org/windows/installer/x64/) + * [Windows Sound Packages](http://files.freeswitch.org/windows/installer/x64/sounds/) + +## Contributions + +GitHub pull requests are the recommended way to contribute to the FreeSWITCH source code: + + * https://github.com/signalwire/freeswitch/pulls + +## Community + +Slack is our chat system where the developers, the FreeSWITCH team, and the most active users are present. +This is the place to get answers faster and chat with other users in real time. All you need to do is enter your email and verify it on the Slack signup page and you are ready to join in the discussion! + +Slack Community: + * https://goo.gl/eqdXBC + +Mailing list: + + * http://lists.freeswitch.org/mailman/listinfo/freeswitch-users + +**Thank you for using FreeSWITCH!** \ No newline at end of file From 65c4ca072de5e4c706ae4f24702219ef57bfe9dd Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 1 Oct 2019 12:14:56 +0400 Subject: [PATCH 017/118] [mod_av] Fix crash on `av show codecs` and `av show formats`. --- src/mod/applications/mod_av/avcodec.c | 16 ++++++++-------- src/mod/applications/mod_av/avformat.c | 3 ++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/mod/applications/mod_av/avcodec.c b/src/mod/applications/mod_av/avcodec.c index 0812fabbb3..4de116fec9 100644 --- a/src/mod/applications/mod_av/avcodec.c +++ b/src/mod/applications/mod_av/avcodec.c @@ -1836,15 +1836,13 @@ static char get_media_type_char(enum AVMediaType type) } } -static const AVCodec *next_codec_for_id(enum AVCodecID id, const AVCodec *prev, +static const AVCodec *next_codec_for_id(enum AVCodecID id, const AVCodec *prev, void **index, int encoder) { #if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58,10,100)) while ((prev = av_codec_next(prev))) { #else - void *i; - - while ((prev = av_codec_iterate(&i))) { + while ((prev = av_codec_iterate(index))) { #endif if (prev->id == id && (encoder ? av_codec_is_encoder(prev) : av_codec_is_decoder(prev))) @@ -1887,10 +1885,11 @@ static unsigned get_codecs_sorted(const AVCodecDescriptor ***rcodecs) static void print_codecs_for_id(switch_stream_handle_t *stream, enum AVCodecID id, int encoder) { const AVCodec *codec = NULL; + void *index = 0; stream->write_function(stream, " (%s: ", encoder ? "encoders" : "decoders"); - while ((codec = next_codec_for_id(id, codec, encoder))) { + while ((codec = next_codec_for_id(id, codec, &index, encoder))) { stream->write_function(stream, "%s ", codec->name); } @@ -1916,6 +1915,7 @@ void show_codecs(switch_stream_handle_t *stream) for (i = 0; i < nb_codecs; i++) { const AVCodecDescriptor *desc = codecs[i]; const AVCodec *codec = NULL; + void *index = 0; stream->write_function(stream, " "); stream->write_function(stream, avcodec_find_decoder(desc->id) ? "D" : "."); @@ -1930,14 +1930,14 @@ void show_codecs(switch_stream_handle_t *stream) /* print decoders/encoders when there's more than one or their * names are different from codec name */ - while ((codec = next_codec_for_id(desc->id, codec, 0))) { + while ((codec = next_codec_for_id(desc->id, codec, &index, 0))) { if (strcmp(codec->name, desc->name)) { print_codecs_for_id(stream ,desc->id, 0); break; } } - codec = NULL; - while ((codec = next_codec_for_id(desc->id, codec, 1))) { + codec = NULL; index = 0; + while ((codec = next_codec_for_id(desc->id, codec, &index, 1))) { if (strcmp(codec->name, desc->name)) { print_codecs_for_id(stream, desc->id, 1); break; diff --git a/src/mod/applications/mod_av/avformat.c b/src/mod/applications/mod_av/avformat.c index 986bfed125..2e0c7de7ab 100644 --- a/src/mod/applications/mod_av/avformat.c +++ b/src/mod/applications/mod_av/avformat.c @@ -1029,7 +1029,7 @@ void show_formats(switch_stream_handle_t *stream) { #if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(58,9,100)) while ((ofmt = av_oformat_next(ofmt))) { #else - void *i; + void *i = 0; while ((ofmt = av_muxer_iterate(&i))) { #endif @@ -1047,6 +1047,7 @@ void show_formats(switch_stream_handle_t *stream) { #if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(58,9,100)) while ((ifmt = av_iformat_next(ifmt))) { #else + i = 0; while ((ifmt = av_demuxer_iterate(&i))) { #endif is_dev = is_device(ifmt->priv_class); From 9de281133aae5369ba56b5fcf3bd08ed0215d6e7 Mon Sep 17 00:00:00 2001 From: David VILLAUME Date: Tue, 1 Oct 2019 17:07:29 +0200 Subject: [PATCH 018/118] [mod_say_fr] Fix "10" not playing in French. --- src/mod/say/mod_say_fr/mod_say_fr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/say/mod_say_fr/mod_say_fr.c b/src/mod/say/mod_say_fr/mod_say_fr.c index ba34647c85..5e96417827 100644 --- a/src/mod/say/mod_say_fr/mod_say_fr.c +++ b/src/mod/say/mod_say_fr/mod_say_fr.c @@ -119,7 +119,7 @@ static switch_status_t play_group(switch_say_method_t method, switch_say_gender_ } } - if (c || ((ftdNumber == 1 && (a || b || c)) && (a && (b || c)))) { + if (c || ((ftdNumber == 1 && (a || b || c)) && (a && (b || c))) || (a == 0 && b == 1 && c == 0) ) { /*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "a=%d b=[%d] c=%d\n",a, b,c);*/ int fVal = c; if (ftdNumber == 1) From dbec99887359e63783812b72993bc5b3abd3bf86 Mon Sep 17 00:00:00 2001 From: Mike Jerris Date: Tue, 1 Oct 2019 09:57:25 -0600 Subject: [PATCH 019/118] [build/docs] point all old stash references in docs and makefiles to new github repository --- Makefile.am | 2 +- build/Makefile.centos5 | 2 +- build/Makefile.centos6 | 2 +- build/Makefile.openbsd | 2 +- build/Makefile.solaris11 | 2 +- debian/README.source | 2 +- debian/bootstrap.sh | 4 ++-- docker/base_image/README.md | 4 ++-- docs/SubmittingPatches | 12 ++++++------ html5/verto/verto_communicator/package.json | 2 +- scripts/FreeSWITCH-debian-raspbian-installer.sh | 4 ++-- scripts/debian_min_build.sh | 2 +- 12 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Makefile.am b/Makefile.am index 2d144ce233..f832dd52aa 100644 --- a/Makefile.am +++ b/Makefile.am @@ -684,7 +684,7 @@ is-scm: echo ; echo ; \ echo "*****************************************************************************************************" ; \ echo "You cannot update a release tarball without a git tree. Please clone FreeSWITCH as so: " ; \ - echo " git clone https://freeswitch.org/stash/scm/fs/freeswitch.git " ; \ + echo " git clone https://github.com/signalwire/freeswitch.git " ; \ echo "*****************************************************************************************************" ; \ echo ; echo ; \ exit 1; \ diff --git a/build/Makefile.centos5 b/build/Makefile.centos5 index cddd8f29ee..92dc5467a8 100644 --- a/build/Makefile.centos5 +++ b/build/Makefile.centos5 @@ -29,7 +29,7 @@ freeswitch.git/configure: freeswitch.git/bootstrap.sh cd freeswitch.git && sh bootstrap.sh freeswitch.git/bootstrap.sh: has-git - test -d freeswitch.git || git clone https://freeswitch.org/stash/scm/fs/freeswitch.git freeswitch.git + test -d freeswitch.git || git clone https://github.com/signalwire/freeswitch.git freeswitch.git install: freeswitch cd freeswitch.git && make install cd-sounds-install cd-moh-install diff --git a/build/Makefile.centos6 b/build/Makefile.centos6 index 582c3192da..327c2e6454 100644 --- a/build/Makefile.centos6 +++ b/build/Makefile.centos6 @@ -19,7 +19,7 @@ freeswitch.git/configure: freeswitch.git/bootstrap.sh cd freeswitch.git && sh bootstrap.sh freeswitch.git/bootstrap.sh: has-git - test -d freeswitch.git || git clone https://freeswitch.org/stash/scm/fs/freeswitch.git freeswitch.git + test -d freeswitch.git || git clone https://github.com/signalwire/freeswitch.git freeswitch.git rpmforge: (which rpm && rpm -i http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm) || true diff --git a/build/Makefile.openbsd b/build/Makefile.openbsd index c916ae0334..f23dff4075 100644 --- a/build/Makefile.openbsd +++ b/build/Makefile.openbsd @@ -24,7 +24,7 @@ freeswitch.git/configure: freeswitch.git/bootstrap.sh cd freeswitch.git && AUTOCONF_VERSION=2.69 AUTOMAKE_VERSION=1.14 LIBTOOL=/usr/local/bin/libtoolize sh bootstrap.sh freeswitch.git/bootstrap.sh: has-git - test -d freeswitch.git || git clone https://freeswitch.org/stash/scm/fs/freeswitch.git freeswitch.git + test -d freeswitch.git || git clone https://github.com/signalwire/freeswitch.git freeswitch.git install: cd freeswitch.git && AUTOCONF_VERSION=2.69 AUTOMAKE_VERSION=1.14 LIBTOOL=/usr/local/bin/libtoolize gmake install cd-sounds-install cd-moh-install diff --git a/build/Makefile.solaris11 b/build/Makefile.solaris11 index 749773ffc3..dd35215961 100644 --- a/build/Makefile.solaris11 +++ b/build/Makefile.solaris11 @@ -31,7 +31,7 @@ freeswitch.git/configure: freeswitch.git/bootstrap.sh cd freeswitch.git && sh bootstrap.sh freeswitch.git/bootstrap.sh: has-git - test -d freeswitch.git || git clone https://freeswitch.org/stash/scm/fs/freeswitch.git freeswitch.git + test -d freeswitch.git || git clone https://github.com/signalwire/freeswitch.git freeswitch.git install: freeswitch cd freeswitch.git && gmake install cd-sounds-install cd-moh-install diff --git a/debian/README.source b/debian/README.source index 945f15125f..f1d4cff376 100644 --- a/debian/README.source +++ b/debian/README.source @@ -18,7 +18,7 @@ of a FreeSWITCH git repository. You can achieve this with: aptitude update && aptitude install -y git mkdir -p /usr/src/freeswitch - git clone https://freeswitch.org/stash/scm/fs/freeswitch.git /usr/src/freeswitch/src + git clone https://github.com/signalwire/freeswitch.git /usr/src/freeswitch/src cd /usr/src/freeswitch/src Ensuring you have a clean build directory diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 325265e39d..9ca918bc03 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -338,8 +338,8 @@ Build-Depends: $(debian_wrap "${mod_build_depends}") Standards-Version: 3.9.3 Homepage: https://freeswitch.org/ -Vcs-Git: https://freeswitch.org/stash/scm/fs/freeswitch.git -Vcs-Browser: https://freeswitch.org/stash/projects/FS/repos/freeswitch/browse +Vcs-Git: https://github.com/signalwire/freeswitch.git +Vcs-Browser: https://github.com/signalwire/freeswitch EOF } diff --git a/docker/base_image/README.md b/docker/base_image/README.md index 222fab6c39..75e6e02dae 100644 --- a/docker/base_image/README.md +++ b/docker/base_image/README.md @@ -85,7 +85,7 @@ apt-get install freeswitch-conf-vanilla ``` 2) clone freeswitch repo ```sh -git clone https://freeswitch.org/stash/projects/FS/repos/freeswitch/browse +git clone https://github.com/signalwire/freeswitch.git ``` 3) execute ```make_min_archive.sh``` script ```sh @@ -100,4 +100,4 @@ docker build -t freeswitch_custom . Read more --------- -[Dockerfile of official FreeSwitch container](https://freeswitch.org/stash/projects/FS/repos/freeswitch/browse/docker/release) +[Dockerfile of official FreeSwitch container](https://github.com/signalwire/freeswitch/tree/master/docker/release) diff --git a/docs/SubmittingPatches b/docs/SubmittingPatches index 2f0601926e..e98372f7e6 100644 --- a/docs/SubmittingPatches +++ b/docs/SubmittingPatches @@ -4,7 +4,7 @@ How to Contribute Patches to FreeSWITCH Download the Source Code ------------------------ - git clone https://freeswitch.org/stash/scm/fs/freeswitch.git + git clone https://github.com/signalwire/freeswitch.git cd freeswitch Ensure Git is Setup @@ -42,18 +42,18 @@ Create a Pull Request # create an account in JIRA and create a new issue - # navigate to FreeSWITCH Stash - chromium https://freeswitch.org/stash + # navigate to FreeSWITCH github + chromium https://github.com/signalwire/freeswitch - # Using the same credentials as Jira, login to Stash; create a forked FS repository; read + # Using your github credentials, login to github; create a forked FS repository; read # the details here: chromium https://freeswitch.org/confluence/display/FREESWITCH/Pull+Requests # add your repository as a remote (change to your username) - git remote add stash ssh://git@freeswitch.org:7999/~johndoe/freeswitch.git + git remote add fs git@github.com:signalwire/freeswitch.git # push your changes to a branch - git push stash +HEAD:myfeature + git push fs +HEAD:myfeature # create a pull request as described here: chromium https://freeswitch.org/confluence/display/FREESWITCH/Pull+Requests diff --git a/html5/verto/verto_communicator/package.json b/html5/verto/verto_communicator/package.json index 28b4d9536a..902c5f0d6d 100644 --- a/html5/verto/verto_communicator/package.json +++ b/html5/verto/verto_communicator/package.json @@ -35,6 +35,6 @@ }, "repository": { "type": "git", - "url": "https://freeswitch.org/stash/scm/fs/freeswitch.git" + "url": "https://github.com/signalwire/freeswitch.git" } } diff --git a/scripts/FreeSWITCH-debian-raspbian-installer.sh b/scripts/FreeSWITCH-debian-raspbian-installer.sh index d91a1d8129..e40983783b 100755 --- a/scripts/FreeSWITCH-debian-raspbian-installer.sh +++ b/scripts/FreeSWITCH-debian-raspbian-installer.sh @@ -133,10 +133,10 @@ config_fs_repos() { curl https://files.freeswitch.org/repo/deb/debian/freeswitch_archive_g0.pub | apt-key add - if [ "$FS_REV" = "master" ]; then echo "deb http://files.freeswitch.org/repo/deb/debian-unstable/ jessie main" >/etc/apt/sources.list.d/freeswitch.list - REPO="https://freeswitch.org/stash/scm/fs/freeswitch.git" + REPO="https://github.com/signalwire/freeswitch.git" elif [ "$FS_REV" = "1.6" ]; then echo "deb http://files.freeswitch.org/repo/deb/freeswitch-1.6/ jessie main" > /etc/apt/sources.list.d/freeswitch.list - REPO="-b v1.6 https://silik0n@freeswitch.org/stash/scm/fs/freeswitch.git" + REPO="-b v1.6 https://github.com/signalwire/freeswitch.git" fi apt-get update 2>&1 >/dev/null } diff --git a/scripts/debian_min_build.sh b/scripts/debian_min_build.sh index f900c3a9a6..953f3840ad 100755 --- a/scripts/debian_min_build.sh +++ b/scripts/debian_min_build.sh @@ -12,7 +12,7 @@ apt-get update && apt-get install -y libtool libjpeg62-turbo-dev ntpdate libfree cd /usr/src -git clone https://freeswitch.org/stash/scm/fs/freeswitch.git freeswitch.git +git clone https://github.com/signalwire/freeswitch.git freeswitch.git cd freeswitch.git From 1b04ffe5359c526876461c47e0cd66b013e2a7a3 Mon Sep 17 00:00:00 2001 From: Mitch Capper Date: Tue, 1 Oct 2019 14:25:31 -0700 Subject: [PATCH 020/118] Updated slack community link to the current (working) join link as old one expired. Closes #29 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 814c2cd92d..77de167e3e 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Slack is our chat system where the developers, the FreeSWITCH team, and the most This is the place to get answers faster and chat with other users in real time. All you need to do is enter your email and verify it on the Slack signup page and you are ready to join in the discussion! Slack Community: - * https://goo.gl/eqdXBC + * https://signalwire.community/ Mailing list: From d60193c1aee826a1f53b33ca01207e301d1b1fe2 Mon Sep 17 00:00:00 2001 From: cdosoftei Date: Wed, 2 Oct 2019 14:05:58 -0400 Subject: [PATCH 021/118] ESL adjustments for PHP 7+ --- configure.ac | 2 +- libs/esl/php/ESL.php | 2 +- libs/esl/php/Makefile.am | 2 +- libs/esl/php/esl_wrap.cpp | 1829 +++++++++++++++++-------------------- libs/esl/php/php_ESL.h | 14 +- 5 files changed, 837 insertions(+), 1012 deletions(-) diff --git a/configure.ac b/configure.ac index 1d9c27eebd..3e7aa0e0b2 100644 --- a/configure.ac +++ b/configure.ac @@ -1661,7 +1661,7 @@ if test "x$ac_cv_have_php" != "xno" -a "x$ac_cv_have_php_config" != "xno"; then PHP=php PHP_CONFIG=php-config PHP_LDFLAGS="`$PHP_CONFIG --ldflags`" - PHP_LIBS="`$PHP_CONFIG --libs | sed -r 's/ ?-l(bz2|pcre|xml2|gssapi_krb5|krb5|k5crypto|com_err|history|z|readline|gmp|ssl|crypto)//g'`" + PHP_LIBS="`$PHP_CONFIG --libs | sed -r 's/ ?-l(bz2|pcre2-8|xml2|gssapi_krb5|krb5|k5crypto|com_err|history|z|readline|gmp|ssl|crypto|argon2|sodium)//g'`" PHP_EXT_DIR="`$PHP_CONFIG --extension-dir`" PHP_INC_DIR="`$PHP -r 'echo ini_get("include_path");' | cut -d: -f2`" PHP_INI_DIR="`$PHP_CONFIG --configure-options | tr " " "\n" | grep -- --with-config-file-scan-dir | cut -f2 -d=`" diff --git a/libs/esl/php/ESL.php b/libs/esl/php/ESL.php index 4ac5499c32..e3858c8765 100644 --- a/libs/esl/php/ESL.php +++ b/libs/esl/php/ESL.php @@ -2,7 +2,7 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 3.0.2 + * Version 3.0.12 * * 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 diff --git a/libs/esl/php/Makefile.am b/libs/esl/php/Makefile.am index bdcd272580..bafc3f8764 100644 --- a/libs/esl/php/Makefile.am +++ b/libs/esl/php/Makefile.am @@ -3,7 +3,7 @@ WRAP_GCC_WARNING_SILENCE=-Wno-unused-label -Wno-unused-function all: ESL.so esl_wrap.cpp: - swig3.0 -module ESL -php5 -c++ -DMULTIPLICITY -I../src/include -o esl_wrap.cpp ../ESL.i + swig3.0 -module ESL -php7 -c++ -DMULTIPLICITY -I../src/include -o esl_wrap.cpp ../ESL.i sed -e 's/ char \*type_name;/ const char \*type_name;/' -i esl_wrap.cpp esl_wrap.o: esl_wrap.cpp diff --git a/libs/esl/php/esl_wrap.cpp b/libs/esl/php/esl_wrap.cpp index 75566f9532..7c8a88b2f7 100644 --- a/libs/esl/php/esl_wrap.cpp +++ b/libs/esl/php/esl_wrap.cpp @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 3.0.2 + * Version 3.0.12 * * 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 @@ -8,7 +8,10 @@ * interface file instead. * ----------------------------------------------------------------------------- */ + +#ifndef SWIGPHP #define SWIGPHP +#endif #define SWIG_PREFIX "" #define SWIG_PREFIX_LEN 0 @@ -103,9 +106,11 @@ template T SwigValueInit() { #endif /* exporting methods */ -#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) -# ifndef GCC_HASCLASSVISIBILITY -# define GCC_HASCLASSVISIBILITY +#if defined(__GNUC__) +# if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif # endif #endif @@ -144,6 +149,19 @@ template T SwigValueInit() { # define _SCL_SECURE_NO_DEPRECATE #endif +/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */ +#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES) +# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 +#endif + +/* Intel's compiler complains if a variable which was never initialised is + * cast to void, which is a common idiom which we use to indicate that we + * are aware a variable isn't used. So we just silence that warning. + * See: https://github.com/swig/swig/issues/192 for more discussion. + */ +#ifdef __INTEL_COMPILER +# pragma warning disable 592 +#endif /* ----------------------------------------------------------------------------- * swigrun.swg @@ -642,16 +660,16 @@ SWIG_UnpackData(const char *c, void *ptr, size_t sz) { char d = *(c++); unsigned char uu; if ((d >= '0') && (d <= '9')) - uu = ((d - '0') << 4); + uu = (unsigned char)((d - '0') << 4); else if ((d >= 'a') && (d <= 'f')) - uu = ((d - ('a'-10)) << 4); + uu = (unsigned char)((d - ('a'-10)) << 4); else return (char *) 0; d = *(c++); if ((d >= '0') && (d <= '9')) - uu |= (d - '0'); + uu |= (unsigned char)(d - '0'); else if ((d >= 'a') && (d <= 'f')) - uu |= (d - ('a'-10)); + uu |= (unsigned char)(d - ('a'-10)); else return (char *) 0; *u = uu; @@ -731,61 +749,31 @@ extern "C" { #include "zend_API.h" #include "zend_exceptions.h" #include "php.h" + +#if PHP_MAJOR_VERSION != 7 +# error These bindings need PHP7 - to generate PHP5 bindings use: swig -php5 +#endif + #include "ext/standard/php_string.h" #include /* for abort(), used in generated code. */ -#ifdef ZEND_RAW_FENTRY -/* ZEND_RAW_FENTRY was added somewhere between 5.2.0 and 5.2.3 */ -# define SWIG_ZEND_NAMED_FE(ZN, N, A) ZEND_RAW_FENTRY((char*)#ZN, N, A, 0) -#else -/* This causes warnings from GCC >= 4.2 (assigning a string literal to char*). - * But this seems to be unavoidable without directly assuming knowledge of - * the structure, which changed between PHP4 and PHP5. */ -# define SWIG_ZEND_NAMED_FE(ZN, N, A) ZEND_NAMED_FE(ZN, N, A) -#endif +/* This indirection is to work around const correctness issues in older PHP. + * FIXME: Remove for PHP7? Or might user code be using it? */ +#define SWIG_ZEND_NAMED_FE(ZN, N, A) ZEND_NAMED_FE(ZN, N, A) -#ifndef Z_SET_ISREF_P -/* For PHP < 5.3 */ -# define Z_SET_ISREF_P(z) (z)->is_ref = 1 -#endif -#ifndef Z_SET_REFCOUNT_P -/* For PHP < 5.3 */ -# define Z_SET_REFCOUNT_P(z, rc) (z)->refcount = (rc) -#endif - -#define SWIG_LONG_CONSTANT(N, V) zend_register_long_constant((char*)#N, sizeof(#N), V, CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC) -#define SWIG_DOUBLE_CONSTANT(N, V) zend_register_double_constant((char*)#N, sizeof(#N), V, CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC) -#define SWIG_STRING_CONSTANT(N, V) zend_register_stringl_constant((char*)#N, sizeof(#N), (char*)(V), strlen(V), CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC) +#define SWIG_BOOL_CONSTANT(N, V) REGISTER_BOOL_CONSTANT(#N, V, CONST_CS | CONST_PERSISTENT) +#define SWIG_LONG_CONSTANT(N, V) REGISTER_LONG_CONSTANT(#N, V, CONST_CS | CONST_PERSISTENT) +#define SWIG_DOUBLE_CONSTANT(N, V) REGISTER_DOUBLE_CONSTANT(#N, V, CONST_CS | CONST_PERSISTENT) +#define SWIG_STRING_CONSTANT(N, V) REGISTER_STRING_CONSTANT(#N, (char*)V, CONST_CS | CONST_PERSISTENT) #define SWIG_CHAR_CONSTANT(N, V) do {\ - static char swig_char = (V);\ - zend_register_stringl_constant((char*)#N, sizeof(#N), &swig_char, 1, CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC);\ + char swig_char = (V);\ + REGISTER_STRINGL_CONSTANT(#N, &swig_char, 1, CONST_CS | CONST_PERSISTENT);\ } while (0) -/* These TSRMLS_ stuff should already be defined now, but with older php under - redhat are not... */ -#ifndef TSRMLS_D -#define TSRMLS_D -#endif -#ifndef TSRMLS_DC -#define TSRMLS_DC -#endif -#ifndef TSRMLS_C -#define TSRMLS_C -#endif -#ifndef TSRMLS_CC -#define TSRMLS_CC -#endif - #ifdef __cplusplus } #endif -/* But in fact SWIG_ConvertPtr is the native interface for getting typed - pointer values out of zvals. We need the TSRMLS_ macros for when we - make PHP type calls later as we handle php resources */ -#define SWIG_ConvertPtr(obj,pp,type,flags) SWIG_ZTS_ConvertPtr(obj,pp,type,flags TSRMLS_CC) - - #define SWIG_fail goto fail static const char *default_error_msg = "Unknown error occurred"; @@ -809,14 +797,10 @@ typedef struct { int newobject; } swig_object_wrapper; -/* empty zend destructor for types without one */ -static ZEND_RSRC_DTOR_FUNC(SWIG_landfill) { (void)rsrc; } - -#define SWIG_SetPointerZval(a,b,c,d) SWIG_ZTS_SetPointerZval(a,b,c,d TSRMLS_CC) #define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) static void -SWIG_ZTS_SetPointerZval(zval *z, void *ptr, swig_type_info *type, int newobject TSRMLS_DC) { +SWIG_SetPointerZval(zval *z, void *ptr, swig_type_info *type, int newobject) { /* * First test for Null pointers. Return those as PHP native NULL */ @@ -833,19 +817,19 @@ SWIG_ZTS_SetPointerZval(zval *z, void *ptr, swig_type_info *type, int newobject value->newobject=(newobject & 1); if ((newobject & 2) == 0) { /* Just register the pointer as a resource. */ - ZEND_REGISTER_RESOURCE(z, value, *(int *)(type->clientdata)); + ZVAL_RES(z, zend_register_resource(value, *(int *)(type->clientdata))); } else { /* * Wrap the resource in an object, the resource will be accessible * via the "_cPtr" member. This is currently only used by * directorin typemaps. */ - zval *resource; - zend_class_entry **ce = NULL; + zval resource; + zend_class_entry *ce = NULL; const char *type_name = type->name+3; /* +3 so: _p_Foo -> Foo */ size_t type_name_len; - int result; const char * p; + HashTable * ht; /* Namespace__Foo -> Foo */ /* FIXME: ugly and goes wrong for classes with __ in their names. */ @@ -854,26 +838,27 @@ SWIG_ZTS_SetPointerZval(zval *z, void *ptr, swig_type_info *type, int newobject } type_name_len = strlen(type_name); - MAKE_STD_ZVAL(resource); - ZEND_REGISTER_RESOURCE(resource, value, *(int *)(type->clientdata)); + ZVAL_RES(&resource, zend_register_resource(value, *(int *)(type->clientdata))); if (SWIG_PREFIX_LEN > 0) { - char * classname = (char*)emalloc(SWIG_PREFIX_LEN + type_name_len + 1); - strcpy(classname, SWIG_PREFIX); - strcpy(classname + SWIG_PREFIX_LEN, type_name); - result = zend_lookup_class(classname, SWIG_PREFIX_LEN + type_name_len, &ce TSRMLS_CC); - efree(classname); + zend_string * classname = zend_string_alloc(SWIG_PREFIX_LEN + type_name_len, 0); + memcpy(classname->val, SWIG_PREFIX, SWIG_PREFIX_LEN); + memcpy(classname->val + SWIG_PREFIX_LEN, type_name, type_name_len); + ce = zend_lookup_class(classname); + zend_string_release(classname); } else { - result = zend_lookup_class((char *)type_name, type_name_len, &ce TSRMLS_CC); + zend_string * classname = zend_string_init(type_name, type_name_len, 0); + ce = zend_lookup_class(classname); + zend_string_release(classname); } - if (result != SUCCESS) { + if (ce == NULL) { /* class does not exist */ - object_init(z); - } else { - object_init_ex(z, *ce); + ce = zend_standard_class_def; } - Z_SET_REFCOUNT_P(z, 1); - Z_SET_ISREF_P(z); - zend_hash_update(HASH_OF(z), (char*)"_cPtr", sizeof("_cPtr"), (void*)&resource, sizeof(zval), NULL); + + ALLOC_HASHTABLE(ht); + zend_hash_init(ht, 1, NULL, NULL, 0); + zend_hash_str_update(ht, "_cPtr", sizeof("_cPtr") - 1, &resource); + object_and_properties_init(z, ce, ht); } return; } @@ -889,11 +874,11 @@ SWIG_ZTS_SetPointerZval(zval *z, void *ptr, swig_type_info *type, int newobject instance of a resource of the type id, so we have to pass type_name as well. The two functions which might call this are: - SWIG_ZTS_ConvertResourcePtr which gets the type name from the resource + SWIG_ConvertResourcePtr which gets the type name from the resource and the registered zend destructors for which we have one per type each with the type name hard wired in. */ static void * -SWIG_ZTS_ConvertResourceData(void * p, const char *type_name, swig_type_info *ty TSRMLS_DC) { +SWIG_ConvertResourceData(void * p, const char *type_name, swig_type_info *ty) { swig_cast_info *tc; void *result = 0; @@ -920,48 +905,53 @@ SWIG_ZTS_ConvertResourceData(void * p, const char *type_name, swig_type_info *ty /* This function returns a pointer of type ty by extracting the pointer and type info from the resource in z. z must be a resource. If it fails, NULL is returned. - It uses SWIG_ZTS_ConvertResourceData to do the real work. */ + It uses SWIG_ConvertResourceData to do the real work. */ static void * -SWIG_ZTS_ConvertResourcePtr(zval *z, swig_type_info *ty, int flags TSRMLS_DC) { +SWIG_ConvertResourcePtr(zval *z, swig_type_info *ty, int flags) { swig_object_wrapper *value; void *p; - int type; const char *type_name; - value = (swig_object_wrapper *) zend_list_find(z->value.lval, &type); - if (type==-1) return NULL; + if (Z_RES_TYPE_P(z) == -1) return NULL; + value = (swig_object_wrapper *) Z_RES_VAL_P(z); if (flags & SWIG_POINTER_DISOWN) { value->newobject = 0; } p = value->ptr; - type_name=zend_rsrc_list_get_rsrc_type(z->value.lval TSRMLS_CC); + type_name=zend_rsrc_list_get_rsrc_type(Z_RES_P(z)); - return SWIG_ZTS_ConvertResourceData(p, type_name, ty TSRMLS_CC); + return SWIG_ConvertResourceData(p, type_name, ty); } /* We allow passing of a RESOURCE pointing to the object or an OBJECT whose _cPtr is a resource pointing to the object */ static int -SWIG_ZTS_ConvertPtr(zval *z, void **ptr, swig_type_info *ty, int flags TSRMLS_DC) { +SWIG_ConvertPtr(zval *z, void **ptr, swig_type_info *ty, int flags) { if (z == NULL) { *ptr = 0; return 0; } - switch (z->type) { + switch (Z_TYPE_P(z)) { case IS_OBJECT: { - zval ** _cPtr; - if (zend_hash_find(HASH_OF(z),(char*)"_cPtr",sizeof("_cPtr"),(void**)&_cPtr)==SUCCESS) { - if ((*_cPtr)->type==IS_RESOURCE) { - *ptr = SWIG_ZTS_ConvertResourcePtr(*_cPtr, ty, flags TSRMLS_CC); - return (*ptr == NULL ? -1 : 0); - } + HashTable * ht = Z_OBJ_HT_P(z)->get_properties(z); + if (ht) { + zval * _cPtr = zend_hash_str_find(ht, "_cPtr", sizeof("_cPtr") - 1); + if (_cPtr) { + if (Z_TYPE_P(_cPtr) == IS_INDIRECT) { + _cPtr = Z_INDIRECT_P(_cPtr); + } + if (Z_TYPE_P(_cPtr) == IS_RESOURCE) { + *ptr = SWIG_ConvertResourcePtr(_cPtr, ty, flags); + return (*ptr == NULL ? -1 : 0); + } + } } break; } case IS_RESOURCE: - *ptr = SWIG_ZTS_ConvertResourcePtr(z, ty, flags TSRMLS_CC); + *ptr = SWIG_ConvertResourcePtr(z, ty, flags); return (*ptr == NULL ? -1 : 0); case IS_NULL: *ptr = 0; @@ -973,24 +963,17 @@ SWIG_ZTS_ConvertPtr(zval *z, void **ptr, swig_type_info *ty, int flags TSRMLS_DC static char const_name[] = "swig_runtime_data_type_pointer"; static swig_module_info *SWIG_Php_GetModule() { - zval *pointer; - swig_module_info *ret = 0; - TSRMLS_FETCH(); - - MAKE_STD_ZVAL(pointer); - - if (zend_get_constant(const_name, sizeof(const_name) - 1, pointer TSRMLS_CC)) { - if (pointer->type == IS_LONG) { - ret = (swig_module_info *) pointer->value.lval; + zval *pointer = zend_get_constant_str(const_name, sizeof(const_name) - 1); + if (pointer) { + if (Z_TYPE_P(pointer) == IS_LONG) { + return (swig_module_info *) pointer->value.lval; } } - FREE_ZVAL(pointer); - return ret; + return NULL; } static void SWIG_Php_SetModule(swig_module_info *pointer) { - TSRMLS_FETCH(); - REGISTER_MAIN_LONG_CONSTANT(const_name, (long) pointer, 0); + REGISTER_MAIN_LONG_CONSTANT(const_name, (long) pointer, CONST_PERSISTENT | CONST_CS); } @@ -1013,19 +996,13 @@ const char *error_msg; int error_code; ZEND_END_MODULE_GLOBALS(ESL) ZEND_DECLARE_MODULE_GLOBALS(ESL) -#ifdef ZTS -#define SWIG_ErrorMsg() TSRMG(ESL_globals_id, zend_ESL_globals *, error_msg ) -#define SWIG_ErrorCode() TSRMG(ESL_globals_id, zend_ESL_globals *, error_code ) -#else #define SWIG_ErrorMsg() (ESL_globals.error_msg) #define SWIG_ErrorCode() (ESL_globals.error_code) -#endif - #ifdef __GNUC__ -static void SWIG_FAIL(TSRMLS_D) __attribute__ ((__noreturn__)); +static void SWIG_FAIL(void) __attribute__ ((__noreturn__)); #endif -static void SWIG_FAIL(TSRMLS_D) { +static void SWIG_FAIL(void) { zend_error(SWIG_ErrorCode(), "%s", SWIG_ErrorMsg()); abort(); } @@ -1034,39 +1011,35 @@ static void ESL_init_globals(zend_ESL_globals *globals ) { globals->error_msg = default_error_msg; globals->error_code = default_error_code; } -static void ESL_destroy_globals(zend_ESL_globals * globals) { (void)globals; } - -static void SWIG_ResetError(TSRMLS_D) { +static void SWIG_ResetError(void) { SWIG_ErrorMsg() = default_error_msg; SWIG_ErrorCode() = default_error_code; } ZEND_NAMED_FUNCTION(_wrap_swig_ESL_alter_newobject) { - zval **args[2]; + zval args[2]; swig_object_wrapper *value; - int type; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) { WRONG_PARAM_COUNT; } - value = (swig_object_wrapper *) zend_list_find((*args[0])->value.lval, &type); - value->newobject = zval_is_true(*args[1]); + value = (swig_object_wrapper *) Z_RES_VAL(args[0]); + value->newobject = zval_is_true(&args[1]); return; } ZEND_NAMED_FUNCTION(_wrap_swig_ESL_get_newobject) { - zval **args[1]; + zval args[1]; swig_object_wrapper *value; - int type; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) { WRONG_PARAM_COUNT; } - value = (swig_object_wrapper *) zend_list_find((*args[0])->value.lval, &type); + value = (swig_object_wrapper *) Z_RES_VAL(args[0]); RETVAL_LONG(value->newobject); return; @@ -1128,81 +1101,83 @@ static int le_swig__p_ESLconnection=0; /* handle for ESLconnection */ ZEND_NAMED_FUNCTION(_wrap_ESLevent_event_set) { ESLevent *arg1 = (ESLevent *) 0 ; esl_event_t *arg2 = (esl_event_t *) 0 ; - zval **args[2]; + zval args[2]; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) { WRONG_PARAM_COUNT; } - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_event_set. Expected SWIGTYPE_p_ESLevent"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_event_set. Expected SWIGTYPE_p_ESLevent"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); - { - if(SWIG_ConvertPtr(*args[1], (void **) &arg2, SWIGTYPE_p_esl_event_t, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 2 of ESLevent_event_set. Expected SWIGTYPE_p_esl_event_t"); - } + + if (SWIG_ConvertPtr(&args[1], (void **) &arg2, SWIGTYPE_p_esl_event_t, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 2 of ESLevent_event_set. Expected SWIGTYPE_p_esl_event_t"); } + if (arg1) (arg1)->event = arg2; +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_ESLevent_event_get) { ESLevent *arg1 = (ESLevent *) 0 ; - zval **args[1]; + zval args[1]; esl_event_t *result = 0 ; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) { WRONG_PARAM_COUNT; } - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_event_get. Expected SWIGTYPE_p_ESLevent"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_event_get. Expected SWIGTYPE_p_ESLevent"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); result = (esl_event_t *) ((arg1)->event); SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_esl_event_t, 0); +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_ESLevent_serialized_string_set) { ESLevent *arg1 = (ESLevent *) 0 ; char *arg2 = (char *) 0 ; - zval **args[2]; + zval args[2]; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) { WRONG_PARAM_COUNT; } - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_serialized_string_set. Expected SWIGTYPE_p_ESLevent"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_serialized_string_set. Expected SWIGTYPE_p_ESLevent"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[1])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[1])) { arg2 = (char *) 0; } else { - convert_to_string_ex(args[1]); - arg2 = (char *) Z_STRVAL_PP(args[1]); + convert_to_string(&args[1]); + arg2 = (char *) Z_STRVAL(args[1]); } /*@SWIG@*/; @@ -1216,128 +1191,131 @@ ZEND_NAMED_FUNCTION(_wrap_ESLevent_serialized_string_set) { } } +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_ESLevent_serialized_string_get) { ESLevent *arg1 = (ESLevent *) 0 ; - zval **args[1]; + zval args[1]; char *result = 0 ; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) { WRONG_PARAM_COUNT; } - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_serialized_string_get. Expected SWIGTYPE_p_ESLevent"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_serialized_string_get. Expected SWIGTYPE_p_ESLevent"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); result = (char *) ((arg1)->serialized_string); - { - if(!result) { - ZVAL_NULL(return_value); - } else { - ZVAL_STRING(return_value, (char *)result, 1); - } + + if (!result) { + RETVAL_NULL(); + } else { + RETVAL_STRING((const char *)result); } + +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_ESLevent_mine_set) { ESLevent *arg1 = (ESLevent *) 0 ; int arg2 ; - zval **args[2]; + zval args[2]; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) { WRONG_PARAM_COUNT; } - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_mine_set. Expected SWIGTYPE_p_ESLevent"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_mine_set. Expected SWIGTYPE_p_ESLevent"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); - /*@SWIG:/usr/share/swig3.0/php/utils.i,7,CONVERT_INT_IN@*/ - convert_to_long_ex(args[1]); - arg2 = (int) Z_LVAL_PP(args[1]); + /*@SWIG:/usr/share/swig3.0/php/utils.i,6,CONVERT_INT_IN@*/ + arg2 = (int) zval_get_long(&args[1]); /*@SWIG@*/; if (arg1) (arg1)->mine = arg2; +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_ESLevent_mine_get) { ESLevent *arg1 = (ESLevent *) 0 ; - zval **args[1]; + zval args[1]; int result; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) { WRONG_PARAM_COUNT; } - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_mine_get. Expected SWIGTYPE_p_ESLevent"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_mine_get. Expected SWIGTYPE_p_ESLevent"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); result = (int) ((arg1)->mine); - { - ZVAL_LONG(return_value,result); - } + + RETVAL_LONG(result); + +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_new_ESLevent__SWIG_0) { char *arg1 = (char *) 0 ; char *arg2 = (char *) NULL ; - zval **args[2]; + zval args[2]; int arg_count; ESLevent *result = 0 ; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); arg_count = ZEND_NUM_ARGS(); if(arg_count<1 || arg_count>2 || zend_get_parameters_array_ex(arg_count,args)!=SUCCESS) WRONG_PARAM_COUNT; - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[0])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[0])) { arg1 = (char *) 0; } else { - convert_to_string_ex(args[0]); - arg1 = (char *) Z_STRVAL_PP(args[0]); + convert_to_string(&args[0]); + arg1 = (char *) Z_STRVAL(args[0]); } /*@SWIG@*/; if(arg_count > 1) { - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[1])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[1])) { arg2 = (char *) 0; } else { - convert_to_string_ex(args[1]); - arg2 = (char *) Z_STRVAL_PP(args[1]); + convert_to_string(&args[1]); + arg2 = (char *) Z_STRVAL(args[1]); } /*@SWIG@*/; @@ -1346,34 +1324,34 @@ ZEND_NAMED_FUNCTION(_wrap_new_ESLevent__SWIG_0) { SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 1); +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_new_ESLevent__SWIG_1) { esl_event_t *arg1 = (esl_event_t *) 0 ; int arg2 = (int) 0 ; - zval **args[2]; + zval args[2]; int arg_count; ESLevent *result = 0 ; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); arg_count = ZEND_NUM_ARGS(); if(arg_count<1 || arg_count>2 || zend_get_parameters_array_ex(arg_count,args)!=SUCCESS) WRONG_PARAM_COUNT; - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_esl_event_t, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of new_ESLevent. Expected SWIGTYPE_p_esl_event_t"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_esl_event_t, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of new_ESLevent. Expected SWIGTYPE_p_esl_event_t"); } + if(arg_count > 1) { - /*@SWIG:/usr/share/swig3.0/php/utils.i,7,CONVERT_INT_IN@*/ - convert_to_long_ex(args[1]); - arg2 = (int) Z_LVAL_PP(args[1]); + /*@SWIG:/usr/share/swig3.0/php/utils.i,6,CONVERT_INT_IN@*/ + arg2 = (int) zval_get_long(&args[1]); /*@SWIG@*/; } @@ -1381,54 +1359,56 @@ ZEND_NAMED_FUNCTION(_wrap_new_ESLevent__SWIG_1) { SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 1); +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_new_ESLevent__SWIG_2) { ESLevent *arg1 = (ESLevent *) 0 ; - zval **args[1]; + zval args[1]; ESLevent *result = 0 ; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) { WRONG_PARAM_COUNT; } - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of new_ESLevent. Expected SWIGTYPE_p_ESLevent"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of new_ESLevent. Expected SWIGTYPE_p_ESLevent"); } + result = (ESLevent *)new ESLevent(arg1); SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 1); +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_new_ESLevent) { int argc; - zval **argv[2]; + zval argv[2]; argc = ZEND_NUM_ARGS(); - zend_get_parameters_array_ex(argc,argv); + zend_get_parameters_array_ex(argc, argv); if ((argc >= 1) && (argc <= 2)) { int _v; { void *tmp; - _v = (SWIG_ConvertPtr(*argv[0], (void**)&tmp, SWIGTYPE_p_esl_event_t, 0) >= 0); + _v = (SWIG_ConvertPtr(&argv[0], (void**)&tmp, SWIGTYPE_p_esl_event_t, 0) >= 0); } if (_v) { if (argc <= 1) { _wrap_new_ESLevent__SWIG_1(INTERNAL_FUNCTION_PARAM_PASSTHRU); return; } - _v = (Z_TYPE_PP(argv[1]) == IS_LONG); + _v = (Z_TYPE(argv[1]) == IS_LONG); if (_v) { _wrap_new_ESLevent__SWIG_1(INTERNAL_FUNCTION_PARAM_PASSTHRU); return; } @@ -1438,7 +1418,7 @@ ZEND_NAMED_FUNCTION(_wrap_new_ESLevent) { int _v; { void *tmp; - _v = (SWIG_ConvertPtr(*argv[0], (void**)&tmp, SWIGTYPE_p_ESLevent, 0) >= 0); + _v = (SWIG_ConvertPtr(&argv[0], (void**)&tmp, SWIGTYPE_p_ESLevent, 0) >= 0); } if (_v) { _wrap_new_ESLevent__SWIG_2(INTERNAL_FUNCTION_PARAM_PASSTHRU); return; @@ -1446,12 +1426,12 @@ ZEND_NAMED_FUNCTION(_wrap_new_ESLevent) { } if ((argc >= 1) && (argc <= 2)) { int _v; - _v = (Z_TYPE_PP(argv[0]) == IS_STRING); + _v = (Z_TYPE(argv[0]) == IS_STRING); if (_v) { if (argc <= 1) { _wrap_new_ESLevent__SWIG_0(INTERNAL_FUNCTION_PARAM_PASSTHRU); return; } - _v = (Z_TYPE_PP(argv[1]) == IS_STRING); + _v = (Z_TYPE(argv[1]) == IS_STRING); if (_v) { _wrap_new_ESLevent__SWIG_0(INTERNAL_FUNCTION_PARAM_PASSTHRU); return; } @@ -1460,70 +1440,72 @@ ZEND_NAMED_FUNCTION(_wrap_new_ESLevent) { SWIG_ErrorCode() = E_ERROR; SWIG_ErrorMsg() = "No matching function for overloaded 'new_ESLevent'"; - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } /* This function is designed to be called by the zend list destructors */ /* to typecast and do the actual destruction */ -static void __wrap_delete_ESLevent(zend_rsrc_list_entry *rsrc, const char *type_name TSRMLS_DC) { - swig_object_wrapper *value=(swig_object_wrapper *) rsrc->ptr ; +static void __wrap_delete_ESLevent(zend_resource *res, const char *type_name) { + swig_object_wrapper *value=(swig_object_wrapper *) res->ptr ; void *ptr=value->ptr ; int newobject=value->newobject ; ESLevent *arg1 = (ESLevent *) 0 ; efree(value); if (! newobject) return; /* can't delete it! */ - arg1 = (ESLevent *)SWIG_ZTS_ConvertResourceData(ptr,type_name,SWIGTYPE_p_ESLevent TSRMLS_CC); + arg1 = (ESLevent *)SWIG_ConvertResourceData(ptr, type_name, SWIGTYPE_p_ESLevent); if (! arg1) zend_error(E_ERROR, "ESLevent resource already free'd"); delete arg1; +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_ESLevent_serialize) { ESLevent *arg1 = (ESLevent *) 0 ; char *arg2 = (char *) NULL ; - zval **args[2]; + zval args[2]; int arg_count; char *result = 0 ; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); arg_count = ZEND_NUM_ARGS(); if(arg_count<1 || arg_count>2 || zend_get_parameters_array_ex(arg_count,args)!=SUCCESS) WRONG_PARAM_COUNT; - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_serialize. Expected SWIGTYPE_p_ESLevent"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_serialize. Expected SWIGTYPE_p_ESLevent"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); if(arg_count > 1) { - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[1])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[1])) { arg2 = (char *) 0; } else { - convert_to_string_ex(args[1]); - arg2 = (char *) Z_STRVAL_PP(args[1]); + convert_to_string(&args[1]); + arg2 = (char *) Z_STRVAL(args[1]); } /*@SWIG@*/; } result = (char *)(arg1)->serialize((char const *)arg2); - { - if(!result) { - ZVAL_NULL(return_value); - } else { - ZVAL_STRING(return_value, (char *)result, 1); - } + + if (!result) { + RETVAL_NULL(); + } else { + RETVAL_STRING((const char *)result); } + +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } @@ -1531,37 +1513,37 @@ ZEND_NAMED_FUNCTION(_wrap_ESLevent_setPriority) { ESLevent *arg1 = (ESLevent *) 0 ; esl_priority_t arg2 = (esl_priority_t) ESL_PRIORITY_NORMAL ; esl_priority_t *tmp2 ; - zval **args[2]; + zval args[2]; int arg_count; bool result; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); arg_count = ZEND_NUM_ARGS(); if(arg_count<1 || arg_count>2 || zend_get_parameters_array_ex(arg_count,args)!=SUCCESS) WRONG_PARAM_COUNT; - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_setPriority. Expected SWIGTYPE_p_ESLevent"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_setPriority. Expected SWIGTYPE_p_ESLevent"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); if(arg_count > 1) { - { - if(SWIG_ConvertPtr(*args[1], (void **) &tmp2, SWIGTYPE_p_esl_priority_t, 0) < 0 || tmp2 == NULL) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 2 of ESLevent_setPriority. Expected SWIGTYPE_p_esl_priority_t"); - } - arg2 = *tmp2; + if (SWIG_ConvertPtr(&args[1], (void **) &tmp2, SWIGTYPE_p_esl_priority_t, 0) < 0 || tmp2 == NULL) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 2 of ESLevent_setPriority. Expected SWIGTYPE_p_esl_priority_t"); } + arg2 = *tmp2; + } result = (bool)(arg1)->setPriority(arg2); - { - ZVAL_BOOL(return_value,(result)?1:0); - } + + RETVAL_BOOL((result) ? 1 : 0); + +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } @@ -1569,147 +1551,150 @@ ZEND_NAMED_FUNCTION(_wrap_ESLevent_getHeader) { ESLevent *arg1 = (ESLevent *) 0 ; char *arg2 = (char *) 0 ; int arg3 = (int) -1 ; - zval **args[3]; + zval args[3]; int arg_count; char *result = 0 ; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); arg_count = ZEND_NUM_ARGS(); if(arg_count<2 || arg_count>3 || zend_get_parameters_array_ex(arg_count,args)!=SUCCESS) WRONG_PARAM_COUNT; - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_getHeader. Expected SWIGTYPE_p_ESLevent"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_getHeader. Expected SWIGTYPE_p_ESLevent"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[1])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[1])) { arg2 = (char *) 0; } else { - convert_to_string_ex(args[1]); - arg2 = (char *) Z_STRVAL_PP(args[1]); + convert_to_string(&args[1]); + arg2 = (char *) Z_STRVAL(args[1]); } /*@SWIG@*/; if(arg_count > 2) { - /*@SWIG:/usr/share/swig3.0/php/utils.i,7,CONVERT_INT_IN@*/ - convert_to_long_ex(args[2]); - arg3 = (int) Z_LVAL_PP(args[2]); + /*@SWIG:/usr/share/swig3.0/php/utils.i,6,CONVERT_INT_IN@*/ + arg3 = (int) zval_get_long(&args[2]); /*@SWIG@*/; } result = (char *)(arg1)->getHeader((char const *)arg2,arg3); - { - if(!result) { - ZVAL_NULL(return_value); - } else { - ZVAL_STRING(return_value, (char *)result, 1); - } + + if (!result) { + RETVAL_NULL(); + } else { + RETVAL_STRING((const char *)result); } + +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_ESLevent_getBody) { ESLevent *arg1 = (ESLevent *) 0 ; - zval **args[1]; + zval args[1]; char *result = 0 ; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) { WRONG_PARAM_COUNT; } - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_getBody. Expected SWIGTYPE_p_ESLevent"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_getBody. Expected SWIGTYPE_p_ESLevent"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); result = (char *)(arg1)->getBody(); - { - if(!result) { - ZVAL_NULL(return_value); - } else { - ZVAL_STRING(return_value, (char *)result, 1); - } + + if (!result) { + RETVAL_NULL(); + } else { + RETVAL_STRING((const char *)result); } + +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_ESLevent_getType) { ESLevent *arg1 = (ESLevent *) 0 ; - zval **args[1]; + zval args[1]; char *result = 0 ; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) { WRONG_PARAM_COUNT; } - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_getType. Expected SWIGTYPE_p_ESLevent"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_getType. Expected SWIGTYPE_p_ESLevent"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); result = (char *)(arg1)->getType(); - { - if(!result) { - ZVAL_NULL(return_value); - } else { - ZVAL_STRING(return_value, (char *)result, 1); - } + + if (!result) { + RETVAL_NULL(); + } else { + RETVAL_STRING((const char *)result); } + +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_ESLevent_addBody) { ESLevent *arg1 = (ESLevent *) 0 ; char *arg2 = (char *) 0 ; - zval **args[2]; + zval args[2]; bool result; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) { WRONG_PARAM_COUNT; } - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_addBody. Expected SWIGTYPE_p_ESLevent"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_addBody. Expected SWIGTYPE_p_ESLevent"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[1])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[1])) { arg2 = (char *) 0; } else { - convert_to_string_ex(args[1]); - arg2 = (char *) Z_STRVAL_PP(args[1]); + convert_to_string(&args[1]); + arg2 = (char *) Z_STRVAL(args[1]); } /*@SWIG@*/; result = (bool)(arg1)->addBody((char const *)arg2); - { - ZVAL_BOOL(return_value,(result)?1:0); - } + + RETVAL_BOOL((result) ? 1 : 0); + +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } @@ -1717,47 +1702,48 @@ ZEND_NAMED_FUNCTION(_wrap_ESLevent_addHeader) { ESLevent *arg1 = (ESLevent *) 0 ; char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; - zval **args[3]; + zval args[3]; bool result; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 3 || zend_get_parameters_array_ex(3, args) != SUCCESS) { WRONG_PARAM_COUNT; } - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_addHeader. Expected SWIGTYPE_p_ESLevent"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_addHeader. Expected SWIGTYPE_p_ESLevent"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[1])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[1])) { arg2 = (char *) 0; } else { - convert_to_string_ex(args[1]); - arg2 = (char *) Z_STRVAL_PP(args[1]); + convert_to_string(&args[1]); + arg2 = (char *) Z_STRVAL(args[1]); } /*@SWIG@*/; - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[2])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[2])) { arg3 = (char *) 0; } else { - convert_to_string_ex(args[2]); - arg3 = (char *) Z_STRVAL_PP(args[2]); + convert_to_string(&args[2]); + arg3 = (char *) Z_STRVAL(args[2]); } /*@SWIG@*/; result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3); - { - ZVAL_BOOL(return_value,(result)?1:0); - } + + RETVAL_BOOL((result) ? 1 : 0); + +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } @@ -1765,47 +1751,48 @@ ZEND_NAMED_FUNCTION(_wrap_ESLevent_pushHeader) { ESLevent *arg1 = (ESLevent *) 0 ; char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; - zval **args[3]; + zval args[3]; bool result; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 3 || zend_get_parameters_array_ex(3, args) != SUCCESS) { WRONG_PARAM_COUNT; } - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_pushHeader. Expected SWIGTYPE_p_ESLevent"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_pushHeader. Expected SWIGTYPE_p_ESLevent"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[1])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[1])) { arg2 = (char *) 0; } else { - convert_to_string_ex(args[1]); - arg2 = (char *) Z_STRVAL_PP(args[1]); + convert_to_string(&args[1]); + arg2 = (char *) Z_STRVAL(args[1]); } /*@SWIG@*/; - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[2])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[2])) { arg3 = (char *) 0; } else { - convert_to_string_ex(args[2]); - arg3 = (char *) Z_STRVAL_PP(args[2]); + convert_to_string(&args[2]); + arg3 = (char *) Z_STRVAL(args[2]); } /*@SWIG@*/; result = (bool)(arg1)->pushHeader((char const *)arg2,(char const *)arg3); - { - ZVAL_BOOL(return_value,(result)?1:0); - } + + RETVAL_BOOL((result) ? 1 : 0); + +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } @@ -1813,144 +1800,148 @@ ZEND_NAMED_FUNCTION(_wrap_ESLevent_unshiftHeader) { ESLevent *arg1 = (ESLevent *) 0 ; char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; - zval **args[3]; + zval args[3]; bool result; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 3 || zend_get_parameters_array_ex(3, args) != SUCCESS) { WRONG_PARAM_COUNT; } - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_unshiftHeader. Expected SWIGTYPE_p_ESLevent"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_unshiftHeader. Expected SWIGTYPE_p_ESLevent"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[1])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[1])) { arg2 = (char *) 0; } else { - convert_to_string_ex(args[1]); - arg2 = (char *) Z_STRVAL_PP(args[1]); + convert_to_string(&args[1]); + arg2 = (char *) Z_STRVAL(args[1]); } /*@SWIG@*/; - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[2])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[2])) { arg3 = (char *) 0; } else { - convert_to_string_ex(args[2]); - arg3 = (char *) Z_STRVAL_PP(args[2]); + convert_to_string(&args[2]); + arg3 = (char *) Z_STRVAL(args[2]); } /*@SWIG@*/; result = (bool)(arg1)->unshiftHeader((char const *)arg2,(char const *)arg3); - { - ZVAL_BOOL(return_value,(result)?1:0); - } + + RETVAL_BOOL((result) ? 1 : 0); + +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_ESLevent_delHeader) { ESLevent *arg1 = (ESLevent *) 0 ; char *arg2 = (char *) 0 ; - zval **args[2]; + zval args[2]; bool result; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) { WRONG_PARAM_COUNT; } - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_delHeader. Expected SWIGTYPE_p_ESLevent"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_delHeader. Expected SWIGTYPE_p_ESLevent"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[1])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[1])) { arg2 = (char *) 0; } else { - convert_to_string_ex(args[1]); - arg2 = (char *) Z_STRVAL_PP(args[1]); + convert_to_string(&args[1]); + arg2 = (char *) Z_STRVAL(args[1]); } /*@SWIG@*/; result = (bool)(arg1)->delHeader((char const *)arg2); - { - ZVAL_BOOL(return_value,(result)?1:0); - } + + RETVAL_BOOL((result) ? 1 : 0); + +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_ESLevent_firstHeader) { ESLevent *arg1 = (ESLevent *) 0 ; - zval **args[1]; + zval args[1]; char *result = 0 ; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) { WRONG_PARAM_COUNT; } - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_firstHeader. Expected SWIGTYPE_p_ESLevent"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_firstHeader. Expected SWIGTYPE_p_ESLevent"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); result = (char *)(arg1)->firstHeader(); - { - if(!result) { - ZVAL_NULL(return_value); - } else { - ZVAL_STRING(return_value, (char *)result, 1); - } + + if (!result) { + RETVAL_NULL(); + } else { + RETVAL_STRING((const char *)result); } + +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_ESLevent_nextHeader) { ESLevent *arg1 = (ESLevent *) 0 ; - zval **args[1]; + zval args[1]; char *result = 0 ; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) { WRONG_PARAM_COUNT; } - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_nextHeader. Expected SWIGTYPE_p_ESLevent"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_nextHeader. Expected SWIGTYPE_p_ESLevent"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); result = (char *)(arg1)->nextHeader(); - { - if(!result) { - ZVAL_NULL(return_value); - } else { - ZVAL_STRING(return_value, (char *)result, 1); - } + + if (!result) { + RETVAL_NULL(); + } else { + RETVAL_STRING((const char *)result); } + +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } @@ -1959,47 +1950,46 @@ ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection__SWIG_0) { int arg2 ; char *arg3 = (char *) 0 ; char *arg4 = (char *) 0 ; - zval **args[4]; + zval args[4]; ESLconnection *result = 0 ; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 4 || zend_get_parameters_array_ex(4, args) != SUCCESS) { WRONG_PARAM_COUNT; } - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[0])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[0])) { arg1 = (char *) 0; } else { - convert_to_string_ex(args[0]); - arg1 = (char *) Z_STRVAL_PP(args[0]); + convert_to_string(&args[0]); + arg1 = (char *) Z_STRVAL(args[0]); } /*@SWIG@*/; - /*@SWIG:/usr/share/swig3.0/php/utils.i,7,CONVERT_INT_IN@*/ - convert_to_long_ex(args[1]); - arg2 = (int) Z_LVAL_PP(args[1]); + /*@SWIG:/usr/share/swig3.0/php/utils.i,6,CONVERT_INT_IN@*/ + arg2 = (int) zval_get_long(&args[1]); /*@SWIG@*/; - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[2])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[2])) { arg3 = (char *) 0; } else { - convert_to_string_ex(args[2]); - arg3 = (char *) Z_STRVAL_PP(args[2]); + convert_to_string(&args[2]); + arg3 = (char *) Z_STRVAL(args[2]); } /*@SWIG@*/; - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[3])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[3])) { arg4 = (char *) 0; } else { - convert_to_string_ex(args[3]); - arg4 = (char *) Z_STRVAL_PP(args[3]); + convert_to_string(&args[3]); + arg4 = (char *) Z_STRVAL(args[3]); } /*@SWIG@*/; @@ -2007,9 +1997,10 @@ ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection__SWIG_0) { SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLconnection, 1); +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } @@ -2017,37 +2008,36 @@ ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection__SWIG_1) { char *arg1 = (char *) 0 ; int arg2 ; char *arg3 = (char *) 0 ; - zval **args[3]; + zval args[3]; ESLconnection *result = 0 ; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 3 || zend_get_parameters_array_ex(3, args) != SUCCESS) { WRONG_PARAM_COUNT; } - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[0])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[0])) { arg1 = (char *) 0; } else { - convert_to_string_ex(args[0]); - arg1 = (char *) Z_STRVAL_PP(args[0]); + convert_to_string(&args[0]); + arg1 = (char *) Z_STRVAL(args[0]); } /*@SWIG@*/; - /*@SWIG:/usr/share/swig3.0/php/utils.i,7,CONVERT_INT_IN@*/ - convert_to_long_ex(args[1]); - arg2 = (int) Z_LVAL_PP(args[1]); + /*@SWIG:/usr/share/swig3.0/php/utils.i,6,CONVERT_INT_IN@*/ + arg2 = (int) zval_get_long(&args[1]); /*@SWIG@*/; - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[2])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[2])) { arg3 = (char *) 0; } else { - convert_to_string_ex(args[2]); - arg3 = (char *) Z_STRVAL_PP(args[2]); + convert_to_string(&args[2]); + arg3 = (char *) Z_STRVAL(args[2]); } /*@SWIG@*/; @@ -2055,9 +2045,10 @@ ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection__SWIG_1) { SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLconnection, 1); +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } @@ -2066,51 +2057,51 @@ ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection__SWIG_2) { char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; char *arg4 = (char *) 0 ; - zval **args[4]; + zval args[4]; ESLconnection *result = 0 ; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 4 || zend_get_parameters_array_ex(4, args) != SUCCESS) { WRONG_PARAM_COUNT; } - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[0])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[0])) { arg1 = (char *) 0; } else { - convert_to_string_ex(args[0]); - arg1 = (char *) Z_STRVAL_PP(args[0]); + convert_to_string(&args[0]); + arg1 = (char *) Z_STRVAL(args[0]); } /*@SWIG@*/; - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[1])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[1])) { arg2 = (char *) 0; } else { - convert_to_string_ex(args[1]); - arg2 = (char *) Z_STRVAL_PP(args[1]); + convert_to_string(&args[1]); + arg2 = (char *) Z_STRVAL(args[1]); } /*@SWIG@*/; - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[2])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[2])) { arg3 = (char *) 0; } else { - convert_to_string_ex(args[2]); - arg3 = (char *) Z_STRVAL_PP(args[2]); + convert_to_string(&args[2]); + arg3 = (char *) Z_STRVAL(args[2]); } /*@SWIG@*/; - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[3])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[3])) { arg4 = (char *) 0; } else { - convert_to_string_ex(args[3]); - arg4 = (char *) Z_STRVAL_PP(args[3]); + convert_to_string(&args[3]); + arg4 = (char *) Z_STRVAL(args[3]); } /*@SWIG@*/; @@ -2118,9 +2109,10 @@ ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection__SWIG_2) { SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLconnection, 1); +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } @@ -2128,41 +2120,41 @@ ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection__SWIG_3) { char *arg1 = (char *) 0 ; char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; - zval **args[3]; + zval args[3]; ESLconnection *result = 0 ; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 3 || zend_get_parameters_array_ex(3, args) != SUCCESS) { WRONG_PARAM_COUNT; } - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[0])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[0])) { arg1 = (char *) 0; } else { - convert_to_string_ex(args[0]); - arg1 = (char *) Z_STRVAL_PP(args[0]); + convert_to_string(&args[0]); + arg1 = (char *) Z_STRVAL(args[0]); } /*@SWIG@*/; - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[1])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[1])) { arg2 = (char *) 0; } else { - convert_to_string_ex(args[1]); - arg2 = (char *) Z_STRVAL_PP(args[1]); + convert_to_string(&args[1]); + arg2 = (char *) Z_STRVAL(args[1]); } /*@SWIG@*/; - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[2])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[2])) { arg3 = (char *) 0; } else { - convert_to_string_ex(args[2]); - arg3 = (char *) Z_STRVAL_PP(args[2]); + convert_to_string(&args[2]); + arg3 = (char *) Z_STRVAL(args[2]); } /*@SWIG@*/; @@ -2170,58 +2162,59 @@ ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection__SWIG_3) { SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLconnection, 1); +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection__SWIG_4) { int arg1 ; - zval **args[1]; + zval args[1]; ESLconnection *result = 0 ; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) { WRONG_PARAM_COUNT; } - /*@SWIG:/usr/share/swig3.0/php/utils.i,7,CONVERT_INT_IN@*/ - convert_to_long_ex(args[0]); - arg1 = (int) Z_LVAL_PP(args[0]); + /*@SWIG:/usr/share/swig3.0/php/utils.i,6,CONVERT_INT_IN@*/ + arg1 = (int) zval_get_long(&args[0]); /*@SWIG@*/; result = (ESLconnection *)new ESLconnection(arg1); SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLconnection, 1); +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection) { int argc; - zval **argv[4]; + zval argv[4]; argc = ZEND_NUM_ARGS(); - zend_get_parameters_array_ex(argc,argv); + zend_get_parameters_array_ex(argc, argv); if (argc == 1) { int _v; - _v = (Z_TYPE_PP(argv[0]) == IS_LONG); + _v = (Z_TYPE(argv[0]) == IS_LONG); if (_v) { _wrap_new_ESLconnection__SWIG_4(INTERNAL_FUNCTION_PARAM_PASSTHRU); return; } } if (argc == 3) { int _v; - _v = (Z_TYPE_PP(argv[0]) == IS_STRING); + _v = (Z_TYPE(argv[0]) == IS_STRING); if (_v) { - _v = (Z_TYPE_PP(argv[1]) == IS_LONG); + _v = (Z_TYPE(argv[1]) == IS_LONG); if (_v) { - _v = (Z_TYPE_PP(argv[2]) == IS_STRING); + _v = (Z_TYPE(argv[2]) == IS_STRING); if (_v) { _wrap_new_ESLconnection__SWIG_1(INTERNAL_FUNCTION_PARAM_PASSTHRU); return; } @@ -2230,11 +2223,11 @@ ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection) { } if (argc == 3) { int _v; - _v = (Z_TYPE_PP(argv[0]) == IS_STRING); + _v = (Z_TYPE(argv[0]) == IS_STRING); if (_v) { - _v = (Z_TYPE_PP(argv[1]) == IS_STRING); + _v = (Z_TYPE(argv[1]) == IS_STRING); if (_v) { - _v = (Z_TYPE_PP(argv[2]) == IS_STRING); + _v = (Z_TYPE(argv[2]) == IS_STRING); if (_v) { _wrap_new_ESLconnection__SWIG_3(INTERNAL_FUNCTION_PARAM_PASSTHRU); return; } @@ -2243,13 +2236,13 @@ ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection) { } if (argc == 4) { int _v; - _v = (Z_TYPE_PP(argv[0]) == IS_STRING); + _v = (Z_TYPE(argv[0]) == IS_STRING); if (_v) { - _v = (Z_TYPE_PP(argv[1]) == IS_LONG); + _v = (Z_TYPE(argv[1]) == IS_LONG); if (_v) { - _v = (Z_TYPE_PP(argv[2]) == IS_STRING); + _v = (Z_TYPE(argv[2]) == IS_STRING); if (_v) { - _v = (Z_TYPE_PP(argv[3]) == IS_STRING); + _v = (Z_TYPE(argv[3]) == IS_STRING); if (_v) { _wrap_new_ESLconnection__SWIG_0(INTERNAL_FUNCTION_PARAM_PASSTHRU); return; } @@ -2259,13 +2252,13 @@ ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection) { } if (argc == 4) { int _v; - _v = (Z_TYPE_PP(argv[0]) == IS_STRING); + _v = (Z_TYPE(argv[0]) == IS_STRING); if (_v) { - _v = (Z_TYPE_PP(argv[1]) == IS_STRING); + _v = (Z_TYPE(argv[1]) == IS_STRING); if (_v) { - _v = (Z_TYPE_PP(argv[2]) == IS_STRING); + _v = (Z_TYPE(argv[2]) == IS_STRING); if (_v) { - _v = (Z_TYPE_PP(argv[3]) == IS_STRING); + _v = (Z_TYPE(argv[3]) == IS_STRING); if (_v) { _wrap_new_ESLconnection__SWIG_2(INTERNAL_FUNCTION_PARAM_PASSTHRU); return; } @@ -2276,168 +2269,173 @@ ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection) { SWIG_ErrorCode() = E_ERROR; SWIG_ErrorMsg() = "No matching function for overloaded 'new_ESLconnection'"; - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } /* This function is designed to be called by the zend list destructors */ /* to typecast and do the actual destruction */ -static void __wrap_delete_ESLconnection(zend_rsrc_list_entry *rsrc, const char *type_name TSRMLS_DC) { - swig_object_wrapper *value=(swig_object_wrapper *) rsrc->ptr ; +static void __wrap_delete_ESLconnection(zend_resource *res, const char *type_name) { + swig_object_wrapper *value=(swig_object_wrapper *) res->ptr ; void *ptr=value->ptr ; int newobject=value->newobject ; ESLconnection *arg1 = (ESLconnection *) 0 ; efree(value); if (! newobject) return; /* can't delete it! */ - arg1 = (ESLconnection *)SWIG_ZTS_ConvertResourceData(ptr,type_name,SWIGTYPE_p_ESLconnection TSRMLS_CC); + arg1 = (ESLconnection *)SWIG_ConvertResourceData(ptr, type_name, SWIGTYPE_p_ESLconnection); if (! arg1) zend_error(E_ERROR, "ESLconnection resource already free'd"); delete arg1; +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_ESLconnection_socketDescriptor) { ESLconnection *arg1 = (ESLconnection *) 0 ; - zval **args[1]; + zval args[1]; int result; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) { WRONG_PARAM_COUNT; } - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_socketDescriptor. Expected SWIGTYPE_p_ESLconnection"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_socketDescriptor. Expected SWIGTYPE_p_ESLconnection"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); result = (int)(arg1)->socketDescriptor(); - { - ZVAL_LONG(return_value,result); - } + + RETVAL_LONG(result); + +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_ESLconnection_connected) { ESLconnection *arg1 = (ESLconnection *) 0 ; - zval **args[1]; + zval args[1]; int result; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) { WRONG_PARAM_COUNT; } - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_connected. Expected SWIGTYPE_p_ESLconnection"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_connected. Expected SWIGTYPE_p_ESLconnection"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); result = (int)(arg1)->connected(); - { - ZVAL_LONG(return_value,result); - } + + RETVAL_LONG(result); + +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_ESLconnection_getInfo) { ESLconnection *arg1 = (ESLconnection *) 0 ; - zval **args[1]; + zval args[1]; ESLevent *result = 0 ; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) { WRONG_PARAM_COUNT; } - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_getInfo. Expected SWIGTYPE_p_ESLconnection"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_getInfo. Expected SWIGTYPE_p_ESLconnection"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); result = (ESLevent *)(arg1)->getInfo(); SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 0); +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_ESLconnection_send) { ESLconnection *arg1 = (ESLconnection *) 0 ; char *arg2 = (char *) 0 ; - zval **args[2]; + zval args[2]; int result; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) { WRONG_PARAM_COUNT; } - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_send. Expected SWIGTYPE_p_ESLconnection"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_send. Expected SWIGTYPE_p_ESLconnection"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[1])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[1])) { arg2 = (char *) 0; } else { - convert_to_string_ex(args[1]); - arg2 = (char *) Z_STRVAL_PP(args[1]); + convert_to_string(&args[1]); + arg2 = (char *) Z_STRVAL(args[1]); } /*@SWIG@*/; result = (int)(arg1)->send((char const *)arg2); - { - ZVAL_LONG(return_value,result); - } + + RETVAL_LONG(result); + +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_ESLconnection_sendRecv) { ESLconnection *arg1 = (ESLconnection *) 0 ; char *arg2 = (char *) 0 ; - zval **args[2]; + zval args[2]; ESLevent *result = 0 ; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) { WRONG_PARAM_COUNT; } - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_sendRecv. Expected SWIGTYPE_p_ESLconnection"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_sendRecv. Expected SWIGTYPE_p_ESLconnection"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[1])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[1])) { arg2 = (char *) 0; } else { - convert_to_string_ex(args[1]); - arg2 = (char *) Z_STRVAL_PP(args[1]); + convert_to_string(&args[1]); + arg2 = (char *) Z_STRVAL(args[1]); } /*@SWIG@*/; @@ -2445,9 +2443,10 @@ ZEND_NAMED_FUNCTION(_wrap_ESLconnection_sendRecv) { SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 0); +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } @@ -2455,39 +2454,39 @@ ZEND_NAMED_FUNCTION(_wrap_ESLconnection_api) { ESLconnection *arg1 = (ESLconnection *) 0 ; char *arg2 = (char *) 0 ; char *arg3 = (char *) NULL ; - zval **args[3]; + zval args[3]; int arg_count; ESLevent *result = 0 ; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); arg_count = ZEND_NUM_ARGS(); if(arg_count<2 || arg_count>3 || zend_get_parameters_array_ex(arg_count,args)!=SUCCESS) WRONG_PARAM_COUNT; - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_api. Expected SWIGTYPE_p_ESLconnection"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_api. Expected SWIGTYPE_p_ESLconnection"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[1])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[1])) { arg2 = (char *) 0; } else { - convert_to_string_ex(args[1]); - arg2 = (char *) Z_STRVAL_PP(args[1]); + convert_to_string(&args[1]); + arg2 = (char *) Z_STRVAL(args[1]); } /*@SWIG@*/; if(arg_count > 2) { - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[2])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[2])) { arg3 = (char *) 0; } else { - convert_to_string_ex(args[2]); - arg3 = (char *) Z_STRVAL_PP(args[2]); + convert_to_string(&args[2]); + arg3 = (char *) Z_STRVAL(args[2]); } /*@SWIG@*/; @@ -2496,9 +2495,10 @@ ZEND_NAMED_FUNCTION(_wrap_ESLconnection_api) { SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 0); +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } @@ -2507,50 +2507,50 @@ ZEND_NAMED_FUNCTION(_wrap_ESLconnection_bgapi) { char *arg2 = (char *) 0 ; char *arg3 = (char *) NULL ; char *arg4 = (char *) NULL ; - zval **args[4]; + zval args[4]; int arg_count; ESLevent *result = 0 ; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); arg_count = ZEND_NUM_ARGS(); if(arg_count<2 || arg_count>4 || zend_get_parameters_array_ex(arg_count,args)!=SUCCESS) WRONG_PARAM_COUNT; - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_bgapi. Expected SWIGTYPE_p_ESLconnection"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_bgapi. Expected SWIGTYPE_p_ESLconnection"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[1])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[1])) { arg2 = (char *) 0; } else { - convert_to_string_ex(args[1]); - arg2 = (char *) Z_STRVAL_PP(args[1]); + convert_to_string(&args[1]); + arg2 = (char *) Z_STRVAL(args[1]); } /*@SWIG@*/; if(arg_count > 2) { - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[2])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[2])) { arg3 = (char *) 0; } else { - convert_to_string_ex(args[2]); - arg3 = (char *) Z_STRVAL_PP(args[2]); + convert_to_string(&args[2]); + arg3 = (char *) Z_STRVAL(args[2]); } /*@SWIG@*/; } if(arg_count > 3) { - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[3])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[3])) { arg4 = (char *) 0; } else { - convert_to_string_ex(args[3]); - arg4 = (char *) Z_STRVAL_PP(args[3]); + convert_to_string(&args[3]); + arg4 = (char *) Z_STRVAL(args[3]); } /*@SWIG@*/; @@ -2559,41 +2559,43 @@ ZEND_NAMED_FUNCTION(_wrap_ESLconnection_bgapi) { SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 0); +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_ESLconnection_sendEvent) { ESLconnection *arg1 = (ESLconnection *) 0 ; ESLevent *arg2 = (ESLevent *) 0 ; - zval **args[2]; + zval args[2]; ESLevent *result = 0 ; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) { WRONG_PARAM_COUNT; } - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_sendEvent. Expected SWIGTYPE_p_ESLconnection"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_sendEvent. Expected SWIGTYPE_p_ESLconnection"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); - { - if(SWIG_ConvertPtr(*args[1], (void **) &arg2, SWIGTYPE_p_ESLevent, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 2 of ESLconnection_sendEvent. Expected SWIGTYPE_p_ESLevent"); - } + + if (SWIG_ConvertPtr(&args[1], (void **) &arg2, SWIGTYPE_p_ESLevent, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 2 of ESLconnection_sendEvent. Expected SWIGTYPE_p_ESLevent"); } + result = (ESLevent *)(arg1)->sendEvent(arg2); SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 0); +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } @@ -2601,104 +2603,106 @@ ZEND_NAMED_FUNCTION(_wrap_ESLconnection_sendMSG) { ESLconnection *arg1 = (ESLconnection *) 0 ; ESLevent *arg2 = (ESLevent *) 0 ; char *arg3 = (char *) NULL ; - zval **args[3]; + zval args[3]; int arg_count; int result; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); arg_count = ZEND_NUM_ARGS(); if(arg_count<2 || arg_count>3 || zend_get_parameters_array_ex(arg_count,args)!=SUCCESS) WRONG_PARAM_COUNT; - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_sendMSG. Expected SWIGTYPE_p_ESLconnection"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_sendMSG. Expected SWIGTYPE_p_ESLconnection"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); - { - if(SWIG_ConvertPtr(*args[1], (void **) &arg2, SWIGTYPE_p_ESLevent, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 2 of ESLconnection_sendMSG. Expected SWIGTYPE_p_ESLevent"); - } + + if (SWIG_ConvertPtr(&args[1], (void **) &arg2, SWIGTYPE_p_ESLevent, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 2 of ESLconnection_sendMSG. Expected SWIGTYPE_p_ESLevent"); } + if(arg_count > 2) { - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[2])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[2])) { arg3 = (char *) 0; } else { - convert_to_string_ex(args[2]); - arg3 = (char *) Z_STRVAL_PP(args[2]); + convert_to_string(&args[2]); + arg3 = (char *) Z_STRVAL(args[2]); } /*@SWIG@*/; } result = (int)(arg1)->sendMSG(arg2,(char const *)arg3); - { - ZVAL_LONG(return_value,result); - } + + RETVAL_LONG(result); + +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_ESLconnection_recvEvent) { ESLconnection *arg1 = (ESLconnection *) 0 ; - zval **args[1]; + zval args[1]; ESLevent *result = 0 ; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) { WRONG_PARAM_COUNT; } - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_recvEvent. Expected SWIGTYPE_p_ESLconnection"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_recvEvent. Expected SWIGTYPE_p_ESLconnection"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); result = (ESLevent *)(arg1)->recvEvent(); SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 0); +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_ESLconnection_recvEventTimed) { ESLconnection *arg1 = (ESLconnection *) 0 ; int arg2 ; - zval **args[2]; + zval args[2]; ESLevent *result = 0 ; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) { WRONG_PARAM_COUNT; } - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_recvEventTimed. Expected SWIGTYPE_p_ESLconnection"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_recvEventTimed. Expected SWIGTYPE_p_ESLconnection"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); - /*@SWIG:/usr/share/swig3.0/php/utils.i,7,CONVERT_INT_IN@*/ - convert_to_long_ex(args[1]); - arg2 = (int) Z_LVAL_PP(args[1]); + /*@SWIG:/usr/share/swig3.0/php/utils.i,6,CONVERT_INT_IN@*/ + arg2 = (int) zval_get_long(&args[1]); /*@SWIG@*/; result = (ESLevent *)(arg1)->recvEventTimed(arg2); SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 0); +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } @@ -2706,37 +2710,37 @@ ZEND_NAMED_FUNCTION(_wrap_ESLconnection_filter) { ESLconnection *arg1 = (ESLconnection *) 0 ; char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; - zval **args[3]; + zval args[3]; ESLevent *result = 0 ; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 3 || zend_get_parameters_array_ex(3, args) != SUCCESS) { WRONG_PARAM_COUNT; } - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_filter. Expected SWIGTYPE_p_ESLconnection"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_filter. Expected SWIGTYPE_p_ESLconnection"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[1])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[1])) { arg2 = (char *) 0; } else { - convert_to_string_ex(args[1]); - arg2 = (char *) Z_STRVAL_PP(args[1]); + convert_to_string(&args[1]); + arg2 = (char *) Z_STRVAL(args[1]); } /*@SWIG@*/; - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[2])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[2])) { arg3 = (char *) 0; } else { - convert_to_string_ex(args[2]); - arg3 = (char *) Z_STRVAL_PP(args[2]); + convert_to_string(&args[2]); + arg3 = (char *) Z_STRVAL(args[2]); } /*@SWIG@*/; @@ -2744,9 +2748,10 @@ ZEND_NAMED_FUNCTION(_wrap_ESLconnection_filter) { SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 0); +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } @@ -2754,47 +2759,48 @@ ZEND_NAMED_FUNCTION(_wrap_ESLconnection_events) { ESLconnection *arg1 = (ESLconnection *) 0 ; char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; - zval **args[3]; + zval args[3]; int result; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 3 || zend_get_parameters_array_ex(3, args) != SUCCESS) { WRONG_PARAM_COUNT; } - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_events. Expected SWIGTYPE_p_ESLconnection"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_events. Expected SWIGTYPE_p_ESLconnection"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[1])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[1])) { arg2 = (char *) 0; } else { - convert_to_string_ex(args[1]); - arg2 = (char *) Z_STRVAL_PP(args[1]); + convert_to_string(&args[1]); + arg2 = (char *) Z_STRVAL(args[1]); } /*@SWIG@*/; - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[2])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[2])) { arg3 = (char *) 0; } else { - convert_to_string_ex(args[2]); - arg3 = (char *) Z_STRVAL_PP(args[2]); + convert_to_string(&args[2]); + arg3 = (char *) Z_STRVAL(args[2]); } /*@SWIG@*/; result = (int)(arg1)->events((char const *)arg2,(char const *)arg3); - { - ZVAL_LONG(return_value,result); - } + + RETVAL_LONG(result); + +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } @@ -2803,50 +2809,50 @@ ZEND_NAMED_FUNCTION(_wrap_ESLconnection_execute) { char *arg2 = (char *) 0 ; char *arg3 = (char *) NULL ; char *arg4 = (char *) NULL ; - zval **args[4]; + zval args[4]; int arg_count; ESLevent *result = 0 ; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); arg_count = ZEND_NUM_ARGS(); if(arg_count<2 || arg_count>4 || zend_get_parameters_array_ex(arg_count,args)!=SUCCESS) WRONG_PARAM_COUNT; - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_execute. Expected SWIGTYPE_p_ESLconnection"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_execute. Expected SWIGTYPE_p_ESLconnection"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[1])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[1])) { arg2 = (char *) 0; } else { - convert_to_string_ex(args[1]); - arg2 = (char *) Z_STRVAL_PP(args[1]); + convert_to_string(&args[1]); + arg2 = (char *) Z_STRVAL(args[1]); } /*@SWIG@*/; if(arg_count > 2) { - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[2])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[2])) { arg3 = (char *) 0; } else { - convert_to_string_ex(args[2]); - arg3 = (char *) Z_STRVAL_PP(args[2]); + convert_to_string(&args[2]); + arg3 = (char *) Z_STRVAL(args[2]); } /*@SWIG@*/; } if(arg_count > 3) { - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[3])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[3])) { arg4 = (char *) 0; } else { - convert_to_string_ex(args[3]); - arg4 = (char *) Z_STRVAL_PP(args[3]); + convert_to_string(&args[3]); + arg4 = (char *) Z_STRVAL(args[3]); } /*@SWIG@*/; @@ -2855,9 +2861,10 @@ ZEND_NAMED_FUNCTION(_wrap_ESLconnection_execute) { SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 0); +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } @@ -2866,50 +2873,50 @@ ZEND_NAMED_FUNCTION(_wrap_ESLconnection_executeAsync) { char *arg2 = (char *) 0 ; char *arg3 = (char *) NULL ; char *arg4 = (char *) NULL ; - zval **args[4]; + zval args[4]; int arg_count; ESLevent *result = 0 ; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); arg_count = ZEND_NUM_ARGS(); if(arg_count<2 || arg_count>4 || zend_get_parameters_array_ex(arg_count,args)!=SUCCESS) WRONG_PARAM_COUNT; - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_executeAsync. Expected SWIGTYPE_p_ESLconnection"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_executeAsync. Expected SWIGTYPE_p_ESLconnection"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[1])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[1])) { arg2 = (char *) 0; } else { - convert_to_string_ex(args[1]); - arg2 = (char *) Z_STRVAL_PP(args[1]); + convert_to_string(&args[1]); + arg2 = (char *) Z_STRVAL(args[1]); } /*@SWIG@*/; if(arg_count > 2) { - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[2])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[2])) { arg3 = (char *) 0; } else { - convert_to_string_ex(args[2]); - arg3 = (char *) Z_STRVAL_PP(args[2]); + convert_to_string(&args[2]); + arg3 = (char *) Z_STRVAL(args[2]); } /*@SWIG@*/; } if(arg_count > 3) { - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[3])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[3])) { arg4 = (char *) 0; } else { - convert_to_string_ex(args[3]); - arg4 = (char *) Z_STRVAL_PP(args[3]); + convert_to_string(&args[3]); + arg4 = (char *) Z_STRVAL(args[3]); } /*@SWIG@*/; @@ -2918,307 +2925,169 @@ ZEND_NAMED_FUNCTION(_wrap_ESLconnection_executeAsync) { SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 0); +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_ESLconnection_setAsyncExecute) { ESLconnection *arg1 = (ESLconnection *) 0 ; char *arg2 = (char *) 0 ; - zval **args[2]; + zval args[2]; int result; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) { WRONG_PARAM_COUNT; } - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_setAsyncExecute. Expected SWIGTYPE_p_ESLconnection"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_setAsyncExecute. Expected SWIGTYPE_p_ESLconnection"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[1])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[1])) { arg2 = (char *) 0; } else { - convert_to_string_ex(args[1]); - arg2 = (char *) Z_STRVAL_PP(args[1]); + convert_to_string(&args[1]); + arg2 = (char *) Z_STRVAL(args[1]); } /*@SWIG@*/; result = (int)(arg1)->setAsyncExecute((char const *)arg2); - { - ZVAL_LONG(return_value,result); - } + + RETVAL_LONG(result); + +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_ESLconnection_setEventLock) { ESLconnection *arg1 = (ESLconnection *) 0 ; char *arg2 = (char *) 0 ; - zval **args[2]; + zval args[2]; int result; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) { WRONG_PARAM_COUNT; } - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_setEventLock. Expected SWIGTYPE_p_ESLconnection"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_setEventLock. Expected SWIGTYPE_p_ESLconnection"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); - /*@SWIG:/usr/share/swig3.0/php/utils.i,62,CONVERT_STRING_IN@*/ - if ((*args[1])->type==IS_NULL) { + /*@SWIG:/usr/share/swig3.0/php/utils.i,57,CONVERT_STRING_IN@*/ + if (Z_ISNULL(args[1])) { arg2 = (char *) 0; } else { - convert_to_string_ex(args[1]); - arg2 = (char *) Z_STRVAL_PP(args[1]); + convert_to_string(&args[1]); + arg2 = (char *) Z_STRVAL(args[1]); } /*@SWIG@*/; result = (int)(arg1)->setEventLock((char const *)arg2); - { - ZVAL_LONG(return_value,result); - } + + RETVAL_LONG(result); + +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_ESLconnection_disconnect) { ESLconnection *arg1 = (ESLconnection *) 0 ; - zval **args[1]; + zval args[1]; int result; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) { WRONG_PARAM_COUNT; } - { - if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_disconnect. Expected SWIGTYPE_p_ESLconnection"); - } + + if (SWIG_ConvertPtr(&args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_disconnect. Expected SWIGTYPE_p_ESLconnection"); } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); result = (int)(arg1)->disconnect(); - { - ZVAL_LONG(return_value,result); - } + + RETVAL_LONG(result); + +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } ZEND_NAMED_FUNCTION(_wrap_eslSetLogLevel) { int arg1 ; - zval **args[1]; + zval args[1]; - SWIG_ResetError(TSRMLS_C); + SWIG_ResetError(); if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) { WRONG_PARAM_COUNT; } - /*@SWIG:/usr/share/swig3.0/php/utils.i,7,CONVERT_INT_IN@*/ - convert_to_long_ex(args[0]); - arg1 = (int) Z_LVAL_PP(args[0]); + /*@SWIG:/usr/share/swig3.0/php/utils.i,6,CONVERT_INT_IN@*/ + arg1 = (int) zval_get_long(&args[0]); /*@SWIG@*/; eslSetLogLevel(arg1); +thrown: return; fail: - SWIG_FAIL(TSRMLS_C); + SWIG_FAIL(); } -static ZEND_RSRC_DTOR_FUNC(_wrap_destroy_p_esl_priority_t) { - /* No destructor for simple type _p_esl_priority_t */ - efree(rsrc->ptr); +static ZEND_RSRC_DTOR_FUNC(_swig_default_rsrc_destroy) { + efree(res->ptr); } static ZEND_RSRC_DTOR_FUNC(_wrap_destroy_p_ESLevent) { - __wrap_delete_ESLevent(rsrc, SWIGTYPE_p_ESLevent->name TSRMLS_CC); -} -static ZEND_RSRC_DTOR_FUNC(_wrap_destroy_p_esl_event_t) { - /* No destructor for simple type _p_esl_event_t */ - efree(rsrc->ptr); + __wrap_delete_ESLevent(res, SWIGTYPE_p_ESLevent->name); } static ZEND_RSRC_DTOR_FUNC(_wrap_destroy_p_ESLconnection) { - __wrap_delete_ESLconnection(rsrc, SWIGTYPE_p_ESLconnection->name TSRMLS_CC); + __wrap_delete_ESLconnection(res, SWIGTYPE_p_ESLconnection->name); } /* end wrapper section */ /* class entry subsection */ /* arginfo subsection */ -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslevent_event_set, 0, 0, 0) +ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_00, 0, 0, 0) ZEND_ARG_PASS_INFO(0) ZEND_ARG_PASS_INFO(0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslevent_event_get, 0, 0, 0) +ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_0, 0, 0, 0) ZEND_ARG_PASS_INFO(0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslevent_serialized_string_set, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslevent_serialized_string_get, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslevent_mine_set, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslevent_mine_get, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_new_eslevent, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslevent_serialize, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslevent_setpriority, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslevent_getheader, 0, 0, 0) +ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_000, 0, 0, 0) ZEND_ARG_PASS_INFO(0) ZEND_ARG_PASS_INFO(0) ZEND_ARG_PASS_INFO(0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslevent_getbody, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslevent_gettype, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslevent_addbody, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslevent_addheader, 0, 0, 0) +ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_0000, 0, 0, 0) ZEND_ARG_PASS_INFO(0) ZEND_ARG_PASS_INFO(0) ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslevent_pushheader, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslevent_unshiftheader, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslevent_delheader, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslevent_firstheader, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslevent_nextheader, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_new_eslconnection, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslconnection_socketdescriptor, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslconnection_connected, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslconnection_getinfo, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslconnection_send, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslconnection_sendrecv, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslconnection_api, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslconnection_bgapi, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslconnection_sendevent, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslconnection_sendmsg, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslconnection_recvevent, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslconnection_recveventtimed, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslconnection_filter, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslconnection_events, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslconnection_execute, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslconnection_executeasync, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslconnection_setasyncexecute, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslconnection_seteventlock, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslconnection_disconnect, 0, 0, 0) - ZEND_ARG_PASS_INFO(0) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_eslsetloglevel, 0, 0, 0) ZEND_ARG_PASS_INFO(0) ZEND_END_ARG_INFO() @@ -3226,64 +3095,60 @@ ZEND_END_ARG_INFO() /* entry subsection */ /* Every non-class user visible function must have an entry here */ static zend_function_entry ESL_functions[] = { - SWIG_ZEND_NAMED_FE(eslevent_event_set,_wrap_ESLevent_event_set,swig_arginfo_eslevent_event_set) - SWIG_ZEND_NAMED_FE(eslevent_event_get,_wrap_ESLevent_event_get,swig_arginfo_eslevent_event_get) - SWIG_ZEND_NAMED_FE(eslevent_serialized_string_set,_wrap_ESLevent_serialized_string_set,swig_arginfo_eslevent_serialized_string_set) - SWIG_ZEND_NAMED_FE(eslevent_serialized_string_get,_wrap_ESLevent_serialized_string_get,swig_arginfo_eslevent_serialized_string_get) - SWIG_ZEND_NAMED_FE(eslevent_mine_set,_wrap_ESLevent_mine_set,swig_arginfo_eslevent_mine_set) - SWIG_ZEND_NAMED_FE(eslevent_mine_get,_wrap_ESLevent_mine_get,swig_arginfo_eslevent_mine_get) - SWIG_ZEND_NAMED_FE(new_eslevent,_wrap_new_ESLevent,swig_arginfo_new_eslevent) - SWIG_ZEND_NAMED_FE(eslevent_serialize,_wrap_ESLevent_serialize,swig_arginfo_eslevent_serialize) - SWIG_ZEND_NAMED_FE(eslevent_setpriority,_wrap_ESLevent_setPriority,swig_arginfo_eslevent_setpriority) - SWIG_ZEND_NAMED_FE(eslevent_getheader,_wrap_ESLevent_getHeader,swig_arginfo_eslevent_getheader) - SWIG_ZEND_NAMED_FE(eslevent_getbody,_wrap_ESLevent_getBody,swig_arginfo_eslevent_getbody) - SWIG_ZEND_NAMED_FE(eslevent_gettype,_wrap_ESLevent_getType,swig_arginfo_eslevent_gettype) - SWIG_ZEND_NAMED_FE(eslevent_addbody,_wrap_ESLevent_addBody,swig_arginfo_eslevent_addbody) - SWIG_ZEND_NAMED_FE(eslevent_addheader,_wrap_ESLevent_addHeader,swig_arginfo_eslevent_addheader) - SWIG_ZEND_NAMED_FE(eslevent_pushheader,_wrap_ESLevent_pushHeader,swig_arginfo_eslevent_pushheader) - SWIG_ZEND_NAMED_FE(eslevent_unshiftheader,_wrap_ESLevent_unshiftHeader,swig_arginfo_eslevent_unshiftheader) - SWIG_ZEND_NAMED_FE(eslevent_delheader,_wrap_ESLevent_delHeader,swig_arginfo_eslevent_delheader) - SWIG_ZEND_NAMED_FE(eslevent_firstheader,_wrap_ESLevent_firstHeader,swig_arginfo_eslevent_firstheader) - SWIG_ZEND_NAMED_FE(eslevent_nextheader,_wrap_ESLevent_nextHeader,swig_arginfo_eslevent_nextheader) - SWIG_ZEND_NAMED_FE(new_eslconnection,_wrap_new_ESLconnection,swig_arginfo_new_eslconnection) - SWIG_ZEND_NAMED_FE(eslconnection_socketdescriptor,_wrap_ESLconnection_socketDescriptor,swig_arginfo_eslconnection_socketdescriptor) - SWIG_ZEND_NAMED_FE(eslconnection_connected,_wrap_ESLconnection_connected,swig_arginfo_eslconnection_connected) - SWIG_ZEND_NAMED_FE(eslconnection_getinfo,_wrap_ESLconnection_getInfo,swig_arginfo_eslconnection_getinfo) - SWIG_ZEND_NAMED_FE(eslconnection_send,_wrap_ESLconnection_send,swig_arginfo_eslconnection_send) - SWIG_ZEND_NAMED_FE(eslconnection_sendrecv,_wrap_ESLconnection_sendRecv,swig_arginfo_eslconnection_sendrecv) - SWIG_ZEND_NAMED_FE(eslconnection_api,_wrap_ESLconnection_api,swig_arginfo_eslconnection_api) - SWIG_ZEND_NAMED_FE(eslconnection_bgapi,_wrap_ESLconnection_bgapi,swig_arginfo_eslconnection_bgapi) - SWIG_ZEND_NAMED_FE(eslconnection_sendevent,_wrap_ESLconnection_sendEvent,swig_arginfo_eslconnection_sendevent) - SWIG_ZEND_NAMED_FE(eslconnection_sendmsg,_wrap_ESLconnection_sendMSG,swig_arginfo_eslconnection_sendmsg) - SWIG_ZEND_NAMED_FE(eslconnection_recvevent,_wrap_ESLconnection_recvEvent,swig_arginfo_eslconnection_recvevent) - SWIG_ZEND_NAMED_FE(eslconnection_recveventtimed,_wrap_ESLconnection_recvEventTimed,swig_arginfo_eslconnection_recveventtimed) - SWIG_ZEND_NAMED_FE(eslconnection_filter,_wrap_ESLconnection_filter,swig_arginfo_eslconnection_filter) - SWIG_ZEND_NAMED_FE(eslconnection_events,_wrap_ESLconnection_events,swig_arginfo_eslconnection_events) - SWIG_ZEND_NAMED_FE(eslconnection_execute,_wrap_ESLconnection_execute,swig_arginfo_eslconnection_execute) - SWIG_ZEND_NAMED_FE(eslconnection_executeasync,_wrap_ESLconnection_executeAsync,swig_arginfo_eslconnection_executeasync) - SWIG_ZEND_NAMED_FE(eslconnection_setasyncexecute,_wrap_ESLconnection_setAsyncExecute,swig_arginfo_eslconnection_setasyncexecute) - SWIG_ZEND_NAMED_FE(eslconnection_seteventlock,_wrap_ESLconnection_setEventLock,swig_arginfo_eslconnection_seteventlock) - SWIG_ZEND_NAMED_FE(eslconnection_disconnect,_wrap_ESLconnection_disconnect,swig_arginfo_eslconnection_disconnect) - SWIG_ZEND_NAMED_FE(eslsetloglevel,_wrap_eslSetLogLevel,swig_arginfo_eslsetloglevel) + SWIG_ZEND_NAMED_FE(eslevent_event_set,_wrap_ESLevent_event_set,swig_arginfo_00) + SWIG_ZEND_NAMED_FE(eslevent_event_get,_wrap_ESLevent_event_get,swig_arginfo_0) + SWIG_ZEND_NAMED_FE(eslevent_serialized_string_set,_wrap_ESLevent_serialized_string_set,swig_arginfo_00) + SWIG_ZEND_NAMED_FE(eslevent_serialized_string_get,_wrap_ESLevent_serialized_string_get,swig_arginfo_0) + SWIG_ZEND_NAMED_FE(eslevent_mine_set,_wrap_ESLevent_mine_set,swig_arginfo_00) + SWIG_ZEND_NAMED_FE(eslevent_mine_get,_wrap_ESLevent_mine_get,swig_arginfo_0) + SWIG_ZEND_NAMED_FE(new_eslevent,_wrap_new_ESLevent,swig_arginfo_0) + SWIG_ZEND_NAMED_FE(eslevent_serialize,_wrap_ESLevent_serialize,swig_arginfo_00) + SWIG_ZEND_NAMED_FE(eslevent_setpriority,_wrap_ESLevent_setPriority,swig_arginfo_00) + SWIG_ZEND_NAMED_FE(eslevent_getheader,_wrap_ESLevent_getHeader,swig_arginfo_000) + SWIG_ZEND_NAMED_FE(eslevent_getbody,_wrap_ESLevent_getBody,swig_arginfo_0) + SWIG_ZEND_NAMED_FE(eslevent_gettype,_wrap_ESLevent_getType,swig_arginfo_0) + SWIG_ZEND_NAMED_FE(eslevent_addbody,_wrap_ESLevent_addBody,swig_arginfo_00) + SWIG_ZEND_NAMED_FE(eslevent_addheader,_wrap_ESLevent_addHeader,swig_arginfo_000) + SWIG_ZEND_NAMED_FE(eslevent_pushheader,_wrap_ESLevent_pushHeader,swig_arginfo_000) + SWIG_ZEND_NAMED_FE(eslevent_unshiftheader,_wrap_ESLevent_unshiftHeader,swig_arginfo_000) + SWIG_ZEND_NAMED_FE(eslevent_delheader,_wrap_ESLevent_delHeader,swig_arginfo_00) + SWIG_ZEND_NAMED_FE(eslevent_firstheader,_wrap_ESLevent_firstHeader,swig_arginfo_0) + SWIG_ZEND_NAMED_FE(eslevent_nextheader,_wrap_ESLevent_nextHeader,swig_arginfo_0) + SWIG_ZEND_NAMED_FE(new_eslconnection,_wrap_new_ESLconnection,swig_arginfo_0) + SWIG_ZEND_NAMED_FE(eslconnection_socketdescriptor,_wrap_ESLconnection_socketDescriptor,swig_arginfo_0) + SWIG_ZEND_NAMED_FE(eslconnection_connected,_wrap_ESLconnection_connected,swig_arginfo_0) + SWIG_ZEND_NAMED_FE(eslconnection_getinfo,_wrap_ESLconnection_getInfo,swig_arginfo_0) + SWIG_ZEND_NAMED_FE(eslconnection_send,_wrap_ESLconnection_send,swig_arginfo_00) + SWIG_ZEND_NAMED_FE(eslconnection_sendrecv,_wrap_ESLconnection_sendRecv,swig_arginfo_00) + SWIG_ZEND_NAMED_FE(eslconnection_api,_wrap_ESLconnection_api,swig_arginfo_000) + SWIG_ZEND_NAMED_FE(eslconnection_bgapi,_wrap_ESLconnection_bgapi,swig_arginfo_0000) + SWIG_ZEND_NAMED_FE(eslconnection_sendevent,_wrap_ESLconnection_sendEvent,swig_arginfo_00) + SWIG_ZEND_NAMED_FE(eslconnection_sendmsg,_wrap_ESLconnection_sendMSG,swig_arginfo_000) + SWIG_ZEND_NAMED_FE(eslconnection_recvevent,_wrap_ESLconnection_recvEvent,swig_arginfo_0) + SWIG_ZEND_NAMED_FE(eslconnection_recveventtimed,_wrap_ESLconnection_recvEventTimed,swig_arginfo_00) + SWIG_ZEND_NAMED_FE(eslconnection_filter,_wrap_ESLconnection_filter,swig_arginfo_000) + SWIG_ZEND_NAMED_FE(eslconnection_events,_wrap_ESLconnection_events,swig_arginfo_000) + SWIG_ZEND_NAMED_FE(eslconnection_execute,_wrap_ESLconnection_execute,swig_arginfo_0000) + SWIG_ZEND_NAMED_FE(eslconnection_executeasync,_wrap_ESLconnection_executeAsync,swig_arginfo_0000) + SWIG_ZEND_NAMED_FE(eslconnection_setasyncexecute,_wrap_ESLconnection_setAsyncExecute,swig_arginfo_00) + SWIG_ZEND_NAMED_FE(eslconnection_seteventlock,_wrap_ESLconnection_setEventLock,swig_arginfo_00) + SWIG_ZEND_NAMED_FE(eslconnection_disconnect,_wrap_ESLconnection_disconnect,swig_arginfo_0) + SWIG_ZEND_NAMED_FE(eslsetloglevel,_wrap_eslSetLogLevel,swig_arginfo_0) SWIG_ZEND_NAMED_FE(swig_ESL_alter_newobject,_wrap_swig_ESL_alter_newobject,NULL) SWIG_ZEND_NAMED_FE(swig_ESL_get_newobject,_wrap_swig_ESL_get_newobject,NULL) -{NULL, NULL, NULL} + ZEND_FE_END }; /* init section */ -#if ZEND_MODULE_API_NO <= 20090626 -#undef ZEND_MODULE_BUILD_ID -#define ZEND_MODULE_BUILD_ID (char*)"API" ZEND_TOSTR(ZEND_MODULE_API_NO) ZEND_BUILD_TS ZEND_BUILD_DEBUG ZEND_BUILD_SYSTEM ZEND_BUILD_EXTRA -#endif zend_module_entry ESL_module_entry = { STANDARD_MODULE_HEADER, - (char*)"ESL", + "ESL", ESL_functions, PHP_MINIT(ESL), - PHP_MSHUTDOWN(ESL), - PHP_RINIT(ESL), - PHP_RSHUTDOWN(ESL), - PHP_MINFO(ESL), + NULL, /* No MSHUTDOWN code */ + NULL, /* No RINIT code */ + NULL, /* No RSHUTDOWN code */ + NULL, /* No MINFO code */ NO_VERSION_YET, STANDARD_MODULE_PROPERTIES }; @@ -3298,6 +3163,7 @@ SWIGEXPORT zend_module_entry *get_module(void) { return &ESL_module_entry; } #endif #define SWIG_php_minit PHP_MINIT_FUNCTION(ESL) + /* ----------------------------------------------------------------------------- * Type initialization: * This problem is tough by the requirement that no dynamic @@ -3355,7 +3221,7 @@ SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { size_t i; swig_module_info *module_head, *iter; - int found, init; + int init; /* check to see if the circular list has been setup, if not, set it up */ if (swig_module.next==0) { @@ -3374,22 +3240,18 @@ SWIG_InitializeModule(void *clientdata) { /* This is the first module loaded for this interpreter */ /* so set the swig module into the interpreter */ SWIG_SetModule(clientdata, &swig_module); - module_head = &swig_module; } else { /* the interpreter has loaded a SWIG module, but has it loaded this one? */ - found=0; iter=module_head; do { if (iter==&swig_module) { - found=1; - break; + /* Our module is already in the list, so there's nothing more to do. */ + return; } iter=iter->next; } while (iter!= module_head); - /* if the is found in the list, then all is done and we may leave */ - if (found) return; - /* otherwise we must add out module into the list */ + /* otherwise we must add our module into the list */ swig_module.next = module_head->next; module_head->next = &swig_module; } @@ -3534,20 +3396,20 @@ SWIG_PropagateClientData(void) { #endif - SWIG_php_minit { +SWIG_php_minit { SWIG_InitializeModule(0); /* oinit subsection */ -ZEND_INIT_MODULE_GLOBALS(ESL, ESL_init_globals, ESL_destroy_globals); +ZEND_INIT_MODULE_GLOBALS(ESL, ESL_init_globals, NULL); /* Register resource destructors for pointer types */ -le_swig__p_esl_priority_t=zend_register_list_destructors_ex(_wrap_destroy_p_esl_priority_t,NULL,(char *)(SWIGTYPE_p_esl_priority_t->name),module_number); +le_swig__p_esl_priority_t=zend_register_list_destructors_ex(_swig_default_rsrc_destroy, NULL, SWIGTYPE_p_esl_priority_t->name, module_number); SWIG_TypeClientData(SWIGTYPE_p_esl_priority_t,&le_swig__p_esl_priority_t); -le_swig__p_ESLevent=zend_register_list_destructors_ex(_wrap_destroy_p_ESLevent,NULL,(char *)(SWIGTYPE_p_ESLevent->name),module_number); +le_swig__p_ESLevent=zend_register_list_destructors_ex(_wrap_destroy_p_ESLevent, NULL, SWIGTYPE_p_ESLevent->name, module_number); SWIG_TypeClientData(SWIGTYPE_p_ESLevent,&le_swig__p_ESLevent); -le_swig__p_esl_event_t=zend_register_list_destructors_ex(_wrap_destroy_p_esl_event_t,NULL,(char *)(SWIGTYPE_p_esl_event_t->name),module_number); +le_swig__p_esl_event_t=zend_register_list_destructors_ex(_swig_default_rsrc_destroy, NULL, SWIGTYPE_p_esl_event_t->name, module_number); SWIG_TypeClientData(SWIGTYPE_p_esl_event_t,&le_swig__p_esl_event_t); -le_swig__p_ESLconnection=zend_register_list_destructors_ex(_wrap_destroy_p_ESLconnection,NULL,(char *)(SWIGTYPE_p_ESLconnection->name),module_number); +le_swig__p_ESLconnection=zend_register_list_destructors_ex(_wrap_destroy_p_ESLconnection, NULL, SWIGTYPE_p_ESLconnection->name, module_number); SWIG_TypeClientData(SWIGTYPE_p_ESLconnection,&le_swig__p_ESLconnection); CG(active_class_entry) = NULL; /* end oinit subsection */ @@ -3558,33 +3420,4 @@ CG(active_class_entry) = NULL; return SUCCESS; } -PHP_RINIT_FUNCTION(ESL) -{ -/* rinit section */ - -/* vinit subsection */ -/* end vinit subsection */ - - return SUCCESS; -} - -PHP_MSHUTDOWN_FUNCTION(ESL) -{ -/* shutdown section */ -#ifdef ZTS - ts_free_id(ESL_globals_id); -#endif - return SUCCESS; -} - -PHP_RSHUTDOWN_FUNCTION(ESL) -{ -/* rshutdown section */ - - return SUCCESS; -} - -PHP_MINFO_FUNCTION(ESL) -{ -} /* end init section */ diff --git a/libs/esl/php/php_ESL.h b/libs/esl/php/php_ESL.h index d6420ea75d..eddf998dd9 100644 --- a/libs/esl/php/php_ESL.h +++ b/libs/esl/php/php_ESL.h @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 3.0.2 + * Version 3.0.12 * * 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 @@ -20,16 +20,6 @@ extern zend_module_entry ESL_module_entry; # define PHP_ESL_API #endif -#ifdef ZTS -#include "TSRM.h" -#endif - -PHP_MINIT_FUNCTION(ESL); -PHP_MSHUTDOWN_FUNCTION(ESL); -PHP_RINIT_FUNCTION(ESL); -PHP_RSHUTDOWN_FUNCTION(ESL); -PHP_MINFO_FUNCTION(ESL); - ZEND_NAMED_FUNCTION(_wrap_ESLevent_event_set); ZEND_NAMED_FUNCTION(_wrap_ESLevent_event_get); ZEND_NAMED_FUNCTION(_wrap_ESLevent_serialized_string_set); @@ -69,4 +59,6 @@ ZEND_NAMED_FUNCTION(_wrap_ESLconnection_setAsyncExecute); ZEND_NAMED_FUNCTION(_wrap_ESLconnection_setEventLock); ZEND_NAMED_FUNCTION(_wrap_ESLconnection_disconnect); ZEND_NAMED_FUNCTION(_wrap_eslSetLogLevel); +PHP_MINIT_FUNCTION(ESL); + #endif /* PHP_ESL_H */ From c4ec06dc23c448e164eeb2da214689db846c4fb2 Mon Sep 17 00:00:00 2001 From: Andrew Savchenko Date: Thu, 10 Oct 2019 16:20:12 +0300 Subject: [PATCH 022/118] Add support for the Elbrus architecture The Elbrus architecture (aka E2K, aka 2000) is LE. Signed-off-by: Andrew Savchenko --- libs/libzrtp/include/zrtp_config.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libs/libzrtp/include/zrtp_config.h b/libs/libzrtp/include/zrtp_config.h index b4631c2007..dbfad31f7d 100644 --- a/libs/libzrtp/include/zrtp_config.h +++ b/libs/libzrtp/include/zrtp_config.h @@ -119,6 +119,12 @@ */ #define ZRTP_BYTE_ORDER ZBO_LITTLE_ENDIAN +#elif defined(__e2k__) +/* + * Elbrus, little endian + */ +#define ZRTP_BYTE_ORDER ZBO_LITTLE_ENDIAN + #endif /* Automatic byte order detection */ #endif From 9d4f480335cfa3980c360754125805551f5e0d12 Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Wed, 9 Oct 2019 19:31:45 -0400 Subject: [PATCH 023/118] [mod_sofia] Fix some incorrect word contractions. --- src/mod/endpoints/mod_sofia/sofia_glue.c | 2 +- src/mod/endpoints/mod_sofia/sofia_reg.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 2d1a60243f..dc6442f70d 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -852,7 +852,7 @@ char *sofia_overcome_sip_uri_weakness(switch_core_session_t *session, const char stripped = sofia_glue_get_url_from_contact(stripped, 0); - /* remove our params so we don't make any whiny moronic device piss it's pants and forget who it is for a half-hour */ + /* remove our params so we don't make any whiny moronic device piss its pants and forget who it is for a half-hour */ if ((p = (char *) switch_stristr(";fs_", stripped))) { *p = '\0'; } diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index c523af78ae..43d0eeb353 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -2929,7 +2929,7 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, if (switch_xml_locate_user_merged("id", zstr(username) ? "nobody" : username, domain_name, ip, &user, params) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't find user [%s@%s] from %s\n" "You must define a domain called '%s' in your directory and add a user with the id=\"%s\" attribute\n" - "and you must configure your device to use the proper domain in it's authentication credentials.\n", username, domain_name, + "and you must configure your device to use the proper domain in its authentication credentials.\n", username, domain_name, ip, domain_name, username); ret = AUTH_FORBIDDEN; @@ -2937,7 +2937,7 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, } else { const char *type = switch_xml_attr(user, "type"); if (type && !strcasecmp(type, "pointer")) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cant register a pointer.\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't register a pointer.\n"); ret = AUTH_FORBIDDEN; goto end; } From fc41980f19d1471cf86a150cbaa841fe86c16dd2 Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Wed, 9 Oct 2019 19:10:26 +0200 Subject: [PATCH 024/118] [mod_event_multicast] Fix memory leak Taken from FS-11193: In "event_handler()" function, when encrypting data using openssl 1.1.0, the context ctx is allocated by "EVP_CIPHER_CTX_new()", then data is encrypted, and at the end, EVP_CIPHER_CTX_cleanup is called. This function resets the context (the function itself is deprecated, and has been renamed to "EVP_CIPHER_CTX_reset) so that it can be used again. The correct call would be to "EVP_CIPHER_CTX_free()", which frees the memory. The code for openssl 1.0 is OK, since the "ctx" struct is kept in stack. The same thing happens during decryption. "ctx" is allocated, but never freed. Signed-off-by: Eneas U de Queiroz Signed-off-by: Sebastian Kemper --- .../event_handlers/mod_event_multicast/mod_event_multicast.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c index 7fe2911ba6..f9fa8ff02b 100644 --- a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c +++ b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c @@ -324,7 +324,7 @@ static void event_handler(switch_event_t *event) &tmplen, (unsigned char *) MAGIC, (int) strlen((char *) MAGIC)); outlen += tmplen; EVP_EncryptFinal(ctx, (unsigned char *) buf + SWITCH_UUID_FORMATTED_LENGTH + outlen, &tmplen); - EVP_CIPHER_CTX_cleanup(ctx); + EVP_CIPHER_CTX_free(ctx); #else EVP_CIPHER_CTX_init(&ctx); EVP_EncryptInit(&ctx, EVP_bf_cbc(), NULL, NULL); @@ -577,7 +577,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_multicast_runtime) EVP_DecryptInit(ctx, NULL, (unsigned char *) globals.psk, (unsigned char *) uuid_str); EVP_DecryptUpdate(ctx, (unsigned char *) tmp, &outl, (unsigned char *) packet, (int) len); EVP_DecryptFinal(ctx, (unsigned char *) tmp + outl, &tmplen); - EVP_CIPHER_CTX_cleanup(ctx); + EVP_CIPHER_CTX_free(ctx); #else EVP_CIPHER_CTX_init(&ctx); EVP_DecryptInit(&ctx, EVP_bf_cbc(), NULL, NULL); From 8919d581fe7d617bf8ee7765db85e7b9f8e1935d Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Wed, 9 Oct 2019 19:05:37 +0200 Subject: [PATCH 025/118] [fs_cli] Fix typo, resolves garbled screen Related to FS-11309. Commit bc3e1c9e7de1855eec454bba467fd2586e5e251b introduced a typo that results in EL_REFRESH never being used, even if available. This can cause the screen to garble. This fixes the typo. Signed-off-by: Sebastian Kemper --- libs/esl/fs_cli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/esl/fs_cli.c b/libs/esl/fs_cli.c index 99db32764b..fd6153e091 100644 --- a/libs/esl/fs_cli.c +++ b/libs/esl/fs_cli.c @@ -674,7 +674,7 @@ static void redisplay(void) esl_mutex_lock(MUTEX); { #ifdef HAVE_LIBEDIT -#ifdef XHAVE_DECL_EL_REFRESH +#ifdef HAVE_DECL_EL_REFRESH #ifdef HAVE_EL_WSET /* Current libedit versions don't implement EL_REFRESH in eln.c so * use the wide version instead. */ From 318e5d0d6d76c834bc93196d58d3d9908c3e65ea Mon Sep 17 00:00:00 2001 From: lazedo Date: Sun, 13 Oct 2019 12:21:22 +0100 Subject: [PATCH 026/118] [mod_kazoo] fix xml leak when event-filter is not available --- src/mod/event_handlers/mod_kazoo/kazoo_ei_utils.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_ei_utils.c b/src/mod/event_handlers/mod_kazoo/kazoo_ei_utils.c index c1b792f490..514980b426 100644 --- a/src/mod/event_handlers/mod_kazoo/kazoo_ei_utils.c +++ b/src/mod/event_handlers/mod_kazoo/kazoo_ei_utils.c @@ -866,7 +866,8 @@ static void fetch_config_filters(switch_memory_pool_t *pool) if (!(xml = switch_xml_open_cfg(cf, &cfg, params))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to open configuration file %s\n", cf); - } else if ((child = switch_xml_child(cfg, "event-filter"))) { + } else { + if ((child = switch_xml_child(cfg, "event-filter"))) { switch_hash_t *filter; switch_hash_t *old_filter; @@ -881,9 +882,10 @@ static void fetch_config_filters(switch_memory_pool_t *pool) if (old_filter) { switch_core_hash_destroy(&old_filter); } + } - kazoo_globals.config_fetched = 1; - switch_xml_free(xml); + kazoo_globals.config_fetched = 1; + switch_xml_free(xml); } } From 696814cb2627def7e823aeb7216d20ed03cadf49 Mon Sep 17 00:00:00 2001 From: Ciprian Date: Sun, 13 Oct 2019 13:27:58 -0400 Subject: [PATCH 027/118] [Core] Disable msrp by default, only enable when listen-port or listen-ssl-port config params configured in msrp.conf --- conf/vanilla/autoload_configs/msrp.conf.xml | 4 +- src/include/switch_msrp.h | 3 -- src/switch_msrp.c | 46 +++++++++++---------- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/conf/vanilla/autoload_configs/msrp.conf.xml b/conf/vanilla/autoload_configs/msrp.conf.xml index 8b9e03e300..65c2d61976 100644 --- a/conf/vanilla/autoload_configs/msrp.conf.xml +++ b/conf/vanilla/autoload_configs/msrp.conf.xml @@ -1,8 +1,8 @@ - - + + diff --git a/src/include/switch_msrp.h b/src/include/switch_msrp.h index 0b114c02fa..9ec9243664 100644 --- a/src/include/switch_msrp.h +++ b/src/include/switch_msrp.h @@ -34,9 +34,6 @@ #include -#define MSRP_LISTEN_PORT 2855 -#define MSRP_SSL_LISTEN_PORT 2856 - enum { MSRP_ST_WAIT_HEADER, MSRP_ST_PARSE_HEADER, diff --git a/src/switch_msrp.c b/src/switch_msrp.c index bc680d11ca..da5e288dc0 100644 --- a/src/switch_msrp.c +++ b/src/switch_msrp.c @@ -36,8 +36,6 @@ #define MSRP_BUFF_SIZE (SWITCH_RTP_MAX_BUF_LEN - 32) #define DEBUG_MSRP 0 -#define MSRP_LISTEN_PORT 2855 -#define MSRP_SSL_LISTEN_PORT 2856 struct msrp_socket_s { switch_port_t port; @@ -297,35 +295,41 @@ SWITCH_DECLARE(switch_status_t) switch_msrp_init() memset(&globals, 0, sizeof(globals)); set_global_ip("0.0.0.0"); globals.pool = pool; - globals.msock.port = (switch_port_t)MSRP_LISTEN_PORT; - globals.msock_ssl.port = (switch_port_t)MSRP_SSL_LISTEN_PORT; + globals.msock.port = (switch_port_t)0; + globals.msock_ssl.port = (switch_port_t)0; globals.msock_ssl.secure = 1; globals.message_buffer_size = 50; globals.debug = DEBUG_MSRP; load_config(); - globals.running = 1; + if (globals.msock.port) { + globals.running = 1; - status = msock_init(globals.ip, globals.msock.port, &globals.msock.sock, pool); + status = msock_init(globals.ip, globals.msock.port, &globals.msock.sock, pool); - if (status == SWITCH_STATUS_SUCCESS) { - switch_threadattr_create(&thd_attr, pool); - // switch_threadattr_detach_set(thd_attr, 1); - switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); - switch_thread_create(&thread, thd_attr, msrp_listener, &globals.msock, pool); - globals.msock.thread = thread; + if (status == SWITCH_STATUS_SUCCESS) { + switch_threadattr_create(&thd_attr, pool); + // switch_threadattr_detach_set(thd_attr, 1); + switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); + switch_thread_create(&thread, thd_attr, msrp_listener, &globals.msock, pool); + globals.msock.thread = thread; + } } - msrp_init_ssl(); - status = msock_init(globals.ip, globals.msock_ssl.port, &globals.msock_ssl.sock, pool); + if (globals.msock_ssl.port) { + globals.running = 1; - if (status == SWITCH_STATUS_SUCCESS) { - switch_threadattr_create(&thd_attr, pool); - // switch_threadattr_detach_set(thd_attr, 1); - switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); - switch_thread_create(&thread, thd_attr, msrp_listener, &globals.msock_ssl, pool); - globals.msock_ssl.thread = thread; + msrp_init_ssl(); + status = msock_init(globals.ip, globals.msock_ssl.port, &globals.msock_ssl.sock, pool); + + if (status == SWITCH_STATUS_SUCCESS) { + switch_threadattr_create(&thd_attr, pool); + // switch_threadattr_detach_set(thd_attr, 1); + switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); + switch_thread_create(&thread, thd_attr, msrp_listener, &globals.msock_ssl, pool); + globals.msock_ssl.thread = thread; + } } return SWITCH_STATUS_SUCCESS; @@ -411,7 +415,7 @@ SWITCH_DECLARE(switch_status_t) switch_msrp_session_destroy(switch_msrp_session_ switch_status_t switch_msrp_session_push_msg(switch_msrp_session_t *ms, switch_msrp_msg_t *msg) { switch_mutex_lock(ms->mutex); - + if (ms->last_msg == NULL) { ms->last_msg = msg; ms->msrp_msg = msg; From 77cd699000fb8235703bea6053c2ff9eb54a0c8a Mon Sep 17 00:00:00 2001 From: Pelle Mattsson Date: Sun, 13 Oct 2019 19:46:37 +0200 Subject: [PATCH 028/118] [Docs] Rename Docker README to README.md, so github recognizes that it as a Markdown file and update the git url in it --- docker/{README => README.md} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename docker/{README => README.md} (95%) diff --git a/docker/README b/docker/README.md similarity index 95% rename from docker/README rename to docker/README.md index c18afbbdd4..e9a321e699 100644 --- a/docker/README +++ b/docker/README.md @@ -31,7 +31,7 @@ The container exposes the following ports: If you wish to help improve these please submit a pull request at: -https://freeswitch.org/jira +https://github.com/signalwire/freeswitch Thanks, /b From 7e91927278f5bb9ed4cb3ba059e4d888a9696352 Mon Sep 17 00:00:00 2001 From: cdosoftei Date: Tue, 15 Oct 2019 12:37:47 -0400 Subject: [PATCH 029/118] [mod_amqp] Properly parse out heartbeat parameter --- src/mod/event_handlers/mod_amqp/mod_amqp_connection.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/event_handlers/mod_amqp/mod_amqp_connection.c b/src/mod/event_handlers/mod_amqp/mod_amqp_connection.c index 2d8ef8c088..7f56c9579c 100644 --- a/src/mod/event_handlers/mod_amqp/mod_amqp_connection.c +++ b/src/mod/event_handlers/mod_amqp/mod_amqp_connection.c @@ -220,7 +220,7 @@ switch_status_t mod_amqp_connection_create(mod_amqp_connection_t **conn, switch_ if (interval && interval > 0) { port = interval; } - } else if (!strncmp(var, "heartbeat", 4)) { + } else if (!strncmp(var, "heartbeat", 9)) { int interval = atoi(val); if (interval && interval > 0) { heartbeat = interval; From 5f628c009053a5419617cba4259c7cdb9d6a169a Mon Sep 17 00:00:00 2001 From: cdosoftei Date: Thu, 17 Oct 2019 15:38:38 -0400 Subject: [PATCH 030/118] [mod_amqp] open logging and produced connections from within their respective threads --- .../mod_amqp/mod_amqp_logging.c | 29 +------------------ .../mod_amqp/mod_amqp_producer.c | 28 +----------------- 2 files changed, 2 insertions(+), 55 deletions(-) diff --git a/src/mod/event_handlers/mod_amqp/mod_amqp_logging.c b/src/mod/event_handlers/mod_amqp/mod_amqp_logging.c index dd6fa599d9..01d08960fa 100644 --- a/src/mod/event_handlers/mod_amqp/mod_amqp_logging.c +++ b/src/mod/event_handlers/mod_amqp/mod_amqp_logging.c @@ -238,34 +238,7 @@ switch_status_t mod_amqp_logging_create(char *name, switch_xml_t cfg) } } profile->conn_active = NULL; - - if ( mod_amqp_connection_open(profile->conn_root, &(profile->conn_active), profile->name, profile->custom_attr) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile[%s] was unable to connect to any connection\n", profile->name); - goto err; - } - -#if AMQP_VERSION_MAJOR == 0 && AMQP_VERSION_MINOR >= 6 - amqp_exchange_declare(profile->conn_active->state, 1, - amqp_cstring_bytes(profile->exchange), - amqp_cstring_bytes(profile->exchange_type), - 0, /* passive */ - profile->exchange_durable, - profile->exchange_auto_delete, - 0, - amqp_empty_table); -#else - amqp_exchange_declare(profile->conn_active->state, 1, - amqp_cstring_bytes(profile->exchange), - amqp_cstring_bytes(profile->exchange_type), - 0, /* passive */ - profile->exchange_durable, - amqp_empty_table); -#endif - - if (mod_amqp_log_if_amqp_error(amqp_get_rpc_reply(profile->conn_active->state), "Declaring exchange")) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile[%s] failed to create exchange\n", profile->name); - goto err; - } + /* We are not going to open the logging queue connection on create, but instead wait for the running thread to open it */ /* Create a bounded FIFO queue for sending messages */ if (switch_queue_create(&(profile->send_queue), profile->send_queue_size, profile->pool) != SWITCH_STATUS_SUCCESS) { diff --git a/src/mod/event_handlers/mod_amqp/mod_amqp_producer.c b/src/mod/event_handlers/mod_amqp/mod_amqp_producer.c index d4479b1752..d7741d3f41 100644 --- a/src/mod/event_handlers/mod_amqp/mod_amqp_producer.c +++ b/src/mod/event_handlers/mod_amqp/mod_amqp_producer.c @@ -325,33 +325,7 @@ switch_status_t mod_amqp_producer_create(char *name, switch_xml_t cfg) } } profile->conn_active = NULL; - - if ( mod_amqp_connection_open(profile->conn_root, &(profile->conn_active), profile->name, profile->custom_attr) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile[%s] was unable to connect to any connection\n", profile->name); - goto err; - } -#if AMQP_VERSION_MAJOR == 0 && AMQP_VERSION_MINOR >= 6 - amqp_exchange_declare(profile->conn_active->state, 1, - amqp_cstring_bytes(profile->exchange), - amqp_cstring_bytes(profile->exchange_type), - 0, /* passive */ - profile->exchange_durable, - profile->exchange_auto_delete, - 0, - amqp_empty_table); -#else - amqp_exchange_declare(profile->conn_active->state, 1, - amqp_cstring_bytes(profile->exchange), - amqp_cstring_bytes(profile->exchange_type), - 0, /* passive */ - profile->exchange_durable, - amqp_empty_table); -#endif - - if (mod_amqp_log_if_amqp_error(amqp_get_rpc_reply(profile->conn_active->state), "Declaring exchange\n")) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile[%s] failed to create exchange\n", profile->name); - goto err; - } + /* We are not going to open the producer queue connection on create, but instead wait for the running thread to open it */ /* Create a bounded FIFO queue for sending messages */ if (switch_queue_create(&(profile->send_queue), profile->send_queue_size, profile->pool) != SWITCH_STATUS_SUCCESS) { From 6a900a90a3b902d5766624718182a7944dfeb20c Mon Sep 17 00:00:00 2001 From: Mike Jerris Date: Tue, 22 Oct 2019 10:24:14 -0600 Subject: [PATCH 031/118] [build] OSX Catalina configure does not support --extra-cflags and fix broken compiler option test for -Wno-extended-offsetof that was used to fix older osx clang issue --- Makefile.am | 2 +- configure.ac | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index f832dd52aa..61b2c609da 100644 --- a/Makefile.am +++ b/Makefile.am @@ -586,7 +586,7 @@ libs/libzrtp/libzrtp.a: cd libs/libzrtp && $(MAKE) libs/libvpx/Makefile: libs/libvpx/.update - cd libs/libvpx && CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" ./configure --enable-pic --disable-docs --disable-examples --disable-install-bins --disable-install-srcs --disable-unit-tests --size-limit=16384x16384 --extra-cflags="$(VISIBILITY_FLAG)" + cd libs/libvpx && CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS) $(VISIBILITY_FLAG)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" ./configure --enable-pic --disable-docs --disable-examples --disable-install-bins --disable-install-srcs --disable-unit-tests --size-limit=16384x16384 libs/libvpx/libvpx.a: libs/libvpx/Makefile libs/libvpx/.update @cd libs/libvpx && $(MAKE) diff --git a/configure.ac b/configure.ac index 3e7aa0e0b2..40e27c6094 100644 --- a/configure.ac +++ b/configure.ac @@ -1052,14 +1052,17 @@ fi CFLAGS="$saved_CFLAGS" if test "x${ax_cv_c_compiler_vendor}" = "xclang" ; then + saved_CFLAGS="$CFLAGS" # Next check added for Xcode 5 and systems with clang 5 llvm 3.3 or above, extended offset must be off AC_CACHE_CHECK([whether compiler supports -Wextended-offsetof], [ac_cv_clang_extended_offsetof], [ + CFLAGS="$CFLAGS -Wno-extended-offsetof" AC_TRY_COMPILE([],[return 0;],[ac_cv_clang_extended_offsetof=yes],[ac_cv_clang_extended_offsetof=no]) ]) AC_MSG_RESULT($ac_cv_clang_extended_offsetof) if test x"$ac_cv_clang_extended_offsetof" = xyes; then APR_ADDTO(CFLAGS, -Wno-extended-offsetof) fi + CFLAGS="$saved_CFLAGS" fi # Tested and fixed lot of modules, but some are untested. Will be added back when the core team decide it ready From 5244a64d4e609eebb97d069a82317c276d677288 Mon Sep 17 00:00:00 2001 From: cdosoftei Date: Tue, 22 Oct 2019 15:22:00 -0400 Subject: [PATCH 032/118] [mod_amqp] configurable commands queue properties --- conf/vanilla/autoload_configs/amqp.conf.xml | 4 ++++ src/mod/event_handlers/mod_amqp/mod_amqp.h | 6 ++++++ .../mod_amqp/mod_amqp_command.c | 20 +++++++++++++++++-- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/conf/vanilla/autoload_configs/amqp.conf.xml b/conf/vanilla/autoload_configs/amqp.conf.xml index d6c24f4ff7..3db3c32232 100644 --- a/conf/vanilla/autoload_configs/amqp.conf.xml +++ b/conf/vanilla/autoload_configs/amqp.conf.xml @@ -57,6 +57,10 @@ + + + + diff --git a/src/mod/event_handlers/mod_amqp/mod_amqp.h b/src/mod/event_handlers/mod_amqp/mod_amqp.h index 0282c1a34c..53ea03836c 100644 --- a/src/mod/event_handlers/mod_amqp/mod_amqp.h +++ b/src/mod/event_handlers/mod_amqp/mod_amqp.h @@ -134,6 +134,12 @@ typedef struct { char *queue; char *binding_key; + /* Queue properties */ + switch_bool_t passive; + switch_bool_t durable; + switch_bool_t exclusive; + switch_bool_t auto_delete; + /* Note: The AMQP channel is not reentrant this MUTEX serializes sending events. */ mod_amqp_connection_t *conn_root; mod_amqp_connection_t *conn_active; diff --git a/src/mod/event_handlers/mod_amqp/mod_amqp_command.c b/src/mod/event_handlers/mod_amqp/mod_amqp_command.c index dba6d20eb0..f467001f3d 100644 --- a/src/mod/event_handlers/mod_amqp/mod_amqp_command.c +++ b/src/mod/event_handlers/mod_amqp/mod_amqp_command.c @@ -121,6 +121,12 @@ switch_status_t mod_amqp_command_create(char *name, switch_xml_t cfg) goto err; } + /* Default queue properties, set to match formerly hardcoded values */ + profile->passive = SWITCH_FALSE; + profile->durable = SWITCH_FALSE; + profile->exclusive = SWITCH_FALSE; + profile->auto_delete = SWITCH_TRUE; + if ((params = switch_xml_child(cfg, "params")) != NULL) { for (param = switch_xml_child(params, "param"); param; param = param->next) { char *var = (char *) switch_xml_attr_soft(param, "name"); @@ -147,6 +153,14 @@ switch_status_t mod_amqp_command_create(char *name, switch_xml_t cfg) queue = mod_amqp_expand_header(profile->pool, event, val); } else if (!strncmp(var, "binding_key", 11)) { binding_key = mod_amqp_expand_header(profile->pool, event, val); + } else if (!strncmp(var, "queue-passive", 13)) { + profile->passive = switch_true(val); + } else if (!strncmp(var, "queue-durable", 13)) { + profile->durable = switch_true(val); + } else if (!strncmp(var, "queue-exclusive", 15)) { + profile->exclusive = switch_true(val); + } else if (!strncmp(var, "queue-auto-delete", 17)) { + profile->auto_delete = switch_true(val); } } } @@ -308,8 +322,10 @@ void * SWITCH_THREAD_FUNC mod_amqp_command_thread(switch_thread_t *thread, void recv_queue = amqp_queue_declare(profile->conn_active->state, // state 1, // channel profile->queue ? amqp_cstring_bytes(profile->queue) : amqp_empty_bytes, // queue name - 0, 0, // passive, durable - 0, 1, // exclusive, auto-delete + profile->passive, + profile->durable, + profile->exclusive, + profile->auto_delete, amqp_empty_table); // args if (mod_amqp_log_if_amqp_error(amqp_get_rpc_reply(profile->conn_active->state), "Declaring queue\n")) { From 311a20af63443255dda0764c578bdac190fd84da Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 23 Oct 2019 23:03:18 +0400 Subject: [PATCH 033/118] [mod_verto] Ignore not just zero but negative frame size as well. --- src/mod/endpoints/mod_verto/mod_verto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index f7dba78ae7..efd76ac25c 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -1922,7 +1922,7 @@ static void client_run(jsock_t *jsock) int rem = 0; int dur = 0, j = 0; - if (!(size = atoi(p))) { + if ((size = atoi(p)) <= 0) { continue; } From 07c6ad5e1a8075d072573d0b0e16878e9f677e94 Mon Sep 17 00:00:00 2001 From: Mike Jerris Date: Wed, 23 Oct 2019 13:54:09 -0600 Subject: [PATCH 034/118] [build] fix libvpx osx build detection on newer compilers and osx versions so we use sse extensions on newer versions --- libs/libvpx/build/make/configure.sh | 24 ++++++++++++++++++++++++ libs/libvpx/build/make/iosbuild.sh | 6 +++--- libs/libvpx/configure | 5 +++++ 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/libs/libvpx/build/make/configure.sh b/libs/libvpx/build/make/configure.sh index 683b430374..4bf61eb5eb 100644 --- a/libs/libvpx/build/make/configure.sh +++ b/libs/libvpx/build/make/configure.sh @@ -757,6 +757,18 @@ process_common_toolchain() { tgt_isa=x86_64 tgt_os=darwin16 ;; + *darwin17*) + tgt_isa=x86_64 + tgt_os=darwin17 + ;; + *darwin18*) + tgt_isa=x86_64 + tgt_os=darwin18 + ;; + *darwin19*) + tgt_isa=x86_64 + tgt_os=darwin19 + ;; x86_64*mingw32*) tgt_os=win64 ;; @@ -885,6 +897,18 @@ process_common_toolchain() { add_cflags "-mmacosx-version-min=10.12" add_ldflags "-mmacosx-version-min=10.12" ;; + *-darwin17-*) + add_cflags "-mmacosx-version-min=10.13" + add_ldflags "-mmacosx-version-min=10.13" + ;; + *-darwin18-*) + add_cflags "-mmacosx-version-min=10.14" + add_ldflags "-mmacosx-version-min=10.14" + ;; + *-darwin19-*) + add_cflags "-mmacosx-version-min=10.15" + add_ldflags "-mmacosx-version-min=10.15" + ;; *-iphonesimulator-*) add_cflags "-miphoneos-version-min=${IOS_VERSION_MIN}" add_ldflags "-miphoneos-version-min=${IOS_VERSION_MIN}" diff --git a/libs/libvpx/build/make/iosbuild.sh b/libs/libvpx/build/make/iosbuild.sh index 365a8c0130..3211d4f5ef 100755 --- a/libs/libvpx/build/make/iosbuild.sh +++ b/libs/libvpx/build/make/iosbuild.sh @@ -35,8 +35,8 @@ ARM_TARGETS="arm64-darwin-gcc armv7s-darwin-gcc" SIM_TARGETS="x86-iphonesimulator-gcc x86_64-iphonesimulator-gcc" -OSX_TARGETS="x86-darwin16-gcc - x86_64-darwin16-gcc" +OSX_TARGETS="x86-darwin18-gcc + x86_64-darwin18-gcc" TARGETS="${ARM_TARGETS} ${SIM_TARGETS}" # Configures for the target specified by $1, and invokes make with the dist @@ -271,7 +271,7 @@ cat << EOF --help: Display this message and exit. --enable-shared: Build a dynamic framework for use on iOS 8 or later. --extra-configure-args : Extra args to pass when configuring libvpx. - --macosx: Uses darwin16 targets instead of iphonesimulator targets for x86 + --macosx: Uses darwin18 targets instead of iphonesimulator targets for x86 and x86_64. Allows linking to framework when builds target MacOSX instead of iOS. --preserve-build-output: Do not delete the build directory. diff --git a/libs/libvpx/configure b/libs/libvpx/configure index e5a74c6f2a..c84c891c0b 100755 --- a/libs/libvpx/configure +++ b/libs/libvpx/configure @@ -129,6 +129,8 @@ all_platforms="${all_platforms} x86-darwin13-gcc" all_platforms="${all_platforms} x86-darwin14-gcc" all_platforms="${all_platforms} x86-darwin15-gcc" all_platforms="${all_platforms} x86-darwin16-gcc" +all_platforms="${all_platforms} x86-darwin17-gcc" +all_platforms="${all_platforms} x86-darwin18-gcc" all_platforms="${all_platforms} x86-iphonesimulator-gcc" all_platforms="${all_platforms} x86-linux-gcc" all_platforms="${all_platforms} x86-linux-icc" @@ -149,6 +151,9 @@ all_platforms="${all_platforms} x86_64-darwin13-gcc" all_platforms="${all_platforms} x86_64-darwin14-gcc" all_platforms="${all_platforms} x86_64-darwin15-gcc" all_platforms="${all_platforms} x86_64-darwin16-gcc" +all_platforms="${all_platforms} x86_64-darwin17-gcc" +all_platforms="${all_platforms} x86_64-darwin18-gcc" +all_platforms="${all_platforms} x86_64-darwin19-gcc" all_platforms="${all_platforms} x86_64-iphonesimulator-gcc" all_platforms="${all_platforms} x86_64-linux-gcc" all_platforms="${all_platforms} x86_64-linux-icc" From 45219aef6f980f242ef217930f9974d6c37310b0 Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Tue, 29 Oct 2019 17:47:22 +0000 Subject: [PATCH 035/118] [mod_sndfile] don't force channels and sample rate with .raw extension --- src/mod/formats/mod_sndfile/mod_sndfile.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/mod/formats/mod_sndfile/mod_sndfile.c b/src/mod/formats/mod_sndfile/mod_sndfile.c index a6f866356f..b9884c2138 100644 --- a/src/mod/formats/mod_sndfile/mod_sndfile.c +++ b/src/mod/formats/mod_sndfile/mod_sndfile.c @@ -117,21 +117,19 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha context->sfinfo.format |= map->format; } - if (!strcmp(ext, "r8") || !strcmp(ext, "raw")) { + if (!strcmp(ext, "raw")) { + context->sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_PCM_16; + } else if (!strcmp(ext, "r8")) { context->sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_PCM_16; - context->sfinfo.channels = 1; context->sfinfo.samplerate = 8000; } else if (!strcmp(ext, "r16")) { context->sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_PCM_16; - context->sfinfo.channels = 1; context->sfinfo.samplerate = 16000; } else if (!strcmp(ext, "r24")) { context->sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_PCM_24; - context->sfinfo.channels = 1; context->sfinfo.samplerate = 24000; } else if (!strcmp(ext, "r32")) { context->sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_PCM_32; - context->sfinfo.channels = 1; context->sfinfo.samplerate = 32000; } else if (!strcmp(ext, "gsm")) { context->sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_GSM610; From 8aafff281b81adbb05a9ebdc6d89ce66d17166a4 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Wed, 30 Oct 2019 20:03:43 +0800 Subject: [PATCH 036/118] [Core] Make switch_ivr_orig_and_bridge function return status and a cause. --- src/include/switch_ivr.h | 3 ++- src/switch_ivr_originate.c | 23 +++++++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index ab01aa49c0..39e915edc5 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -1052,8 +1052,9 @@ SWITCH_DECLARE(int) switch_dial_handle_get_peers(switch_dial_handle_t *handle, i SWITCH_DECLARE(int) switch_dial_handle_get_vars(switch_dial_handle_t *handle, int idx, switch_event_t **array, int max); SWITCH_DECLARE(switch_event_t *) switch_dial_handle_get_global_vars(switch_dial_handle_t *handle); SWITCH_DECLARE(switch_event_t *) switch_dial_leg_get_vars(switch_dial_leg_t *leg); +SWITCH_DECLARE(const char *) switch_dial_leg_get_var(switch_dial_leg_t *leg, const char *key); SWITCH_DECLARE(int) switch_dial_handle_get_total(switch_dial_handle_t *handle); -SWITCH_DECLARE(void) switch_ivr_orig_and_bridge(switch_core_session_t *session, const char *data, switch_dial_handle_t *dh); +SWITCH_DECLARE(switch_status_t) switch_ivr_orig_and_bridge(switch_core_session_t *session, const char *data, switch_dial_handle_t *dh, switch_call_cause_t *cause); SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_collect_input(switch_core_session_t *session, const char *prompt, diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 0ed6f0644f..c34767d99a 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -4383,6 +4383,12 @@ SWITCH_DECLARE(switch_event_t *) switch_dial_leg_get_vars(switch_dial_leg_t *leg return leg->leg_vars; } +SWITCH_DECLARE(const char *) switch_dial_leg_get_var(switch_dial_leg_t *leg, const char *key) +{ + switch_assert(leg); + + return switch_event_get_header(leg->leg_vars, key); +} static switch_status_t vars_serialize_json_obj(switch_event_t *event, cJSON **json) { @@ -4559,32 +4565,31 @@ static switch_status_t o_bridge_on_dtmf(switch_core_session_t *session, void *in return SWITCH_STATUS_SUCCESS; } -SWITCH_DECLARE(void) switch_ivr_orig_and_bridge(switch_core_session_t *session, const char *data, switch_dial_handle_t *dh) +SWITCH_DECLARE(switch_status_t) switch_ivr_orig_and_bridge(switch_core_session_t *session, const char *data, switch_dial_handle_t *dh, switch_call_cause_t *cause) { switch_channel_t *caller_channel = switch_core_session_get_channel(session); switch_core_session_t *peer_session = NULL; - switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING; switch_status_t status = SWITCH_STATUS_FALSE; int fail = 0; if ((status = switch_ivr_originate(session, &peer_session, - &cause, data, 0, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, dh)) != SWITCH_STATUS_SUCCESS) { + cause, data, 0, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, dh)) != SWITCH_STATUS_SUCCESS) { fail = 1; } if (fail) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Originate Failed. Cause: %s\n", switch_channel_cause2str(cause)); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Originate Failed. Cause: %s\n", switch_channel_cause2str(*cause)); - switch_channel_set_variable(caller_channel, "originate_failed_cause", switch_channel_cause2str(cause)); + switch_channel_set_variable(caller_channel, "originate_failed_cause", switch_channel_cause2str(*cause)); - switch_channel_handle_cause(caller_channel, cause); + switch_channel_handle_cause(caller_channel, *cause); - return; + return status; } else { - switch_channel_t *peer_channel = switch_core_session_get_channel(peer_session); + if (switch_true(switch_channel_get_variable(caller_channel, SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE)) || switch_true(switch_channel_get_variable(peer_channel, SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE))) { switch_channel_set_flag(caller_channel, CF_BYPASS_MEDIA_AFTER_BRIDGE); @@ -4620,6 +4625,8 @@ SWITCH_DECLARE(void) switch_ivr_orig_and_bridge(switch_core_session_t *session, switch_core_session_rwunlock(peer_session); } } + + return status; } From 1442186cee771e7aa64b0e238c62ce6890bbb097 Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Wed, 23 Oct 2019 16:37:55 -0400 Subject: [PATCH 037/118] [core] Update switch_ivr_bridge_bleg to skip audio bridge during transfer --- src/switch_ivr_bridge.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 767754a59f..667950d2ad 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -1099,7 +1099,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_bridge_bleg(switch_core_session_t *se switch_channel_clear_flag(channel, CF_ARRANGED_BRIDGE); return SWITCH_STATUS_FALSE; } else { - audio_bridge_on_exchange_media(session); + switch_channel_t *channel = switch_core_session_get_channel(session); + if (!switch_channel_test_flag(channel, CF_TRANSFER)) { + audio_bridge_on_exchange_media(session); + } } return SWITCH_STATUS_SUCCESS; From c76a8c5458566003aca608a56e30f330acf90c50 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 30 Oct 2019 17:25:47 +0000 Subject: [PATCH 038/118] swigall --- .../languages/mod_managed/freeswitch_wrap.cxx | 60 +- src/mod/languages/mod_managed/managed/swig.cs | 984 +++++++++--------- 2 files changed, 558 insertions(+), 486 deletions(-) diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index ae2c894584..a4d3a87787 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 3.0.10 + * Version 3.0.12 * * 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 @@ -9923,7 +9923,7 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_device_node_t_xml_ } -SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_device_node_t__event_set___(void * jarg1, void * jarg2) { +SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_device_node_t_event__set___(void * jarg1, void * jarg2) { device_uuid_node_s *arg1 = (device_uuid_node_s *) 0 ; switch_event_t *arg2 = (switch_event_t *) 0 ; @@ -9933,7 +9933,7 @@ SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_device_node_t__event } -SWIGEXPORT void * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_device_node_t__event_get___(void * jarg1) { +SWIGEXPORT void * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_device_node_t_event__get___(void * jarg1) { void * jresult ; device_uuid_node_s *arg1 = (device_uuid_node_s *) 0 ; switch_event_t *result = 0 ; @@ -14573,6 +14573,22 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_hash_destroy___( } +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_hash_insert_auto_free___(void * jarg1, char * jarg2, void * jarg3) { + int jresult ; + switch_hash_t *arg1 = (switch_hash_t *) 0 ; + char *arg2 = (char *) 0 ; + void *arg3 = (void *) 0 ; + switch_status_t result; + + arg1 = (switch_hash_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (void *)jarg3; + result = (switch_status_t)switch_core_hash_insert_auto_free(arg1,(char const *)arg2,(void const *)arg3); + jresult = (int)result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_hash_insert_destructor___(void * jarg1, char * jarg2, void * jarg3, void * jarg4) { int jresult ; switch_hash_t *arg1 = (switch_hash_t *) 0 ; @@ -18603,6 +18619,16 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_session_start_te } +SWIGEXPORT char * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_get_event_channel_key_separator___() { + char * jresult ; + char *result = 0 ; + + result = (char *)switch_core_get_event_channel_key_separator(); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_loadable_module_interface_module_name_set___(void * jarg1, char * jarg2) { switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; char *arg2 = (char *) 0 ; @@ -28639,7 +28665,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_file_handle_max_sampl } -SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_file_handle__params_set___(void * jarg1, void * jarg2) { +SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_file_handle_params__set___(void * jarg1, void * jarg2) { switch_file_handle *arg1 = (switch_file_handle *) 0 ; switch_event_t *arg2 = (switch_event_t *) 0 ; @@ -28649,7 +28675,7 @@ SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_file_handle__params_ } -SWIGEXPORT void * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_file_handle__params_get___(void * jarg1) { +SWIGEXPORT void * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_file_handle_params__get___(void * jarg1) { void * jresult ; switch_file_handle *arg1 = (switch_file_handle *) 0 ; switch_event_t *result = 0 ; @@ -43480,6 +43506,20 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_dial_leg_get_vars_ } +SWIGEXPORT char * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_dial_leg_get_var___(void * jarg1, char * jarg2) { + char * jresult ; + switch_dial_leg_t *arg1 = (switch_dial_leg_t *) 0 ; + char *arg2 = (char *) 0 ; + char *result = 0 ; + + arg1 = (switch_dial_leg_t *)jarg1; + arg2 = (char *)jarg2; + result = (char *)switch_dial_leg_get_var(arg1,(char const *)arg2); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_dial_handle_get_total___(void * jarg1) { int jresult ; switch_dial_handle_t *arg1 = (switch_dial_handle_t *) 0 ; @@ -43492,15 +43532,21 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_dial_handle_get_total } -SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_ivr_orig_and_bridge___(void * jarg1, char * jarg2, void * jarg3) { +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_ivr_orig_and_bridge___(void * jarg1, char * jarg2, void * jarg3, void * jarg4) { + int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; char *arg2 = (char *) 0 ; switch_dial_handle_t *arg3 = (switch_dial_handle_t *) 0 ; + switch_call_cause_t *arg4 = (switch_call_cause_t *) 0 ; + switch_status_t result; arg1 = (switch_core_session_t *)jarg1; arg2 = (char *)jarg2; arg3 = (switch_dial_handle_t *)jarg3; - switch_ivr_orig_and_bridge(arg1,(char const *)arg2,arg3); + arg4 = (switch_call_cause_t *)jarg4; + result = (switch_status_t)switch_ivr_orig_and_bridge(arg1,(char const *)arg2,arg3,arg4); + jresult = (int)result; + return jresult; } diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index 6c9218cc82..fcb1241d12 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -2,7 +2,7 @@ // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -65,7 +65,7 @@ public class Api : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -452,7 +452,7 @@ public class CoreSession : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -520,7 +520,7 @@ public class DTMF : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -657,7 +657,7 @@ public partial class Event : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // 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 : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -848,7 +848,7 @@ public class IvrMenu : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -901,7 +901,7 @@ public partial class ManagedSession : CoreSession { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -930,7 +930,7 @@ public class SWIGTYPE_p_FILE { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -959,7 +959,7 @@ public class SWIGTYPE_p_a_256__char { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -988,7 +988,7 @@ public class SWIGTYPE_p_a_2__icand_s { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1017,7 +1017,7 @@ public class SWIGTYPE_p_apr_pool_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1046,7 +1046,7 @@ public class SWIGTYPE_p_cJSON { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1075,7 +1075,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1104,7 +1104,7 @@ public class SWIGTYPE_p_f_p_p_switch_database_interface_handle__switch_status_t // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1133,7 +1133,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1162,7 +1162,7 @@ public class SWIGTYPE_p_f_p_q_const__cJSON_p_switch_core_session_p_p_cJSON__swit // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1191,7 +1191,7 @@ public class SWIGTYPE_p_f_p_q_const__char_p_cJSON_p_q_const__char_unsigned_long_ // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1220,7 +1220,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1249,7 +1249,7 @@ public class SWIGTYPE_p_f_p_q_const__char_p_q_const__char_int_p_switch_database_ // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1278,7 +1278,7 @@ public class SWIGTYPE_p_f_p_q_const__char_p_q_const__char_int_p_switch_database_ // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1307,7 +1307,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1336,7 +1336,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1365,7 +1365,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1394,7 +1394,7 @@ public class SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_void__void { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1423,7 +1423,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1452,7 +1452,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1481,7 +1481,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1510,7 +1510,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1539,7 +1539,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1568,7 +1568,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1597,7 +1597,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1626,7 +1626,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1655,7 +1655,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1684,7 +1684,7 @@ public class SWIGTYPE_p_f_p_switch_asr_handle_p_p_switch_event_p_unsigned_long__ // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1713,7 +1713,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1742,7 +1742,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1771,7 +1771,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1800,7 +1800,7 @@ public class SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigne // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1829,7 +1829,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1858,7 +1858,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1887,7 +1887,7 @@ public class SWIGTYPE_p_f_p_switch_codec__switch_status_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1916,7 +1916,7 @@ public class SWIGTYPE_p_f_p_switch_codec_enum_switch_codec_control_command_t_enu // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1945,7 +1945,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -1974,7 +1974,7 @@ public class SWIGTYPE_p_f_p_switch_codec_p_switch_frame__switch_status_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2003,7 +2003,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2032,7 +2032,7 @@ public class SWIGTYPE_p_f_p_switch_core_session__int { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2061,7 +2061,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2090,7 +2090,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_enum_switch_channel_callstate_t_ // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2119,7 +2119,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2148,7 +2148,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_char_p_switch_say_args_t_p_p_c // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2177,7 +2177,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2206,7 +2206,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2235,7 +2235,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2264,7 +2264,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2293,7 +2293,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2322,7 +2322,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2351,7 +2351,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2380,7 +2380,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2409,7 +2409,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2438,7 +2438,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2467,7 +2467,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2496,7 +2496,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2525,7 +2525,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2554,7 +2554,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2583,7 +2583,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_void__p_void { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2612,7 +2612,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2641,7 +2641,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2670,7 +2670,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_t_switch_media_type_t__p_switch_ // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2699,7 +2699,7 @@ public class SWIGTYPE_p_f_p_switch_database_interface_handle__switch_status_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2728,7 +2728,7 @@ public class SWIGTYPE_p_f_p_switch_database_interface_handle_enum_switch_bool_t_ // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2757,7 +2757,7 @@ public class SWIGTYPE_p_f_p_switch_database_interface_handle_p_int__switch_statu // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2786,7 +2786,7 @@ public class SWIGTYPE_p_f_p_switch_database_interface_handle_p_q_const__char_p_c // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2815,7 +2815,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2844,7 +2844,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2873,7 +2873,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2902,7 +2902,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2931,7 +2931,7 @@ public class SWIGTYPE_p_f_p_switch_event__switch_status_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2960,7 +2960,7 @@ public class SWIGTYPE_p_f_p_switch_event__void { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -2989,7 +2989,7 @@ public class SWIGTYPE_p_f_p_switch_event_p_q_const__char__switch_status_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3018,7 +3018,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3047,7 +3047,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3076,7 +3076,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3105,7 +3105,7 @@ public class SWIGTYPE_p_f_p_switch_file_handle_enum_switch_file_command_t__switc // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3134,7 +3134,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3163,7 +3163,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3192,7 +3192,7 @@ public class SWIGTYPE_p_f_p_switch_file_handle_p_switch_frame__switch_status_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3221,7 +3221,7 @@ public class SWIGTYPE_p_f_p_switch_file_handle_p_switch_frame_enum_switch_video_ // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3250,7 +3250,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3279,7 +3279,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3308,7 +3308,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3337,7 +3337,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3366,7 +3366,7 @@ public class SWIGTYPE_p_f_p_switch_live_array_s_p_q_const__char_p_q_const__char_ // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3395,7 +3395,7 @@ public class SWIGTYPE_p_f_p_switch_media_bug_p_void__void { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3424,7 +3424,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3453,7 +3453,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3482,7 +3482,7 @@ public class SWIGTYPE_p_f_p_switch_scheduler_task__void { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3511,7 +3511,7 @@ public class SWIGTYPE_p_f_p_switch_speech_handle__void { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3540,7 +3540,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3569,7 +3569,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3598,7 +3598,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3627,7 +3627,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3656,7 +3656,7 @@ public class SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_int_p_unsig // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3685,7 +3685,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3714,7 +3714,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3743,7 +3743,7 @@ public class SWIGTYPE_p_f_p_switch_stream_handle_p_int__p_unsigned_char { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3772,7 +3772,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3801,7 +3801,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3830,7 +3830,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3859,7 +3859,7 @@ public class SWIGTYPE_p_f_p_switch_timer__switch_status_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3888,7 +3888,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3917,7 +3917,7 @@ public class SWIGTYPE_p_f_p_void__void { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3946,7 +3946,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -3975,7 +3975,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 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4004,7 +4004,7 @@ public class SWIGTYPE_p_f_p_void_p_switch_event__int { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4033,7 +4033,7 @@ public class SWIGTYPE_p_f_switch_cache_db_database_interface_options_t_p_p_switc // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4062,7 +4062,7 @@ public class SWIGTYPE_p_f_uint8_t_p_p_q_const__char_p_void__p_switch_xml { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4091,7 +4091,7 @@ public class SWIGTYPE_p_f_void__p_char { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4120,7 +4120,7 @@ public class SWIGTYPE_p_f_void__switch_status_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4149,7 +4149,7 @@ public class SWIGTYPE_p_float { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4178,7 +4178,7 @@ public class SWIGTYPE_p_in6_addr { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4207,7 +4207,7 @@ public class SWIGTYPE_p_int { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4236,7 +4236,7 @@ public class SWIGTYPE_p_p_apr_pool_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4265,7 +4265,7 @@ public class SWIGTYPE_p_p_cJSON { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4294,7 +4294,7 @@ public class SWIGTYPE_p_p_char { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4323,7 +4323,7 @@ public class SWIGTYPE_p_p_p_char { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4352,7 +4352,7 @@ public class SWIGTYPE_p_p_payload_map_s { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4381,7 +4381,7 @@ public class SWIGTYPE_p_p_real_pcre { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4410,7 +4410,7 @@ public class SWIGTYPE_p_p_sqlite3 { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4439,7 +4439,7 @@ public class SWIGTYPE_p_p_sqlite3_stmt { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4468,7 +4468,7 @@ public class SWIGTYPE_p_p_switch_agc_s { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4497,7 +4497,7 @@ public class SWIGTYPE_p_p_switch_audio_resampler_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4526,7 +4526,7 @@ public class SWIGTYPE_p_p_switch_buffer { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4555,7 +4555,7 @@ public class SWIGTYPE_p_p_switch_cache_db_handle { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4584,7 +4584,7 @@ public class SWIGTYPE_p_p_switch_caller_extension { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4613,7 +4613,7 @@ public class SWIGTYPE_p_p_switch_channel { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4642,7 +4642,7 @@ public class SWIGTYPE_p_p_switch_codec_implementation { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4671,7 +4671,7 @@ public class SWIGTYPE_p_p_switch_console_callback_match { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4700,7 +4700,7 @@ public class SWIGTYPE_p_p_switch_core_port_allocator { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4729,7 +4729,7 @@ public class SWIGTYPE_p_p_switch_core_session { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4758,7 +4758,7 @@ public class SWIGTYPE_p_p_switch_core_session_message { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4787,7 +4787,7 @@ public class SWIGTYPE_p_p_switch_device_record_s { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4816,7 +4816,7 @@ public class SWIGTYPE_p_p_switch_dial_handle_s { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4845,7 +4845,7 @@ public class SWIGTYPE_p_p_switch_dial_leg_list_s { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4874,7 +4874,7 @@ public class SWIGTYPE_p_p_switch_dial_leg_s { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4903,7 +4903,7 @@ public class SWIGTYPE_p_p_switch_event { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4932,7 +4932,7 @@ public class SWIGTYPE_p_p_switch_event_node { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4961,7 +4961,7 @@ public class SWIGTYPE_p_p_switch_file_handle { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -4990,7 +4990,7 @@ public class SWIGTYPE_p_p_switch_frame { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5019,7 +5019,7 @@ public class SWIGTYPE_p_p_switch_frame_buffer_s { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5048,7 +5048,7 @@ public class SWIGTYPE_p_p_switch_hashtable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5077,7 +5077,7 @@ public class SWIGTYPE_p_p_switch_hashtable_iterator { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5106,7 +5106,7 @@ public class SWIGTYPE_p_p_switch_ivr_digit_stream { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5135,7 +5135,7 @@ public class SWIGTYPE_p_p_switch_ivr_digit_stream_parser { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5164,7 +5164,7 @@ public class SWIGTYPE_p_p_switch_ivr_dmachine { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5193,7 +5193,7 @@ public class SWIGTYPE_p_p_switch_ivr_dmachine_match { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5222,7 +5222,7 @@ public class SWIGTYPE_p_p_switch_ivr_menu { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5251,7 +5251,7 @@ public class SWIGTYPE_p_p_switch_ivr_menu_xml_ctx { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5280,7 +5280,7 @@ public class SWIGTYPE_p_p_switch_live_array_s { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5309,7 +5309,7 @@ public class SWIGTYPE_p_p_switch_log_node_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5338,7 +5338,7 @@ public class SWIGTYPE_p_p_switch_media_bug { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5367,7 +5367,7 @@ public class SWIGTYPE_p_p_switch_network_list { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5396,7 +5396,7 @@ public class SWIGTYPE_p_p_switch_rtp { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5425,7 +5425,7 @@ public class SWIGTYPE_p_p_switch_say_file_handle { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5454,7 +5454,7 @@ public class SWIGTYPE_p_p_switch_sql_queue_manager { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5483,7 +5483,7 @@ public class SWIGTYPE_p_p_switch_thread_data_s { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5512,7 +5512,7 @@ public class SWIGTYPE_p_p_switch_xml { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5541,7 +5541,7 @@ public class SWIGTYPE_p_p_switch_xml_binding { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5570,7 +5570,7 @@ public class SWIGTYPE_p_p_unsigned_char { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5599,7 +5599,7 @@ public class SWIGTYPE_p_p_void { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5628,7 +5628,7 @@ public class SWIGTYPE_p_pid_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5657,7 +5657,7 @@ public class SWIGTYPE_p_real_pcre { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5686,7 +5686,7 @@ public class SWIGTYPE_p_short { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5715,7 +5715,7 @@ public class SWIGTYPE_p_sockaddr { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5744,7 +5744,7 @@ public class SWIGTYPE_p_sockaddr_in6 { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5773,7 +5773,7 @@ public class SWIGTYPE_p_socklen_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5802,7 +5802,7 @@ public class SWIGTYPE_p_sqlite3 { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5831,7 +5831,7 @@ public class SWIGTYPE_p_sqlite3_stmt { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5860,7 +5860,7 @@ public class SWIGTYPE_p_switch_agc_s { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5889,7 +5889,7 @@ public class SWIGTYPE_p_switch_buffer { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5918,7 +5918,7 @@ public class SWIGTYPE_p_switch_cache_db_handle { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5947,7 +5947,7 @@ public class SWIGTYPE_p_switch_call_cause_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -5976,7 +5976,7 @@ public class SWIGTYPE_p_switch_channel { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6005,7 +6005,7 @@ public class SWIGTYPE_p_switch_codec_control_type_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6034,7 +6034,7 @@ public class SWIGTYPE_p_switch_core_port_allocator { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6063,7 +6063,7 @@ public class SWIGTYPE_p_switch_core_session { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6092,7 +6092,7 @@ public class SWIGTYPE_p_switch_dial_handle_s { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6121,7 +6121,7 @@ public class SWIGTYPE_p_switch_dial_leg_list_s { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6150,7 +6150,7 @@ public class SWIGTYPE_p_switch_dial_leg_s { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6179,7 +6179,7 @@ public class SWIGTYPE_p_switch_event_types_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6208,7 +6208,7 @@ public class SWIGTYPE_p_switch_file_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6237,7 +6237,7 @@ public class SWIGTYPE_p_switch_frame_buffer_s { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6266,7 +6266,7 @@ public class SWIGTYPE_p_switch_hashtable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6295,7 +6295,7 @@ public class SWIGTYPE_p_switch_hashtable_iterator { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6324,7 +6324,7 @@ public class SWIGTYPE_p_switch_image_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6353,7 +6353,7 @@ public class SWIGTYPE_p_switch_img_fmt_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6382,7 +6382,7 @@ public class SWIGTYPE_p_switch_img_position_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6411,7 +6411,7 @@ public class SWIGTYPE_p_switch_interval_time_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6440,7 +6440,7 @@ public class SWIGTYPE_p_switch_ivr_action_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6469,7 +6469,7 @@ public class SWIGTYPE_p_switch_ivr_digit_stream { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6498,7 +6498,7 @@ public class SWIGTYPE_p_switch_ivr_digit_stream_parser { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6527,7 +6527,7 @@ public class SWIGTYPE_p_switch_ivr_dmachine { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6556,7 +6556,7 @@ public class SWIGTYPE_p_switch_ivr_menu { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6585,7 +6585,7 @@ public class SWIGTYPE_p_switch_ivr_menu_xml_ctx { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6614,7 +6614,7 @@ public class SWIGTYPE_p_switch_jb_s { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6643,7 +6643,7 @@ public class SWIGTYPE_p_switch_live_array_s { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6672,7 +6672,7 @@ public class SWIGTYPE_p_switch_media_bug { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6701,7 +6701,7 @@ public class SWIGTYPE_p_switch_mutex_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6730,7 +6730,7 @@ public class SWIGTYPE_p_switch_network_list { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6759,7 +6759,7 @@ public class SWIGTYPE_p_switch_odbc_handle { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6788,7 +6788,7 @@ public class SWIGTYPE_p_switch_pollfd_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6817,7 +6817,7 @@ public class SWIGTYPE_p_switch_queue_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6846,7 +6846,7 @@ public class SWIGTYPE_p_switch_rtcp_frame { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6875,7 +6875,7 @@ public class SWIGTYPE_p_switch_rtp { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6904,7 +6904,7 @@ public class SWIGTYPE_p_switch_rtp_flag_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6933,7 +6933,7 @@ public class SWIGTYPE_p_switch_say_file_handle { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6962,7 +6962,7 @@ public class SWIGTYPE_p_switch_size_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -6991,7 +6991,7 @@ public class SWIGTYPE_p_switch_sockaddr_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -7020,7 +7020,7 @@ public class SWIGTYPE_p_switch_socket_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -7049,7 +7049,7 @@ public class SWIGTYPE_p_switch_sql_queue_manager { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -7078,7 +7078,7 @@ public class SWIGTYPE_p_switch_ssize_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -7107,7 +7107,7 @@ public class SWIGTYPE_p_switch_thread_rwlock_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -7136,7 +7136,7 @@ public class SWIGTYPE_p_switch_thread_start_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -7165,7 +7165,7 @@ public class SWIGTYPE_p_switch_thread_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -7194,7 +7194,7 @@ public class SWIGTYPE_p_switch_time_exp_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -7223,7 +7223,7 @@ public class SWIGTYPE_p_switch_time_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -7252,7 +7252,7 @@ public class SWIGTYPE_p_switch_xml_binding { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -7281,7 +7281,7 @@ public class SWIGTYPE_p_time_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -7310,7 +7310,7 @@ public class SWIGTYPE_p_unsigned_char { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -7339,7 +7339,7 @@ public class SWIGTYPE_p_unsigned_int { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -7368,7 +7368,7 @@ public class SWIGTYPE_p_unsigned_long { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -7397,7 +7397,7 @@ public class SWIGTYPE_p_unsigned_short { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -7426,7 +7426,7 @@ public class SWIGTYPE_p_void { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -7495,7 +7495,7 @@ public partial class Stream : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -7563,7 +7563,7 @@ public class audio_buffer_header_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -7581,7 +7581,7 @@ public enum cache_db_flag_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -7599,7 +7599,7 @@ public enum dm_match_type_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -7688,7 +7688,7 @@ public class dtls_fingerprint_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -7710,7 +7710,7 @@ public enum dtls_state_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -7730,7 +7730,7 @@ public enum dtls_type_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -7748,7 +7748,7 @@ public enum dtmf_flag_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -8932,6 +8932,11 @@ else return ret; } + public static switch_status_t switch_core_hash_insert_auto_free(SWIGTYPE_p_switch_hashtable hash, string key, SWIGTYPE_p_void data) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_hash_insert_auto_free(SWIGTYPE_p_switch_hashtable.getCPtr(hash), key, SWIGTYPE_p_void.getCPtr(data)); + return ret; + } + public static switch_status_t switch_core_hash_insert_destructor(SWIGTYPE_p_switch_hashtable hash, string key, SWIGTYPE_p_void data, SWIGTYPE_p_f_p_void__void destructor) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_hash_insert_destructor(SWIGTYPE_p_switch_hashtable.getCPtr(hash), key, SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_f_p_void__void.getCPtr(destructor)); return ret; @@ -10264,6 +10269,11 @@ else return ret; } + public static string switch_core_get_event_channel_key_separator() { + string ret = freeswitchPINVOKE.switch_core_get_event_channel_key_separator(); + return ret; + } + public static switch_status_t switch_loadable_module_init(switch_bool_t autoload) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_init((int)autoload); return ret; @@ -13593,13 +13603,19 @@ else return ret; } + public static string switch_dial_leg_get_var(SWIGTYPE_p_switch_dial_leg_s leg, string key) { + string ret = freeswitchPINVOKE.switch_dial_leg_get_var(SWIGTYPE_p_switch_dial_leg_s.getCPtr(leg), key); + return ret; + } + public static int switch_dial_handle_get_total(SWIGTYPE_p_switch_dial_handle_s handle) { int ret = freeswitchPINVOKE.switch_dial_handle_get_total(SWIGTYPE_p_switch_dial_handle_s.getCPtr(handle)); return ret; } - public static void switch_ivr_orig_and_bridge(SWIGTYPE_p_switch_core_session session, string data, SWIGTYPE_p_switch_dial_handle_s dh) { - freeswitchPINVOKE.switch_ivr_orig_and_bridge(SWIGTYPE_p_switch_core_session.getCPtr(session), data, SWIGTYPE_p_switch_dial_handle_s.getCPtr(dh)); + public static switch_status_t switch_ivr_orig_and_bridge(SWIGTYPE_p_switch_core_session session, string data, SWIGTYPE_p_switch_dial_handle_s dh, SWIGTYPE_p_switch_call_cause_t cause) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_orig_and_bridge(SWIGTYPE_p_switch_core_session.getCPtr(session), data, SWIGTYPE_p_switch_dial_handle_s.getCPtr(dh), SWIGTYPE_p_switch_call_cause_t.getCPtr(cause)); + return ret; } public static switch_status_t switch_ivr_play_and_collect_input(SWIGTYPE_p_switch_core_session session, string prompt, string recognizer_mod_name, string recognizer_grammar, int min_digits, int max_digits, string terminators, uint digit_timeout, SWIGTYPE_p_p_cJSON recognition_result, ref string digits_collected, string terminator_collected, switch_input_args_t args) { @@ -14922,7 +14938,7 @@ else // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -17662,11 +17678,11 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_device_node_t_xml_cdr_get___")] public static extern global::System.IntPtr switch_device_node_t_xml_cdr_get(global::System.Runtime.InteropServices.HandleRef jarg1); - [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_device_node_t__event_set___")] - public static extern void switch_device_node_t__event_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_device_node_t_event__set___")] + public static extern void switch_device_node_t_event__set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); - [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_device_node_t__event_get___")] - public static extern global::System.IntPtr switch_device_node_t__event_get(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_device_node_t_event__get___")] + public static extern global::System.IntPtr switch_device_node_t_event__get(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_device_node_t_callstate_set___")] public static extern void switch_device_node_t_callstate_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); @@ -18769,6 +18785,9 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_hash_destroy___")] public static extern int switch_core_hash_destroy(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_hash_insert_auto_free___")] + public static extern int switch_core_hash_insert_auto_free(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_hash_insert_destructor___")] public static extern int switch_core_hash_insert_destructor(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); @@ -19696,6 +19715,9 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_session_start_text_thread___")] public static extern int switch_core_session_start_text_thread(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_get_event_channel_key_separator___")] + public static extern string switch_core_get_event_channel_key_separator(); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_loadable_module_interface_module_name_set___")] public static extern void switch_loadable_module_interface_module_name_set(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); @@ -22102,11 +22124,11 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_file_handle_max_samples_get___")] public static extern int switch_file_handle_max_samples_get(global::System.Runtime.InteropServices.HandleRef jarg1); - [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_file_handle__params_set___")] - public static extern void switch_file_handle__params_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_file_handle_params__set___")] + public static extern void switch_file_handle_params__set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); - [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_file_handle__params_get___")] - public static extern global::System.IntPtr switch_file_handle__params_get(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_file_handle_params__get___")] + public static extern global::System.IntPtr switch_file_handle_params__get(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_file_handle_cur_channels_set___")] public static extern void switch_file_handle_cur_channels_set(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); @@ -25591,11 +25613,14 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_dial_leg_get_vars___")] public static extern global::System.IntPtr switch_dial_leg_get_vars(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_dial_leg_get_var___")] + public static extern string switch_dial_leg_get_var(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_dial_handle_get_total___")] public static extern int switch_dial_handle_get_total(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_ivr_orig_and_bridge___")] - public static extern void switch_ivr_orig_and_bridge(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + public static extern int switch_ivr_orig_and_bridge(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_ivr_play_and_collect_input___")] public static extern int switch_ivr_play_and_collect_input(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, string jarg3, string jarg4, int jarg5, int jarg6, string jarg7, uint jarg8, global::System.Runtime.InteropServices.HandleRef jarg9, ref string jarg10, string jarg11, global::System.Runtime.InteropServices.HandleRef jarg12); @@ -27616,7 +27641,7 @@ class freeswitchPINVOKE { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -27774,7 +27799,7 @@ public class icand_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -27792,7 +27817,7 @@ public enum ice_proto_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -27914,7 +27939,7 @@ public class ice_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -28005,7 +28030,7 @@ public class input_callback_state_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -28075,7 +28100,7 @@ public class ip_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -28364,7 +28389,7 @@ public class payload_map_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -28443,7 +28468,7 @@ public class profile_node_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -28468,7 +28493,7 @@ public enum rtcp_psfb_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -28499,7 +28524,7 @@ public enum rtcp_pt_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -28522,7 +28547,7 @@ public enum rtcp_rtpfb_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -28549,7 +28574,7 @@ public enum rtcp_sdes_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -28568,7 +28593,7 @@ namespace FreeSWITCH.Native { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -28598,7 +28623,7 @@ public enum switch_abc_type_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -28741,7 +28766,7 @@ public class switch_api_interface : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -28832,7 +28857,7 @@ public class switch_app_log : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -28855,7 +28880,7 @@ namespace FreeSWITCH.Native { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -29018,7 +29043,7 @@ public class switch_application_interface : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -29040,7 +29065,7 @@ namespace FreeSWITCH.Native { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -29246,7 +29271,7 @@ public class switch_asr_handle : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -29556,7 +29581,7 @@ public class switch_asr_interface : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -29614,7 +29639,7 @@ public class switch_audio_codec_settings : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -29643,7 +29668,7 @@ public enum switch_audio_col_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -29783,7 +29808,7 @@ public class switch_audio_resampler_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -29807,7 +29832,7 @@ namespace FreeSWITCH.Native { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -29825,7 +29850,7 @@ public enum switch_bitpack_mode_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -30005,7 +30030,7 @@ public class switch_bitpack_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -30023,7 +30048,7 @@ public enum switch_bool_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -30104,7 +30129,7 @@ public class switch_cache_db_connection_options_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -30162,7 +30187,7 @@ public class switch_cache_db_core_db_options_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -30261,7 +30286,7 @@ public class switch_cache_db_database_interface_options_t : global::System.IDisp // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -30280,7 +30305,7 @@ public enum switch_cache_db_handle_type_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -30361,7 +30386,7 @@ public class switch_cache_db_native_handle_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -30439,7 +30464,7 @@ public class switch_cache_db_odbc_options_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -30531,7 +30556,7 @@ public enum switch_call_cause_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -30549,7 +30574,7 @@ public enum switch_call_direction_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -30639,7 +30664,7 @@ public class switch_caller_application : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -30762,7 +30787,7 @@ public class switch_caller_extension : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -31240,7 +31265,7 @@ public class switch_caller_profile : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -31262,7 +31287,7 @@ namespace FreeSWITCH.Native { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -31284,7 +31309,7 @@ public enum switch_channel_app_flag_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -31309,7 +31334,7 @@ public enum switch_channel_callstate_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -31335,7 +31360,7 @@ public enum switch_channel_cap_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -31519,7 +31544,7 @@ public enum switch_channel_flag_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -31549,7 +31574,7 @@ public enum switch_channel_state_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -31740,7 +31765,7 @@ public class switch_channel_timetable : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -31757,7 +31782,7 @@ public enum switch_chat_application_flag_enum_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -31920,7 +31945,7 @@ public class switch_chat_application_interface : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -32043,7 +32068,7 @@ public class switch_chat_interface : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -32219,7 +32244,7 @@ public class switch_codec : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -32242,7 +32267,7 @@ public enum switch_codec_control_command_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -32261,7 +32286,7 @@ public enum switch_codec_control_type_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -32289,7 +32314,7 @@ namespace FreeSWITCH.Native { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -32388,7 +32413,7 @@ public class switch_codec_fmtp : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -32684,7 +32709,7 @@ public class switch_codec_implementation : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -32838,7 +32863,7 @@ public class switch_codec_interface : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -32908,7 +32933,7 @@ public class switch_codec_settings : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -32928,7 +32953,7 @@ public enum switch_codec_type_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -33067,7 +33092,7 @@ public class switch_config : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -33157,7 +33182,7 @@ public class switch_console_callback_match : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -33226,7 +33251,7 @@ public class switch_console_callback_match_node : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -33263,7 +33288,8 @@ namespace FreeSWITCH.Native { SCF_SESSION_THREAD_POOL = (1 << 23), SCF_DIALPLAN_TIMESTAMPS = (1 << 24), SCF_CPF_SOFT_PREFIX = (1 << 25), - SCF_CPF_SOFT_LOOKUP = (1 << 26) + SCF_CPF_SOFT_LOOKUP = (1 << 26), + SCF_EVENT_CHANNEL_ENABLE_HIERARCHY_DELIVERY = (1 << 27) } } @@ -33271,7 +33297,7 @@ namespace FreeSWITCH.Native { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -33291,7 +33317,7 @@ public enum switch_core_media_ice_type_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -33532,7 +33558,7 @@ public class switch_core_session_message : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -33551,7 +33577,7 @@ namespace FreeSWITCH.Native { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -33627,7 +33653,7 @@ public enum switch_core_session_message_types_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -33729,7 +33755,7 @@ public class switch_core_thread_session : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -33847,7 +33873,7 @@ public class switch_core_time_duration : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -33915,7 +33941,7 @@ public class switch_cputime : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -34035,7 +34061,7 @@ public class switch_crypto_key_material_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -34052,7 +34078,7 @@ public enum switch_database_flag_enum_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -34293,7 +34319,7 @@ public class switch_database_interface : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -34363,7 +34389,7 @@ public class switch_database_interface_handle : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -34422,12 +34448,12 @@ public class switch_device_node_t : global::System.IDisposable { } } - public switch_event _event { + public switch_event event_ { set { - freeswitchPINVOKE.switch_device_node_t__event_set(swigCPtr, switch_event.getCPtr(value)); + freeswitchPINVOKE.switch_device_node_t_event__set(swigCPtr, switch_event.getCPtr(value)); } get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_device_node_t__event_get(swigCPtr); + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_device_node_t_event__get(swigCPtr); switch_event ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_event(cPtr, false); return ret; } @@ -34507,7 +34533,7 @@ public class switch_device_node_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -34778,7 +34804,7 @@ public class switch_device_record_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -34801,7 +34827,7 @@ public enum switch_device_state_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -35099,7 +35125,7 @@ public class switch_device_stats_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -35222,7 +35248,7 @@ public class switch_dialplan_interface : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -35241,7 +35267,7 @@ public enum switch_digit_action_target_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -35489,7 +35515,7 @@ public class switch_directories : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -35506,7 +35532,7 @@ namespace FreeSWITCH.Native { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -35597,7 +35623,7 @@ public class switch_directory_handle : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -35764,7 +35790,7 @@ public class switch_directory_interface : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -35782,7 +35808,7 @@ public enum switch_dtmf_direction_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -35803,7 +35829,7 @@ public enum switch_dtmf_source_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -35891,7 +35917,7 @@ public class switch_dtmf_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -35916,7 +35942,7 @@ namespace FreeSWITCH.Native { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -36072,7 +36098,7 @@ public class switch_endpoint_interface : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -36171,7 +36197,7 @@ public class switch_error_period_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -36344,7 +36370,7 @@ public class switch_event : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -36363,7 +36389,7 @@ public enum switch_event_flag_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -36471,7 +36497,7 @@ public class switch_event_header : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -36578,7 +36604,7 @@ public enum switch_event_types_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -36598,7 +36624,7 @@ public enum switch_file_command_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -36635,7 +36661,7 @@ namespace FreeSWITCH.Native { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -37104,12 +37130,12 @@ public class switch_file_handle : global::System.IDisposable { } } - public switch_event _params { + public switch_event params_ { set { - freeswitchPINVOKE.switch_file_handle__params_set(swigCPtr, switch_event.getCPtr(value)); + freeswitchPINVOKE.switch_file_handle_params__set(swigCPtr, switch_event.getCPtr(value)); } get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_file_handle__params_get(swigCPtr); + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_file_handle_params__get(swigCPtr); switch_event ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_event(cPtr, false); return ret; } @@ -37230,7 +37256,7 @@ public class switch_file_handle : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -37483,7 +37509,7 @@ public class switch_file_interface : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -37541,7 +37567,7 @@ public class switch_filenames : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -37619,7 +37645,7 @@ public class switch_fps_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -37885,7 +37911,7 @@ public class switch_frame : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -37923,7 +37949,7 @@ namespace FreeSWITCH.Native { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -38041,7 +38067,7 @@ public class switch_frame_geometry_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -38134,7 +38160,7 @@ public class switch_hold_record_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -38382,7 +38408,7 @@ public class switch_http_request_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -38401,7 +38427,7 @@ public enum switch_hup_type_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -38524,7 +38550,7 @@ public class switch_input_args_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -38542,7 +38568,7 @@ public enum switch_input_type_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -38612,7 +38638,7 @@ public class switch_io_event_hook_kill_channel : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -38682,7 +38708,7 @@ public class switch_io_event_hook_outgoing_channel : global::System.IDisposable // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -38752,7 +38778,7 @@ public class switch_io_event_hook_read_frame : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -38822,7 +38848,7 @@ public class switch_io_event_hook_receive_event : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -38892,7 +38918,7 @@ public class switch_io_event_hook_receive_message : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -38962,7 +38988,7 @@ public class switch_io_event_hook_recv_dtmf : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -39032,7 +39058,7 @@ public class switch_io_event_hook_send_dtmf : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -39102,7 +39128,7 @@ public class switch_io_event_hook_state_change : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -39172,7 +39198,7 @@ public class switch_io_event_hook_state_run : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -39242,7 +39268,7 @@ public class switch_io_event_hook_text_read_frame : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -39312,7 +39338,7 @@ public class switch_io_event_hook_text_write_frame : global::System.IDisposable // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -39382,7 +39408,7 @@ public class switch_io_event_hook_video_read_frame : global::System.IDisposable // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -39452,7 +39478,7 @@ public class switch_io_event_hook_video_write_frame : global::System.IDisposable // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -39522,7 +39548,7 @@ public class switch_io_event_hook_write_frame : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -39724,7 +39750,7 @@ public class switch_io_event_hooks : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -39745,7 +39771,7 @@ namespace FreeSWITCH.Native { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -39774,7 +39800,7 @@ public enum switch_io_routine_name_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -39987,7 +40013,7 @@ public class switch_io_routines : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -40005,7 +40031,7 @@ public enum switch_io_type_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -40028,7 +40054,7 @@ public enum switch_ivr_action_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -40128,7 +40154,7 @@ public class switch_ivr_dmachine_match : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -40147,7 +40173,7 @@ public enum switch_ivr_menu_flags { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -40166,7 +40192,7 @@ public enum switch_ivr_option_enum_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -40309,7 +40335,7 @@ public class switch_json_api_interface : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -40487,7 +40513,7 @@ public class switch_limit_interface : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -40588,7 +40614,7 @@ public class switch_loadable_module_function_table_t : global::System.IDisposabl // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -40865,7 +40891,7 @@ public class switch_loadable_module_interface : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -40884,7 +40910,7 @@ public enum switch_loadable_module_type_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -40952,7 +40978,7 @@ public class switch_log_json_format_item_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -41152,7 +41178,7 @@ public class switch_log_json_format_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -41188,7 +41214,7 @@ public enum switch_log_level_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -41349,7 +41375,7 @@ public class switch_log_node_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -41368,7 +41394,7 @@ public enum switch_management_action_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -41491,7 +41517,7 @@ public class switch_management_interface : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -41534,7 +41560,7 @@ namespace FreeSWITCH.Native { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -41562,7 +41588,7 @@ namespace FreeSWITCH.Native { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -41583,7 +41609,7 @@ public enum switch_media_flow_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -41602,7 +41628,7 @@ public enum switch_media_type_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -41842,7 +41868,7 @@ public class switch_mm_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -41860,7 +41886,7 @@ public enum switch_module_flag_enum_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -41893,7 +41919,7 @@ public enum switch_module_interface_name_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -41982,7 +42008,7 @@ public class switch_network_port_range : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -42006,7 +42032,7 @@ namespace FreeSWITCH.Native { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -42096,7 +42122,7 @@ public class switch_picture : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -42120,7 +42146,7 @@ public enum switch_poll_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -42141,7 +42167,7 @@ namespace FreeSWITCH.Native { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -42160,7 +42186,7 @@ public enum switch_priority_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -42178,7 +42204,7 @@ public enum switch_pvt_class_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -42197,7 +42223,7 @@ public enum switch_ring_ready_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -42295,7 +42321,7 @@ public class switch_rtcp_hdr_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -42563,7 +42589,7 @@ public class switch_rtcp_numbers_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -42661,7 +42687,7 @@ public class switch_rtcp_video_counters_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -42731,7 +42757,7 @@ public class switch_rtcp_video_stats_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -42761,7 +42787,7 @@ public enum switch_rtp_bug_flag_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -42782,7 +42808,7 @@ public enum switch_rtp_crypto_direction_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -42884,7 +42910,7 @@ public class switch_rtp_crypto_key : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -42902,7 +42928,7 @@ public enum switch_rtp_crypto_key_param_method_type_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -42928,7 +42954,7 @@ public enum switch_rtp_crypto_key_type_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -42996,7 +43022,7 @@ public enum switch_rtp_flag_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -43015,7 +43041,7 @@ public enum switch_rtp_flush_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -43083,7 +43109,7 @@ public class switch_rtp_hdr_ext_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -43221,7 +43247,7 @@ public class switch_rtp_hdr_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -43607,7 +43633,7 @@ public class switch_rtp_numbers_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -43697,7 +43723,7 @@ public class switch_rtp_packet_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -43788,7 +43814,7 @@ public class switch_rtp_stats_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -43806,7 +43832,7 @@ public enum switch_rw_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -43894,7 +43920,7 @@ public class switch_say_args_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -43914,7 +43940,7 @@ public enum switch_say_gender_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -44048,7 +44074,7 @@ public class switch_say_interface : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -44069,7 +44095,7 @@ public enum switch_say_method_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -44104,7 +44130,7 @@ public enum switch_say_type_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -44124,7 +44150,7 @@ namespace FreeSWITCH.Native { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -44253,7 +44279,7 @@ public class switch_scheduler_task : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -44271,7 +44297,7 @@ public enum switch_sdp_type_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -44423,7 +44449,7 @@ public class switch_secure_settings_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -44491,7 +44517,7 @@ public class switch_serial_event_header_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -44599,7 +44625,7 @@ public class switch_serial_event_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -44658,7 +44684,7 @@ public enum switch_session_ctl_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -44678,7 +44704,7 @@ public enum switch_signal_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -44769,7 +44795,7 @@ public class switch_slin_data : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -44793,7 +44819,7 @@ namespace FreeSWITCH.Native { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -45039,7 +45065,7 @@ public class switch_speech_handle : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -45239,7 +45265,7 @@ public class switch_speech_interface : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -45337,7 +45363,7 @@ public class switch_srtp_crypto_suite_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -45358,7 +45384,7 @@ public enum switch_stack_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -45376,7 +45402,7 @@ public enum switch_state_handler_flag_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -45404,7 +45430,7 @@ public enum switch_state_handler_name_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -45605,7 +45631,7 @@ public class switch_state_handler_table : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -45647,7 +45673,7 @@ public enum switch_status_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -45809,7 +45835,7 @@ public class switch_stream_handle : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -46007,7 +46033,7 @@ public class switch_t38_options_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -46027,7 +46053,7 @@ public enum switch_text_channel_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -46119,7 +46145,7 @@ public class switch_thread_data_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -46139,7 +46165,7 @@ public enum switch_thread_priority_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -46304,7 +46330,7 @@ public class switch_timer : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -46321,7 +46347,7 @@ namespace FreeSWITCH.Native { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -46343,7 +46369,7 @@ public enum switch_timer_func_name_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -46521,7 +46547,7 @@ public class switch_timer_interface : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -46748,7 +46774,7 @@ public class switch_unicast_conninfo : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -46768,7 +46794,7 @@ namespace FreeSWITCH.Native { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -46787,7 +46813,7 @@ public enum switch_uri_flags { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -46807,7 +46833,7 @@ namespace FreeSWITCH.Native { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -46828,7 +46854,7 @@ public enum switch_vad_state_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -46926,7 +46952,7 @@ public class switch_vid_params_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -46945,7 +46971,7 @@ public enum switch_vid_spy_fmt_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -47053,7 +47079,7 @@ public class switch_video_codec_settings : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -47073,7 +47099,7 @@ public enum switch_video_encode_speed_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -47092,7 +47118,7 @@ public enum switch_video_profile_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -47111,7 +47137,7 @@ public enum switch_video_read_flag_t { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -47189,7 +47215,7 @@ public class switch_waitlist_t : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -47373,7 +47399,7 @@ public class switch_xml : global::System.IDisposable { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. @@ -47393,7 +47419,7 @@ namespace FreeSWITCH.Native { // // // This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.10 +// Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. From 8d2174d7073093a14725e8c938796b15947fea0a Mon Sep 17 00:00:00 2001 From: lazedo Date: Thu, 31 Oct 2019 10:34:40 +0000 Subject: [PATCH 039/118] [mod_kazoo] several fixes & code cleanup --- src/mod/event_handlers/mod_kazoo/kazoo_api.c | 3 +- .../event_handlers/mod_kazoo/kazoo_commands.c | 22 ++- src/mod/event_handlers/mod_kazoo/kazoo_defs.h | 9 + .../event_handlers/mod_kazoo/kazoo_dptools.c | 3 +- src/mod/event_handlers/mod_kazoo/kazoo_ei.h | 27 +-- .../mod_kazoo/kazoo_ei_config.c | 23 ++- .../event_handlers/mod_kazoo/kazoo_ei_utils.c | 2 - .../mod_kazoo/kazoo_endpoints.c | 145 +++++++++++--- .../event_handlers/mod_kazoo/kazoo_message.c | 23 ++- .../event_handlers/mod_kazoo/kazoo_tweaks.c | 183 ++++++++---------- .../event_handlers/mod_kazoo/kazoo_tweaks.h | 32 +++ .../event_handlers/mod_kazoo/kazoo_utils.c | 116 +++++++---- .../event_handlers/mod_kazoo/kazoo_utils.h | 51 +++++ src/mod/event_handlers/mod_kazoo/kz_node.c | 2 +- src/mod/event_handlers/mod_kazoo/mod_kazoo.c | 15 +- src/mod/event_handlers/mod_kazoo/mod_kazoo.h | 11 +- 16 files changed, 452 insertions(+), 215 deletions(-) create mode 100644 src/mod/event_handlers/mod_kazoo/kazoo_defs.h create mode 100644 src/mod/event_handlers/mod_kazoo/kazoo_tweaks.h create mode 100644 src/mod/event_handlers/mod_kazoo/kazoo_utils.h diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_api.c b/src/mod/event_handlers/mod_kazoo/kazoo_api.c index b070f86336..955ff5c64e 100644 --- a/src/mod/event_handlers/mod_kazoo/kazoo_api.c +++ b/src/mod/event_handlers/mod_kazoo/kazoo_api.c @@ -516,8 +516,9 @@ SWITCH_STANDARD_API(exec_api_cmd) return SWITCH_STATUS_SUCCESS; } -void add_cli_api(switch_loadable_module_interface_t **module_interface, switch_api_interface_t *api_interface) +void add_cli_api(switch_loadable_module_interface_t **module_interface) { + switch_api_interface_t *api_interface = NULL; SWITCH_ADD_API(api_interface, "erlang", KAZOO_DESC, exec_api_cmd, KAZOO_SYNTAX); switch_console_set_complete("add erlang status"); switch_console_set_complete("add erlang event_filter"); diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_commands.c b/src/mod/event_handlers/mod_kazoo/kazoo_commands.c index f798d027b7..2e9a8f2459 100644 --- a/src/mod/event_handlers/mod_kazoo/kazoo_commands.c +++ b/src/mod/event_handlers/mod_kazoo/kazoo_commands.c @@ -104,7 +104,8 @@ static void process_history_item(char* value, cJSON *json) switch_safe_free(item); } -SWITCH_STANDARD_API(kz_json_history) { +SWITCH_STANDARD_API(kz_json_history) +{ char *mycmd = NULL, *argv[MAX_HISTORY] = { 0 }; int n, argc = 0; cJSON *json = cJSON_CreateObject(); @@ -145,7 +146,8 @@ SWITCH_STANDARD_API(kz_json_history) { return SWITCH_STATUS_SUCCESS; } -SWITCH_STANDARD_API(kz_first_of) { +SWITCH_STANDARD_API(kz_first_of) +{ char delim = '|'; char *mycmd = NULL, *argv[MAX_FIRST_OF] = { 0 }; int n, argc = 0; @@ -498,7 +500,20 @@ done: return status; } -void add_kz_commands(switch_loadable_module_interface_t **module_interface, switch_api_interface_t *api_interface) { +SWITCH_STANDARD_API(kz_expand_api) +{ + if (!zstr(cmd)) { + char * val = kz_expand(cmd); + stream->write_function(stream, "+OK %s", val); + switch_safe_free(val); + } else { + stream->write_function(stream, "ERR invalid input"); + } + return SWITCH_STATUS_SUCCESS; +} + +void add_kz_commands(switch_loadable_module_interface_t **module_interface) { + switch_api_interface_t *api_interface = NULL; SWITCH_ADD_API(api_interface, "kz_uuid_setvar_multi", UUID_SET_DESC, uuid_setvar_multi_function, UUID_MULTISET_SYNTAX); SWITCH_ADD_API(api_interface, "kz_uuid_setvar_multi_encoded", UUID_SET_DESC, uuid_setvar_multi_encoded_function, UUID_MULTISET_SYNTAX); switch_console_set_complete("add kz_uuid_setvar_multi ::console::list_uuid"); @@ -510,5 +525,6 @@ void add_kz_commands(switch_loadable_module_interface_t **module_interface, swit SWITCH_ADD_API(api_interface, "kz_http_put", KZ_HTTP_PUT_DESC, kz_http_put, KZ_HTTP_PUT_SYNTAX); SWITCH_ADD_API(api_interface, "first-of", KZ_FIRST_OF_DESC, kz_first_of, KZ_FIRST_OF_SYNTAX); SWITCH_ADD_API(api_interface, "kz_json_history", KZ_FIRST_OF_DESC, kz_json_history, KZ_FIRST_OF_SYNTAX); + SWITCH_ADD_API(api_interface, "kz_expand", KZ_FIRST_OF_DESC, kz_expand_api, KZ_FIRST_OF_SYNTAX); } diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_defs.h b/src/mod/event_handlers/mod_kazoo/kazoo_defs.h new file mode 100644 index 0000000000..7fe86dd354 --- /dev/null +++ b/src/mod/event_handlers/mod_kazoo/kazoo_defs.h @@ -0,0 +1,9 @@ +#ifndef KAZOO_DEFS_H_ +#define KAZOO_DEFS_H_ + +#define INTERACTION_VARIABLE "Call-Interaction-ID" + +#define UNIX_EPOCH_IN_GREGORIAN 62167219200 +#define UNIX_EPOCH_IN_GREGORIAN_STR "62167219200" + +#endif /* KAZOO_DEFS_H_ */ diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_dptools.c b/src/mod/event_handlers/mod_kazoo/kazoo_dptools.c index 72e2afa18f..da5354f3ec 100644 --- a/src/mod/event_handlers/mod_kazoo/kazoo_dptools.c +++ b/src/mod/event_handlers/mod_kazoo/kazoo_dptools.c @@ -891,7 +891,8 @@ SWITCH_STANDARD_APP(kz_att_xfer_function) } } -void add_kz_dptools(switch_loadable_module_interface_t **module_interface, switch_application_interface_t *app_interface) { +void add_kz_dptools(switch_loadable_module_interface_t **module_interface) { + switch_application_interface_t *app_interface = NULL; SWITCH_ADD_APP(app_interface, "kz_set", SET_SHORT_DESC, SET_LONG_DESC, set_function, SET_SYNTAX, SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC); SWITCH_ADD_APP(app_interface, "kz_set_encoded", SET_SHORT_DESC, SET_LONG_DESC, set_encoded_function, SET_SYNTAX, SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC); SWITCH_ADD_APP(app_interface, "kz_multiset", MULTISET_SHORT_DESC, MULTISET_LONG_DESC, multiset_function, MULTISET_SYNTAX, SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC); diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_ei.h b/src/mod/event_handlers/mod_kazoo/kazoo_ei.h index b28a888978..4d247629e3 100644 --- a/src/mod/event_handlers/mod_kazoo/kazoo_ei.h +++ b/src/mod/event_handlers/mod_kazoo/kazoo_ei.h @@ -10,6 +10,8 @@ #define VERSION "mod_kazoo v1.5.0-1 community" #define KZ_MAX_SEPARATE_STRINGS 10 +#define HOSTNAME_MAX 1024 +#define NODENAME_MAX 1024 typedef enum {KAZOO_FETCH_PROFILE, KAZOO_EVENT_PROFILE} kazoo_profile_type; @@ -139,25 +141,7 @@ struct ei_xml_agent_s { }; -typedef enum { - KZ_TWEAK_INTERACTION_ID, - KZ_TWEAK_EXPORT_VARS, - KZ_TWEAK_SWITCH_URI, - KZ_TWEAK_REPLACES_CALL_ID, - KZ_TWEAK_LOOPBACK_VARS, - KZ_TWEAK_CALLER_ID, - KZ_TWEAK_TRANSFERS, - KZ_TWEAK_BRIDGE, - KZ_TWEAK_BRIDGE_REPLACES_ALEG, - KZ_TWEAK_BRIDGE_REPLACES_CALL_ID, - KZ_TWEAK_BRIDGE_VARIABLES, - KZ_TWEAK_RESTORE_CALLER_ID_ON_BLIND_XFER, - - /* No new flags below this line */ - KZ_TWEAK_MAX -} kz_tweak_t; - -struct globals_s { +struct kz_globals_s { switch_memory_pool_t *pool; switch_atomic_t threads; switch_socket_t *acceptor; @@ -180,6 +164,7 @@ struct globals_s { int ei_compat_rel; char *ip; char *hostname; + struct hostent* hostname_ent; char *ei_cookie; char *ei_nodename; uint32_t flags; @@ -209,8 +194,8 @@ struct globals_s { }; -typedef struct globals_s globals_t; -extern globals_t kazoo_globals; +typedef struct kz_globals_s kz_globals_t; +extern kz_globals_t kazoo_globals; /* kazoo_event_stream.c */ ei_event_stream_t *find_event_stream(ei_event_stream_t *event_streams, const erlang_pid *from); diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_ei_config.c b/src/mod/event_handlers/mod_kazoo/kazoo_ei_config.c index 0d2b95a8c2..df3eec0bf6 100644 --- a/src/mod/event_handlers/mod_kazoo/kazoo_ei_config.c +++ b/src/mod/event_handlers/mod_kazoo/kazoo_ei_config.c @@ -95,6 +95,19 @@ static int read_cookie_from_file(char *filename) { } } +void kz_set_hostname() +{ + if (kazoo_globals.hostname == NULL) { + char hostname[NODENAME_MAX]; + memcpy(hostname, switch_core_get_hostname(), NODENAME_MAX); + kazoo_globals.hostname_ent = gethostbyname(hostname); + if(kazoo_globals.hostname_ent != NULL) { + kazoo_globals.hostname = switch_core_strdup(kazoo_globals.pool, kazoo_globals.hostname_ent->h_name); + } else { + kazoo_globals.hostname = switch_core_strdup(kazoo_globals.pool, hostname); + } + } +} switch_status_t kazoo_ei_config(switch_xml_t cfg) { switch_xml_t child, param; @@ -109,7 +122,7 @@ switch_status_t kazoo_ei_config(switch_xml_t cfg) { kazoo_globals.receive_msg_preallocate = 2000; kazoo_globals.event_stream_preallocate = KZ_DEFAULT_STREAM_PRE_ALLOCATE; kazoo_globals.send_msg_batch = 10; - kazoo_globals.event_stream_framing = 2; + kazoo_globals.event_stream_framing = 4; kazoo_globals.port = 0; kazoo_globals.io_fault_tolerance = 10; kazoo_globals.json_encoding = ERLANG_TUPLE; @@ -211,11 +224,18 @@ switch_status_t kazoo_ei_config(switch_xml_t cfg) { } if ((child = switch_xml_child(cfg, "tweaks"))) { + char *default_tweaks = (char *) switch_xml_attr_soft(param, "default"); + if (default_tweaks) { + int i, v = switch_true(default_tweaks) ? 1 : 0; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Set tweak default : %s\n", default_tweaks); + for (i = 0; i < KZ_TWEAK_MAX; i++) kazoo_globals.tweaks[i] = v; + } for (param = switch_xml_child(child, "tweak"); param; param = param->next) { kz_tweak_t tweak = KZ_TWEAK_MAX; char *var = (char *) switch_xml_attr_soft(param, "name"); char *val = (char *) switch_xml_attr_soft(param, "value"); if(var && val && kz_name_tweak(var, &tweak) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Set tweak %s : %s\n", var, val); if(switch_true(val)) { kz_set_tweak(tweak); } else { @@ -230,6 +250,7 @@ switch_status_t kazoo_ei_config(switch_xml_t cfg) { char *var = (char *) switch_xml_attr_soft(param, "name"); char *val = (char *) switch_xml_attr_soft(param, "value"); if(var && val) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Set core variable %s : %s\n", var, val); switch_core_set_variable(var, val); } } diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_ei_utils.c b/src/mod/event_handlers/mod_kazoo/kazoo_ei_utils.c index 514980b426..7def04974b 100644 --- a/src/mod/event_handlers/mod_kazoo/kazoo_ei_utils.c +++ b/src/mod/event_handlers/mod_kazoo/kazoo_ei_utils.c @@ -332,8 +332,6 @@ switch_socket_t *create_socket_with_port(switch_memory_pool_t *pool, switch_port return NULL; } - switch_getnameinfo(&kazoo_globals.hostname, sa, 0); - if (kazoo_globals.nat_map && switch_nat_get_type()) { switch_nat_add_mapping(port, SWITCH_NAT_TCP, NULL, SWITCH_FALSE); } diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_endpoints.c b/src/mod/event_handlers/mod_kazoo/kazoo_endpoints.c index fba1adddb1..111edfdb90 100644 --- a/src/mod/event_handlers/mod_kazoo/kazoo_endpoints.c +++ b/src/mod/event_handlers/mod_kazoo/kazoo_endpoints.c @@ -32,22 +32,46 @@ */ #include "mod_kazoo.h" +#define INTERACTION_VARIABLE "Call-Interaction-ID" + +static const char *x_bridge_variables[] = { + "Call-Control-Queue", + "Call-Control-PID", + "Call-Control-Node", + INTERACTION_VARIABLE, + "ecallmgr_Ecallmgr-Node", + "sip_h_k-cid", + "Switch-URI", + "Switch-URL", + NULL +}; + +static void kz_tweaks_variables_to_event(switch_core_session_t *session, switch_event_t *event) +{ + int i; + switch_channel_t *channel = switch_core_session_get_channel(session); + for(i = 0; x_bridge_variables[i] != NULL; i++) { + const char *val = switch_channel_get_variable_dup(channel, x_bridge_variables[i], SWITCH_FALSE, -1); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, x_bridge_variables[i], val); + } +} + /* kazoo endpoint */ switch_endpoint_interface_t *kz_endpoint_interface; static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *session, - switch_event_t *var_event, - switch_caller_profile_t *outbound_profile, - switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, - switch_call_cause_t *cancel_cause); + switch_event_t *var_event, + switch_caller_profile_t *outbound_profile, + switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, + switch_call_cause_t *cancel_cause); switch_io_routines_t kz_endpoint_io_routines = { /*.outgoing_channel */ kz_endpoint_outgoing_channel }; static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *session, - switch_event_t *var_event, - switch_caller_profile_t *outbound_profile, - switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, - switch_call_cause_t *cancel_cause) + switch_event_t *var_event, + switch_caller_profile_t *outbound_profile, + switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, + switch_call_cause_t *cancel_cause) { switch_xml_t x_user = NULL, x_param, x_params; char *user = NULL, *domain = NULL, *dup_domain = NULL, *dialed_user = NULL; @@ -58,8 +82,10 @@ static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *s switch_event_t *params = NULL, *var_event_orig = var_event; char stupid[128] = ""; const char *skip = NULL, *var = NULL; + switch_core_session_t *a_session = NULL, *e_session = NULL; if (zstr(outbound_profile->destination_number)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "NO DESTINATION NUMBER\n"); goto done; } @@ -84,6 +110,9 @@ static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *s switch_assert(params); switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "as_channel", "true"); switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "action", "user_call"); + if (session) { + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(session)); + } if (var_event) { switch_event_merge(params, var_event); @@ -102,6 +131,20 @@ static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *s goto done; } + if ((x_params = switch_xml_child(x_user, "variables"))) { + for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) { + const char *pvar = switch_xml_attr_soft(x_param, "name"); + const char *val = switch_xml_attr(x_param, "value"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "adding variable to var_event => %s = %s\n", pvar, val); + if (!var_event) { + switch_event_create(&var_event, SWITCH_EVENT_GENERAL); + } else { + switch_event_del_header(var_event, pvar); + } + switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, pvar, val); + } + } + if ((x_params = switch_xml_child(x_user, "params"))) { for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) { const char *pvar = switch_xml_attr_soft(x_param, "name"); @@ -115,7 +158,7 @@ static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *s } else { switch_event_del_header(var_event, pvar + 9); } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG1, "adding variable to var_event => %s = %s\n", pvar + 9, val); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "adding dialog var to var_event => %s = %s\n", pvar + 9, val); switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, pvar + 9, val); } } @@ -126,9 +169,6 @@ static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *s if (var_event) { switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "dialed_user", dialed_user); switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "dialed_domain", domain); - if (!zstr(dest) && !strstr(dest, "presence_id=")) { - switch_event_add_header(var_event, SWITCH_STACK_BOTTOM, "presence_id", "%s@%s", dialed_user, domain); - } } if (!dest) { @@ -141,16 +181,27 @@ static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *s switch_originate_flag_t myflags = SOF_NONE; char *cid_name_override = NULL; char *cid_num_override = NULL; + switch_event_t *event = NULL; if (var_event) { cid_name_override = switch_event_get_header(var_event, "origination_caller_id_name"); cid_num_override = switch_event_get_header(var_event, "origination_caller_id_number"); } - if (session) { - switch_event_t *event = NULL; + if(session) { + a_session = session; + } else if(var_event) { + const char* uuid_e_session = switch_event_get_header(var_event, "ent_originate_aleg_uuid"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHECKING ORIGINATE-UUID : %s\n", uuid_e_session); + if (uuid_e_session && (e_session = switch_core_session_force_locate(uuid_e_session)) != NULL) { + a_session = e_session; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FOUND ORIGINATE-UUID : %s\n", uuid_e_session); + } + } + + if (a_session) { switch_event_create(&event, SWITCH_EVENT_GENERAL); - channel = switch_core_session_get_channel(session); + channel = switch_core_session_get_channel(a_session); if ((varval = switch_channel_get_variable(channel, SWITCH_CALL_TIMEOUT_VARIABLE)) || (var_event && (varval = switch_event_get_header(var_event, "leg_timeout")))) { timelimit = atoi(varval); @@ -163,13 +214,7 @@ static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *s switch_channel_set_variable(channel, "dialed_user", dialed_user); switch_channel_set_variable(channel, "dialed_domain", domain); - d_dest = switch_event_expand_headers(event, dest); - - switch_event_destroy(&event); - } else { - switch_event_t *event = NULL; - if (var_event) { switch_event_dup(&event, var_event); switch_event_del_header(event, "dialed_user"); @@ -185,10 +230,48 @@ static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *s switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "dialed_user", dialed_user); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "dialed_domain", domain); - d_dest = switch_event_expand_headers(event, dest); - switch_event_destroy(&event); } + if ((x_params = switch_xml_child(x_user, "profile-variables"))) { + for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) { + const char *pvar = switch_xml_attr_soft(x_param, "name"); + const char *val = switch_xml_attr(x_param, "value"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "adding profile variable to event => %s = %s\n", pvar, val); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, pvar, val); + } + } + + if ((x_params = switch_xml_child(x_user, "variables"))) { + for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) { + const char *pvar = switch_xml_attr_soft(x_param, "name"); + const char *val = switch_xml_attr(x_param, "value"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "adding variable to event => %s = %s\n", pvar, val); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, pvar, val); + } + } + + if ((x_params = switch_xml_child(x_user, "params"))) { + for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) { + const char *pvar = switch_xml_attr_soft(x_param, "name"); + const char *val = switch_xml_attr(x_param, "value"); + + if (!strncasecmp(pvar, "dial-var-", 9)) { + switch_event_del_header(event, pvar + 9); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "adding dialog var to event => %s = %s\n", pvar + 9, val); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, pvar + 9, val); + } + } + } + + d_dest = kz_event_expand_headers(event, dest); + + if (var_event) { + kz_expand_headers(event, var_event); + } + + switch_event_destroy(&event); + + if ((flags & SOF_NO_LIMITS)) { myflags |= SOF_NO_LIMITS; } @@ -197,10 +280,19 @@ static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *s myflags |= SOF_NOBLOCK; } + if ( a_session ) { + if(var_event) { + kz_tweaks_variables_to_event(a_session, var_event); + } + } + + if(e_session) { + switch_core_session_rwunlock(e_session); + } + switch_snprintf(stupid, sizeof(stupid), "kz/%s", dialed_user); if (switch_stristr(stupid, d_dest)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Waddya Daft? You almost called '%s' in an infinate loop!\n", - stupid); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Waddya Daft? You almost called '%s' in an infinate loop!\n", stupid); cause = SWITCH_CAUSE_INVALID_IE_CONTENTS; } else if (switch_ivr_originate(session, new_session, &cause, d_dest, timelimit, NULL, cid_name_override, cid_num_override, outbound_profile, var_event, myflags, @@ -220,6 +312,7 @@ static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *s } } + /* if ((x_params = switch_xml_child(x_user, "variables"))) { for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) { const char *pvar = switch_xml_attr(x_param, "name"); @@ -227,6 +320,7 @@ static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *s switch_channel_set_variable(new_channel, pvar, val); } } + */ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_DEBUG1, "CHECKING CALLER-ID\n"); if ((x_params = switch_xml_child(x_user, "profile-variables"))) { @@ -272,7 +366,6 @@ static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *s switch_safe_free(user); switch_safe_free(dup_domain); - return cause; } diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_message.c b/src/mod/event_handlers/mod_kazoo/kazoo_message.c index 74ddff6647..a35dfab080 100644 --- a/src/mod/event_handlers/mod_kazoo/kazoo_message.c +++ b/src/mod/event_handlers/mod_kazoo/kazoo_message.c @@ -232,7 +232,9 @@ cJSON * kazoo_event_add_field_to_json(cJSON *dst, switch_event_t *src, kazoo_fie expanded = kz_event_expand_headers(src, field->value); if(expanded != NULL && !zstr(expanded)) { item = kazoo_event_add_json_value(dst, field, field->as ? field->as : field->name, expanded); - free(expanded); + if(expanded != field->value) { + free(expanded); + } } break; @@ -325,6 +327,21 @@ static switch_status_t kazoo_event_add_fields_to_json(kazoo_logging_ptr logging, return SWITCH_STATUS_SUCCESS; } +#define EVENT_TIMESTAMP_FIELD "Event-Date-Timestamp" +#define JSON_TIMESTAMP_FIELD "Event-Timestamp" + +static switch_status_t kazoo_event_add_timestamp(switch_event_t* evt, cJSON* JObj) +{ + switch_event_header_t *header; + cJSON *item = NULL; + if((header = switch_event_get_header_ptr(evt, EVENT_TIMESTAMP_FIELD)) != NULL) { + if ((item = kazoo_event_json_value(JSON_NUMBER, header->value)) != NULL) { + kazoo_cJSON_AddItemToObject(JObj, JSON_TIMESTAMP_FIELD, item); + return SWITCH_STATUS_SUCCESS; + } + } + return SWITCH_STATUS_NOTFOUND; +} kazoo_message_ptr kazoo_message_create_event(switch_event_t* evt, kazoo_event_ptr event, kazoo_event_profile_ptr profile) { @@ -366,6 +383,8 @@ kazoo_message_ptr kazoo_message_create_event(switch_event_t* evt, kazoo_event_pt kazoo_event_init_json(profile->fields, event ? event->fields : NULL, evt, &JObj); + kazoo_event_add_timestamp(evt, JObj); + if(profile->fields) kazoo_event_add_fields_to_json(&logging, JObj, evt, profile->fields->head); @@ -402,6 +421,8 @@ kazoo_message_ptr kazoo_message_create_fetch(switch_event_t* evt, kazoo_fetch_pr kazoo_event_init_json(profile->fields, NULL, evt, &JObj); + kazoo_event_add_timestamp(evt, JObj); + if(profile->fields) kazoo_event_add_fields_to_json(&logging, JObj, evt, profile->fields->head); diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_tweaks.c b/src/mod/event_handlers/mod_kazoo/kazoo_tweaks.c index 67f4d37a99..2afcdf1a6a 100644 --- a/src/mod/event_handlers/mod_kazoo/kazoo_tweaks.c +++ b/src/mod/event_handlers/mod_kazoo/kazoo_tweaks.c @@ -30,9 +30,6 @@ */ #include "mod_kazoo.h" -#define INTERACTION_VARIABLE "Call-Interaction-ID" -#define BRIDGE_INTERCEPT_VARIABLE "Bridge-Intercepted" - static char *TWEAK_NAMES[] = { "interaction-id", "export-vars", @@ -69,7 +66,6 @@ static switch_status_t kz_tweaks_signal_bridge_on_hangup(switch_core_session_t * switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "tweak signal bridge on hangup: %s , %s\n", switch_core_session_get_uuid(session), peer_uuid); - if (switch_event_create(&my_event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(my_event, SWITCH_STACK_BOTTOM, "Bridge-A-Unique-ID", switch_core_session_get_uuid(session)); switch_event_add_header_string(my_event, SWITCH_STACK_BOTTOM, "Bridge-B-Unique-ID", peer_uuid); @@ -106,7 +102,6 @@ static void kz_tweaks_handle_bridge_variables(switch_event_t *event) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "tweak bridge event handler: variables : %s , %s\n", a_leg, b_leg); - if (a_leg && (a_session = switch_core_session_force_locate(a_leg)) != NULL) { switch_channel_t *a_channel = switch_core_session_get_channel(a_session); if(switch_channel_get_variable_dup(a_channel, bridge_variables[0], SWITCH_FALSE, -1) == NULL) { @@ -137,56 +132,91 @@ static void kz_tweaks_handle_bridge_variables(switch_event_t *event) } -static void kz_tweaks_handle_bridge_intercepted(switch_event_t *event) +static void kz_tweaks_handle_bridge_replaces_aleg(switch_event_t *event) { switch_event_t *my_event; - switch_core_session_t *a_session = NULL; - switch_core_session_t *b_session = NULL; - const char *uuid = switch_event_get_header(event, "Unique-ID"); - const char *a_leg = switch_event_get_header(event, "Bridge-A-Unique-ID"); - const char *b_leg = switch_event_get_header(event, "Bridge-B-Unique-ID"); - const char *bridge_intercepted = NULL; + const char *replaced_call_id = switch_event_get_header(event, "variable_sip_replaces_call_id"); + const char *a_leg_call_id = switch_event_get_header(event, "variable_sip_replaces_a-leg"); + const char *peer_uuid = switch_event_get_header(event, "Unique-ID"); + int processed = 0; if (!kz_test_tweak(KZ_TWEAK_BRIDGE_REPLACES_ALEG)) return; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "tweak bridge event handler: intercepted : %s , %s, %s\n", uuid, a_leg, b_leg); + if(a_leg_call_id && replaced_call_id) { + const char *call_id = switch_event_get_header(event, "Bridge-B-Unique-ID"); + switch_core_session_t *session = NULL; + if ((session = switch_core_session_locate(peer_uuid)) != NULL) { + switch_channel_t *channel = switch_core_session_get_channel(session); + processed = switch_true(switch_channel_get_variable_dup(channel, "Bridge-Event-Processed", SWITCH_FALSE, -1)); + switch_channel_set_variable(channel, "Bridge-Event-Processed", "true"); + switch_core_session_rwunlock(session); + } - if ((a_session = switch_core_session_locate(a_leg)) != NULL) { - switch_channel_t *a_channel = switch_core_session_get_channel(a_session); - bridge_intercepted = switch_channel_get_variable_dup(a_channel, BRIDGE_INTERCEPT_VARIABLE, SWITCH_TRUE, -1); - switch_channel_set_variable(a_channel, BRIDGE_INTERCEPT_VARIABLE, NULL); - if (bridge_intercepted && switch_true(bridge_intercepted)) { - switch_channel_set_variable(a_channel, "Bridge-B-Unique-ID", b_leg); - switch_channel_add_state_handler(a_channel, &kz_tweaks_signal_bridge_state_handlers); - - if ((b_session = switch_core_session_locate(b_leg)) != NULL) { - switch_channel_t *b_channel = switch_core_session_get_channel(b_session); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "creating channel_bridge event A - %s , B - %s\n", switch_core_session_get_uuid(b_session), uuid); - if (switch_event_create(&my_event, SWITCH_EVENT_CHANNEL_BRIDGE) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(my_event, SWITCH_STACK_BOTTOM, "Bridge-A-Unique-ID", switch_core_session_get_uuid(b_session)); - switch_event_add_header_string(my_event, SWITCH_STACK_BOTTOM, "Bridge-B-Unique-ID", uuid); - switch_channel_event_set_data(b_channel, my_event); - switch_event_fire(&my_event); + if(processed) { + if(call_id) { + if((session = switch_core_session_locate(call_id)) != NULL) { + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_channel_set_variable(channel, "Bridge-Event-Processed", "true"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "creating channel_bridge event A - %s , B - %s\n", switch_core_session_get_uuid(session), peer_uuid); + if (switch_event_create(&my_event, SWITCH_EVENT_CHANNEL_BRIDGE) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(my_event, SWITCH_STACK_BOTTOM, "Bridge-A-Unique-ID", switch_core_session_get_uuid(session)); + switch_event_add_header_string(my_event, SWITCH_STACK_BOTTOM, "Bridge-B-Unique-ID", peer_uuid); + switch_channel_event_set_data(channel, my_event); + switch_event_fire(&my_event); + } + switch_channel_set_variable(channel, "Bridge-B-Unique-ID", peer_uuid); + switch_channel_add_state_handler(channel, &kz_tweaks_signal_bridge_state_handlers); + switch_core_session_rwunlock(session); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "invalid session : %s\n", call_id); + DUMP_EVENT(event); } - switch_core_session_rwunlock(b_session); } } - switch_core_session_rwunlock(a_session); + } - switch_safe_strdup(bridge_intercepted); + +} + +static void kz_tweaks_handle_bridge_replaces_call_id(switch_event_t *event) +{ + switch_event_t *my_event; + + const char *replaced_call_id = switch_event_get_header(event, "variable_sip_replaces_call_id"); + const char *a_leg_call_id = switch_event_get_header(event, "variable_sip_replaces_a-leg"); + const char *peer_uuid = switch_event_get_header(event, "Unique-ID"); + + if (!kz_test_tweak(KZ_TWEAK_BRIDGE_REPLACES_CALL_ID)) return; + + if(a_leg_call_id && replaced_call_id) { + switch_core_session_t *call_session = NULL; + const char *call_id = switch_event_get_header(event, "Bridge-B-Unique-ID"); + if (call_id && (call_session = switch_core_session_force_locate(call_id)) != NULL) { + switch_channel_t *call_channel = switch_core_session_get_channel(call_session); + if (switch_event_create(&my_event, SWITCH_EVENT_CHANNEL_BRIDGE) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(my_event, SWITCH_STACK_BOTTOM, "Bridge-A-Unique-ID", switch_core_session_get_uuid(call_session)); + switch_event_add_header_string(my_event, SWITCH_STACK_BOTTOM, "Bridge-B-Unique-ID", peer_uuid); + switch_channel_event_set_data(call_channel, my_event); + switch_event_fire(&my_event); + } + switch_channel_set_variable(call_channel, "Bridge-B-Unique-ID", peer_uuid); + switch_channel_add_state_handler(call_channel, &kz_tweaks_signal_bridge_state_handlers); + switch_core_session_rwunlock(call_session); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "NOT FOUND : %s\n", call_id); + } + } + } static void kz_tweaks_channel_bridge_event_handler(switch_event_t *event) { - const char *uuid = switch_event_get_header(event, "Unique-ID"); - if (!kz_test_tweak(KZ_TWEAK_BRIDGE)) return; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "tweak bridge event handler: %s\n", uuid); - - kz_tweaks_handle_bridge_intercepted(event); + kz_tweaks_handle_bridge_replaces_call_id(event); + kz_tweaks_handle_bridge_replaces_aleg(event); kz_tweaks_handle_bridge_variables(event); } @@ -204,21 +234,12 @@ static void kz_tweaks_channel_replaced_event_handler(switch_event_t *event) static void kz_tweaks_channel_intercepted_event_handler(switch_event_t *event) { - switch_core_session_t *uuid_session = NULL; const char *uuid = switch_event_get_header(event, "Unique-ID"); const char *peer_uuid = switch_event_get_header(event, "intercepted_by"); if (!kz_test_tweak(KZ_TWEAK_TRANSFERS)) return; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "tweak intercepted handler : %s was intercepted by %s\n", uuid, peer_uuid); - - if ((uuid_session = switch_core_session_force_locate(peer_uuid)) != NULL) { - switch_channel_t *uuid_channel = switch_core_session_get_channel(uuid_session); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "marking %s for channel_bridge handling\n", peer_uuid); - switch_channel_set_variable(uuid_channel, BRIDGE_INTERCEPT_VARIABLE, "true"); - switch_core_session_rwunlock(uuid_session); - } - + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "INTERCEPTED : %s => %s\n", uuid, peer_uuid); } static void kz_tweaks_channel_transferor_event_handler(switch_event_t *event) @@ -423,30 +444,6 @@ static void kz_tweaks_handle_caller_id(switch_core_session_t *session) } } -/* -static switch_status_t kz_tweaks_handle_auth_token(switch_core_session_t *session) -{ - switch_channel_t *channel = switch_core_session_get_channel(session); - switch_event_t *event; - const char *token = switch_channel_get_variable(channel, "sip_h_X-FS-Auth-Token"); - if(token) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Authenticating user for nightmare xfer %s\n", token); - if (switch_ivr_set_user(session, token) == SWITCH_STATUS_SUCCESS) { - if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) { - switch_channel_event_set_data(channel, event); - switch_event_fire(&event); - } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Authenticated user from nightmare xfer %s\n", token); - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Error Authenticating user for nightmare xfer %s\n", token); - } - } - - return SWITCH_STATUS_SUCCESS; - -} -*/ - static switch_status_t kz_tweaks_handle_nightmare_xfer_interaction_id(switch_core_session_t *session) { if (kz_test_tweak(KZ_TWEAK_INTERACTION_ID)) { @@ -525,16 +522,26 @@ static switch_status_t kz_tweaks_handle_switch_uri(switch_core_session_t *sessio } +static char * kz_tweaks_new_interaction_id() +{ + long int first = (switch_micro_time_now() / 1000000) + UNIX_EPOCH_IN_GREGORIAN; + char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1]; + switch_uuid_t uuid; + switch_uuid_get(&uuid); + switch_uuid_format(uuid_str, &uuid); + uuid_str[8] = '\0'; + return switch_mprintf("%ld-%s", first, uuid_str); +} + static void kz_tweaks_handle_interaction_id(switch_core_session_t *session) { - const char *expr = "${expr(ceil((${Event-Date-Timestamp} / 1000000) + $${UNIX_EPOCH_IN_GREGORIAN}))}-${regex(${create_uuid()}|^([^-]*)|%1)}"; switch_channel_t *channel = switch_core_session_get_channel(session); char * val = NULL; switch_core_session_t *peer_session = NULL; const char* peer_interaction_id = NULL; if (kz_test_tweak(KZ_TWEAK_INTERACTION_ID)) { - val = kz_expand(expr); + val = kz_tweaks_new_interaction_id(); if (val) { switch_channel_set_variable(channel, "Original-"INTERACTION_VARIABLE, val); if(switch_core_session_get_partner(session, &peer_session) == SWITCH_STATUS_SUCCESS) { @@ -583,32 +590,6 @@ static switch_status_t kz_tweaks_register_handle_blind_xfer(switch_core_session_ return SWITCH_STATUS_SUCCESS; } -static switch_status_t kz_tweaks_set_export_vars(switch_core_session_t *session) -{ - switch_channel_t *channel = switch_core_session_get_channel(session); - const char *exports; - char *var, *new_exports, *new_exports_d = NULL; - - if (kz_test_tweak(KZ_TWEAK_EXPORT_VARS)) { - exports = switch_channel_get_variable(channel, SWITCH_EXPORT_VARS_VARIABLE); - var = switch_core_session_strdup(session, "Switch-URI,Switch-URL"); - - if (exports) { - new_exports_d = switch_mprintf("%s,%s", exports, var); - new_exports = new_exports_d; - } else { - new_exports = var; - } - - switch_channel_set_variable(channel, SWITCH_EXPORT_VARS_VARIABLE, new_exports); - - switch_safe_free(new_exports_d); - } - - - return SWITCH_STATUS_SUCCESS; -} - static switch_status_t kz_tweaks_on_init(switch_core_session_t *session) { switch_channel_t *channel = switch_core_session_get_channel(session); @@ -618,12 +599,10 @@ static switch_status_t kz_tweaks_on_init(switch_core_session_t *session) kz_tweaks_handle_interaction_id(session); kz_tweaks_handle_switch_uri(session); kz_tweaks_handle_caller_id(session); -// kz_tweaks_handle_auth_token(session); kz_tweaks_handle_nightmare_xfer_interaction_id(session); kz_tweaks_handle_replaces_call_id(session); kz_tweaks_handle_loopback(session); kz_tweaks_register_handle_blind_xfer(session); - kz_tweaks_set_export_vars(session); return SWITCH_STATUS_SUCCESS; } @@ -693,7 +672,7 @@ static void kz_tweaks_unbind_events() void kz_tweaks_add_core_variables() { - switch_core_set_variable("UNIX_EPOCH_IN_GREGORIAN", "62167219200"); + switch_core_set_variable("UNIX_EPOCH_IN_GREGORIAN", UNIX_EPOCH_IN_GREGORIAN_STR); } void kz_tweaks_start() diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_tweaks.h b/src/mod/event_handlers/mod_kazoo/kazoo_tweaks.h new file mode 100644 index 0000000000..11cf5f6561 --- /dev/null +++ b/src/mod/event_handlers/mod_kazoo/kazoo_tweaks.h @@ -0,0 +1,32 @@ +#pragma once + +#include + +typedef enum { + KZ_TWEAK_INTERACTION_ID, + KZ_TWEAK_EXPORT_VARS, + KZ_TWEAK_SWITCH_URI, + KZ_TWEAK_REPLACES_CALL_ID, + KZ_TWEAK_LOOPBACK_VARS, + KZ_TWEAK_CALLER_ID, + KZ_TWEAK_TRANSFERS, + KZ_TWEAK_BRIDGE, + KZ_TWEAK_BRIDGE_REPLACES_ALEG, + KZ_TWEAK_BRIDGE_REPLACES_CALL_ID, + KZ_TWEAK_BRIDGE_VARIABLES, + KZ_TWEAK_RESTORE_CALLER_ID_ON_BLIND_XFER, + + /* No new flags below this line */ + KZ_TWEAK_MAX +} kz_tweak_t; + +void kz_tweaks_start(); +void kz_tweaks_stop(); +SWITCH_DECLARE(const char *) kz_tweak_name(kz_tweak_t tweak); +SWITCH_DECLARE(switch_status_t) kz_name_tweak(const char *name, kz_tweak_t *type); + + +#define kz_test_tweak(flag) (kazoo_globals.tweaks[flag] ? 1 : 0) +#define kz_set_tweak(flag) kazoo_globals.tweaks[flag] = 1 +#define kz_clear_tweak(flag) kazoo_globals.tweaks[flag] = 0 + diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_utils.c b/src/mod/event_handlers/mod_kazoo/kazoo_utils.c index f4050bb34a..afc685434f 100644 --- a/src/mod/event_handlers/mod_kazoo/kazoo_utils.c +++ b/src/mod/event_handlers/mod_kazoo/kazoo_utils.c @@ -90,15 +90,11 @@ SWITCH_DECLARE(switch_status_t) kz_expand_api_execute(const char *cmd, const cha switch_assert(stream->data != NULL); switch_assert(stream->write_function != NULL); - if (strcasecmp(cmd, "console_complete")) { - cmd_used = switch_strip_whitespace(cmd); - arg_used = switch_strip_whitespace(arg); - } else { - cmd_used = (char *) cmd; - arg_used = (char *) arg; - } + cmd_used = switch_strip_whitespace(cmd); + arg_used = switch_strip_whitespace(arg); if (cmd_used && (api = switch_loadable_module_get_api_interface(cmd_used)) != 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "executing [%s] => [%s]\n", cmd_used, arg_used); if ((status = api->function(arg_used, session, stream)) != SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "COMMAND RETURNED ERROR!\n"); } @@ -148,6 +144,7 @@ SWITCH_DECLARE(char *) kz_event_expand_headers_check(switch_event_t *event, cons nv = 0; olen = strlen(in) + 1; indup = strdup(in); + switch_assert(indup); endof_indup = end_of_p(indup) + 1; if ((data = malloc(olen))) { @@ -342,46 +339,37 @@ SWITCH_DECLARE(char *) kz_event_expand_headers_check(switch_event_t *event, cons } else { switch_stream_handle_t stream = { 0 }; char *expanded = NULL; + char *expanded_vname = NULL; SWITCH_STANDARD_STREAM(stream); - if (stream.data) { - char *expanded_vname = NULL; - - if ((expanded_vname = kz_event_expand_headers_check(event, (char *) vname, var_list, api_list, recur+1)) == vname) { - expanded_vname = NULL; - } else { - vname = expanded_vname; - } - - if ((expanded = kz_event_expand_headers_check(event, vval, var_list, api_list, recur+1)) == vval) { - expanded = NULL; - } else { - vval = expanded; - } - - if (!switch_core_test_flag(SCF_API_EXPANSION) || (api_list && !switch_event_check_permission_list(api_list, vname))) { - func_val = NULL; - sub_val = ""; - } else { - stream.param_event = event; - if (kz_expand_api_execute(vname, vval, NULL, &stream) == SWITCH_STATUS_SUCCESS) { - func_val = stream.data; - sub_val = func_val; - } else { - free(stream.data); - } - } - - switch_safe_free(expanded); - switch_safe_free(expanded_vname); - + if ((expanded_vname = kz_event_expand_headers_check(event, (char *) vname, var_list, api_list, recur+1)) == vname) { + expanded_vname = NULL; } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n"); - free(data); - free(indup); - return (char *) in; + vname = expanded_vname; } + + if ((expanded = kz_event_expand_headers_check(event, vval, var_list, api_list, recur+1)) == vval) { + expanded = NULL; + } else { + vval = expanded; + } + + if (!switch_core_test_flag(SCF_API_EXPANSION) || (api_list && !switch_event_check_permission_list(api_list, vname))) { + func_val = NULL; + sub_val = ""; + } else { + stream.param_event = event; + if (kz_expand_api_execute(vname, vval, NULL, &stream) == SWITCH_STATUS_SUCCESS) { + func_val = stream.data; + sub_val = func_val; + } else { + free(stream.data); + } + } + + switch_safe_free(expanded); + switch_safe_free(expanded_vname); } if ((nlen = sub_val ? strlen(sub_val) : 0)) { if (len + nlen >= olen) { @@ -435,6 +423,21 @@ SWITCH_DECLARE(char *) kz_event_expand_headers(switch_event_t *event, const char return kz_event_expand_headers_check(event, in, NULL, NULL, 0); } +SWITCH_DECLARE(char *) kz_event_expand_headers_pool(switch_memory_pool_t *pool, switch_event_t *event, char *val) +{ + char *expanded; + char *dup = NULL; + + expanded = kz_event_expand_headers(event, val); + dup = switch_core_strdup(pool, expanded); + + if (expanded != val) { + free(expanded); + } + + return dup; +} + SWITCH_DECLARE(char *) kz_event_expand(const char *in) { switch_event_t *event = NULL; @@ -565,6 +568,35 @@ void kz_event_decode(switch_event_t *event) } } +void kz_expand_headers(switch_event_t *resolver, switch_event_t *event) { + switch_event_t *clone = NULL; + switch_event_header_t *header = NULL; + switch_event_create_plain(&clone, event->event_id); + + for(header = event->headers; header; header = header->next) { + char *expanded = kz_event_expand_headers(resolver, header->value); + if (expanded != header->value) { + switch_event_add_header_string(clone, SWITCH_STACK_BOTTOM, header->name, expanded); + switch_safe_free(expanded); + } + } + + /* we don't want to force unique headers + * so we delete and then merge + */ + for(header = clone->headers; header; header = header->next) { + switch_event_del_header(event, header->name); + } + + switch_event_merge(event, clone); + + switch_event_destroy(&clone); +} + +void kz_expand_headers_self(switch_event_t *event) { + kz_expand_headers(event, event); +} + char * kz_expand_vars(char *xml_str) { return kz_expand_vars_pool(xml_str, NULL); } diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_utils.h b/src/mod/event_handlers/mod_kazoo/kazoo_utils.h new file mode 100644 index 0000000000..397d94a361 --- /dev/null +++ b/src/mod/event_handlers/mod_kazoo/kazoo_utils.h @@ -0,0 +1,51 @@ +#pragma once + +#include + +#ifdef __cplusplus +#define KZ_BEGIN_EXTERN_C extern "C" { +#define KZ_END_EXTERN_C } +#else +#define KZ_BEGIN_EXTERN_C +#define KZ_END_EXTERN_C +#endif + +KZ_BEGIN_EXTERN_C + +void kz_check_set_profile_var(switch_channel_t *channel, char* var, char *val); + +SWITCH_DECLARE(switch_status_t) kz_switch_core_merge_variables(switch_event_t *event); + +SWITCH_DECLARE(switch_status_t) kz_switch_core_base_headers_for_expand(switch_event_t **event); + +SWITCH_DECLARE(switch_status_t) kz_expand_api_execute(const char *cmd, const char *arg, switch_core_session_t *session, switch_stream_handle_t *stream); + +SWITCH_DECLARE(char *) kz_event_expand_headers_check(switch_event_t *event, const char *in, switch_event_t *var_list, switch_event_t *api_list, uint32_t recur); + +SWITCH_DECLARE(char *) kz_event_expand_headers(switch_event_t *event, const char *in); + +SWITCH_DECLARE(char *) kz_event_expand_headers_pool(switch_memory_pool_t *pool, switch_event_t *event, char *val); + +SWITCH_DECLARE(char *) kz_event_expand(const char *in); + +SWITCH_DECLARE(char *) kz_expand(const char *in); + +SWITCH_DECLARE(char *) kz_expand_pool(switch_memory_pool_t *pool, const char *in); + +char* kz_switch_event_get_first_of(switch_event_t *event, const char *list[]); + +SWITCH_DECLARE(switch_status_t) kz_switch_event_add_variable_name_printf(switch_event_t *event, switch_stack_t stack, const char *val, const char *fmt, ...); + +SWITCH_DECLARE(switch_xml_t) kz_xml_child(switch_xml_t xml, const char *name); + +void kz_xml_process(switch_xml_t cfg); +void kz_event_decode(switch_event_t *event); + +char * kz_expand_vars(char *xml_str); +void kz_expand_headers(switch_event_t *resolver, switch_event_t *event); +void kz_expand_headers_self(switch_event_t *event); + +char * kz_expand_vars_pool(char *xml_str, switch_memory_pool_t *pool); +switch_status_t kz_json_api(const char * command, cJSON *args, cJSON **res); + +KZ_END_EXTERN_C diff --git a/src/mod/event_handlers/mod_kazoo/kz_node.c b/src/mod/event_handlers/mod_kazoo/kz_node.c index 26c362980b..1c50d0586e 100644 --- a/src/mod/event_handlers/mod_kazoo/kz_node.c +++ b/src/mod/event_handlers/mod_kazoo/kz_node.c @@ -86,6 +86,6 @@ SWITCH_STANDARD_JSON_API(kz_node_info_json_function) void add_kz_node(switch_loadable_module_interface_t **module_interface) { - switch_json_api_interface_t *json_api_interface = NULL; + switch_json_api_interface_t *json_api_interface = NULL; SWITCH_ADD_JSON_API(json_api_interface, "node.info", "JSON node API", kz_node_info_json_function, ""); } diff --git a/src/mod/event_handlers/mod_kazoo/mod_kazoo.c b/src/mod/event_handlers/mod_kazoo/mod_kazoo.c index ca0538039b..6a4a9a4ce6 100644 --- a/src/mod/event_handlers/mod_kazoo/mod_kazoo.c +++ b/src/mod/event_handlers/mod_kazoo/mod_kazoo.c @@ -32,23 +32,16 @@ */ #include "mod_kazoo.h" -globals_t kazoo_globals = {0}; +kz_globals_t kazoo_globals = {0}; SWITCH_MODULE_DEFINITION(mod_kazoo, mod_kazoo_load, mod_kazoo_shutdown, mod_kazoo_runtime); SWITCH_MODULE_LOAD_FUNCTION(mod_kazoo_load) { - switch_api_interface_t *api_interface = NULL; - switch_application_interface_t *app_interface = NULL; memset(&kazoo_globals, 0, sizeof(kazoo_globals)); - kazoo_globals.pool = pool; - kazoo_globals.ei_nodes = NULL; - - // ensure epmd is running - if(kazoo_load_config() != SWITCH_STATUS_SUCCESS) { // TODO: what would we need to clean up here? switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Improper configuration!\n"); @@ -66,13 +59,13 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_kazoo_load) { bind_fetch_agents(); /* create an api for cli debug commands */ - add_cli_api(module_interface, api_interface); + add_cli_api(module_interface); /* add our modified commands */ - add_kz_commands(module_interface, api_interface); + add_kz_commands(module_interface); /* add our modified dptools */ - add_kz_dptools(module_interface, app_interface); + add_kz_dptools(module_interface); /* add our endpoints */ add_kz_endpoints(module_interface); diff --git a/src/mod/event_handlers/mod_kazoo/mod_kazoo.h b/src/mod/event_handlers/mod_kazoo/mod_kazoo.h index 1fc12ba2aa..c9f16f4826 100644 --- a/src/mod/event_handlers/mod_kazoo/mod_kazoo.h +++ b/src/mod/event_handlers/mod_kazoo/mod_kazoo.h @@ -17,8 +17,11 @@ extern const char kz_default_config[]; extern const int kz_default_config_size; +#include "kazoo_defs.h" +#include "kazoo_tweaks.h" #include "kazoo_ei.h" #include "kazoo_message.h" +#include "kazoo_utils.h" typedef enum { LFLAG_RUNNING = (1 << 0) @@ -26,16 +29,17 @@ typedef enum { /* kazoo_commands.c */ -void add_kz_commands(switch_loadable_module_interface_t **module_interface, switch_api_interface_t *api_interface); +void add_kz_commands(switch_loadable_module_interface_t **module_interface); /* kazoo_dptools.c */ -void add_kz_dptools(switch_loadable_module_interface_t **module_interface, switch_application_interface_t *app_interface); +void add_kz_dptools(switch_loadable_module_interface_t **module_interface); /* kazoo_api.c */ -void add_cli_api(switch_loadable_module_interface_t **module_interface, switch_api_interface_t *api_interface); +void add_cli_api(switch_loadable_module_interface_t **module_interface); void remove_cli_api(); /* kazoo_utils.c */ +/* SWITCH_DECLARE(switch_status_t) kz_switch_core_merge_variables(switch_event_t *event); SWITCH_DECLARE(switch_status_t) kz_switch_core_base_headers_for_expand(switch_event_t **event); void kz_check_set_profile_var(switch_channel_t *channel, char* var, char *val); @@ -49,6 +53,7 @@ SWITCH_DECLARE(char *) kz_event_expand_headers(switch_event_t *event, const char SWITCH_DECLARE(char *) kz_expand(const char *in); SWITCH_DECLARE(char *) kz_expand_pool(switch_memory_pool_t *pool, const char *in); switch_status_t kz_json_api(const char * command, cJSON *args, cJSON **res); +*/ /* kazoo_endpoints.c */ void add_kz_endpoints(switch_loadable_module_interface_t **module_interface); From f77484b96da315dc3a4cc7ba3fdff47640a3ecbd Mon Sep 17 00:00:00 2001 From: lazedo Date: Thu, 31 Oct 2019 12:20:33 +0000 Subject: [PATCH 040/118] [mod_sofia] add existing variables when locating user --- src/mod/endpoints/mod_sofia/sofia.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 38cf504f83..8b6a88cec2 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -10131,6 +10131,7 @@ switch_status_t sofia_locate_user(char* user, switch_core_session_t *session, si for (un = sip->sip_unknown; un; un = un->un_next) { switch_event_add_header_string(v_event, SWITCH_STACK_BOTTOM, un->un_name, un->un_value); }; + switch_channel_event_set_data(switch_core_session_get_channel(session), v_event); } result = switch_xml_locate_user_merged("id", username, domain, NULL, x_user, v_event); From b4373c6666fadff332805dafc2688838541cfd8b Mon Sep 17 00:00:00 2001 From: lazedo Date: Thu, 31 Oct 2019 12:27:21 +0000 Subject: [PATCH 041/118] [mod_sofia] add K- to prefixes that create a sip_h_ variable used by sip tracing tools and not to confuse with application (X-) or (P-) --- src/mod/endpoints/mod_sofia/sofia.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 38cf504f83..e35089641a 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -11327,7 +11327,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia switch_channel_set_variable(channel, "sip_geolocation_error", un->un_value); } else if (!strcasecmp(un->un_name, "userLocation")) { switch_channel_set_variable(channel, "sip_user_location", un->un_value); - } else if (!strncasecmp(un->un_name, "X-", 2) || !strncasecmp(un->un_name, "P-", 2) || !strcasecmp(un->un_name, "User-to-User") || !strncasecmp(un->un_name, "On", 2)) { + } else if (!strncasecmp(un->un_name, "X-", 2) || !strncasecmp(un->un_name, "P-", 2) || !strcasecmp(un->un_name, "User-to-User") || !strncasecmp(un->un_name, "On", 2) || !strncasecmp(un->un_name, "K-", 2)) { if (!zstr(un->un_value)) { char new_name[512] = ""; int reps = 0; From 506bcd280d746af49ccced5b6f84580e8066cc93 Mon Sep 17 00:00:00 2001 From: lazedo Date: Thu, 31 Oct 2019 12:41:47 +0000 Subject: [PATCH 042/118] [core] allow event-channel debugging & single delivery --- src/include/switch_types.h | 4 +++- src/switch_core.c | 14 ++++++++++++++ src/switch_event.c | 20 +++++++++++++++----- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index ff69cbd9e5..9302ad5c3d 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -387,7 +387,9 @@ typedef enum { SCF_DIALPLAN_TIMESTAMPS = (1 << 24), SCF_CPF_SOFT_PREFIX = (1 << 25), SCF_CPF_SOFT_LOOKUP = (1 << 26), - SCF_EVENT_CHANNEL_ENABLE_HIERARCHY_DELIVERY = (1 << 27) + SCF_EVENT_CHANNEL_ENABLE_HIERARCHY_DELIVERY = (1 << 27), + SCF_EVENT_CHANNEL_HIERARCHY_DELIVERY_ONCE = (1 << 28), + SCF_EVENT_CHANNEL_LOG_UNDELIVERABLE_JSON = (1 << 29) } switch_core_flag_enum_t; typedef uint32_t switch_core_flag_t; diff --git a/src/switch_core.c b/src/switch_core.c index 359265c02f..baed1783e6 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -2369,6 +2369,20 @@ static void switch_load_core_config(const char *file) } else { switch_clear_flag((&runtime), SCF_EVENT_CHANNEL_ENABLE_HIERARCHY_DELIVERY); } + } else if (!strcasecmp(var, "event-channel-hierarchy-deliver-once") && !zstr(val)) { + int v = switch_true(val); + if (v) { + switch_set_flag((&runtime), SCF_EVENT_CHANNEL_HIERARCHY_DELIVERY_ONCE); + } else { + switch_clear_flag((&runtime), SCF_EVENT_CHANNEL_HIERARCHY_DELIVERY_ONCE); + } + } else if (!strcasecmp(var, "event-channel-log-undeliverable-json") && !zstr(val)) { + int v = switch_true(val); + if (v) { + switch_set_flag((&runtime), SCF_EVENT_CHANNEL_LOG_UNDELIVERABLE_JSON); + } else { + switch_clear_flag((&runtime), SCF_EVENT_CHANNEL_LOG_UNDELIVERABLE_JSON); + } } } } diff --git a/src/switch_event.c b/src/switch_event.c index 7392e41618..6b1a3bfc42 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -2934,17 +2934,21 @@ static void ecd_deliver(event_channel_data_t **ecdP) const char *sep = switch_core_get_event_channel_key_separator(); char *x_argv[SWITCH_CHANNEL_DISPATCH_MAX_KEY_PARTS] = { 0 }; int x_argc = switch_separate_string_string(key, (char*) sep, x_argv, SWITCH_CHANNEL_DISPATCH_MAX_KEY_PARTS); - char buf[512]; - int i; + char buf[1024]; + int i, r; for(i=x_argc - 1; i > 0; i--) { int z; - memset(buf, 0, 512); + memset(buf, 0, 1024); sprintf(buf, "%s", x_argv[0]); for(z=1; z < i; z++) { strcat(buf, sep); strcat(buf, x_argv[z]); } - t += _switch_event_channel_broadcast(buf, ecd->event_channel, ecd->json, ecd->key, ecd->id); + r = _switch_event_channel_broadcast(buf, ecd->event_channel, ecd->json, ecd->key, ecd->id); + t += r; + if (r && switch_core_test_flag(SCF_EVENT_CHANNEL_HIERARCHY_DELIVERY_ONCE)) { + break; + } } } else { char *p = NULL; @@ -2958,7 +2962,13 @@ static void ecd_deliver(event_channel_data_t **ecdP) t += _switch_event_channel_broadcast(SWITCH_EVENT_CHANNEL_GLOBAL, ecd->event_channel, ecd->json, ecd->key, ecd->id); if(t == 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "no subscribers for %s , %s\n", ecd->event_channel, ecd->key); + if (switch_core_test_flag(SCF_EVENT_CHANNEL_LOG_UNDELIVERABLE_JSON)) { + char *json = cJSON_Print(ecd->json); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "no subscribers for %s , %s => %s\n", ecd->event_channel, ecd->key, json); + switch_safe_free(json); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "no subscribers for %s , %s\n", ecd->event_channel, ecd->key); + } } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "delivered to %u subscribers for %s\n", t, ecd->event_channel); } From 998e322f465ee7a35e70e6a4ad0ad02c0d552a86 Mon Sep 17 00:00:00 2001 From: lazedo Date: Thu, 7 Nov 2019 22:42:28 +0000 Subject: [PATCH 043/118] [mod_kazoo] add kz-endpoint-runtime-context --- .../mod_kazoo/kazoo_endpoints.c | 456 +++++++++++------- 1 file changed, 281 insertions(+), 175 deletions(-) diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_endpoints.c b/src/mod/event_handlers/mod_kazoo/kazoo_endpoints.c index 111edfdb90..cf253760ed 100644 --- a/src/mod/event_handlers/mod_kazoo/kazoo_endpoints.c +++ b/src/mod/event_handlers/mod_kazoo/kazoo_endpoints.c @@ -73,9 +73,9 @@ static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *s switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause) { - switch_xml_t x_user = NULL, x_param, x_params; + switch_xml_t x_user = NULL, x_param, x_params, x_callfwd; char *user = NULL, *domain = NULL, *dup_domain = NULL, *dialed_user = NULL; - const char *dest = NULL; + char *dest = NULL; switch_call_cause_t cause = SWITCH_CAUSE_NONE; unsigned int timelimit = SWITCH_DEFAULT_TIMEOUT; switch_channel_t *new_channel = NULL; @@ -83,6 +83,21 @@ static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *s char stupid[128] = ""; const char *skip = NULL, *var = NULL; switch_core_session_t *a_session = NULL, *e_session = NULL; + cJSON * ctx = NULL; + const char *endpoint_dial = NULL; + const char *callforward_dial = NULL; + const char *failover_dial = NULL; + char *b_failover_dial = NULL; + const char *endpoint_separator = NULL; + const char *varval = NULL; + char *d_dest = NULL; + switch_channel_t *channel = NULL; + switch_originate_flag_t myflags = SOF_NONE; + char *cid_name_override = NULL; + char *cid_num_override = NULL; + switch_event_t *event = NULL; + switch_status_t status = SWITCH_STATUS_SUCCESS; + if (zstr(outbound_profile->destination_number)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "NO DESTINATION NUMBER\n"); @@ -131,6 +146,16 @@ static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *s goto done; } + if (var_event) { + const char * str_ctx = switch_event_get_header(var_event, "kz-endpoint-runtime-context"); + if ( str_ctx ) { + ctx = cJSON_Parse(str_ctx); + if (ctx) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "call context parsed => %s\n", str_ctx); + } + } + } + if ((x_params = switch_xml_child(x_user, "variables"))) { for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) { const char *pvar = switch_xml_attr_soft(x_param, "name"); @@ -150,8 +175,12 @@ static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *s const char *pvar = switch_xml_attr_soft(x_param, "name"); const char *val = switch_xml_attr(x_param, "value"); - if (!strcasecmp(pvar, "dial-string")) { - dest = val; + if (!strcasecmp(pvar, "endpoint-dial-string")) { + endpoint_dial = val; + } else if (!strcasecmp(pvar, "callforward-dial-string")) { + callforward_dial = val; + } else if (!strcasecmp(pvar, "endpoint-separator")) { + endpoint_separator = val; } else if (!strncasecmp(pvar, "dial-var-", 9)) { if (!var_event) { switch_event_create(&var_event, SWITCH_EVENT_GENERAL); @@ -164,6 +193,61 @@ static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *s } } + x_callfwd = switch_xml_child(x_user, "call-forward"); + if (x_callfwd) { + switch_bool_t call_fwd_is_substitute = SWITCH_FALSE, + call_fwd_is_failover = SWITCH_FALSE, + call_fwd_direct_calls_only = SWITCH_FALSE, + call_fwd_is_valid = SWITCH_TRUE; + for (x_param = switch_xml_child(x_callfwd, "variable"); x_param; x_param = x_param->next) { + const char *var = switch_xml_attr_soft(x_param, "name"); + const char *val = switch_xml_attr(x_param, "value"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "cfw %s => %s\n", var, val); + if (!strcasecmp(var, "Is-Substitute")) { + call_fwd_is_substitute = switch_true(val); + } else if (!strcasecmp(var, "Is-Failover")) { + call_fwd_is_failover = switch_true(val); + } else if (!strcasecmp(var, "Direct-Calls-Only")) { + call_fwd_direct_calls_only = switch_true(val); + } + } + + if (call_fwd_direct_calls_only) { + call_fwd_is_valid = SWITCH_FALSE; + if (ctx ) { + cJSON *json_flags = cJSON_GetObjectItem(ctx, "Flags"); + if (json_flags && json_flags->type == cJSON_Array) { + cJSON *item; + cJSON_ArrayForEach(item, json_flags) { + if (!strcmp(item->valuestring, "direct_call")) { + call_fwd_is_valid = SWITCH_TRUE; + break; + } + } + if (!call_fwd_is_valid) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "call fwd requires direct_call and it was not found\n"); + } + } + } + } + + if (!call_fwd_is_valid) { + dest = strdup(endpoint_dial); + } else if (call_fwd_is_failover) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "setting failover => %s\n", callforward_dial); + dest = strdup(endpoint_dial); + failover_dial = callforward_dial; + } else if (call_fwd_is_substitute) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "setting call fwd substitute => %s\n", callforward_dial); + dest = strdup(callforward_dial); + } else { + dest = switch_mprintf("%s%s%s", endpoint_dial ? endpoint_dial : "", (endpoint_dial ? endpoint_separator ? endpoint_separator : "," : ""), callforward_dial); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "setting call fwd append => %s => %s\n", callforward_dial, dest); + } + } else { + dest = strdup(endpoint_dial); + } + dialed_user = (char *)switch_xml_attr(x_user, "id"); if (var_event) { @@ -174,184 +258,206 @@ static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *s if (!dest) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No dial-string available, please check your user directory.\n"); cause = SWITCH_CAUSE_MANDATORY_IE_MISSING; - } else { - const char *varval; - char *d_dest = NULL; - switch_channel_t *channel; - switch_originate_flag_t myflags = SOF_NONE; - char *cid_name_override = NULL; - char *cid_num_override = NULL; - switch_event_t *event = NULL; + goto done; + } - if (var_event) { - cid_name_override = switch_event_get_header(var_event, "origination_caller_id_name"); - cid_num_override = switch_event_get_header(var_event, "origination_caller_id_number"); - } + if (var_event) { + cid_name_override = switch_event_get_header(var_event, "origination_caller_id_name"); + cid_num_override = switch_event_get_header(var_event, "origination_caller_id_number"); + } - if(session) { - a_session = session; - } else if(var_event) { - const char* uuid_e_session = switch_event_get_header(var_event, "ent_originate_aleg_uuid"); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHECKING ORIGINATE-UUID : %s\n", uuid_e_session); - if (uuid_e_session && (e_session = switch_core_session_force_locate(uuid_e_session)) != NULL) { - a_session = e_session; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FOUND ORIGINATE-UUID : %s\n", uuid_e_session); - } - } - - if (a_session) { - switch_event_create(&event, SWITCH_EVENT_GENERAL); - channel = switch_core_session_get_channel(a_session); - if ((varval = switch_channel_get_variable(channel, SWITCH_CALL_TIMEOUT_VARIABLE)) - || (var_event && (varval = switch_event_get_header(var_event, "leg_timeout")))) { - timelimit = atoi(varval); - } - switch_channel_event_set_data(channel, event); - if(var_event) { - switch_event_merge(event, var_event); - } - - switch_channel_set_variable(channel, "dialed_user", dialed_user); - switch_channel_set_variable(channel, "dialed_domain", domain); - - } else { - if (var_event) { - switch_event_dup(&event, var_event); - switch_event_del_header(event, "dialed_user"); - switch_event_del_header(event, "dialed_domain"); - if ((varval = switch_event_get_header(var_event, SWITCH_CALL_TIMEOUT_VARIABLE)) || - (varval = switch_event_get_header(var_event, "leg_timeout"))) { - timelimit = atoi(varval); - } - } else { - switch_event_create(&event, SWITCH_EVENT_REQUEST_PARAMS); - switch_assert(event); - } - - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "dialed_user", dialed_user); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "dialed_domain", domain); - } - - if ((x_params = switch_xml_child(x_user, "profile-variables"))) { - for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) { - const char *pvar = switch_xml_attr_soft(x_param, "name"); - const char *val = switch_xml_attr(x_param, "value"); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "adding profile variable to event => %s = %s\n", pvar, val); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, pvar, val); - } - } - - if ((x_params = switch_xml_child(x_user, "variables"))) { - for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) { - const char *pvar = switch_xml_attr_soft(x_param, "name"); - const char *val = switch_xml_attr(x_param, "value"); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "adding variable to event => %s = %s\n", pvar, val); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, pvar, val); - } - } - - if ((x_params = switch_xml_child(x_user, "params"))) { - for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) { - const char *pvar = switch_xml_attr_soft(x_param, "name"); - const char *val = switch_xml_attr(x_param, "value"); - - if (!strncasecmp(pvar, "dial-var-", 9)) { - switch_event_del_header(event, pvar + 9); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "adding dialog var to event => %s = %s\n", pvar + 9, val); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, pvar + 9, val); - } - } - } - - d_dest = kz_event_expand_headers(event, dest); - - if (var_event) { - kz_expand_headers(event, var_event); - } - - switch_event_destroy(&event); - - - if ((flags & SOF_NO_LIMITS)) { - myflags |= SOF_NO_LIMITS; - } - - if ((flags & SOF_FORKED_DIAL)) { - myflags |= SOF_NOBLOCK; - } - - if ( a_session ) { - if(var_event) { - kz_tweaks_variables_to_event(a_session, var_event); - } - } - - if(e_session) { - switch_core_session_rwunlock(e_session); - } - - switch_snprintf(stupid, sizeof(stupid), "kz/%s", dialed_user); - if (switch_stristr(stupid, d_dest)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Waddya Daft? You almost called '%s' in an infinate loop!\n", stupid); - cause = SWITCH_CAUSE_INVALID_IE_CONTENTS; - } else if (switch_ivr_originate(session, new_session, &cause, d_dest, timelimit, NULL, - cid_name_override, cid_num_override, outbound_profile, var_event, myflags, - cancel_cause, NULL) == SWITCH_STATUS_SUCCESS) { - const char *context; - switch_caller_profile_t *cp; - - if (var_event) { - switch_event_del_header(var_event, "origination_uuid"); - } - - new_channel = switch_core_session_get_channel(*new_session); - - if ((context = switch_channel_get_variable(new_channel, "user_context"))) { - if ((cp = switch_channel_get_caller_profile(new_channel))) { - cp->context = switch_core_strdup(cp->pool, context); - } - } - - /* - if ((x_params = switch_xml_child(x_user, "variables"))) { - for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) { - const char *pvar = switch_xml_attr(x_param, "name"); - const char *val = switch_xml_attr(x_param, "value"); - switch_channel_set_variable(new_channel, pvar, val); - } - } - */ - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_DEBUG1, "CHECKING CALLER-ID\n"); - if ((x_params = switch_xml_child(x_user, "profile-variables"))) { - switch_caller_profile_t *cp = NULL; - const char* val = NULL; - for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) { - const char *pvar = switch_xml_attr(x_param, "name"); - const char *val = switch_xml_attr(x_param, "value"); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_DEBUG1, "setting profile var %s = %s\n", pvar, val); - switch_channel_set_profile_var(new_channel, pvar, val); - } - cp = switch_channel_get_caller_profile(new_channel); - if((val=switch_caller_get_field_by_name(cp, "Endpoint-Caller-ID-Name"))) { - cp->callee_id_name = val; - cp->orig_caller_id_name = val; - } - if((val=switch_caller_get_field_by_name(cp, "Endpoint-Caller-ID-Number"))) { - cp->callee_id_number = val; - cp->orig_caller_id_number = val; - } - } - switch_core_session_rwunlock(*new_session); - } - - if (d_dest != dest) { - switch_safe_free(d_dest); + if(session) { + a_session = session; + } else if(var_event) { + const char* uuid_e_session = switch_event_get_header(var_event, "ent_originate_aleg_uuid"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHECKING ORIGINATE-UUID : %s\n", uuid_e_session); + if (uuid_e_session && (e_session = switch_core_session_force_locate(uuid_e_session)) != NULL) { + a_session = e_session; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FOUND ORIGINATE-UUID : %s\n", uuid_e_session); } } + if (a_session) { + switch_event_create(&event, SWITCH_EVENT_GENERAL); + channel = switch_core_session_get_channel(a_session); + if ((varval = switch_channel_get_variable(channel, SWITCH_CALL_TIMEOUT_VARIABLE)) + || (var_event && (varval = switch_event_get_header(var_event, "leg_timeout")))) { + timelimit = atoi(varval); + } + switch_channel_event_set_data(channel, event); + + switch_channel_set_variable(channel, "dialed_user", dialed_user); + switch_channel_set_variable(channel, "dialed_domain", domain); + + } else { + if (var_event) { + switch_event_dup(&event, var_event); + switch_event_del_header(event, "dialed_user"); + switch_event_del_header(event, "dialed_domain"); + if ((varval = switch_event_get_header(var_event, SWITCH_CALL_TIMEOUT_VARIABLE)) || + (varval = switch_event_get_header(var_event, "leg_timeout"))) { + timelimit = atoi(varval); + } + } else { + switch_event_create(&event, SWITCH_EVENT_REQUEST_PARAMS); + switch_assert(event); + } + + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "dialed_user", dialed_user); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "dialed_domain", domain); + } + + if ((x_params = switch_xml_child(x_user, "profile-variables"))) { + for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) { + const char *pvar = switch_xml_attr_soft(x_param, "name"); + const char *val = switch_xml_attr(x_param, "value"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "adding profile variable to event => %s = %s\n", pvar, val); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, pvar, val); + } + } + + if ((x_params = switch_xml_child(x_user, "variables"))) { + for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) { + const char *pvar = switch_xml_attr_soft(x_param, "name"); + const char *val = switch_xml_attr(x_param, "value"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "adding variable to event => %s = %s\n", pvar, val); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, pvar, val); + } + } + + if ((x_params = switch_xml_child(x_user, "params"))) { + for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) { + const char *pvar = switch_xml_attr_soft(x_param, "name"); + const char *val = switch_xml_attr(x_param, "value"); + + if (!strncasecmp(pvar, "dial-var-", 9)) { + switch_event_del_header(event, pvar + 9); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "adding dialog var to event => %s = %s\n", pvar + 9, val); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, pvar + 9, val); + } + } + } + + // add runtime vars to event for expand + if (ctx) { + cJSON *item = NULL; + char *response = NULL; + cJSON_ArrayForEach(item, ctx) { + if (item->type == cJSON_String) { + response = strdup(item->valuestring); + } else { + response = cJSON_PrintUnformatted(item); + } + kz_switch_event_add_variable_name_printf(event, SWITCH_STACK_BOTTOM, response, "kz_ctx_%s", item->string); + switch_safe_free(response); + } + } + + d_dest = kz_event_expand_headers(event, dest); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "dialing %s => %s\n", dest, d_dest); + + if(failover_dial) { + b_failover_dial = kz_event_expand_headers(event, failover_dial); + } + + if (var_event) { + kz_expand_headers(event, var_event); + } + + switch_event_destroy(&event); + + + if ((flags & SOF_NO_LIMITS)) { + myflags |= SOF_NO_LIMITS; + } + + if ((flags & SOF_FORKED_DIAL)) { + myflags |= SOF_NOBLOCK; + } + + if ( a_session ) { + if(var_event) { + kz_tweaks_variables_to_event(a_session, var_event); + } + } + + if(e_session) { + switch_core_session_rwunlock(e_session); + } + + switch_snprintf(stupid, sizeof(stupid), "kz/%s", dialed_user); + if (switch_stristr(stupid, d_dest)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Waddya Daft? You almost called '%s' in an infinate loop!\n", stupid); + cause = SWITCH_CAUSE_INVALID_IE_CONTENTS; + goto done; + } + + status = switch_ivr_originate(session, new_session, &cause, d_dest, timelimit, NULL, + cid_name_override, cid_num_override, outbound_profile, var_event, myflags, + cancel_cause, NULL); + + if (status != SWITCH_STATUS_SUCCESS && b_failover_dial) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "trying failover => %s\n", failover_dial); + status = switch_ivr_originate(session, new_session, &cause, b_failover_dial, timelimit, NULL, + cid_name_override, cid_num_override, outbound_profile, var_event, myflags, + cancel_cause, NULL); + } + + if (status == SWITCH_STATUS_SUCCESS) { + const char *context; + switch_caller_profile_t *cp; + + if (var_event) { + switch_event_del_header(var_event, "origination_uuid"); + } + + new_channel = switch_core_session_get_channel(*new_session); + + if ((context = switch_channel_get_variable(new_channel, "user_context"))) { + if ((cp = switch_channel_get_caller_profile(new_channel))) { + cp->context = switch_core_strdup(cp->pool, context); + } + } + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_DEBUG1, "CHECKING CALLER-ID\n"); + if ((x_params = switch_xml_child(x_user, "profile-variables"))) { + switch_caller_profile_t *cp = NULL; + const char* val = NULL; + for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) { + const char *pvar = switch_xml_attr(x_param, "name"); + const char *val = switch_xml_attr(x_param, "value"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_DEBUG1, "setting profile var %s = %s\n", pvar, val); + switch_channel_set_profile_var(new_channel, pvar, val); + } + cp = switch_channel_get_caller_profile(new_channel); + if((val=switch_caller_get_field_by_name(cp, "Endpoint-Caller-ID-Name"))) { + cp->callee_id_name = val; + cp->orig_caller_id_name = val; + } + if((val=switch_caller_get_field_by_name(cp, "Endpoint-Caller-ID-Number"))) { + cp->callee_id_number = val; + cp->orig_caller_id_number = val; + } + } + switch_core_session_rwunlock(*new_session); + } + done: + if (d_dest && d_dest != dest) { + switch_safe_free(d_dest); + } + + if(b_failover_dial && b_failover_dial != failover_dial) { + switch_safe_free(b_failover_dial); + } + + switch_safe_free(dest); + + if (ctx) { + cJSON_Delete(ctx); + } + if (x_user) { switch_xml_free(x_user); } From 647ed310e54ce8bcab683ea6d37fbd1a9a22577b Mon Sep 17 00:00:00 2001 From: Areski Belaid Date: Mon, 11 Nov 2019 17:23:20 +0100 Subject: [PATCH 044/118] [mod_callcenter] Unreserve callcenter events when config errors loading --- .../mod_callcenter/mod_callcenter.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index f8b75fa459..f9e32fe845 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -4208,12 +4208,19 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_callcenter_load) switch_json_api_interface_t *json_api_interface; switch_status_t status; - + /* create/register custom event message type */ if (switch_event_reserve_subclass(CALLCENTER_EVENT) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", CALLCENTER_EVENT); return SWITCH_STATUS_TERM; } + /* Subscribe to presence request events */ + if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, + cc_presence_event_handler, NULL, &globals.node) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to subscribe for presence events!\n"); + return SWITCH_STATUS_GENERR; + } + memset(&globals, 0, sizeof(globals)); globals.pool = pool; @@ -4221,15 +4228,12 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_callcenter_load) switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool); if ((status = load_config()) != SWITCH_STATUS_SUCCESS) { + switch_event_unbind(&globals.node); + switch_event_free_subclass(CALLCENTER_EVENT); + switch_core_hash_destroy(&globals.queue_hash); return status; } - if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, - cc_presence_event_handler, NULL, &globals.node) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to subscribe for presence events!\n"); - return SWITCH_STATUS_GENERR; - } - switch_mutex_lock(globals.mutex); globals.running = 1; switch_mutex_unlock(globals.mutex); From 3c6d47c29340d6abe1eb2e635ad44e4fdfa53da0 Mon Sep 17 00:00:00 2001 From: lazedo Date: Mon, 11 Nov 2019 18:09:26 +0000 Subject: [PATCH 045/118] [mod_kazoo] recurse context runtime vars --- .../mod_kazoo/kazoo_endpoints.c | 12 +-------- .../event_handlers/mod_kazoo/kazoo_utils.c | 26 +++++++++++++++++++ .../event_handlers/mod_kazoo/kazoo_utils.h | 2 ++ 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_endpoints.c b/src/mod/event_handlers/mod_kazoo/kazoo_endpoints.c index cf253760ed..bec5b5e1ea 100644 --- a/src/mod/event_handlers/mod_kazoo/kazoo_endpoints.c +++ b/src/mod/event_handlers/mod_kazoo/kazoo_endpoints.c @@ -340,17 +340,7 @@ static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *s // add runtime vars to event for expand if (ctx) { - cJSON *item = NULL; - char *response = NULL; - cJSON_ArrayForEach(item, ctx) { - if (item->type == cJSON_String) { - response = strdup(item->valuestring); - } else { - response = cJSON_PrintUnformatted(item); - } - kz_switch_event_add_variable_name_printf(event, SWITCH_STACK_BOTTOM, response, "kz_ctx_%s", item->string); - switch_safe_free(response); - } + kz_expand_json_to_event(ctx, event, "kz_ctx"); } d_dest = kz_event_expand_headers(event, dest); diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_utils.c b/src/mod/event_handlers/mod_kazoo/kazoo_utils.c index afc685434f..34b33c8ae1 100644 --- a/src/mod/event_handlers/mod_kazoo/kazoo_utils.c +++ b/src/mod/event_handlers/mod_kazoo/kazoo_utils.c @@ -516,6 +516,32 @@ SWITCH_DECLARE(switch_status_t) kz_switch_event_add_variable_name_printf(switch_ return status; } +SWITCH_DECLARE(switch_status_t) kz_expand_json_to_event(cJSON *json, switch_event_t *event, char * prefix) +{ + char * fmt = switch_mprintf("%s%s%%s", prefix ? prefix : "", prefix ? "_" : ""); + if (event) { + cJSON *item = NULL; + char *response = NULL; + cJSON_ArrayForEach(item, json) { + if (item->type == cJSON_String) { + response = strdup(item->valuestring); + } else if (item->type == cJSON_Object) { + char * fmt1 = switch_mprintf(fmt, item->string); + kz_expand_json_to_event(item, event, fmt1); + switch_safe_free(fmt1); + continue; + } else { + response = cJSON_PrintUnformatted(item); + } + kz_switch_event_add_variable_name_printf(event, SWITCH_STACK_BOTTOM, response, fmt, item->string); + switch_safe_free(response); + } + } + + switch_safe_free(fmt); + return SWITCH_STATUS_SUCCESS; +} + SWITCH_DECLARE(switch_xml_t) kz_xml_child(switch_xml_t xml, const char *name) { xml = (xml) ? xml->child : NULL; diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_utils.h b/src/mod/event_handlers/mod_kazoo/kazoo_utils.h index 397d94a361..c5ddc3e037 100644 --- a/src/mod/event_handlers/mod_kazoo/kazoo_utils.h +++ b/src/mod/event_handlers/mod_kazoo/kazoo_utils.h @@ -48,4 +48,6 @@ void kz_expand_headers_self(switch_event_t *event); char * kz_expand_vars_pool(char *xml_str, switch_memory_pool_t *pool); switch_status_t kz_json_api(const char * command, cJSON *args, cJSON **res); +SWITCH_DECLARE(switch_status_t) kz_expand_json_to_event(cJSON *json, switch_event_t *event, char * prefix); + KZ_END_EXTERN_C From 7f6348313826bb989cc0ad1d18d63451869f4f6b Mon Sep 17 00:00:00 2001 From: Vallimamod Abdullah Date: Mon, 11 Nov 2019 19:58:18 +0100 Subject: [PATCH 046/118] [mod_event_socket] Add null pointer checks on listener session and socket --- .../mod_event_socket/mod_event_socket.c | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index 23915d4a37..192b81c1f4 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -2635,11 +2635,22 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) switch_assert(listener != NULL); - if ((session = listener->session)) { - if (switch_core_session_read_lock(session) != SWITCH_STATUS_SUCCESS) { - locked = 0; - goto done; - } + if (!(session = listener->session)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Listener session is null!\n"); + switch_clear_flag_locked(listener, LFLAG_RUNNING); + goto done; + } + + if (switch_core_session_read_lock(session) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Unable to lock session!\n"); + locked = 0; + goto done; + } + + if (!listener->sock) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Listener socket is null!\n"); + switch_clear_flag_locked(listener, LFLAG_RUNNING); + goto done; } switch_socket_opt_set(listener->sock, SWITCH_SO_TCP_NODELAY, TRUE); From 60746cc07c72795a59b38a0be16b85e83a0ba9df Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Mon, 11 Nov 2019 19:02:21 +0000 Subject: [PATCH 047/118] [mod_tts_commandline, mod_sndfile] fix crash on file not found --- .../asr_tts/mod_tts_commandline/mod_tts_commandline.c | 10 +++++++--- src/mod/formats/mod_sndfile/mod_sndfile.c | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c b/src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c index 1d9906d0a9..a19af3a18d 100644 --- a/src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c +++ b/src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c @@ -186,13 +186,17 @@ static switch_status_t tts_commandline_speech_read_tts(switch_speech_handle_t *s assert(info != NULL); if (switch_core_file_read(info->fh, data, &my_datalen) != SWITCH_STATUS_SUCCESS) { - switch_core_file_close(info->fh); + if (switch_test_flag(info->fh, SWITCH_FILE_OPEN)) { + switch_core_file_close(info->fh); + } unlink(info->file); return SWITCH_STATUS_FALSE; } *datalen = my_datalen * 2; if (datalen == 0) { - switch_core_file_close(info->fh); + if (switch_test_flag(info->fh, SWITCH_FILE_OPEN)) { + switch_core_file_close(info->fh); + } unlink(info->file); return SWITCH_STATUS_BREAK; } else { @@ -205,7 +209,7 @@ static void tts_commandline_speech_flush_tts(switch_speech_handle_t *sh) tts_commandline_t *info = (tts_commandline_t *) sh->private_info; assert(info != NULL); - if (info->fh != NULL && info->fh->file_interface != NULL) { + if (info->fh != NULL && info->fh->file_interface != NULL && switch_test_flag(info->fh, SWITCH_FILE_OPEN)) { switch_core_file_close(info->fh); } if (switch_file_exists(info->file, NULL) == SWITCH_STATUS_SUCCESS) { diff --git a/src/mod/formats/mod_sndfile/mod_sndfile.c b/src/mod/formats/mod_sndfile/mod_sndfile.c index b9884c2138..a03e28af5c 100644 --- a/src/mod/formats/mod_sndfile/mod_sndfile.c +++ b/src/mod/formats/mod_sndfile/mod_sndfile.c @@ -267,7 +267,9 @@ static switch_status_t sndfile_file_close(switch_file_handle_t *handle) { sndfile_context *context = handle->private_info; - sf_close(context->handle); + if (context) { + sf_close(context->handle); + } return SWITCH_STATUS_SUCCESS; } From a2b46bcf109d92e97b925aebeeea4d13a99e6267 Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Mon, 11 Nov 2019 23:18:23 +0000 Subject: [PATCH 048/118] [core] Do not try to close a file handle if it's not SWITCH_FILE_OPEN, return SWITCH_STATUS_FALSE instead --- src/switch_core_file.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/switch_core_file.c b/src/switch_core_file.c index a009f5b19b..c49b151b01 100644 --- a/src/switch_core_file.c +++ b/src/switch_core_file.c @@ -929,6 +929,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_close(switch_file_handle_t *fh) if (switch_test_flag(fh, SWITCH_FILE_OPEN)) { status = switch_core_file_pre_close(fh); + } else { + return SWITCH_STATUS_FALSE; } fh->file_interface->file_close(fh); From b0f09fcff2736442887f9d3c455f240bfd6a6e40 Mon Sep 17 00:00:00 2001 From: Piotr Gregor Date: Tue, 12 Nov 2019 17:29:29 +0000 Subject: [PATCH 049/118] [mod_avmd] Unlock and close session if adding a media bug fails --- src/mod/applications/mod_avmd/mod_avmd.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_avmd/mod_avmd.c b/src/mod/applications/mod_avmd/mod_avmd.c index 8069c9bb5e..4b95e1a5c1 100644 --- a/src/mod/applications/mod_avmd/mod_avmd.c +++ b/src/mod/applications/mod_avmd/mod_avmd.c @@ -1403,6 +1403,7 @@ SWITCH_STANDARD_APP(avmd_start_app) { avmd_session_t *avmd_session = NULL; switch_core_media_flag_t flags = 0; const char *direction = "NO DIRECTION"; + uint8_t report = 0; if (session == NULL) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "BUGGG. FreeSWITCH session is NULL! Please report to developers\n"); @@ -1446,6 +1447,8 @@ SWITCH_STANDARD_APP(avmd_start_app) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to set dynamic parameteres for avmd session. Unknown error\n"); goto end; } + + report = avmd_session->settings.report_status; status = init_avmd_session_data(avmd_session, session, avmd_globals.mutex); if (status != SWITCH_STATUS_SUCCESS) { @@ -1508,7 +1511,10 @@ SWITCH_STANDARD_APP(avmd_start_app) { status = switch_core_media_bug_add(session, "avmd", NULL, avmd_callback, avmd_session, 0, flags, &bug); /* Add a media bug that allows me to intercept the audio stream */ if (status != SWITCH_STATUS_SUCCESS) { /* If adding a media bug fails exit */ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to add media bug!\n"); - goto end_unlock; + + switch_mutex_unlock(avmd_session->mutex); + avmd_session_close(avmd_session); + goto end; } switch_mutex_lock(avmd_globals.mutex); @@ -1526,7 +1532,7 @@ end_unlock: end: if (status != SWITCH_STATUS_SUCCESS) { - if (avmd_session == NULL || avmd_session->settings.report_status == 1) { + if (avmd_session == NULL || report) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Avmd on channel [%s] NOT started\n", switch_channel_get_name(channel)); } } From f8dc87bd18e6a75bd6665e2a330e26679891655e Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 13 Nov 2019 17:56:57 +0400 Subject: [PATCH 050/118] [mod_event_socket] Fix "Listener session is null" problem - regression from previous commit to the mod. --- .../mod_event_socket/mod_event_socket.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index 192b81c1f4..c8d8a23501 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -2635,16 +2635,12 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) switch_assert(listener != NULL); - if (!(session = listener->session)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Listener session is null!\n"); - switch_clear_flag_locked(listener, LFLAG_RUNNING); - goto done; - } - - if (switch_core_session_read_lock(session) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Unable to lock session!\n"); - locked = 0; - goto done; + if ((session = listener->session)) { + if (switch_core_session_read_lock(session) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Unable to lock session!\n"); + locked = 0; + goto done; + } } if (!listener->sock) { From 254fda292a5236e6b73f57e5bab922d040301d28 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Sun, 13 Oct 2019 19:06:30 +0800 Subject: [PATCH 051/118] [core] fix shutdown crash when core running with MINIMAL flag --- src/switch_core_media.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 81a3e8591e..e55ae8aad7 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -14069,7 +14069,9 @@ SWITCH_DECLARE(void) switch_core_media_init(void) SWITCH_DECLARE(void) switch_core_media_deinit(void) { - switch_core_destroy_memory_pool(&video_globals.pool); + if (video_globals.pool) { + switch_core_destroy_memory_pool(&video_globals.pool); + } } static int payload_number(const char *name) From 724868fa0887450f8b39039e59827dae74e4ad3a Mon Sep 17 00:00:00 2001 From: Seven Du Date: Sun, 13 Oct 2019 19:19:35 +0800 Subject: [PATCH 052/118] [core] fix test case --- tests/unit/.gitignore | 4 +++ tests/unit/conf_playsay/freeswitch.xml | 47 ++++++++++++++++++++++++++ tests/unit/switch_ivr_play_say.c | 4 +++ 3 files changed, 55 insertions(+) create mode 100644 tests/unit/conf_playsay/freeswitch.xml diff --git a/tests/unit/.gitignore b/tests/unit/.gitignore index 653a998769..f6d7de8008 100644 --- a/tests/unit/.gitignore +++ b/tests/unit/.gitignore @@ -10,3 +10,7 @@ perf.data perf.data.old Makefile.in + +freeswitch.xml.fsxml.tmp +test-argb.png +test-rgb.png diff --git a/tests/unit/conf_playsay/freeswitch.xml b/tests/unit/conf_playsay/freeswitch.xml new file mode 100644 index 0000000000..3e870470ea --- /dev/null +++ b/tests/unit/conf_playsay/freeswitch.xml @@ -0,0 +1,47 @@ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+
diff --git a/tests/unit/switch_ivr_play_say.c b/tests/unit/switch_ivr_play_say.c index 90bcd9d1fb..c08cdd5752 100644 --- a/tests/unit/switch_ivr_play_say.c +++ b/tests/unit/switch_ivr_play_say.c @@ -39,6 +39,10 @@ FST_CORE_BEGIN("./conf_playsay") { FST_SETUP_BEGIN() { + fst_requires_module("mod_tone_stream"); + fst_requires_module("mod_sndfile"); + fst_requires_module("mod_dptools"); + fst_requires_module("mod_test"); } FST_SETUP_END() From a4f0b2f2a0607653bc6a192cfbecf7aa22de9f08 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 14 Nov 2019 22:14:47 +0400 Subject: [PATCH 053/118] [mod_test] Fix OSX build --- src/mod/applications/mod_test/Makefile.am | 10 +++++++--- src/mod/applications/mod_test/test/Makefile.am | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_test/Makefile.am b/src/mod/applications/mod_test/Makefile.am index 35cf0ed45e..960df11231 100644 --- a/src/mod/applications/mod_test/Makefile.am +++ b/src/mod/applications/mod_test/Makefile.am @@ -1,10 +1,14 @@ include $(top_srcdir)/build/modmake.rulesam MODNAME=mod_test +noinst_LTLIBRARIES = libtestmod.la +libtestmod_la_SOURCES = mod_test.c + mod_LTLIBRARIES = mod_test.la -mod_test_la_SOURCES = mod_test.c mod_test_la_CFLAGS = $(AM_CFLAGS) -mod_test_la_LIBADD = $(switch_builddir)/libfreeswitch.la -mod_test_la_LDFLAGS = -avoid-version -module -no-undefined -shared +mod_test_la_SOURCES = +mod_test_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(SOFIALA) libtestmod.la +mod_test_la_LDFLAGS = -avoid-version -module -no-undefined -shared SUBDIRS=. test + diff --git a/src/mod/applications/mod_test/test/Makefile.am b/src/mod/applications/mod_test/test/Makefile.am index 54825db400..3b721482fb 100644 --- a/src/mod/applications/mod_test/test/Makefile.am +++ b/src/mod/applications/mod_test/test/Makefile.am @@ -1,5 +1,6 @@ include $(top_srcdir)/build/modmake.rulesam noinst_PROGRAMS = test_asr test_asr_CFLAGS = $(AM_CFLAGS) -I../ -test_asr_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) ../mod_test.la $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS) +test_asr_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS) +test_asr_LDADD = ../libtestmod.la TESTS = $(noinst_PROGRAMS) From 0bd676db329d720bcb60aa113c4ab88a90590043 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 21 Nov 2019 22:43:28 +0400 Subject: [PATCH 054/118] Add unit-tests automation to Drone CI --- .drone.yml | 47 +++++++++++++++++++++++++++++++++ tests/unit/collect-test-logs.sh | 23 ++++++++++++++++ tests/unit/run-tests.sh | 27 +++++++++++++++++++ 3 files changed, 97 insertions(+) create mode 100644 .drone.yml create mode 100755 tests/unit/collect-test-logs.sh create mode 100755 tests/unit/run-tests.sh diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000000..5331fea2ad --- /dev/null +++ b/.drone.yml @@ -0,0 +1,47 @@ +--- +kind: pipeline +name: unit-tests + +steps: + - name: run-tests + image: signalwire/freeswitch-public-base + pull: true + commands: + - ./bootstrap.sh -j + - echo "applications/mod_test" >> modules.conf + - ./configure + - echo "#!/bin/bash\nmake -j`nproc --all` |& tee ./unit-tests-build-result.txt\nexitstatus=\${PIPESTATUS[0]}\necho \$exitstatus > ./build-status.txt\nmake install\n" > build.sh + - chmod +x build.sh + - ./build.sh + - cd tests/unit + - ./run-tests.sh + - mkdir logs && (mv log_run-tests_*.html logs || true) + - echo 0 > run-tests-status.txt + - ./collect-test-logs.sh && exit 0 || echo 'Some tests failed' + - echo 1 > run-tests-status.txt + - cd logs && ls -la + + - name: notify + image: signalwire/unit-tests-notify + pull: true + environment: + GITHUB_CI_APP_PEM: + from_secret: github_ci_app_pem + SSH_KEY: + from_secret: ssh_key + SLACK_WEBHOOK_URL: + from_secret: slack_webhook_url + commands: + - /root/notify.sh + +trigger: + branch: + - master + event: + - pull_request + - push +--- +kind: signature +hmac: a34718dd1e2b9468a845962219ff05cac0c922ddf90d885af557a937a9e412e0 + +... diff --git a/tests/unit/collect-test-logs.sh b/tests/unit/collect-test-logs.sh new file mode 100755 index 0000000000..a46102af72 --- /dev/null +++ b/tests/unit/collect-test-logs.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +echo "Collecting test logs" +LOG_DIR=./logs +html="

There are failed unit-tests:

" +html+="" +logs=$(find $LOG_DIR -type f -iname "*.html" -print) +logs_found=0 +for name in $logs +do + logname=$(basename $name) + testname=$(echo $logname | awk -F 'log_run-tests_' '{print $2}' | awk -F '.html' '{print $1}') + html+="" + logs_found=1 +done + +if [ $logs_found -ne 0 ]; then + html+="

Unit tests
$testname
" + echo $html > $LOG_DIR/artifacts.html + exit 1 +fi + +exit 0 diff --git a/tests/unit/run-tests.sh b/tests/unit/run-tests.sh new file mode 100755 index 0000000000..55c41e203d --- /dev/null +++ b/tests/unit/run-tests.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +TESTS=$(make -f - 2>/dev/null <(ansi2html > $logfilename) ; + exitstatus=${PIPESTATUS[0]} ; + if [ "0" -eq $exitstatus ] ; then + rm $logfilename ; + else + echo "*** ./$i exit status is $exitstatus" ; + echo "*** $logfilename was saved" ; + fi ; + echo "----------------" ; +done From 5836b9652ba9dce2e3fa8dc51b30388e3f3819a5 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Sun, 24 Nov 2019 03:59:54 +0400 Subject: [PATCH 055/118] [Unit-tests] Fix test framework leaking on successful checks under setup or teardown mode. Failed checks in these modes are noted and then freed, but not when passed. --- src/include/test/switch_fct.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/include/test/switch_fct.h b/src/include/test/switch_fct.h index f2de6920f7..ab70d882c5 100644 --- a/src/include/test/switch_fct.h +++ b/src/include/test/switch_fct.h @@ -3663,9 +3663,12 @@ with. If we fail a setup up, then we go directly to a teardown mode. */ fct_ts__add_test( \ fctkern_ptr__->ns.ts_curr, fctkern_ptr__->ns.curr_test \ ); \ + } else { \ + fct_test__del(fctkern_ptr__->ns.curr_test); \ + fctkern_ptr__->ns.curr_test = NULL; \ } \ } else { \ - switch_assert("invalid condition for fct_req!"); \ + switch_assert("invalid condition for fct_req!"); \ _fct_req((_CNDTN_)); \ } From 3de3ec3b1ab350d3a7317ce055ef2b50d7f9a7b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dtalo=20Rossi?= Date: Mon, 25 Nov 2019 18:33:12 -0300 Subject: [PATCH 056/118] [mod_callcenter] Adding SAF_SUPPORT_NOMEDIA to callcenter_track since we don't need media up for it. Also, a small fix to make it compile on OSX. --- src/mod/applications/mod_callcenter/mod_callcenter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index f9e32fe845..cdbb9f4361 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -4010,7 +4010,7 @@ SWITCH_STANDARD_API(cc_break_api_function) const char *uuid = NULL; switch_core_session_t *break_session = NULL; switch_channel_t *channel = NULL; - switch_bool_t status = SWITCH_STATUS_SUCCESS; + switch_status_t status = SWITCH_STATUS_SUCCESS; if (!zstr(cmd)) { mydata = strdup(cmd); @@ -4246,7 +4246,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_callcenter_load) } SWITCH_ADD_APP(app_interface, "callcenter", "CallCenter", CC_DESC, callcenter_function, CC_USAGE, SAF_NONE); - SWITCH_ADD_APP(app_interface, "callcenter_track", "CallCenter Track Call", "Track external mod_callcenter calls to avoid place new calls", callcenter_track, CC_USAGE, SAF_NONE); + SWITCH_ADD_APP(app_interface, "callcenter_track", "CallCenter Track Call", "Track external mod_callcenter calls to avoid place new calls", callcenter_track, CC_USAGE, SAF_SUPPORT_NOMEDIA); SWITCH_ADD_API(api_interface, "callcenter_config", "Config of callcenter", cc_config_api_function, CC_CONFIG_API_SYNTAX); SWITCH_ADD_API(api_interface, "callcenter_break", "Stop watching an uuid and release agent", cc_break_api_function, "callcenter_break agent "); From 2865603ad2fa7c58eaf61c26c209db10c7ddaef7 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 22 Nov 2019 01:14:12 +0400 Subject: [PATCH 057/118] [Unit-tests] Fix xml error not finding freeswitch.xml on FST_MINCORE_BEGIN --- src/include/test/switch_test.h | 4 ++-- src/mod/endpoints/mod_sofia/test/test_sofia_funcs.c | 2 +- tests/unit/switch_console.c | 2 +- tests/unit/switch_event.c | 2 +- tests/unit/switch_hash.c | 2 +- tests/unit/switch_utils.c | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/include/test/switch_test.h b/src/include/test/switch_test.h index 1cf1ff94ff..98a1bd068c 100644 --- a/src/include/test/switch_test.h +++ b/src/include/test/switch_test.h @@ -308,7 +308,7 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char /** * Minimal FS core load */ -#define FST_MINCORE_BEGIN() \ +#define FST_MINCORE_BEGIN(confdir) \ FCT_BGN() \ { \ int fst_core = 0; \ @@ -317,7 +317,7 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char switch_memory_pool_t *fst_pool = NULL; \ int fst_timer_started = 0; \ fst_getenv_default("FST_SUPPRESS_UNUSED_STATIC_WARNING", NULL, SWITCH_FALSE); \ - if (fst_init_core_and_modload(".", NULL, 1) == SWITCH_STATUS_SUCCESS) { /* minimal load */ \ + if (fst_init_core_and_modload(confdir, NULL, 1) == SWITCH_STATUS_SUCCESS) { /* minimal load */ \ fst_core = 1; \ } else { \ fprintf(stderr, "Failed to load FS core\n"); \ diff --git a/src/mod/endpoints/mod_sofia/test/test_sofia_funcs.c b/src/mod/endpoints/mod_sofia/test/test_sofia_funcs.c index f55649c5cf..e5b1baa932 100644 --- a/src/mod/endpoints/mod_sofia/test/test_sofia_funcs.c +++ b/src/mod/endpoints/mod_sofia/test/test_sofia_funcs.c @@ -33,7 +33,7 @@ #include #include "../mod_sofia.c" -FST_MINCORE_BEGIN() +FST_MINCORE_BEGIN("./conf") FST_SUITE_BEGIN(switch_hash) diff --git a/tests/unit/switch_console.c b/tests/unit/switch_console.c index 547b6f01ee..9a3e9cfdc8 100644 --- a/tests/unit/switch_console.c +++ b/tests/unit/switch_console.c @@ -33,7 +33,7 @@ #include #include -FST_MINCORE_BEGIN() +FST_MINCORE_BEGIN("./conf") FST_SUITE_BEGIN(SWITCH_STANDARD_STREAM) diff --git a/tests/unit/switch_event.c b/tests/unit/switch_event.c index 1f55b574b9..69410cec48 100644 --- a/tests/unit/switch_event.c +++ b/tests/unit/switch_event.c @@ -4,7 +4,7 @@ // #define BENCHMARK 1 -FST_MINCORE_BEGIN() +FST_MINCORE_BEGIN("./conf") FST_SUITE_BEGIN(switch_event) diff --git a/tests/unit/switch_hash.c b/tests/unit/switch_hash.c index 43d3e18692..e0de407917 100644 --- a/tests/unit/switch_hash.c +++ b/tests/unit/switch_hash.c @@ -4,7 +4,7 @@ // #define BENCHMARK 1 -FST_MINCORE_BEGIN() +FST_MINCORE_BEGIN("./conf") FST_SUITE_BEGIN(switch_hash) diff --git a/tests/unit/switch_utils.c b/tests/unit/switch_utils.c index 177d14c6ba..72c5817b71 100644 --- a/tests/unit/switch_utils.c +++ b/tests/unit/switch_utils.c @@ -33,7 +33,7 @@ #include #include -FST_MINCORE_BEGIN() +FST_MINCORE_BEGIN("./conf") FST_SUITE_BEGIN(switch_hash) From 4c434aef1fef98f0c48cfee711d0ebfbf22e99f2 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 26 Nov 2019 22:54:17 +0400 Subject: [PATCH 058/118] [Unit-tests] Fix test framework by telling sqldb to manage handles so they don't leak and are destroyed on shutdown. --- src/include/test/switch_test.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/include/test/switch_test.h b/src/include/test/switch_test.h index 98a1bd068c..ffdc06412d 100644 --- a/src/include/test/switch_test.h +++ b/src/include/test/switch_test.h @@ -113,7 +113,7 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char switch_core_set_globals(); if (!minimal) { - status = switch_core_init_and_modload(0, SWITCH_TRUE, &err); + status = switch_core_init_and_modload(SCF_USE_SQL, SWITCH_TRUE, &err); switch_sleep(1 * 1000000); switch_core_set_variable("sound_prefix", "." SWITCH_PATH_SEPARATOR); if (status != SWITCH_STATUS_SUCCESS && err) { From b337e77258079212aaf2f46ea42c4be0ffade28d Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 27 Nov 2019 21:36:53 +0400 Subject: [PATCH 059/118] [Unit-tests] Fix leaks in mod_test and in switch_core_codec, switch_vpx, switch_xml, switch_ivr_play_say tests. --- src/mod/applications/mod_test/mod_test.c | 2 -- tests/unit/switch_core_codec.c | 8 ++++++++ tests/unit/switch_ivr_play_say.c | 2 ++ tests/unit/switch_vpx.c | 1 + 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_test/mod_test.c b/src/mod/applications/mod_test/mod_test.c index d5460ac364..c8ce62c39f 100644 --- a/src/mod/applications/mod_test/mod_test.c +++ b/src/mod/applications/mod_test/mod_test.c @@ -257,8 +257,6 @@ static switch_status_t test_asr_get_results(switch_asr_handle_t *ah, char **resu { test_asr_t *context = (test_asr_t *) ah->private_info; switch_status_t status = SWITCH_STATUS_SUCCESS; - switch_stream_handle_t result = { 0 }; - SWITCH_STANDARD_STREAM(result); if (switch_test_flag(context, ASRFLAG_RETURNED_RESULT) || switch_test_flag(ah, SWITCH_ASR_FLAG_CLOSED)) { return SWITCH_STATUS_FALSE; diff --git a/tests/unit/switch_core_codec.c b/tests/unit/switch_core_codec.c index b01d5220c5..61a70314a4 100644 --- a/tests/unit/switch_core_codec.c +++ b/tests/unit/switch_core_codec.c @@ -74,6 +74,8 @@ FST_CORE_BEGIN("./conf") switch_core_codec_copy(&orig_codec, &new_codec, NULL, NULL); fst_check(orig_codec.implementation->samples_per_second == new_codec.implementation->samples_per_second); fst_check(orig_codec.implementation->actual_samples_per_second == new_codec.implementation->actual_samples_per_second); + switch_core_codec_destroy(&orig_codec); + switch_core_codec_destroy(&new_codec); status = switch_core_codec_init(&orig_codec, "OPUS", @@ -88,6 +90,8 @@ FST_CORE_BEGIN("./conf") switch_core_codec_copy(&orig_codec, &new_codec, NULL, NULL); fst_check(orig_codec.implementation->samples_per_second == new_codec.implementation->samples_per_second); fst_check(orig_codec.implementation->actual_samples_per_second == new_codec.implementation->actual_samples_per_second); + switch_core_codec_destroy(&orig_codec); + switch_core_codec_destroy(&new_codec); status = switch_core_codec_init(&orig_codec, "OPUS", @@ -102,6 +106,8 @@ FST_CORE_BEGIN("./conf") switch_core_codec_copy(&orig_codec, &new_codec, NULL, NULL); fst_check(orig_codec.implementation->samples_per_second == new_codec.implementation->samples_per_second); fst_check(orig_codec.implementation->actual_samples_per_second == new_codec.implementation->actual_samples_per_second); + switch_core_codec_destroy(&orig_codec); + switch_core_codec_destroy(&new_codec); status = switch_core_codec_init(&orig_codec, "G722", @@ -116,6 +122,8 @@ FST_CORE_BEGIN("./conf") switch_core_codec_copy(&orig_codec, &new_codec, NULL, NULL); fst_check(orig_codec.implementation->samples_per_second == new_codec.implementation->samples_per_second); fst_check(orig_codec.implementation->actual_samples_per_second == new_codec.implementation->actual_samples_per_second); + switch_core_codec_destroy(&orig_codec); + switch_core_codec_destroy(&new_codec); } FST_TEST_END() diff --git a/tests/unit/switch_ivr_play_say.c b/tests/unit/switch_ivr_play_say.c index c08cdd5752..6dd1c524f5 100644 --- a/tests/unit/switch_ivr_play_say.c +++ b/tests/unit/switch_ivr_play_say.c @@ -261,6 +261,8 @@ FST_CORE_BEGIN("./conf_playsay") fst_check_string_equals(cJSON_GetObjectCstr(recognition_result, "text"), ""); fst_check_string_equals(digits_collected, NULL); fst_check(terminator_collected == 0); + if (recognition_result) cJSON_Delete(recognition_result); + recognition_result = NULL; } FST_SESSION_END() } diff --git a/tests/unit/switch_vpx.c b/tests/unit/switch_vpx.c index 505b27f09a..d97d09f186 100644 --- a/tests/unit/switch_vpx.c +++ b/tests/unit/switch_vpx.c @@ -82,6 +82,7 @@ FST_CORE_BEGIN("./conf") fst_check(frame.m == 1); fst_check(packets > 0); + switch_img_free(&img); switch_core_codec_destroy(&codec); } FST_TEST_END() From 1afad3413b762a2213a752d74284a22c28e0ac06 Mon Sep 17 00:00:00 2001 From: lazedo Date: Tue, 3 Dec 2019 21:45:15 +0000 Subject: [PATCH 060/118] [mod_kazoo] missing call to kz_set_hostname --- src/mod/event_handlers/mod_kazoo/kazoo_ei_config.c | 2 +- src/mod/event_handlers/mod_kazoo/mod_kazoo.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_ei_config.c b/src/mod/event_handlers/mod_kazoo/kazoo_ei_config.c index df3eec0bf6..83828a25a2 100644 --- a/src/mod/event_handlers/mod_kazoo/kazoo_ei_config.c +++ b/src/mod/event_handlers/mod_kazoo/kazoo_ei_config.c @@ -122,7 +122,7 @@ switch_status_t kazoo_ei_config(switch_xml_t cfg) { kazoo_globals.receive_msg_preallocate = 2000; kazoo_globals.event_stream_preallocate = KZ_DEFAULT_STREAM_PRE_ALLOCATE; kazoo_globals.send_msg_batch = 10; - kazoo_globals.event_stream_framing = 4; + kazoo_globals.event_stream_framing = 2; kazoo_globals.port = 0; kazoo_globals.io_fault_tolerance = 10; kazoo_globals.json_encoding = ERLANG_TUPLE; diff --git a/src/mod/event_handlers/mod_kazoo/mod_kazoo.c b/src/mod/event_handlers/mod_kazoo/mod_kazoo.c index 6a4a9a4ce6..1be309c28d 100644 --- a/src/mod/event_handlers/mod_kazoo/mod_kazoo.c +++ b/src/mod/event_handlers/mod_kazoo/mod_kazoo.c @@ -42,6 +42,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_kazoo_load) { memset(&kazoo_globals, 0, sizeof(kazoo_globals)); kazoo_globals.pool = pool; + kz_set_hostname(); if(kazoo_load_config() != SWITCH_STATUS_SUCCESS) { // TODO: what would we need to clean up here? switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Improper configuration!\n"); From 731b0eb8fde433cd452fc832c83eb5cd47718c41 Mon Sep 17 00:00:00 2001 From: lazedo Date: Tue, 3 Dec 2019 23:24:47 +0000 Subject: [PATCH 061/118] [mod_kazoo] add kz_set_hostname declaration --- src/mod/event_handlers/mod_kazoo/kazoo_ei.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_ei.h b/src/mod/event_handlers/mod_kazoo/kazoo_ei.h index 4d247629e3..1fe826b846 100644 --- a/src/mod/event_handlers/mod_kazoo/kazoo_ei.h +++ b/src/mod/event_handlers/mod_kazoo/kazoo_ei.h @@ -238,7 +238,7 @@ void fetch_config(); switch_status_t kazoo_load_config(); void kazoo_destroy_config(); - +void kz_set_hostname(); #define _ei_x_encode_string(buf, string) { ei_x_encode_binary(buf, string, strlen(string)); } From ac77de715ba4645cc7bee180453450801cb43aaa Mon Sep 17 00:00:00 2001 From: lazedo Date: Wed, 4 Dec 2019 05:58:08 +0000 Subject: [PATCH 062/118] [mod_kazoo] use globals hostname to create nodename in create_ei_cnode --- .../event_handlers/mod_kazoo/kazoo_ei_utils.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_ei_utils.c b/src/mod/event_handlers/mod_kazoo/kazoo_ei_utils.c index 7def04974b..7f751db4f9 100644 --- a/src/mod/event_handlers/mod_kazoo/kazoo_ei_utils.c +++ b/src/mod/event_handlers/mod_kazoo/kazoo_ei_utils.c @@ -345,10 +345,9 @@ switch_socket_t *create_socket(switch_memory_pool_t *pool) { } switch_status_t create_ei_cnode(const char *ip_addr, const char *name, struct ei_cnode_s *ei_cnode) { - char hostname[EI_MAXHOSTNAMELEN + 1] = ""; + char hostname[EI_MAXHOSTNAMELEN + 1]; char nodename[MAXNODELEN + 1]; char cnodename[EI_MAXALIVELEN + 1]; - //EI_MAX_COOKIE_SIZE+1 char *atsign; /* copy the erlang interface nodename into something we can modify */ @@ -356,17 +355,13 @@ switch_status_t create_ei_cnode(const char *ip_addr, const char *name, struct ei if ((atsign = strchr(cnodename, '@'))) { /* we got a qualified node name, don't guess the host/domain */ - snprintf(nodename, MAXNODELEN + 1, "%s", kazoo_globals.ei_nodename); + snprintf(nodename, MAXNODELEN + 1, "%s", name); /* truncate the alivename at the @ */ - *atsign = '\0'; + *atsign++ = '\0'; + strncpy(hostname, atsign, EI_MAXHOSTNAMELEN); } else { - if (zstr(kazoo_globals.hostname) || !strncasecmp(kazoo_globals.ip, "0.0.0.0", 7) || !strncasecmp(kazoo_globals.ip, "::", 2)) { - memcpy(hostname, switch_core_get_hostname(), EI_MAXHOSTNAMELEN); - } else { - memcpy(hostname, kazoo_globals.hostname, EI_MAXHOSTNAMELEN); - } - - snprintf(nodename, MAXNODELEN + 1, "%s@%s", kazoo_globals.ei_nodename, hostname); + strncpy(hostname, kazoo_globals.hostname, EI_MAXHOSTNAMELEN); + snprintf(nodename, MAXNODELEN + 1, "%s@%s", name, hostname); } if (kazoo_globals.ei_shortname) { @@ -376,6 +371,8 @@ switch_status_t create_ei_cnode(const char *ip_addr, const char *name, struct ei } } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "creating nodename: %s\n", nodename); + /* init the ec stuff */ if (ei_connect_xinit(ei_cnode, hostname, cnodename, nodename, (Erl_IpAddr) ip_addr, kazoo_globals.ei_cookie, 0) < 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to initialize the erlang interface connection structure\n"); From a124937f0c84678251f2614315dfe022262f6e10 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 4 Dec 2019 19:32:46 +0400 Subject: [PATCH 063/118] [Core] Fix wrong sqldb initialization order causing crash on load. --- src/switch_core_sqldb.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 3752a06b23..51fde6ebdf 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -3822,6 +3822,14 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_ skip: if (sql_manager.manage) { + /* Initiate switch_sql_queue_manager */ + switch_threadattr_create(&thd_attr, sql_manager.memory_pool); + switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); + switch_threadattr_priority_set(thd_attr, SWITCH_PRI_REALTIME); + switch_core_sqldb_start_thread(); + switch_thread_create(&sql_manager.db_thread, thd_attr, switch_core_sql_db_thread, NULL, sql_manager.memory_pool); + + /* switch_sql_queue_manager initiated, now we can bind to core_event_handler */ #ifdef SWITCH_SQL_BIND_EVERY_EVENT switch_event_bind("core_db", SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL); #else @@ -3851,13 +3859,6 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_ switch_event_bind("core_db", SWITCH_EVENT_NAT, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL); switch_event_bind("core_db", SWITCH_EVENT_CODEC, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL); #endif - - switch_threadattr_create(&thd_attr, sql_manager.memory_pool); - switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); - switch_threadattr_priority_set(thd_attr, SWITCH_PRI_REALTIME); - switch_core_sqldb_start_thread(); - switch_thread_create(&sql_manager.db_thread, thd_attr, switch_core_sql_db_thread, NULL, sql_manager.memory_pool); - } switch_cache_db_release_db_handle(&sql_manager.dbh); From b124b607d724d3e308b654e57dd55fdab182b171 Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Thu, 21 Nov 2019 18:02:47 +0000 Subject: [PATCH 064/118] [Core] Add PRE_CLOSED flag on file handle, add unit test. --- src/include/switch_types.h | 3 +- src/switch_core_file.c | 5 +- tests/unit/Makefile.am | 2 +- tests/unit/switch_core_file.c | 133 ++++++++++++++++++++++++++++++++++ 4 files changed, 140 insertions(+), 3 deletions(-) create mode 100644 tests/unit/switch_core_file.c diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 9302ad5c3d..9d8445a1e7 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1937,7 +1937,8 @@ typedef enum { SWITCH_FILE_NOMUX = (1 << 17), SWITCH_FILE_BREAK_ON_CHANGE = (1 << 18), SWITCH_FILE_FLAG_VIDEO = (1 << 19), - SWITCH_FILE_FLAG_VIDEO_EOF = (1 << 20) + SWITCH_FILE_FLAG_VIDEO_EOF = (1 << 20), + SWITCH_FILE_PRE_CLOSED = (1 << 21) } switch_file_flag_enum_t; typedef uint32_t switch_file_flag_t; diff --git a/src/switch_core_file.c b/src/switch_core_file.c index c49b151b01..717233ce55 100644 --- a/src/switch_core_file.c +++ b/src/switch_core_file.c @@ -915,6 +915,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_pre_close(switch_file_handle_t } switch_clear_flag_locked(fh, SWITCH_FILE_OPEN); + switch_set_flag_locked(fh, SWITCH_FILE_PRE_CLOSED); if (fh->file_interface->file_pre_close) { status = fh->file_interface->file_pre_close(fh); @@ -929,10 +930,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_close(switch_file_handle_t *fh) if (switch_test_flag(fh, SWITCH_FILE_OPEN)) { status = switch_core_file_pre_close(fh); - } else { + } else if (!switch_test_flag(fh, SWITCH_FILE_PRE_CLOSED)) { return SWITCH_STATUS_FALSE; } + switch_clear_flag_locked(fh, SWITCH_FILE_PRE_CLOSED); + fh->file_interface->file_close(fh); if (fh->params) { diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index 79df35188f..f3e9a7d234 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -1,6 +1,6 @@ include $(top_srcdir)/build/modmake.rulesam -noinst_PROGRAMS = switch_event switch_hash switch_ivr_originate switch_utils switch_core switch_console switch_vpx \ +noinst_PROGRAMS = switch_event switch_hash switch_ivr_originate switch_utils switch_core switch_console switch_vpx switch_core_file \ switch_ivr_play_say switch_core_codec noinst_PROGRAMS+= switch_core_video AM_LDFLAGS = -avoid-version -no-undefined $(SWITCH_AM_LDFLAGS) $(openssl_LIBS) diff --git a/tests/unit/switch_core_file.c b/tests/unit/switch_core_file.c new file mode 100644 index 0000000000..34edf7d7c0 --- /dev/null +++ b/tests/unit/switch_core_file.c @@ -0,0 +1,133 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2018, 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 + * Anthony Minessale II + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Chris Rienzo + * Seven Du + * Dragos Oancea + * + * switch_core_file.c -- tests file core functions + * + */ +#include +#include + +#include + +FST_CORE_BEGIN("./conf") +{ + FST_SUITE_BEGIN(switch_core_file) + { + FST_SETUP_BEGIN() + { + } + FST_SETUP_END() + + FST_TEARDOWN_BEGIN() + { + } + FST_TEARDOWN_END() + + FST_TEST_BEGIN(test_switch_core_file_close) + { + switch_file_handle_t fh = { 0 }; + switch_status_t status = SWITCH_STATUS_FALSE; + static char filename[] = "/tmp/fs_unit_test.wav"; + static char hdr[] = /*simplest wav file*/ + "\x52\x49\x46\x46" + "\x24\x00\x00\x00" + "\x57\x41\x56\x45" + "\x66\x6d\x74\x20" + "\x10\x00\x00\x00" + "\x01\x00\x01\x00" + "\x44\xac\x00\x00" + "\x88\x58\x01\x00" + "\x02\x00\x10\x00" + "\x64\x61\x74\x61" + "\x00\x00"; + FILE *f = NULL; + + f = fopen(filename, "w"); + fst_check(f != NULL); + fwrite(hdr, 1, sizeof(hdr) ,f); + fclose(f); + + status = switch_core_file_open(&fh, filename, 1, 8000, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL); + fst_check(status == SWITCH_STATUS_SUCCESS); + fst_check(switch_test_flag(&fh, SWITCH_FILE_OPEN)); + status = switch_core_file_pre_close(&fh); + fst_check(!switch_test_flag(&fh, SWITCH_FILE_OPEN)); + fst_check(switch_test_flag(&fh, SWITCH_FILE_PRE_CLOSED)); + fst_check(status == SWITCH_STATUS_SUCCESS); + status = switch_core_file_close(&fh); + fst_check(status == SWITCH_STATUS_SUCCESS); + fst_check(!switch_test_flag(&fh, SWITCH_FILE_PRE_CLOSED)); + + status = switch_core_file_close(&fh); + fst_check(status == SWITCH_STATUS_FALSE); + + unlink(filename); + } + FST_TEST_END() + FST_TEST_BEGIN(test_switch_core_file_no_pre_close) + { + switch_file_handle_t fh = { 0 }; + switch_status_t status = SWITCH_STATUS_FALSE; + static char filename[] = "/tmp/fs_unit_test.wav"; + static char hdr[] = /*simplest wav file*/ + "\x52\x49\x46\x46" + "\x24\x00\x00\x00" + "\x57\x41\x56\x45" + "\x66\x6d\x74\x20" + "\x10\x00\x00\x00" + "\x01\x00\x01\x00" + "\x44\xac\x00\x00" + "\x88\x58\x01\x00" + "\x02\x00\x10\x00" + "\x64\x61\x74\x61" + "\x00\x00"; + FILE *f = NULL; + + f = fopen(filename, "w"); + fst_check(f != NULL); + fwrite(hdr, 1, sizeof(hdr) ,f); + fclose(f); + + status = switch_core_file_open(&fh, filename, 1, 8000, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL); + fst_check(status == SWITCH_STATUS_SUCCESS); + fst_check(switch_test_flag(&fh, SWITCH_FILE_OPEN)); + status = switch_core_file_close(&fh); + fst_check(status == SWITCH_STATUS_SUCCESS); + fst_check(!switch_test_flag(&fh, SWITCH_FILE_PRE_CLOSED)); + + status = switch_core_file_close(&fh); + fst_check(status == SWITCH_STATUS_FALSE); + + unlink(filename); + } + FST_TEST_END() + + } + FST_SUITE_END() +} +FST_CORE_END() From bae7c3eae0f0c831cd8579ee51897875b6c75192 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 5 Dec 2019 23:44:33 +0400 Subject: [PATCH 065/118] [Unit-tests] Fix switch_core_file test. --- tests/unit/conf/freeswitch.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unit/conf/freeswitch.xml b/tests/unit/conf/freeswitch.xml index abdbcd4ae5..3e25162a8c 100644 --- a/tests/unit/conf/freeswitch.xml +++ b/tests/unit/conf/freeswitch.xml @@ -11,6 +11,7 @@ +
From 7ce50c8bd0344886e1ae86d0b991ad97ac0b702b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 27 Nov 2019 21:10:50 +0000 Subject: [PATCH 066/118] [Core] Fix hard coded dtmf durations based on 8k --- src/switch_core_io.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 8b12efaffb..fd11a3da47 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -1127,6 +1127,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf_string(switch_core int i, argc; char *argv[256]; int dur_total = 0; + int rate_mult = 8; + + switch_codec_implementation_t write_impl = { 0 }; switch_assert(session != NULL); @@ -1156,13 +1159,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf_string(switch_core switch_channel_pre_answer(session->channel); } + switch_core_session_get_write_impl(session, &write_impl); + rate_mult = (write_impl.actual_samples_per_second / 1000); + for (i = 0; i < argc; i++) { dtmf.duration = switch_core_default_dtmf_duration(0); - dur = switch_core_default_dtmf_duration(0) / 8; + dur = switch_core_default_dtmf_duration(0) / rate_mult; if ((p = strchr(argv[i], '@'))) { *p++ = '\0'; - if ((dur = atoi(p)) > (int)switch_core_min_dtmf_duration(0) / 8) { - dtmf.duration = dur * 8; + if ((dur = atoi(p)) > (int)switch_core_min_dtmf_duration(0) / rate_mult) { + dtmf.duration = dur * rate_mult; } } @@ -1192,14 +1198,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf_string(switch_core switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s send dtmf\ndigit=%c ms=%u samples=%u\n", switch_channel_get_name(session->channel), dtmf.digit, dur, dtmf.duration); sent++; - dur_total += dtmf.duration + 2000; /* account for 250ms pause */ + dur_total += dtmf.duration + (250 * rate_mult); /* account for 250ms pause */ } } } if (dur_total) { char tmp[32] = ""; - switch_snprintf(tmp, sizeof(tmp), "%d", dur_total / 8); + switch_snprintf(tmp, sizeof(tmp), "%d", dur_total / rate_mult); switch_channel_set_variable(session->channel, "last_dtmf_duration", tmp); } From 47c5c8f3e8957c37fad5feeeb791375d05992b93 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 27 Nov 2019 21:10:15 +0000 Subject: [PATCH 067/118] [Core] Fix short-circuit in write timestamp calc --- src/switch_rtp.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 4d60b7c41e..5da1b4fbe3 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -9039,7 +9039,6 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra data = frame->data; len = frame->datalen; ts = rtp_session->flags[SWITCH_RTP_FLAG_RAW_WRITE] ? (uint32_t) frame->timestamp : 0; - if (!ts) ts = rtp_session->last_write_ts + rtp_session->samples_per_interval; } /* From 52949efc28937f051a4beece3763366df9e19329 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 10 Dec 2019 19:08:27 +0400 Subject: [PATCH 068/118] [Core] Wait for all EVENT_DISPATCH_QUEUE_THREADS before killing the logging which leaks otherwise. --- src/switch_event.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/switch_event.c b/src/switch_event.c index 6b1a3bfc42..b1e02e570a 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -571,9 +571,11 @@ SWITCH_DECLARE(switch_status_t) switch_event_shutdown(void) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping dispatch threads\n"); - for(x = 0; x < (uint32_t)DISPATCH_THREAD_COUNT; x++) { - switch_status_t st; - switch_thread_join(&st, EVENT_DISPATCH_QUEUE_THREADS[x]); + for(x = 0; x < (uint32_t)MAX_DISPATCH; x++) { + if (EVENT_DISPATCH_QUEUE_THREADS[x]) { + switch_status_t st; + switch_thread_join(&st, EVENT_DISPATCH_QUEUE_THREADS[x]); + } } } From be37eea41283e6362d4bc4ff1d58d6c692cc516b Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Tue, 26 Nov 2019 14:20:52 +0000 Subject: [PATCH 069/118] [unit-tests] add basic RTP unit-test --- tests/unit/Makefile.am | 2 +- tests/unit/switch_rtp.c | 59 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 tests/unit/switch_rtp.c diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index f3e9a7d234..2b5f953997 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -1,7 +1,7 @@ include $(top_srcdir)/build/modmake.rulesam noinst_PROGRAMS = switch_event switch_hash switch_ivr_originate switch_utils switch_core switch_console switch_vpx switch_core_file \ - switch_ivr_play_say switch_core_codec + switch_ivr_play_say switch_core_codec switch_rtp noinst_PROGRAMS+= switch_core_video AM_LDFLAGS = -avoid-version -no-undefined $(SWITCH_AM_LDFLAGS) $(openssl_LIBS) AM_LDFLAGS += $(FREESWITCH_LIBS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS) diff --git a/tests/unit/switch_rtp.c b/tests/unit/switch_rtp.c new file mode 100644 index 0000000000..8c41764eba --- /dev/null +++ b/tests/unit/switch_rtp.c @@ -0,0 +1,59 @@ + +#include +#include + +static const char *rx_host = "127.0.0.1"; +static switch_port_t rx_port = 12346; +static const char *tx_host = "127.0.0.1"; +static switch_port_t tx_port = 54320; +static switch_memory_pool_t *pool = NULL; +static switch_rtp_t *rtp_session = NULL; +static switch_rtp_flag_t flags[SWITCH_RTP_FLAG_INVALID] = {0}; +const char *err = NULL; +static const switch_payload_t TEST_PT = 8; +switch_rtp_packet_t rtp_packet; +switch_frame_flag_t *frame_flags; +switch_io_flag_t io_flags; +switch_payload_t read_pt; +uint datalen; + +FST_CORE_BEGIN("./conf") +{ +FST_SUITE_BEGIN(switch_rtp) +{ +FST_SETUP_BEGIN() +{ +} +FST_SETUP_END() + +FST_TEARDOWN_BEGIN() +{ +} +FST_TEARDOWN_END() + +FST_TEST_BEGIN(test_rtp) +{ + switch_core_new_memory_pool(&pool); + + rtp_session = switch_rtp_new(rx_host, rx_port, tx_host, tx_port, TEST_PT, 8000, 20 * 1000, flags, "soft", &err, pool, 0, 0); + fst_xcheck(rtp_session != NULL, "get RTP session"); + fst_requires(rtp_session); + fst_requires(switch_rtp_ready(rtp_session)); + switch_rtp_activate_rtcp(rtp_session, 5, rx_port + 1, 0); + switch_rtp_set_default_payload(rtp_session, TEST_PT); + fst_xcheck(switch_rtp_get_default_payload(rtp_session) == TEST_PT, "get Payload Type") + switch_rtp_set_ssrc(rtp_session, 0xabcd); + switch_rtp_set_remote_ssrc(rtp_session, 0xcdef); + fst_xcheck(switch_rtp_get_ssrc(rtp_session) == 0xabcd, "get SSRC"); + switch_rtp_stats_t *stats = switch_rtp_get_stats(rtp_session, pool); + fst_requires(stats); + switch_rtp_destroy(&rtp_session); + + switch_core_destroy_memory_pool(&pool); +} +FST_TEST_END() +} +FST_SUITE_END() +} +FST_CORE_END() + From d49d22ff06dac8a4bfd39ed097d08b5b442c235e Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 20 Dec 2019 00:14:17 +0400 Subject: [PATCH 070/118] [Core] DTMF: Avoid division by zero on low actual_samples_per_second --- src/switch_core_io.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/switch_core_io.c b/src/switch_core_io.c index fd11a3da47..22d0474e3e 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -1160,7 +1160,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf_string(switch_core } switch_core_session_get_write_impl(session, &write_impl); - rate_mult = (write_impl.actual_samples_per_second / 1000); + + if (write_impl.actual_samples_per_second >= 1000) { + rate_mult = (write_impl.actual_samples_per_second / 1000); + } for (i = 0; i < argc; i++) { dtmf.duration = switch_core_default_dtmf_duration(0); From b28eb5ea920e683c0a72dca6797a137e6f82f2b2 Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Fri, 10 May 2019 08:34:10 +0000 Subject: [PATCH 071/118] FS-11836: scan-build: Argument with 'nonnull' attribute passed null FS-11836: scan-build: Dead assignments --- src/switch_core_media.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index e55ae8aad7..c3a29353ee 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -1802,6 +1802,9 @@ SWITCH_DECLARE(int) switch_core_session_check_incoming_crypto(switch_core_sessio return 0; } + if (!crypto) { + return 0; + } engine = &session->media_handle->engines[type]; for (i = 0; smh->crypto_suite_order[i] != CRYPTO_INVALID; i++) { @@ -1826,7 +1829,7 @@ SWITCH_DECLARE(int) switch_core_session_check_incoming_crypto(switch_core_sessio if (engine->ssec[engine->crypto_type].remote_crypto_key && switch_rtp_ready(engine->rtp_session)) { /* Compare all the key. The tag may remain the same even if key changed */ - if (crypto && engine->crypto_type != CRYPTO_INVALID && !strcmp(crypto, engine->ssec[engine->crypto_type].remote_crypto_key)) { + if (engine->crypto_type != CRYPTO_INVALID && !strcmp(crypto, engine->ssec[engine->crypto_type].remote_crypto_key)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Existing key is still valid.\n"); got_crypto = 1; } else { @@ -5216,7 +5219,6 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s switch_channel_get_name(session->channel), switch_channel_get_name(other_channel)); switch_core_session_rwunlock(other_session); - pass = 0; match = 0; fmatch = 0; goto done; @@ -6065,7 +6067,6 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s vmatch = 0; almost_vmatch = 0; - nm_idx = 0; m_idx = 0; memset(matches, 0, sizeof(matches[0]) * MAX_MATCHES); memset(near_matches, 0, sizeof(near_matches[0]) * MAX_MATCHES); @@ -10778,7 +10779,6 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess int cur_ptime = 0, this_ptime = 0, cng_type = 0; const char *mult; - i = 0; if (!switch_media_handle_test_media_flag(smh, SCMF_SUPPRESS_CNG) && smh->mparams->cng_pt && use_cng) { cng_type = smh->mparams->cng_pt; @@ -13529,7 +13529,6 @@ static void switch_core_media_set_r_sdp_codec_string(switch_core_session_t *sess if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND || prefer_sdp) { for (map = m->m_rtpmaps; map; map = map->rm_next) { - match = 0; if (map->rm_pt > 127 || already_did[map->rm_pt]) { continue; @@ -13563,7 +13562,6 @@ static void switch_core_media_set_r_sdp_codec_string(switch_core_session_t *sess continue; } for (map = m->m_rtpmaps; map; map = map->rm_next) { - match = 0; if (map->rm_pt > 127 || already_did[map->rm_pt]) { continue; @@ -13601,7 +13599,6 @@ static void switch_core_media_set_r_sdp_codec_string(switch_core_session_t *sess if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND || prefer_sdp) { for (map = m->m_rtpmaps; map; map = map->rm_next) { - match = 0; if (map->rm_pt > 127 || already_did[map->rm_pt]) { continue; @@ -13646,7 +13643,6 @@ static void switch_core_media_set_r_sdp_codec_string(switch_core_session_t *sess } for (map = m->m_rtpmaps; map; map = map->rm_next) { - match = 0; if (map->rm_pt > 127 || already_did[map->rm_pt]) { continue; @@ -16082,7 +16078,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess enc_frame->ssrc = frame->ssrc; enc_frame->payload = enc_frame->codec->implementation->ianacode; write_frame = enc_frame; - status = SWITCH_STATUS_SUCCESS; break; case SWITCH_STATUS_NOT_INITALIZED: switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec init error!\n"); @@ -16236,7 +16231,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess enc_frame->ssrc = frame->ssrc; enc_frame->payload = enc_frame->codec->implementation->ianacode; write_frame = enc_frame; - status = SWITCH_STATUS_SUCCESS; break; case SWITCH_STATUS_NOT_INITALIZED: switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec init error!\n"); From 24e0949844e561641b9dd8b4c46dc15022003048 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 19 Sep 2019 23:18:43 +0400 Subject: [PATCH 072/118] FS-12056: [mod_sofia] Fix leaking destination in sofia_glue_do_invite() and leaking route in sofia_glue_gen_contact_str() --- src/mod/endpoints/mod_sofia/sofia_glue.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index dc6442f70d..72c654fe46 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1097,7 +1097,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) if (!caller_profile) { switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - return SWITCH_STATUS_FALSE; + switch_goto_status(SWITCH_STATUS_FALSE, end); } @@ -1126,7 +1126,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) if ((status = switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Port Error!\n"); - return status; + goto end; } if (!switch_channel_get_private(tech_pvt->channel, "t38_options") || zstr(tech_pvt->mparams.local_sdp_str)) { @@ -1160,7 +1160,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) if (zstr(tech_pvt->dest)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "URL Error!\n"); - return SWITCH_STATUS_FALSE; + switch_goto_status(SWITCH_STATUS_FALSE, end); } if ((d_url = sofia_glue_get_url_from_contact(tech_pvt->dest, 1))) { @@ -1265,7 +1265,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) if (!sofia_test_pflag(tech_pvt->profile, PFLAG_TLS) && sofia_glue_transport_has_tls(tech_pvt->transport)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "TLS not supported by profile\n"); - return SWITCH_STATUS_FALSE; + switch_goto_status(SWITCH_STATUS_FALSE, end); } if (zstr(tech_pvt->invite_contact)) { @@ -1360,7 +1360,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) if (!strncasecmp(url_str, "tel:", 4)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "URL Error! tel: uri's not supported at this time\n"); - return SWITCH_STATUS_FALSE; + switch_goto_status(SWITCH_STATUS_FALSE, end); } if (!s) { s = url_str; @@ -1386,7 +1386,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) invite_contact); switch_safe_free(d_url); - return SWITCH_STATUS_FALSE; + switch_goto_status(SWITCH_STATUS_FALSE, end); } if (tech_pvt->dest && (strstr(tech_pvt->dest, ";fs_nat") || strstr(tech_pvt->dest, ";received") @@ -1705,12 +1705,19 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) SIPTAG_PAYLOAD_STR(mp ? mp : tech_pvt->mparams.local_sdp_str), TAG_IF(rep, SIPTAG_REPLACES_STR(rep)), SOATAG_HOLD(holdstr), TAG_END()); } - sofia_glue_free_destination(dst); switch_safe_free(extra_headers); switch_safe_free(mp); tech_pvt->redirected = NULL; - return SWITCH_STATUS_SUCCESS; + status = SWITCH_STATUS_SUCCESS; + +end: + + if (dst) { + sofia_glue_free_destination(dst); + } + + return status; } void sofia_glue_do_xfer_invite(switch_core_session_t *session) @@ -3336,6 +3343,7 @@ char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, nua switch_zmalloc(route_encoded, route_encoded_len); switch_url_encode(route, route_encoded, route_encoded_len); contact_str = switch_mprintf("%s <%s;fs_path=%s>", display, full_contact_dup, route_encoded); + free(route); free(full_contact_dup); free(route_encoded); } From 3f075d30acd0677eeb908cab20b1aa2271369d4a Mon Sep 17 00:00:00 2001 From: Seven Du Date: Fri, 30 Aug 2019 20:58:17 +0800 Subject: [PATCH 073/118] FS-12032 remove extra semi colon --- src/switch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switch.c b/src/switch.c index 6a56fd90c5..22f780db63 100644 --- a/src/switch.c +++ b/src/switch.c @@ -84,7 +84,7 @@ static HANDLE shutdown_event; static void handle_SIGILL(int sig) { int32_t arg = 0; - if (sig) {}; + if (sig) {} /* send shutdown signal to the freeswitch core */ switch_core_session_ctl(SCSC_SHUTDOWN, &arg); return; @@ -93,7 +93,7 @@ static void handle_SIGILL(int sig) static void handle_SIGTERM(int sig) { int32_t arg = 0; - if (sig) {}; + if (sig) {} /* send shutdown signal to the freeswitch core */ switch_core_session_ctl(SCSC_SHUTDOWN_ELEGANT, &arg); return; From b8a18f7d83615ff54df9f9fae535839a079b82dd Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 20 Sep 2019 20:02:32 +0400 Subject: [PATCH 074/118] FS-12057: [mod_conference] Fix video mute (use of uninitialized pointer) --- src/mod/applications/mod_conference/conference_video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_conference/conference_video.c b/src/mod/applications/mod_conference/conference_video.c index 95da2b15e9..625e2406ec 100644 --- a/src/mod/applications/mod_conference/conference_video.c +++ b/src/mod/applications/mod_conference/conference_video.c @@ -3866,7 +3866,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr switch_image_t *mute_img = omember->video_mute_img ? omember->video_mute_img : omember->pcanvas_img; if (mute_img) { - switch_image_t *tmp; + switch_image_t *tmp = NULL; switch_img_copy(mute_img, &tmp); switch_img_fit(&tmp, layer->screen_w, layer->screen_h, SWITCH_FIT_SIZE); From e2c1e3a7d35534590bffb317abb92da541b38515 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 19 Sep 2019 22:21:30 +0400 Subject: [PATCH 075/118] FS-12055: [mod_sofia] Fix leaks and release profile properly in general_event_handler() and actual_sofia_presence_event_handler() --- src/mod/endpoints/mod_sofia/mod_sofia.c | 18 ++++++++++++------ src/mod/endpoints/mod_sofia/sofia_presence.c | 2 ++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 72ac5b01b9..61350bdf72 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -5384,6 +5384,9 @@ void general_event_handler(switch_event_t *event) if (zstr(dst->contact)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid contact uri [%s]\n", switch_str_nil(dst->contact)); + sofia_glue_free_destination(dst); + switch_safe_free(route_uri); + sofia_glue_release_profile(profile); return; } @@ -5410,10 +5413,10 @@ void general_event_handler(switch_event_t *event) switch_safe_free(route_uri); sofia_glue_free_destination(dst); - - sofia_glue_release_profile(profile); } + sofia_glue_release_profile(profile); + return; } else if (to_uri || from_uri) { if (!es) { @@ -5465,10 +5468,10 @@ void general_event_handler(switch_event_t *event) switch_safe_free(route_uri); sofia_glue_free_destination(dst); - - sofia_glue_release_profile(profile); } + sofia_glue_release_profile(profile); + return; } @@ -5647,6 +5650,7 @@ void general_event_handler(switch_event_t *event) if (!(list = sofia_reg_find_reg_url_multi(profile, user, host))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find registered user %s@%s\n", user, host); + sofia_glue_release_profile(profile); return; } @@ -5776,10 +5780,12 @@ void general_event_handler(switch_event_t *event) nua_handle_unref(nh); } - sofia_glue_release_profile(profile); - done: + if (profile) { + sofia_glue_release_profile(profile); + } + switch_safe_free(local_dup); } diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 6e5d15b381..be27121cd1 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1160,6 +1160,7 @@ static switch_event_t *actual_sofia_presence_event_handler(switch_event_t *event if (!mod_sofia_globals.profile_hash) { switch_console_free_matches(&matches); + sofia_glue_release_profile(profile); goto done; } @@ -1413,6 +1414,7 @@ static switch_event_t *actual_sofia_presence_event_handler(switch_event_t *event if (zstr(call_id) && (dh.hits && presence_source && (!strcasecmp(presence_source, "register") || switch_stristr("register", status)))) { + sofia_glue_release_profile(profile); goto done; } From 5addd7144c7b31d405b32de3697be439982c108b Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 20 Sep 2019 21:41:46 +0400 Subject: [PATCH 076/118] FS-12058: [sofia-sip] Fix scan-build issues in su_alloc.c --- libs/sofia-sip/.update | 2 +- libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c | 35 +++++++++++--------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index 3f2302fd37..4384659886 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Mon Sep 09 11:45:57 CDT 2019 +Fri Sep 20 12:16:57 CDT 2019 diff --git a/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c b/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c index e438a89543..67450734a2 100644 --- a/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c +++ b/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c @@ -210,8 +210,11 @@ su_inline void safefree(void *b) { b ? free(b) : (void)0; } #endif static inline su_block_t* MEMLOCK(const su_home_t *h) { - if (h && h->suh_lock) _su_home_locker(h->suh_lock); - return h->suh_blocks; + if (h) { + if (h->suh_lock) _su_home_locker(h->suh_lock); + return h->suh_blocks; + } + return NULL; } static inline void* UNLOCK(const su_home_t *h) { if (h && h->suh_lock) _su_home_unlocker(h->suh_lock); @@ -271,9 +274,9 @@ struct su_block_s { static void su_home_check_blocks(su_block_t const *b); -static void su_home_stats_alloc(su_block_t *, void *p, void *preload, +static void su_home_stats_alloc(su_block_t *, void *preload, size_t size, int zero); -static void su_home_stats_free(su_block_t *sub, void *p, void *preload, +static void su_home_stats_free(su_block_t *sub, void *preload, unsigned size); static void _su_home_deinit(su_home_t *home); @@ -529,7 +532,7 @@ void *sub_alloc(su_home_t *home, sua->sua_home = zero > 1; if (sub->sub_stats) - su_home_stats_alloc(sub, data, preload, size, zero); + su_home_stats_alloc(sub, preload, size, zero); } return data; @@ -923,7 +926,7 @@ void su_free(su_home_t *home, void *data) preloaded = data; if (sub->sub_stats) - su_home_stats_free(sub, data, preloaded, allocation->sua_size); + su_home_stats_free(sub, preloaded, allocation->sua_size); if (allocation->sua_home) { su_home_t *subhome = data; @@ -1425,8 +1428,8 @@ void *su_realloc(su_home_t *home, void *data, isize_t size) ndata = realloc(data, size + MEMCHECK_EXTRA); if (ndata) { if (sub->sub_stats) { - su_home_stats_free(sub, data, 0, sua->sua_size); - su_home_stats_alloc(sub, data, 0, size, 1); + su_home_stats_free(sub, 0, sua->sua_size); + su_home_stats_alloc(sub, 0, size, 1); } #if MEMCHECK_EXTRA @@ -1453,8 +1456,8 @@ void *su_realloc(su_home_t *home, void *data, isize_t size) if (p2 <= sub->sub_prsize) { /* Extend/reduce existing preload */ if (sub->sub_stats) { - su_home_stats_free(sub, data, data, sua->sua_size); - su_home_stats_alloc(sub, data, data, size, 0); + su_home_stats_free(sub, data, sua->sua_size); + su_home_stats_alloc(sub, data, size, 0); } sub->sub_prused = (unsigned)p2; @@ -1470,8 +1473,8 @@ void *su_realloc(su_home_t *home, void *data, isize_t size) else if (size < (size_t)sua->sua_size) { /* Reduce existing preload */ if (sub->sub_stats) { - su_home_stats_free(sub, data, data, sua->sua_size); - su_home_stats_alloc(sub, data, data, size, 0); + su_home_stats_free(sub, data, sua->sua_size); + su_home_stats_alloc(sub, data, size, 0); } #if MEMCHECK_EXTRA memcpy((char *)data + size, &term, sizeof (term)); @@ -1488,7 +1491,7 @@ void *su_realloc(su_home_t *home, void *data, isize_t size) /* Free preload */ sub->sub_prused = (char *)data - home->suh_blocks->sub_preload; if (sub->sub_stats) - su_home_stats_free(sub, data, data, sua->sua_size); + su_home_stats_free(sub, data, sua->sua_size); } memcpy(ndata, data, @@ -1500,7 +1503,7 @@ void *su_realloc(su_home_t *home, void *data, isize_t size) #endif if (sub->sub_stats) - su_home_stats_alloc(sub, data, 0, size, 1); + su_home_stats_alloc(sub, 0, size, 1); memset(sua, 0, sizeof *sua); sub->sub_used--; @@ -1837,7 +1840,7 @@ void su_home_get_stats(su_home_t *home, int include_clones, } static -void su_home_stats_alloc(su_block_t *sub, void *p, void *preload, +void su_home_stats_alloc(su_block_t *sub, void *preload, size_t size, int zero) { su_home_stat_t *hs = sub->sub_stats; @@ -1866,7 +1869,7 @@ void su_home_stats_alloc(su_block_t *sub, void *p, void *preload, } static -void su_home_stats_free(su_block_t *sub, void *p, void *preload, +void su_home_stats_free(su_block_t *sub, void *preload, unsigned size) { su_home_stat_t *hs = sub->sub_stats; From fc61fcfe6095cd9bb976306694fbf6c2470eb383 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 12 Sep 2019 23:38:28 +0400 Subject: [PATCH 077/118] FS-12050: [Core] Fix DataBase Handle (DBH) cache logic --- src/switch_core_sqldb.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 51fde6ebdf..4bae77fbfa 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -179,18 +179,27 @@ static switch_cache_db_handle_t *get_handle(const char *db_str, const char *user switch_mutex_lock(sql_manager.dbh_mutex); + /* First loop allows a thread to use a handle multiple times sumiltaneously + but only if that handle is in use by the same thread. In that case use_count will be incremented. + This allows SQLite to read and write within a single thread, giving the same handle for both operations. + */ for (dbh_ptr = sql_manager.handle_pool; dbh_ptr; dbh_ptr = dbh_ptr->next) { - if (dbh_ptr->thread_hash == thread_hash && dbh_ptr->hash == hash && !dbh_ptr->use_count && + if (dbh_ptr->thread_hash == thread_hash && dbh_ptr->hash == hash && !switch_test_flag(dbh_ptr, CDF_PRUNE) && switch_mutex_trylock(dbh_ptr->mutex) == SWITCH_STATUS_SUCCESS) { r = dbh_ptr; + break; } } if (!r) { + /* If a handle idles, take it and associate with the thread. + If a handle is in use, skip and create new one. + */ for (dbh_ptr = sql_manager.handle_pool; dbh_ptr; dbh_ptr = dbh_ptr->next) { - if (dbh_ptr->hash == hash && (dbh_ptr->type != SCDB_TYPE_DATABASE_INTERFACE || !dbh_ptr->use_count) && !switch_test_flag(dbh_ptr, CDF_PRUNE) && + if (dbh_ptr->hash == hash && !dbh_ptr->use_count && !switch_test_flag(dbh_ptr, CDF_PRUNE) && switch_mutex_trylock(dbh_ptr->mutex) == SWITCH_STATUS_SUCCESS) { r = dbh_ptr; + r->thread_hash = thread_hash; break; } } @@ -200,8 +209,6 @@ static switch_cache_db_handle_t *get_handle(const char *db_str, const char *user r->use_count++; r->total_used_count++; sql_manager.total_used_handles++; - r->hash = switch_ci_hashfunc_default(db_str, &hlen); - r->thread_hash = thread_hash; switch_set_string(r->last_user, user_str); } @@ -349,9 +356,7 @@ SWITCH_DECLARE(void) switch_cache_db_release_db_handle(switch_cache_db_handle_t (*dbh)->io_mutex = NULL; if ((*dbh)->use_count) { - if (--(*dbh)->use_count == 0) { - (*dbh)->thread_hash = 1; - } + --(*dbh)->use_count; } switch_mutex_unlock((*dbh)->mutex); sql_manager.total_used_handles--; From 4eca43bc628c5f94e8445514228996e49513872a Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 13 Sep 2019 20:28:38 +0400 Subject: [PATCH 078/118] FS-12048: [Core] Fix leak in SQLite (switch_cache_db_execute_sql2str) when queries return a NULL containing field which may result in high memory consumption. --- Freeswitch.2017.sln | 15 ++ src/include/switch_core_db.h | 47 ++--- src/switch_core_db.c | 10 +- src/switch_core_sqldb.c | 2 - tests/unit/Makefile.am | 2 +- tests/unit/switch_core_db.c | 75 ++++++++ tests/unit/test_switch_core_db.2017.vcxproj | 203 ++++++++++++++++++++ 7 files changed, 319 insertions(+), 35 deletions(-) create mode 100644 tests/unit/switch_core_db.c create mode 100644 tests/unit/test_switch_core_db.2017.vcxproj diff --git a/Freeswitch.2017.sln b/Freeswitch.2017.sln index 537439a95d..c324093a86 100644 --- a/Freeswitch.2017.sln +++ b/Freeswitch.2017.sln @@ -586,6 +586,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_pgsql", "src\mod\databa EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_mariadb", "src\mod\databases\mod_mariadb\mod_mariadb.2017.vcxproj", "{0B612F84-7533-4DEC-AEDD-5C9CBCF15EAC}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_switch_core_db", "tests\unit\test_switch_core_db.2017.vcxproj", "{580675D7-C1C9-4197-AAC5-00F64FAFDE78}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -2689,6 +2691,18 @@ Global {0B612F84-7533-4DEC-AEDD-5C9CBCF15EAC}.Release|Win32.Build.0 = Release|Win32 {0B612F84-7533-4DEC-AEDD-5C9CBCF15EAC}.Release|x64.ActiveCfg = Release|x64 {0B612F84-7533-4DEC-AEDD-5C9CBCF15EAC}.Release|x64.Build.0 = Release|x64 + {580675D7-C1C9-4197-AAC5-00F64FAFDE78}.All|Win32.ActiveCfg = Release|Win32 + {580675D7-C1C9-4197-AAC5-00F64FAFDE78}.All|Win32.Build.0 = Release|Win32 + {580675D7-C1C9-4197-AAC5-00F64FAFDE78}.All|x64.ActiveCfg = Release|x64 + {580675D7-C1C9-4197-AAC5-00F64FAFDE78}.All|x64.Build.0 = Release|x64 + {580675D7-C1C9-4197-AAC5-00F64FAFDE78}.Debug|Win32.ActiveCfg = Debug|Win32 + {580675D7-C1C9-4197-AAC5-00F64FAFDE78}.Debug|Win32.Build.0 = Debug|Win32 + {580675D7-C1C9-4197-AAC5-00F64FAFDE78}.Debug|x64.ActiveCfg = Debug|x64 + {580675D7-C1C9-4197-AAC5-00F64FAFDE78}.Debug|x64.Build.0 = Debug|x64 + {580675D7-C1C9-4197-AAC5-00F64FAFDE78}.Release|Win32.ActiveCfg = Release|Win32 + {580675D7-C1C9-4197-AAC5-00F64FAFDE78}.Release|Win32.Build.0 = Release|Win32 + {580675D7-C1C9-4197-AAC5-00F64FAFDE78}.Release|x64.ActiveCfg = Release|x64 + {580675D7-C1C9-4197-AAC5-00F64FAFDE78}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2901,6 +2915,7 @@ Global {BC1FD72E-1CD5-4525-A7F5-17C5740BFDED} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {1BA65811-5453-46F6-8190-9ECEEFEB7DF2} = {31C2761D-20E0-4BF8-98B9-E32F0D8DD6E1} {0B612F84-7533-4DEC-AEDD-5C9CBCF15EAC} = {31C2761D-20E0-4BF8-98B9-E32F0D8DD6E1} + {580675D7-C1C9-4197-AAC5-00F64FAFDE78} = {9388C266-C3FC-468A-92EF-0CBC35941412} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {09840DE7-9208-45AA-9667-1A71EE93BD1E} diff --git a/src/include/switch_core_db.h b/src/include/switch_core_db.h index a2d0fd20f7..4a6b3eb4bf 100644 --- a/src/include/switch_core_db.h +++ b/src/include/switch_core_db.h @@ -103,41 +103,42 @@ SWITCH_DECLARE(int) switch_core_db_close(switch_core_db_t *db); SWITCH_DECLARE(int) switch_core_db_open(const char *filename, switch_core_db_t **ppDb); /** - * The next group of routines returns information about the information - * in a single column of the current result row of a query. In every - * case the first parameter is a pointer to the SQL statement that is being - * executed (the switch_core_db_stmt_t* that was returned from switch_core_db_prepare()) and - * the second argument is the index of the column for which information - * should be returned. iCol is zero-indexed. The left-most column as an - * index of 0. + * ^Strings returned by sqlite3_column_text() and sqlite3_column_text16(), + * even empty strings, are always zero-terminated. ^The return + * value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer. * - * If the SQL statement is not currently point to a valid row, or if the - * the colulmn index is out of range, the result is undefined. + * ^The object returned by [sqlite3_column_value()] is an + * [unprotected sqlite3_value] object. An unprotected sqlite3_value object + * may only be used with [sqlite3_bind_value()] and [sqlite3_result_value()]. + * If the [unprotected sqlite3_value] object returned by + * [sqlite3_column_value()] is used in any other way, including calls + * to routines like [sqlite3_value_int()], [sqlite3_value_text()], + * or [sqlite3_value_bytes()], then the behavior is undefined. * - * These routines attempt to convert the value where appropriate. For + * These routines attempt to convert the value where appropriate. ^For * example, if the internal representation is FLOAT and a text result - * is requested, sprintf() is used internally to do the conversion - * automatically. The following table details the conversions that - * are applied: + * is requested, [sqlite3_snprintf()] is used internally to perform the + * conversion automatically. ^(The following table details the conversions + * that are applied: * * Internal Type Requested Type Conversion * ------------- -------------- -------------------------- * NULL INTEGER Result is 0 * NULL FLOAT Result is 0.0 - * NULL TEXT Result is an empty string - * NULL BLOB Result is a zero-length BLOB + * NULL TEXT Result is a NULL pointer + * NULL BLOB Result is a NULL pointer * INTEGER FLOAT Convert from integer to float * INTEGER TEXT ASCII rendering of the integer - * INTEGER BLOB Same as for INTEGER->TEXT - * FLOAT INTEGER Convert from float to integer + * INTEGER BLOB Same as INTEGER->TEXT + * FLOAT INTEGER [CAST] to INTEGER * FLOAT TEXT ASCII rendering of the float - * FLOAT BLOB Same as FLOAT->TEXT - * TEXT INTEGER Use atoi() - * TEXT FLOAT Use atof() + * FLOAT BLOB [CAST] to BLOB + * TEXT INTEGER [CAST] to INTEGER + * TEXT FLOAT [CAST] to REAL * TEXT BLOB No change - * BLOB INTEGER Convert to TEXT then use atoi() - * BLOB FLOAT Convert to TEXT then use atof() - * BLOB TEXT Add a "\000" terminator if needed + * BLOB INTEGER [CAST] to INTEGER + * BLOB FLOAT [CAST] to REAL + * BLOB TEXT Add a zero terminator if needed * * Return the value as UTF-8 text. */ diff --git a/src/switch_core_db.c b/src/switch_core_db.c index 5c9efae882..ae118b7694 100644 --- a/src/switch_core_db.c +++ b/src/switch_core_db.c @@ -57,15 +57,7 @@ SWITCH_DECLARE(int) switch_core_db_close(switch_core_db_t *db) SWITCH_DECLARE(const unsigned char *) switch_core_db_column_text(switch_core_db_stmt_t *stmt, int iCol) { - const unsigned char *txt = sqlite3_column_text(stmt, iCol); - - if (!strcasecmp((char *) stmt, "(null)")) { - memset(stmt, 0, 1); - txt = NULL; - } - - return txt; - + return sqlite3_column_text(stmt, iCol); } SWITCH_DECLARE(const char *) switch_core_db_column_name(switch_core_db_stmt_t *stmt, int N) diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 4bae77fbfa..ffc82aa2e5 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -884,8 +884,6 @@ SWITCH_DECLARE(char *) switch_cache_db_execute_sql2str(switch_cache_db_handle_t if ((txt = switch_core_db_column_text(stmt, 0))) { switch_copy_string(str, (char *) txt, len); status = SWITCH_STATUS_SUCCESS; - } else { - goto end; } } break; diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index 2b5f953997..de5e164911 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -2,7 +2,7 @@ include $(top_srcdir)/build/modmake.rulesam noinst_PROGRAMS = switch_event switch_hash switch_ivr_originate switch_utils switch_core switch_console switch_vpx switch_core_file \ switch_ivr_play_say switch_core_codec switch_rtp -noinst_PROGRAMS+= switch_core_video +noinst_PROGRAMS+= switch_core_video switch_core_db AM_LDFLAGS = -avoid-version -no-undefined $(SWITCH_AM_LDFLAGS) $(openssl_LIBS) AM_LDFLAGS += $(FREESWITCH_LIBS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS) AM_CFLAGS = $(SWITCH_AM_CPPFLAGS) diff --git a/tests/unit/switch_core_db.c b/tests/unit/switch_core_db.c new file mode 100644 index 0000000000..50a004fed5 --- /dev/null +++ b/tests/unit/switch_core_db.c @@ -0,0 +1,75 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2018, 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 + * Anthony Minessale II + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Chris Rienzo + * Andrey Volk + * + * + * switch_core_db.c -- tests core db functions + * + */ +#include +#include + +#include + +FST_CORE_BEGIN("./conf") +{ + FST_SUITE_BEGIN(switch_core_db) + { + FST_SETUP_BEGIN() + { + } + FST_SETUP_END() + + FST_TEARDOWN_BEGIN() + { + } + FST_TEARDOWN_END() + + FST_TEST_BEGIN(test_switch_cache_db_execute_sql2str) + { + switch_cache_db_handle_t *dbh = NULL; + char *dsn = "test_switch_cache_db_execute_sql2str.db"; + char res1[20] = "test"; + char res2[20] = "test"; + + if (switch_cache_db_get_db_handle_dsn(&dbh, dsn) == SWITCH_STATUS_SUCCESS) { + + switch_cache_db_execute_sql2str(dbh, "SELECT 1", (char *)&res1, 20, NULL); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "SELECT 1: %s\n", switch_str_nil(res1)); + + switch_cache_db_execute_sql2str(dbh, "SELECT NULL", (char *)&res2, 20, NULL); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "SELECT NULL: %s\n", switch_str_nil(res2)); + + } + + fst_check_string_equals(res1, "1"); + fst_check_string_equals(res2, ""); + } + FST_TEST_END() + } + FST_SUITE_END() +} +FST_CORE_END() diff --git a/tests/unit/test_switch_core_db.2017.vcxproj b/tests/unit/test_switch_core_db.2017.vcxproj new file mode 100644 index 0000000000..33959b2827 --- /dev/null +++ b/tests/unit/test_switch_core_db.2017.vcxproj @@ -0,0 +1,203 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + test_switch_core_db + test_switch_core_db + Win32Proj + 10.0.17134.0 + {580675D7-C1C9-4197-AAC5-00F64FAFDE78} + + + + Application + MultiByte + v141 + + + Application + MultiByte + v141 + + + Application + MultiByte + v141 + + + Application + MultiByte + v141 + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + false + $(SolutionDir)$(PlatformName)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + $(SolutionDir)$(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + false + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + + + + $(SolutionDir)src\include;%(AdditionalIncludeDirectories) + SWITCH_TEST_BASE_DIR_FOR_CONF="..\\..\\tests\\unit\\";%(PreprocessorDefinitions) + + + + + + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level4 + ProgramDatabase + true + 6031;6340;6246;6011;6387;%(DisableSpecificWarnings) + + + $(OutDir);%(AdditionalLibraryDirectories) + true + Console + true + + + MachineX86 + + + + + + X64 + + + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level4 + ProgramDatabase + true + 6031;6340;6246;6011;6387;%(DisableSpecificWarnings) + + + $(OutDir);%(AdditionalLibraryDirectories) + true + Console + true + + + MachineX64 + + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level4 + ProgramDatabase + 6031;6340;6246;6011;6387;%(DisableSpecificWarnings) + + + $(OutDir);%(AdditionalLibraryDirectories) + false + Console + true + true + true + + + MachineX86 + + + + + + X64 + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level4 + ProgramDatabase + 6031;6340;6246;6011;6387;%(DisableSpecificWarnings) + + + $(OutDir);%(AdditionalLibraryDirectories) + false + Console + true + true + true + + + MachineX64 + + + + + + + + {202d7a4e-760d-4d0e-afa1-d7459ced30ff} + + + + + + \ No newline at end of file From aec1cbd236cfb62240bd1b07bac63844ce57e4ec Mon Sep 17 00:00:00 2001 From: Seven Du Date: Tue, 9 Apr 2019 21:11:11 +0800 Subject: [PATCH 079/118] FS-11773 add callID to conference private event --- src/mod/applications/mod_conference/conference_event.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/applications/mod_conference/conference_event.c b/src/mod/applications/mod_conference/conference_event.c index 9b7f748ae8..d293630167 100644 --- a/src/mod/applications/mod_conference/conference_event.c +++ b/src/mod/applications/mod_conference/conference_event.c @@ -650,6 +650,7 @@ void conference_event_adv_la(conference_obj_t *conference, conference_member_t * cJSON_AddItemToObject(msg, "eventChannel", cJSON_CreateString(event_channel)); cJSON_AddItemToObject(msg, "eventType", cJSON_CreateString("channelPvtData")); + cJSON_AddStringToObject(msg, "callID", switch_core_session_get_uuid(member->session)); cJSON_AddItemToObject(data, "action", cJSON_CreateString(join ? "conference-liveArray-join" : "conference-liveArray-part")); cJSON_AddItemToObject(data, "laChannel", cJSON_CreateString(conference->la_event_channel)); From fa18a3d0d618664b2ecc6c39c9b1a7c90c2f6dff Mon Sep 17 00:00:00 2001 From: Seven Du Date: Tue, 4 Jun 2019 21:17:00 +0800 Subject: [PATCH 080/118] FS-11877 fix regression from FS-11773 27ce89a6a2a rename callID to sessionCallID since it breaks VC --- src/mod/applications/mod_conference/conference_event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_conference/conference_event.c b/src/mod/applications/mod_conference/conference_event.c index d293630167..6977b8a494 100644 --- a/src/mod/applications/mod_conference/conference_event.c +++ b/src/mod/applications/mod_conference/conference_event.c @@ -650,8 +650,8 @@ void conference_event_adv_la(conference_obj_t *conference, conference_member_t * cJSON_AddItemToObject(msg, "eventChannel", cJSON_CreateString(event_channel)); cJSON_AddItemToObject(msg, "eventType", cJSON_CreateString("channelPvtData")); - cJSON_AddStringToObject(msg, "callID", switch_core_session_get_uuid(member->session)); + cJSON_AddStringToObject(data, "callID", switch_core_session_get_uuid(member->session)); cJSON_AddItemToObject(data, "action", cJSON_CreateString(join ? "conference-liveArray-join" : "conference-liveArray-part")); cJSON_AddItemToObject(data, "laChannel", cJSON_CreateString(conference->la_event_channel)); cJSON_AddItemToObject(data, "laName", cJSON_CreateString(conference->la_name)); From 9847a8915f2a909edf735d7eb6851c56281a7b47 Mon Sep 17 00:00:00 2001 From: Liyang Date: Thu, 28 Feb 2019 19:24:13 +0800 Subject: [PATCH 081/118] FS-11677: [mod_video_filter] support api/app to replace the write video of session with a bug https://freeswitch.org/jira/browse/FS-11677 --- .../mod_video_filter/mod_video_filter.c | 253 +++++++++++++++++- 1 file changed, 252 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_video_filter/mod_video_filter.c b/src/mod/applications/mod_video_filter/mod_video_filter.c index 8645fdb0d0..dcb1fc8bca 100644 --- a/src/mod/applications/mod_video_filter/mod_video_filter.c +++ b/src/mod/applications/mod_video_filter/mod_video_filter.c @@ -70,7 +70,13 @@ typedef struct chromakey_child_context_s { } chromakey_child_context_t; - +typedef struct video_replace_context_s { + switch_image_t *rp_img; + switch_file_handle_t vfh; + switch_core_session_t *session; +} video_replace_context_t; + + static void init_context(chromakey_context_t *context) { switch_color_set_rgb(&context->bgcolor, "#000000"); @@ -817,6 +823,245 @@ SWITCH_STANDARD_API(chromakey_api_function) return SWITCH_STATUS_SUCCESS; } +static switch_status_t video_replace_thread_callback(switch_core_session_t *session, switch_frame_t *frame, void *user_data) +{ + video_replace_context_t *context = (video_replace_context_t *)user_data; + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_frame_t file_frame = { 0 }; + + if (!switch_channel_ready(channel)) { + return SWITCH_STATUS_FALSE; + } + + if (!frame->img) { + return SWITCH_STATUS_SUCCESS; + } + + if (switch_test_flag(&context->vfh, SWITCH_FILE_OPEN)) { + switch_status_t status = SWITCH_STATUS_FALSE; + + context->vfh.mm.scale_w = frame->img->d_w; + context->vfh.mm.scale_h = frame->img->d_h; + + status = switch_core_file_read_video(&context->vfh, &file_frame, SVR_FLUSH); + switch_core_file_command(&context->vfh, SCFC_FLUSH_AUDIO); + + if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) { + int close = 1; + + if (context->vfh.params) { + const char *loopstr = switch_event_get_header(context->vfh.params, "loop"); + if (switch_true(loopstr)) { + uint32_t pos = 0; + switch_core_file_seek(&context->vfh, &pos, 0, SEEK_SET); + close = 0; + } + } + + if (close) { + switch_core_file_close(&context->vfh); + } + } else if (file_frame.img) { + switch_img_free(&context->rp_img); + switch_img_copy(file_frame.img, &context->rp_img); + switch_img_free(&(file_frame.img)); + } + + if (context->rp_img) { + switch_img_copy(context->rp_img, &frame->img); + } + } + + return SWITCH_STATUS_SUCCESS; +} + +static switch_bool_t video_replace_bug_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type) +{ + video_replace_context_t *context = (video_replace_context_t *)user_data; + + switch (type) { + case SWITCH_ABC_TYPE_INIT: + { + } + break; + case SWITCH_ABC_TYPE_CLOSE: + { + switch_thread_rwlock_unlock(MODULE_INTERFACE->rwlock); + switch_img_free(&context->rp_img); + + if (switch_test_flag(&context->vfh, SWITCH_FILE_OPEN)) { + switch_core_file_close(&context->vfh); + memset(&context->vfh, 0, sizeof(context->vfh)); + } + } + break; + case SWITCH_ABC_TYPE_READ_VIDEO_PING: + case SWITCH_ABC_TYPE_VIDEO_PATCH: + { + switch_frame_t *frame = switch_core_media_bug_get_video_ping_frame(bug); + video_replace_thread_callback(context->session, frame, context); + } + break; + default: + break; + } + + return SWITCH_TRUE; +} + +SWITCH_STANDARD_APP(video_replace_start_function) +{ + switch_media_bug_t *bug; + switch_status_t status; + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_media_bug_flag_t flags = SMBF_READ_VIDEO_PING|SMBF_READ_VIDEO_PATCH; + const char *function = "video_replace"; + video_replace_context_t *context; + + if ((bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_video_replace_bug_"))) { + if (!zstr(data) && !strcasecmp(data, "stop")) { + switch_channel_set_private(channel, "_video_replace_bug_", NULL); + switch_core_media_bug_remove(session, &bug); + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "alreday start!\n"); + } + return; + } + + switch_channel_wait_for_flag(channel, CF_VIDEO_READY, SWITCH_TRUE, 10000, NULL); + + context = (video_replace_context_t *) switch_core_session_alloc(session, sizeof(*context)); + switch_assert(context != NULL); + memset(context, 0, sizeof(*context)); + context->session = session; + + switch_thread_rwlock_rdlock(MODULE_INTERFACE->rwlock); + + if (switch_core_file_open(&context->vfh, data, 1, 8000, + SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT | SWITCH_FILE_FLAG_VIDEO, + switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening video file\n"); + switch_thread_rwlock_unlock(MODULE_INTERFACE->rwlock); + return; + } + + if ((status = switch_core_media_bug_add(session, function, NULL, video_replace_bug_callback, context, 0, flags, &bug)) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failure!\n"); + switch_thread_rwlock_unlock(MODULE_INTERFACE->rwlock); + return; + } + + switch_channel_set_private(channel, "_video_replace_bug_", bug); +} + +/* API Interface Function */ +#define VIDEO_REPLACE_API_SYNTAX " [start|stop] " +SWITCH_STANDARD_API(video_replace_api_function) +{ + switch_core_session_t *rsession = NULL; + switch_channel_t *channel = NULL; + switch_media_bug_t *bug; + switch_status_t status; + video_replace_context_t *context; + char *mycmd = NULL; + int argc = 0; + char *argv[3] = { 0 }; + char *uuid = NULL; + char *action = NULL; + char *file = NULL; + switch_media_bug_flag_t flags = SMBF_READ_VIDEO_PING | SMBF_READ_VIDEO_PATCH; + const char *function = "video_replace"; + + if (zstr(cmd)) { + goto usage; + } + + if (!(mycmd = strdup(cmd))) { + goto usage; + } + + if ((argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 2) { + goto usage; + } + + uuid = argv[0]; + action = argv[1]; + file = argv[2]; + + if (!(rsession = switch_core_session_locate(uuid))) { + stream->write_function(stream, "-ERR Cannot locate session!\n"); + goto done; + } + + channel = switch_core_session_get_channel(rsession); + + bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_video_replace_bug_"); + + if (!strcasecmp(action, "stop")) { + if (bug) { + switch_channel_set_private(channel, "_video_replace_bug_", NULL); + switch_core_media_bug_remove(rsession, &bug); + stream->write_function(stream, "+OK Success\n"); + } else { + stream->write_function(stream, "-ERR not start\n"); + } + + goto done; + } else if (!strcasecmp(action, "start")) { + if (zstr(file)) goto usage; + + if (bug) { + stream->write_function(stream, "-ERR alreday start\n"); + goto done; + } + } else { + goto usage; + } + + context = (video_replace_context_t *) switch_core_session_alloc(rsession, sizeof(*context)); + switch_assert(context != NULL); + context->session = rsession; + + switch_thread_rwlock_rdlock(MODULE_INTERFACE->rwlock); + + if (switch_core_file_open(&context->vfh, file, 1, 8000, + SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT | SWITCH_FILE_FLAG_VIDEO, + switch_core_session_get_pool(rsession)) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening video file\n"); + switch_thread_rwlock_unlock(MODULE_INTERFACE->rwlock); + goto done; + } else { + switch_vid_params_t vp = { 0 }; + + switch_core_media_get_vid_params(context->session, &vp); + context->vfh.mm.scale_w = vp.width; + context->vfh.mm.scale_h = vp.height; + context->vfh.mm.fps = vp.fps; + } + + if ((status = switch_core_media_bug_add(rsession, function, NULL, + video_replace_bug_callback, context, 0, flags, &bug)) != SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "-ERR Failure!\n"); + switch_thread_rwlock_unlock(MODULE_INTERFACE->rwlock); + goto done; + } else { + switch_channel_set_private(channel, "_video_replace_bug_", bug); + stream->write_function(stream, "+OK Success\n"); + goto done; + } + + usage: + stream->write_function(stream, "-USAGE: %s\n", VIDEO_REPLACE_API_SYNTAX); + + done: + if (rsession) { + switch_core_session_rwunlock(rsession); + } + + switch_safe_free(mycmd); + return SWITCH_STATUS_SUCCESS; +} + SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_video_filter_shutdown) { @@ -837,7 +1082,13 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_video_filter_load) SWITCH_ADD_API(api_interface, "chromakey", "chromakey", chromakey_api_function, CHROMAKEY_API_SYNTAX); + SWITCH_ADD_APP(app_interface, "video_replace", "video_replace", "video replace bug", + video_replace_start_function, "", SAF_NONE); + + SWITCH_ADD_API(api_interface, "video_replace", "video_replace", video_replace_api_function, VIDEO_REPLACE_API_SYNTAX); + switch_console_set_complete("add chromakey ::console::list_uuid ::[start:stop"); + switch_console_set_complete("add video_replace ::console::list_uuid ::[start:stop"); return SWITCH_STATUS_SUCCESS; } From 4d2f3fc5eca48da22565a2d3063430488b7b638d Mon Sep 17 00:00:00 2001 From: Liyang Date: Wed, 6 Mar 2019 15:17:05 +0800 Subject: [PATCH 082/118] FS-11677: [mod_video_filter] fix memory leak and support replace read/write video of session with a bug https://freeswitch.org/jira/browse/FS-11677 --- .../mod_video_filter/mod_video_filter.c | 110 +++++++++++++----- 1 file changed, 81 insertions(+), 29 deletions(-) diff --git a/src/mod/applications/mod_video_filter/mod_video_filter.c b/src/mod/applications/mod_video_filter/mod_video_filter.c index dcb1fc8bca..3cd8c84ce9 100644 --- a/src/mod/applications/mod_video_filter/mod_video_filter.c +++ b/src/mod/applications/mod_video_filter/mod_video_filter.c @@ -823,7 +823,7 @@ SWITCH_STANDARD_API(chromakey_api_function) return SWITCH_STATUS_SUCCESS; } -static switch_status_t video_replace_thread_callback(switch_core_session_t *session, switch_frame_t *frame, void *user_data) +static switch_status_t video_replace_thread_callback(switch_core_session_t *session, switch_frame_t *frame, void *user_data, switch_abc_type_t type) { video_replace_context_t *context = (video_replace_context_t *)user_data; switch_channel_t *channel = switch_core_session_get_channel(session); @@ -840,8 +840,10 @@ static switch_status_t video_replace_thread_callback(switch_core_session_t *sess if (switch_test_flag(&context->vfh, SWITCH_FILE_OPEN)) { switch_status_t status = SWITCH_STATUS_FALSE; - context->vfh.mm.scale_w = frame->img->d_w; - context->vfh.mm.scale_h = frame->img->d_h; + if (type == SWITCH_ABC_TYPE_READ_VIDEO_PING || (context->vfh.params && switch_true(switch_event_get_header(context->vfh.params, "scale")))) { + context->vfh.mm.scale_w = frame->img->d_w; + context->vfh.mm.scale_h = frame->img->d_h; + } status = switch_core_file_read_video(&context->vfh, &file_frame, SVR_FLUSH); switch_core_file_command(&context->vfh, SCFC_FLUSH_AUDIO); @@ -853,21 +855,26 @@ static switch_status_t video_replace_thread_callback(switch_core_session_t *sess const char *loopstr = switch_event_get_header(context->vfh.params, "loop"); if (switch_true(loopstr)) { uint32_t pos = 0; - switch_core_file_seek(&context->vfh, &pos, 0, SEEK_SET); - close = 0; + + if (switch_core_file_seek(&context->vfh, &pos, 0, SEEK_SET) == SWITCH_STATUS_SUCCESS) close = 0; } } if (close) { switch_core_file_close(&context->vfh); } - } else if (file_frame.img) { - switch_img_free(&context->rp_img); - switch_img_copy(file_frame.img, &context->rp_img); - switch_img_free(&(file_frame.img)); + } + + if (file_frame.img) { + switch_img_free(&(context->rp_img)); + context->rp_img = file_frame.img; } if (context->rp_img) { + if (context->rp_img->d_w != frame->img->d_w || context->rp_img->d_h != frame->img->d_h ) { + frame->img = NULL; + } + switch_img_copy(context->rp_img, &frame->img); } } @@ -877,6 +884,8 @@ static switch_status_t video_replace_thread_callback(switch_core_session_t *sess static switch_bool_t video_replace_bug_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type) { + switch_core_session_t *session = switch_core_media_bug_get_session(bug); + switch_channel_t *channel = switch_core_session_get_channel(session); video_replace_context_t *context = (video_replace_context_t *)user_data; switch (type) { @@ -896,10 +905,15 @@ static switch_bool_t video_replace_bug_callback(switch_media_bug_t *bug, void *u } break; case SWITCH_ABC_TYPE_READ_VIDEO_PING: - case SWITCH_ABC_TYPE_VIDEO_PATCH: + case SWITCH_ABC_TYPE_WRITE_VIDEO_PING: { - switch_frame_t *frame = switch_core_media_bug_get_video_ping_frame(bug); - video_replace_thread_callback(context->session, frame, context); + if (switch_test_flag(&context->vfh, SWITCH_FILE_OPEN)) { + switch_frame_t *frame = switch_core_media_bug_get_video_ping_frame(bug); + video_replace_thread_callback(context->session, frame, context, type); + } else { + switch_channel_set_private(channel, "_video_replace_bug_", NULL); + return SWITCH_FALSE; + } } break; default: @@ -914,9 +928,14 @@ SWITCH_STANDARD_APP(video_replace_start_function) switch_media_bug_t *bug; switch_status_t status; switch_channel_t *channel = switch_core_session_get_channel(session); - switch_media_bug_flag_t flags = SMBF_READ_VIDEO_PING|SMBF_READ_VIDEO_PATCH; + switch_media_bug_flag_t flags = 0; const char *function = "video_replace"; video_replace_context_t *context; + char *lbuf; + int argc = 0; + char *argv[2] = { 0 }; + char *direction = NULL; + char *file = NULL; if ((bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_video_replace_bug_"))) { if (!zstr(data) && !strcasecmp(data, "stop")) { @@ -928,6 +947,29 @@ SWITCH_STANDARD_APP(video_replace_start_function) return; } + if (data && (lbuf = switch_core_session_strdup(session, data)) + && (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) > 0) { + + if (argc > 1) { + direction = argv[0]; + file = argv[1]; + } else { + direction = "write"; + file = lbuf; + } + + if (!strcasecmp(direction, "read")) { + flags = SMBF_READ_VIDEO_PING; + } else if (!strcasecmp(direction, "write")) { + flags = SMBF_WRITE_VIDEO_PING; + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "invalid replace direction!\n"); + return; + } + } else { + return; + } + switch_channel_wait_for_flag(channel, CF_VIDEO_READY, SWITCH_TRUE, 10000, NULL); context = (video_replace_context_t *) switch_core_session_alloc(session, sizeof(*context)); @@ -937,7 +979,7 @@ SWITCH_STANDARD_APP(video_replace_start_function) switch_thread_rwlock_rdlock(MODULE_INTERFACE->rwlock); - if (switch_core_file_open(&context->vfh, data, 1, 8000, + if (switch_core_file_open(&context->vfh, file, 1, 8000, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT | SWITCH_FILE_FLAG_VIDEO, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening video file\n"); @@ -955,7 +997,7 @@ SWITCH_STANDARD_APP(video_replace_start_function) } /* API Interface Function */ -#define VIDEO_REPLACE_API_SYNTAX " [start|stop] " +#define VIDEO_REPLACE_API_SYNTAX " [read|write] " SWITCH_STANDARD_API(video_replace_api_function) { switch_core_session_t *rsession = NULL; @@ -965,11 +1007,12 @@ SWITCH_STANDARD_API(video_replace_api_function) video_replace_context_t *context; char *mycmd = NULL; int argc = 0; - char *argv[3] = { 0 }; + char *argv[4] = { 0 }; char *uuid = NULL; char *action = NULL; char *file = NULL; - switch_media_bug_flag_t flags = SMBF_READ_VIDEO_PING | SMBF_READ_VIDEO_PATCH; + char *direction = NULL; + switch_media_bug_flag_t flags = 0; const char *function = "video_replace"; if (zstr(cmd)) { @@ -986,7 +1029,6 @@ SWITCH_STANDARD_API(video_replace_api_function) uuid = argv[0]; action = argv[1]; - file = argv[2]; if (!(rsession = switch_core_session_locate(uuid))) { stream->write_function(stream, "-ERR Cannot locate session!\n"); @@ -1008,7 +1050,23 @@ SWITCH_STANDARD_API(video_replace_api_function) goto done; } else if (!strcasecmp(action, "start")) { - if (zstr(file)) goto usage; + if (argc == 3) { + direction = "write"; + file = argv[2]; + } else { + direction = argv[2]; + file = argv[3]; + } + + if (zstr(direction) || zstr(file)) goto usage; + + if (!strcasecmp(direction, "read")) { + flags = SMBF_READ_VIDEO_PING; + } else if (!strcasecmp(direction, "write")) { + flags = SMBF_WRITE_VIDEO_PING; + } else { + goto usage; + } if (bug) { stream->write_function(stream, "-ERR alreday start\n"); @@ -1030,13 +1088,6 @@ SWITCH_STANDARD_API(video_replace_api_function) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening video file\n"); switch_thread_rwlock_unlock(MODULE_INTERFACE->rwlock); goto done; - } else { - switch_vid_params_t vp = { 0 }; - - switch_core_media_get_vid_params(context->session, &vp); - context->vfh.mm.scale_w = vp.width; - context->vfh.mm.scale_h = vp.height; - context->vfh.mm.fps = vp.fps; } if ((status = switch_core_media_bug_add(rsession, function, NULL, @@ -1083,12 +1134,13 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_video_filter_load) SWITCH_ADD_API(api_interface, "chromakey", "chromakey", chromakey_api_function, CHROMAKEY_API_SYNTAX); SWITCH_ADD_APP(app_interface, "video_replace", "video_replace", "video replace bug", - video_replace_start_function, "", SAF_NONE); + video_replace_start_function, "[read|write] | stop", SAF_NONE); - SWITCH_ADD_API(api_interface, "video_replace", "video_replace", video_replace_api_function, VIDEO_REPLACE_API_SYNTAX); + SWITCH_ADD_API(api_interface, "uuid_video_replace", "video_replace", video_replace_api_function, VIDEO_REPLACE_API_SYNTAX); switch_console_set_complete("add chromakey ::console::list_uuid ::[start:stop"); - switch_console_set_complete("add video_replace ::console::list_uuid ::[start:stop"); + switch_console_set_complete("add uuid_video_replace ::console::list_uuid start ::[read:write"); + switch_console_set_complete("add uuid_video_replace ::console::list_uuid stop"); return SWITCH_STATUS_SUCCESS; } From 05dbd8bd05cc55fea43a723b96564efc1c2cc73b Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Mon, 7 Oct 2019 19:57:46 +0400 Subject: [PATCH 083/118] [mod_distributor] Fix leak of xml object when no lists in config. --- src/mod/applications/mod_distributor/mod_distributor.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/applications/mod_distributor/mod_distributor.c b/src/mod/applications/mod_distributor/mod_distributor.c index cbdcc987ed..a653514f89 100644 --- a/src/mod/applications/mod_distributor/mod_distributor.c +++ b/src/mod/applications/mod_distributor/mod_distributor.c @@ -128,6 +128,7 @@ static int load_config(int reloading) if (!(lists = switch_xml_child(cfg, "lists"))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find any lists!\n"); + switch_xml_free(xml); return status; } From 5fd6299267bed8d3c633d7e692e4a3b55972ecf7 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Mon, 7 Oct 2019 20:54:52 +0400 Subject: [PATCH 084/118] [mod_hiredis] Xml object is not freed on load. --- src/mod/applications/mod_hiredis/hiredis_utils.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mod/applications/mod_hiredis/hiredis_utils.c b/src/mod/applications/mod_hiredis/hiredis_utils.c index e90ba6c1ee..ced3f589a2 100644 --- a/src/mod/applications/mod_hiredis/hiredis_utils.c +++ b/src/mod/applications/mod_hiredis/hiredis_utils.c @@ -115,10 +115,14 @@ switch_status_t mod_hiredis_do_config() goto err; } + switch_xml_free(xml); return SWITCH_STATUS_SUCCESS; err: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Configuration failed\n"); + if (xml) { + switch_xml_free(xml); + } return SWITCH_STATUS_GENERR; } From 8442218df134e9f775574e6188f4213622bc721e Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Mon, 7 Oct 2019 22:37:33 +0400 Subject: [PATCH 085/118] [mod_sofia] sofia_handle_sip_i_invite() leaks xml and event objects on acl_token, sofia_reg_handle_sip_r_challenge() leaks xml object when a user does not have params. --- src/mod/endpoints/mod_sofia/sofia.c | 7 +++++++ src/mod/endpoints/mod_sofia/sofia_reg.c | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index bc3d9da995..aedfb66e56 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -10537,6 +10537,10 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia switch_channel_set_variable_printf(channel, "sip_invite_stamp", "%" SWITCH_TIME_T_FMT, sip_invite_time); if (*acl_token) { + if (x_user) { + switch_xml_free(x_user); + x_user = NULL; + } switch_channel_set_variable(channel, "acl_token", acl_token); if (sofia_locate_user(acl_token, session, sip, &x_user) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Authenticating user %s\n", acl_token); @@ -10544,6 +10548,9 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Error Authenticating user %s\n", acl_token); if (sofia_test_pflag(profile, PFLAG_AUTH_REQUIRE_USER)) { nua_respond(nh, SIP_480_TEMPORARILY_UNAVAILABLE, TAG_END()); + if (v_event) { + switch_event_destroy(&v_event); + } goto fail; } } diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 43d0eeb353..569699a1c8 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -2624,9 +2624,8 @@ void sofia_reg_handle_sip_r_challenge(int status, sip_auth_password = dup_pass; } } - - switch_xml_free(x_user); } + switch_xml_free(x_user); } switch_event_destroy(&locate_params); From e4f95f706905fb8adeb7c5cf3debde3e7a13637d Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Mon, 7 Oct 2019 23:05:44 +0400 Subject: [PATCH 086/118] [mod_local_stream] Xml object is leaked on reload when cannot stop local_stream beeing in use. --- src/mod/formats/mod_local_stream/mod_local_stream.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mod/formats/mod_local_stream/mod_local_stream.c b/src/mod/formats/mod_local_stream/mod_local_stream.c index 9e9a7aa3c9..c70d77410c 100644 --- a/src/mod/formats/mod_local_stream/mod_local_stream.c +++ b/src/mod/formats/mod_local_stream/mod_local_stream.c @@ -764,6 +764,10 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "local_stream://%s partially reloaded.\n",source->name); source->part_reload = 0; source->full_reload = 0; + + if (xml) { + switch_xml_free(xml); + } } } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "local_stream://%s fully reloaded.\n",source->name); From dd1aab33329fcb6fde343b7856b9981b3ef7e748 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Mon, 7 Oct 2019 23:47:35 +0400 Subject: [PATCH 087/118] [mod_voicemail] vm_fsdb_msg_email command leaks xml object. --- src/mod/applications/mod_voicemail/mod_voicemail.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index ff12ebdc3b..6ef8bf37e7 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -5979,7 +5979,6 @@ SWITCH_STANDARD_API(vm_fsdb_msg_email_function) if (switch_xml_locate_user_merged("id", id, domain, NULL, &x_user, NULL) != SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "-ERR Can't locate user.\n"); - switch_xml_free(x_user); goto done; } @@ -6106,6 +6105,10 @@ SWITCH_STANDARD_API(vm_fsdb_msg_email_function) done: switch_core_destroy_memory_pool(&pool); + if (x_user) { + switch_xml_free(x_user); + } + return SWITCH_STATUS_SUCCESS; } From 0af811bb24536a5271238f1a57b8b9cd341bbba3 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 8 Oct 2019 19:52:30 +0400 Subject: [PATCH 088/118] [sofia-sip] Fix memory leak when incomplete tls connection. --- libs/sofia-sip/.update | 2 +- libs/sofia-sip/libsofia-sip-ua/tport/tport.c | 10 +++++++--- libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c | 9 ++++++++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index 4384659886..d5e9004486 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Fri Sep 20 12:16:57 CDT 2019 +Tue Oct 08 10:50:11 CDT 2019 diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/tport.c b/libs/sofia-sip/libsofia-sip-ua/tport/tport.c index 286de1a91e..68b401be23 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/tport.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/tport.c @@ -1056,15 +1056,19 @@ int tport_register_secondary(tport_t *self, su_wakeup_f wakeup, int events) && (i = su_root_register(root, wait, wakeup, self, 0)) != -1) { + /* Can't be added to list of opened if already closed */ + if (tport_is_closed(self)) goto fail; + self->tp_index = i; self->tp_events = events; - /* Can't be added to list of opened if already closed */ - if (!tport_is_closed(self)) - tprb_append(&self->tp_pri->pri_open, self); + tprb_append(&self->tp_pri->pri_open, self); + return 0; } +fail: + SU_DEBUG_9(("%s(%p): tport is %s!\n", __func__, (void *)self, (tport_is_closed(self) ? "closed" : "opened"))); su_wait_destroy(wait); return -1; } diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c b/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c index f06aaaabab..8b079e9117 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c @@ -969,12 +969,19 @@ int tls_connect(su_root_magic_t *magic, su_wait_t *w, tport_t *self) if (events & SU_WAIT_HUP && !self->tp_closed) tport_hup_event(self); - if (self->tp_closed) + if (self->tp_closed) { + SU_DEBUG_9(("%s(%p): tport was closed during connect. Returning, but set secondary timer first.\n", + __func__, (void *)self)); + tport_set_secondary_timer(self); return 0; + } error = su_soerror(self->tp_socket); if (error) { tport_error_report(self, error, NULL); + SU_DEBUG_9(("%s(%p): socket error during connect. Returning, but set secondary timer first.\n", + __func__, (void *)self)); + tport_set_secondary_timer(self); return 0; } From 8126d1f48247fc7a6dd96a4148b81bf58797c30c Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 8 Nov 2019 19:00:59 +0400 Subject: [PATCH 089/118] [sofia-sip] Fix memory leak when a tcp connection gives POLLERR due to RST. --- libs/sofia-sip/.update | 2 +- libs/sofia-sip/libsofia-sip-ua/tport/tport.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index d5e9004486..a988844f14 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Tue Oct 08 10:50:11 CDT 2019 +Fri Nov 08 08:54:20 CDT 2019 diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/tport.c b/libs/sofia-sip/libsofia-sip-ua/tport/tport.c index 68b401be23..fbfdfa56b6 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/tport.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/tport.c @@ -2767,6 +2767,7 @@ static int tport_wakeup_pri(su_root_magic_t *m, su_wait_t *w, tport_t *self) int tport_wakeup(su_root_magic_t *magic, su_wait_t *w, tport_t *self) { int events = su_wait_events(w, self->tp_socket); + int error; #if HAVE_POLL assert(w->fd == self->tp_socket); @@ -2781,9 +2782,16 @@ int tport_wakeup(su_root_magic_t *magic, su_wait_t *w, tport_t *self) self->tp_closed ? " (closed)" : "")); if (self->tp_pri->pri_vtable->vtp_wakeup) - return self->tp_pri->pri_vtable->vtp_wakeup(self, events); + error = self->tp_pri->pri_vtable->vtp_wakeup(self, events); else - return tport_base_wakeup(self, events); + error = tport_base_wakeup(self, events); + + if (tport_is_closed(self)) { + SU_DEBUG_9(("%s(%p): tport is closed! Setting secondary timer!\n", "tport_wakeup", (void *)self)); + tport_set_secondary_timer(self); + } + + return error; } static int tport_base_wakeup(tport_t *self, int events) From cb7db309af4e4c4bbf070467599191a88311cd52 Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Thu, 14 Nov 2019 08:12:00 +0000 Subject: [PATCH 090/118] [core] scan-build: video_bridge_thread() - Dereference of null pointer --- src/switch_ivr_bridge.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 667950d2ad..41b668c58b 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -233,8 +233,8 @@ static void video_bridge_thread(switch_core_session_t *session, void *obj) } - if (switch_test_flag(read_frame, SFF_CNG) || - switch_channel_test_flag(channel, CF_LEG_HOLDING) || switch_channel_test_flag(b_channel, CF_VIDEO_READ_FILE_ATTACHED)) { + if (read_frame && (switch_test_flag(read_frame, SFF_CNG) || + switch_channel_test_flag(channel, CF_LEG_HOLDING) || switch_channel_test_flag(b_channel, CF_VIDEO_READ_FILE_ATTACHED))) { continue; } From ed991ef1533eb0fb880a2025459d4c44156ffa80 Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Thu, 14 Nov 2019 07:45:06 +0000 Subject: [PATCH 091/118] [core] scan-build: switch_strftime_tz() - Dead assignment --- src/switch_time.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/switch_time.c b/src/switch_time.c index cbb47f9ef7..e0c12aa737 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -1459,7 +1459,6 @@ SWITCH_DECLARE(switch_status_t) switch_time_exp_tz_name(const char *tz, switch_t tzdef = switch_lookup_timezone(tz_name); } else { /* We set the default timezone to GMT. */ - tz_name = "GMT"; tzdef = "GMT"; } From 459627dee20e4d4b5c1977c3238cef3481fcc546 Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Thu, 14 Nov 2019 07:41:53 +0000 Subject: [PATCH 092/118] [core] scan-build: audio_bridge_thread() - Dead assignment --- src/switch_ivr_bridge.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 41b668c58b..5ff242e102 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -670,7 +670,6 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) } else { switch_ivr_3p_nomedia(switch_core_session_get_uuid(session_a), SMF_REBRIDGE); } - bypass_media_after_bridge = 0; switch_channel_clear_flag(chan_b, CF_BYPASS_MEDIA_AFTER_BRIDGE); goto end_of_bridge_loop; } From 3d52d2a9ca397b84c4c4f2fddf79cbe90c5db041 Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Thu, 14 Nov 2019 07:28:23 +0000 Subject: [PATCH 093/118] [core] scan-build: Dead assignment. Value stored to 'p' is never read --- src/switch_stun.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/switch_stun.c b/src/switch_stun.c index b60a3cd5ea..6149ac3dc3 100644 --- a/src/switch_stun.c +++ b/src/switch_stun.c @@ -884,9 +884,6 @@ SWITCH_DECLARE(switch_status_t) switch_stun_ip_lookup(char **external_ip, const stun_port = (switch_port_t)iport; } } - else { - p = stun_ip; - } switch_find_local_ip(ip_buf, sizeof(ip_buf), NULL, AF_INET); From 51bf0fc51a3c6652dbe43556237883af279a5d70 Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Thu, 14 Nov 2019 07:26:00 +0000 Subject: [PATCH 094/118] [core] scan-build: switch_agc_feed() - Division by zero --- src/switch_resample.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/switch_resample.c b/src/switch_resample.c index 2c9529b8e2..866acdd99c 100644 --- a/src/switch_resample.c +++ b/src/switch_resample.c @@ -522,7 +522,9 @@ SWITCH_DECLARE(switch_status_t) switch_agc_feed(switch_agc_t *agc, int16_t *data energy += abs(data[i]); } - agc->score = energy / samples * channels; + if (samples) { + agc->score = energy / samples * channels; + } agc->score_sum += agc->score; agc->score_count++; From bafe238b7285c36de7227bf39c931702baa4c12e Mon Sep 17 00:00:00 2001 From: Seven Du Date: Sat, 16 Nov 2019 16:10:54 +0800 Subject: [PATCH 095/118] [core] fix copy and paste error --- tests/unit/switch_console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/switch_console.c b/tests/unit/switch_console.c index 9a3e9cfdc8..49a2568e71 100644 --- a/tests/unit/switch_console.c +++ b/tests/unit/switch_console.c @@ -25,7 +25,7 @@ * Konstantin Molchanov * * - * switch_utils.c -- tests switch_utils + * switch_console.c -- tests switch_console * */ From f664600df47e4eae9d8e93011d7f695cdc2f5162 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 20 Nov 2019 11:38:27 +0400 Subject: [PATCH 096/118] [fs_cli] Fix unchecked tainted data. --- libs/esl/fs_cli.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/esl/fs_cli.c b/libs/esl/fs_cli.c index fd6153e091..b63fdd845a 100644 --- a/libs/esl/fs_cli.c +++ b/libs/esl/fs_cli.c @@ -1002,10 +1002,13 @@ static const char *basic_gets(int *cnt) for (x = 0; x < (sizeof(command_buf) - 1); x++) { int c = getchar(); if (c < 0) { + size_t command_buf_len; if (fgets(command_buf, sizeof(command_buf) - 1, stdin) != command_buf) { break; + } + if ((command_buf_len = strlen(command_buf)) > 0) { + command_buf[command_buf_len - 1] = '\0'; /* remove endline */ } - command_buf[strlen(command_buf)-1] = '\0'; /* remove endline */ break; } command_buf[x] = (char) c; From da31fac5a099843c2095baddf20bbb7866beb662 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 25 Sep 2019 23:04:24 +0400 Subject: [PATCH 097/118] [Core, mod_commands] Add switch_core_pool_stats API and pool_stats command with corresponding --enable-pool-debug configure flag. --- libs/apr/.update | 2 +- libs/apr/include/apr_pools.h | 6 +++ libs/apr/memory/unix/apr_pools.c | 18 ++++++- src/include/switch_core.h | 2 + .../applications/mod_commands/mod_commands.c | 7 +++ src/switch_core_memory.c | 52 +++++++++++++++++++ 6 files changed, 85 insertions(+), 2 deletions(-) diff --git a/libs/apr/.update b/libs/apr/.update index 38f319cd1f..fba8701bc7 100644 --- a/libs/apr/.update +++ b/libs/apr/.update @@ -1 +1 @@ -Fri Apr 8 13:43:12 EDT 2016 +Wed Sep 25 15:25:12 EDT 2019 diff --git a/libs/apr/include/apr_pools.h b/libs/apr/include/apr_pools.h index 886323fa66..9b7f15685a 100644 --- a/libs/apr/include/apr_pools.h +++ b/libs/apr/include/apr_pools.h @@ -214,6 +214,12 @@ APR_DECLARE(apr_status_t) apr_pool_create_ex_debug(apr_pool_t **newpool, #define apr_pool_create_ex(newpool, parent, abort_fn, allocator) \ apr_pool_create_ex_debug(newpool, parent, abort_fn, allocator, \ APR_POOL__FILE_LINE__) + +APR_DECLARE(int) apr_pool_walk_tree_debug(apr_pool_t *pool, + int(*fn)(apr_pool_t *pool, void *data), + void *data); + +APR_DECLARE(void) apr_pool_get_stats(apr_pool_t *pool, unsigned int *alloc, unsigned int *total_alloc, unsigned int *clear); #endif /** diff --git a/libs/apr/memory/unix/apr_pools.c b/libs/apr/memory/unix/apr_pools.c index 600b0772cc..c412a4aef0 100644 --- a/libs/apr/memory/unix/apr_pools.c +++ b/libs/apr/memory/unix/apr_pools.c @@ -1126,6 +1126,22 @@ static int apr_pool_walk_tree(apr_pool_t *pool, return rv; } +APR_DECLARE(int) apr_pool_walk_tree_debug(apr_pool_t *pool, + int(*fn)(apr_pool_t *pool, void *data), + void *data) +{ + return apr_pool_walk_tree(pool, fn, data); +} + +APR_DECLARE(void) apr_pool_get_stats(apr_pool_t *pool, unsigned int *alloc, unsigned int *total_alloc, unsigned int *clear) +{ + if (pool) { + *alloc = pool->stat_alloc; + *total_alloc = pool->stat_total_alloc; + *clear = pool->stat_clear; + } +} + #if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL) static void apr_pool_log_event(apr_pool_t *pool, const char *event, const char *file_line, int deref) @@ -1432,7 +1448,7 @@ static void pool_clear_debug(apr_pool_t *pool, const char *file_line) for (index = 0; index < node->index; index++) { memset(node->beginp[index], POOL_POISON_BYTE, - node->endp[index] - node->beginp[index]); + (char *)node->endp[index] - (char *)node->beginp[index]); free(node->beginp[index]); } diff --git a/src/include/switch_core.h b/src/include/switch_core.h index bc7b70318b..f5df53ff11 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -623,6 +623,8 @@ SWITCH_DECLARE(const switch_state_handler_table_t *) switch_core_get_state_handl SWITCH_DECLARE(void) switch_core_memory_pool_tag(switch_memory_pool_t *pool, const char *tag); +SWITCH_DECLARE(void) switch_core_pool_stats(switch_stream_handle_t *stream); + SWITCH_DECLARE(switch_status_t) switch_core_perform_new_memory_pool(_Out_ switch_memory_pool_t **pool, _In_z_ const char *file, _In_z_ const char *func, _In_ int line); diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 46eaac71e4..37eda79929 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -685,6 +685,12 @@ end: return SWITCH_STATUS_SUCCESS; } +SWITCH_STANDARD_API(pool_stats_function) +{ + switch_core_pool_stats(stream); + return SWITCH_STATUS_SUCCESS; +} + SWITCH_STANDARD_API(db_cache_function) { int argc; @@ -7502,6 +7508,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) SWITCH_ADD_API(commands_api_interface, "nat_map", "Manage NAT", nat_map_function, "[status|republish|reinit] | [add|del] [tcp|udp] [static]"); SWITCH_ADD_API(commands_api_interface, "originate", "Originate a call", originate_function, ORIGINATE_SYNTAX); SWITCH_ADD_API(commands_api_interface, "pause", "Pause media on a channel", pause_function, PAUSE_SYNTAX); + SWITCH_ADD_API(commands_api_interface, "pool_stats", "Core pool memory usage", pool_stats_function, "Core pool memory usage."); SWITCH_ADD_API(commands_api_interface, "quote_shell_arg", "Quote/escape a string for use on shell command line", quote_shell_arg_function, ""); SWITCH_ADD_API(commands_api_interface, "regex", "Evaluate a regex", regex_function, "|[|][n|b]"); SWITCH_ADD_API(commands_api_interface, "reloadacl", "Reload XML", reload_acl_function, ""); diff --git a/src/switch_core_memory.c b/src/switch_core_memory.c index 288e96d85b..eb35f1b2ca 100644 --- a/src/switch_core_memory.c +++ b/src/switch_core_memory.c @@ -88,7 +88,11 @@ SWITCH_DECLARE(void *) switch_core_perform_session_alloc(switch_core_session_t * (void *) session->pool, (void *) session, apr_pool_tag(session->pool, NULL), (int) memory); #endif +#if APR_POOL_DEBUG + ptr = apr_palloc_debug(session->pool, memory, func); +#else ptr = apr_palloc(session->pool, memory); +#endif switch_assert(ptr != NULL); memset(ptr, 0, memory); @@ -349,7 +353,39 @@ SWITCH_DECLARE(void) switch_pool_clear(switch_memory_pool_t *p) } +#if APR_POOL_DEBUG +static int switch_core_pool_stats_callback(apr_pool_t *pool, void *data) { + switch_stream_handle_t *stream = (switch_stream_handle_t *)data; + unsigned int size = (unsigned int)apr_pool_num_bytes(pool, 1); + unsigned int alloc = 0, total_alloc = 0, clear = 0; + char *line = NULL; + apr_pool_userdata_get((void**)&line, "line", pool); + apr_pool_get_stats(pool, &alloc, &total_alloc, &clear); + + if (stream) { + stream->write_function(stream, "Pool '%s' size: %d, alloc:%d, total_alloc:%d, clear:%d\n", (line ? line : apr_pool_tag(pool, NULL)), (int)size, alloc, total_alloc, clear); + } else { + printf("Pool '%s' size: %d, alloc:%d, total_alloc:%d, clear:%d\n", (line ? line : apr_pool_tag(pool, NULL)), (int)size, alloc, total_alloc, clear); + } + return 0; +} +#endif + +SWITCH_DECLARE(void) switch_core_pool_stats(switch_stream_handle_t *stream) +{ +#if APR_POOL_DEBUG + if (runtime.memory_pool) { + apr_pool_walk_tree_debug(runtime.memory_pool, switch_core_pool_stats_callback, (void *)stream); + } +#else + if (stream) { + stream->write_function(stream, "Unable to get core pool statictics. Please rebuild FreeSWITCH with --enable-pool-debug"); + } else { + printf("Unable to get core pool statictics. Please rebuild FreeSWITCH with --enable-pool-debug"); + } +#endif +} SWITCH_DECLARE(switch_status_t) switch_core_perform_new_memory_pool(switch_memory_pool_t **pool, const char *file, const char *func, int line) { @@ -382,7 +418,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_new_memory_pool(switch_memor abort(); } +#if APR_POOL_DEBUG + if ((apr_pool_create_ex_debug(pool, memory_manager.memory_pool, NULL, my_allocator, func)) != APR_SUCCESS) { +#else if ((apr_pool_create_ex(pool, NULL, NULL, my_allocator)) != APR_SUCCESS) { +#endif abort(); } @@ -405,6 +445,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_new_memory_pool(switch_memor tmp = switch_core_sprintf(*pool, "%s:%d", file, line); apr_pool_tag(*pool, tmp); +#if APR_POOL_DEBUG + apr_pool_userdata_set(tmp, "line", NULL, *pool); +#endif + #ifdef DEBUG_ALLOC2 switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p New Pool %s\n", (void *) *pool, apr_pool_tag(*pool, NULL)); #endif @@ -438,7 +482,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_destroy_memory_pool(switch_m #ifdef USE_MEM_LOCK switch_mutex_lock(memory_manager.mem_lock); #endif +#if APR_POOL_DEBUG + apr_pool_destroy_debug(*pool, func); +#else apr_pool_destroy(*pool); +#endif #ifdef USE_MEM_LOCK switch_mutex_unlock(memory_manager.mem_lock); #endif @@ -469,7 +517,11 @@ SWITCH_DECLARE(void *) switch_core_perform_alloc(switch_memory_pool_t *pool, swi /*switch_assert(memory < 20000); */ #endif +#if APR_POOL_DEBUG + ptr = apr_palloc_debug(pool, memory, func); +#else ptr = apr_palloc(pool, memory); +#endif switch_assert(ptr != NULL); memset(ptr, 0, memory); From 00967290b9f3a9e4618630fb7d1a86fcead9da17 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Fri, 11 Oct 2019 15:32:09 +0800 Subject: [PATCH 098/118] [core] support partial speech events --- src/switch_ivr_async.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index bb629e9af2..ee23ccd79c 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -4673,9 +4673,9 @@ static void *SWITCH_THREAD_FUNC speech_thread(switch_thread_t *thread, void *obj status = switch_core_asr_get_results(sth->ah, &xmlstr, &flags); - if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) { + if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK && status != SWITCH_STATUS_MORE_DATA) { goto done; - } else if (status == SWITCH_STATUS_SUCCESS) { + } else { /* Try to fetch extra information for this result, the return value doesn't really matter here - it's just optional data. */ switch_core_asr_get_result_headers(sth->ah, &headers, &flags); } @@ -4732,6 +4732,14 @@ static void *SWITCH_THREAD_FUNC speech_thread(switch_thread_t *thread, void *obj switch_event_merge(event, headers); } + switch_event_add_body(event, "%s", xmlstr); + } else if (status == SWITCH_STATUS_MORE_DATA) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Speech-Type", "detected-partial-speech"); + + if (headers) { + switch_event_merge(event, headers); + } + switch_event_add_body(event, "%s", xmlstr); } else { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Speech-Type", "begin-speaking"); From e753e615ca57675e5b291fd5f6c772fea1cfa528 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 29 Oct 2019 19:30:46 +0400 Subject: [PATCH 099/118] [mod_sofia] Module load will fail if ext-rtp-ip or ext-sip-ip configuration param is set as empty string. --- src/mod/endpoints/mod_sofia/sofia.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index aedfb66e56..b9eab1939b 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -5056,6 +5056,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) } } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid ext-rtp-ip\n"); + switch_goto_status(SWITCH_STATUS_GENERR, done); } } else if (!strcasecmp(var, "rtp-ip")) { char *ip = mod_sofia_globals.guess_ip; @@ -5150,6 +5151,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) } } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid ext-sip-ip\n"); + switch_goto_status(SWITCH_STATUS_GENERR, done); } } else if (!strcasecmp(var, "local-network-acl")) { if (val && !strcasecmp(val, "none")) { From 20295c53efcda037cb67703c36fc3fc62656cc2d Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Sun, 15 Sep 2019 23:56:04 +0400 Subject: [PATCH 100/118] FS-11827: [Core] Add feature allowing FreeSWITCH to store CORE DB (SQLite) fully in memory (core-db-dsn). --- src/include/switch_core.h | 13 ++++++-- src/include/switch_core_db.h | 11 +++++++ src/include/switch_types.h | 1 + src/switch_core_db.c | 59 +++++++++++++++++++++++++++++---- src/switch_core_sqldb.c | 64 +++++++++++++++++++++++++----------- 5 files changed, 121 insertions(+), 27 deletions(-) diff --git a/src/include/switch_core.h b/src/include/switch_core.h index f5df53ff11..dbff45d46b 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -1854,6 +1854,13 @@ SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_video_write_codec(_In_ */ SWITCH_DECLARE(switch_core_db_t *) switch_core_db_open_file(const char *filename); +/*! + \brief Open a core db (SQLite) in-memory + \param uri to the db to open + \return the db handle +*/ +SWITCH_DECLARE(switch_core_db_t *) switch_core_db_open_in_memory(const char *uri); + /*! \brief Execute a sql stmt until it is accepted \param db the db handle @@ -2485,7 +2492,8 @@ typedef int (*switch_core_db_event_callback_func_t) (void *pArg, switch_event_t #define CACHE_DB_LEN 256 typedef enum { CDF_INUSE = (1 << 0), - CDF_PRUNE = (1 << 1) + CDF_PRUNE = (1 << 1), + CDF_NONEXPIRING = (1 << 2) } cache_db_flag_t; typedef enum { @@ -2495,13 +2503,14 @@ typedef enum { } switch_cache_db_handle_type_t; typedef union { - switch_core_db_t *core_db_dbh; + switch_core_db_handle_t *core_db_dbh; switch_odbc_handle_t *odbc_dbh; switch_database_interface_handle_t *database_interface_dbh; } switch_cache_db_native_handle_t; typedef struct { char *db_path; + switch_bool_t in_memory; } switch_cache_db_core_db_options_t; typedef struct { diff --git a/src/include/switch_core_db.h b/src/include/switch_core_db.h index 4a6b3eb4bf..ab8351b782 100644 --- a/src/include/switch_core_db.h +++ b/src/include/switch_core_db.h @@ -51,6 +51,12 @@ SWITCH_BEGIN_EXTERN_C * following opaque structure. */ typedef struct sqlite3 switch_core_db_t; + +struct switch_core_db_handle { + switch_bool_t in_memory; + switch_core_db_t *handle; +}; + typedef struct sqlite3_stmt switch_core_db_stmt_t; typedef int (*switch_core_db_callback_func_t) (void *pArg, int argc, char **argv, char **columnNames); @@ -102,6 +108,11 @@ SWITCH_DECLARE(int) switch_core_db_close(switch_core_db_t *db); */ SWITCH_DECLARE(int) switch_core_db_open(const char *filename, switch_core_db_t **ppDb); +/** + Same as switch_core_db_open() but additionally allows SQLITE_OPEN_URI + */ +SWITCH_DECLARE(int) switch_core_db_open_v2(const char *filename, switch_core_db_t **ppDb); + /** * ^Strings returned by sqlite3_column_text() and sqlite3_column_text16(), * even empty strings, are always zero-terminated. ^The return diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 9d8445a1e7..456b3c4c66 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -2318,6 +2318,7 @@ typedef struct switch_codec_implementation switch_codec_implementation_t; typedef struct switch_buffer switch_buffer_t; typedef union switch_codec_settings switch_codec_settings_t; typedef struct switch_codec_fmtp switch_codec_fmtp_t; +typedef struct switch_core_db_handle switch_core_db_handle_t; typedef struct switch_odbc_handle switch_odbc_handle_t; typedef struct switch_database_interface_handle switch_database_interface_handle_t; diff --git a/src/switch_core_db.c b/src/switch_core_db.c index ae118b7694..d3701ce91f 100644 --- a/src/switch_core_db.c +++ b/src/switch_core_db.c @@ -50,6 +50,11 @@ SWITCH_DECLARE(int) switch_core_db_open(const char *filename, switch_core_db_t * return sqlite3_open(filename, ppDb); } +SWITCH_DECLARE(int) switch_core_db_open_v2(const char *filename, switch_core_db_t **ppDb) +{ + return sqlite3_open_v2(filename, ppDb, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_URI, NULL); +} + SWITCH_DECLARE(int) switch_core_db_close(switch_core_db_t *db) { return sqlite3_close(db); @@ -84,6 +89,7 @@ SWITCH_DECLARE(int) switch_core_db_exec(switch_core_db_t *db, const char *sql, s while (--sane > 0) { ret = sqlite3_exec(db, sql, callback, data, &err); if (ret == SQLITE_BUSY || ret == SQLITE_LOCKED) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "SQLite is %s, sane=%d [%s]\n", (ret == SQLITE_BUSY ? "BUSY" : "LOCKED"), sane, sql); if (sane > 1) { switch_core_db_free(err); switch_yield(100000); @@ -187,6 +193,35 @@ SWITCH_DECLARE(int) switch_core_db_load_extension(switch_core_db_t *db, const ch return ret; } +static int switch_core_db_connection_setup(switch_core_db_t *db, switch_bool_t in_memory) { + int db_ret; + + if ((db_ret = switch_core_db_exec(db, "PRAGMA synchronous=OFF;", NULL, NULL, NULL)) != SQLITE_OK) { + goto end; + } + if ((db_ret = switch_core_db_exec(db, "PRAGMA count_changes=OFF;", NULL, NULL, NULL)) != SQLITE_OK) { + goto end; + } + if ((db_ret = switch_core_db_exec(db, "PRAGMA temp_store=MEMORY;", NULL, NULL, NULL)) != SQLITE_OK) { + goto end; + } + if (!in_memory) { + if ((db_ret = switch_core_db_exec(db, "PRAGMA cache_size=8000;", NULL, NULL, NULL)) != SQLITE_OK) { + goto end; + } + } else { + if ((db_ret = switch_core_db_exec(db, "PRAGMA cache_size=-8192;", NULL, NULL, NULL)) != SQLITE_OK) { + goto end; + } + if ((db_ret = switch_core_db_exec(db, "PRAGMA journal_mode=OFF;", NULL, NULL, NULL)) != SQLITE_OK) { + goto end; + } + } + +end: + return db_ret; +} + SWITCH_DECLARE(switch_core_db_t *) switch_core_db_open_file(const char *filename) { switch_core_db_t *db; @@ -197,16 +232,28 @@ SWITCH_DECLARE(switch_core_db_t *) switch_core_db_open_file(const char *filename if ((db_ret = switch_core_db_open(path, &db)) != SQLITE_OK) { goto end; } - if ((db_ret = switch_core_db_exec(db, "PRAGMA synchronous=OFF;", NULL, NULL, NULL)) != SQLITE_OK) { + if ((db_ret = switch_core_db_connection_setup(db, SWITCH_FALSE)) != SQLITE_OK) { goto end; } - if ((db_ret = switch_core_db_exec(db, "PRAGMA count_changes=OFF;", NULL, NULL, NULL)) != SQLITE_OK) { + +end: + if (db_ret != SQLITE_OK) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL ERR [%s]\n", switch_core_db_errmsg(db)); + switch_core_db_close(db); + db = NULL; + } + return db; +} + +SWITCH_DECLARE(switch_core_db_t *) switch_core_db_open_in_memory(const char *uri) +{ + switch_core_db_t *db; + int db_ret; + + if ((db_ret = switch_core_db_open_v2(uri, &db)) != SQLITE_OK) { goto end; } - if ((db_ret = switch_core_db_exec(db, "PRAGMA cache_size=8000;", NULL, NULL, NULL)) != SQLITE_OK) { - goto end; - } - if ((db_ret = switch_core_db_exec(db, "PRAGMA temp_store=MEMORY;", NULL, NULL, NULL)) != SQLITE_OK) { + if ((db_ret = switch_core_db_connection_setup(db, SWITCH_TRUE)) != SQLITE_OK) { goto end; } diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index ffc82aa2e5..b2ba795115 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -95,6 +95,14 @@ static switch_cache_db_handle_t *create_handle(switch_cache_db_handle_type_t typ return new_dbh; } +static void destroy_handle(switch_cache_db_handle_t **dbh) +{ + if (dbh && *dbh && (*dbh)->pool) { + switch_core_destroy_memory_pool(&(*dbh)->pool); + *dbh = NULL; + } +} + static void add_handle(switch_cache_db_handle_t *dbh, const char *db_str, const char *db_callsite_str, const char *thread_str) { switch_ssize_t hlen = -1; @@ -161,7 +169,7 @@ SWITCH_DECLARE(void) switch_cache_db_database_interface_flush_handles(switch_dat del_handle(dbh_ptr); switch_mutex_unlock(dbh_ptr->mutex); - switch_core_destroy_memory_pool(&dbh_ptr->pool); + destroy_handle(&dbh_ptr); } } @@ -266,7 +274,7 @@ static void sql_close(time_t prune) diff = (time_t) prune - dbh->last_used; } - if (prune > 0 && (dbh->use_count || (diff < SQL_CACHE_TIMEOUT && !switch_test_flag(dbh, CDF_PRUNE)))) { + if (prune > 0 && (dbh->use_count || switch_test_flag(dbh, CDF_NONEXPIRING) || (diff < SQL_CACHE_TIMEOUT && !switch_test_flag(dbh, CDF_PRUNE)))) { continue; } @@ -287,8 +295,8 @@ static void sql_close(time_t prune) break; case SCDB_TYPE_CORE_DB: { - switch_core_db_close(dbh->native_handle.core_db_dbh); - dbh->native_handle.core_db_dbh = NULL; + switch_core_db_close(dbh->native_handle.core_db_dbh->handle); + dbh->native_handle.core_db_dbh->handle = NULL; } break; } @@ -453,6 +461,10 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle_dsn_ex(switch_cac if (!strncasecmp(dsn, "sqlite://", 9)) { type = SCDB_TYPE_CORE_DB; connection_options.core_db_options.db_path = (char *)(dsn + 9); + if (!strncasecmp(connection_options.core_db_options.db_path, "memory://", 9)) { + connection_options.core_db_options.in_memory = SWITCH_TRUE; + connection_options.core_db_options.db_path = (char *)(connection_options.core_db_options.db_path + 9); + } } else if ((!(i = strncasecmp(dsn, "odbc://", 7))) || (strchr(dsn + 2, ':') && !colon_slashes)) { type = SCDB_TYPE_ODBC; @@ -615,7 +627,11 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle(switch_cache_db_h break; case SCDB_TYPE_CORE_DB: { - db = switch_core_db_open_file(connection_options->core_db_options.db_path); + if (!connection_options->core_db_options.in_memory) { + db = switch_core_db_open_file(connection_options->core_db_options.db_path); + } else { + db = switch_core_db_open_in_memory(connection_options->core_db_options.db_path); + } } break; @@ -636,7 +652,13 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle(switch_cache_db_h if (database_interface_dbh) { new_dbh->native_handle.database_interface_dbh = database_interface_dbh; } else if (db) { - new_dbh->native_handle.core_db_dbh = db; + if (!(new_dbh->native_handle.core_db_dbh = switch_core_alloc(new_dbh->pool, sizeof(*new_dbh->native_handle.core_db_dbh)))) { + destroy_handle(&new_dbh); + switch_core_db_close(db); + goto end; + } + new_dbh->native_handle.core_db_dbh->handle = db; + new_dbh->native_handle.core_db_dbh->in_memory = connection_options->core_db_options.in_memory; } else if (odbc_dbh) { new_dbh->native_handle.odbc_dbh = odbc_dbh; } @@ -686,7 +708,7 @@ static switch_status_t switch_cache_db_execute_sql_real(switch_cache_db_handle_t break; case SCDB_TYPE_CORE_DB: { - int ret = switch_core_db_exec(dbh->native_handle.core_db_dbh, sql, NULL, NULL, &errmsg); + int ret = switch_core_db_exec(dbh->native_handle.core_db_dbh->handle, sql, NULL, NULL, &errmsg); type = "NATIVE"; if (ret == SWITCH_CORE_DB_OK) { @@ -810,7 +832,7 @@ SWITCH_DECLARE(int) switch_cache_db_affected_rows(switch_cache_db_handle_t *dbh) switch (dbh->type) { case SCDB_TYPE_CORE_DB: { - return switch_core_db_changes(dbh->native_handle.core_db_dbh); + return switch_core_db_changes(dbh->native_handle.core_db_dbh->handle); } break; case SCDB_TYPE_ODBC: @@ -836,7 +858,7 @@ SWITCH_DECLARE(int) switch_cache_db_load_extension(switch_cache_db_handle_t *dbh case SCDB_TYPE_CORE_DB: { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "try to load extension [%s]!\n", extension); - return switch_core_db_load_extension(dbh->native_handle.core_db_dbh, extension); + return switch_core_db_load_extension(dbh->native_handle.core_db_dbh->handle, extension); } break; case SCDB_TYPE_ODBC: @@ -868,7 +890,7 @@ SWITCH_DECLARE(char *) switch_cache_db_execute_sql2str(switch_cache_db_handle_t { switch_core_db_stmt_t *stmt; - if (switch_core_db_prepare(dbh->native_handle.core_db_dbh, sql, -1, &stmt, 0)) { + if (switch_core_db_prepare(dbh->native_handle.core_db_dbh->handle, sql, -1, &stmt, 0)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Statement Error [%s]!\n", sql); goto end; } else { @@ -1206,7 +1228,7 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_event_callback(switc break; case SCDB_TYPE_CORE_DB: { - int ret = switch_core_db_exec(dbh->native_handle.core_db_dbh, sql, helper_callback, &h, &errmsg); + int ret = switch_core_db_exec(dbh->native_handle.core_db_dbh->handle, sql, helper_callback, &h, &errmsg); if (ret == SWITCH_CORE_DB_OK || ret == SWITCH_CORE_DB_ABORT) { status = SWITCH_STATUS_SUCCESS; @@ -1273,7 +1295,7 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_event_callback_err(s break; case SCDB_TYPE_CORE_DB: { - int ret = switch_core_db_exec(dbh->native_handle.core_db_dbh, sql, helper_callback, &h, &errmsg); + int ret = switch_core_db_exec(dbh->native_handle.core_db_dbh->handle, sql, helper_callback, &h, &errmsg); if (ret == SWITCH_CORE_DB_OK || ret == SWITCH_CORE_DB_ABORT) { status = SWITCH_STATUS_SUCCESS; @@ -1332,7 +1354,7 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_callback(switch_cach break; case SCDB_TYPE_CORE_DB: { - int ret = switch_core_db_exec(dbh->native_handle.core_db_dbh, sql, callback, pdata, &errmsg); + int ret = switch_core_db_exec(dbh->native_handle.core_db_dbh->handle, sql, callback, pdata, &errmsg); if (ret == SWITCH_CORE_DB_OK || ret == SWITCH_CORE_DB_ABORT) { status = SWITCH_STATUS_SUCCESS; @@ -1394,7 +1416,7 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_callback_err(switch_ break; case SCDB_TYPE_CORE_DB: { - int ret = switch_core_db_exec(dbh->native_handle.core_db_dbh, sql, callback, pdata, &errmsg); + int ret = switch_core_db_exec(dbh->native_handle.core_db_dbh->handle, sql, callback, pdata, &errmsg); if (ret == SWITCH_CORE_DB_OK || ret == SWITCH_CORE_DB_ABORT) { status = SWITCH_STATUS_SUCCESS; @@ -1521,21 +1543,21 @@ SWITCH_DECLARE(switch_bool_t) switch_cache_db_test_reactive_ex(switch_cache_db_h case SCDB_TYPE_CORE_DB: { char *errmsg = NULL; - switch_core_db_exec(dbh->native_handle.core_db_dbh, test_sql, NULL, NULL, &errmsg); + switch_core_db_exec(dbh->native_handle.core_db_dbh->handle, test_sql, NULL, NULL, &errmsg); if (errmsg) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL ERR [%s]\n[%s]\nAuto Generating Table!\n", errmsg, test_sql); switch_core_db_free(errmsg); errmsg = NULL; if (drop_sql) { - switch_core_db_exec(dbh->native_handle.core_db_dbh, drop_sql, NULL, NULL, &errmsg); + switch_core_db_exec(dbh->native_handle.core_db_dbh->handle, drop_sql, NULL, NULL, &errmsg); } if (errmsg) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Ignoring SQL ERR [%s]\n[%s]\n", errmsg, drop_sql); switch_core_db_free(errmsg); errmsg = NULL; } - switch_core_db_exec(dbh->native_handle.core_db_dbh, reactive_sql, NULL, NULL, &errmsg); + switch_core_db_exec(dbh->native_handle.core_db_dbh->handle, reactive_sql, NULL, NULL, &errmsg); if (errmsg) { r = SWITCH_FALSE; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL ERR [%s]\n[%s]\n", errmsg, reactive_sql); @@ -3779,6 +3801,10 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_ switch_cache_db_execute_sql(sql_manager.dbh, create_tasks_sql, NULL); switch_cache_db_execute_sql(sql_manager.dbh, detailed_calls_sql, NULL); switch_cache_db_execute_sql(sql_manager.dbh, basic_calls_sql, NULL); + + if (sql_manager.dbh->native_handle.core_db_dbh->in_memory == SWITCH_TRUE) { + switch_set_flag(sql_manager.dbh, CDF_NONEXPIRING); + } } break; } @@ -4009,14 +4035,14 @@ SWITCH_DECLARE(void) switch_cache_db_status(switch_stream_handle_t *stream) used++; } - stream->write_function(stream, "%s\n\tType: %s\n\tLast used: %d\n\tTotal used: %ld\n\tFlags: %s, %s(%d)\n" + stream->write_function(stream, "%s\n\tType: %s\n\tLast used: %d\n\tTotal used: %ld\n\tFlags: %s, %s(%d)%s\n" "\tCreator: %s\n\tLast User: %s\n", cleankey_str, switch_cache_db_type_name(dbh->type), diff, dbh->total_used_count, locked ? "Locked" : "Unlocked", - dbh->use_count ? "Attached" : "Detached", dbh->use_count, dbh->creator, dbh->last_user); + dbh->use_count ? "Attached" : "Detached", dbh->use_count, switch_test_flag(dbh, CDF_NONEXPIRING) ? ", Non-expiring" : "", dbh->creator, dbh->last_user); } stream->write_function(stream, "%d total. %d in use.\n", count, used); From cbc8d698a083808feae98789d25a1098a1d6aadc Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 19 Sep 2019 02:01:11 +0400 Subject: [PATCH 101/118] FS-11827: [Core] Fix regression in mod_managed due to the type name switch_core_db_handle conflicting with the switch_core_db_handle macro --- src/include/switch_core.h | 2 +- src/include/switch_core_db.h | 2 +- src/include/switch_types.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/include/switch_core.h b/src/include/switch_core.h index dbff45d46b..8255e13c85 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -2503,7 +2503,7 @@ typedef enum { } switch_cache_db_handle_type_t; typedef union { - switch_core_db_handle_t *core_db_dbh; + switch_coredb_handle_t *core_db_dbh; switch_odbc_handle_t *odbc_dbh; switch_database_interface_handle_t *database_interface_dbh; } switch_cache_db_native_handle_t; diff --git a/src/include/switch_core_db.h b/src/include/switch_core_db.h index ab8351b782..4fbdc5bc63 100644 --- a/src/include/switch_core_db.h +++ b/src/include/switch_core_db.h @@ -52,7 +52,7 @@ SWITCH_BEGIN_EXTERN_C */ typedef struct sqlite3 switch_core_db_t; -struct switch_core_db_handle { +struct switch_coredb_handle { switch_bool_t in_memory; switch_core_db_t *handle; }; diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 456b3c4c66..09fe09defc 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -2318,7 +2318,7 @@ typedef struct switch_codec_implementation switch_codec_implementation_t; typedef struct switch_buffer switch_buffer_t; typedef union switch_codec_settings switch_codec_settings_t; typedef struct switch_codec_fmtp switch_codec_fmtp_t; -typedef struct switch_core_db_handle switch_core_db_handle_t; +typedef struct switch_coredb_handle switch_coredb_handle_t; typedef struct switch_odbc_handle switch_odbc_handle_t; typedef struct switch_database_interface_handle switch_database_interface_handle_t; From cd5d72ac744208ae63b0b81d18410f30eb8224da Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 31 Oct 2019 21:39:50 +0400 Subject: [PATCH 102/118] [Core] Database interface: fix potential crash in switch_cache_db_database_interface_flush_handles, code cleanup. --- src/switch_core_sqldb.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index b2ba795115..7f5c2aff52 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -153,6 +153,8 @@ SWITCH_DECLARE(void) switch_cache_db_database_interface_flush_handles(switch_dat switch_mutex_lock(sql_manager.dbh_mutex); +top: + for (dbh_ptr = sql_manager.handle_pool; dbh_ptr; dbh_ptr = dbh_ptr->next) { if (switch_mutex_trylock(dbh_ptr->mutex) == SWITCH_STATUS_SUCCESS) { if (dbh_ptr->type != SCDB_TYPE_DATABASE_INTERFACE) { @@ -170,6 +172,7 @@ SWITCH_DECLARE(void) switch_cache_db_database_interface_flush_handles(switch_dat del_handle(dbh_ptr); switch_mutex_unlock(dbh_ptr->mutex); destroy_handle(&dbh_ptr); + goto top; } } @@ -303,7 +306,7 @@ static void sql_close(time_t prune) del_handle(dbh); switch_mutex_unlock(dbh->mutex); - switch_core_destroy_memory_pool(&dbh->pool); + destroy_handle(&dbh); goto top; } else { @@ -432,7 +435,7 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle_dsn_ex(switch_cac const char *file, const char *func, int line) { switch_cache_db_connection_options_t connection_options = { {0} }; - switch_cache_db_handle_type_t type; + switch_cache_db_handle_type_t type = SCDB_TYPE_CORE_DB; switch_database_interface_t *database_interface = NULL; char tmp[256] = ""; char *p; From 1486e84aa294817d80ebf7b00981ff0418ad5465 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 1 Nov 2019 00:05:40 +0400 Subject: [PATCH 103/118] [Core] Fix dereference of null pointer in switch_ivr_originate and switch_ivr_enterprise_originate causing crashes, add unit test. --- Freeswitch.2017.sln | 15 ++ src/switch_ivr_originate.c | 7 +- tests/unit/switch_ivr_originate.c | 23 ++ .../test_switch_ivr_originate.2017.vcxproj | 203 ++++++++++++++++++ 4 files changed, 246 insertions(+), 2 deletions(-) create mode 100644 tests/unit/test_switch_ivr_originate.2017.vcxproj diff --git a/Freeswitch.2017.sln b/Freeswitch.2017.sln index c324093a86..adad7bc73e 100644 --- a/Freeswitch.2017.sln +++ b/Freeswitch.2017.sln @@ -588,6 +588,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_mariadb", "src\mod\data EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_switch_core_db", "tests\unit\test_switch_core_db.2017.vcxproj", "{580675D7-C1C9-4197-AAC5-00F64FAFDE78}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_switch_ivr_originate", "tests\unit\test_switch_ivr_originate.2017.vcxproj", "{69A7464A-9B0D-4804-A108-835229DACF58}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -2703,6 +2705,18 @@ Global {580675D7-C1C9-4197-AAC5-00F64FAFDE78}.Release|Win32.Build.0 = Release|Win32 {580675D7-C1C9-4197-AAC5-00F64FAFDE78}.Release|x64.ActiveCfg = Release|x64 {580675D7-C1C9-4197-AAC5-00F64FAFDE78}.Release|x64.Build.0 = Release|x64 + {69A7464A-9B0D-4804-A108-835229DACF58}.All|Win32.ActiveCfg = Release|Win32 + {69A7464A-9B0D-4804-A108-835229DACF58}.All|Win32.Build.0 = Release|Win32 + {69A7464A-9B0D-4804-A108-835229DACF58}.All|x64.ActiveCfg = Release|x64 + {69A7464A-9B0D-4804-A108-835229DACF58}.All|x64.Build.0 = Release|x64 + {69A7464A-9B0D-4804-A108-835229DACF58}.Debug|Win32.ActiveCfg = Debug|Win32 + {69A7464A-9B0D-4804-A108-835229DACF58}.Debug|Win32.Build.0 = Debug|Win32 + {69A7464A-9B0D-4804-A108-835229DACF58}.Debug|x64.ActiveCfg = Debug|x64 + {69A7464A-9B0D-4804-A108-835229DACF58}.Debug|x64.Build.0 = Debug|x64 + {69A7464A-9B0D-4804-A108-835229DACF58}.Release|Win32.ActiveCfg = Release|Win32 + {69A7464A-9B0D-4804-A108-835229DACF58}.Release|Win32.Build.0 = Release|Win32 + {69A7464A-9B0D-4804-A108-835229DACF58}.Release|x64.ActiveCfg = Release|x64 + {69A7464A-9B0D-4804-A108-835229DACF58}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2916,6 +2930,7 @@ Global {1BA65811-5453-46F6-8190-9ECEEFEB7DF2} = {31C2761D-20E0-4BF8-98B9-E32F0D8DD6E1} {0B612F84-7533-4DEC-AEDD-5C9CBCF15EAC} = {31C2761D-20E0-4BF8-98B9-E32F0D8DD6E1} {580675D7-C1C9-4197-AAC5-00F64FAFDE78} = {9388C266-C3FC-468A-92EF-0CBC35941412} + {69A7464A-9B0D-4804-A108-835229DACF58} = {9388C266-C3FC-468A-92EF-0CBC35941412} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {09840DE7-9208-45AA-9667-1A71EE93BD1E} diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index c34767d99a..9e9ebdb19c 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -1587,7 +1587,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess /* extract channel variables, allowing multiple sets of braces */ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Parsing ultra-global variables\n"); - while (*data == '<') { + while (data && *data == '<') { char *parsed = NULL; if (switch_event_create_brackets(data, '<', '>', ',', &var_event, &parsed, SWITCH_FALSE) != SWITCH_STATUS_SUCCESS || !parsed) { @@ -2742,7 +2742,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess end = NULL; - chan_type = peer_names[i]; + if (!(chan_type = peer_names[i])) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Empty dial string\n"); + switch_goto_status(SWITCH_STATUS_FALSE, done); + } /* strip leading spaces */ diff --git a/tests/unit/switch_ivr_originate.c b/tests/unit/switch_ivr_originate.c index 8cbdfa2a9d..1354e3b921 100644 --- a/tests/unit/switch_ivr_originate.c +++ b/tests/unit/switch_ivr_originate.c @@ -197,6 +197,29 @@ FST_CORE_BEGIN("./conf") switch_dial_handle_destroy(&dh); } FST_TEST_END(); + + FST_TEST_BEGIN(originate_test_empty_dial_string) + { + switch_core_session_t *session = NULL; + switch_channel_t *channel = NULL; + switch_status_t status; + switch_call_cause_t cause; + switch_dial_handle_t *dh; + switch_dial_leg_list_t *ll; + switch_dial_leg_t *leg = NULL; + + switch_dial_handle_create(&dh); + switch_dial_handle_add_leg_list(dh, &ll); + + /* Dial string is NULL */ + switch_dial_leg_list_add_leg(ll, &leg, NULL); + + status = switch_ivr_originate(NULL, &session, &cause, NULL, 0, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, dh); + fst_check(status == SWITCH_STATUS_FALSE); + + switch_dial_handle_destroy(&dh); + } + FST_TEST_END() } FST_SUITE_END() } diff --git a/tests/unit/test_switch_ivr_originate.2017.vcxproj b/tests/unit/test_switch_ivr_originate.2017.vcxproj new file mode 100644 index 0000000000..c0dfd1a281 --- /dev/null +++ b/tests/unit/test_switch_ivr_originate.2017.vcxproj @@ -0,0 +1,203 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + test_switch_ivr_originate + test_switch_ivr_originate + Win32Proj + 10.0.17134.0 + {69A7464A-9B0D-4804-A108-835229DACF58} + + + + Application + MultiByte + v141 + + + Application + MultiByte + v141 + + + Application + MultiByte + v141 + + + Application + MultiByte + v141 + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + false + $(SolutionDir)$(PlatformName)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + $(SolutionDir)$(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + false + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + + + + $(SolutionDir)src\include;%(AdditionalIncludeDirectories) + SWITCH_TEST_BASE_DIR_FOR_CONF="..\\..\\tests\\unit\\";%(PreprocessorDefinitions) + + + + + + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level4 + ProgramDatabase + true + 6031;6340;6246;6011;6387;%(DisableSpecificWarnings) + + + $(OutDir);%(AdditionalLibraryDirectories) + true + Console + true + + + MachineX86 + + + + + + X64 + + + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level4 + ProgramDatabase + true + 6031;6340;6246;6011;6387;%(DisableSpecificWarnings) + + + $(OutDir);%(AdditionalLibraryDirectories) + true + Console + true + + + MachineX64 + + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level4 + ProgramDatabase + 6031;6340;6246;6011;6387;%(DisableSpecificWarnings) + + + $(OutDir);%(AdditionalLibraryDirectories) + false + Console + true + true + true + + + MachineX86 + + + + + + X64 + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level4 + ProgramDatabase + 6031;6340;6246;6011;6387;%(DisableSpecificWarnings) + + + $(OutDir);%(AdditionalLibraryDirectories) + false + Console + true + true + true + + + MachineX64 + + + + + + + + {202d7a4e-760d-4d0e-afa1-d7459ced30ff} + + + + + + \ No newline at end of file From c65cb486d6d6bbb507de36e9ffabfd96a22e040e Mon Sep 17 00:00:00 2001 From: Mike Jerris Date: Fri, 8 Nov 2019 09:48:25 -0700 Subject: [PATCH 104/118] [core] change No audio stun for a long time error to warning --- src/switch_rtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 5da1b4fbe3..fb8d5d2cf2 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -842,7 +842,7 @@ static switch_status_t ice_out(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice) elapsed = (unsigned int) ((switch_micro_time_now() - rtp_session->last_stun) / 1000); if (elapsed > 30000) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "No %s stun for a long time!\n", rtp_type(rtp_session)); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, "No %s stun for a long time!\n", rtp_type(rtp_session)); rtp_session->last_stun = switch_micro_time_now(); //status = SWITCH_STATUS_GENERR; //goto end; From 5df8bfcd849a5ac2e692820457996479ebd9268c Mon Sep 17 00:00:00 2001 From: Seven Du Date: Thu, 14 Nov 2019 12:34:57 +0800 Subject: [PATCH 105/118] [core] log status code when queue event failure --- src/switch_event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_event.c b/src/switch_event.c index b1e02e570a..aa0ea7ee88 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -3069,7 +3069,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_channel_broadcast(const char *event cJSON_Delete(ecd->json); ecd->json = NULL; destroy_ecd(&ecd); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Event Channel Queue failure for channel %s\n", event_channel); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Event Channel Queue failure for channel %s, status = %d\n", event_channel, status); } else { ecd = NULL; } From 917d850b04af8393c6d1e0052fbb68aadecda7ef Mon Sep 17 00:00:00 2001 From: Seven Du Date: Sat, 16 Nov 2019 10:33:48 +0800 Subject: [PATCH 106/118] [core] remember if a tag is parsed from CDATA --- src/include/switch_xml.h | 3 +- src/switch_xml.c | 8 +++-- tests/unit/Makefile.am | 2 +- tests/unit/switch_xml.c | 74 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 tests/unit/switch_xml.c diff --git a/src/include/switch_xml.h b/src/include/switch_xml.h index 5ea600a550..7362a587ee 100644 --- a/src/include/switch_xml.h +++ b/src/include/switch_xml.h @@ -69,7 +69,8 @@ SWITCH_BEGIN_EXTERN_C SWITCH_XML_ROOT = (1 << 0), // root SWITCH_XML_NAMEM = (1 << 1), // name is malloced SWITCH_XML_TXTM = (1 << 2), // txt is malloced - SWITCH_XML_DUP = (1 << 3) // attribute name and value are strduped + SWITCH_XML_DUP = (1 << 3), // attribute name and value are strduped + SWITCH_XML_CDATA = (1 << 4) // body is in CDATA } switch_xml_flag_t; /*! \brief A representation of an XML tree */ diff --git a/src/switch_xml.c b/src/switch_xml.c index f2e43f6318..596fa6a6bf 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -1139,10 +1139,14 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_parse_str(char *s, switch_size_t len) if (!(s = strstr(s + 3, "--")) || (*(s += 2) != '>' && *s) || (!*s && e != '>')) return switch_xml_err(root, d, "unclosed