Module: kamailio Branch: master Commit: dfb34a6516e358023543f2a30664d30ed723e934 URL: https://github.com/kamailio/kamailio/commit/dfb34a6516e358023543f2a30664d30e...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2015-01-06T23:41:59+01:00
core: use Sia header name instead of Via for HTTP responses sent out
---
Modified: msg_translator.c
---
Diff: https://github.com/kamailio/kamailio/commit/dfb34a6516e358023543f2a30664d30e... Patch: https://github.com/kamailio/kamailio/commit/dfb34a6516e358023543f2a30664d30e...
---
diff --git a/msg_translator.c b/msg_translator.c index 5e6bb24..5afb739 100644 --- a/msg_translator.c +++ b/msg_translator.c @@ -2281,6 +2281,8 @@ char * build_res_buf_from_sip_req( unsigned int code, str *text ,str *new_tag, char *after_body; str to_tag; char *totags; + int httpreq; + char *pvia;
body = 0; buf=0; @@ -2302,6 +2304,8 @@ char * build_res_buf_from_sip_req( unsigned int code, str *text ,str *new_tag, /*computes the length of the new response buffer*/ len = 0;
+ httpreq = IS_HTTP(msg); + /* check if received needs to be added */ if (received_test(msg)) { if ((received_buf=received_builder(msg,&received_len))==0) { @@ -2410,6 +2414,8 @@ char * build_res_buf_from_sip_req( unsigned int code, str *text ,str *new_tag, switch (hdr->type) { case HDR_VIA_T: + /* if is HTTP, backup start of Via header in response */ + if(unlikely(httpreq)) pvia = p; if (hdr==msg->h_via1){ if (rport_buf){ if (msg->via1->rport){ /* delete the old one */ @@ -2443,6 +2449,10 @@ char * build_res_buf_from_sip_req( unsigned int code, str *text ,str *new_tag, (hdr->body.s+hdr->body.len)-hdr->name.s, msg); } append_str( p, CRLF,CRLF_LEN); + /* if is HTTP, replace Via with Sia + * - HTTP Via format is different than SIP Via + */ + if(unlikely(httpreq)) *pvia = 'S'; break; case HDR_RECORDROUTE_T: /* RR only for 1xx and 2xx replies */