On Tuesday 12 August 2008, Carsten Bock wrote:
Let me double check this. In our setup, this works
properly (or at least
no problem known); and the from headers in the reply is right as well.
One difference may be, that we use uac_replace_from purely in
branch_route() and not in the request route itself.
It's what I do now.
I can double check your problem tomorrow (i'm not
at the office today)
and, if i find something, update the patch.
It needed an additional patch to make
it set the msg_id to the current
reply_id. I also changed the DBG messages. Patch is against 1.2+svn4682.
See below for the complete working patch.
diff -u openser-1.2-orig/modules/uac/uac.c openser-1.2/modules/uac/uac.c
--- openser-1.2-orig/modules/uac/uac.c 2008-08-12 15:55:12.000000000 +0200
+++ openser-1.2/modules/uac/uac.c 2008-08-12 13:26:27.000000000 +0200
@@ -81,9 +81,9 @@
/* Exported functions */
static cmd_export_t cmds[]={
{"uac_replace_from", w_replace_from2, 2, fixup_replace_from2,
- REQUEST_ROUTE },
+ REQUEST_ROUTE | BRANCH_ROUTE },
{"uac_replace_from", w_replace_from1, 1, fixup_replace_from1,
- REQUEST_ROUTE },
+ REQUEST_ROUTE | BRANCH_ROUTE },
{"uac_restore_from", w_restore_from, 0, 0,
REQUEST_ROUTE },
{"uac_auth", w_uac_auth, 0, 0,
diff -u openser-1.2-orig/modules/uac/from.c openser-1.2/modules/uac/from.c
--- openser-1.2-orig/modules/uac/from.c 2007-10-22 11:48:48.000000000 +0200
+++ openser-1.2/modules/uac/from.c 2008-08-12 15:56:42.000000000 +0200
@@ -61,6 +61,8 @@
#define text3B64_len(_l) ( ( ((_l)+2)/3 ) << 2 )
+/* The reply, were the From-Line was replaced. */
+static unsigned int msg_id = 0;
void init_from_replacer()
{
@@ -564,6 +566,12 @@
"FROM hdr\n");
return;
}
+
+ DBG("DBG:uac::restore_from_reply: current id = %d, code %d (last id
%d)\n", rpl->id, p->code, msg_id);
+ if (msg_id == rpl->id) {
+ DBG("DBG:uac::restore_from_reply: No change, already done!\n");
+ return;
+ }
/* duplicate the new from value */
new_val.s = pkg_malloc( req->from->len );
@@ -589,6 +597,9 @@
LOG(L_ERR,"ERROR:uac:restore_from_reply: insert new lump
failed\n");
return;
}
+
+ /* Mark this id as replied to prevent multiple From headers in replies */
+ msg_id = rpl->id;
}
--
Met vriendelijke groet,
Alex Hermann
SpeakUp
T: 088-SPEAKUP (088-7732587)
F: 088-7732588