#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_DEFAULT , .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 = "068e67f60f50dd9ee86464c05884a49d" , .load = load_module, .unload = unload_module, } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_custom_function | extstate_function |
Definition in file func_extstate.c.
static void __reg_module | ( | void | ) | [static] |
Definition at line 133 of file func_extstate.c.
static void __unreg_module | ( | void | ) | [static] |
Definition at line 133 of file func_extstate.c.
static const char* ast_extstate_str | ( | int | state | ) | [static] |
Definition at line 39 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().
00040 { 00041 const char *res = "UNKNOWN"; 00042 00043 switch (state) { 00044 case AST_EXTENSION_NOT_INUSE: 00045 res = "NOT_INUSE"; 00046 break; 00047 case AST_EXTENSION_INUSE: 00048 res = "INUSE"; 00049 break; 00050 case AST_EXTENSION_BUSY: 00051 res = "BUSY"; 00052 break; 00053 case AST_EXTENSION_UNAVAILABLE: 00054 res = "UNAVAILABLE"; 00055 break; 00056 case AST_EXTENSION_RINGING: 00057 res = "RINGING"; 00058 break; 00059 case AST_EXTENSION_INUSE | AST_EXTENSION_RINGING: 00060 res = "RINGINUSE"; 00061 break; 00062 case AST_EXTENSION_INUSE | AST_EXTENSION_ONHOLD: 00063 res = "HOLDINUSE"; 00064 break; 00065 case AST_EXTENSION_ONHOLD: 00066 res = "ONHOLD"; 00067 break; 00068 } 00069 00070 return res; 00071 }
static int extstate_read | ( | struct ast_channel * | chan, | |
const char * | cmd, | |||
char * | data, | |||
char * | buf, | |||
size_t | len | |||
) | [static] |
Definition at line 73 of file func_extstate.c.
References ast_copy_string(), ast_extension_state(), ast_extstate_str(), ast_log(), ast_strlen_zero(), chan, context, exten, LOG_WARNING, and strsep().
00075 { 00076 char *exten, *context; 00077 00078 if (ast_strlen_zero(data)) { 00079 ast_log(LOG_WARNING, "EXTENSION_STATE requires an extension\n"); 00080 return -1; 00081 } 00082 00083 context = exten = data; 00084 strsep(&context, "@"); 00085 if (ast_strlen_zero(context)) 00086 context = "default"; 00087 00088 if (ast_strlen_zero(exten)) { 00089 ast_log(LOG_WARNING, "EXTENSION_STATE requires an extension\n"); 00090 return -1; 00091 } 00092 00093 ast_copy_string(buf, 00094 ast_extstate_str(ast_extension_state(chan, context, exten)), len); 00095 00096 return 0; 00097 }
static int load_module | ( | void | ) | [static] |
Definition at line 124 of file func_extstate.c.
References ast_custom_function_register, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, and extstate_function.
00125 { 00126 int res; 00127 00128 res = ast_custom_function_register(&extstate_function); 00129 00130 return res ? AST_MODULE_LOAD_DECLINE : AST_MODULE_LOAD_SUCCESS; 00131 }
static int unload_module | ( | void | ) | [static] |
Definition at line 115 of file func_extstate.c.
References ast_custom_function_unregister(), and extstate_function.
00116 { 00117 int res; 00118 00119 res = ast_custom_function_unregister(&extstate_function); 00120 00121 return res; 00122 }
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .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 = "068e67f60f50dd9ee86464c05884a49d" , .load = load_module, .unload = unload_module, } [static] |
Definition at line 133 of file func_extstate.c.
const struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 133 of file func_extstate.c.
struct ast_custom_function extstate_function [static] |