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);
97 "Usage: ari show users\n"
98 " Shows all ARI users\n";
112 ast_cli(
a->fd,
"Error getting ARI configuration\n");
116 ast_cli(
a->fd,
"r/o? ACL? Username\n");
117 ast_cli(
a->fd,
"---- ---- --------\n");
127 size_t wordlen = strlen(
word);
133 if (!strncasecmp(
word,
id, wordlen)) {
147 ast_cli(
a->fd,
"Error getting ARI configuration\n");
155 "Usage: ari show user <username>\n"
156 " Shows a specific ARI user\n";
171 ast_cli(
a->fd,
"User '%s' not found\n",
a->argv[3]);
193 "Usage: ari mkpasswd <password>\n"
194 " Encrypts a password for use in ari.conf\n"
195 " Be aware that the password will be shown in the\n"
196 " command line history. The mkpasswd shell command\n"
197 " may be preferable.\n"
212 ast_cli(
a->fd,
"Failed to encrypt password\n");
217 "; Copy the following two lines into ari.conf\n");
218 ast_cli(
a->fd,
"password_format = crypt\n");
219 ast_cli(
a->fd,
"password = %s\n", crypted);
234 "Usage: ari show apps\n"
235 " Lists all registered applications.\n"
250 ast_cli(
a->fd,
"Unable to retrieve registered applications!\n");
254 ast_cli(
a->fd,
"Application Name \n");
255 ast_cli(
a->fd,
"=========================\n");
271 size_t wordlen = strlen(
word);
276 if (!strncasecmp(
word,
object, wordlen)) {
290 ast_cli(
a->fd,
"Error getting ARI applications\n");
298 "Usage: ari show app <application>\n"
299 " Provide detailed information about a registered application.\n"
332 ast_cli(
a->fd,
"Error getting ARI applications\n");
340 "Usage: ari set debug <application|all> <on|off>\n"
341 " Enable or disable debugging on a specific application.\n"
348 }
else if (
a->argc == 4) {
361 debug = !strcmp(
a->argv[4],
"on");
363 if (!strcmp(
a->argv[3],
"all")) {
365 ast_cli(
a->fd,
"Debugging on all applications %s\n",
366 debug ?
"enabled" :
"disabled");
376 ast_cli(
a->fd,
"Debugging on '%s' %s\n",
378 debug ?
"enabled" :
"disabled");
392 ast_cli(
a->fd,
"%-32s %-15s %-32s %-7s %s\n",
401#define DASHES "----------------------------------------------------------------------"
409 e->
command =
"ari show outbound-websockets";
411 "Usage: ari show outbound-websockets\n"
412 " Shows all ARI outbound-websockets\n";
426 ast_cli(
a->fd,
"Error getting ARI configuration\n");
430 ast_cli(
a->fd,
"%-32s %-15s %-32s %-7s %s\n",
"Name",
"Type",
"Apps",
"Status",
"URI");
431 ast_cli(
a->fd,
"%.*s %.*s %.*s %.*s %.*s\n", 32,
DASHES, 15,
DASHES, 32,
DASHES, 7,
DASHES, 64,
DASHES);
442 const char *
id =
NULL;
447 e->
command =
"ari show outbound-websocket";
449 "Usage: ari show outbound-websocket <connection id>\n"
450 " Shows a specific ARI outbound websocket\n";
465 ast_cli(
a->fd,
"Error getting ARI configuration\n");
473 ast_cli(
a->fd,
"uri = %s\n", owc->websocket_client->uri);
474 ast_cli(
a->fd,
"protocols = %s\n", owc->websocket_client->protocols);
475 ast_cli(
a->fd,
"apps = %s%s\n", owc->apps,
477 ast_cli(
a->fd,
"username = %s\n", owc->websocket_client->username);
478 ast_cli(
a->fd,
"password = %s\n",
S_COR(owc->websocket_client->password,
"********",
""));
479 ast_cli(
a->fd,
"local_ari_user = %s%s\n", owc->local_ari_user,
483 ast_cli(
a->fd,
"connec_timeout = %d\n", owc->websocket_client->connect_timeout);
484 ast_cli(
a->fd,
"reconnect_attempts = %d\n", owc->websocket_client->reconnect_attempts);
485 ast_cli(
a->fd,
"reconnect_interval = %d\n", owc->websocket_client->reconnect_interval);
487 ast_cli(
a->fd,
"ca_list_file = %s\n", owc->websocket_client->ca_list_file);
488 ast_cli(
a->fd,
"ca_list_path = %s\n", owc->websocket_client->ca_list_path);
489 ast_cli(
a->fd,
"cert_file = %s\n", owc->websocket_client->cert_file);
490 ast_cli(
a->fd,
"priv_key_file = %s\n", owc->websocket_client->priv_key_file);
492 ast_cli(
a->fd,
"verify_server_hostname = %s\n",
AST_CLI_YESNO(owc->websocket_client->verify_server_hostname));
504 ast_cli(
a->fd,
"Error getting ARI configuration\n");
510 e->
command =
"ari start outbound-websocket";
512 "Usage: ari start outbound-websocket <connection id>\n"
513 " Starts a specific ARI outbound websocket\n";
528 ast_cli(
a->fd,
"Error getting ARI configuration\n");
531 ast_cli(
a->fd,
"Starting websocket session for outbound-websocket '%s'\n",
a->argv[3]);
534 ast_cli(
a->fd,
"Error starting outbound websocket\n");
547 ast_cli(
a->fd,
"%-*s %-15s %-32s %-5s %s\n",
553 ?
"N/A" : (
session->connected ?
"Up" :
"Down"),
560#define DASHES "----------------------------------------------------------------------"
568 e->
command =
"ari show websocket sessions";
570 "Usage: ari show websocket sessions\n"
571 " Shows all ARI websocket sessions\n";
585 ast_cli(
a->fd,
"Error getting websocket sessions\n");
589 ast_cli(
a->fd,
"%-*.*s %-15.15s %-32.32s %-5.5s %-16.16s\n",
597 ast_cli(
a->fd,
"%-*.*s %-15.15s %-32.32s %-5.5s %-16.16s\n",
611 e->
command =
"ari shutdown websocket sessions";
613 "Usage: ari shutdown websocket sessions\n"
614 " Shuts down all ARI websocket sessions\n";
626 ast_cli(
a->fd,
"Shutting down all websocket sessions\n");
635 size_t wordlen = strlen(
word);
640 if (!strncasecmp(
word,
session->session_id, wordlen)) {
655 ast_cli(
a->fd,
"Error getting ARI configuration\n");
661 e->
command =
"ari shutdown websocket session";
663 "Usage: ari shutdown websocket session <id>\n"
664 " Shuts down ARI websocket session\n";
679 ast_cli(
a->fd,
"Websocket session '%s' not found\n",
a->argv[4]);
682 ast_cli(
a->fd,
"Shutting down websocket session '%s'\n",
a->argv[4]);
void ast_acl_output(int fd, struct ast_acl_list *acl, const char *prefix)
output an ACL to the provided fd
int ast_acl_list_is_empty(struct ast_acl_list *acl_list)
Determines if an ACL is empty or if it contains entries.
void ast_cli_unregister_multiple(void)
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.
#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 phoneprov_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.