Module: sip-router
Branch: master
Commit: 4e4b1339bfd3a832f5feeb1d2a2380c7455ec82b
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4e4b1339bfd3a832f5feeb1d2a2380c7455ec82b

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date:   Thu Apr 25 14:50:40 2013 +0200

tm: add angle brackets around From/To URI for local generated requests

- safer for special cases of URI format

---

 modules/tm/t_msgbuilder.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/modules/tm/t_msgbuilder.c b/modules/tm/t_msgbuilder.c
index aa0144c..b5ff309 100644
--- a/modules/tm/t_msgbuilder.c
+++ b/modules/tm/t_msgbuilder.c
@@ -1401,7 +1401,9 @@ static inline char* print_to(char* w, dlg_t* dialog, 
struct cell* t)
        t->to.len = TO_LEN + dialog->rem_uri.len + CRLF_LEN;
 
        memapp(w, TO, TO_LEN);
+       if(dialog->rem_uri.s[0]!='<') memapp(w, "<", 1);
        memapp(w, dialog->rem_uri.s, dialog->rem_uri.len);
+       if(dialog->rem_uri.s[0]!='<') memapp(w, ">", 1);
 
        if (dialog->id.rem_tag.len) {
                t->to.len += TOTAG_LEN + dialog->id.rem_tag.len ;
@@ -1423,7 +1425,9 @@ static inline char* print_from(char* w, dlg_t* dialog, 
struct cell* t)
        t->from.len = FROM_LEN + dialog->loc_uri.len + CRLF_LEN;
 
        memapp(w, FROM, FROM_LEN);
+       if(dialog->loc_uri.s[0]!='<') memapp(w, "<", 1);
        memapp(w, dialog->loc_uri.s, dialog->loc_uri.len);
+       if(dialog->loc_uri.s[0]!='<') memapp(w, ">", 1);
 
        if (dialog->id.loc_tag.len) {
                t->from.len += FROMTAG_LEN + dialog->id.loc_tag.len;
@@ -1544,8 +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 < > */
        *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 < > */
        *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 */


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to