59 const char *right_key = arg;
67 cmp = strcmp(left_obj->
base->
name, right_key);
70 cmp = strncmp(left_obj->
base->
name, right_key, strlen(right_key));
84 const char *right_key = arg;
96 cmp = strcmp(left_obj->
base->
name, right_key);
99 cmp = strncmp(left_obj->
base->
name, right_key, strlen(right_key));
113 const char *right_key = arg;
121 if (strcmp(left_obj->
base->
name, right_key) == 0) {
126 if (strncmp(left_obj->
base->
name, right_key, strlen(right_key)) == 0) {
142 const char *right_key = arg;
153 if (strcmp(left_obj->
base->
name, right_key) == 0) {
158 if (strncmp(left_obj->
base->
name, right_key, strlen(right_key)) == 0) {
175 if (!strcmp(snapshot->
base->
type,
"PJSIP")) {
186 regex_t *regexbuf = arg;
202 if (!parent_container) {
207 if (!child_container) {
214 if (regcomp(®exbuf,
regex, REG_EXTENDED | REG_NOSUB)) {
222 return child_container;
256 "%*s: <ChannelId%*.*s> <State.....> <Time.....>\n",
263 "%*s: <DialedExten%*.*s> CLCID: <ConnectedLineCID.......>\n",
275 char *print_name =
NULL;
279 char *print_time = alloca(32);
284 print_name = alloca(print_name_len);
296 flexwidth, flexwidth,
307 "%*s: %-*.*s CLCID: \"%s\" <%s>\n",
309 flexwidth, flexwidth,
315 if (
context->indent_level == 0) {
330 " ...........Receive......... .........Transmit..........\n"
331 " BridgeId ChannelId ........ UpTime.. Codec. Count Lost Pct Jitter Count Lost Pct Jitter RTT....\n"
332 " =================");
347 char *print_name =
NULL;
348 char *print_time = alloca(32);
349 char codec_in_use[7];
365 || !
session->active_media_state
366 || !
session->active_media_state->topology) {
391 codec_in_use[0] =
'\0';
406 if (stats_res == -1) {
410 " %8.8s %-18.18s %-8.8s %-6.6s %6u%s %6u%s %3u %7.3f %6u%s %6u%s %3u %7.3f %7.3f\n",
416 stats.
rxcount > 100000 ?
"K":
" ",
418 stats.
rxploss > 100000 ?
"K":
" ",
422 stats.
txcount > 100000 ?
"K":
" ",
424 stats.
txploss > 100000 ?
"K":
" ",
438 .
command =
"pjsip list channels",
439 .
usage =
"Usage: pjsip list channels [ like <pattern> ]\n"
440 " List the active PJSIP channels\n"
441 " Optional regular expression pattern is used to filter the list.\n"),
443 .
command =
"pjsip show channels",
444 .
usage =
"Usage: pjsip show channels [ like <pattern> ]\n"
445 " List(detailed) the active PJSIP channels\n"
446 " Optional regular expression pattern is used to filter the list.\n"),
448 .
command =
"pjsip show channel",
449 .
usage =
"Usage: pjsip show channel\n"
450 " List(detailed) the active PJSIP channel\n"),
453 .
command =
"pjsip show channelstats",
454 .
usage =
"Usage: pjsip show channelstats [ like <pattern> ]\n"
455 " List(detailed) the active PJSIP channel stats\n"
456 " Optional regular expression pattern is used to filter the list.\n"),
480 ast_log(
LOG_ERROR,
"Unable to allocate memory for channelstats_formatter\n");
Asterisk main include file. File version handling, generic pbx functions.
static struct ast_mansession session
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define ao2_link(container, obj)
Add an object to a container.
@ AO2_ALLOC_OPT_LOCK_NOLOCK
#define ao2_callback(c, flags, cb_fn, arg)
ao2_callback() is a generic function that applies cb_fn() to all objects in a container,...
int() ao2_callback_fn(void *obj, void *arg, int flags)
Type of a generic callback function.
int() ao2_sort_fn(const void *obj_left, const void *obj_right, int flags)
Type of generic container sort function.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
@ OBJ_SEARCH_PARTIAL_KEY
The arg parameter is a partial search key similar to OBJ_SEARCH_KEY.
@ OBJ_SEARCH_OBJECT
The arg parameter is an object of the same type.
@ OBJ_SEARCH_MASK
Search option field mask.
@ OBJ_SEARCH_KEY
The arg parameter is a search key, but is not an object.
#define ao2_container_alloc_list(ao2_options, container_options, sort_fn, cmp_fn)
Allocate and initialize a list container.
#define ao2_alloc(data_size, destructor_fn)
PJSIP Channel Driver shared data structures.
General Asterisk PBX channel definitions.
void * ast_channel_tech_pvt(const struct ast_channel *chan)
struct ast_format * ast_channel_rawreadformat(struct ast_channel *chan)
#define ast_channel_lock(chan)
const char * ast_state2str(enum ast_channel_state state)
Gives the string form of a given channel state.
struct ast_channel * ast_channel_get_by_name(const char *name)
Find a channel by name.
#define ast_channel_unlock(chan)
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#define AST_CLI_DEFINE(fn, txt,...)
#define ast_cli_register_multiple(e, len)
Register multiple commands.
static int cli_message_to_snapshot(void *obj, void *arg, int flags)
static int cli_channelstats_print_header(void *obj, void *arg, int flags)
static struct ast_cli_entry cli_commands[]
static int cli_channelstats_print_body(void *obj, void *arg, int flags)
static const char * cli_channel_get_id(const void *obj)
static int cli_channel_print_header(void *obj, void *arg, int flags)
static int cli_channelstats_iterate(void *endpoint, ao2_callback_fn callback, void *arg)
static struct ao2_container * cli_channelstats_get_container(const char *regex)
static int cli_channelstats_compare(void *obj, void *arg, int flags)
struct ast_sip_cli_formatter_entry * channelstats_formatter
int pjsip_channel_cli_register(void)
Registers the channel cli commands.
static struct ao2_container * get_container(const char *regex, ao2_sort_fn sort_fn, ao2_callback_fn compare_fn)
static int cli_channel_compare(void *obj, void *arg, int flags)
struct ast_sip_cli_formatter_entry * channel_formatter
static int cli_channel_sort(const void *obj, const void *arg, int flags)
static int cli_channelstats_sort(const void *obj, const void *arg, int flags)
static int cli_channel_iterate(void *endpoint, ao2_callback_fn callback, void *arg)
void pjsip_channel_cli_unregister(void)
Unregisters the channel cli commands.
static int cli_filter_channels(void *obj, void *arg, int flags)
static struct ao2_container * cli_channel_get_container(const char *regex)
static void * cli_channel_retrieve_by_id(const char *id)
static int cli_channel_print_body(void *obj, void *arg, int flags)
PJSIP CLI functions header file.
static int regex(struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len)
struct ast_channel_snapshot * ast_channel_snapshot_get_latest_by_name(const char *name)
Obtain the latest ast_channel_snapshot from the Stasis Message Bus API cache. This is an ao2 object,...
struct ao2_container * ast_channel_cache_by_name(void)
Secondary channel cache, indexed by name.
int ast_sip_for_each_channel(const struct ast_sip_endpoint *endpoint, ao2_callback_fn on_channel_snapshot, void *arg)
For every channel snapshot on an endpoint all the given 'on_channel_snapshot' handler.
int ast_sip_unregister_cli_formatter(struct ast_sip_cli_formatter_entry *formatter)
Unregisters a CLI formatter.
#define CLI_HEADER_FILLER
char * ast_sip_cli_traverse_objects(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define CLI_INDENT_TO_SPACES(x)
int ast_sip_register_cli_formatter(struct ast_sip_cli_formatter_entry *formatter)
Registers a CLI formatter.
@ AST_RTP_INSTANCE_STAT_ALL
int ast_rtp_instance_get_stats(struct ast_rtp_instance *instance, struct ast_rtp_instance_stats *stats, enum ast_rtp_instance_stat stat)
Retrieve statistics about an RTP instance.
Stasis Message Bus API. See Stasis Message Bus API for detailed documentation.
struct ast_stream * ast_stream_topology_get_first_stream_by_type(const struct ast_stream_topology *topology, enum ast_media_type type)
Gets the first active stream of a specific type from the topology.
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
struct timeval creationtime
const ast_string_field type
const ast_string_field name
const ast_string_field exten
const ast_string_field appl
Structure representing a snapshot of channel state.
struct ast_channel_snapshot_connected * connected
struct ast_channel_snapshot_dialplan * dialplan
struct ast_channel_snapshot_bridge * bridge
struct ast_channel_snapshot_base * base
enum ast_channel_state state
Main Channel structure associated with a channel.
struct ast_channel_snapshot * snapshot
descriptor for a cli entry.
A structure which contains a channel implementation and session.
struct ast_sip_session * session
Pointer to session.
CLI Formatter Context passed to all formatters.
CLI Formatter Registry Entry.
int(* iterate)(void *container, ao2_callback_fn callback, void *args)
ao2_callback_fn * print_header
void *(* retrieve_by_id)(const char *id)
const char *(* get_id)(const void *obj)
ao2_callback_fn * print_body
struct ao2_container *(* get_container)(const char *regex)
A structure describing a SIP session.
Time-related functions and macros.
void ast_format_duration_hh_mm_ss(int duration, char *buf, size_t length)
Formats a duration into HH:MM:SS.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.