Hi Julien
I believe to have located the problem an wrote a patch (against the
current debian stable) to circumvent it:
- The Route HF is inserted after the last Via HF,
which means right before the From HF (in my case)
- If I also change the From HF, I run into the known limitation of
OpenSER 'changing a HF twice gets unpredictable results' (lump stuff).
It looks like that changing a HF and inserting a HF right before the
changed one, ends up in same case as changing the HF twice.
- To circumvent the problem I rewrote the file
openser/branches/1.1/modules/tm/path.c
in such a way, that the Route HF is (if no Route HF present yet) always
inserted right before the Call-ID HF, as the Call-ID MUST NOT be changed
(unless you are a B2BUA).
If there is no Call-ID HF, an error is returned.
(This means I presume, that Call-ID must be present and not be changed)
Please find the patch in the attachment.
I have tested it on my system and it apprears to work fine.
cheers,
Bernie
Bernie Hoeneisen <[EMAIL PROTECTED]> wrote:
Hi,
Thus, it seems that calling the subst() function before the
(Path-info) Route HF is inserted causes the problem.
Thanks for the testing, I'll watch for the bug upstream.
I imagine you can't test openser 1.2 ?
JB.
--
Julien BLACHE <[EMAIL PROTECTED]> | Debian, because code matters more
Debian & GNU/Linux Developer | <http://www.debian.org>
Public key available on <http://www.jblache.org> - KeyID: F5D6 5169
GPG Fingerprint : 935A 79F1 C8B3 3521 FD62 7CC7 CD61 4FD7 F5D6 5169
diff -r -u openser-1.1.0/debian/changelog openser-1.1.0.new/debian/changelog
--- openser-1.1.0/debian/changelog 2007-05-19 14:03:16.000000000 +0200
+++ openser-1.1.0.new/debian/changelog 2007-05-19 12:19:22.000000000 +0200
@@ -1,3 +1,9 @@
+openser (1.1.0-9etch1-1) stable; urgency=low
+
+ * Workaround for problem with (Path-)Route HF insertion
+
+ -- Bernie Hoeneisen <[EMAIL PROTECTED]> Sat, 19 May 2007 12:18:57 +0200
+
openser (1.1.0-9etch1) testing-proposed-updates; urgency=low
* Security fixes for Etch (closes: #412904).
diff -r -u openser-1.1.0/modules/tm/path.c openser-1.1.0.new/modules/tm/path.c
--- openser-1.1.0/modules/tm/path.c 2006-01-30 17:37:30.000000000 +0100
+++ openser-1.1.0.new/modules/tm/path.c 2007-05-19 12:42:56.000000000 +0200
@@ -34,36 +34,32 @@
* Save given Path body as Route header in message.
*
* If another Route HF is found, it's placed right before that.
- * Otherwise, it's placed after the last Via HF. If also no
- * Via HF is found, it's placed as first HF.
+ * Otherwise, it's placed before the Call-ID HF. If also no
+ * Call-ID HF is found, it will return an Error.
*/
int insert_path_as_route(struct sip_msg* msg, str* path)
{
struct lump *anchor;
char *route;
- struct hdr_field *hf, *last_via=0;
+ struct hdr_field *hf, *callid=0;
for (hf = msg->headers; hf; hf = hf->next) {
if (hf->type == HDR_ROUTE_T) {
break;
- } else if (hf->type == HDR_VIA_T) {
- last_via = hf;
+ } else if (hf->type == HDR_CALLID_T) {
+ callid = hf;
}
}
if (hf) {
/* Route HF found, insert before it */
anchor = anchor_lump(msg, hf->name.s - msg->buf, 0, 0);
- } else if(last_via) {
- if (last_via->next) {
- /* Via HF in between, insert after it */
- anchor = anchor_lump(msg, last_via->next->name.s - msg->buf, 0, 0);
- } else {
- /* Via HF is last, so append */
- anchor = anchor_lump(msg, msg->unparsed - msg->buf, 0, 0);
- }
+ } else if(callid) {
+ /* Call-ID HF found, insert before it */
+ anchor = anchor_lump(msg, callid->name.s - msg->buf, 0, 0);
} else {
- /* None of the above, insert as first */
- anchor = anchor_lump(msg, msg->headers->name.s - msg->buf, 0, 0);
+ /* None of the above */
+ LOG(L_ERR, "ERROR: insert_path_as_route(): Failed to get anchor. No Call-ID HF found\n");
+ return -1;
}
if (anchor == 0) {
Only in openser-1.1.0.new/utils/openserunix: openserunix.d