From: Matthew Nicholson Date: Tue, 18 Jan 2011 21:35:03 +0000 (+0000) Subject: URI encode the user part of the contact header. X-Git-Tag: 1.4.41-rc1~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b53679ab6ab4a027053fca3b938580ab1412ffa1;p=thirdparty%2Fasterisk.git URI encode the user part of the contact header. ABE-2705 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@302311 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 4ec0a51765..374af61740 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -7521,11 +7521,16 @@ 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; + + user = ast_uri_encode(p->exten, tmp, sizeof(tmp), 1); + /* Construct Contact: header */ if (ourport != STANDARD_SIP_PORT) - ast_string_field_build(p, our_contact, "", p->exten, ast_strlen_zero(p->exten) ? "" : "@", ast_inet_ntoa(p->ourip), ourport); + ast_string_field_build(p, our_contact, "", user, ast_strlen_zero(user) ? "" : "@", ast_inet_ntoa(p->ourip), ourport); else - ast_string_field_build(p, our_contact, "", p->exten, ast_strlen_zero(p->exten) ? "" : "@", ast_inet_ntoa(p->ourip)); + ast_string_field_build(p, our_contact, "", user, ast_strlen_zero(user) ? "" : "@", ast_inet_ntoa(p->ourip)); } /*! \brief Build the Remote Party-ID & From using callingpres options */