#include "asterisk.h"
#include <stdlib.h>
#include <stdio.h>
#include "asterisk/module.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/utils.h"
#include "asterisk/lock.h"
#include "asterisk/file.h"
#include "asterisk/logger.h"
#include "asterisk/options.h"
#include "asterisk/enum.h"
#include "asterisk/app.h"
Go to the source code of this file.
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | function_enum (struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len) |
static int | function_txtcidname (struct ast_channel *chan, 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 | AST_MODFLAG_BUILDSUM, .description = "ENUM related dialplan functions" , .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 = "361d7bb937402d51e4658efb5b4d76e4" , .load = load_module, .unload = unload_module, } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_custom_function | enum_function |
static char * | synopsis = "Syntax: ENUMLOOKUP(number[|Method-type[|options[|record#[|zone-suffix]]]])\n" |
static struct ast_custom_function | txtcidname_function |
Oleksiy Krivoshey <oleksiyk@gmail.com>
Russell Bryant <russelb@clemson.edu>
Definition in file func_enum.c.
static void __reg_module | ( | void | ) | [static] |
Definition at line 198 of file func_enum.c.
static void __unreg_module | ( | void | ) | [static] |
Definition at line 198 of file func_enum.c.
static int function_enum | ( | struct ast_channel * | chan, | |
char * | cmd, | |||
char * | data, | |||
char * | buf, | |||
size_t | len | |||
) | [static] |
Definition at line 53 of file func_enum.c.
References AST_APP_ARG, ast_copy_string(), AST_DECLARE_APP_ARGS, ast_get_enum(), ast_log(), AST_MAX_EXTENSION, ast_module_user_add, ast_module_user_remove, AST_STANDARD_APP_ARGS, ast_strlen_zero(), ast_module_user::chan, LOG_WARNING, s, and ast_channel::zone.
00055 { 00056 AST_DECLARE_APP_ARGS(args, 00057 AST_APP_ARG(number); 00058 AST_APP_ARG(tech); 00059 AST_APP_ARG(options); 00060 AST_APP_ARG(record); 00061 AST_APP_ARG(zone); 00062 ); 00063 int res = 0; 00064 char tech[80]; 00065 char dest[256] = "", tmp[2] = "", num[AST_MAX_EXTENSION] = ""; 00066 struct ast_module_user *u; 00067 char *s, *p; 00068 unsigned int record = 1; 00069 00070 buf[0] = '\0'; 00071 00072 if (ast_strlen_zero(data)) { 00073 ast_log(LOG_WARNING, "%s", synopsis); 00074 return -1; 00075 } 00076 00077 AST_STANDARD_APP_ARGS(args, data); 00078 00079 if (args.argc < 1) { 00080 ast_log(LOG_WARNING, "%s", synopsis); 00081 return -1; 00082 } 00083 00084 u = ast_module_user_add(chan); 00085 00086 ast_copy_string(tech, args.tech ? args.tech : "sip", sizeof(tech)); 00087 00088 if (!args.zone) 00089 args.zone = "e164.arpa"; 00090 00091 if (!args.options) 00092 args.options = ""; 00093 00094 if (args.record) 00095 record = atoi(args.record); 00096 00097 /* strip any '-' signs from number */ 00098 for (s = p = args.number; *s; s++) { 00099 if (*s != '-') { 00100 snprintf(tmp, sizeof(tmp), "%c", *s); 00101 strncat(num, tmp, sizeof(num) - strlen(num) - 1); 00102 } 00103 00104 } 00105 00106 res = ast_get_enum(chan, num, dest, sizeof(dest), tech, sizeof(tech), args.zone, 00107 args.options, record); 00108 00109 p = strchr(dest, ':'); 00110 if (p && strcasecmp(tech, "ALL")) 00111 ast_copy_string(buf, p + 1, len); 00112 else 00113 ast_copy_string(buf, dest, len); 00114 00115 ast_module_user_remove(u); 00116 00117 return 0; 00118 }
static int function_txtcidname | ( | struct ast_channel * | chan, | |
char * | cmd, | |||
char * | data, | |||
char * | buf, | |||
size_t | len | |||
) | [static] |
Definition at line 135 of file func_enum.c.
References ast_copy_string(), ast_get_txt(), ast_log(), ast_module_user_add, ast_module_user_remove, ast_strlen_zero(), ast_module_user::chan, and LOG_WARNING.
00137 { 00138 int res; 00139 char tech[80]; 00140 char txt[256] = ""; 00141 char dest[80]; 00142 struct ast_module_user *u; 00143 00144 buf[0] = '\0'; 00145 00146 00147 if (ast_strlen_zero(data)) { 00148 ast_log(LOG_WARNING, "TXTCIDNAME requires an argument (number)\n"); 00149 return -1; 00150 } 00151 00152 u = ast_module_user_add(chan); 00153 00154 res = ast_get_txt(chan, data, dest, sizeof(dest), tech, sizeof(tech), txt, 00155 sizeof(txt)); 00156 00157 if (!ast_strlen_zero(txt)) 00158 ast_copy_string(buf, txt, len); 00159 00160 ast_module_user_remove(u); 00161 00162 return 0; 00163 }
static int load_module | ( | void | ) | [static] |
Definition at line 188 of file func_enum.c.
References ast_custom_function_register(), enum_function, and txtcidname_function.
00189 { 00190 int res = 0; 00191 00192 res |= ast_custom_function_register(&enum_function); 00193 res |= ast_custom_function_register(&txtcidname_function); 00194 00195 return res; 00196 }
static int unload_module | ( | void | ) | [static] |
Definition at line 176 of file func_enum.c.
References ast_custom_function_unregister(), ast_module_user_hangup_all, enum_function, and txtcidname_function.
00177 { 00178 int res = 0; 00179 00180 res |= ast_custom_function_unregister(&enum_function); 00181 res |= ast_custom_function_unregister(&txtcidname_function); 00182 00183 ast_module_user_hangup_all(); 00184 00185 return res; 00186 }
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT | AST_MODFLAG_BUILDSUM, .description = "ENUM related dialplan functions" , .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 = "361d7bb937402d51e4658efb5b4d76e4" , .load = load_module, .unload = unload_module, } [static] |
Definition at line 198 of file func_enum.c.
const struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 198 of file func_enum.c.
struct ast_custom_function enum_function [static] |
char* synopsis = "Syntax: ENUMLOOKUP(number[|Method-type[|options[|record#[|zone-suffix]]]])\n" [static] |
Definition at line 51 of file func_enum.c.
struct ast_custom_function txtcidname_function [static] |