From f9ab6f1c9c4134b9348a50412f3b87b29366c7d9 Mon Sep 17 00:00:00 2001 From: Maximilian Fridrich Date: Thu, 30 Nov 2023 09:33:28 +0100 Subject: [PATCH] qualify: fix OPTIONS peer URI for IPv6 (#38) --- modules/qualify/qualify.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/qualify/qualify.c b/modules/qualify/qualify.c index b0f9d00..887190c 100644 --- a/modules/qualify/qualify.c +++ b/modules/qualify/qualify.c @@ -187,8 +187,13 @@ static int call_start_qualify(struct call *call, } (void)call_msg_src(call, &peer_addr); - err = re_snprintf(peer_uri, sizeof(peer_uri), "sip:%H:%d", - sa_print_addr, &peer_addr, sa_port(&peer_addr)); + + err = re_snprintf(peer_uri, sizeof(peer_uri), + "sip:%s%j%s:%d", + sa_af(&peer_addr) == AF_INET6 ? "[" : "", + &peer_addr, + sa_af(&peer_addr) == AF_INET6 ? "]" : "", + sa_port(&peer_addr)); if (err <= 0) { warning("qualify: failed to get peer URI for %s (%m)\n",