]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
For consistency sake, ensure that the values that ${CALLINGPRES} returns are valid...
authorTilghman Lesher <tilghman@meg.abyt.es>
Fri, 18 Apr 2008 06:49:16 +0000 (06:49 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Fri, 18 Apr 2008 06:49:16 +0000 (06:49 +0000)
input to SetCallingPres.  (Closes issue #12472)

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

apps/app_setcallerid.c

index 4456e1ee02fe003ee2fb60a18defdb0b2a1ce5aa..fb060f11b0eff645f5912eaea0a60d42df626ab9 100644 (file)
@@ -70,8 +70,11 @@ static int setcallerid_pres_exec(struct ast_channel *chan, void *data)
        int pres = -1;
 
        u = ast_module_user_add(chan);
-       
-       pres = ast_parse_caller_presentation(data);
+
+       /* For interface consistency, permit the argument to be specified as a number */
+       if (sscanf(data, "%d", &pres) != 1 || pres < 0 || pres > 255 || (pres & 0x9c)) {
+               pres = ast_parse_caller_presentation(data);
+       }
 
        if (pres < 0) {
                ast_log(LOG_WARNING, "'%s' is not a valid presentation (see 'show application SetCallerPres')\n",