]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 289700 via svnmerge from
authorJeff Peeler <jpeeler@digium.com>
Fri, 1 Oct 2010 16:22:19 +0000 (16:22 +0000)
committerJeff Peeler <jpeeler@digium.com>
Fri, 1 Oct 2010 16:22:19 +0000 (16:22 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.6.2

................
  r289700 | jpeeler | 2010-10-01 11:21:04 -0500 (Fri, 01 Oct 2010) | 21 lines

  Merged revisions 289699 via svnmerge from
  https://origsvn.digium.com/svn/asterisk/branches/1.4

  ........
    r289699 | jpeeler | 2010-10-01 11:20:00 -0500 (Fri, 01 Oct 2010) | 14 lines

    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: https://origsvn.digium.com/svn/asterisk/branches/1.8@289701 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index f2b29897b4499a867c4df3d9e7cf298eae0ecafa..80a215cc3d1e48becb99ce37a8e082dc530084cb 100644 (file)
@@ -6613,9 +6613,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  */