diff options
author | mnicholson <mnicholson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2011-01-18 21:35:03 +0000 |
---|---|---|
committer | mnicholson <mnicholson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2011-01-18 21:35:03 +0000 |
commit | 2e99b7fded410427fa1d2fdb3093aa301c7c01b2 (patch) | |
tree | ab7ede1f91cd01d5fd0e0fecb30f5c734d0f3d7f /channels/chan_sip.c | |
parent | 7235b572d6fd1f06dc7ea6fa597660c783d579fa (diff) |
URI encode the user part of the contact header.
ABE-2705
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@302311 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r-- | channels/chan_sip.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 4ec0a5176..374af6174 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, "<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 */ |