Hi,
Trying the GRUU implementation on Registrar module (Kamailio Version
3.3), I found that the proxy does not rewrite the Request URI for
in-dialog requests as stated in RFC 5627 6.2.
++++
If the Request-URI contains the "gr" URI parameter and is equivalent,
based on URI comparison, to a GRUU which is currently valid within
the domain, processing proceeds as it would for any other URI present
in the location service, as defined in Section 16.5 of RFC 3261 [1],
except that the "gr" URI parameter is not removed as part of the
canonicalization process. This is the case for both out-of-dialog
requests targeted to the GRUU, and mid-dialog requests targeted to
the GRUU (in which case the incoming request would have a Route
header field value containing the URI that the proxy used for record-
routing.).
Note that the "gr" URI parameter is retained just for the purposes of
finding the GRUU in the location service; if a match is found, the
Request-URI will be rewritten with the registered contacts, replacing
the GRUU and its "gr" URI parameter. The "gr" URI parameter is not
carried forward into the rewritten Request-URI.
++++
Here an in-dialog MESSAGE coming to Kamailio and routed-out. The
incoming request URI has the 'gr' parameter and also has the outgoing
request, which should be rewritten with the registered contact (which
hasn't got the 'gr' parameter) .
++++
MESSAGE sip:one@mydomain;gr=urn:uuid:820e1a10-ffc9-44fd-ae36-2009d835deaf
SIP/2.0'
Route: <sip:KAMAILIO;transport=tcp;lr=on>'
Route: <sip:OUTBOUND_PROXY:9090;transport=tcp;lr;ovid=fef2d723>'
Route: <sip:f2abb14cb6@OUTBOUND_PROXY:10080;transport=ws;lr;ovid=fef2d723>'
Via: SIP/2.0/TCP
OUTBOUND_PROXY:9090;branch=z9hG4bK1b8e92e2b075b4fcb9f177ab9ea732ca88ac6221;rport'
Via: SIP/2.0/TCP
192.32.232.12;branch=z9hG4bK3609852;received=PUBLIC_IP'
Max-Forwards: 8'
To: sip:one@mydomain;tag=9y5zyjjrqb'
From: sip:jmillan@mydomain;tag=243wxuykw0'
Call-ID: b9q6ixruxbbt2ej5opqf'
CSeq: 3570 MESSAGE'
Content-Type: text/plain'
User-Agent: JsSIP 0.1.0'
Content-Length: 7'
'
lalaiii
MESSAGE sip:one@mydomain;gr=urn:uuid:820e1a10-ffc9-44fd-ae36-2009d835deaf
SIP/2.0'
Route: <sip:OUTBOUND_PROXY:9090;transport=tcp;lr;ovid=fef2d723>'
Route: <sip:f2abb14cb6@OUTBOUND_PROXY:10080;transport=ws;lr;ovid=fef2d723>'
Via: SIP/2.0/TCP KAMAILIO;branch=z9hG4bKf316.d94709f5.0;i=2'
Via: SIP/2.0/TCP
OUTBOUND_PROXY:9090;branch=z9hG4bK1b8e92e2b075b4fcb9f177ab9ea732ca88ac6221;rport=39080'
Via: SIP/2.0/TCP 192.32.232.12;branch=z9hG4bK3609852;received=PUBLIC_IP'
Max-Forwards: 7'
To: sip:one@mydomain;tag=9y5zyjjrqb'
From: sip:jmillan@mydomain;tag=243wxuykw0'
Call-ID: b9q6ixruxbbt2ej5opqf'
CSeq: 3570 MESSAGE'
Content-Type: text/plain'
User-Agent: JsSIP 0.1.0'
Content-Length: 7'
'
lalaiii
++++
Regards.
when doing jitsi presence tests, i also managed to get kamailio 3.3 to
crash with core dump. events leading to the crash were pua publish via
xmlrpc, which resulted into punch of notifies, some of which sip proxy
failed to deliver due to missing tcp connections.
after generating the notifies, presence server crashed like this:
#0 0x00007fa1e9b17f7b in core_hash () from /usr/lib/pres-serv/modules_k/pua.so
#1 0x00007fa1e9b1933f in publ_cback_func ()
from /usr/lib/pres-serv/modules_k/pua.so
#2 0x00007fa1ee59b907 in run_trans_callbacks_internal ()
from /usr/lib/pres-serv/modules/tm.so
#3 0x00007fa1ee59ba19 in run_trans_callbacks ()
from /usr/lib/pres-serv/modules/tm.so
#4 0x00007fa1ee5c36fa in local_reply () from /usr/lib/pres-serv/modules/tm.so
#5 0x00007fa1ee5c4b30 in reply_received ()
from /usr/lib/pres-serv/modules/tm.so
#6 0x000000000044fee5 in forward_reply ()
#7 0x0000000000489180 in receive_msg ()
#8 0x0000000000501a8c in receive_tcp_msg ()
#9 0x0000000000502740 in tcp_read_req ()
#10 0x0000000000503759 in handle_io ()
#11 0x00000000004fe363 in io_wait_loop_epoll ()
#12 0x0000000000504431 in tcp_receive_loop ()
#13 0x00000000004f9920 in tcp_init_children ()
#14 0x000000000045c9fb in main_loop ()
#15 0x000000000045f29c in main ()
it would be nice to get this fixed before 3.3 release.
-- juha
Module: sip-router
Branch: 3.3
Commit: 3a32ca895bf326bf16454705a294d17bd6a2f539
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=3a32ca8…
Author: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Date: Thu Jun 14 17:41:49 2012 +0100
modules_k/pua: send_publish() doesn't work correctly in DB only mode with certain DBs
- The pua record wasn't getting inserted in some cases
- Looks like I removed a couple of lines I shouldn't have when merging
from Crocodile's internal SVN repository to git
- Issue found by Hugh Waite @ Crocodile RCS and fixed by Hugh Waite and
Peter Dunkley @ Crocodile RCS
(cherry picked from commit 78da4d35dfceaa3d167d2b5ad66f1a27bc0f4628)
---
modules_k/pua/pua_db.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/modules_k/pua/pua_db.c b/modules_k/pua/pua_db.c
index c064c25..05dd1e3 100644
--- a/modules_k/pua/pua_db.c
+++ b/modules_k/pua/pua_db.c
@@ -989,6 +989,9 @@ int update_record_puadb(ua_pres_t *pres, int expires, str *etag)
return -1;
}
+ if (pua_dbf.affected_rows != NULL)
+ return pua_dbf.affected_rows(pua_db);
+
return 1;
}
Module: sip-router
Branch: master
Commit: 78da4d35dfceaa3d167d2b5ad66f1a27bc0f4628
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=78da4d3…
Author: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Date: Thu Jun 14 17:41:49 2012 +0100
modules_k/pua: send_publish() doesn't work correctly in DB only mode with certain DBs
- The pua record wasn't getting inserted in some cases
- Looks like I removed a couple of lines I shouldn't have when merging
from Crocodile's internal SVN repository to git
- Issue found by Hugh Waite @ Crocodile RCS and fixed by Hugh Waite and
Peter Dunkley @ Crocodile RCS
---
modules_k/pua/pua_db.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/modules_k/pua/pua_db.c b/modules_k/pua/pua_db.c
index c064c25..05dd1e3 100644
--- a/modules_k/pua/pua_db.c
+++ b/modules_k/pua/pua_db.c
@@ -989,6 +989,9 @@ int update_record_puadb(ua_pres_t *pres, int expires, str *etag)
return -1;
}
+ if (pua_dbf.affected_rows != NULL)
+ return pua_dbf.affected_rows(pua_db);
+
return 1;
}
Hello,
str_str function searches for a substring into a bigger string.
str_str function in lib/cds/sstr.c file has a comment: /* FIXME:
reimplement using better algorithm */
Attached patch reimplements that function using
Boyer-Moore-Horspool-Raita algorithm, which is the one most text editors
use to search for substrings.
Boyer-Moore-Horspool-Raita algorithm is a simplification from
Boyer-Moore one, with less preprocessing overhead.
If n is the string length, and m is substring length, naive brute force
algorithm has a cost of O(n*m).
Raita algoritm has same cost in worst case but Ω(n/m) a better average cost.
As a drawback it adds a preprocessing cost of O(m + charset_length)
where charset_length is 256 for us, because we use char.
Another way to approach this substring search issue would be separate it
into two functions, a preprocessing one, and a searching one. Then in
module initializacion where the function is used, calculate the needed
preprocess and when the function is called do the search only.
This Raita algorithm could also be useful for str_search function in
ut.c. Its usefulness depends on n, and m lengths, the bigger they are
the better the algoritm works.
http://en.wikipedia.org/wiki/String_searching_algorithmhttp://en.wikipedia.org/wiki/Boyer%E2%80%93Moore%E2%80%93Horspool_algorithmhttp://www-igm.univ-mlv.fr/~lecroq/string/node22.html
Regards,
Vicente.