aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authorjpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b>2010-10-01 16:20:00 +0000
committerjpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b>2010-10-01 16:20:00 +0000
commit122d3ef983e5a4e5336cd261982025bd574e3425 (patch)
treefeb0e57d7f183f09362a2f3aa1902848dbcd48df /channels
parent001f39e727e6649cae32ddbeb0facfeb1d0308a5 (diff)
Ensure user portion of SIP URI matches dialplan when using encoded characters.
This commit takes a simliar approach to 288112 and checks the dialplan to determine the proper action for an incoming contact header as to whether or not it should be decoded or not. sip_new was blindly always decoding the extension, which also caused the outgoing contact header to be incorrect as well as failing to match the encoded extension in the dialplan. (closes issue #17892) Reported by: wdoekes Patches: bug17892-1.patch uploaded by jpeeler (license 325) Tested by: wdoekes git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@289699 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 18db5ca5d..843fa2dd6 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -4443,9 +4443,14 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit
* we should decode the uri before storing it in the channel, but leave it encoded in the sip_pvt
* structure so that there aren't issues when forming URI's
*/
- decoded_exten = ast_strdupa(i->exten);
- ast_uri_decode(decoded_exten);
- ast_copy_string(tmp->exten, decoded_exten, sizeof(tmp->exten));
+ if (ast_exists_extension(NULL, i->context, i->exten, 1, i->cid_num)) {
+ /* encoded in dialplan, so keep extension encoded */
+ ast_copy_string(tmp->exten, i->exten, sizeof(tmp->exten));
+ } else {
+ decoded_exten = ast_strdupa(i->exten);
+ ast_uri_decode(decoded_exten);
+ ast_copy_string(tmp->exten, decoded_exten, sizeof(tmp->exten));
+ }
/* Don't use ast_set_callerid() here because it will
* generate an unnecessary NewCallerID event */