michael@377: Index: modules/registrar/save.c michael@377: diff -Nau modules/registrar/save.c.orig modules/registrar/save.c michael@377: --- modules/registrar/save.c.orig 2008-03-07 14:12:56.307895000 +0100 michael@377: +++ modules/registrar/save.c 2008-03-08 00:03:02.436987000 +0100 michael@377: @@ -51,6 +51,7 @@ michael@377: #include "../../ut.h" michael@377: #include "../../qvalue.h" michael@377: #include "../../dset.h" michael@377: +#include "../../msg_translator.h" michael@377: #ifdef USE_TCP michael@377: #include "../../tcp_server.h" michael@377: #endif michael@377: @@ -687,9 +688,28 @@ michael@377: contact_t* c; michael@377: int st; michael@377: str aor; michael@377: + unsigned int new_len = 0; michael@377: + struct sip_msg* sip_manip = 0; michael@377: michael@377: rerrno = R_FINE; michael@377: michael@377: + /* make a cheap shallow copy of the incoming message */ michael@377: + sip_manip = (void*)pkg_malloc(sizeof(struct sip_msg)); michael@377: + if (sip_manip==0) { michael@377: + LM_ERR("no more pkg memory\n"); michael@377: + goto error; michael@377: + } michael@377: + memcpy(sip_manip,_m,sizeof(struct sip_msg)); michael@377: + michael@377: + /* incorporate changes made to the routing script so far, */ michael@377: + /* this mean that the so called 'lumps' will be processed */ michael@377: + sip_manip->buf = build_res_buf_from_sip_res(_m, &new_len); michael@377: + sip_manip->len = new_len; michael@377: + michael@377: + /* from here on, use the new refreshed message data as */ michael@377: + /* specifically manipulated according to the user's wish */ michael@377: + _m = sip_manip; /* only safe when passing by value */ michael@377: + michael@377: if (parse_message(_m) < 0) { michael@377: goto error; michael@377: } michael@377: Don't forget to free(3) the pkg_alloc(3) memory!!!