Module: sip-router
Branch: master
Commit: 66f80a68a48835b1634da04ead4deadeb89ce7f7
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=66f80a6…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Fri Feb 4 19:27:10 2011 +0100
topoh: add angle brackets around contact uri
- if there are no angle brackets around initial contact uri, add for
encoded uri to keep URI parameters properly
---
modules/topoh/th_msg.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/modules/topoh/th_msg.c b/modules/topoh/th_msg.c
index a721141..df29ea1 100644
--- a/modules/topoh/th_msg.c
+++ b/modules/topoh/th_msg.c
@@ -247,6 +247,7 @@ int th_mask_contact(sip_msg_t *msg)
struct lump* l;
str out;
str in;
+ char *p;
contact_t *c;
if(msg->contact==NULL)
@@ -270,6 +271,24 @@ int th_mask_contact(sip_msg_t *msg)
LM_ERR("cannot encode contact uri\n");
return -1;
}
+ if(*(in.s-1)!='<')
+ {
+ /* add < > around contact uri if not there */
+ p = (char*)pkg_malloc(out.len+3);
+ if(p==NULL)
+ {
+ LM_ERR("failed to get more pkg\n");
+ pkg_free(out.s);
+ return -1;
+ }
+ *p = '<';
+ strncpy(p+1, out.s, out.len);
+ p[out.len+1] = '>';
+ p[out.len+2] = '\0';
+ pkg_free(out.s);
+ out.s = p;
+ out.len += 2;
+ }
l=del_lump(msg, in.s-msg->buf, in.len, 0);
if (l==0)