From 28cbf8801cc42d61b3fd3a9c74fe8b68db42106b Mon Sep 17 00:00:00 2001 From: Matthew Nicholson Date: Tue, 18 Jan 2011 21:40:03 +0000 Subject: [PATCH] Merged revisions 302311 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r302311 | mnicholson | 2011-01-18 15:35:03 -0600 (Tue, 18 Jan 2011) | 4 lines URI encode the user part of the contact header. ABE-2705 ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.2@302313 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_sip.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index c1be361e84..27d6e1c620 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -10736,19 +10736,21 @@ static void extract_uri(struct sip_pvt *p, struct sip_request *req) /*! \brief Build contact header - the contact header we send out */ static void build_contact(struct sip_pvt *p) { - + char tmp[SIPBUFSIZE]; + char *user = ast_uri_encode(p->exten, tmp, sizeof(tmp), 1); int ourport = ntohs(p->ourip.sin_port); + /* only add port if it's non-standard for the transport type */ if (!sip_standard_port(p->socket.type, ourport)) { if (p->socket.type == SIP_TRANSPORT_UDP) - ast_string_field_build(p, our_contact, "", p->exten, ast_strlen_zero(p->exten) ? "" : "@", ast_inet_ntoa(p->ourip.sin_addr), ourport); + ast_string_field_build(p, our_contact, "", user, ast_strlen_zero(user) ? "" : "@", ast_inet_ntoa(p->ourip.sin_addr), ourport); else - ast_string_field_build(p, our_contact, "", p->exten, ast_strlen_zero(p->exten) ? "" : "@", ast_inet_ntoa(p->ourip.sin_addr), ourport, get_transport(p->socket.type)); + ast_string_field_build(p, our_contact, "", user, ast_strlen_zero(user) ? "" : "@", ast_inet_ntoa(p->ourip.sin_addr), ourport, get_transport(p->socket.type)); } else { if (p->socket.type == SIP_TRANSPORT_UDP) - ast_string_field_build(p, our_contact, "", p->exten, ast_strlen_zero(p->exten) ? "" : "@", ast_inet_ntoa(p->ourip.sin_addr)); + ast_string_field_build(p, our_contact, "", user, ast_strlen_zero(user) ? "" : "@", ast_inet_ntoa(p->ourip.sin_addr)); else - ast_string_field_build(p, our_contact, "", p->exten, ast_strlen_zero(p->exten) ? "" : "@", ast_inet_ntoa(p->ourip.sin_addr), get_transport(p->socket.type)); + ast_string_field_build(p, our_contact, "", user, ast_strlen_zero(user) ? "" : "@", ast_inet_ntoa(p->ourip.sin_addr), get_transport(p->socket.type)); } } -- 2.47.2