Application to dump channel variables. More...
#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 | |
| AST_MODULE_INFO_STANDARD (ASTERISK_GPL_KEY,"Dump Info About The Calling Channel") | |
| static int | dumpchan_exec (struct ast_channel *chan, void *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 char * | app = "DumpChan" |
Application to dump channel variables.
Definition in file app_dumpchan.c.
| AST_MODULE_INFO_STANDARD | ( | ASTERISK_GPL_KEY | , | |
| "Dump Info About The Calling Channel" | ||||
| ) |
| static int dumpchan_exec | ( | struct ast_channel * | chan, | |
| void * | 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::callgroup, ast_channel::cdr, ast_channel::cid, ast_callerid::cid_dnid, ast_callerid::cid_name, ast_callerid::cid_num, ast_callerid::cid_rdnis, ast_channel::context, ast_channel::data, DEBUGCHAN_FLAG, ast_channel::exten, ast_channel::fds, ast_channel::fin, ast_channel::fout, ast_channel::nativeformats, ast_channel::pickupgroup, ast_channel::priority, ast_channel::rawreadformat, ast_channel::rawwriteformat, ast_channel::readformat, ast_channel::rings, S_OR, sec, ast_cdr::start, ast_channel::tech, ast_channel_tech::type, 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_OR(c->cid.cid_num, "(N/A)"), 00120 S_OR(c->cid.cid_name, "(N/A)"), 00121 S_OR(c->cid.cid_dnid, "(N/A)"), 00122 S_OR(c->cid.cid_rdnis, "(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 }
char* app = "DumpChan" [static] |
Definition at line 63 of file app_dumpchan.c.
1.6.1