kamailio.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
List overview
Download
sr-dev
September 2012
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
sr-dev@lists.kamailio.org
32 participants
173 discussions
Start a n
N
ew thread
git:master: modules_k/presence: core_hash not used correctly to distribute notifier traffic
by Peter Dunkley
Module: sip-router Branch: master Commit: 4b9aa7f144b8cf3e6da775563528913ed79e0553 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4b9aa7f…
Author: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com> Committer: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com> Date: Tue Sep 11 12:53:58 2012 +0100 modules_k/presence: core_hash not used correctly to distribute notifier traffic - Found and fixed by Hugh Waite @ Crocodile RCS Ltd --- modules_k/presence/notify.c | 13 +++++++------ modules_k/presence/presence.c | 4 ++-- modules_k/presence/subscribe.c | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/modules_k/presence/notify.c b/modules_k/presence/notify.c index 53f665f..919a324 100644 --- a/modules_k/presence/notify.c +++ b/modules_k/presence/notify.c @@ -2252,9 +2252,9 @@ int set_wipeer_subs_updated(str *pres_uri, pres_ev_t *event, int full) update_cols[n_update_cols] = &str_updated_col; update_vals[n_update_cols].type = DB1_INT; update_vals[n_update_cols].nul = 0; - update_vals[n_update_cols].val.int_val = core_hash(&callid, - &from_tag, (pres_waitn_time * pres_notifier_poll_rate - * pres_notifier_processes) - 1); + update_vals[n_update_cols].val.int_val = + core_hash(&callid, &from_tag, 0) % (pres_waitn_time * + pres_notifier_poll_rate * pres_notifier_processes); n_update_cols++; if (full) @@ -2313,9 +2313,10 @@ int set_updated(subs_t *sub) update_cols[0] = &str_updated_col; update_vals[0].type = DB1_INT; update_vals[0].nul = 0; - update_vals[0].val.int_val = core_hash(&sub->callid, &sub->from_tag, - (pres_waitn_time * pres_notifier_poll_rate - * pres_notifier_processes) - 1); + update_vals[0].val.int_val = + core_hash(&sub->callid, &sub->from_tag, 0) % + (pres_waitn_time * pres_notifier_poll_rate + * pres_notifier_processes); if (pa_dbf.use_table(pa_db, &active_watchers_table) < 0) { diff --git a/modules_k/presence/presence.c b/modules_k/presence/presence.c index 118b4d2..0adec43 100644 --- a/modules_k/presence/presence.c +++ b/modules_k/presence/presence.c @@ -1407,9 +1407,9 @@ static int update_pw_dialogs_dbonlymode(subs_t* subs, subs_t** subs_array) * pres_notifier_processes)); } else { db_vals[n_update_cols].val.int_val = - core_hash(&subs->callid, &subs->from_tag, + core_hash(&subs->callid, &subs->from_tag, 0) % (pres_waitn_time * pres_notifier_poll_rate - * pres_notifier_processes) - 1); + * pres_notifier_processes); } n_update_cols++; diff --git a/modules_k/presence/subscribe.c b/modules_k/presence/subscribe.c index 47b1537..f8a9c1b 100644 --- a/modules_k/presence/subscribe.c +++ b/modules_k/presence/subscribe.c @@ -476,9 +476,9 @@ int update_subscription_notifier(struct sip_msg* msg, subs_t* subs, *sent_reply= 0; /* Set the notifier/update fields for the subscription */ - subs->updated = core_hash(&subs->callid, &subs->from_tag, + subs->updated = core_hash(&subs->callid, &subs->from_tag, 0) % (pres_waitn_time * pres_notifier_poll_rate - * pres_notifier_processes) - 1); + * pres_notifier_processes); if (subs->event->type & WINFO_TYPE) subs->updated_winfo = UPDATED_TYPE; else if (subs->event->wipeer)
12 years, 3 months
1
0
0
0
git:master: modules_k/presence: Fixed inconsistencies in use of expires_offset for removing subcriptions
by Peter Dunkley
Module: sip-router Branch: master Commit: a29a2a81bc541af020955dbda0d352445fef5788 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a29a2a8…
Author: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com> Committer: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com> Date: Tue Sep 11 12:51:33 2012 +0100 modules_k/presence: Fixed inconsistencies in use of expires_offset for removing subcriptions - These caused particular problems on mulit-server, DB only, systems - Found and fixed by Hugh Waite @ Crocodile RCS Ltd. --- modules_k/presence/notify.c | 26 +++++++++----------------- modules_k/presence/presence.c | 6 +++--- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/modules_k/presence/notify.c b/modules_k/presence/notify.c index 7d8aa2b..53f665f 100644 --- a/modules_k/presence/notify.c +++ b/modules_k/presence/notify.c @@ -246,7 +246,7 @@ int get_wi_subs_db(subs_t* subs, watcher_t* watchers) int n_result_cols = 0; int n_query_cols = 0; int i; - int status_col, expires_col, watcher_user_col, watcher_domain_col, callid_col; + int status_col, watcher_user_col, watcher_domain_col, callid_col; query_cols[n_query_cols] = &str_presentity_uri_col; query_ops[n_query_cols] = OP_EQ; @@ -266,11 +266,10 @@ int get_wi_subs_db(subs_t* subs, watcher_t* watchers) query_ops[n_query_cols] = OP_GT; query_vals[n_query_cols].type = DB1_INT; query_vals[n_query_cols].nul = 0; - query_vals[n_query_cols].val.int_val = (int)time(NULL) - expires_offset; + query_vals[n_query_cols].val.int_val = (int)time(NULL) + expires_offset; n_query_cols++; result_cols[status_col=n_result_cols++] = &str_status_col; - result_cols[expires_col=n_result_cols++] = &str_expires_col; result_cols[watcher_user_col=n_result_cols++] = &str_watcher_username_col; result_cols[watcher_domain_col=n_result_cols++] = &str_watcher_domain_col; result_cols[callid_col=n_result_cols++] = &str_callid_col; @@ -581,11 +580,11 @@ error: str* get_p_notify_body(str pres_uri, pres_ev_t* event, str* etag, str* contact) { - db_key_t query_cols[6]; - db_val_t query_vals[6]; - db_key_t result_cols[6]; + db_key_t query_cols[3]; + db_val_t query_vals[3]; + db_key_t result_cols[3]; db1_res_t *result = NULL; - int body_col, expires_col, etag_col= 0, sender_col; + int body_col, etag_col= 0, sender_col; str** body_array= NULL; str* notify_body= NULL; db_row_t *row= NULL ; @@ -646,7 +645,6 @@ str* get_p_notify_body(str pres_uri, pres_ev_t* event, str* etag, n_query_cols++; result_cols[body_col=n_result_cols++] = &str_body_col; - result_cols[expires_col=n_result_cols++] = &str_expires_col; result_cols[etag_col=n_result_cols++] = &str_etag_col; result_cols[sender_col=n_result_cols++] = &str_sender_col; @@ -1087,9 +1085,6 @@ int get_subs_db(str* pres_uri, pres_ev_t* event, str* sender, row = &result->rows[i]; row_vals = ROW_VALUES(row); - // if(row_vals[expires_col].val.int_val< (int)time(NULL)) - // continue; - if(row_vals[reason_col].val.string_val) { if(strlen(row_vals[reason_col].val.string_val) != 0) continue; @@ -1145,11 +1140,10 @@ int get_subs_db(str* pres_uri, pres_ev_t* event, str* sender, s.event= event; s.local_cseq = row_vals[cseq_col].val.int_val +1; - if(row_vals[expires_col].val.int_val < (int)time(NULL)) + if(row_vals[expires_col].val.int_val < (int)time(NULL) + expires_offset) s.expires = 0; else - s.expires = row_vals[expires_col].val.int_val - - (int)time(NULL); + s.expires = row_vals[expires_col].val.int_val - (int)time(NULL); s.version = row_vals[version_col].val.int_val +1; s_new= mem_copy_subs(&s, PKG_MEM_TYPE); @@ -2876,13 +2870,11 @@ int process_dialogs(int round, int presence_winfo) cached_updated_winfo = sub.updated_winfo = VAL_INT(&dvalues[updated_winfo_col]); - if (VAL_INT(&dvalues[expires_col]) > now) + if (VAL_INT(&dvalues[expires_col]) > now + expires_offset) sub.expires = VAL_INT(&dvalues[expires_col]) - now; else sub.expires = 0; - if (sub.expires < expires_offset) sub.expires = 0; - sub.updated = round; if ((notify_sent = notifier_notify(&sub, &updated, &end_transaction)) < 0) diff --git a/modules_k/presence/presence.c b/modules_k/presence/presence.c index 29470bc..118b4d2 100644 --- a/modules_k/presence/presence.c +++ b/modules_k/presence/presence.c @@ -1348,10 +1348,10 @@ static int update_pw_dialogs_dbonlymode(subs_t* subs, subs_t** subs_array) s.expires = row_vals[r_expires_col].val.int_val; - if( s.expires < (int)time(NULL) ) - s.expires = 0; - else + if( s.expires > (int)time(NULL) + expires_offset) s.expires -= (int)time(NULL); + else + s.expires = 0; s.version = row_vals[r_version_col].val.int_val;
12 years, 3 months
1
0
0
0
git:master: modules_k/presence: Fixed level of a diagnostic message
by Peter Dunkley
Module: sip-router Branch: master Commit: 3635a0d920f0d03e85b8b97a44d878f0f8d13931 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=3635a0d…
Author: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com> Committer: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com> Date: Tue Sep 11 12:54:51 2012 +0100 modules_k/presence: Fixed level of a diagnostic message --- modules_k/presence/notify.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/modules_k/presence/notify.c b/modules_k/presence/notify.c index 919a324..d06fa6c 100644 --- a/modules_k/presence/notify.c +++ b/modules_k/presence/notify.c @@ -2836,7 +2836,7 @@ int process_dialogs(int round, int presence_winfo) if (dialog->n <= 0) { - LM_WARN("record not found\n"); + LM_INFO("record not found - this may be observed in multi-server systems\n"); if (cleanup_missing_dialog(&sub) < 0) LM_ERR("cleaning up after missing record\n"); goto next_dialog;
12 years, 3 months
1
0
0
0
git:master: registrar(k): documented lookup_branches(...) function
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: bb7bc779da5910a3d22cb5631b532ac3a3eb6b1a URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=bb7bc77…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Tue Sep 11 13:01:13 2012 +0200 registrar(k): documented lookup_branches(...) function --- modules_k/registrar/README | 155 +++++++++++++++------------ modules_k/registrar/doc/registrar_admin.xml | 34 ++++++- 2 files changed, 121 insertions(+), 68 deletions(-) Diff:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=bb7…
12 years, 3 months
1
0
0
0
git:master: registrar(k): new function lookup_branches(domain)
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: 2ac602d3de1330705ecfdede660d43c02e4b4334 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=2ac602d…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Tue Sep 11 12:52:45 2012 +0200 registrar(k): new function lookup_branches(domain) - lookup the contacts for r-uri and additional branches - only branches that are clean (i.e., have only r-uri set) are used - useful for group dialing, to lookup all AoR in the group, without a need to loop back --- modules_k/registrar/lookup.c | 132 +++++++++++++++++++++++++++++++++++++++++ modules_k/registrar/lookup.h | 5 ++ modules_k/registrar/reg_mod.c | 12 ++++ 3 files changed, 149 insertions(+), 0 deletions(-) diff --git a/modules_k/registrar/lookup.c b/modules_k/registrar/lookup.c index 0f75eec..865224a 100644 --- a/modules_k/registrar/lookup.c +++ b/modules_k/registrar/lookup.c @@ -309,6 +309,138 @@ done: } +int reset_ruri_branch(sip_msg_t *msg) +{ + if(msg==NULL) + return -1; + + reset_dst_uri(msg); + reset_path_vector(msg); + set_ruri_q(Q_UNSPECIFIED); + reset_force_socket(msg); + setbflagsval(0, 0); + return 0; +} + +/*! \brief + * Lookup contacts in the database for all branches, including R-URI + * \return: -1 : not found + * -2 : found but method not allowed (for r-uri) + * -3 : error + */ +int lookup_branches(sip_msg_t *msg, udomain_t *d) +{ + unsigned int nr_branches_start; + unsigned int i; + int ret; + int found; + str new_uri; + str ruri_b_uri = {0}; + str ruri_b_dst_uri = {0}; + str ruri_b_path = {0}; + int ruri_b_q = Q_UNSPECIFIED; + struct socket_info *ruri_b_socket = 0; + flag_t ruri_b_flags = 0; + branch_t *crt = NULL; + + ret = 1; + found = 0; + nr_branches_start = nr_branches; + /* first lookup the r-uri */ + ret = lookup(msg, d, NULL); + + /* if no other branches -- all done */ + if(nr_branches_start==0) + return ret; + + /* backup r-uri branch */ + ruri_b_uri = msg->new_uri; + ruri_b_dst_uri = msg->dst_uri; + ruri_b_path = msg->path_vec; + ruri_b_q = get_ruri_q(); + ruri_b_socket = msg->force_send_socket; + getbflagsval(0, &ruri_b_flags); + reset_ruri_branch(msg); + + for(i=0; i<nr_branches; i++) { + crt = get_sip_branch(i); + /* it has to be a clean branch to do lookup for it */ + if(crt->len <= 0 || crt->dst_uri_len > 0 + || crt->path_len > 0 || crt->force_send_socket!=NULL + || crt->flags !=0) + continue; + /* set the new uri from branch and lookup */ + new_uri.s = crt->uri; + new_uri.len = crt->len; + if (rewrite_uri(msg, &new_uri) < 0) { + LM_ERR("unable to rewrite Request-URI for branch %u\n", i); + ret = -3; + goto done; + } + ret = lookup(msg, d, NULL); + if(ret>0) { + /* move r-uri branch attributes to crt branch */ + found = 1; + + if (unlikely(msg->new_uri.len > MAX_URI_SIZE - 1)) { + LM_ERR("too long uri: %.*s\n", msg->new_uri.len, + msg->new_uri.s); + ret = -3; + goto done; + } + + /* copy the dst_uri */ + if (msg->dst_uri.len>0 && msg->dst_uri.s!=NULL) { + if (unlikely(msg->dst_uri.len > MAX_URI_SIZE - 1)) { + LM_ERR("too long dst_uri: %.*s\n", msg->dst_uri.len, + msg->dst_uri.s); + ret = -3; + goto done; + } + + memcpy(crt->dst_uri, msg->dst_uri.s, msg->dst_uri.len); + crt->dst_uri[msg->dst_uri.len] = 0; + crt->dst_uri_len = msg->dst_uri.len; + } + + /* copy the path string */ + if (unlikely(msg->path_vec.len>0 && msg->path_vec.s!=NULL)) { + if (unlikely(msg->path_vec.len > MAX_PATH_SIZE - 1)) { + LM_ERR("too long path: %.*s\n", msg->path_vec.len, + msg->path_vec.s); + ret = -3; + goto done; + } + memcpy(crt->path, msg->path_vec.s, msg->path_vec.len); + crt->path[msg->path_vec.len] = 0; + crt->path_len = msg->path_vec.len; + } + + /* copy the ruri */ + memcpy(crt->uri, msg->new_uri.s, msg->new_uri.len); + crt->uri[msg->new_uri.len] = 0; + crt->len = msg->new_uri.len; + crt->q = get_ruri_q(); + + crt->force_send_socket = msg->force_send_socket; + getbflagsval(0, &crt->flags); + } + reset_ruri_branch(msg); + } + +done: + reset_ruri_branch(msg); + msg->new_uri = ruri_b_uri; + msg->parsed_uri_ok = 0; + msg->dst_uri = ruri_b_dst_uri; + msg->path_vec = ruri_b_path; + set_ruri_q(ruri_b_q); + set_force_socket(msg, ruri_b_socket); + setbflagsval(0, ruri_b_flags); + + return (found)?1:ret; +} + /*! \brief the is_registered() function * Return true if the AOR in the Request-URI is registered, * it is similar to lookup but registered neither rewrites diff --git a/modules_k/registrar/lookup.h b/modules_k/registrar/lookup.h index 8680f14..93780ae 100644 --- a/modules_k/registrar/lookup.h +++ b/modules_k/registrar/lookup.h @@ -41,6 +41,11 @@ */ int lookup(struct sip_msg* _m, udomain_t* _d, str* _uri); +/*! \brief + * Lookup r-uri and additional branches in usrloc + */ +int lookup_branches(sip_msg_t *msg, udomain_t *d); + /*! \brief * Return true if the AOR in the Request-URI is registered, diff --git a/modules_k/registrar/reg_mod.c b/modules_k/registrar/reg_mod.c index a38b00a..de4067f 100644 --- a/modules_k/registrar/reg_mod.c +++ b/modules_k/registrar/reg_mod.c @@ -91,6 +91,7 @@ static void mod_destroy(void); static int w_save2(struct sip_msg* _m, char* _d, char* _cflags); static int w_save3(struct sip_msg* _m, char* _d, char* _cflags, char* _uri); static int w_lookup(struct sip_msg* _m, char* _d, char* _p2); +static int w_lookup_branches(struct sip_msg* _m, char* _d, char* _p2); static int w_registered(struct sip_msg* _m, char* _d, char* _uri); static int w_unregister(struct sip_msg* _m, char* _d, char* _uri); @@ -186,6 +187,8 @@ static cmd_export_t cmds[] = { {"reg_free_contacts", (cmd_function)pv_free_contacts, 1, fixup_str_null, 0, REQUEST_ROUTE| FAILURE_ROUTE }, + {"lookup_branches", (cmd_function)w_lookup_branches, 1, domain_uri_fixup, 0, + REQUEST_ROUTE | FAILURE_ROUTE }, {"bind_registrar", (cmd_function)bind_registrar, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} @@ -437,6 +440,15 @@ static int w_lookup(struct sip_msg* _m, char* _d, char* _uri) return lookup(_m, (udomain_t*)_d, (uri.len>0)?&uri:NULL); } +/*! \brief + * Wrapper to lookup_branches(location) + */ +static int w_lookup_branches(sip_msg_t* _m, char* _d, char* _p2) +{ + return lookup_branches(_m, (udomain_t*)_d); +} + + static int w_registered(struct sip_msg* _m, char* _d, char* _uri) { str uri = {0};
12 years, 3 months
1
0
0
0
git:master: core: whitespace identation fixes
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: 0724528964f8ea74049cd2d2e08082025b5c5377 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0724528…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Tue Sep 11 12:45:25 2012 +0200 core: whitespace identation fixes --- dset.c | 39 ++++++++++++++++++++++----------------- 1 files changed, 22 insertions(+), 17 deletions(-) diff --git a/dset.c b/dset.c index 4ba5ccf..31732e4 100644 --- a/dset.c +++ b/dset.c @@ -492,27 +492,32 @@ qvalue_t get_ruri_q(void) */ int rewrite_uri(struct sip_msg* _m, str* _s) { - char* buf; + char *buf = NULL; - buf = (char*)pkg_malloc(_s->len + 1); - if (!buf) { - LOG(L_ERR, "ERROR: rewrite_uri: No memory left\n"); - return -1; - } + if(_m->new_uri.s==NULL || _m->new_uri.len<_s->len) { + buf = (char*)pkg_malloc(_s->len + 1); + if (!buf) { + LM_ERR("No memory left to rewrite r-uri\n"); + return -1; + } + } + if(buf!=NULL) { + if(_m->new_uri.s) + pkg_free(_m->new_uri.s); + } else { + buf = _m->new_uri.s; + } - memcpy(buf, _s->s, _s->len); - buf[_s->len] = '\0'; + memcpy(buf, _s->s, _s->len); + buf[_s->len] = '\0'; - _m->parsed_uri_ok = 0; - if (_m->new_uri.s) { - pkg_free(_m->new_uri.s); - } + _m->parsed_uri_ok = 0; - _m->new_uri.s = buf; - _m->new_uri.len = _s->len; - /* mark ruri as new and available for forking */ - ruri_mark_new(); + _m->new_uri.s = buf; + _m->new_uri.len = _s->len; + /* mark ruri as new and available for forking */ + ruri_mark_new(); - return 1; + return 1; }
12 years, 3 months
1
0
0
0
git:master: lib/srdb1: added unique constraint on ruid for location table
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: 2c1a857f08512e7008cbd15c23716e149204a06d URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=2c1a857…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Tue Sep 11 09:00:10 2012 +0200 lib/srdb1: added unique constraint on ruid for location table --- lib/srdb1/schema/location.xml | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/lib/srdb1/schema/location.xml b/lib/srdb1/schema/location.xml index 91e421e..fc1c8e7 100644 --- a/lib/srdb1/schema/location.xml +++ b/lib/srdb1/schema/location.xml @@ -186,5 +186,11 @@ <colref linkend="domain"/> <colref linkend="contact"/> </index> + <index> + <name>ruid_idx</name> + <colref linkend="ruid"/> + <unique/> + </index> + </table>
12 years, 3 months
1
0
0
0
git:master: kamctl: regenerated the db creation scripts
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: f252606e41e00595cdaace7491af3d8daa138272 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=f252606…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Tue Sep 11 09:02:51 2012 +0200 kamctl: regenerated the db creation scripts - there were changes in presence tables not propagated to scripts - it includes the updates for location tables --- utils/kamctl/db_sqlite/presence-create.sql | 4 ++-- utils/kamctl/db_sqlite/registrar-create.sql | 3 ++- utils/kamctl/db_sqlite/usrloc-create.sql | 5 +++-- utils/kamctl/mysql/presence-create.sql | 5 +++-- utils/kamctl/mysql/registrar-create.sql | 3 ++- utils/kamctl/mysql/usrloc-create.sql | 5 +++-- utils/kamctl/oracle/presence-create.sql | 4 ++-- utils/kamctl/oracle/registrar-create.sql | 3 ++- utils/kamctl/oracle/usrloc-create.sql | 5 +++-- utils/kamctl/postgres/presence-create.sql | 4 ++-- utils/kamctl/postgres/registrar-create.sql | 3 ++- utils/kamctl/postgres/usrloc-create.sql | 5 +++-- 12 files changed, 29 insertions(+), 20 deletions(-) diff --git a/utils/kamctl/db_sqlite/presence-create.sql b/utils/kamctl/db_sqlite/presence-create.sql index a9a9157..4e25d80 100644 --- a/utils/kamctl/db_sqlite/presence-create.sql +++ b/utils/kamctl/db_sqlite/presence-create.sql @@ -102,10 +102,10 @@ CREATE TABLE pua ( remote_contact VARCHAR(128) NOT NULL, version INTEGER NOT NULL, extra_headers TEXT NOT NULL, - CONSTRAINT pua_pua_idx UNIQUE (etag, tuple_id, call_id, from_tag), - CONSTRAINT pua_expires_idx UNIQUE (expires) + CONSTRAINT pua_pua_idx UNIQUE (etag, tuple_id, call_id, from_tag) ); +CREATE INDEX pua_expires_idx ON pua (expires); CREATE INDEX pua_dialog1_idx ON pua (call_id, from_tag, to_tag); CREATE INDEX pua_dialog2_idx ON pua (pres_id, pres_uri); CREATE INDEX pua_tmp_dlg1_idx ON pua (call_id, from_tag); diff --git a/utils/kamctl/db_sqlite/registrar-create.sql b/utils/kamctl/db_sqlite/registrar-create.sql index bcad0f6..f9a4cc4 100644 --- a/utils/kamctl/db_sqlite/registrar-create.sql +++ b/utils/kamctl/db_sqlite/registrar-create.sql @@ -18,7 +18,8 @@ CREATE TABLE aliases ( socket VARCHAR(64) DEFAULT NULL, methods INTEGER DEFAULT NULL, instance VARCHAR(255) DEFAULT NULL, - reg_id INTEGER DEFAULT 0 NOT NULL + reg_id INTEGER DEFAULT 0 NOT NULL, + CONSTRAINT aliases_ruid_idx UNIQUE (ruid) ); CREATE INDEX aliases_alias_idx ON aliases (username, domain, contact); diff --git a/utils/kamctl/db_sqlite/usrloc-create.sql b/utils/kamctl/db_sqlite/usrloc-create.sql index 11442f6..6286179 100644 --- a/utils/kamctl/db_sqlite/usrloc-create.sql +++ b/utils/kamctl/db_sqlite/usrloc-create.sql @@ -6,7 +6,7 @@ CREATE TABLE location ( domain VARCHAR(64) DEFAULT NULL, contact VARCHAR(255) DEFAULT '' NOT NULL, received VARCHAR(128) DEFAULT NULL, - path VARCHAR(128) DEFAULT NULL, + path VARCHAR(512) DEFAULT NULL, expires TIMESTAMP WITHOUT TIME ZONE DEFAULT '2030-05-28 21:32:15' NOT NULL, q REAL DEFAULT 1.0 NOT NULL, callid VARCHAR(255) DEFAULT 'Default-Call-ID' NOT NULL, @@ -18,7 +18,8 @@ CREATE TABLE location ( socket VARCHAR(64) DEFAULT NULL, methods INTEGER DEFAULT NULL, instance VARCHAR(255) DEFAULT NULL, - reg_id INTEGER DEFAULT 0 NOT NULL + reg_id INTEGER DEFAULT 0 NOT NULL, + CONSTRAINT location_ruid_idx UNIQUE (ruid) ); CREATE INDEX location_account_contact_idx ON location (username, domain, contact); diff --git a/utils/kamctl/mysql/presence-create.sql b/utils/kamctl/mysql/presence-create.sql index 7f68249..928521e 100644 --- a/utils/kamctl/mysql/presence-create.sql +++ b/utils/kamctl/mysql/presence-create.sql @@ -102,13 +102,14 @@ CREATE TABLE pua ( remote_contact VARCHAR(128) NOT NULL, version INT(11) NOT NULL, extra_headers TEXT NOT NULL, - CONSTRAINT pua_idx UNIQUE (etag, tuple_id, call_id, from_tag), + CONSTRAINT pua_idx UNIQUE (etag, tuple_id, call_id, from_tag) ) ENGINE=MyISAM; +CREATE INDEX expires_idx ON pua (expires); CREATE INDEX dialog1_idx ON pua (call_id, from_tag, to_tag); CREATE INDEX dialog2_idx ON pua (pres_id, pres_uri); CREATE INDEX tmp_dlg1_idx ON pua (call_id, from_tag); CREATE INDEX tmp_dlg2_idx ON pua (pres_id, pres_uri, call_id, from_tag); CREATE INDEX tmp_record1_idx ON pua (pres_id); CREATE INDEX tmp_record2_idx ON pua (pres_id, etag); -CREATE INDEX expires_idx ON pua (expires); + diff --git a/utils/kamctl/mysql/registrar-create.sql b/utils/kamctl/mysql/registrar-create.sql index 640f7e8..4d7d9e8 100644 --- a/utils/kamctl/mysql/registrar-create.sql +++ b/utils/kamctl/mysql/registrar-create.sql @@ -18,7 +18,8 @@ CREATE TABLE aliases ( socket VARCHAR(64) DEFAULT NULL, methods INT(11) DEFAULT NULL, instance VARCHAR(255) DEFAULT NULL, - reg_id INT(11) DEFAULT 0 NOT NULL + reg_id INT(11) DEFAULT 0 NOT NULL, + CONSTRAINT ruid_idx UNIQUE (ruid) ) ENGINE=MyISAM; CREATE INDEX alias_idx ON aliases (username, domain, contact); diff --git a/utils/kamctl/mysql/usrloc-create.sql b/utils/kamctl/mysql/usrloc-create.sql index fe26cca..8f4f425 100644 --- a/utils/kamctl/mysql/usrloc-create.sql +++ b/utils/kamctl/mysql/usrloc-create.sql @@ -6,7 +6,7 @@ CREATE TABLE location ( domain VARCHAR(64) DEFAULT NULL, contact VARCHAR(255) DEFAULT '' NOT NULL, received VARCHAR(128) DEFAULT NULL, - path VARCHAR(128) DEFAULT NULL, + path VARCHAR(512) DEFAULT NULL, expires DATETIME DEFAULT '2030-05-28 21:32:15' NOT NULL, q FLOAT(10,2) DEFAULT 1.0 NOT NULL, callid VARCHAR(255) DEFAULT 'Default-Call-ID' NOT NULL, @@ -18,7 +18,8 @@ CREATE TABLE location ( socket VARCHAR(64) DEFAULT NULL, methods INT(11) DEFAULT NULL, instance VARCHAR(255) DEFAULT NULL, - reg_id INT(11) DEFAULT 0 NOT NULL + reg_id INT(11) DEFAULT 0 NOT NULL, + CONSTRAINT ruid_idx UNIQUE (ruid) ) ENGINE=MyISAM; CREATE INDEX account_contact_idx ON location (username, domain, contact); diff --git a/utils/kamctl/oracle/presence-create.sql b/utils/kamctl/oracle/presence-create.sql index bffdba2..a1c5528 100644 --- a/utils/kamctl/oracle/presence-create.sql +++ b/utils/kamctl/oracle/presence-create.sql @@ -134,8 +134,7 @@ CREATE TABLE pua ( remote_contact VARCHAR2(128), version NUMBER(10), extra_headers CLOB, - CONSTRAINT pua_pua_idx UNIQUE (etag, tuple_id, call_id, from_tag), - CONSTRAINT pua_expires_idx UNIQUE (expires) + CONSTRAINT pua_pua_idx UNIQUE (etag, tuple_id, call_id, from_tag) ); CREATE OR REPLACE TRIGGER pua_tr @@ -146,6 +145,7 @@ END pua_tr; / BEGIN map2users('pua'); END; / +CREATE INDEX pua_expires_idx ON pua (expires); CREATE INDEX pua_dialog1_idx ON pua (call_id, from_tag, to_tag); CREATE INDEX pua_dialog2_idx ON pua (pres_id, pres_uri); CREATE INDEX pua_tmp_dlg1_idx ON pua (call_id, from_tag); diff --git a/utils/kamctl/oracle/registrar-create.sql b/utils/kamctl/oracle/registrar-create.sql index d311b41..4c0d5ba 100644 --- a/utils/kamctl/oracle/registrar-create.sql +++ b/utils/kamctl/oracle/registrar-create.sql @@ -18,7 +18,8 @@ CREATE TABLE aliases ( socket VARCHAR2(64) DEFAULT NULL, methods NUMBER(10) DEFAULT NULL, instance VARCHAR2(255) DEFAULT NULL, - reg_id NUMBER(10) DEFAULT 0 NOT NULL + reg_id NUMBER(10) DEFAULT 0 NOT NULL, + CONSTRAINT aliases_ruid_idx UNIQUE (ruid) ); CREATE OR REPLACE TRIGGER aliases_tr diff --git a/utils/kamctl/oracle/usrloc-create.sql b/utils/kamctl/oracle/usrloc-create.sql index 67070c9..8cc677e 100644 --- a/utils/kamctl/oracle/usrloc-create.sql +++ b/utils/kamctl/oracle/usrloc-create.sql @@ -6,7 +6,7 @@ CREATE TABLE location ( domain VARCHAR2(64) DEFAULT NULL, contact VARCHAR2(255) DEFAULT '', received VARCHAR2(128) DEFAULT NULL, - path VARCHAR2(128) DEFAULT NULL, + path VARCHAR2(512) DEFAULT NULL, expires DATE DEFAULT to_date('2030-05-28 21:32:15','yyyy-mm-dd hh24:mi:ss'), q NUMBER(10,2) DEFAULT 1.0 NOT NULL, callid VARCHAR2(255) DEFAULT 'Default-Call-ID', @@ -18,7 +18,8 @@ CREATE TABLE location ( socket VARCHAR2(64) DEFAULT NULL, methods NUMBER(10) DEFAULT NULL, instance VARCHAR2(255) DEFAULT NULL, - reg_id NUMBER(10) DEFAULT 0 NOT NULL + reg_id NUMBER(10) DEFAULT 0 NOT NULL, + CONSTRAINT location_ruid_idx UNIQUE (ruid) ); CREATE OR REPLACE TRIGGER location_tr diff --git a/utils/kamctl/postgres/presence-create.sql b/utils/kamctl/postgres/presence-create.sql index 1aacd99..cf3fe17 100644 --- a/utils/kamctl/postgres/presence-create.sql +++ b/utils/kamctl/postgres/presence-create.sql @@ -102,10 +102,10 @@ CREATE TABLE pua ( remote_contact VARCHAR(128) NOT NULL, version INTEGER NOT NULL, extra_headers TEXT NOT NULL, - CONSTRAINT pua_pua_idx UNIQUE (etag, tuple_id, call_id, from_tag), - CONSTRAINT pua_expires_idx UNIQUE (expires) + CONSTRAINT pua_pua_idx UNIQUE (etag, tuple_id, call_id, from_tag) ); +CREATE INDEX pua_expires_idx ON pua (expires); CREATE INDEX pua_dialog1_idx ON pua (call_id, from_tag, to_tag); CREATE INDEX pua_dialog2_idx ON pua (pres_id, pres_uri); CREATE INDEX pua_tmp_dlg1_idx ON pua (call_id, from_tag); diff --git a/utils/kamctl/postgres/registrar-create.sql b/utils/kamctl/postgres/registrar-create.sql index 1f1c382..86d0b11 100644 --- a/utils/kamctl/postgres/registrar-create.sql +++ b/utils/kamctl/postgres/registrar-create.sql @@ -18,7 +18,8 @@ CREATE TABLE aliases ( socket VARCHAR(64) DEFAULT NULL, methods INTEGER DEFAULT NULL, instance VARCHAR(255) DEFAULT NULL, - reg_id INTEGER DEFAULT 0 NOT NULL + reg_id INTEGER DEFAULT 0 NOT NULL, + CONSTRAINT aliases_ruid_idx UNIQUE (ruid) ); CREATE INDEX aliases_alias_idx ON aliases (username, domain, contact); diff --git a/utils/kamctl/postgres/usrloc-create.sql b/utils/kamctl/postgres/usrloc-create.sql index 6125845..c161178 100644 --- a/utils/kamctl/postgres/usrloc-create.sql +++ b/utils/kamctl/postgres/usrloc-create.sql @@ -6,7 +6,7 @@ CREATE TABLE location ( domain VARCHAR(64) DEFAULT NULL, contact VARCHAR(255) DEFAULT '' NOT NULL, received VARCHAR(128) DEFAULT NULL, - path VARCHAR(128) DEFAULT NULL, + path VARCHAR(512) DEFAULT NULL, expires TIMESTAMP WITHOUT TIME ZONE DEFAULT '2030-05-28 21:32:15' NOT NULL, q REAL DEFAULT 1.0 NOT NULL, callid VARCHAR(255) DEFAULT 'Default-Call-ID' NOT NULL, @@ -18,7 +18,8 @@ CREATE TABLE location ( socket VARCHAR(64) DEFAULT NULL, methods INTEGER DEFAULT NULL, instance VARCHAR(255) DEFAULT NULL, - reg_id INTEGER DEFAULT 0 NOT NULL + reg_id INTEGER DEFAULT 0 NOT NULL, + CONSTRAINT location_ruid_idx UNIQUE (ruid) ); CREATE INDEX location_account_contact_idx ON location (username, domain, contact);
12 years, 3 months
1
0
0
0
git:master: lib/srdb1: added unique constraint on ruid for aliases table
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: fd911bbfdc82fc41312e2b4466e71ccd24bc5ee2 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=fd911bb…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Tue Sep 11 09:02:34 2012 +0200 lib/srdb1: added unique constraint on ruid for aliases table --- lib/srdb1/schema/aliases.xml | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/lib/srdb1/schema/aliases.xml b/lib/srdb1/schema/aliases.xml index fe7df18..29975de 100644 --- a/lib/srdb1/schema/aliases.xml +++ b/lib/srdb1/schema/aliases.xml @@ -186,5 +186,10 @@ <colref linkend="domain"/> <colref linkend="contact"/> </index> + <index> + <name>ruid_idx</name> + <colref linkend="ruid"/> + <unique/> + </index> </table>
12 years, 3 months
1
0
0
0
git:master: kex: documented mi statistics commands
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: 6b7a27e81cc838de6af9a1c55edb937d1094ce98 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=6b7a27e…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Tue Sep 11 08:52:53 2012 +0200 kex: documented mi statistics commands - reported by David at lublink --- modules_k/kex/README | 51 +++++++++++++++++++++++++++++ modules_k/kex/doc/kex_admin.xml | 67 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+), 0 deletions(-) diff --git a/modules_k/kex/README b/modules_k/kex/README index 89b3197..d7b35ee 100644 --- a/modules_k/kex/README +++ b/modules_k/kex/README @@ -49,6 +49,9 @@ Daniel-Constantin Mierla 4.4. uptime 4.5. version 4.6. which + 4.7. get_statistics + 4.8. reset_statistics + 4.9. clear_statistics 5. RPC Commands @@ -105,6 +108,9 @@ Chapter 1. Admin Guide 4.4. uptime 4.5. version 4.6. which + 4.7. get_statistics + 4.8. reset_statistics + 4.9. clear_statistics 5. RPC Commands @@ -383,6 +389,9 @@ resetdebug(); 4.4. uptime 4.5. version 4.6. which + 4.7. get_statistics + 4.8. reset_statistics + 4.9. clear_statistics 4.1. arg @@ -456,6 +465,48 @@ resetdebug(); :which:_reply_fifo_file_ _empty_line_ +4.7. get_statistics + + Print the list of available internal statistics. + + Name: get_statistics + + Parameters: statsid - which statistics to be printed. If set to 'all' + then all statistics are printed; if set to 'statsgroup:' then all + statistics in the group are printed; if set to 'statsname' then the + statistics identified by the name is printed. + + MI FIFO Command Format: + :get_statistics:_reply_fifo_file_ + _statsid_ + _empty_line_ + +4.8. reset_statistics + + Reset internal statistics. + + Name: reset_statistics + + Parameters: statsid - which statistics to be reset, give as name. + + MI FIFO Command Format: + :reset_statistics:_reply_fifo_file_ + _statsid_ + _empty_line_ + +4.9. clear_statistics + + Return statistics and reset their value in one command. + + Name: get_statistics + + Parameters: statsid - same as for get_statistics. + + MI FIFO Command Format: + :clear_statistics:_reply_fifo_file_ + _statsid_ + _empty_line_ + 5. RPC Commands 5.1. pkg.stats diff --git a/modules_k/kex/doc/kex_admin.xml b/modules_k/kex/doc/kex_admin.xml index 02a27a6..8db736e 100644 --- a/modules_k/kex/doc/kex_admin.xml +++ b/modules_k/kex/doc/kex_admin.xml @@ -549,6 +549,73 @@ resetdebug(); _empty_line_ </programlisting> </section> + <section> + <title> + <function moreinfo="none">get_statistics</function> + </title> + <para> + Print the list of available internal statistics. + </para> + <para> + Name: <emphasis>get_statistics</emphasis> + </para> + <para>Parameters: <emphasis>statsid</emphasis> - which statistics to + be printed. If set to 'all' then all statistics are printed; if + set to 'statsgroup:' then all statistics in the group are printed; + if set to 'statsname' then the statistics identified by the name + is printed.</para> + <para> + MI FIFO Command Format: + </para> + <programlisting format="linespecific"> + :get_statistics:_reply_fifo_file_ + _statsid_ + _empty_line_ + </programlisting> + </section> + <section> + <title> + <function moreinfo="none">reset_statistics</function> + </title> + <para> + Reset internal statistics. + </para> + <para> + Name: <emphasis>reset_statistics</emphasis> + </para> + <para>Parameters: <emphasis>statsid</emphasis> - which statistics to + be reset, give as name.</para> + <para> + MI FIFO Command Format: + </para> + <programlisting format="linespecific"> + :reset_statistics:_reply_fifo_file_ + _statsid_ + _empty_line_ + </programlisting> + </section> + <section> + <title> + <function moreinfo="none">clear_statistics</function> + </title> + <para> + Return statistics and reset their value in one command. + </para> + <para> + Name: <emphasis>get_statistics</emphasis> + </para> + <para>Parameters: <emphasis>statsid</emphasis> - same as for + get_statistics.</para> + <para> + MI FIFO Command Format: + </para> + <programlisting format="linespecific"> + :clear_statistics:_reply_fifo_file_ + _statsid_ + _empty_line_ + </programlisting> + </section> + </section> <section>
12 years, 3 months
1
0
0
0
← Newer
1
...
10
11
12
13
14
15
16
17
18
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Results per page:
10
25
50
100
200