kamdbctl(8) Kamailio kamdbctl(8)
NAME
kamdbctl - Kamailio database control tool
SYNOPSIS
kamctl command [ parameters ]
DESCRIPTION
kamdbctl is a script to maintain the database needed by some Kamalio
modules.
Hello
The str_strcmp function does not do a correct lexicographic comparison
between the received strings:
<verbatim>
/**
* \brief Compare two str's case sensitive
* \param str1 first str
* \param str2 second str
* \return 0 if both are equal, positive if str1 is greater, negative if
str2 is greater, -2 on errors
*/
static inline int str_strcmp(const str *str1, const str *str2)
{
if(str1==NULL || str2==NULL || str1->s ==NULL || str2->s==NULL ||
str1->len<0 || str2->len<0)
{
LM_ERR("bad parameters\n");
return -2;
}
if (str1->len < str2->len)
return -1;
else if (str1->len > str2->len)
return 1;
else
return strncmp(str1->s, str2->s, str1->len);
}
</verbatim>
in this case str1={"z",1} will be "smaller" then str2={"aa", 2} because
it's length is smaller . Method is used is various tree implementations...
(same from str_casestrcmp())
Is this "normal" ?
Marius
Hello
The str_strcmp function does not do a correct lexicographic comparison
between the received strings:
<verbatim>
/**
* \brief Compare two str's case sensitive
* \param str1 first str
* \param str2 second str
* \return 0 if both are equal, positive if str1 is greater, negative if
str2 is greater, -2 on errors
*/
static inline int str_strcmp(const str *str1, const str *str2)
{
if(str1==NULL || str2==NULL || str1->s ==NULL || str2->s==NULL ||
str1->len<0 || str2->len<0)
{
LM_ERR("bad parameters\n");
return -2;
}
if (str1->len < str2->len)
return -1;
else if (str1->len > str2->len)
return 1;
else
return strncmp(str1->s, str2->s, str1->len);
}
</verbatim>
in this case str1={"z",1} will be "smaller" then str2={"aa", 2} because
it's length is smaller . Method is used is various tree implementations...
(same from str_casestrcmp())
Is this "normal" ?
Marius
Hello
The str_strcmp function does not do a correct lexicographic comparison
between the received strings:
<verbatim>
/**
* \brief Compare two str's case sensitive
* \param str1 first str
* \param str2 second str
* \return 0 if both are equal, positive if str1 is greater, negative if
str2 is greater, -2 on errors
*/
static inline int str_strcmp(const str *str1, const str *str2)
{
if(str1==NULL || str2==NULL || str1->s ==NULL || str2->s==NULL ||
str1->len<0 || str2->len<0)
{
LM_ERR("bad parameters\n");
return -2;
}
if (str1->len < str2->len)
return -1;
else if (str1->len > str2->len)
return 1;
else
return strncmp(str1->s, str2->s, str1->len);
}
</verbatim>
in this case str1={"z",1} will be "smaller" then str2={"aa", 2} because
it's length is smaller . Method is used is various tree implementations...
(same from str_casestrcmp())
Is this "normal" ?
Marius
Hi, I want to improve the regex module by allowing that the function
pcre_match_group() accepts a pseudo variable as second argument, to
get something like this:
$avp(i:11) = 111;
if pcre_match_group("$rU","$avp(i:11)")
...
So I'm modifying regex_mod.c:
- Before:
{ "pcre_match_group", (cmd_function)w_pcre_match_group, 2, fixup_spve_uint, 0,
REQUEST_ROUTE|FAILURE_ROUTE|ONREPLY_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE }
- Now:
{ "pcre_match_group", (cmd_function)w_pcre_match_group, 2, fixup_spve_spve, 0,
REQUEST_ROUTE|FAILURE_ROUTE|ONREPLY_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE }
Then in the function code I do (just the additions):
-------------------------------------------------------------------------
static int w_pcre_match_group(struct sip_msg* _msg, char* _s1, char* _s2)
{
str group;
if (_s2 == NULL) {
num_pcre = 0;
} else {
if (fixup_get_svalue(_msg, (gparam_p)_s2, &group))
{
LM_ERR("cannot print the format for second param\n");
return -5;
}
num_pcre = (int)(long)group.s;
LM_INFO("***debugging*** group.s = <%s> - group.len = <%i> -
num_pcre = <%i>\n", group.s, group.len, num_pcre);
}
------------------------------------------------------------------------
With the above example:
$avp(i:11) = 111;
if pcre_match_group("$rU","$avp(i:11)")
I get the following wrong outpu (num_pcre should be 111):
INFO:regex:w_pcre_match_group: ***debugging*** group.s = <111> -
group.len = <3> - num_pcre = <7198368>
So, how to convert group.s into an integer? Thanks a lot for any help.
PS: I'm coding it in Kamailio 1.5.
--
Iñaki Baz Castillo
<ibc(a)aliax.net>
Revision: 6002
http://openser.svn.sourceforge.net/openser/?rev=6002&view=rev
Author: ibc_sf
Date: 2010-04-22 11:42:24 +0000 (Thu, 22 Apr 2010)
Log Message:
-----------
dialog(k): populate bind addr before any error
- backport from sip-router master branch (commit d68980dc6f3de03a432f478c124852c23a1d1b2)
- setting bind addr attribute in populate_leg_info() takes place before
any parsing error may occur, to be sure it is set, avoiding extra
check for null value when updating db
- reported by Kelvin Chua
- credits to Timo Reimann for troubleshooting
Modified Paths:
--------------
branches/1.5/modules/dialog/dlg_handlers.c
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6001
http://openser.svn.sourceforge.net/openser/?rev=6001&view=rev
Author: ibc_sf
Date: 2010-04-22 11:35:47 +0000 (Thu, 22 Apr 2010)
Log Message:
-----------
dialog(k): populate bind addr before any error
- backport from sip-router master branch (commit d68980dc6f3de03a432f478c124852c23a1d1b2)
- setting bind addr attribute in populate_leg_info() takes place before
any parsing error may occur, to be sure it is set, avoiding extra
check for null value when updating db
- reported by Kelvin Chua
- credits to Timo Reimann for troubleshooting
Modified Paths:
--------------
trunk/modules/dialog/dlg_handlers.c
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Hello,
yesterday I committed to git new feature that allow write access to
branch attributes. It is about branches kept in core before TM takes
over and creates the branches for transaction. These branches are filled
when you do location lookup, alias db lookup or append_branch in route
block.
You can update the attributes:
- r-uri
- outbound proxy address (dst uri)
- path
- q value
- local socket to be used for sending
- branch flags
More at:
http://sip-router.org/wiki/cookbooks/pseudo-variables/devel#branch_attribut…
The access can be done with index, 0 is the first. Negative value of
index starts counting from the last, therefore index -1 is the last
branch. If the index is missing, then first branch is used.
Adding a new branch can be done with km_append_branch(...) of kex module
or append_branch() functions. Dropping a branch is by assigning $null to
uri attribute of branch.
Among benefits:
- drop invalid branches before creating the transaction
- you can lookup the aor from branches in location table, avoiding a
loopback of a branch (e.g., for alias db case)
Cheers,
Daniel
--
Daniel-Constantin Mierla
* http://www.asipto.com/
* http://twitter.com/miconda
* http://www.linkedin.com/in/danielconstantinmierla