42 "Usage: ari show status\n"
43 " Shows all ARI settings\n";
58 ast_cli(
a->fd,
"Error getting ARI configuration\n");
71 ast_cli(
a->fd,
"Auth realm: %s\n", general->auth_realm);
72 ast_cli(
a->fd,
"Allowed Origins: %s\n", general->allowed_origins);
96 "Usage: ari show users\n"
97 " Shows all ARI users\n";
111 ast_cli(
a->fd,
"Error getting ARI configuration\n");
126 size_t wordlen = strlen(
word);
132 if (!strncasecmp(
word,
id, wordlen)) {
146 ast_cli(
a->fd,
"Error getting ARI configuration\n");
154 "Usage: ari show user <username>\n"
155 " Shows a specific ARI user\n";
170 ast_cli(
a->fd,
"User '%s' not found\n",
a->argv[3]);
188 "Usage: ari mkpasswd <password>\n"
189 " Encrypts a password for use in ari.conf\n"
190 " Be aware that the password will be shown in the\n"
191 " command line history. The mkpasswd shell command\n"
192 " may be preferable.\n"
207 ast_cli(
a->fd,
"Failed to encrypt password\n");
212 "; Copy the following two lines into ari.conf\n");
213 ast_cli(
a->fd,
"password_format = crypt\n");
214 ast_cli(
a->fd,
"password = %s\n", crypted);
229 "Usage: ari show apps\n"
230 " Lists all registered applications.\n"
245 ast_cli(
a->fd,
"Unable to retrieve registered applications!\n");
249 ast_cli(
a->fd,
"Application Name \n");
250 ast_cli(
a->fd,
"=========================\n");
266 size_t wordlen = strlen(
word);
271 if (!strncasecmp(
word,
object, wordlen)) {
285 ast_cli(
a->fd,
"Error getting ARI applications\n");
293 "Usage: ari show app <application>\n"
294 " Provide detailed information about a registered application.\n"
327 ast_cli(
a->fd,
"Error getting ARI applications\n");
335 "Usage: ari set debug <application|all> <on|off>\n"
336 " Enable or disable debugging on a specific application.\n"
343 }
else if (
a->argc == 4) {
356 debug = !strcmp(
a->argv[4],
"on");
358 if (!strcmp(
a->argv[3],
"all")) {
360 ast_cli(
a->fd,
"Debugging on all applications %s\n",
361 debug ?
"enabled" :
"disabled");
371 ast_cli(
a->fd,
"Debugging on '%s' %s\n",
373 debug ?
"enabled" :
"disabled");
387 ast_cli(
a->fd,
"%-32s %-15s %-32s %-7s %s\n",
396#define DASHES "----------------------------------------------------------------------"
404 e->
command =
"ari show outbound-websockets";
406 "Usage: ari show outbound-websockets\n"
407 " Shows all ARI outbound-websockets\n";
421 ast_cli(
a->fd,
"Error getting ARI configuration\n");
425 ast_cli(
a->fd,
"%-32s %-15s %-32s %-7s %s\n",
"Name",
"Type",
"Apps",
"Status",
"URI");
426 ast_cli(
a->fd,
"%.*s %.*s %.*s %.*s %.*s\n", 32,
DASHES, 15,
DASHES, 32,
DASHES, 7,
DASHES, 64,
DASHES);
437 const char *
id =
NULL;
442 e->
command =
"ari show outbound-websocket";
444 "Usage: ari show outbound-websocket <connection id>\n"
445 " Shows a specific ARI outbound websocket\n";
460 ast_cli(
a->fd,
"Error getting ARI configuration\n");
468 ast_cli(
a->fd,
"uri = %s\n", owc->websocket_client->uri);
469 ast_cli(
a->fd,
"protocols = %s\n", owc->websocket_client->protocols);
470 ast_cli(
a->fd,
"apps = %s%s\n", owc->apps,
472 ast_cli(
a->fd,
"username = %s\n", owc->websocket_client->username);
473 ast_cli(
a->fd,
"password = %s\n",
S_COR(owc->websocket_client->password,
"********",
""));
474 ast_cli(
a->fd,
"local_ari_user = %s%s\n", owc->local_ari_user,
478 ast_cli(
a->fd,
"connec_timeout = %d\n", owc->websocket_client->connect_timeout);
479 ast_cli(
a->fd,
"reconnect_attempts = %d\n", owc->websocket_client->reconnect_attempts);
480 ast_cli(
a->fd,
"reconnect_interval = %d\n", owc->websocket_client->reconnect_interval);
482 ast_cli(
a->fd,
"ca_list_file = %s\n", owc->websocket_client->ca_list_file);
483 ast_cli(
a->fd,
"ca_list_path = %s\n", owc->websocket_client->ca_list_path);
484 ast_cli(
a->fd,
"cert_file = %s\n", owc->websocket_client->cert_file);
485 ast_cli(
a->fd,
"priv_key_file = %s\n", owc->websocket_client->priv_key_file);
487 ast_cli(
a->fd,
"verify_server_hostname = %s\n",
AST_CLI_YESNO(owc->websocket_client->verify_server_hostname));
499 ast_cli(
a->fd,
"Error getting ARI configuration\n");
505 e->
command =
"ari start outbound-websocket";
507 "Usage: ari start outbound-websocket <connection id>\n"
508 " Starts a specific ARI outbound websocket\n";
523 ast_cli(
a->fd,
"Error getting ARI configuration\n");
526 ast_cli(
a->fd,
"Starting websocket session for outbound-websocket '%s'\n",
a->argv[3]);
529 ast_cli(
a->fd,
"Error starting outbound websocket\n");
542 ast_cli(
a->fd,
"%-*s %-15s %-32s %-5s %s\n",
548 ?
"N/A" : (
session->connected ?
"Up" :
"Down"),
555#define DASHES "----------------------------------------------------------------------"
563 e->
command =
"ari show websocket sessions";
565 "Usage: ari show websocket sessions\n"
566 " Shows all ARI websocket sessions\n";
580 ast_cli(
a->fd,
"Error getting websocket sessions\n");
584 ast_cli(
a->fd,
"%-*.*s %-15.15s %-32.32s %-5.5s %-16.16s\n",
592 ast_cli(
a->fd,
"%-*.*s %-15.15s %-32.32s %-5.5s %-16.16s\n",
606 e->
command =
"ari shutdown websocket sessions";
608 "Usage: ari shutdown websocket sessions\n"
609 " Shuts down all ARI websocket sessions\n";
621 ast_cli(
a->fd,
"Shutting down all websocket sessions\n");
630 size_t wordlen = strlen(
word);
635 if (!strncasecmp(
word,
session->session_id, wordlen)) {
650 ast_cli(
a->fd,
"Error getting ARI configuration\n");
656 e->
command =
"ari shutdown websocket session";
658 "Usage: ari shutdown websocket session <id>\n"
659 " Shuts down ARI websocket session\n";
674 ast_cli(
a->fd,
"Websocket session '%s' not found\n",
a->argv[4]);
677 ast_cli(
a->fd,
"Shutting down websocket session '%s'\n",
a->argv[4]);
int ari_outbound_websocket_start(struct ari_conf_outbound_websocket *owc)
struct ari_ws_session * ari_websocket_get_session(const char *session_id)
void ari_websocket_shutdown_all(void)
void ari_websocket_shutdown(struct ari_ws_session *session)
struct ao2_container * ari_websocket_get_sessions(void)
Internal API's for websockets.
const char * ari_websocket_type_to_str(enum ast_websocket_type type)
Asterisk main include file. File version handling, generic pbx functions.
static struct ast_mansession session
#define ast_strdup(str)
A wrapper for strdup()
#define ao2_iterator_next(iter)
#define ao2_callback(c, flags, cb_fn, arg)
ao2_callback() is a generic function that applies cb_fn() to all objects in a container,...
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
static struct unistimsession * sessions
Standard Command Line Interface.
#define AST_CLI_YESNO(x)
Return Yes or No depending on the argument.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#define AST_CLI_DEFINE(fn, txt,...)
int ast_cli_completion_add(char *value)
Add a result to a request for completion options.
void ast_cli(int fd, const char *fmt,...)
#define ast_cli_register_multiple(e, len)
Register multiple commands.
@ AST_WS_TYPE_CLIENT_PER_CALL_CONFIG
Internal API's for res_ari.
@ ARI_OWC_FIELD_LOCAL_ARI_USER
static char * ari_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int show_owc_cb(void *obj, void *arg, int flags)
static char * ari_mkpasswd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * ari_show_apps(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * ari_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int show_sessions_cb(void *obj, void *arg, int flags)
static void complete_sorcery_object(struct ao2_container *container, const char *word)
static char * ari_show_sessions(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * ari_show_owc(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int show_users_cb(void *obj, void *arg, int flags)
static char * ari_shut_session(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * ari_show_app(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static struct ast_cli_entry cli_ari[]
static void complete_app(struct ao2_container *container, const char *word)
static char * ari_show_owcs(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * ari_shut_sessions(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * ari_show_users(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * ari_start_owc(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static void complete_session(struct ao2_container *container, const char *word)
void ari_cli_unregister(void)
Unregister CLI commands for ARI.
static char * ari_show_user(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
int ari_cli_register(void)
Register CLI commands for ARI.
enum ari_conf_owc_fields ari_conf_owc_get_invalid_fields(const char *id)
struct ao2_container * ari_conf_get_owcs(void)
struct ao2_container * ari_conf_get_users(void)
struct ari_conf_general * ari_conf_get_general(void)
struct ari_conf_outbound_websocket * ari_conf_get_owc(const char *id)
struct ari_conf_user * ari_conf_get_user(const char *username)
struct ao2_container * container
static int debug
Global debug status.
const char * ast_sorcery_object_get_id(const void *object)
Get the unique identifier of a sorcery object.
Stasis Application API. See Stasis Application API for detailed documentation.
void stasis_app_set_debug(struct stasis_app *app, int debug)
Enable/disable request/response and event logging on an application.
void stasis_app_set_global_debug(int debug)
Enable/disable request/response and event logging on all applications.
void stasis_app_to_cli(const struct stasis_app *app, struct ast_cli_args *a)
Dump properties of a stasis_app to the CLI.
struct stasis_app * stasis_app_get_by_name(const char *name)
Retrieve a handle to a Stasis application by its name.
struct ao2_container * stasis_app_get_all(void)
Gets the names of all registered Stasis applications.
const char * stasis_app_name(const struct stasis_app *app)
Retrieve an application's name.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one.
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Registered applications container.
Global configuration options for ARI.
const ast_string_field apps
struct ast_websocket_client * websocket_client
Per-user configuration options.
descriptor for a cli entry.
const ast_string_field uri
enum ast_websocket_type connection_type
structure to hold users read from users.conf
list of users found in the config file
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
char * ast_crypt_encrypt(const char *key)
Asterisk wrapper around crypt(3) for encrypting passwords.
Universally unique identifier support.
char * ast_vector_string_join(struct ast_vector_string *vec, const char *delim)
Join the elements of a string vector into a single string.