Module: kamailio Branch: master Commit: 6fc84ad9efe4962cc7668851f7ca61cfcc25675f URL: https://github.com/kamailio/kamailio/commit/6fc84ad9efe4962cc7668851f7ca61cf...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: GitHub noreply@github.com Date: 2017-11-17T13:07:56+01:00
Merge pull request #1319 from surendratiwari3/nat_traversal_ipv6_contact
nat_traversal: fixing ipv6 contact for fix_contact function in cfg.
---
Modified: src/modules/nat_traversal/nat_traversal.c
---
Diff: https://github.com/kamailio/kamailio/commit/6fc84ad9efe4962cc7668851f7ca61cf... Patch: https://github.com/kamailio/kamailio/commit/6fc84ad9efe4962cc7668851f7ca61cf...
---
diff --git a/src/modules/nat_traversal/nat_traversal.c b/src/modules/nat_traversal/nat_traversal.c index d3c6c95057..ae38d7653b 100644 --- a/src/modules/nat_traversal/nat_traversal.c +++ b/src/modules/nat_traversal/nat_traversal.c @@ -1478,8 +1478,16 @@ FixContact(struct sip_msg *msg) return -1; }
- len = sprintf(buf, "%.*s%s:%d%.*s", before_host.len, before_host.s, - newip.s, newport, after.len, after.s); + if (msg->rcv.src_ip.af==AF_INET6) + { + len = sprintf(buf, "%.*s[%s]:%d%.*s", before_host.len, before_host.s, + newip.s, newport, after.len, after.s); + } + else + { + len = sprintf(buf, "%.*s%s:%d%.*s", before_host.len, before_host.s, + newip.s, newport, after.len, after.s); + }
if (insert_new_lump_after(anchor, buf, len, (enum _hdr_types_t)HDR_CONTACT_F) == 0) { pkg_free(buf);