[asterisk-commits] mnicholson: branch 1.4 r302311 - /branches/1.4/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 18 15:35:08 CST 2011


Author: mnicholson
Date: Tue Jan 18 15:35:03 2011
New Revision: 302311

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=302311
Log:
URI encode the user part of the contact header.

ABE-2705

Modified:
    branches/1.4/channels/chan_sip.c

Modified: branches/1.4/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=302311&r1=302310&r2=302311
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Tue Jan 18 15:35:03 2011
@@ -7521,11 +7521,16 @@
 /*! \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, "<sip:%s%s%s:%d>", p->exten, ast_strlen_zero(p->exten) ? "" : "@", ast_inet_ntoa(p->ourip), ourport);
+		ast_string_field_build(p, our_contact, "<sip:%s%s%s:%d>", user, ast_strlen_zero(user) ? "" : "@", ast_inet_ntoa(p->ourip), ourport);
 	else
-		ast_string_field_build(p, our_contact, "<sip:%s%s%s>", p->exten, ast_strlen_zero(p->exten) ? "" : "@", ast_inet_ntoa(p->ourip));
+		ast_string_field_build(p, our_contact, "<sip:%s%s%s>", user, ast_strlen_zero(user) ? "" : "@", ast_inet_ntoa(p->ourip));
 }
 
 /*! \brief Build the Remote Party-ID & From using callingpres options */




More information about the asterisk-commits mailing list