#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 = AST_BUILDOPT_SUM, .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 210 of file app_dumpchan.c.
| static void __unreg_module | ( | void | ) | [static] |
Definition at line 210 of file app_dumpchan.c.
| static int dumpchan_exec | ( | struct ast_channel * | chan, | |
| const char * | data | |||
| ) | [static] |
Definition at line 175 of file app_dumpchan.c.
References ast_channel_name(), 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().
00176 { 00177 struct ast_str *vars = ast_str_thread_get(&ast_str_thread_global_buf, 16); 00178 char info[2048]; 00179 int level = 0; 00180 static char *line = "================================================================================"; 00181 00182 if (!ast_strlen_zero(data)) 00183 level = atoi(data); 00184 00185 if (option_verbose >= level) { 00186 serialize_showchan(chan, info, sizeof(info)); 00187 pbx_builtin_serialize_variables(chan, &vars); 00188 ast_verbose("\n" 00189 "Dumping Info For Channel: %s:\n" 00190 "%s\n" 00191 "Info:\n" 00192 "%s\n" 00193 "Variables:\n" 00194 "%s%s\n", ast_channel_name(chan), line, info, ast_str_buffer(vars), line); 00195 } 00196 00197 return 0; 00198 }
| static int load_module | ( | void | ) | [static] |
Definition at line 205 of file app_dumpchan.c.
References ast_register_application_xml, and dumpchan_exec().
00206 { 00207 return ast_register_application_xml(app, dumpchan_exec); 00208 }
| 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_channel::appl, ast_bridged_channel(), ast_channel_language(), ast_channel_linkedid(), ast_channel_name(), ast_channel_parkinglot(), ast_channel_uniqueid(), AST_FLAG_BLOCKING, ast_getformatname(), ast_getformatname_multiple(), ast_print_group(), ast_state2str(), ast_str_alloca, ast_test_flag, ast_translate_path_to_str(), ast_tvnow(), ast_channel::blockproc, ast_channel::caller, ast_channel::callgroup, ast_channel::cdr, ast_channel::connected, 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_connected_line::id, ast_party_caller::id, ast_party_id::name, ast_channel::nativeformats, ast_party_dialed::number, ast_party_id::number, ast_channel::pickupgroup, ast_channel::priority, 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_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 cgrp[256]; 00077 char pgrp[256]; 00078 struct ast_str *write_transpath = ast_str_alloca(256); 00079 struct ast_str *read_transpath = ast_str_alloca(256); 00080 00081 now = ast_tvnow(); 00082 memset(buf, 0, size); 00083 if (!c) 00084 return 0; 00085 00086 if (c->cdr) { 00087 elapsed_seconds = now.tv_sec - c->cdr->start.tv_sec; 00088 hour = elapsed_seconds / 3600; 00089 min = (elapsed_seconds % 3600) / 60; 00090 sec = elapsed_seconds % 60; 00091 } 00092 00093 snprintf(buf,size, 00094 "Name= %s\n" 00095 "Type= %s\n" 00096 "UniqueID= %s\n" 00097 "LinkedID= %s\n" 00098 "CallerIDNum= %s\n" 00099 "CallerIDName= %s\n" 00100 "ConnectedLineIDNum= %s\n" 00101 "ConnectedLineIDName=%s\n" 00102 "DNIDDigits= %s\n" 00103 "RDNIS= %s\n" 00104 "Parkinglot= %s\n" 00105 "Language= %s\n" 00106 "State= %s (%d)\n" 00107 "Rings= %d\n" 00108 "NativeFormat= %s\n" 00109 "WriteFormat= %s\n" 00110 "ReadFormat= %s\n" 00111 "RawWriteFormat= %s\n" 00112 "RawReadFormat= %s\n" 00113 "WriteTranscode= %s %s\n" 00114 "ReadTranscode= %s %s\n" 00115 "1stFileDescriptor= %d\n" 00116 "Framesin= %d %s\n" 00117 "Framesout= %d %s\n" 00118 "TimetoHangup= %ld\n" 00119 "ElapsedTime= %dh%dm%ds\n" 00120 "DirectBridge= %s\n" 00121 "IndirectBridge= %s\n" 00122 "Context= %s\n" 00123 "Extension= %s\n" 00124 "Priority= %d\n" 00125 "CallGroup= %s\n" 00126 "PickupGroup= %s\n" 00127 "Application= %s\n" 00128 "Data= %s\n" 00129 "Blocking_in= %s\n", 00130 ast_channel_name(c), 00131 c->tech->type, 00132 ast_channel_uniqueid(c), 00133 ast_channel_linkedid(c), 00134 S_COR(c->caller.id.number.valid, c->caller.id.number.str, "(N/A)"), 00135 S_COR(c->caller.id.name.valid, c->caller.id.name.str, "(N/A)"), 00136 S_COR(c->connected.id.number.valid, c->connected.id.number.str, "(N/A)"), 00137 S_COR(c->connected.id.name.valid, c->connected.id.name.str, "(N/A)"), 00138 S_OR(c->dialed.number.str, "(N/A)"), 00139 S_COR(c->redirecting.from.number.valid, c->redirecting.from.number.str, "(N/A)"), 00140 ast_channel_parkinglot(c), 00141 ast_channel_language(c), 00142 ast_state2str(c->_state), 00143 c->_state, 00144 c->rings, 00145 ast_getformatname_multiple(nf, sizeof(nf), c->nativeformats), 00146 ast_getformatname(&c->writeformat), 00147 ast_getformatname(&c->readformat), 00148 ast_getformatname(&c->rawwriteformat), 00149 ast_getformatname(&c->rawreadformat), 00150 c->writetrans ? "Yes" : "No", 00151 ast_translate_path_to_str(c->writetrans, &write_transpath), 00152 c->readtrans ? "Yes" : "No", 00153 ast_translate_path_to_str(c->readtrans, &read_transpath), 00154 c->fds[0], 00155 c->fin & ~DEBUGCHAN_FLAG, (c->fin & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "", 00156 c->fout & ~DEBUGCHAN_FLAG, (c->fout & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "", 00157 (long)c->whentohangup.tv_sec, 00158 hour, 00159 min, 00160 sec, 00161 c->_bridge ? ast_channel_name(c->_bridge) : "<none>", 00162 ast_bridged_channel(c) ? ast_channel_name(ast_bridged_channel(c)) : "<none>", 00163 c->context, 00164 c->exten, 00165 c->priority, 00166 ast_print_group(cgrp, sizeof(cgrp), c->callgroup), 00167 ast_print_group(pgrp, sizeof(pgrp), c->pickupgroup), 00168 c->appl ? c->appl : "(N/A)", 00169 c->data ? S_OR(c->data, "(Empty)") : "(None)", 00170 (ast_test_flag(c, AST_FLAG_BLOCKING) ? c->blockproc : "(Not Blocking)")); 00171 00172 return 0; 00173 }
| static int unload_module | ( | void | ) | [static] |
Definition at line 200 of file app_dumpchan.c.
References ast_unregister_application().
00201 { 00202 return ast_unregister_application(app); 00203 }
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 = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, } [static] |
Definition at line 210 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 210 of file app_dumpchan.c.
1.5.6