Skip to content

Commit 7d9227b

Browse files
committed
tm: If "reply_to_via" is set, send reply to IP/Port indicated in "Via"
1 parent 68f55e1 commit 7d9227b

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

modules/tm/t_lookup.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,20 @@ int init_rb( struct retr_buf *rb, struct sip_msg *msg)
942942
{
943943
int proto;
944944

945-
update_sock_struct_from_ip( &rb->dst.to, msg );
945+
if (!reply_to_via) {
946+
update_sock_struct_from_ip( &rb->dst.to, msg );
947+
proto=msg->rcv.proto;
948+
} else {
949+
/*init retrans buffer*/
950+
if (update_sock_struct_from_via( &(rb->dst.to), msg, msg->via1 )==-1) {
951+
LM_ERR("cannot lookup reply dst: %.*s\n",
952+
msg->via1->host.len, msg->via1->host.s );
953+
ser_error=E_BAD_VIA;
954+
return 0;
955+
}
956+
proto=msg->via1->proto;
957+
}
958+
946959
proto=msg->rcv.proto;
947960
rb->dst.proto=proto;
948961
rb->dst.proto_reserved1=msg->rcv.proto_reserved1;

0 commit comments

Comments
 (0)