From a93623618b83fb08f2a0a728800f431856b29f92 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 7 Feb 2011 16:33:36 -0600 Subject: [PATCH 1/9] 3 regresions from this now, rolling it back --- src/mod/applications/mod_voicemail/mod_voicemail.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index bea82142b6..80b011e189 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -1277,13 +1277,9 @@ static void message_count(vm_profile_t *profile, const char *id_in, const char * myid = resolve_id(id_in, domain_name, "message-count"); - switch_snprintf(sql, sizeof(sql), "select 1, read_flags, count(read_epoch) from voicemail_msgs where " - "username='%s' and domain='%s' and in_folder='%s' " - "and read_epoch=0 group by read_flags union select 0, read_flags, count(read_epoch) from voicemail_msgs where username='%s' " - "and domain='%s' and in_folder='%s' and read_epoch<>0 group by read_flags;", - myid, domain_name, myfolder, myid, domain_name, myfolder); - - + switch_snprintf(sql, sizeof(sql), + "select read_epoch=0, read_flags, count(read_epoch) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' group by read_epoch=0,read_flags;", + myid, domain_name, myfolder); vm_execute_sql_callback(profile, profile->mutex, sql, message_count_callback, &cbt); From 0e841a5f14810514ee60562481c405d7fb560e72 Mon Sep 17 00:00:00 2001 From: Mike Jerris Date: Tue, 8 Feb 2011 10:36:12 -0600 Subject: [PATCH 2/9] FS-3040/FS-1742: use 1 sql query for message count in a way that is portable and doesn't segfault --- .../mod_voicemail/mod_voicemail.c | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 80b011e189..894e49a511 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -1011,6 +1011,11 @@ typedef struct msg_cnt_callback msg_cnt_callback_t; static int message_count_callback(void *pArg, int argc, char **argv, char **columnNames) { msg_cnt_callback_t *cbt = (msg_cnt_callback_t *) pArg; + + if (argc < 3 || zstr(argv[0]) || zstr(argv[1]) || zstr(argv[2])) { + return -1; + } + if (atoi(argv[0]) == 1) { /* UnRead */ if (!strcasecmp(argv[1], "A_URGENT")) { /* Urgent */ cbt->total_new_urgent_messages = atoi(argv[2]); @@ -1263,7 +1268,7 @@ static void message_count(vm_profile_t *profile, const char *id_in, const char * { char msg_count[80] = ""; msg_cnt_callback_t cbt = { 0 }; - char sql[256]; + char *sql; char *myid = NULL; @@ -1277,11 +1282,20 @@ static void message_count(vm_profile_t *profile, const char *id_in, const char * myid = resolve_id(id_in, domain_name, "message-count"); - switch_snprintf(sql, sizeof(sql), - "select read_epoch=0, read_flags, count(read_epoch) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' group by read_epoch=0,read_flags;", - myid, domain_name, myfolder); + sql = switch_mprintf( + "select 1, read_flags, count(read_epoch) from voicemail_msgs where " + "username='%q' and domain='%q' and in_folder='%q' and read_epoch=0 " + "group by read_flags " + "union " + "select 0, read_flags, count(read_epoch) from voicemail_msgs where " + "username='%q' and domain='%q' and in_folder='%q' and read_epoch<>0 " + "group by read_flags;", + + myid, domain_name, myfolder, + myid, domain_name, myfolder); vm_execute_sql_callback(profile, profile->mutex, sql, message_count_callback, &cbt); + free(sql); *total_new_messages = cbt.total_new_messages + cbt.total_new_urgent_messages; *total_new_urgent_messages = cbt.total_new_urgent_messages; From 93501b288b34a7d4f5287f7bc2b498a2321d73c5 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Tue, 8 Feb 2011 11:52:40 -0500 Subject: [PATCH 3/9] Fixes to support QSIG over T1 --- .../ftmod_sangoma_isdn_cfg.c | 2 + .../ftmod_sangoma_isdn_stack_cfg.c | 38 +++++++++++-------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c index bd5b13bfec..9fe28190e1 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c @@ -84,6 +84,8 @@ static ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span signal_data->switchtype = SNGISDN_SWITCH_4ESS; } else if (!strcasecmp(switch_name, "dms100")) { signal_data->switchtype = SNGISDN_SWITCH_DMS100; + } else if (!strcasecmp(switch_name, "qsig")) { + signal_data->switchtype = SNGISDN_SWITCH_QSIG; } else { ftdm_log(FTDM_LOG_ERROR, "%s:Unsupported switchtype %s for trunktype:%s\n", span->name, switch_name, ftdm_trunk_type2str(span->trunk_type)); return FTDM_FAIL; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c index a52a624dd0..1bd2753e81 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c @@ -667,25 +667,33 @@ ftdm_status_t sngisdn_stack_cfg_q931_dlsap(ftdm_span_t *span) cfg.t.cfg.s.inDLSAP.maxBSrvCnt = 2; cfg.t.cfg.s.inDLSAP.maxDSrvCnt = 2; #endif /* ISDN_SRV */ - - if (signal_data->signalling == SNGISDN_SIGNALING_NET) { - cfg.t.cfg.s.inDLSAP.ackOpt = TRUE; - cfg.t.cfg.s.inDLSAP.intType = NETWORK; - cfg.t.cfg.s.inDLSAP.clrGlr = FALSE; /* in case of glare, do not clear local call */ - cfg.t.cfg.s.inDLSAP.statEnqOpt = TRUE; - if (signal_data->switchtype == SNGISDN_SWITCH_EUROISDN || - signal_data->switchtype == SNGISDN_SWITCH_INSNET) { - cfg.t.cfg.s.inDLSAP.rstOpt = FALSE; - } else { - cfg.t.cfg.s.inDLSAP.rstOpt = TRUE; - } - } else { - cfg.t.cfg.s.inDLSAP.ackOpt = FALSE; - cfg.t.cfg.s.inDLSAP.intType = USER; + if (signal_data->switchtype == SNGISDN_SWITCH_QSIG) { + cfg.t.cfg.s.inDLSAP.ackOpt = TRUE; + cfg.t.cfg.s.inDLSAP.intType = SYM_USER; cfg.t.cfg.s.inDLSAP.clrGlr = TRUE; /* in case of glare, clear local call */ cfg.t.cfg.s.inDLSAP.statEnqOpt = FALSE; cfg.t.cfg.s.inDLSAP.rstOpt = FALSE; + } else { + if (signal_data->signalling == SNGISDN_SIGNALING_NET) { + cfg.t.cfg.s.inDLSAP.ackOpt = TRUE; + cfg.t.cfg.s.inDLSAP.intType = NETWORK; + cfg.t.cfg.s.inDLSAP.clrGlr = FALSE; /* in case of glare, do not clear local call */ + cfg.t.cfg.s.inDLSAP.statEnqOpt = TRUE; + + if (signal_data->switchtype == SNGISDN_SWITCH_EUROISDN || + signal_data->switchtype == SNGISDN_SWITCH_INSNET) { + cfg.t.cfg.s.inDLSAP.rstOpt = FALSE; + } else { + cfg.t.cfg.s.inDLSAP.rstOpt = TRUE; + } + } else { + cfg.t.cfg.s.inDLSAP.ackOpt = FALSE; + cfg.t.cfg.s.inDLSAP.intType = USER; + cfg.t.cfg.s.inDLSAP.clrGlr = TRUE; /* in case of glare, clear local call */ + cfg.t.cfg.s.inDLSAP.statEnqOpt = FALSE; + cfg.t.cfg.s.inDLSAP.rstOpt = FALSE; + } } /* Override the restart options if user selected that option */ From 330d741853f4f7c548b61dbcb717266a2bf24107 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 8 Feb 2011 11:23:59 -0600 Subject: [PATCH 4/9] reset signal_bond variable back to its original value on failed dial in att_xfer --- src/mod/applications/mod_dptools/mod_dptools.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index f7bf86b4c7..9a1258a5b6 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -1864,6 +1864,7 @@ SWITCH_STANDARD_APP(att_xfer_function) if (switch_ivr_originate(session, &peer_session, &cause, data, 0, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL) != SWITCH_STATUS_SUCCESS || !peer_session) { + switch_channel_set_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE, bond); goto end; } @@ -1878,6 +1879,7 @@ SWITCH_STANDARD_APP(att_xfer_function) if (zstr(bond) && switch_channel_down(peer_channel)) { switch_core_session_rwunlock(peer_session); + switch_channel_set_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE, bond); goto end; } From 2401fec54b48d8dfb1ec5a2f33a092dac076c0f3 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 8 Feb 2011 13:01:42 -0600 Subject: [PATCH 5/9] minor regression from 4ae8282e6c6df0e296113e9b4b4a1383e1af8ad7 (sofia_contact with no args from cli caused seg) --- src/mod/endpoints/mod_sofia/mod_sofia.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index c6832030b4..2a2ec63221 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3458,7 +3458,7 @@ SWITCH_STANDARD_API(sofia_contact_function) { char *data; char *user = NULL; - char *domain = NULL; + char *domain = NULL, *dup_domain = NULL; char *concat = NULL; char *profile_name = NULL; char *p; @@ -3501,7 +3501,8 @@ SWITCH_STANDARD_API(sofia_contact_function) } if (zstr(domain)) { - domain = switch_core_get_variable_pdup("domain", switch_core_session_get_pool(session)); + dup_domain = switch_core_get_variable_dup("domain"); + domain = dup_domain; } if (!user) goto end; @@ -3567,6 +3568,7 @@ SWITCH_STANDARD_API(sofia_contact_function) switch_safe_free(mystream.data); switch_safe_free(data); + switch_safe_free(dup_domain); return SWITCH_STATUS_SUCCESS; } From 2adfc50af7958eea12c15e023bcf80b18a4c73f9 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 9 Feb 2011 09:32:17 -0600 Subject: [PATCH 6/9] take out default it seems to suck on 32 bit --- conf/autoload_configs/switch.conf.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/autoload_configs/switch.conf.xml b/conf/autoload_configs/switch.conf.xml index 32cb76f08a..44893b931a 100644 --- a/conf/autoload_configs/switch.conf.xml +++ b/conf/autoload_configs/switch.conf.xml @@ -25,7 +25,7 @@ - +