#include "asterisk.h"
#include "asterisk/module.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/utils.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 | load_module (void) |
static int | timeout_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
static int | timeout_write (struct ast_channel *chan, const char *cmd, char *data, const char *value) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Channel timeout 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 = "068e67f60f50dd9ee86464c05884a49d" , .load = load_module, .unload = unload_module, } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_custom_function | timeout_function |
Definition in file func_timeout.c.
static void __reg_module | ( | void | ) | [static] |
Definition at line 184 of file func_timeout.c.
static void __unreg_module | ( | void | ) | [static] |
Definition at line 184 of file func_timeout.c.
static int load_module | ( | void | ) | [static] |
Definition at line 179 of file func_timeout.c.
References ast_custom_function_register, and timeout_function.
00180 { 00181 return ast_custom_function_register(&timeout_function); 00182 }
static int timeout_read | ( | struct ast_channel * | chan, | |
const char * | cmd, | |||
char * | data, | |||
char * | buf, | |||
size_t | len | |||
) | [static] |
Definition at line 37 of file func_timeout.c.
References ast_copy_string(), ast_log(), chan, ast_pbx::dtimeout, LOG_ERROR, ast_channel::pbx, ast_pbx::rtimeout, and ast_channel::whentohangup.
00039 { 00040 time_t myt; 00041 00042 if (!chan) 00043 return -1; 00044 00045 if (!data) { 00046 ast_log(LOG_ERROR, "Must specify type of timeout to get.\n"); 00047 return -1; 00048 } 00049 00050 switch (*data) { 00051 case 'a': 00052 case 'A': 00053 if (chan->whentohangup == 0) { 00054 ast_copy_string(buf, "0", len); 00055 } else { 00056 time(&myt); 00057 snprintf(buf, len, "%d", (int) (chan->whentohangup - myt)); 00058 } 00059 break; 00060 00061 case 'r': 00062 case 'R': 00063 if (chan->pbx) { 00064 snprintf(buf, len, "%d", chan->pbx->rtimeout); 00065 } 00066 break; 00067 00068 case 'd': 00069 case 'D': 00070 if (chan->pbx) { 00071 snprintf(buf, len, "%d", chan->pbx->dtimeout); 00072 } 00073 break; 00074 00075 default: 00076 ast_log(LOG_ERROR, "Unknown timeout type specified.\n"); 00077 break; 00078 } 00079 00080 return 0; 00081 }
static int timeout_write | ( | struct ast_channel * | chan, | |
const char * | cmd, | |||
char * | data, | |||
const char * | value | |||
) | [static] |
Definition at line 83 of file func_timeout.c.
References ast_channel_setwhentohangup(), ast_localtime(), ast_log(), ast_strftime(), ast_verb, ast_verbose(), chan, LOG_ERROR, and VERBOSITY_ATLEAST.
00085 { 00086 int x; 00087 char timestr[64]; 00088 struct ast_tm myt; 00089 00090 if (!chan) 00091 return -1; 00092 00093 if (!data) { 00094 ast_log(LOG_ERROR, "Must specify type of timeout to set.\n"); 00095 return -1; 00096 } 00097 00098 if (!value) 00099 return -1; 00100 00101 x = atoi(value); 00102 if (x < 0) 00103 x = 0; 00104 00105 switch (*data) { 00106 case 'a': 00107 case 'A': 00108 ast_channel_setwhentohangup(chan, x); 00109 if (VERBOSITY_ATLEAST(3)) { 00110 if (chan->whentohangup) { 00111 struct timeval tv = { chan->whentohangup, 0 }; 00112 ast_strftime(timestr, sizeof(timestr), "%Y-%m-%d %H:%M:%S.%3q %Z", 00113 ast_localtime(&tv, &myt, NULL)); 00114 ast_verbose("Channel will hangup at %s.\n", timestr); 00115 } else { 00116 ast_verbose("Channel hangup cancelled.\n"); 00117 } 00118 } 00119 break; 00120 00121 case 'r': 00122 case 'R': 00123 if (chan->pbx) { 00124 chan->pbx->rtimeout = x; 00125 ast_verb(3, "Response timeout set to %d\n", chan->pbx->rtimeout); 00126 } 00127 break; 00128 00129 case 'd': 00130 case 'D': 00131 if (chan->pbx) { 00132 chan->pbx->dtimeout = x; 00133 ast_verb(3, "Digit timeout set to %d\n", chan->pbx->dtimeout); 00134 } 00135 break; 00136 00137 default: 00138 ast_log(LOG_ERROR, "Unknown timeout type specified.\n"); 00139 break; 00140 } 00141 00142 return 0; 00143 }
static int unload_module | ( | void | ) | [static] |
Definition at line 174 of file func_timeout.c.
References ast_custom_function_unregister(), and timeout_function.
00175 { 00176 return ast_custom_function_unregister(&timeout_function); 00177 }
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Channel timeout 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 = "068e67f60f50dd9ee86464c05884a49d" , .load = load_module, .unload = unload_module, } [static] |
Definition at line 184 of file func_timeout.c.
const struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 184 of file func_timeout.c.
struct ast_custom_function timeout_function [static] |