Get the state of a hinted extension for dialplan control. More...
#include "asterisk.h"#include "asterisk/module.h"#include "asterisk/channel.h"#include "asterisk/pbx.h"#include "asterisk/utils.h"#include "asterisk/devicestate.h"
Go to the source code of this file.
Functions | |
| static void | __reg_module (void) |
| static void | __unreg_module (void) |
| static const char * | ast_extstate_str (int state) |
| static int | extstate_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
| static int | load_module (void) |
| static int | unload_module (void) |
Variables | |
| static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Gets an extension's state in the dialplan" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, } |
| static struct ast_module_info * | ast_module_info = &__mod_info |
| static struct ast_custom_function | extstate_function |
Get the state of a hinted extension for dialplan control.
Definition in file func_extstate.c.
| static void __reg_module | ( | void | ) | [static] |
Definition at line 150 of file func_extstate.c.
| static void __unreg_module | ( | void | ) | [static] |
Definition at line 150 of file func_extstate.c.
| static const char* ast_extstate_str | ( | int | state | ) | [static] |
Definition at line 66 of file func_extstate.c.
References AST_EXTENSION_BUSY, AST_EXTENSION_INUSE, AST_EXTENSION_NOT_INUSE, AST_EXTENSION_ONHOLD, AST_EXTENSION_RINGING, and AST_EXTENSION_UNAVAILABLE.
Referenced by extstate_read().
{
const char *res = "UNKNOWN";
switch (state) {
case AST_EXTENSION_NOT_INUSE:
res = "NOT_INUSE";
break;
case AST_EXTENSION_INUSE:
res = "INUSE";
break;
case AST_EXTENSION_BUSY:
res = "BUSY";
break;
case AST_EXTENSION_UNAVAILABLE:
res = "UNAVAILABLE";
break;
case AST_EXTENSION_RINGING:
res = "RINGING";
break;
case AST_EXTENSION_INUSE | AST_EXTENSION_RINGING:
res = "RINGINUSE";
break;
case AST_EXTENSION_INUSE | AST_EXTENSION_ONHOLD:
res = "HOLDINUSE";
break;
case AST_EXTENSION_ONHOLD:
res = "ONHOLD";
break;
}
return res;
}
| static int extstate_read | ( | struct ast_channel * | chan, |
| const char * | cmd, | ||
| char * | data, | ||
| char * | buf, | ||
| size_t | len | ||
| ) | [static] |
Definition at line 100 of file func_extstate.c.
References ast_copy_string(), ast_extension_state(), ast_extstate_str(), ast_log(), ast_strlen_zero(), context, exten, and LOG_WARNING.
{
char *exten, *context;
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "EXTENSION_STATE requires an extension\n");
return -1;
}
context = exten = data;
strsep(&context, "@");
if (ast_strlen_zero(context))
context = "default";
if (ast_strlen_zero(exten)) {
ast_log(LOG_WARNING, "EXTENSION_STATE requires an extension\n");
return -1;
}
ast_copy_string(buf,
ast_extstate_str(ast_extension_state(chan, context, exten)), len);
return 0;
}
| static int load_module | ( | void | ) | [static] |
Definition at line 141 of file func_extstate.c.
References ast_custom_function_register, AST_MODULE_LOAD_DECLINE, and AST_MODULE_LOAD_SUCCESS.
{
int res;
res = ast_custom_function_register(&extstate_function);
return res ? AST_MODULE_LOAD_DECLINE : AST_MODULE_LOAD_SUCCESS;
}
| static int unload_module | ( | void | ) | [static] |
Definition at line 132 of file func_extstate.c.
References ast_custom_function_unregister().
{
int res;
res = ast_custom_function_unregister(&extstate_function);
return res;
}
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Gets an extension's state in the dialplan" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, } [static] |
Definition at line 150 of file func_extstate.c.
struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 150 of file func_extstate.c.
struct ast_custom_function extstate_function [static] |
{
.name = "EXTENSION_STATE",
.read = extstate_read,
.read_max = 12,
}
Definition at line 126 of file func_extstate.c.