Module: sip-router
Branch: master
Commit: fb0cd1cd6a891ab5dc5f559bb6740ba62ac3daf4
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=fb0cd1c…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Mon Sep 22 22:21:33 2014 +0200
tm: test ending angle bracket for From/To URI when genrating local requests
- the value can start with a display name and can end up with double
angle bracketting
---
modules/tm/t_msgbuilder.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/modules/tm/t_msgbuilder.c b/modules/tm/t_msgbuilder.c
index 273cbae..a1890c8 100644
--- a/modules/tm/t_msgbuilder.c
+++ b/modules/tm/t_msgbuilder.c
@@ -1397,12 +1397,12 @@ static inline char* print_to(char* w, dlg_t* dialog, struct cell*
t)
{
t->to.s = w;
t->to.len = TO_LEN + dialog->rem_uri.len + CRLF_LEN
- + ((dialog->rem_uri.s[0]!='<')?2:0);
+ + (((dialog->rem_uri.s[dialog->rem_uri.len - 1]!='>'))?2:0);
memapp(w, TO, TO_LEN);
- if(dialog->rem_uri.s[0]!='<') memapp(w, "<", 1);
+ if(dialog->rem_uri.s[dialog->rem_uri.len - 1]!='>') memapp(w,
"<", 1);
memapp(w, dialog->rem_uri.s, dialog->rem_uri.len);
- if(dialog->rem_uri.s[0]!='<') memapp(w, ">", 1);
+ if(dialog->rem_uri.s[dialog->rem_uri.len - 1]!='>') memapp(w,
">", 1);
if (dialog->id.rem_tag.len) {
t->to.len += TOTAG_LEN + dialog->id.rem_tag.len ;
@@ -1422,12 +1422,12 @@ static inline char* print_from(char* w, dlg_t* dialog, struct
cell* t)
{
t->from.s = w;
t->from.len = FROM_LEN + dialog->loc_uri.len + CRLF_LEN
- + ((dialog->loc_uri.s[0]!='<')?2:0);
+ + ((dialog->loc_uri.s[dialog->loc_uri.len - 1]!='>')?2:0);
memapp(w, FROM, FROM_LEN);
- if(dialog->loc_uri.s[0]!='<') memapp(w, "<", 1);
+ if(dialog->loc_uri.s[dialog->loc_uri.len - 1]!='>') memapp(w,
"<", 1);
memapp(w, dialog->loc_uri.s, dialog->loc_uri.len);
- if(dialog->loc_uri.s[0]!='<') memapp(w, ">", 1);
+ if(dialog->loc_uri.s[dialog->loc_uri.len - 1]!='>') memapp(w,
">", 1);
if (dialog->id.loc_tag.len) {
t->from.len += FROMTAG_LEN + dialog->id.loc_tag.len;
@@ -1548,10 +1548,10 @@ char* build_uac_req(str* method, str* headers, str* body, dlg_t*
dialog, int bra
*len += TO_LEN + dialog->rem_uri.len
+ (dialog->id.rem_tag.len ? (TOTAG_LEN + dialog->id.rem_tag.len) : 0) + CRLF_LEN;
/* To */
- if(dialog->rem_uri.s[0]!='<') *len += 2; /* To-URI < > */
+ if(dialog->rem_uri.s[dialog->rem_uri.len - 1]!='>') *len += 2; /*
To-URI < > */
*len += FROM_LEN + dialog->loc_uri.len
+ (dialog->id.loc_tag.len ? (FROMTAG_LEN + dialog->id.loc_tag.len) : 0) +
CRLF_LEN; /* From */
- if(dialog->loc_uri.s[0]!='<') *len += 2; /* From-URI < > */
+ if(dialog->loc_uri.s[dialog->loc_uri.len - 1]!='>') *len += 2; /*
From-URI < > */
*len += CALLID_LEN + dialog->id.call_id.len + CRLF_LEN;
/* Call-ID */
*len += CSEQ_LEN + cseq.len + 1 + method->len + CRLF_LEN;
/* CSeq */
*len += calculate_routeset_length(dialog);
/* Route set */