mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-24 05:38:11 +00:00
Quit early and print a LOG_WARNING if we are trying to check devicestate on a Local channel that's been improperly defined.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@34463 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -126,16 +126,23 @@ static int local_devicestate(void *data)
|
|||||||
int res;
|
int res;
|
||||||
|
|
||||||
exten = ast_strdupa(data);
|
exten = ast_strdupa(data);
|
||||||
if ((context = strchr(exten, '@'))) {
|
context = strchr(exten, '@');
|
||||||
*context = '\0';
|
|
||||||
context = context + 1;
|
if (!context) {
|
||||||
|
ast_log(LOG_WARNING, "Someone used Local/%s somewhere without a @context. This is bad.\n", exten);
|
||||||
|
return AST_DEVICE_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*context = '\0';
|
||||||
|
context = context + 1;
|
||||||
|
|
||||||
if (option_debug > 2)
|
if (option_debug > 2)
|
||||||
ast_log(LOG_DEBUG, "Checking if extension %s@%s exists (devicestate)\n", exten, context);
|
ast_log(LOG_DEBUG, "Checking if extension %s@%s exists (devicestate)\n", exten, context);
|
||||||
res = ast_exists_extension(NULL, context, exten, 1, NULL);
|
res = ast_exists_extension(NULL, context, exten, 1, NULL);
|
||||||
if (!res)
|
if (!res) {
|
||||||
|
|
||||||
return AST_DEVICE_INVALID;
|
return AST_DEVICE_INVALID;
|
||||||
else
|
} else
|
||||||
return AST_DEVICE_UNKNOWN;
|
return AST_DEVICE_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user