below is patch that fixes receiced param value. i have not tested if
kamalio that gets such a value is able to unescape the escaped chars.
if not, that is a bug too.
-- juha
*** path.c Fri Mar 29 19:14:46 2013
--- /usr/src/sip-router/modules/path/path.c Wed Apr 10 08:09:43 2013
***************
*** 145,171 ****
if (param == PATH_PARAM_RECEIVED) {
/* TODO: agranig: optimize this one! */
src_ip = ip_addr2a(&_m->rcv.src_ip);
! rcv_addr.s = pkg_malloc(6 + IP_ADDR_MAX_STR_SIZE + 22); /*
'sip:<ip>:<port>;transport=sctp'\0 */
if(!rcv_addr.s) {
LM_ERR("no pkg memory left for receive-address\n");
goto out3;
}
switch (_m->rcv.proto) {
case PROTO_UDP:
! rcv_addr.len = snprintf(rcv_addr.s, 6 + IP_ADDR_MAX_STR_SIZE + 6,
"'sip:%s:%u'", src_ip, _m->rcv.src_port);
break;
case PROTO_TCP:
! rcv_addr.len = snprintf(rcv_addr.s, 6 + IP_ADDR_MAX_STR_SIZE + 20,
"'sip:%s:%u;transport=tcp'", src_ip, _m->rcv.src_port);
break;
case PROTO_TLS:
! rcv_addr.len = snprintf(rcv_addr.s, 6 + IP_ADDR_MAX_STR_SIZE + 20,
"'sip:%s:%u;transport=tls'", src_ip, _m->rcv.src_port);
break;
case PROTO_SCTP:
! rcv_addr.len = snprintf(rcv_addr.s, 6 + IP_ADDR_MAX_STR_SIZE + 21,
"'sip:%s:%u;transport=sctp'", src_ip, _m->rcv.src_port);
break;
case PROTO_WS:
case PROTO_WSS:
! rcv_addr.len = snprintf(rcv_addr.s, 6 + IP_ADDR_MAX_STR_SIZE + 19,
"'sip:%s:%u;transport=ws'", src_ip, _m->rcv.src_port);
break;
}
--- 145,171 ----
if (param == PATH_PARAM_RECEIVED) {
/* TODO: agranig: optimize this one! */
src_ip = ip_addr2a(&_m->rcv.src_ip);
! rcv_addr.s = pkg_malloc(6 + IP_ADDR_MAX_STR_SIZE + 24); /*
sip:<ip>:<port>%3Btransport%3Dsctp\0 */
if(!rcv_addr.s) {
LM_ERR("no pkg memory left for receive-address\n");
goto out3;
}
switch (_m->rcv.proto) {
case PROTO_UDP:
! rcv_addr.len = snprintf(rcv_addr.s, 6 + IP_ADDR_MAX_STR_SIZE + 4,
"sip:%s:%u", src_ip, _m->rcv.src_port);
break;
case PROTO_TCP:
! rcv_addr.len = snprintf(rcv_addr.s, 6 + IP_ADDR_MAX_STR_SIZE + 22,
"sip:%s:%u%%3Btransport%%3Dtcp", src_ip, _m->rcv.src_port);
break;
case PROTO_TLS:
! rcv_addr.len = snprintf(rcv_addr.s, 6 + IP_ADDR_MAX_STR_SIZE + 22,
"sip:%s:%u%%3Btransport%%3Dtls", src_ip, _m->rcv.src_port);
break;
case PROTO_SCTP:
! rcv_addr.len = snprintf(rcv_addr.s, 6 + IP_ADDR_MAX_STR_SIZE + 23,
"sip:%s:%u%%3Btransport%%3Dsctp", src_ip, _m->rcv.src_port);
break;
case PROTO_WS:
case PROTO_WSS:
! rcv_addr.len = snprintf(rcv_addr.s, 6 + IP_ADDR_MAX_STR_SIZE + 21,
"sip:%s:%u%%3Btransport%%3Dws", src_ip, _m->rcv.src_port);
break;
}