Hi Daniel,
presence seems to share the db connection on the clean functions.
this leads to messages like
[dbt_base.c:150]: dbt_free_result(): unable to free internal structure
here is mod_init of in presence.c
if(clean_period>0)
{
register_timer(msg_presentity_clean, 0, clean_period);
register_timer(msg_watchers_clean, 0, clean_period);
}
i included a updated patch tested against master.
please consider including it.
Best
Module: sip-router
Branch: master
Commit: a39e8db53e6a99545385c6b8d4bfc77217f788c4
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a39e8db…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Mon Sep 8 17:15:34 2014 +0200
dispatcher: regenerated readme file
---
modules/dispatcher/README | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/modules/dispatcher/README b/modules/dispatcher/README
index a6dd931..a25a3df 100644
--- a/modules/dispatcher/README
+++ b/modules/dispatcher/README
@@ -72,7 +72,7 @@ Carsten Bock
4.3. ds_next_dst()
4.4. ds_next_domain()
4.5. ds_mark_dst([state])
- 4.6. ds_is_from_list([groupid [, uri, mode] ])
+ 4.6. ds_is_from_list([groupid [, mode [, uri] ] ])
4.7. ds_load_update()
4.8. ds_load_unset()
@@ -188,7 +188,7 @@ Chapter 1. Admin Guide
4.3. ds_next_dst()
4.4. ds_next_domain()
4.5. ds_mark_dst([state])
- 4.6. ds_is_from_list([groupid [, uri, mode] ])
+ 4.6. ds_is_from_list([groupid [, mode [, uri] ] ])
4.7. ds_load_update()
4.8. ds_load_unset()
@@ -695,7 +695,7 @@ Note
4.3. ds_next_dst()
4.4. ds_next_domain()
4.5. ds_mark_dst([state])
- 4.6. ds_is_from_list([groupid [, uri, mode] ])
+ 4.6. ds_is_from_list([groupid [, mode [, uri] ] ])
4.7. ds_load_update()
4.8. ds_load_unset()
@@ -834,7 +834,7 @@ failure_route[tryagain] {
}
...
-4.6. ds_is_from_list([groupid [, uri, mode] ])
+4.6. ds_is_from_list([groupid [, mode [, uri] ] ])
This function returns true, if there is a match of source address or
uri with an address in the given group of the dispatcher-list;
@@ -846,6 +846,12 @@ failure_route[tryagain] {
the matching will be done only against the addresses in the
specific group id. The parameter can be an integer or a variable
holding an integer value.
+ * mode - (optional) - a bitmask to specify how the matching should be
+ done. If is 0, all ip, port and proto are matched. If bit one is
+ set, then port is ignored. If bit two is set, then protocol is
+ ignored. The parameter can be an integer or a variable holding an
+ integer value. It must be provided if the uri parameter is
+ provided.
* uri (optional) - if is empty or missing, the matching is done
against source IP, port and protocol. Otherwise the value has to be
a valid SIP URI, used to match against addresses in the dispatcher
@@ -853,12 +859,6 @@ failure_route[tryagain] {
parameters are ignored. The parameter can be a static or dynamic
(with variables) string. The domain part of the URI can be an IP
address or a hostname.
- * mode - (optional) - a bitmask to specify how the matching should be
- done. If is 0, all ip, port and proto are matched. If bit one is
- set, then port is ignored. If bit two is set, then protocol is
- ignored. The parameter can be an integer or a variable holding an
- integer value. It must be provided if the uri parameter is
- provided.
Upon a match, the variable specified by 'setid_pvname' parameter will
be set to groupid of matching address and the attributes will be set in
Module: sip-router
Branch: master
Commit: 121cb0f4feb2cc1a670d17432593ff7e025d65a5
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=121cb0f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Mon Sep 8 17:13:12 2014 +0200
dispatcher: swap the order between uri and mode parameters in the new ds_is_from_list(...)
- allow to have ds_is_from_list() only with group id and mode, uri is
the last parameter, still optional
- patch provided by Luis Azedo <luis.azedo(a)factorlusitano.com>
---
modules/dispatcher/dispatcher.c | 41 +++++++++++++++++++++------
modules/dispatcher/doc/dispatcher_admin.xml | 24 ++++++++--------
2 files changed, 44 insertions(+), 21 deletions(-)
diff --git a/modules/dispatcher/dispatcher.c b/modules/dispatcher/dispatcher.c
index 5356f2e..13f3f56 100644
--- a/modules/dispatcher/dispatcher.c
+++ b/modules/dispatcher/dispatcher.c
@@ -159,8 +159,9 @@ static int w_ds_load_update(struct sip_msg*, char*, char*);
static int w_ds_is_from_list0(struct sip_msg*, char*, char*);
static int w_ds_is_from_list1(struct sip_msg*, char*, char*);
+static int w_ds_is_from_list2(struct sip_msg*, char*, char*);
static int w_ds_is_from_list3(struct sip_msg*, char*, char*, char*);
-static int fixup_ds_is_from_list3(void** param, int param_no);
+static int fixup_ds_is_from_list(void** param, int param_no);
static void destroy(void);
@@ -192,8 +193,10 @@ static cmd_export_t cmds[]={
0, 0, REQUEST_ROUTE|FAILURE_ROUTE|ONREPLY_ROUTE|BRANCH_ROUTE},
{"ds_is_from_list", (cmd_function)w_ds_is_from_list1, 1,
fixup_igp_null, 0, ANY_ROUTE},
+ {"ds_is_from_list", (cmd_function)w_ds_is_from_list2, 2,
+ fixup_ds_is_from_list, 0, ANY_ROUTE},
{"ds_is_from_list", (cmd_function)w_ds_is_from_list3, 3,
- fixup_ds_is_from_list3, 0, ANY_ROUTE},
+ fixup_ds_is_from_list, 0, ANY_ROUTE},
{"ds_load_unset", (cmd_function)w_ds_load_unset, 0,
0, 0, ANY_ROUTE},
{"ds_load_update", (cmd_function)w_ds_load_update, 0,
@@ -844,20 +847,34 @@ static int w_ds_is_from_list1(struct sip_msg *msg, char *set, char *str2)
return ds_is_from_list(msg, s);
}
-static int w_ds_is_from_list3(struct sip_msg *msg, char *set, char *uri, char *mode)
+static int w_ds_is_from_list2(struct sip_msg *msg, char *set, char *mode)
{
int vset;
int vmode;
- str suri;
if(fixup_get_ivalue(msg, (gparam_t*)set, &vset)!=0)
{
LM_ERR("cannot get set id value\n");
return -1;
}
- if(fixup_get_svalue(msg, (gparam_t*)uri, &suri)!=0)
+ if(fixup_get_ivalue(msg, (gparam_t*)mode, &vmode)!=0)
{
- LM_ERR("cannot get uri value\n");
+ LM_ERR("cannot get mode value\n");
+ return -1;
+ }
+
+ return ds_is_addr_from_list(msg, vset, NULL, vmode);
+}
+
+static int w_ds_is_from_list3(struct sip_msg *msg, char *set, char *mode, char *uri)
+{
+ int vset;
+ int vmode;
+ str suri;
+
+ if(fixup_get_ivalue(msg, (gparam_t*)set, &vset)!=0)
+ {
+ LM_ERR("cannot get set id value\n");
return -1;
}
if(fixup_get_ivalue(msg, (gparam_t*)mode, &vmode)!=0)
@@ -865,15 +882,21 @@ static int w_ds_is_from_list3(struct sip_msg *msg, char *set, char *uri, char *m
LM_ERR("cannot get mode value\n");
return -1;
}
+ if(fixup_get_svalue(msg, (gparam_t*)uri, &suri)!=0)
+ {
+ LM_ERR("cannot get uri value\n");
+ return -1;
+ }
return ds_is_addr_from_list(msg, vset, &suri, vmode);
}
-static int fixup_ds_is_from_list3(void** param, int param_no)
+
+static int fixup_ds_is_from_list(void** param, int param_no)
{
- if(param_no==1 || param_no==3)
+ if(param_no==1 || param_no==2)
return fixup_igp_null(param, 1);
- if(param_no==2)
+ if(param_no==3)
return fixup_spve_null(param, 1);
return 0;
}
diff --git a/modules/dispatcher/doc/dispatcher_admin.xml b/modules/dispatcher/doc/dispatcher_admin.xml
index 5177a12..11c75ce 100644
--- a/modules/dispatcher/doc/dispatcher_admin.xml
+++ b/modules/dispatcher/doc/dispatcher_admin.xml
@@ -994,7 +994,7 @@ failure_route[tryagain] {
</section>
<section id="dispatcher.f.ds_is_from_list">
<title>
- <function moreinfo="none">ds_is_from_list([groupid [, uri, mode] ])</function>
+ <function moreinfo="none">ds_is_from_list([groupid [, mode [, uri] ] ])</function>
</title>
<para>
This function returns true, if there is a match of source address or uri
@@ -1011,17 +1011,6 @@ failure_route[tryagain] {
</para>
</listitem>
<listitem>
- <para><emphasis>uri</emphasis> (optional) - if is empty or missing,
- the matching is done against source IP, port and protocol.
- Otherwise the value has to be a valid SIP URI, used to match
- against addresses in the dispatcher list. Only IP, port and
- protocol are matches, any additional parameters are ignored.
- The parameter can be a static or dynamic (with variables)
- string. The domain part of the URI can be an IP address or
- a hostname.
- </para>
- </listitem>
- <listitem>
<para><emphasis>mode</emphasis> - (optional) - a bitmask to specify
how the matching should be done. If is 0, all ip, port and
proto are matched. If bit one is set, then port is ignored.
@@ -1030,6 +1019,17 @@ failure_route[tryagain] {
It must be provided if the uri parameter is provided.
</para>
</listitem>
+ <listitem>
+ <para><emphasis>uri</emphasis> (optional) - if is empty or missing,
+ the matching is done against source IP, port and protocol.
+ Otherwise the value has to be a valid SIP URI, used to match
+ against addresses in the dispatcher list. Only IP, port and
+ protocol are matches, any additional parameters are ignored.
+ The parameter can be a static or dynamic (with variables)
+ string. The domain part of the URI can be an IP address or
+ a hostname.
+ </para>
+ </listitem>
</itemizedlist>
<para>