#include "asterisk.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/channel.h"
#include "asterisk/app.h"
#include "asterisk/translate.h"
Go to the source code of this file.
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | dumpchan_exec (struct ast_channel *chan, const char *data) |
static int | load_module (void) |
static int | serialize_showchan (struct ast_channel *c, char *buf, size_t size) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Dump Info About The Calling Channel" , .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 = "88eaa8f5c1bd988bedd71113385e0886" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, } |
static const char | app [] = "DumpChan" |
static struct ast_module_info * | ast_module_info = &__mod_info |
Definition in file app_dumpchan.c.
static void __reg_module | ( | void | ) | [static] |
Definition at line 214 of file app_dumpchan.c.
static void __unreg_module | ( | void | ) | [static] |
Definition at line 214 of file app_dumpchan.c.
static int dumpchan_exec | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 179 of file app_dumpchan.c.
References ast_str_buffer(), ast_str_thread_get(), ast_strlen_zero(), ast_verbose, option_verbose, pbx_builtin_serialize_variables(), and serialize_showchan().
Referenced by load_module().
00180 { 00181 struct ast_str *vars = ast_str_thread_get(&ast_str_thread_global_buf, 16); 00182 char info[2048]; 00183 int level = 0; 00184 static char *line = "================================================================================"; 00185 00186 if (!ast_strlen_zero(data)) 00187 level = atoi(data); 00188 00189 if (option_verbose >= level) { 00190 serialize_showchan(chan, info, sizeof(info)); 00191 pbx_builtin_serialize_variables(chan, &vars); 00192 ast_verbose("\n" 00193 "Dumping Info For Channel: %s:\n" 00194 "%s\n" 00195 "Info:\n" 00196 "%s\n" 00197 "Variables:\n" 00198 "%s%s\n", chan->name, line, info, ast_str_buffer(vars), line); 00199 } 00200 00201 return 0; 00202 }
static int load_module | ( | void | ) | [static] |
Definition at line 209 of file app_dumpchan.c.
References ast_register_application_xml, and dumpchan_exec().
00210 { 00211 return ast_register_application_xml(app, dumpchan_exec); 00212 }
static int serialize_showchan | ( | struct ast_channel * | c, | |
char * | buf, | |||
size_t | size | |||
) | [static] |
Definition at line 70 of file app_dumpchan.c.
References ast_channel::_bridge, ast_channel::_state, ast_bridged_channel(), AST_FLAG_BLOCKING, ast_getformatname_multiple(), ast_print_group(), ast_state2str(), ast_str_alloca, ast_test_flag, ast_translate_path_to_str(), ast_tvnow(), ast_channel::caller, ast_channel::cdr, ast_channel::connected, DEBUGCHAN_FLAG, ast_channel::dialed, ast_channel::fds, ast_channel::fin, ast_channel::fout, ast_party_redirecting::from, ast_party_connected_line::id, ast_party_caller::id, ast_channel::language, ast_channel::linkedid, name, ast_party_id::name, ast_channel::name, ast_channel::nativeformats, ast_party_dialed::number, ast_party_id::number, ast_channel::parkinglot, ast_channel::rawreadformat, ast_channel::rawwriteformat, ast_channel::readformat, ast_channel::readtrans, ast_channel::redirecting, ast_channel::rings, S_COR, S_OR, ast_cdr::start, ast_party_dialed::str, ast_party_name::str, ast_party_number::str, ast_channel::tech, ast_channel_tech::type, ast_channel::uniqueid, ast_party_name::valid, ast_party_number::valid, ast_channel::whentohangup, ast_channel::writeformat, and ast_channel::writetrans.
Referenced by dumpchan_exec().
00071 { 00072 struct timeval now; 00073 long elapsed_seconds = 0; 00074 int hour = 0, min = 0, sec = 0; 00075 char nf[256]; 00076 char wf[256]; 00077 char rf[256]; 00078 char rwf[256]; 00079 char rrf[256]; 00080 char cgrp[256]; 00081 char pgrp[256]; 00082 struct ast_str *write_transpath = ast_str_alloca(256); 00083 struct ast_str *read_transpath = ast_str_alloca(256); 00084 00085 now = ast_tvnow(); 00086 memset(buf, 0, size); 00087 if (!c) 00088 return 0; 00089 00090 if (c->cdr) { 00091 elapsed_seconds = now.tv_sec - c->cdr->start.tv_sec; 00092 hour = elapsed_seconds / 3600; 00093 min = (elapsed_seconds % 3600) / 60; 00094 sec = elapsed_seconds % 60; 00095 } 00096 00097 snprintf(buf,size, 00098 "Name= %s\n" 00099 "Type= %s\n" 00100 "UniqueID= %s\n" 00101 "LinkedID= %s\n" 00102 "CallerIDNum= %s\n" 00103 "CallerIDName= %s\n" 00104 "ConnectedLineIDNum= %s\n" 00105 "ConnectedLineIDName=%s\n" 00106 "DNIDDigits= %s\n" 00107 "RDNIS= %s\n" 00108 "Parkinglot= %s\n" 00109 "Language= %s\n" 00110 "State= %s (%d)\n" 00111 "Rings= %d\n" 00112 "NativeFormat= %s\n" 00113 "WriteFormat= %s\n" 00114 "ReadFormat= %s\n" 00115 "RawWriteFormat= %s\n" 00116 "RawReadFormat= %s\n" 00117 "WriteTranscode= %s %s\n" 00118 "ReadTranscode= %s %s\n" 00119 "1stFileDescriptor= %d\n" 00120 "Framesin= %d %s\n" 00121 "Framesout= %d %s\n" 00122 "TimetoHangup= %ld\n" 00123 "ElapsedTime= %dh%dm%ds\n" 00124 "DirectBridge= %s\n" 00125 "IndirectBridge= %s\n" 00126 "Context= %s\n" 00127 "Extension= %s\n" 00128 "Priority= %d\n" 00129 "CallGroup= %s\n" 00130 "PickupGroup= %s\n" 00131 "Application= %s\n" 00132 "Data= %s\n" 00133 "Blocking_in= %s\n", 00134 c->name, 00135 c->tech->type, 00136 c->uniqueid, 00137 c->linkedid, 00138 S_COR(c->caller.id.number.valid, c->caller.id.number.str, "(N/A)"), 00139 S_COR(c->caller.id.name.valid, c->caller.id.name.str, "(N/A)"), 00140 S_COR(c->connected.id.number.valid, c->connected.id.number.str, "(N/A)"), 00141 S_COR(c->connected.id.name.valid, c->connected.id.name.str, "(N/A)"), 00142 S_OR(c->dialed.number.str, "(N/A)"), 00143 S_COR(c->redirecting.from.number.valid, c->redirecting.from.number.str, "(N/A)"), 00144 c->parkinglot, 00145 c->language, 00146 ast_state2str(c->_state), 00147 c->_state, 00148 c->rings, 00149 ast_getformatname_multiple(nf, sizeof(nf), c->nativeformats), 00150 ast_getformatname_multiple(wf, sizeof(wf), c->writeformat), 00151 ast_getformatname_multiple(rf, sizeof(rf), c->readformat), 00152 ast_getformatname_multiple(rwf, sizeof(rwf), c->rawwriteformat), 00153 ast_getformatname_multiple(rrf, sizeof(rrf), c->rawreadformat), 00154 c->writetrans ? "Yes" : "No", 00155 ast_translate_path_to_str(c->writetrans, &write_transpath), 00156 c->readtrans ? "Yes" : "No", 00157 ast_translate_path_to_str(c->readtrans, &read_transpath), 00158 c->fds[0], 00159 c->fin & ~DEBUGCHAN_FLAG, (c->fin & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "", 00160 c->fout & ~DEBUGCHAN_FLAG, (c->fout & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "", 00161 (long)c->whentohangup.tv_sec, 00162 hour, 00163 min, 00164 sec, 00165 c->_bridge ? c->_bridge->name : "<none>", 00166 ast_bridged_channel(c) ? ast_bridged_channel(c)->name : "<none>", 00167 c->context, 00168 c->exten, 00169 c->priority, 00170 ast_print_group(cgrp, sizeof(cgrp), c->callgroup), 00171 ast_print_group(pgrp, sizeof(pgrp), c->pickupgroup), 00172 c->appl ? c->appl : "(N/A)", 00173 c->data ? S_OR(c->data, "(Empty)") : "(None)", 00174 (ast_test_flag(c, AST_FLAG_BLOCKING) ? c->blockproc : "(Not Blocking)")); 00175 00176 return 0; 00177 }
static int unload_module | ( | void | ) | [static] |
Definition at line 204 of file app_dumpchan.c.
References ast_unregister_application().
00205 { 00206 return ast_unregister_application(app); 00207 }
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Dump Info About The Calling Channel" , .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 = "88eaa8f5c1bd988bedd71113385e0886" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, } [static] |
Definition at line 214 of file app_dumpchan.c.
const char app[] = "DumpChan" [static] |
Definition at line 68 of file app_dumpchan.c.
struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 214 of file app_dumpchan.c.