From 02f7b6cfca765086ef8861b6cf08c31dbb1a6ac1 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 30 Nov 2012 11:43:48 -0600 Subject: [PATCH 01/23] disable catchup code when jitterbuffer is there --- 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 8726beabe8..25a46f3b5c 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -3234,7 +3234,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER)) { if ((switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOFLUSH) || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_STICKY_FLUSH)) && - rtp_session->read_pollfd) { + rtp_session->read_pollfd && (!rtp_session->jb || rtp_session->pause_jb)) { if (switch_poll(rtp_session->read_pollfd, 1, &fdr, 0) == SWITCH_STATUS_SUCCESS) { status = read_rtp_packet(rtp_session, &bytes, flags, SWITCH_FALSE); /* switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Initial (%i) %d\n", status, bytes); */ From f86c4e58094b61de4c7f648540fad5a23d224c94 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Fri, 30 Nov 2012 13:21:23 -0800 Subject: [PATCH 02/23] Add 1.2.5.1 and 1.2.5.2 maintenance notes to ChangeLog --- docs/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/ChangeLog b/docs/ChangeLog index f5e330d00e..6921a3133c 100644 --- a/docs/ChangeLog +++ b/docs/ChangeLog @@ -1,3 +1,7 @@ +freeswitch (1.2.5.2) + Maintenance release/bug fixes +freeswitch (1.2.5.1) + Maintenance release/bug fixes freeswitch (1.2.5) mod_lua: Enable mod_lua to use native pgsql dbh support (r:2cea7f0f) mod_sofia: Add att_xfer_destination_number variable to indicate the original destination number of the attended transfer leg on REFER for semi-attended transfer scenarios. (r:893cd7be) From d56e8d60fb3c8244540cd9f545792eeceffabafb Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 30 Nov 2012 13:54:15 -0600 Subject: [PATCH 03/23] FS-4896 please try this --- src/switch_core_media_bug.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/src/switch_core_media_bug.c b/src/switch_core_media_bug.c index b0d9e8d4f9..7beb048155 100644 --- a/src/switch_core_media_bug.c +++ b/src/switch_core_media_bug.c @@ -183,18 +183,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b bytes = read_impl.decoded_bytes_per_packet; -#ifdef TESTINGONLY - if (0 && bug->session->recur_buffer_len) { - frame->datalen = bug->session->recur_buffer_len; - frame->samples = bug->session->recur_buffer_len / sizeof(int16_t); - frame->rate = read_impl.actual_samples_per_second; - frame->codec = NULL; - memcpy(frame->data, bug->session->recur_buffer, bug->session->recur_buffer_len); - return SWITCH_STATUS_SUCCESS; - } -#endif - - if (frame->buflen < bytes) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_ERROR, "%s frame buffer too small!\n", switch_channel_get_name(bug->session->channel)); @@ -232,15 +220,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b } if (!bug->record_frame_size) { - if (do_read && do_write) { - switch_size_t frame_size; - switch_codec_implementation_t read_impl = { 0 }; - switch_codec_implementation_t other_read_impl = { 0 }; - switch_core_session_t *other_session; - - switch_core_session_get_read_impl(bug->session, &read_impl); - frame_size = read_impl.decoded_bytes_per_packet; + switch_size_t frame_size; + switch_codec_implementation_t read_impl = { 0 }; + //switch_codec_implementation_t other_read_impl = { 0 }; + //switch_core_session_t *other_session; + switch_core_session_get_read_impl(bug->session, &read_impl); + frame_size = read_impl.decoded_bytes_per_packet; + bug->record_frame_size = frame_size; +#if 0 + if (do_read && do_write) { if (switch_core_session_get_partner(bug->session, &other_session) == SWITCH_STATUS_SUCCESS) { switch_core_session_get_read_impl(other_session, &other_read_impl); switch_core_session_rwunlock(other_session); @@ -258,6 +247,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b bug->record_frame_size = frame_size; } +#endif } From a939dee96eab357c360d538801485be639c58a95 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 30 Nov 2012 13:54:43 -0600 Subject: [PATCH 04/23] rtp and signal parsing adjustments --- src/mod/endpoints/mod_sofia/sofia.c | 5 ----- src/switch_rtp.c | 3 ++- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index c74a61cfd2..306f5fe42c 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1582,7 +1582,6 @@ void sofia_process_dispatch_event(sofia_dispatch_event_t **dep) nua_t *nua = de->nua; sofia_profile_t *profile = de->profile; sofia_private_t *sofia_private = nua_handle_magic(de->nh); - switch_core_session_t *session = de->session; *dep = NULL; our_sofia_event_callback(de->data->e_event, de->data->e_status, de->data->e_phrase, de->nua, de->profile, @@ -1597,10 +1596,6 @@ void sofia_process_dispatch_event(sofia_dispatch_event_t **dep) nua_handle_unref(nh); nua_stack_unref(nua); - - if (session) { - switch_ivr_parse_all_signal_data(session); - } } diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 25a46f3b5c..bb04f5bff3 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -3254,7 +3254,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ } } - if (rtp_session->hot_hits > 1 && !rtp_session->sync_packets) {// >= (rtp_session->samples_per_second * 30)) { + if (rtp_session->hot_hits > 10 && !rtp_session->sync_packets) {// >= (rtp_session->samples_per_second * 30)) { hot_socket = 1; } } else { @@ -3277,6 +3277,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ "%s Auto-Flush catching up %d packets (%d)ms.\n", switch_core_session_get_name(session), rtp_session->sync_packets, (rtp_session->ms_per_packet * rtp_session->sync_packets) / 1000); + switch_core_timer_sync(&rtp_session->timer); } else { switch_core_timer_next(&rtp_session->timer); From 52972343450ab7709bb8dfbfa531a98800051881 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 30 Nov 2012 14:05:45 -0600 Subject: [PATCH 05/23] not quite, one more tweak --- src/switch_rtp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index bb04f5bff3..bceaf5e743 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -3254,7 +3254,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ } } - if (rtp_session->hot_hits > 10 && !rtp_session->sync_packets) {// >= (rtp_session->samples_per_second * 30)) { + if (rtp_session->hot_hits > 1 && !rtp_session->sync_packets) {// >= (rtp_session->samples_per_second * 30)) { hot_socket = 1; } } else { @@ -3278,6 +3278,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ switch_core_session_get_name(session), rtp_session->sync_packets, (rtp_session->ms_per_packet * rtp_session->sync_packets) / 1000); switch_core_timer_sync(&rtp_session->timer); + rtp_session->hot_hits = 0; } else { switch_core_timer_next(&rtp_session->timer); From e10437534e1c11905677dc98d2c06582932244e4 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 30 Nov 2012 14:56:36 -0600 Subject: [PATCH 06/23] fix fifo queue_manager placement --- src/mod/applications/mod_fifo/mod_fifo.c | 29 ++++++++++++------------ 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 8970803f44..00b411572c 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -4034,20 +4034,6 @@ static switch_status_t load_config(int reload, int del_all) globals.dbname = "fifo"; } - switch_sql_queue_manager_init_name("fifo", - &globals.qm, - 2, - globals.odbc_dsn ? globals.odbc_dsn : globals.dbname, - SWITCH_MAX_TRANS, - globals.pre_trans_execute, - globals.post_trans_execute, - globals.inner_pre_trans_execute, - globals.inner_post_trans_execute); - - switch_sql_queue_manager_start(globals.qm); - - - if (!(dbh = fifo_get_db_handle())) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot open DB!\n"); goto done; @@ -4499,6 +4485,19 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_fifo_load) return status; } + if (globals.odbc_dsn || globals.dbname) { + switch_sql_queue_manager_init_name("fifo", + &globals.qm, + 2, + globals.odbc_dsn ? globals.odbc_dsn : globals.dbname, + SWITCH_MAX_TRANS, + globals.pre_trans_execute, + globals.post_trans_execute, + globals.inner_pre_trans_execute, + globals.inner_post_trans_execute); + } + + /* connect my internal structure to the blank pointer passed to me */ *module_interface = switch_loadable_module_create_module_interface(pool, modname); SWITCH_ADD_APP(app_interface, "fifo", "Park with FIFO", FIFO_DESC, fifo_function, FIFO_USAGE, SAF_NONE); @@ -4529,6 +4528,8 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_fifo_shutdown) fifo_node_t *node, *this_node; switch_mutex_t *mutex = globals.mutex; + switch_sql_queue_manager_destroy(&globals.qm); + switch_event_unbind(&globals.node); switch_event_free_subclass(FIFO_EVENT); From a284f0a4c60a17b365dff521ca601acc67cf405d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 30 Nov 2012 15:01:16 -0600 Subject: [PATCH 07/23] doh --- src/mod/applications/mod_fifo/mod_fifo.c | 27 +++++++++++++----------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 00b411572c..ae46280900 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -4040,6 +4040,21 @@ static switch_status_t load_config(int reload, int del_all) } if (!reload) { + + + switch_sql_queue_manager_init_name("fifo", + &globals.qm, + 2, + globals.odbc_dsn ? globals.odbc_dsn : globals.dbname, + SWITCH_MAX_TRANS, + globals.pre_trans_execute, + globals.post_trans_execute, + globals.inner_pre_trans_execute, + globals.inner_post_trans_execute); + + + + switch_cache_db_test_reactive(dbh, "delete from fifo_outbound where static = 1 or taking_calls < 0 or stop_time < 0", "drop table fifo_outbound", outbound_sql); switch_cache_db_test_reactive(dbh, "delete from fifo_bridge", "drop table fifo_bridge", bridge_sql); @@ -4485,18 +4500,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_fifo_load) return status; } - if (globals.odbc_dsn || globals.dbname) { - switch_sql_queue_manager_init_name("fifo", - &globals.qm, - 2, - globals.odbc_dsn ? globals.odbc_dsn : globals.dbname, - SWITCH_MAX_TRANS, - globals.pre_trans_execute, - globals.post_trans_execute, - globals.inner_pre_trans_execute, - globals.inner_post_trans_execute); - } - /* connect my internal structure to the blank pointer passed to me */ *module_interface = switch_loadable_module_create_module_interface(pool, modname); From 45e116f3540faf209aa2b4cc66a83f5e63e9bd1e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sun, 2 Dec 2012 09:58:33 -0600 Subject: [PATCH 08/23] revert this, probably not needed --- 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 bceaf5e743..652ffb11a9 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -3234,7 +3234,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER)) { if ((switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOFLUSH) || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_STICKY_FLUSH)) && - rtp_session->read_pollfd && (!rtp_session->jb || rtp_session->pause_jb)) { + rtp_session->read_pollfd) { if (switch_poll(rtp_session->read_pollfd, 1, &fdr, 0) == SWITCH_STATUS_SUCCESS) { status = read_rtp_packet(rtp_session, &bytes, flags, SWITCH_FALSE); /* switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Initial (%i) %d\n", status, bytes); */ From 5f78fcbe15f06e52985410838f34c2516b47e1c2 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 3 Dec 2012 08:07:24 -0600 Subject: [PATCH 09/23] FS-4886 --resolve the file permisions must be set properly by you, you must have installed it as root then changed users. This patch will fix the crash. --- src/mod/applications/mod_httapi/mod_httapi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_httapi/mod_httapi.c b/src/mod/applications/mod_httapi/mod_httapi.c index 845c342f63..275e2f47ff 100644 --- a/src/mod/applications/mod_httapi/mod_httapi.c +++ b/src/mod/applications/mod_httapi/mod_httapi.c @@ -2565,7 +2565,12 @@ static switch_status_t locate_url_file(http_file_context_t *context, const char } - fetch_cache_data(context, url, &headers, context->cache_file); + if ((status = fetch_cache_data(context, url, &headers, context->cache_file)) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error checking file cache (check permissions)\n"); + goto end; + } + + metadata = switch_core_sprintf(context->pool, "%s:%s:%s:%s", url, switch_event_get_header_nil(headers, "last-modified"), From edfd49cd40ccba680889b2a02d575029966dd382 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 3 Dec 2012 08:49:50 -0600 Subject: [PATCH 10/23] FS-4903 --resolve --- src/mod/applications/mod_fifo/mod_fifo.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index ae46280900..c05c02ed85 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -759,8 +759,12 @@ static switch_status_t fifo_execute_sql_queued(char **sqlp, switch_bool_t sql_al if (switch_stristr("insert", sql)) { index = 0; } - - switch_sql_queue_manager_push(globals.qm, sql, index, !sql_already_dynamic); + + if (block) { + switch_sql_queue_manager_push_confirm(globals.qm, sql, index, !sql_already_dynamic); + } else { + switch_sql_queue_manager_push(globals.qm, sql, index, !sql_already_dynamic); + } if (sql_already_dynamic) { *sqlp = NULL; @@ -2248,7 +2252,7 @@ static void fifo_caller_add(fifo_node_t *node, switch_core_session_t *session) switch_str_nil(switch_channel_get_variable(channel, "caller_id_number")), switch_epoch_time_now(NULL)); - fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_FALSE); + fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_TRUE); } static void fifo_caller_del(const char *uuid) @@ -2261,7 +2265,7 @@ static void fifo_caller_del(const char *uuid) sql = switch_mprintf("delete from fifo_callers"); } - fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_FALSE); + fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_TRUE); } @@ -3998,6 +4002,8 @@ static switch_status_t load_config(int reload, int del_all) return SWITCH_STATUS_TERM; } + globals.dbname = "fifo"; + if ((settings = switch_xml_child(cfg, "settings"))) { for (param = switch_xml_child(settings, "param"); param; param = param->next) { char *var = NULL; @@ -4030,9 +4036,6 @@ static switch_status_t load_config(int reload, int del_all) } } - if (zstr(globals.odbc_dsn)) { - globals.dbname = "fifo"; - } if (!(dbh = fifo_get_db_handle())) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot open DB!\n"); @@ -4040,18 +4043,17 @@ static switch_status_t load_config(int reload, int del_all) } if (!reload) { - - switch_sql_queue_manager_init_name("fifo", &globals.qm, 2, - globals.odbc_dsn ? globals.odbc_dsn : globals.dbname, + !zstr(globals.odbc_dsn) ? globals.odbc_dsn : globals.dbname, SWITCH_MAX_TRANS, globals.pre_trans_execute, globals.post_trans_execute, globals.inner_pre_trans_execute, globals.inner_post_trans_execute); - + + switch_sql_queue_manager_start(globals.qm); From ca50ea834a83ca68930b000b451081dc0e4b7b9b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 3 Dec 2012 16:39:09 -0600 Subject: [PATCH 11/23] FS-4902 --resolve --- .../mod_cdr_mongodb/mod_cdr_mongodb.c | 64 ++++++++++++++++--- 1 file changed, 54 insertions(+), 10 deletions(-) diff --git a/src/mod/event_handlers/mod_cdr_mongodb/mod_cdr_mongodb.c b/src/mod/event_handlers/mod_cdr_mongodb/mod_cdr_mongodb.c index 8a2b30d5e9..4fe0eb6725 100644 --- a/src/mod/event_handlers/mod_cdr_mongodb/mod_cdr_mongodb.c +++ b/src/mod/event_handlers/mod_cdr_mongodb/mod_cdr_mongodb.c @@ -119,7 +119,10 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) switch_app_log_t *app_log; bson cdr; int is_b; + int callflow_idx = 0; + switch_hold_record_t *hold_record = switch_channel_get_hold_record(channel), *hr; char *tmp; + char idx_buffer[4]; if (globals.shutdown) { return SWITCH_STATUS_SUCCESS; @@ -170,26 +173,52 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) /* App log */ if ((app_log = switch_core_session_get_app_log(session))) { + int idx = 0; switch_app_log_t *ap; - bson_append_start_object(&cdr, "app_log"); + bson_append_start_array(&cdr, "app_log"); + for (ap = app_log; ap; ap = ap->next) { - bson_append_start_object(&cdr, "application"); + switch_snprintf(idx_buffer, sizeof(idx_buffer), "%d", idx); + bson_append_start_object(&cdr, idx_buffer); bson_append_string(&cdr, "app_name", ap->app); bson_append_string(&cdr, "app_data", switch_str_nil(ap->arg)); bson_append_long(&cdr, "app_stamp", ap->stamp); bson_append_finish_object(&cdr); /* application */ + idx++; } - bson_append_finish_object(&cdr); /* app_log */ + bson_append_finish_array(&cdr); /* app_log */ + } + + /* Hold */ + if (hold_record) { + int idx = 0; + bson_append_start_array(&cdr, "hold_record"); + for (hr = hold_record; hr ; hr = hr->next) { + switch_snprintf(idx_buffer, sizeof(idx_buffer), "%d", idx); + bson_append_start_object(&cdr, idx_buffer); + bson_append_long(&cdr, "on", hr->on); + bson_append_long(&cdr, "off", hr->off); + if (hr->uuid) { + bson_append_string(&cdr, "bridged_to", hr->uuid); + } + bson_append_finish_object(&cdr); + idx++; + } + bson_append_finish_array(&cdr); } /* Callflow */ caller_profile = switch_channel_get_caller_profile(channel); + /* Start callflow array */ + bson_append_start_array(&cdr, "callflow"); + while (caller_profile) { - bson_append_start_object(&cdr, "callflow"); + snprintf(idx_buffer, sizeof(idx_buffer), "%d", callflow_idx); + bson_append_start_object(&cdr, idx_buffer); if (!zstr(caller_profile->dialplan)) { bson_append_string(&cdr, "dialplan", caller_profile->dialplan); @@ -262,37 +291,49 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) set_bson_profile_data(&cdr, caller_profile); if (caller_profile->origination_caller_profile) { + int idx = 0; switch_caller_profile_t *cp = NULL; - bson_append_start_object(&cdr, "origination"); + /* Start origination array */ + bson_append_start_array(&cdr, "origination"); for (cp = caller_profile->origination_caller_profile; cp; cp = cp->next) { - bson_append_start_object(&cdr, "origination_caller_profile"); + snprintf(idx_buffer, sizeof(idx_buffer), "%d", idx); + bson_append_start_object(&cdr, idx_buffer); set_bson_profile_data(&cdr, cp); bson_append_finish_object(&cdr); + idx++; } bson_append_finish_object(&cdr); /* origination */ } if (caller_profile->originator_caller_profile) { + int idx = 0; switch_caller_profile_t *cp = NULL; - bson_append_start_object(&cdr, "originator"); + /* Start originator array */ + bson_append_start_array(&cdr, "originator"); for (cp = caller_profile->originator_caller_profile; cp; cp = cp->next) { - bson_append_start_object(&cdr, "originator_caller_profile"); + snprintf(idx_buffer, sizeof(idx_buffer), "%d", idx); + bson_append_start_object(&cdr, idx_buffer); set_bson_profile_data(&cdr, cp); bson_append_finish_object(&cdr); + idx++; } bson_append_finish_object(&cdr); /* originator */ } if (caller_profile->originatee_caller_profile) { + int idx = 0; switch_caller_profile_t *cp = NULL; - bson_append_start_object(&cdr, "originatee"); + /* Start originatee array */ + bson_append_start_array(&cdr, "originatee"); for (cp = caller_profile->originatee_caller_profile; cp; cp = cp->next) { - bson_append_start_object(&cdr, "originatee_caller_profile"); + snprintf(idx_buffer, sizeof(idx_buffer), "%d", idx); + bson_append_start_object(&cdr, idx_buffer); set_bson_profile_data(&cdr, cp); bson_append_finish_object(&cdr); + idx++; } bson_append_finish_object(&cdr); /* originatee */ } @@ -320,8 +361,11 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) bson_append_finish_object(&cdr); /* callflow */ caller_profile = caller_profile->next; + callflow_idx++; /* increment callflow_idx */ } + bson_append_finish_array(&cdr); + bson_finish(&cdr); switch_mutex_lock(globals.mongo_mutex); From 76dcefcee4bdbbb87a81255dca6c1d5d42ce86d5 Mon Sep 17 00:00:00 2001 From: Raymond Chandler Date: Mon, 3 Dec 2012 23:12:55 -0500 Subject: [PATCH 12/23] attempt to fix detection of libdl for sqlite --- libs/sqlite/configure.ac | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/sqlite/configure.ac b/libs/sqlite/configure.ac index 75d6f512d1..3522235852 100644 --- a/libs/sqlite/configure.ac +++ b/libs/sqlite/configure.ac @@ -634,6 +634,7 @@ else LIBS="" AC_SEARCH_LIBS(tgetent, [readline ncurses curses termcap]) AC_CHECK_LIB([readline], [readline]) + AC_CHECK_LIB([dl], [dlopen]) TARGET_READLINE_LIBS="$LIBS" fi AC_SUBST(TARGET_READLINE_LIBS) From 330868f455fe3796f8fbb5c1105e2f0985a2bc5c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 4 Dec 2012 07:44:41 -0600 Subject: [PATCH 13/23] FS-4808 see if this helps --- src/mod/endpoints/mod_dingaling/mod_dingaling.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index 2878968ddf..753e037a9d 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -1490,11 +1490,11 @@ static int activate_rtp(struct private_object *tech_pvt) { int r = 0; - if (tech_pvt->transports[LDL_TPORT_RTP].ready) { + if (tech_pvt->transports[LDL_TPORT_RTP].ready && tech_pvt->transports[LDL_TPORT_RTCP].ready) { r += activate_audio_rtp(tech_pvt); } - if (tech_pvt->transports[LDL_TPORT_VIDEO_RTP].ready) { + if (tech_pvt->transports[LDL_TPORT_VIDEO_RTP].ready && tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].ready) { r += activate_video_rtp(tech_pvt); } From 08ecd195b57daaa198cac74ce3858fdd1e94205f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 4 Dec 2012 07:46:31 -0600 Subject: [PATCH 14/23] FS-4813 --resolve --- 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 306f5fe42c..358a017db3 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1354,7 +1354,7 @@ static void our_sofia_event_callback(nua_event_t event, switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Request-Target-Extension", ref_to_user); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Request-Target-Domain", ref_to_host); if (switch_true(full_url)) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "full-url", "true"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "full_url", "true"); } if (sip->sip_call_id && sip->sip_call_id->i_id) { From 83ecc518f68024a7adfd11296503ce22d3c25886 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Tue, 4 Dec 2012 10:05:54 -0600 Subject: [PATCH 15/23] fix sqlite reconf --- Makefile.am | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 2104db9b75..ddcf2fca06 100644 --- a/Makefile.am +++ b/Makefile.am @@ -470,11 +470,17 @@ libs/speex/libspeex/libspeexdsp.la: libs/speex/.update @cd libs/speex && $(MAKE) @$(TOUCH_TARGET) -libs/sqlite/libsqlite3.la: libs/sqlite libs/sqlite/.update +libs/sqlite/libsqlite3.la: libs/sqlite libs/sqlite/Makefile libs/sqlite/.update touch src/include/switch.h @cd libs/sqlite && $(MAKE) CFLAGS="$(SWITCH_AM_CFLAGS)" @$(TOUCH_TARGET) +libs/sqlite/Makefile: libs/sqlite/configure.ac + cd libs/sqlite && autoconf + cd libs/sqlite && ./config.status --recheck + cd libs/sqlite && ./config.status + @$(TOUCH_TARGET) + libs/pcre/libpcre.la: libs/pcre libs/pcre/.update touch src/include/switch.h @cd libs/pcre && $(MAKE) From effeee8c9e5f13a1fad0fc1d2af660d13981760e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 4 Dec 2012 10:58:44 -0600 Subject: [PATCH 16/23] add cr --- 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 358a017db3..161d245ea5 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2423,7 +2423,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void if (!profile->nua) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Creating SIP UA for profile: %s\n" "The likely causes for this are:\n" "1) Another application is already listening on the specified address.\n" - "2) The IP the profile is attempting to bind to is not local to this system.", profile->name); + "2) The IP the profile is attempting to bind to is not local to this system.\n", profile->name); sofia_profile_start_failure(profile, profile->name); sofia_glue_del_profile(profile); goto end; From 673b1019a27a20546a75c5ad81606736c43fa0b7 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 4 Dec 2012 11:18:19 -0600 Subject: [PATCH 17/23] comment patch from e644e620c89867895cb4e69f834913f5df1070e2 seems to cause issues --- src/mod/endpoints/mod_sofia/sofia_glue.c | 6 +++--- 1 file 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 efdce9449e..d24b3182c1 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -707,9 +707,9 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch if (ov_fmtp) { pass_fmtp = ov_fmtp; - } else { - pass_fmtp = switch_channel_get_variable(tech_pvt->channel, "sip_video_fmtp"); - } + }// else { // seems to break eyebeam at least... + //pass_fmtp = switch_channel_get_variable(tech_pvt->channel, "sip_video_fmtp"); + //} } if (pass_fmtp) { From 4b9be86a8e93e989b7987d55aca71308a5e18e5d Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Fri, 30 Nov 2012 17:19:32 +0000 Subject: [PATCH 18/23] lets make the revs work correctly --- scripts/ci/src_tarball.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/ci/src_tarball.sh b/scripts/ci/src_tarball.sh index 1c79f2fca1..4e64d68e77 100755 --- a/scripts/ci/src_tarball.sh +++ b/scripts/ci/src_tarball.sh @@ -8,8 +8,12 @@ sdir="." check_pwd check_input_ver_build $@ eval $(parse_version "$1") +if [ -n "$grev" ]; then + dst_name="freeswitch-$cmajor.$cminor.$cmicro.$grev" +else + dst_name="freeswitch-$cmajor.$cminor.$cmicro" +fi -dst_name="freeswitch-$cmajor.$cminor.$cmicro" dst_dir="${tmp_dir}/jenkins.$$/$dst_name" if [ -d "$dst_dir" ]; then From 1d6b646c5499a2d56be6442d7113e86ae5e32067 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 4 Dec 2012 16:04:16 -0600 Subject: [PATCH 19/23] wait for threads to end on shutdown --- src/switch_core_session.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/switch_core_session.c b/src/switch_core_session.c index c2fb0ea8d6..74dae6e68a 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -1688,6 +1688,12 @@ static void *SWITCH_THREAD_FUNC switch_core_session_thread_pool_manager(switch_t check_queue(); } + + while(session_manager.running) { + switch_queue_trypush(session_manager.thread_queue, NULL); + switch_yield(20000); + } + return NULL; } From 94d044d2f4eb0d406dec2d7ff118aa0078b3feb2 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 5 Dec 2012 10:22:09 -0600 Subject: [PATCH 20/23] FS-4808 revert --- src/mod/endpoints/mod_dingaling/mod_dingaling.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index 753e037a9d..2878968ddf 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -1490,11 +1490,11 @@ static int activate_rtp(struct private_object *tech_pvt) { int r = 0; - if (tech_pvt->transports[LDL_TPORT_RTP].ready && tech_pvt->transports[LDL_TPORT_RTCP].ready) { + if (tech_pvt->transports[LDL_TPORT_RTP].ready) { r += activate_audio_rtp(tech_pvt); } - if (tech_pvt->transports[LDL_TPORT_VIDEO_RTP].ready && tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].ready) { + if (tech_pvt->transports[LDL_TPORT_VIDEO_RTP].ready) { r += activate_video_rtp(tech_pvt); } From b92560c53f41e8c04387f3bc096d3f982700b468 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 5 Dec 2012 10:59:06 -0600 Subject: [PATCH 21/23] FS-4808 try this --- .../endpoints/mod_dingaling/mod_dingaling.c | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index 2878968ddf..da0cbdeb02 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -83,7 +83,8 @@ typedef enum { TFLAG_TRANSPORT_ACCEPT = (1 << 22), TFLAG_READY = (1 << 23), TFLAG_NAT_MAP = (1 << 24), - TFLAG_SECURE = (1 << 25) + TFLAG_SECURE = (1 << 25), + TFLAG_VIDEO_RTP_READY = (1 << 7) } TFLAGS; typedef enum { @@ -240,7 +241,7 @@ struct private_object { switch_mutex_t *flag_mutex; int read_count; - + switch_time_t audio_ready; }; @@ -1345,10 +1346,6 @@ static int activate_video_rtp(struct private_object *tech_pvt) switch_rtp_destroy(&tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session); } - - - - } else { if (switch_core_codec_init(&tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_name, @@ -1460,6 +1457,7 @@ static int activate_video_rtp(struct private_object *tech_pvt) tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_user, NULL);//tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_pass); switch_channel_set_flag(channel, CF_VIDEO); + switch_set_flag(tech_pvt, TFLAG_VIDEO_RTP_READY); //switch_rtp_set_default_payload(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_num); //switch_rtp_set_recv_pt(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_num); @@ -1491,11 +1489,15 @@ static int activate_rtp(struct private_object *tech_pvt) int r = 0; if (tech_pvt->transports[LDL_TPORT_RTP].ready) { - r += activate_audio_rtp(tech_pvt); + if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND) || tech_pvt->transports[LDL_TPORT_RTCP].accepted) { + r += activate_audio_rtp(tech_pvt); + } } if (tech_pvt->transports[LDL_TPORT_VIDEO_RTP].ready) { - r += activate_video_rtp(tech_pvt); + if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND) || tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].accepted) { + r += activate_video_rtp(tech_pvt); + } } return r; @@ -1631,6 +1633,7 @@ static int do_candidates(struct private_object *tech_pvt, int force) if ((tech_pvt->transports[LDL_TPORT_RTP].ready && tech_pvt->transports[LDL_TPORT_RTCP].ready)) { switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT); switch_set_flag_locked(tech_pvt, TFLAG_RTP_READY); + tech_pvt->audio_ready = switch_micro_time_now(); } @@ -1793,7 +1796,7 @@ static switch_status_t negotiate_media(switch_core_session_t *session) struct private_object *tech_pvt = NULL; switch_time_t started; switch_time_t now; - unsigned int elapsed; + unsigned int elapsed, audio_elapsed; tech_pvt = switch_core_session_get_private(session); switch_assert(tech_pvt != NULL); @@ -1815,12 +1818,20 @@ static switch_status_t negotiate_media(switch_core_session_t *session) while (!(switch_test_flag(tech_pvt, TFLAG_CODEC_READY) && switch_test_flag(tech_pvt, TFLAG_RTP_READY) && + (switch_test_flag(tech_pvt, TFLAG_OUTBOUND) || switch_test_flag(tech_pvt, TFLAG_VIDEO_RTP_READY)) && switch_test_flag(tech_pvt, TFLAG_ANSWER) && switch_test_flag(tech_pvt, TFLAG_TRANSPORT_ACCEPT) && //tech_pvt->read_count && tech_pvt->transports[LDL_TPORT_RTP].remote_ip && tech_pvt->transports[LDL_TPORT_RTP].remote_port && switch_test_flag(tech_pvt, TFLAG_TRANSPORT))) { now = switch_micro_time_now(); elapsed = (unsigned int) ((now - started) / 1000); + if (switch_test_flag(tech_pvt, TFLAG_RTP_READY) && !switch_test_flag(tech_pvt, TFLAG_VIDEO_RTP_READY)) { + audio_elapsed = (unsigned int) ((now - tech_pvt->audio_ready) / 1000); + if (audio_elapsed > 1000) { + switch_set_flag(tech_pvt, TFLAG_VIDEO_RTP_READY); + } + } + if (switch_channel_down(channel) || switch_test_flag(tech_pvt, TFLAG_BYE)) { goto out; } From a5dbd2654806a3d613b8ed71bd487dcd34679779 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 5 Dec 2012 13:17:50 -0600 Subject: [PATCH 22/23] fix some delay regressions --- src/switch_ivr.c | 2 ++ src/switch_ivr_bridge.c | 4 ++-- src/switch_ivr_originate.c | 8 ++++---- src/switch_rtp.c | 6 ++++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/switch_ivr.c b/src/switch_ivr.c index dd5055351c..6aa5166634 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -640,6 +640,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se switch_channel_set_flag(channel, CF_BREAK); } + switch_channel_audio_sync(channel); } } else if (cmd_hash == CMD_UNICAST) { char *local_ip = switch_event_get_header(event, "local-ip"); @@ -1771,6 +1772,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_ switch_channel_set_caller_profile(channel, new_profile); switch_channel_set_state(channel, CS_ROUTING); + switch_channel_audio_sync(channel); msg.message_id = SWITCH_MESSAGE_INDICATE_TRANSFER; msg.from = __FILE__; diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index b8b04cdbd0..52cc7c6693 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -1232,8 +1232,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses switch_channel_set_flag_recursive(caller_channel, CF_BRIDGE_ORIGINATOR); switch_channel_clear_flag(peer_channel, CF_BRIDGE_ORIGINATOR); - //switch_channel_audio_sync(caller_channel); - //switch_channel_audio_sync(peer_channel); + switch_channel_audio_sync(caller_channel); + switch_channel_audio_sync(peer_channel); b_leg->session = peer_session; switch_copy_string(b_leg->b_uuid, switch_core_session_get_uuid(session), sizeof(b_leg->b_uuid)); diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 52d903c79d..dc281b5885 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -3707,11 +3707,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess switch_cond_next(); } - //switch_channel_audio_sync(bchan); + switch_channel_audio_sync(bchan); - //if (caller_channel) { - // switch_channel_audio_sync(caller_channel); - //} + if (caller_channel) { + switch_channel_audio_sync(caller_channel); + } } if (oglobals.session) { diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 652ffb11a9..951edb70b7 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -2072,7 +2072,7 @@ SWITCH_DECLARE(switch_rtp_t *) switch_rtp_new(const char *rx_host, rtp_session->ready = 2; rtp_session->rx_host = switch_core_strdup(rtp_session->pool, rx_host); rtp_session->rx_port = rx_port; - //switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_FLUSH); + switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_FLUSH); } else { switch_rtp_release_port(rx_host, rx_port); } @@ -2763,7 +2763,8 @@ SWITCH_DECLARE(void) rtp_flush_read_buffer(switch_rtp_t *rtp_session, switch_rtp if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO)) { - + switch_set_flag(rtp_session, SWITCH_RTP_FLAG_FLUSH); + switch (flush) { case SWITCH_RTP_FLUSH_STICK: switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_STICKY_FLUSH); @@ -2818,6 +2819,7 @@ static void do_flush(switch_rtp_t *rtp_session) if (switch_rtp_ready(rtp_session)) { bytes = sizeof(rtp_msg_t); switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock_input, 0, (void *) &rtp_session->recv_msg, &bytes); + if (bytes) { int do_cng = 0; From 91eef34d5cf07b62b071a8dee1722fa3b2702e5b Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Thu, 6 Dec 2012 05:04:29 +0000 Subject: [PATCH 23/23] rev bump --- configure.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index 6f7c2eea68..6dbdfb7759 100644 --- a/configure.in +++ b/configure.in @@ -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.2.5.2], BUG-REPORT-ADDRESS) +AC_INIT([freeswitch], [1.2.5.3], BUG-REPORT-ADDRESS) AC_SUBST(SWITCH_VERSION_MAJOR, [1]) AC_SUBST(SWITCH_VERSION_MINOR, [2]) -AC_SUBST(SWITCH_VERSION_MICRO, [5.2]) +AC_SUBST(SWITCH_VERSION_MICRO, [5.3]) AC_SUBST(SWITCH_VERSION_REVISION, []) AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, [])