Fix the parsing of the "reason" parameter in the
authorMark Michelson <mmichelson@digium.com>
Wed, 30 Jul 2008 20:24:40 +0000 (20:24 +0000)
committerMark Michelson <mmichelson@digium.com>
Wed, 30 Jul 2008 20:24:40 +0000 (20:24 +0000)
Diversion: header.

(closes issue #13195)
Reported by: woodsfsg

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@134556 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index af353db..9d2564d 100644 (file)
@@ -11006,6 +11006,8 @@ static int get_rdnis(struct sip_pvt *p, struct sip_request *oreq)
        if (ast_strlen_zero(tmp))
                return 0;
 
+       params = strchr(tmp, ';');
+
        exten = get_in_brackets(tmp);
        if (!strncasecmp(exten, "sip:", 4)) {
                exten += 4;
@@ -11017,7 +11019,7 @@ static int get_rdnis(struct sip_pvt *p, struct sip_request *oreq)
        }
 
        /* Get diversion-reason param if present */
-       if ((params = strchr(tmp, ';'))) {
+       if (params) {
                *params = '\0'; /* Cut off parameters  */
                params++;
                while (*params == ';' || *params == ' ')