#include "asterisk.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/channel.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 | 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 = "8586c2a7d357cb591cc3a6607a8f62d1" , .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 179 of file app_dumpchan.c.
static void __unreg_module | ( | void | ) | [static] |
Definition at line 179 of file app_dumpchan.c.
static int dumpchan_exec | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 150 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().
00151 { 00152 struct ast_str *vars = ast_str_thread_get(&ast_str_thread_global_buf, 16); 00153 char info[1024]; 00154 int level = 0; 00155 static char *line = "================================================================================"; 00156 00157 if (!ast_strlen_zero(data)) 00158 level = atoi(data); 00159 00160 if (option_verbose >= level) { 00161 serialize_showchan(chan, info, sizeof(info)); 00162 pbx_builtin_serialize_variables(chan, &vars); 00163 ast_verbose("\nDumping Info For Channel: %s:\n%s\nInfo:\n%s\nVariables:\n%s%s\n", chan->name, line, info, ast_str_buffer(vars), line); 00164 } 00165 00166 return 0; 00167 }
static int load_module | ( | void | ) | [static] |
Definition at line 174 of file app_dumpchan.c.
References ast_register_application_xml, and dumpchan_exec().
00175 { 00176 return ast_register_application_xml(app, dumpchan_exec); 00177 }
static int serialize_showchan | ( | struct ast_channel * | c, | |
char * | buf, | |||
size_t | size | |||
) | [static] |
Definition at line 65 of file app_dumpchan.c.
References ast_channel::_state, ast_channel::appl, AST_FLAG_BLOCKING, ast_getformatname_multiple(), ast_print_group(), ast_state2str(), ast_test_flag, ast_tvnow(), ast_channel::blockproc, ast_channel::caller, ast_channel::callgroup, ast_channel::cdr, ast_channel::context, ast_channel::data, DEBUGCHAN_FLAG, ast_channel::dialed, ast_channel::exten, ast_channel::fds, ast_channel::fin, ast_channel::fout, ast_party_redirecting::from, ast_party_caller::id, ast_channel::language, ast_party_id::name, ast_channel::name, ast_channel::nativeformats, ast_party_dialed::number, ast_party_id::number, ast_channel::parkinglot, ast_channel::pickupgroup, ast_channel::priority, ast_channel::rawreadformat, ast_channel::rawwriteformat, ast_channel::readformat, 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, and ast_channel::writeformat.
Referenced by dumpchan_exec().
00066 { 00067 struct timeval now; 00068 long elapsed_seconds = 0; 00069 int hour = 0, min = 0, sec = 0; 00070 char cgrp[BUFSIZ/2]; 00071 char pgrp[BUFSIZ/2]; 00072 char formatbuf[BUFSIZ/2]; 00073 00074 now = ast_tvnow(); 00075 memset(buf, 0, size); 00076 if (!c) 00077 return 0; 00078 00079 if (c->cdr) { 00080 elapsed_seconds = now.tv_sec - c->cdr->start.tv_sec; 00081 hour = elapsed_seconds / 3600; 00082 min = (elapsed_seconds % 3600) / 60; 00083 sec = elapsed_seconds % 60; 00084 } 00085 00086 snprintf(buf,size, 00087 "Name= %s\n" 00088 "Type= %s\n" 00089 "UniqueID= %s\n" 00090 "CallerIDNum= %s\n" 00091 "CallerIDName= %s\n" 00092 "DNIDDigits= %s\n" 00093 "RDNIS= %s\n" 00094 "Parkinglot= %s\n" 00095 "Language= %s\n" 00096 "State= %s (%d)\n" 00097 "Rings= %d\n" 00098 "NativeFormat= %s\n" 00099 "WriteFormat= %s\n" 00100 "ReadFormat= %s\n" 00101 "RawWriteFormat= %s\n" 00102 "RawReadFormat= %s\n" 00103 "1stFileDescriptor= %d\n" 00104 "Framesin= %d %s\n" 00105 "Framesout= %d %s\n" 00106 "TimetoHangup= %ld\n" 00107 "ElapsedTime= %dh%dm%ds\n" 00108 "Context= %s\n" 00109 "Extension= %s\n" 00110 "Priority= %d\n" 00111 "CallGroup= %s\n" 00112 "PickupGroup= %s\n" 00113 "Application= %s\n" 00114 "Data= %s\n" 00115 "Blocking_in= %s\n", 00116 c->name, 00117 c->tech->type, 00118 c->uniqueid, 00119 S_COR(c->caller.id.number.valid, c->caller.id.number.str, "(N/A)"), 00120 S_COR(c->caller.id.name.valid, c->caller.id.name.str, "(N/A)"), 00121 S_OR(c->dialed.number.str, "(N/A)"), 00122 S_COR(c->redirecting.from.number.valid, c->redirecting.from.number.str, "(N/A)"), 00123 c->parkinglot, 00124 c->language, 00125 ast_state2str(c->_state), 00126 c->_state, 00127 c->rings, 00128 ast_getformatname_multiple(formatbuf, sizeof(formatbuf), c->nativeformats), 00129 ast_getformatname_multiple(formatbuf, sizeof(formatbuf), c->writeformat), 00130 ast_getformatname_multiple(formatbuf, sizeof(formatbuf), c->readformat), 00131 ast_getformatname_multiple(formatbuf, sizeof(formatbuf), c->rawwriteformat), 00132 ast_getformatname_multiple(formatbuf, sizeof(formatbuf), c->rawreadformat), 00133 c->fds[0], c->fin & ~DEBUGCHAN_FLAG, (c->fin & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "", 00134 c->fout & ~DEBUGCHAN_FLAG, (c->fout & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "", (long)c->whentohangup.tv_sec, 00135 hour, 00136 min, 00137 sec, 00138 c->context, 00139 c->exten, 00140 c->priority, 00141 ast_print_group(cgrp, sizeof(cgrp), c->callgroup), 00142 ast_print_group(pgrp, sizeof(pgrp), c->pickupgroup), 00143 ( c->appl ? c->appl : "(N/A)" ), 00144 ( c-> data ? S_OR(c->data, "(Empty)") : "(None)"), 00145 (ast_test_flag(c, AST_FLAG_BLOCKING) ? c->blockproc : "(Not Blocking)")); 00146 00147 return 0; 00148 }
static int unload_module | ( | void | ) | [static] |
Definition at line 169 of file app_dumpchan.c.
References ast_unregister_application().
00170 { 00171 return ast_unregister_application(app); 00172 }
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 = "8586c2a7d357cb591cc3a6607a8f62d1" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, } [static] |
Definition at line 179 of file app_dumpchan.c.
const char app[] = "DumpChan" [static] |
Definition at line 63 of file app_dumpchan.c.
struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 179 of file app_dumpchan.c.