From 9f1b731164a2dd7c4aa20920184751066a560afc Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 12 Jul 2011 20:33:58 -0500 Subject: [PATCH 01/16] up vals --- src/mod/endpoints/mod_sofia/mod_sofia.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 3350b7b7f8..8b1422ba8c 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -317,8 +317,8 @@ typedef enum { TFLAG_MAX } TFLAGS; -#define SOFIA_MAX_MSG_QUEUE 26 -#define SOFIA_MSG_QUEUE_SIZE 20 +#define SOFIA_MAX_MSG_QUEUE 51 +#define SOFIA_MSG_QUEUE_SIZE 2000 struct mod_sofia_globals { switch_memory_pool_t *pool; From 11690aff4c4b819e981c4763abff37c33700f5ab Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 12 Jul 2011 20:36:08 -0500 Subject: [PATCH 02/16] remove some unnecessary sql stmts --- src/switch_core_sqldb.c | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 7d40114ed1..b3c2e7112c 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -964,6 +964,12 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, switch_mutex_lock(sql_manager.cond_mutex); + + switch_cache_db_execute_sql(sql_manager.event_db, "PRAGMA synchronous=OFF;", NULL); + switch_cache_db_execute_sql(sql_manager.event_db, "PRAGMA count_changes=OFF;", NULL); + switch_cache_db_execute_sql(sql_manager.event_db, "PRAGMA temp_store=MEMORY;", NULL); + switch_cache_db_execute_sql(sql_manager.event_db, "PRAGMA journal_mode=OFF;", NULL); + while (sql_manager.thread_running == 1) { if (save_sql || switch_queue_trypop(sql_manager.sql_queue[0], &pop) == SWITCH_STATUS_SUCCESS || switch_queue_trypop(sql_manager.sql_queue[1], &pop) == SWITCH_STATUS_SUCCESS) { @@ -1055,6 +1061,8 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, #ifdef DEBUG_SQL switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "DONE\n"); #endif + + iterations = 0; trans = 0; len = 0; @@ -1062,6 +1070,8 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, lc = 0; if (do_sleep) { switch_yield(200000); + } else { + switch_yield(1000); } wrote = 1; } @@ -1228,6 +1238,7 @@ static void core_event_handler(switch_event_t *event) ); break; case SWITCH_EVENT_CODEC: + new_sql() = switch_mprintf ("update channels set read_codec='%q',read_rate='%q',read_bit_rate='%q',write_codec='%q',write_rate='%q',write_bit_rate='%q' where uuid='%q' and hostname='%q'", @@ -1322,9 +1333,18 @@ static void core_event_handler(switch_event_t *event) break; case SWITCH_EVENT_CHANNEL_CALLSTATE: { - new_sql() = switch_mprintf("update channels set callstate='%q' where uuid='%q' and hostname='%q'", - switch_event_get_header_nil(event, "channel-call-state"), - switch_event_get_header_nil(event, "unique-id"), switch_core_get_switchname()); + char *num = switch_event_get_header_nil(event, "channel-call-state-number"); + switch_channel_callstate_t callstate = CCS_DOWN; + + if (num) { + callstate = atoi(num); + } + + if (callstate != CCS_DOWN && callstate != CCS_HANGUP) { + new_sql() = switch_mprintf("update channels set callstate='%q' where uuid='%q' and hostname='%q'", + switch_event_get_header_nil(event, "channel-call-state"), + switch_event_get_header_nil(event, "unique-id"), switch_core_get_switchname()); + } } break; @@ -1338,8 +1358,10 @@ static void core_event_handler(switch_event_t *event) } switch (state_i) { + case CS_NEW: case CS_HANGUP: case CS_DESTROY: + case CS_REPORTING: break; case CS_ROUTING: if ((extra_cols = parse_presence_data_cols(event))) { @@ -1802,8 +1824,9 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_ switch_cache_db_execute_sql(dbh, "drop table tasks", NULL); switch_cache_db_execute_sql(dbh, "PRAGMA synchronous=OFF;", NULL); switch_cache_db_execute_sql(dbh, "PRAGMA count_changes=OFF;", NULL); - switch_cache_db_execute_sql(dbh, "PRAGMA cache_size=8000", NULL); + switch_cache_db_execute_sql(dbh, "PRAGMA default_cache_size=8000", NULL); switch_cache_db_execute_sql(dbh, "PRAGMA temp_store=MEMORY;", NULL); + switch_cache_db_execute_sql(dbh, "PRAGMA journal_mode=OFF;", NULL); } break; } From 0521886de89621ab6cc76b71f6557f5e8867ca81 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 12 Jul 2011 20:36:36 -0500 Subject: [PATCH 03/16] use rwlock for global vars to reduce contention --- src/include/private/switch_core_pvt.h | 2 +- src/switch_channel.c | 1 + src/switch_core.c | 31 ++++++++++++++------------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index 3b530b3940..6115e70ede 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -221,7 +221,7 @@ struct switch_runtime { switch_mutex_t *throttle_mutex; switch_mutex_t *session_hash_mutex; switch_mutex_t *global_mutex; - switch_mutex_t *global_var_mutex; + switch_thread_rwlock_t *global_var_rwlock; uint32_t sps_total; int32_t sps; int32_t sps_last; diff --git a/src/switch_channel.c b/src/switch_channel.c index b1abb86cd8..f5667100a8 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -219,6 +219,7 @@ SWITCH_DECLARE(void) switch_channel_perform_set_callstate(switch_channel_t *chan if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_CALLSTATE) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Original-Channel-Call-State", switch_channel_callstate2str(o_callstate)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Call-State-Number", "%d", callstate); switch_channel_event_set_data(channel, event); switch_event_fire(&event); } diff --git a/src/switch_core.c b/src/switch_core.c index 721d53cfef..e7cd60d58f 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -304,9 +304,9 @@ SWITCH_DECLARE(const char *) switch_core_get_switchname(void) SWITCH_DECLARE(char *) switch_core_get_variable(const char *varname) { char *val; - switch_mutex_lock(runtime.global_var_mutex); + switch_thread_rwlock_rdlock(runtime.global_var_rwlock); val = (char *) switch_event_get_header(runtime.global_vars, varname); - switch_mutex_unlock(runtime.global_var_mutex); + switch_thread_rwlock_unlock(runtime.global_var_rwlock); return val; } @@ -314,11 +314,11 @@ SWITCH_DECLARE(char *) switch_core_get_variable_dup(const char *varname) { char *val = NULL, *v; - switch_mutex_lock(runtime.global_var_mutex); + switch_thread_rwlock_rdlock(runtime.global_var_rwlock); if ((v = (char *) switch_event_get_header(runtime.global_vars, varname))) { val = strdup(v); } - switch_mutex_unlock(runtime.global_var_mutex); + switch_thread_rwlock_unlock(runtime.global_var_rwlock); return val; } @@ -327,21 +327,21 @@ SWITCH_DECLARE(char *) switch_core_get_variable_pdup(const char *varname, switch { char *val = NULL, *v; - switch_mutex_lock(runtime.global_var_mutex); + switch_thread_rwlock_rdlock(runtime.global_var_rwlock); if ((v = (char *) switch_event_get_header(runtime.global_vars, varname))) { val = switch_core_strdup(pool, v); } - switch_mutex_unlock(runtime.global_var_mutex); + switch_thread_rwlock_unlock(runtime.global_var_rwlock); return val; } static void switch_core_unset_variables(void) { - switch_mutex_lock(runtime.global_var_mutex); + switch_thread_rwlock_wrlock(runtime.global_var_rwlock); switch_event_destroy(&runtime.global_vars); switch_event_create_plain(&runtime.global_vars, SWITCH_EVENT_CHANNEL_DATA); - switch_mutex_unlock(runtime.global_var_mutex); + switch_thread_rwlock_unlock(runtime.global_var_rwlock); } SWITCH_DECLARE(void) switch_core_set_variable(const char *varname, const char *value) @@ -349,7 +349,7 @@ SWITCH_DECLARE(void) switch_core_set_variable(const char *varname, const char *v char *val; if (varname) { - switch_mutex_lock(runtime.global_var_mutex); + switch_thread_rwlock_wrlock(runtime.global_var_rwlock); val = (char *) switch_event_get_header(runtime.global_vars, varname); if (val) { switch_event_del_header(runtime.global_vars, varname); @@ -361,7 +361,7 @@ SWITCH_DECLARE(void) switch_core_set_variable(const char *varname, const char *v } else { switch_event_del_header(runtime.global_vars, varname); } - switch_mutex_unlock(runtime.global_var_mutex); + switch_thread_rwlock_unlock(runtime.global_var_rwlock); } } @@ -370,17 +370,17 @@ SWITCH_DECLARE(switch_bool_t) switch_core_set_var_conditional(const char *varnam char *val; if (varname) { - switch_mutex_lock(runtime.global_var_mutex); + switch_thread_rwlock_wrlock(runtime.global_var_rwlock); val = (char *) switch_event_get_header(runtime.global_vars, varname); if (val) { if (!val2 || strcmp(val, val2) != 0) { - switch_mutex_unlock(runtime.global_var_mutex); + switch_thread_rwlock_unlock(runtime.global_var_rwlock); return SWITCH_FALSE; } switch_event_del_header(runtime.global_vars, varname); } else if (!zstr(val2)) { - switch_mutex_unlock(runtime.global_var_mutex); + switch_thread_rwlock_unlock(runtime.global_var_rwlock); return SWITCH_FALSE; } @@ -391,7 +391,7 @@ SWITCH_DECLARE(switch_bool_t) switch_core_set_var_conditional(const char *varnam } else { switch_event_del_header(runtime.global_vars, varname); } - switch_mutex_unlock(runtime.global_var_mutex); + switch_thread_rwlock_unlock(runtime.global_var_rwlock); } return SWITCH_TRUE; } @@ -1400,7 +1400,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc switch_mutex_init(&runtime.session_hash_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool); switch_mutex_init(&runtime.global_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool); - switch_mutex_init(&runtime.global_var_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool); + + switch_thread_rwlock_create(&runtime.global_var_rwlock, runtime.memory_pool); switch_core_set_globals(); switch_core_session_init(runtime.memory_pool); switch_event_create_plain(&runtime.global_vars, SWITCH_EVENT_CHANNEL_DATA); From 7cdc8342dcac8c0563486f2a200c9a69620c9a15 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 13 Jul 2011 04:32:00 +0000 Subject: [PATCH 04/16] if user has set presence_id, don't override it --- src/mod/endpoints/mod_sofia/mod_sofia.c | 5 ++++- src/mod/endpoints/mod_sofia/sofia.c | 16 +++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 8504dc137e..7ebbe33f70 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -4358,7 +4358,10 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session if (tech_pvt->local_url) { switch_channel_set_variable(nchannel, "sip_local_url", tech_pvt->local_url); if (profile->pres_type) { - switch_channel_set_variable(nchannel, "presence_id", tech_pvt->local_url); + const char *presence_id = switch_channel_get_variable(nchannel, "presence_id"); + if (zstr(presence_id)) { + switch_channel_set_variable(nchannel, "presence_id", tech_pvt->local_url); + } } } switch_channel_set_variable(nchannel, "sip_destination_url", tech_pvt->dest); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 8817062e59..6823acf133 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -7501,13 +7501,15 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ } if (profile->pres_type) { - const char *user = switch_str_nil(sip->sip_from->a_url->url_user); - const char *host = switch_str_nil(sip->sip_from->a_url->url_host); - - char *tmp = switch_mprintf("%s@%s", user, host); - switch_assert(tmp); - switch_channel_set_variable(channel, "presence_id", tmp); - free(tmp); + const char *presence_id = switch_channel_get_variable(channel, "presence_id"); + if (zstr(presence_id)) { + const char *user = switch_str_nil(sip->sip_from->a_url->url_user); + const char *host = switch_str_nil(sip->sip_from->a_url->url_host); + char *tmp = switch_mprintf("%s@%s", user, host); + switch_assert(tmp); + switch_channel_set_variable(channel, "presence_id", tmp); + free(tmp); + } } From 06322d33e0ff398be17dba8291fad477b87ce3bc Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Wed, 13 Jul 2011 06:04:26 -0500 Subject: [PATCH 05/16] skypopen: brought almost all sleeps to at least 20millisec, because various platforms have no smaller granularity (eg: virtual machines). Fixed bogus values in 'sk list' report --- src/mod/endpoints/mod_skypopen/mod_skypopen.c | 75 ++++++++++--------- .../mod_skypopen/skypopen_protocol.c | 24 +++--- 2 files changed, 54 insertions(+), 45 deletions(-) diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index fb6af40c80..61a4ccae70 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -364,7 +364,7 @@ static switch_status_t interface_exists(char *the_interface) if (globals.SKYPOPEN_INTERFACES[interface_id].skypopen_signaling_thread) { #ifdef WIN32 skypopen_signaling_write(tech_pvt, "DIE"); - switch_sleep(10000); + switch_sleep(20000); switch_file_write(tech_pvt->SkypopenHandles.fdesc[1], "sciutati", &howmany); // let's the controldev_thread die #else /* WIN32 */ howmany = write(tech_pvt->SkypopenHandles.fdesc[1], "sciutati", howmany); @@ -381,7 +381,7 @@ static switch_status_t interface_exists(char *the_interface) if (tech_pvt->running && tech_pvt->SkypopenHandles.disp) { XEvent e; Atom atom1 = XInternAtom(tech_pvt->SkypopenHandles.disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False); - switch_sleep(1000); + switch_sleep(20000); XFlush(tech_pvt->SkypopenHandles.disp); memset(&e, 0, sizeof(e)); e.xclient.type = ClientMessage; @@ -494,9 +494,9 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) DEBUGA_SKYPE("audio tcp threads to DIE\n", SKYPOPEN_P_LOG); conta = 0; while (tech_pvt->tcp_srv_thread) { - switch_sleep(5000); + switch_sleep(50000); conta++; - if (conta == 200) { + if (conta == 20) { ERRORA("tcp_srv_thread is NOT dead, this can LEAK MEMORY\n", SKYPOPEN_P_LOG); break; } @@ -504,9 +504,9 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) DEBUGA_SKYPE("audio tcp srv thread DEAD %d\n", SKYPOPEN_P_LOG, conta); conta = 0; while (tech_pvt->tcp_cli_thread) { - switch_sleep(5000); + switch_sleep(50000); conta++; - if (conta == 200) { + if (conta == 20) { ERRORA("tcp_cli_thread is NOT dead, this can LEAK MEMORY\n", SKYPOPEN_P_LOG); break; } @@ -873,11 +873,13 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch try = 0; if (!bytes_read) { - switch_sleep(1000); + switch_sleep(1000); //XXX don't like this try++; - if (try < 5) + if (try < 5){ + DEBUGA_SKYPE("skypopen_audio_read going back to read\n", SKYPOPEN_P_LOG); goto read; - DEBUGA_SKYPE("skypopen_audio_read Silence\n", SKYPOPEN_P_LOG); + } + WARNINGA("skypopen_audio_read Silence\n", SKYPOPEN_P_LOG); memset(tech_pvt->read_frame.data, 255, BYTES_PER_FRAME); tech_pvt->read_frame.datalen = BYTES_PER_FRAME; @@ -1056,9 +1058,9 @@ static switch_status_t channel_answer_channel(switch_core_session_t *session) if (switch_channel_get_state(channel) == CS_RESET) { return SWITCH_STATUS_FALSE; } - switch_sleep(5000); + switch_sleep(50000); conta++; - if (conta == 100) { //0.5 seconds + if (conta == 10) { //0.5 seconds return SWITCH_STATUS_FALSE; } } @@ -1361,7 +1363,6 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; } - tech_pvt->ob_calls++; rdest = strchr(caller_profile->destination_number, '/'); *rdest++ = '\0'; @@ -1371,6 +1372,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi caller_profile->destination_number = rdest; switch_mutex_lock(tech_pvt->flag_mutex); + tech_pvt->ob_calls++; switch_set_flag(tech_pvt, TFLAG_OUTBOUND); switch_mutex_unlock(tech_pvt->flag_mutex); switch_channel_set_state(channel, CS_INIT); @@ -1428,7 +1430,7 @@ static void *SWITCH_THREAD_FUNC skypopen_signaling_thread_func(switch_thread_t * if (channel) { switch_channel_state_t state = switch_channel_get_state(channel); if (state < CS_EXECUTE) { - switch_sleep(10000); //10 msec, let the state evolve from CS_NEW + switch_sleep(20000); //20 msec, let the state evolve from CS_NEW } switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); } else { @@ -1442,9 +1444,9 @@ static void *SWITCH_THREAD_FUNC skypopen_signaling_thread_func(switch_thread_t * DEBUGA_SKYPE("audio tcp threads to DIE\n", SKYPOPEN_P_LOG); conta = 0; while (tech_pvt->tcp_srv_thread) { - switch_sleep(5000); + switch_sleep(50000); conta++; - if (conta == 200) { + if (conta == 20) { ERRORA("tcp_srv_thread is NOT dead, this can LEAK MEMORY\n", SKYPOPEN_P_LOG); break; } @@ -1452,9 +1454,9 @@ static void *SWITCH_THREAD_FUNC skypopen_signaling_thread_func(switch_thread_t * DEBUGA_SKYPE("audio tcp srv thread DEAD %d\n", SKYPOPEN_P_LOG, conta); conta = 0; while (tech_pvt->tcp_cli_thread) { - switch_sleep(5000); + switch_sleep(50000); conta++; - if (conta == 200) { + if (conta == 20) { ERRORA("tcp_cli_thread is NOT dead, this can LEAK MEMORY\n", SKYPOPEN_P_LOG); break; } @@ -1647,7 +1649,7 @@ static switch_status_t load_config(int reload_type) } else { DEBUGA_SKYPE("Initialized XInitThreads!\n", SKYPOPEN_P_LOG); } - switch_sleep(1000); + switch_sleep(20000); #endif /* WIN32 */ if (interface_id && interface_id < SKYPOPEN_MAX_INTERFACES) { @@ -1795,20 +1797,20 @@ static switch_status_t load_config(int reload_type) SKYPOPEN_P_LOG, interface_id, globals.SKYPOPEN_INTERFACES[interface_id].skype_user); skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[interface_id], "PROTOCOL 7"); - switch_sleep(10000); + switch_sleep(20000); skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[interface_id], "SET AUTOAWAY OFF"); - switch_sleep(10000); + switch_sleep(20000); skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[interface_id], "SET WINDOWSTATE HIDDEN"); - switch_sleep(10000); + switch_sleep(20000); skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[interface_id], "SET USERSTATUS ONLINE"); - switch_sleep(10000); + switch_sleep(20000); if (globals.SKYPOPEN_INTERFACES[interface_id].silent_mode) { skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[interface_id], "SET SILENT_MODE ON"); - switch_sleep(10000); + switch_sleep(20000); skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[interface_id], "SET SILENT_MODE OFF"); - switch_sleep(10000); + switch_sleep(20000); skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[interface_id], "SET SILENT_MODE ON"); - switch_sleep(10000); + switch_sleep(20000); } } else { ERRORA @@ -1929,7 +1931,7 @@ static switch_status_t chat_send(const char *proto, const char *from, const char snprintf(skype_msg, sizeof(skype_msg), "CHAT CREATE %s", to); skypopen_signaling_write(tech_pvt, skype_msg); - switch_sleep(1000); + switch_sleep(20000); } found = 0; @@ -1946,11 +1948,12 @@ static switch_status_t chat_send(const char *proto, const char *from, const char if (found) { break; } - if (tried > 1000) { + tried++; + if (tried > 20) { ERRORA("No chat with dialog_partner='%s' was found\n", SKYPOPEN_P_LOG, to); break; } - switch_sleep(1000); + switch_sleep(50000); } } @@ -2032,12 +2035,12 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypopen_shutdown) if (globals.SKYPOPEN_INTERFACES[interface_id].skypopen_signaling_thread) { #ifdef WIN32 skypopen_signaling_write(tech_pvt, "DIE"); - switch_sleep(10000); + switch_sleep(20000); switch_file_write(tech_pvt->SkypopenHandles.fdesc[1], "sciutati", &howmany); // let's the controldev_thread die #else /* WIN32 */ skypopen_signaling_write(tech_pvt, "DIE"); - switch_sleep(10000); + switch_sleep(20000); howmany = write(tech_pvt->SkypopenHandles.fdesc[1], "sciutati", howmany); #endif /* WIN32 */ } @@ -2053,7 +2056,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypopen_shutdown) XEvent e; Atom atom1 = XInternAtom(tech_pvt->SkypopenHandles.disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False); - switch_sleep(1000); + switch_sleep(20000); XFlush(tech_pvt->SkypopenHandles.disp); memset(&e, 0, sizeof(e)); e.xclient.type = ClientMessage; @@ -2456,12 +2459,12 @@ SWITCH_STANDARD_API(sk_function) for (tmp_i = 0; tmp_i < SKYPOPEN_MAX_INTERFACES; tmp_i++) { if (strlen(globals.SKYPOPEN_INTERFACES[tmp_i].name)) { skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[tmp_i], "GET PROFILE PSTN_BALANCE"); - switch_sleep(10000); + switch_sleep(20000); strncpy(tmp_message, globals.SKYPOPEN_INTERFACES[tmp_i].message, sizeof(globals.SKYPOPEN_INTERFACES[tmp_i].message)); skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[tmp_i], "GET PROFILE PSTN_BALANCE_CURRENCY"); - switch_sleep(10000); + switch_sleep(20000); if(strlen(tmp_message)>21 && strlen(globals.SKYPOPEN_INTERFACES[tmp_i].message) > 30) stream->write_function(stream, " %s \t%s\t%s\n", globals.SKYPOPEN_INTERFACES[tmp_i].name, tmp_message+21, globals.SKYPOPEN_INTERFACES[tmp_i].message+30); } @@ -2480,13 +2483,13 @@ SWITCH_STANDARD_API(sk_function) stream->write_function(stream, "= ====\t ======== \t======= =======\t======\t============\t======\n"); for (i = 0; i < SKYPOPEN_MAX_INTERFACES; i++) { + if (strlen(globals.SKYPOPEN_INTERFACES[i].name)) { next_flag_char = i == globals.next_interface ? '*' : ' '; ib += globals.SKYPOPEN_INTERFACES[i].ib_calls; ib_failed += globals.SKYPOPEN_INTERFACES[i].ib_failed_calls; ob += globals.SKYPOPEN_INTERFACES[i].ob_calls; ob_failed += globals.SKYPOPEN_INTERFACES[i].ob_failed_calls; - if (strlen(globals.SKYPOPEN_INTERFACES[i].name)) { stream->write_function(stream, "%c %d\t[%s]\t%3u/%u\t%6u/%u\t%s\t%s\t%s\n", next_flag_char, @@ -2498,7 +2501,7 @@ SWITCH_STANDARD_API(sk_function) interface_status[globals.SKYPOPEN_INTERFACES[i].interface_state], skype_callflow[globals.SKYPOPEN_INTERFACES[i].skype_callflow], globals.SKYPOPEN_INTERFACES[i].session_uuid_str); } else if (argc > 1 && !strcasecmp(argv[1], "full")) { - stream->write_function(stream, "%c\t%d\n", next_flag_char, i); + stream->write_function(stream, "%c %d\n", next_flag_char, i); } } @@ -2915,7 +2918,7 @@ int skypopen_transfer(private_t *tech_pvt) sprintf(msg_to_skype, "ALTER CALL %s HANGUP", id); skypopen_signaling_write(tech_pvt, msg_to_skype); } - switch_sleep(10000); + switch_sleep(20000); DEBUGA_SKYPE ("We have NOT answered a Skype RING from skype_call %s, because we are already in a skypopen call (%s)\n", SKYPOPEN_P_LOG, id, tech_pvt->skype_call_id); diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index b62ece6419..091fb7a57f 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -186,7 +186,7 @@ int skypopen_signaling_read(private_t *tech_pvt) SKYPOPEN_P_LOG); skypopen_sleep(1000000); skypopen_signaling_write(tech_pvt, "PROTOCOL 7"); - skypopen_sleep(10000); + skypopen_sleep(20000); return 0; } if (!strncasecmp(message, "ERROR 92 CALL", 12)) { @@ -898,6 +898,9 @@ void *skypopen_do_tcp_srv_thread_func(void *obj) if (tech_pvt->timer_read_srv.timer_interface && tech_pvt->timer_read_srv.timer_interface->timer_next) { switch_core_timer_next(&tech_pvt->timer_read_srv); + } else { + skypopen_sleep(20000); + } //rt = select(fdselect + 1, &fs, NULL, NULL, &to); if (rt > 0) { @@ -905,12 +908,12 @@ void *skypopen_do_tcp_srv_thread_func(void *obj) if (tech_pvt->skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) { len = recv(fd, (char *) srv_in, BYTES_PER_FRAME * 2, 0); } else { - skypopen_sleep(10000); + //skypopen_sleep(10000); continue; } if (tech_pvt->begin_to_read == 0) { DEBUGA_SKYPE("len=%d\n", SKYPOPEN_P_LOG, len); - skypopen_sleep(10000); + //skypopen_sleep(10000); continue; } @@ -1054,6 +1057,8 @@ void *skypopen_do_tcp_cli_thread_func(void *obj) if (tech_pvt->timer_write.timer_interface && tech_pvt->timer_write.timer_interface->timer_next && tech_pvt->interface_state != SKYPOPEN_STATE_HANGUP_REQUESTED) { switch_core_timer_next(&tech_pvt->timer_write); + } else { + skypopen_sleep(20000); } if (tech_pvt->begin_to_write == 0) { @@ -1064,7 +1069,7 @@ void *skypopen_do_tcp_cli_thread_func(void *obj) DEBUGA_SKYPE("len=%d, error: %s\n", SKYPOPEN_P_LOG, len, strerror(errno)); break; } - skypopen_sleep(10000); + //skypopen_sleep(10000); continue; } else { @@ -1367,7 +1372,7 @@ LRESULT APIENTRY skypopen_present(HWND hWindow, UINT uiMessage, WPARAM uiParam, } break; case SKYPECONTROLAPI_ATTACH_PENDING_AUTHORIZATION: - skypopen_sleep(5000); + skypopen_sleep(20000); break; case SKYPECONTROLAPI_ATTACH_REFUSED: ERRORA("Skype client refused to be connected by Skypopen!\n", SKYPOPEN_P_LOG); @@ -1377,7 +1382,7 @@ LRESULT APIENTRY skypopen_present(HWND hWindow, UINT uiMessage, WPARAM uiParam, break; case SKYPECONTROLAPI_ATTACH_API_AVAILABLE: DEBUGA_SKYPE("Skype API available\n", SKYPOPEN_P_LOG); - skypopen_sleep(5000); + skypopen_sleep(20000); break; default: WARNINGA("GOT AN UNKNOWN SKYPE WINDOWS MSG\n", SKYPOPEN_P_LOG); @@ -1681,7 +1686,7 @@ void skypopen_clean_disp(void *data) DEBUGA_SKYPE("NOT destroyed disp\n", SKYPOPEN_P_LOG); } DEBUGA_SKYPE("OUT destroyed disp\n", SKYPOPEN_P_LOG); - skypopen_sleep(1000); + skypopen_sleep(20000); } void *skypopen_do_skypeapi_thread_func(void *obj) @@ -1927,13 +1932,14 @@ void *skypopen_do_skypeapi_thread_func(void *obj) SKYPOPEN_P_LOG, buf); skypopen_sleep(1000000); //1 sec } - skypopen_sleep(1000); //0.1 msec + skypopen_sleep(20000); //20 msec break; } } if (continue_is_broken) { XFlush(disp); - skypopen_sleep(1000); //0.1 msec + skypopen_sleep(20000); //20 msec + WARNINGA("continue_is_broken\n", SKYPOPEN_P_LOG); continue; } strcat(buffer, buf); From 43eeeb82a825d395f220c03f97dcb475916af8b7 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Wed, 13 Jul 2011 07:43:39 -0500 Subject: [PATCH 06/16] skypopen: fixed a demented bug (incrementing a variable zeroed in the same loop) maybe responsible for moh sputtering under load on virtual machines --- src/mod/endpoints/mod_skypopen/mod_skypopen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 61a4ccae70..ad5e33290c 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -857,6 +857,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch switch_core_timer_next(&tech_pvt->timer_read); } + try = 0; read: @@ -871,7 +872,6 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch } switch_mutex_unlock(tech_pvt->mutex_audio_srv); - try = 0; if (!bytes_read) { switch_sleep(1000); //XXX don't like this try++; @@ -879,7 +879,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch DEBUGA_SKYPE("skypopen_audio_read going back to read\n", SKYPOPEN_P_LOG); goto read; } - WARNINGA("skypopen_audio_read Silence\n", SKYPOPEN_P_LOG); + DEBUGA_SKYPE("skypopen_audio_read Silence\n", SKYPOPEN_P_LOG); memset(tech_pvt->read_frame.data, 255, BYTES_PER_FRAME); tech_pvt->read_frame.datalen = BYTES_PER_FRAME; From 707bd05b7c83be5ba1d4dfb18bbb815d21f31927 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Wed, 13 Jul 2011 08:43:35 -0500 Subject: [PATCH 07/16] FS-3417 --resolve Heap corruption in strftime_api_function -thanks --- src/mod/applications/mod_dptools/mod_dptools.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 990a7ca956..d62db97e13 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -1352,27 +1352,28 @@ SWITCH_STANDARD_API(strftime_api_function) switch_time_exp_t tm; char date[80] = ""; switch_time_t thetime; - char *p; + char *p, *q = NULL; char *mycmd = NULL; if (!zstr(cmd)) { mycmd = strdup(cmd); + q = mycmd; } - if (!zstr(mycmd) && (p = strchr(mycmd, '|'))) { + if (!zstr(q) && (p = strchr(q, '|'))) { *p++ = '\0'; - thetime = switch_time_make(atol(mycmd), 0); - mycmd = p + 1; + thetime = switch_time_make(atol(q), 0); + q = p + 1; } else { thetime = switch_micro_time_now(); } switch_time_exp_lt(&tm, thetime); - if (zstr(mycmd)) { + if (zstr(q)) { switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm); } else { - switch_strftime(date, &retsize, sizeof(date), mycmd, &tm); + switch_strftime(date, &retsize, sizeof(date), q, &tm); } stream->write_function(stream, "%s", date); switch_safe_free(mycmd); From 60416b22982503dfc90c296d1bab56430aeb8dc9 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Wed, 13 Jul 2011 08:44:23 -0500 Subject: [PATCH 08/16] skypopen: Fixed bogus values in 'sk list' report ? --- src/mod/endpoints/mod_skypopen/mod_skypopen.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index ad5e33290c..63f99c567a 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -2473,10 +2473,10 @@ SWITCH_STANDARD_API(sk_function) if (!strcasecmp(argv[0], "list")) { int i; - int ib = 0; - int ib_failed = 0; - int ob = 0; - int ob_failed = 0; + unsigned int ib = 0; + unsigned int ib_failed = 0; + unsigned int ob = 0; + unsigned int ob_failed = 0; char next_flag_char = ' '; stream->write_function(stream, "F ID\t Name \tIB (F/T) OB (F/T)\tState\tCallFlw\t\tUUID\n"); @@ -2505,7 +2505,7 @@ SWITCH_STANDARD_API(sk_function) } } - stream->write_function(stream, "\nTotal Interfaces: %d IB Calls(Failed/Total): %ld/%ld OB Calls(Failed/Total): %ld/%ld\n", + stream->write_function(stream, "\nTotal Interfaces: %d IB Calls(Failed/Total): %u/%u OB Calls(Failed/Total): %u/%u\n", globals.real_interfaces > 0 ? globals.real_interfaces - 1 : 0, ib_failed, ib, ob_failed, ob); } else if (!strcasecmp(argv[0], "console")) { From 72e64748e853841c842bd5c9647088ab4cca734f Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Wed, 13 Jul 2011 11:30:22 -0400 Subject: [PATCH 09/16] FreeTDM: Fix for compile error on some systems --- .../src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c index e127e7fc1e..d9c3c7b8ba 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c @@ -584,10 +584,12 @@ uint32_t sngisdn_decode_ie(char *str, uint32_t *str_len, uint8_t current_codeset break; case PROT_Q931_IE_DISPLAY: { - uint8_t j, displayType, assocInfo; + uint8_t j; char displayStr[82]; uint8_t displayNtEnabled = 0; uint8_t displayStrOct = 2; + uint8_t displayType = 0; + uint8_t assocInfo = 0; memset(displayStr, 0, sizeof(displayStr)); From e339b549e014f30c5de256cf2b3ba94a91bb06e3 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 13 Jul 2011 10:37:32 -0500 Subject: [PATCH 10/16] FS-3386 this is probably relevant, try this revision --- 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 6823acf133..81a04792b5 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -7819,7 +7819,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ tech_pvt->sofia_private = sofia_private; - tech_pvt->nh = nua_handle_ref(nh); + tech_pvt->nh = nh; if (profile->pres_type && sofia_test_pflag(profile, PFLAG_IN_DIALOG_CHAT)) { sofia_presence_set_chat_hash(tech_pvt, sip); From c9cab416205ac406bc8cd278e9c0e1b79a6ba12a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 14 Jul 2011 00:12:53 -0500 Subject: [PATCH 11/16] tweak debug code --- libs/sofia-sip/.update | 2 +- libs/sofia-sip/libsofia-sip-ua/nua/nua_common.c | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index 9544ad8244..83502caf5f 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Mon Jul 11 17:37:21 CDT 2011 +Wed Jul 6 15:11:41 CDT 2011 diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_common.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_common.c index 48988259b0..c3ee92d12f 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_common.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_common.c @@ -109,8 +109,8 @@ nua_handle_t *nh_create_handle(nua_t *nua, assert(nua->nua_home); - //if ((nh = su_home_clone(nua->nua_home, sizeof(*nh)))) { - if ((nh = su_home_clone(NULL, sizeof(*nh)))) { + if ((nh = su_home_clone(nua->nua_home, sizeof(*nh)))) { + //if ((nh = su_home_new(sizeof(*nh)))) { nh->nh_valid = nua_valid_handle_cookie; nh->nh_nua = nua; nh->nh_magic = hmagic; @@ -174,7 +174,7 @@ _nua_handle_ref_by(nua_handle_t *nh, { if (nh) SU_DEBUG_0(("%p - nua_handle_ref() => "MOD_ZU" by %s:%u: %s()\n", - nh, su_home_refcount((su_home_t *)nh) + 1, file, line, by)); + nh, su_home_refcount((su_home_t *)nh) + 1, file, line, function)); return (nua_handle_t *)su_home_ref((su_home_t *)nh); } @@ -186,15 +186,17 @@ _nua_handle_unref_by(nua_handle_t *nh, if (nh) { size_t refcount = su_home_refcount((su_home_t *)nh) - 1; int freed = su_home_unref((su_home_t *)nh); + if (freed) refcount = 0; SU_DEBUG_0(("%p - nua_handle_unref() => "MOD_ZU" by %s:%u: %s()\n", - nh, refcount, file, line, by)); + nh, refcount, file, line, function)); return freed; } return 0; } +#if 0 nua_handle_t *nua_handle_ref(nua_handle_t *nh) { return _nua_handle_ref_by(nh, "", 0, "") @@ -204,6 +206,7 @@ int nua_handle_unref(nua_handle_t *nh) { return _nua_handle_unref_by(nh, "", 0, "") } +#endif #else From 8f4ab3eb3c15fda50813b3d1c8c0dd4c212b0685 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 14 Jul 2011 00:13:36 -0500 Subject: [PATCH 12/16] tweak sql q params --- src/switch_core_sqldb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index b3c2e7112c..eaa2490770 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -35,6 +35,8 @@ #include #include "private/switch_core_pvt.h" //#define DEBUG_SQL 1 +#define SWITCH_SQL_QUEUE_LEN 100000 +#define SWITCH_SQL_QUEUE_PAUSE_LEN 90000 struct switch_cache_db_handle { char name[CACHE_DB_LEN]; @@ -942,7 +944,6 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, switch_size_t newlen; int lc = 0, wrote = 0, do_sleep = 1; uint32_t sanity = 120; - int too_long = SWITCH_SQL_QUEUE_LEN / 2; int auto_pause = 0; switch_assert(sqlbuf); @@ -1030,7 +1031,7 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, lc = switch_queue_size(sql_manager.sql_queue[0]) + switch_queue_size(sql_manager.sql_queue[1]); - if (lc > too_long) { + if (lc > SWITCH_SQL_QUEUE_PAUSE_LEN) { if (!auto_pause) { auto_pause = 1; switch_core_session_ctl(SCSC_PAUSE_INBOUND, &auto_pause); From d2f76ca482bba15ada126baf8306927efe87db28 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 14 Jul 2011 00:14:10 -0500 Subject: [PATCH 13/16] tweaks to codec buffer size detection --- src/include/private/switch_core_pvt.h | 1 - src/include/switch_loadable_module.h | 6 +++++- src/switch_loadable_module.c | 5 +++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index 6115e70ede..423969fac8 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -84,7 +84,6 @@ #define SWITCH_EVENT_QUEUE_LEN 256 #define SWITCH_MESSAGE_QUEUE_LEN 256 -#define SWITCH_SQL_QUEUE_LEN 100000 #define SWITCH_BUFFER_BLOCK_FRAMES 25 #define SWITCH_BUFFER_START_FRAMES 50 diff --git a/src/include/switch_loadable_module.h b/src/include/switch_loadable_module.h index 7e4d617256..4b81a1f25e 100644 --- a/src/include/switch_loadable_module.h +++ b/src/include/switch_loadable_module.h @@ -438,7 +438,11 @@ static inline void switch_core_codec_add_implementation(switch_memory_pool_t *po /*! deinitalize a codec handle using this implementation */ switch_core_codec_destroy_func_t destroy) { - if (codec_type == SWITCH_CODEC_TYPE_VIDEO || switch_check_interval(actual_samples_per_second, microseconds_per_packet / 1000)) { + + if (decoded_bytes_per_packet > SWITCH_RECOMMENDED_BUFFER_SIZE) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Rejected codec name: %s rate: %u ptime: %u not enough buffer space %d > %d\n", + iananame, actual_samples_per_second, microseconds_per_packet / 1000, decoded_bytes_per_packet, SWITCH_RECOMMENDED_BUFFER_SIZE); + } else if (codec_type == SWITCH_CODEC_TYPE_VIDEO || switch_check_interval(actual_samples_per_second, microseconds_per_packet / 1000)) { switch_codec_implementation_t *impl = (switch_codec_implementation_t *) switch_core_alloc(pool, sizeof(*impl)); impl->codec_type = codec_type; impl->ianacode = ianacode; diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index db4f4fa1dd..8fca52eb58 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -175,8 +175,9 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable if (impl->decoded_bytes_per_packet > SWITCH_RECOMMENDED_BUFFER_SIZE) { load_interface = 0; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, - "Failed to load codec interface %s from %s due to bytes per frame exceeding buffer size.\n", ptr->interface_name, - key); + "Failed to load codec interface %s from %s due to bytes per frame %d exceeding buffer size %d.\n", + ptr->interface_name, + key, impl->decoded_bytes_per_packet, SWITCH_RECOMMENDED_BUFFER_SIZE); break; } } From 2932c1fa17c589f3e47178553f78195fe08cf22d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 14 Jul 2011 00:17:05 -0500 Subject: [PATCH 14/16] FS-3386 Try this revision please --- .../mod_spandsp/mod_spandsp_codecs.c | 3 +- src/mod/endpoints/mod_sofia/mod_sofia.c | 3 +- src/mod/endpoints/mod_sofia/mod_sofia.h | 7 +- src/mod/endpoints/mod_sofia/sofia.c | 109 +++++++++--------- src/mod/endpoints/mod_sofia/sofia_glue.c | 2 +- src/mod/endpoints/mod_sofia/sofia_presence.c | 16 ++- src/mod/endpoints/mod_sofia/sofia_reg.c | 19 ++- 7 files changed, 83 insertions(+), 76 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_codecs.c b/src/mod/applications/mod_spandsp/mod_spandsp_codecs.c index 4e7f048ef7..c75db05449 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_codecs.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_codecs.c @@ -34,6 +34,7 @@ #include "mod_spandsp.h" +#if SWITCH_MAX_INTERVAL >= 90 /* LPC10 - START */ struct lpc10_context { @@ -123,7 +124,7 @@ static switch_status_t switch_lpc10_decode(switch_codec_t *codec, } /* LPC10 - END */ - +#endif /* GSM - START */ struct gsm_context { diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 7ebbe33f70..cea774ff99 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -553,9 +553,8 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session) *tech_pvt->sofia_private->uuid = '\0'; } - sofia_glue_set_rtp_stats(tech_pvt); - + switch_mutex_unlock(tech_pvt->sofia_mutex); return SWITCH_STATUS_SUCCESS; diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 8b1422ba8c..00dcd71897 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -33,7 +33,7 @@ * mod_sofia.h -- SOFIA SIP Endpoint * */ - +//#define HAVE_MEMLEAK_LOG 1 /*Defines etc..*/ /*************************************************************************************************************************************************************/ #define MANUAL_BYE 1 @@ -151,10 +151,11 @@ struct sofia_private { char gateway_name[256]; char auth_gateway_name[256]; int destroy_nh; - int destroy_me; int is_call; + int got_bye; int is_static; sofia_dispatch_event_t *de; + nua_handle_t *nh; }; #define set_param(ptr,val) if (ptr) {free(ptr) ; ptr = NULL;} if (val) {ptr = strdup(val);} @@ -318,7 +319,7 @@ typedef enum { } TFLAGS; #define SOFIA_MAX_MSG_QUEUE 51 -#define SOFIA_MSG_QUEUE_SIZE 2000 +#define SOFIA_MSG_QUEUE_SIZE 200 struct mod_sofia_globals { switch_memory_pool_t *pool; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 81a04792b5..5f42fa31d2 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -486,12 +486,7 @@ void sofia_handle_sip_i_notify(switch_core_session_t *session, int status, end: - if (sub_state == nua_substate_terminated && sofia_private && sofia_private != &mod_sofia_globals.destroy_private && - sofia_private != &mod_sofia_globals.keep_private) { - sofia_private->destroy_nh = 1; - sofia_private->destroy_me = 1; - } - + return; } void sofia_handle_sip_i_bye(switch_core_session_t *session, int status, @@ -558,13 +553,9 @@ void sofia_handle_sip_i_bye(switch_core_session_t *session, int status, switch_channel_hangup(channel, cause); nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS_MSG(de->data->e_msg), TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)), TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END()); - + switch_safe_free(extra_headers); - if (sofia_private) { - sofia_private->destroy_me = 1; - sofia_private->destroy_nh = 1; - } #endif @@ -585,6 +576,8 @@ void sofia_handle_sip_i_bye(switch_core_session_t *session, int status, } tech_pvt->got_bye = 1; + sofia_private->got_bye = 1; + switch_channel_set_variable(channel, "sip_hangup_disposition", "recv_bye"); return; @@ -1075,28 +1068,19 @@ static void our_sofia_event_callback(nua_event_t event, } if (check_destroy) { - if (nh && ((sofia_private && sofia_private->destroy_nh) || !nua_handle_magic(nh))) { + if (0 && nh && ((sofia_private && sofia_private->destroy_nh) || !nua_handle_magic(nh))) { + + printf("FUCKER2\n"); + if (sofia_private) { nua_handle_bind(nh, NULL); } + nua_handle_destroy(nh); nh = NULL; } } - if (sofia_private && sofia_private->destroy_me) { - if (tech_pvt) { - tech_pvt->sofia_private = NULL; - } - - if (nh) { - nua_handle_bind(nh, NULL); - } - sofia_private->destroy_me = 12; - sofia_private_free(sofia_private); - - } - if (gateway) { sofia_reg_release_gateway(gateway); } @@ -1115,15 +1099,22 @@ void sofia_process_dispatch_event(sofia_dispatch_event_t **dep) sofia_dispatch_event_t *de = *dep; nua_handle_t *nh = de->nh; nua_t *nua = de->nua; - + sofia_private_t *sofia_private = nua_handle_magic(de->nh); + *dep = NULL; - our_sofia_event_callback(de->data->e_event, de->data->e_status, de->data->e_phrase, de->nua, de->profile, - de->nh, nua_handle_magic(de->nh), de->sip, de, (tagi_t *) de->data->e_tags); + sofia_private = nua_handle_magic(nh); - nua_destroy_event(de->event); - su_free(nh->nh_home, de); + //printf("QUEUE EVENT %s\n", nua_event_name(de->data->e_event)); + + + our_sofia_event_callback(de->data->e_event, de->data->e_status, de->data->e_phrase, de->nua, de->profile, + nh, sofia_private, de->sip, de, (tagi_t *) de->data->e_tags); + + //printf("/QUEUE EVENT %s\n", nua_event_name(de->data->e_event)); + nua_destroy_event(de->event); + su_free(nh->nh_home, de); nua_handle_unref(nh); nua_stack_unref(nua); } @@ -1222,24 +1213,55 @@ void sofia_event_callback(nua_event_t event, { sofia_dispatch_event_t *de; + //printf("EVENT %s\n", nua_event_name(event)); + + + + if (event == nua_i_terminated) { + if (sofia_private && sofia_private->nh) { + nua_handle_bind(nh, NULL); + nua_handle_destroy(sofia_private->nh); + } + + return; + } + + de = su_alloc(nh->nh_home, sizeof(*de)); memset(de, 0, sizeof(*de)); nua_save_event(nua, de->event); de->nh = nua_handle_ref(nh); - de->nh = nh; de->data = nua_event_data(de->event); de->sip = sip_object(de->data->e_msg); de->profile = profile; de->nua = nua_stack_ref(nua); + + if (event == nua_i_state) { + int ss_state = nua_callstate_init; + tl_gets(tags, NUTAG_CALLSTATE_REF(ss_state), TAG_END()); + + //printf("state [%s][%d]\n", nua_callstate_name(ss_state), status); + + if (ss_state == nua_callstate_terminated || ss_state == nua_callstate_terminating) { + sofia_process_dispatch_event(&de); + return; + } + } + + + + + if (event == nua_i_invite && !sofia_private) { if (!(sofia_private = su_alloc(nh->nh_home, sizeof(*sofia_private)))) { abort(); } memset(sofia_private, 0, sizeof(*sofia_private)); - sofia_private->is_call++; + sofia_private->is_call = 2; sofia_private->de = de; + sofia_private->nh = nua_handle_ref(nh); nua_handle_bind(nh, sofia_private); return; } @@ -1266,7 +1288,6 @@ void sofia_event_callback(nua_event_t event, } } - sofia_queue_message(de); } @@ -4347,7 +4368,6 @@ static void sofia_handle_sip_r_options(switch_core_session_t *session, int statu if (sofia_private && !zstr(sofia_private->gateway_name)) { gateway = sofia_reg_find_gateway(sofia_private->gateway_name); - sofia_private->destroy_me = 1; } if (gateway) { @@ -5067,10 +5087,6 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, goto done; } } - - if (sofia_private) { - sofia_private->destroy_me = 1; - } } if (session) { @@ -5806,21 +5822,6 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, switch_channel_hangup(channel, cause); } - - if (ss_state == nua_callstate_terminated) { - if (tech_pvt->sofia_private) { - tech_pvt->sofia_private = NULL; - } - - nua_handle_unref(tech_pvt->nh); - tech_pvt->nh = NULL; - - if (nh) { - nua_handle_bind(nh, NULL); - nua_handle_destroy(nh); - } - } - break; } @@ -7929,8 +7930,6 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ switch_mutex_unlock(tech_pvt->profile->flag_mutex); } - nua_handle_bind(nh, NULL); - sofia_private_free(sofia_private); switch_core_session_destroy(&session); nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END()); return; diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index e6a6052c4a..2c35b60223 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -2214,7 +2214,6 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) switch_safe_free(d_url); return SWITCH_STATUS_FALSE; } - nua_handle_ref(tech_pvt->nh); if (tech_pvt->dest && (strstr(tech_pvt->dest, ";fs_nat") || strstr(tech_pvt->dest, ";received") || ((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val)))) { @@ -2309,6 +2308,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) memset(sofia_private, 0, sizeof(*sofia_private)); sofia_private->is_call++; + sofia_private->nh = nua_handle_ref(tech_pvt->nh); tech_pvt->sofia_private = sofia_private; switch_copy_string(tech_pvt->sofia_private->uuid, switch_core_session_get_uuid(session), sizeof(tech_pvt->sofia_private->uuid)); diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 34c6799991..aa74e6040c 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1790,8 +1790,12 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * switch_safe_free(pl); switch_safe_free(to); - if (nh && kill_handle) { - nua_handle_destroy(nh); + if (nh) { + if (kill_handle) { + nua_handle_destroy(nh); + } else { + nua_handle_unref(nh); + } } return 0; @@ -1841,6 +1845,10 @@ static int sofia_presence_mwi_callback(void *pArg, int argc, char **argv, char * end: + if (nh) { + nua_handle_unref(nh); + } + if (ext_profile) { sofia_glue_release_profile(ext_profile); } @@ -1931,6 +1939,8 @@ static int broadsoft_sla_notify_callback(void *pArg, int argc, char **argv, char nua_notify(nh, SIPTAG_EXPIRES_STR("0"), SIPTAG_SUBSCRIPTION_STATE_STR("terminated;reason=noresource"), SIPTAG_EVENT_STR("line-seize"), SIPTAG_CALL_INFO_STR(tmp), TAG_END()); + + nua_handle_unref(nh); return 0; } @@ -1939,6 +1949,7 @@ static int broadsoft_sla_notify_callback(void *pArg, int argc, char **argv, char TAG_IF(*expires_str, SIPTAG_EXPIRES_STR(expires_str)), SIPTAG_SUBSCRIPTION_STATE_STR(sstr), SIPTAG_EVENT_STR("call-info"), SIPTAG_CALL_INFO_STR(tmp), TAG_END()); + nua_handle_unref(nh); } return 0; @@ -2629,6 +2640,7 @@ static int sofia_counterpath_crutch(void *pArg, int argc, char **argv, char **co SIPTAG_EXPIRES_STR(expstr), SIPTAG_SUBSCRIPTION_STATE_STR(sstr), SIPTAG_EVENT_STR(event_type), SIPTAG_CONTENT_TYPE_STR("application/pidf+xml"), SIPTAG_PAYLOAD_STR(pl), TAG_END()); + nua_handle_unref(nh); } return 0; diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 88c5dd4ec6..3f7736a1ec 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -54,8 +54,9 @@ static void sofia_reg_new_handle(sofia_gateway_t *gateway_ptr, int attach) NUTAG_CALLSTATE_REF(ss_state), SIPTAG_FROM_STR(gateway_ptr->register_from), TAG_END()); if (attach) { if (!gateway_ptr->sofia_private) { - gateway_ptr->sofia_private = malloc(sizeof(*gateway_ptr->sofia_private)); - switch_assert(gateway_ptr->sofia_private); + if (!(gateway_ptr->sofia_private = su_alloc(gateway_ptr->nh->nh_home, sizeof(*gateway_ptr->sofia_private)))) { + abort(); + } } memset(gateway_ptr->sofia_private, 0, sizeof(*gateway_ptr->sofia_private)); @@ -186,9 +187,10 @@ void sofia_sub_check_gateway(sofia_profile_t *profile, time_t now) NUTAG_CALLSTATE_REF(ss_state), SIPTAG_FROM_STR(gateway_ptr->register_from), TAG_END()); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "subscribing to [%s] on gateway [%s]\n", gw_sub_ptr->event, gateway_ptr->name); - gateway_ptr->sofia_private = malloc(sizeof(*gateway_ptr->sofia_private)); - switch_assert(gateway_ptr->sofia_private); + if (!(gateway_ptr->sofia_private = su_alloc(gateway_ptr->sub_nh->nh_home, sizeof(*gateway_ptr->sofia_private)))) { + abort(); + } memset(gateway_ptr->sofia_private, 0, sizeof(*gateway_ptr->sofia_private)); gateway_ptr->sofia_private->gateway = gateway_ptr; @@ -290,7 +292,6 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now) if (gateway_ptr->ping && !gateway_ptr->pinging && (now >= gateway_ptr->ping && (ostate == REG_STATE_NOREG || ostate == REG_STATE_REGED)) && !gateway_ptr->deleted) { nua_handle_t *nh = nua_handle(profile->nua, NULL, NUTAG_URL(gateway_ptr->register_url), TAG_END()); - sofia_private_t *pvt; register_host = sofia_glue_get_register_host(gateway_ptr->register_proxy); @@ -301,13 +302,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now) switch_safe_free(register_host); - pvt = malloc(sizeof(*pvt)); - switch_assert(pvt); - memset(pvt, 0, sizeof(*pvt)); - pvt->destroy_nh = 1; - pvt->destroy_me = 1; - switch_copy_string(pvt->gateway_name, gateway_ptr->name, sizeof(pvt->gateway_name)); - nua_handle_bind(nh, pvt); + nua_handle_bind(nh, &mod_sofia_globals.destroy_private); gateway_ptr->pinging = 1; nua_options(nh, From 6925af68e0fbc56e79687f4fa1e80b1c0e3b3533 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Thu, 14 Jul 2011 09:42:33 -0500 Subject: [PATCH 15/16] FS-3422 --resolve typo --- 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 5f42fa31d2..dd5cc68268 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -3636,7 +3636,7 @@ switch_status_t config_sofia(int reload, char *profile_name) profile->client_rport_level = 1; } else if (val && !strcasecmp(val, "server-only")) { profile->client_rport_level = 0; - profile->client_rport_level = 1; + profile->server_rport_level = 1; } else if (switch_true(val)) { profile->server_rport_level = 2; profile->client_rport_level = 1; From f9969f385677daa2f0bc72edea4e7435cb69aa6f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 14 Jul 2011 16:01:44 -0500 Subject: [PATCH 16/16] only list real profiles not aliases in presence code --- src/mod/endpoints/mod_sofia/mod_sofia.c | 12 +++++++++++- src/mod/endpoints/mod_sofia/mod_sofia.h | 4 +++- src/mod/endpoints/mod_sofia/sofia_glue.c | 2 +- src/mod/endpoints/mod_sofia/sofia_presence.c | 8 ++++---- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index cea774ff99..8852047612 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -4962,7 +4962,7 @@ static void general_event_handler(switch_event_t *event) } } -switch_status_t list_profiles(const char *line, const char *cursor, switch_console_callback_match_t **matches) +switch_status_t list_profiles_full(const char *line, const char *cursor, switch_console_callback_match_t **matches, switch_bool_t show_aliases) { sofia_profile_t *profile = NULL; switch_hash_index_t *hi; @@ -4974,7 +4974,12 @@ switch_status_t list_profiles(const char *line, const char *cursor, switch_conso switch_mutex_lock(mod_sofia_globals.hash_mutex); for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) { switch_hash_this(hi, &vvar, NULL, &val); + profile = (sofia_profile_t *) val; + if (!show_aliases && strcmp((char *)vvar, profile->name)) { + continue; + } + if (sofia_test_pflag(profile, PFLAG_RUNNING)) { switch_console_push_match(&my_matches, (const char *) vvar); } @@ -4990,6 +4995,11 @@ switch_status_t list_profiles(const char *line, const char *cursor, switch_conso return status; } +switch_status_t list_profiles(const char *line, const char *cursor, switch_console_callback_match_t **matches) +{ + return list_profiles_full(line, cursor, matches, SWITCH_TRUE); +} + static switch_status_t list_gateways(const char *line, const char *cursor, switch_console_callback_match_t **matches) { sofia_profile_t *profile = NULL; diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 00dcd71897..10fb99b3f9 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -1081,8 +1081,10 @@ switch_status_t sofia_set_loglevel(const char *name, int level); * \note Valid components are "default" (sofia's default logger), "tport", "iptsec", "nea", "nta", "nth_client", "nth_server", "nua", "soa", "sresolv", "stun" * \return the component's loglevel, or -1 if the component isn't valid */ -switch_status_t list_profiles(const char *line, const char *cursor, switch_console_callback_match_t **matches); int sofia_get_loglevel(const char *name); +switch_status_t list_profiles_full(const char *line, const char *cursor, switch_console_callback_match_t **matches, switch_bool_t show_aliases); +switch_status_t list_profiles(const char *line, const char *cursor, switch_console_callback_match_t **matches); + sofia_cid_type_t sofia_cid_name2type(const char *name); void sofia_glue_tech_set_local_sdp(private_object_t *tech_pvt, const char *sdp_str, switch_bool_t dup); void sofia_glue_set_rtp_stats(private_object_t *tech_pvt); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 2c35b60223..eeff2ed89b 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -5541,7 +5541,7 @@ int sofia_glue_recover(switch_bool_t flush) switch_console_callback_match_t *matches; - if (list_profiles(NULL, NULL, &matches) == SWITCH_STATUS_SUCCESS) { + if (list_profiles_full(NULL, NULL, &matches, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { switch_console_callback_match_node_t *m; for (m = matches->head; m; m = m->next) { if ((profile = sofia_glue_find_profile(m->val))) { diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index aa74e6040c..7e75fe75bf 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -282,7 +282,7 @@ void sofia_presence_cancel(void) return; } - if (list_profiles(NULL, NULL, &matches) == SWITCH_STATUS_SUCCESS) { + if (list_profiles_full(NULL, NULL, &matches, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { switch_console_callback_match_node_t *m; sql = switch_mprintf("select proto,sip_user,sip_host,sub_to_user,sub_to_host,event,contact,call_id,full_from," @@ -409,7 +409,7 @@ static void actual_sofia_presence_mwi_event_handler(switch_event_t *event) sql = switch_mprintf("select profile_name from sip_registrations where sip_host='%s' or mwi_host='%s'", host, host); - if (list_profiles(NULL, NULL, &matches) == SWITCH_STATUS_SUCCESS) { + if (list_profiles_full(NULL, NULL, &matches, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { switch_console_callback_match_node_t *m; for (m = matches->head; m; m = m->next) { @@ -592,7 +592,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) switch_assert(sql != NULL); - if (list_profiles(NULL, NULL, &matches) == SWITCH_STATUS_SUCCESS) { + if (list_profiles_full(NULL, NULL, &matches, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { switch_console_callback_match_node_t *m; for (m = matches->head; m; m = m->next) { @@ -788,7 +788,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) goto done; } - if (list_profiles(NULL, NULL, &matches) == SWITCH_STATUS_SUCCESS) { + if (list_profiles_full(NULL, NULL, &matches, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { switch_console_callback_match_node_t *m; for (m = matches->head; m; m = m->next) {