67 static const char app[] =
"DumpChan";
69 static int serialize_showchan(
struct ast_channel *c,
char *buf,
size_t size)
71 long elapsed_seconds = 0;
72 int hour = 0, min = 0, sec = 0;
76 struct ast_str *write_transpath = ast_str_alloca(256);
77 struct ast_str *read_transpath = ast_str_alloca(256);
85 hour = elapsed_seconds / 3600;
86 min = (elapsed_seconds % 3600) / 60;
87 sec = elapsed_seconds % 60;
98 "ConnectedLineIDNum= %s\n"
99 "ConnectedLineIDName=%s\n"
109 "RawWriteFormat= %s\n"
110 "RawReadFormat= %s\n"
111 "WriteTranscode= %s %s\n"
112 "ReadTranscode= %s %s\n"
113 "1stFileDescriptor= %d\n"
116 "TimetoHangup= %ld\n"
117 "ElapsedTime= %dh%dm%ds\n"
129 ast_channel_uniqueid(c),
130 ast_channel_linkedid(c),
131 S_COR(ast_channel_caller(c)->
id.
number.valid, ast_channel_caller(c)->
id.
number.str,
"(N/A)"),
132 S_COR(ast_channel_caller(c)->
id.
name.valid, ast_channel_caller(c)->
id.
name.str,
"(N/A)"),
133 S_COR(ast_channel_connected(c)->
id.
number.valid, ast_channel_connected(c)->
id.
number.str,
"(N/A)"),
134 S_COR(ast_channel_connected(c)->
id.
name.valid, ast_channel_connected(c)->
id.
name.str,
"(N/A)"),
135 S_OR(ast_channel_dialed(c)->
number.str,
"(N/A)"),
136 S_COR(ast_channel_redirecting(c)->from.number.valid, ast_channel_redirecting(c)->from.number.str,
"(N/A)"),
137 ast_channel_parkinglot(c),
138 ast_channel_language(c),
141 ast_channel_rings(c),
147 ast_channel_writetrans(c) ?
"Yes" :
"No",
149 ast_channel_readtrans(c) ?
"Yes" :
"No",
151 ast_channel_fd(c, 0),
153 ast_channel_fout(c) & ~DEBUGCHAN_FLAG, (ast_channel_fout(c) & DEBUGCHAN_FLAG) ?
" (DEBUGGED)" :
"",
154 (
long)ast_channel_whentohangup(c)->tv_sec,
158 bridge ? bridge->
uniqueid :
"(Not bridged)",
159 ast_channel_context(c),
160 ast_channel_exten(c),
161 ast_channel_priority(c),
164 ast_channel_appl(c) ? ast_channel_appl(c) :
"(N/A)",
165 ast_channel_data(c) ?
S_OR(ast_channel_data(c),
"(Empty)") :
"(None)",
166 (ast_test_flag(ast_channel_flags(c),
AST_FLAG_BLOCKING) ? ast_channel_blockproc(c) :
"(Not Blocking)"));
167 ast_channel_unlock(c);
172 static int dumpchan_exec(
struct ast_channel *chan,
const char *data)
177 static char *line =
"================================================================================";
179 if (!ast_strlen_zero(data))
182 if (VERBOSITY_ATLEAST(level)) {
183 serialize_showchan(chan, info,
sizeof(info));
186 "Dumping Info For Channel: %s:\n"
191 "%s%s\n", ast_channel_name(chan), line, info,
ast_str_buffer(vars), line);
197 static int unload_module(
void)
202 static int load_module(
void)
207 AST_MODULE_INFO_STANDARD(
ASTERISK_GPL_KEY,
"Dump Info About The Calling Channel");
Main Channel structure associated with a channel.
Asterisk main include file. File version handling, generic pbx functions.
const ast_string_field uniqueid
Support for translation of data formats. translate.c.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
const ast_string_field name
ast_channel_state
ast_channel states
int ast_unregister_application(const char *app)
Unregister an application.
char * ast_print_group(char *buf, int buflen, ast_group_t group)
Print call and pickup groups into buffer.
struct ast_bridge * ast_channel_get_bridge(const struct ast_channel *chan)
Get the bridge associated with a channel.
General Asterisk PBX channel definitions.
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
Structure to describe a channel "technology", ie a channel driver See for examples: ...
Core PBX routines and definitions.
Structure that contains information about a bridge.
Support for dynamic strings.
int ast_channel_get_duration(struct ast_channel *chan)
Obtain how long the channel since the channel was created.
const char * ast_translate_path_to_str(struct ast_trans_pvt *t, struct ast_str **str)
Puts a string representation of the translation path into outbuf.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one...
struct ast_str * ast_str_thread_get(struct ast_threadstorage *ts, size_t init_len)
Retrieve a thread locally stored dynamic string.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
const char * ast_state2str(enum ast_channel_state state)
Gives the string form of a given channel state.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
int pbx_builtin_serialize_variables(struct ast_channel *chan, struct ast_str **buf)
Create a human-readable string, specifying all variables and their corresponding values.