]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
func_presencestate: Return "not_set" when no data is set in AstDB 10/1410/1
authorIvan Poddubny <ivan.poddubny@gmail.com>
Wed, 7 Oct 2015 06:24:31 +0000 (09:24 +0300)
committerIvan Poddubny <ivan.poddubny@gmail.com>
Wed, 7 Oct 2015 06:47:34 +0000 (01:47 -0500)
Return AST_PRESENCE_NOT_SET when CustomPresence AstDB key does not
exist, i.e. when a new CustomPresence is added in the dialplan.

ASTERISK-25400 #close
Reported by: Andrew Nagy

Change-Id: I6fb17b16591b5a55fbffe96f3994ec26b1b1723a

funcs/func_presencestate.c

index d57b8e30cb281ff42e2413813671f6fe3ac4c4c9..e37e8c60d3ac95625f9459565cc238ef0c2607b2 100644 (file)
@@ -243,7 +243,9 @@ static enum ast_presence_state custom_presence_callback(const char *data, char *
        char *_message;
        char *_subtype;
 
-       ast_db_get(astdb_family, data, buf, sizeof(buf));
+       if (ast_db_get(astdb_family, data, buf, sizeof(buf))) {
+               return AST_PRESENCE_NOT_SET;
+       }
 
        if (parse_data(buf, &state, &_subtype, &_message, &_options)) {
                return AST_PRESENCE_INVALID;