Asterisk - The Open Source Telephony Project GIT-master-c7a8271
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Modules Pages
res/ari/cli.c
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 2013, Digium, Inc.
5 *
6 * David M. Lee, II <dlee@digium.com>
7 *
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
13 *
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
17 */
18
19/*! \file
20 *
21 * \brief Command line for ARI.
22 * \author David M. Lee, II <dlee@digium.com>
23 */
24
25#include "asterisk.h"
26
27#include "asterisk/astobj2.h"
28#include "asterisk/cli.h"
29#include "asterisk/stasis_app.h"
30#include "asterisk/uuid.h"
31#include "internal.h"
32#include "ari_websockets.h"
33
34static char *ari_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
35{
36 RAII_VAR(struct ari_conf_general *, general, NULL, ao2_cleanup);
37
38 switch (cmd) {
39 case CLI_INIT:
40 e->command = "ari show status";
41 e->usage =
42 "Usage: ari show status\n"
43 " Shows all ARI settings\n";
44 return NULL;
45 case CLI_GENERATE:
46 return NULL;
47 default:
48 break;
49 }
50
51 if (a->argc != 3) {
52 return CLI_SHOWUSAGE;
53 }
54
55 general = ari_conf_get_general();
56
57 if (!general) {
58 ast_cli(a->fd, "Error getting ARI configuration\n");
59 return CLI_FAILURE;
60 }
61
62 ast_cli(a->fd, "ARI Status:\n");
63 ast_cli(a->fd, "Enabled: %s\n", AST_CLI_YESNO(general->enabled));
64 ast_cli(a->fd, "Output format: ");
65 if (general->format & AST_JSON_PRETTY) {
66 ast_cli(a->fd, "pretty");
67 } else {
68 ast_cli(a->fd, "compact");
69 }
70 ast_cli(a->fd, "\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);
73 return CLI_SUCCESS;
74}
75
76static int show_users_cb(void *obj, void *arg, int flags)
77{
78 struct ari_conf_user *user = obj;
79 struct ast_cli_args *a = arg;
80
81 ast_cli(a->fd, "%-4s %s\n",
82 AST_CLI_YESNO(user->read_only),
84 return 0;
85}
86
87static char *ari_show_users(struct ast_cli_entry *e, int cmd,
88 struct ast_cli_args *a)
89{
91
92 switch (cmd) {
93 case CLI_INIT:
94 e->command = "ari show users";
95 e->usage =
96 "Usage: ari show users\n"
97 " Shows all ARI users\n";
98 return NULL;
99 case CLI_GENERATE:
100 return NULL;
101 default:
102 break;
103 }
104
105 if (a->argc != 3) {
106 return CLI_SHOWUSAGE;
107 }
108
110 if (!users) {
111 ast_cli(a->fd, "Error getting ARI configuration\n");
112 return CLI_FAILURE;
113 }
114
115 ast_cli(a->fd, "r/o? Username\n");
116 ast_cli(a->fd, "---- --------\n");
117
119
120 return CLI_SUCCESS;
121}
122
124 const char *word)
125{
126 size_t wordlen = strlen(word);
127 void *object;
129
130 while ((object = ao2_iterator_next(&i))) {
131 const char *id = ast_sorcery_object_get_id(object);
132 if (!strncasecmp(word, id, wordlen)) {
134 }
135 ao2_ref(object, -1);
136 }
138}
139
140static char *ari_show_user(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
141{
144
145 if (!users) {
146 ast_cli(a->fd, "Error getting ARI configuration\n");
147 return CLI_FAILURE;
148 }
149
150 switch (cmd) {
151 case CLI_INIT:
152 e->command = "ari show user";
153 e->usage =
154 "Usage: ari show user <username>\n"
155 " Shows a specific ARI user\n";
156 return NULL;
157 case CLI_GENERATE:
159 return NULL;
160 default:
161 break;
162 }
163
164 if (a->argc != 4) {
165 return CLI_SHOWUSAGE;
166 }
167
168 user = ari_conf_get_user(a->argv[3]);
169 if (!user) {
170 ast_cli(a->fd, "User '%s' not found\n", a->argv[3]);
171 return CLI_SUCCESS;
172 }
173
174 ast_cli(a->fd, "Username: %s\n", ast_sorcery_object_get_id(user));
175 ast_cli(a->fd, "Read only?: %s\n", AST_CLI_YESNO(user->read_only));
176
177 return CLI_SUCCESS;
178}
179
180static char *ari_mkpasswd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
181{
182 RAII_VAR(char *, crypted, NULL, ast_free);
183
184 switch (cmd) {
185 case CLI_INIT:
186 e->command = "ari mkpasswd";
187 e->usage =
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"
193 ;
194 return NULL;
195 case CLI_GENERATE:
196 return NULL;
197 default:
198 break;
199 }
200
201 if (a->argc != 3) {
202 return CLI_SHOWUSAGE;
203 }
204
205 crypted = ast_crypt_encrypt(a->argv[2]);
206 if (!crypted) {
207 ast_cli(a->fd, "Failed to encrypt password\n");
208 return CLI_FAILURE;
209 }
210
211 ast_cli(a->fd,
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);
215
216 return CLI_SUCCESS;
217}
218
219static char *ari_show_apps(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
220{
221 struct ao2_container *apps;
222 struct ao2_iterator it_apps;
223 char *app;
224
225 switch (cmd) {
226 case CLI_INIT:
227 e->command = "ari show apps";
228 e->usage =
229 "Usage: ari show apps\n"
230 " Lists all registered applications.\n"
231 ;
232 return NULL;
233 case CLI_GENERATE:
234 return NULL;
235 default:
236 break;
237 }
238
239 if (a->argc != 3) {
240 return CLI_SHOWUSAGE;
241 }
242
244 if (!apps) {
245 ast_cli(a->fd, "Unable to retrieve registered applications!\n");
246 return CLI_FAILURE;
247 }
248
249 ast_cli(a->fd, "Application Name \n");
250 ast_cli(a->fd, "=========================\n");
251 it_apps = ao2_iterator_init(apps, 0);
252 while ((app = ao2_iterator_next(&it_apps))) {
253 ast_cli(a->fd, "%s\n", app);
254 ao2_ref(app, -1);
255 }
256
257 ao2_iterator_destroy(&it_apps);
258 ao2_ref(apps, -1);
259
260 return CLI_SUCCESS;
261}
262
264 const char *word)
265{
266 size_t wordlen = strlen(word);
267 void *object;
269
270 while ((object = ao2_iterator_next(&i))) {
271 if (!strncasecmp(word, object, wordlen)) {
273 }
274 ao2_ref(object, -1);
275 }
277}
278
279static char *ari_show_app(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
280{
281 void *app;
283
284 if (!apps) {
285 ast_cli(a->fd, "Error getting ARI applications\n");
286 return CLI_FAILURE;
287 }
288
289 switch (cmd) {
290 case CLI_INIT:
291 e->command = "ari show app";
292 e->usage =
293 "Usage: ari show app <application>\n"
294 " Provide detailed information about a registered application.\n"
295 ;
296 return NULL;
297 case CLI_GENERATE:
298 complete_app(apps, a->word);
299 return NULL;
300 default:
301 break;
302 }
303
304 if (a->argc != 4) {
305 return CLI_SHOWUSAGE;
306 }
307
308 app = stasis_app_get_by_name(a->argv[3]);
309 if (!app) {
310 return CLI_FAILURE;
311 }
312
314
315 ao2_ref(app, -1);
316
317 return CLI_SUCCESS;
318}
319
320static char *ari_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
321{
323 void *app;
324 int debug;
325
326 if (!apps) {
327 ast_cli(a->fd, "Error getting ARI applications\n");
328 return CLI_FAILURE;
329 }
330
331 switch (cmd) {
332 case CLI_INIT:
333 e->command = "ari set debug";
334 e->usage =
335 "Usage: ari set debug <application|all> <on|off>\n"
336 " Enable or disable debugging on a specific application.\n"
337 ;
338 return NULL;
339 case CLI_GENERATE:
340 if (a->argc == 3) {
342 complete_app(apps, a->word);
343 } else if (a->argc == 4) {
346 }
347 return NULL;
348 default:
349 break;
350 }
351
352 if (a->argc != 5) {
353 return CLI_SHOWUSAGE;
354 }
355
356 debug = !strcmp(a->argv[4], "on");
357
358 if (!strcmp(a->argv[3], "all")) {
360 ast_cli(a->fd, "Debugging on all applications %s\n",
361 debug ? "enabled" : "disabled");
362 return CLI_SUCCESS;
363 }
364
365 app = stasis_app_get_by_name(a->argv[3]);
366 if (!app) {
367 return CLI_FAILURE;
368 }
369
371 ast_cli(a->fd, "Debugging on '%s' %s\n",
373 debug ? "enabled" : "disabled");
374
375 ao2_ref(app, -1);
376
377 return CLI_SUCCESS;
378}
379
380static int show_owc_cb(void *obj, void *arg, int flags)
381{
382 struct ari_conf_outbound_websocket *owc = obj;
383 const char *id = ast_sorcery_object_get_id(owc);
385 struct ast_cli_args *a = arg;
386
387 ast_cli(a->fd, "%-32s %-15s %-32s %-7s %s\n",
388 id,
390 owc->apps,
391 invalid_fields == ARI_OWC_FIELD_NONE ? "valid" : "INVALID",
392 owc->websocket_client->uri);
393 return 0;
394}
395
396#define DASHES "----------------------------------------------------------------------"
397static char *ari_show_owcs(struct ast_cli_entry *e, int cmd,
398 struct ast_cli_args *a)
399{
400 RAII_VAR(struct ao2_container *, owcs, NULL, ao2_cleanup);
401
402 switch (cmd) {
403 case CLI_INIT:
404 e->command = "ari show outbound-websockets";
405 e->usage =
406 "Usage: ari show outbound-websockets\n"
407 " Shows all ARI outbound-websockets\n";
408 return NULL;
409 case CLI_GENERATE:
410 return NULL;
411 default:
412 break;
413 }
414
415 if (a->argc != 3) {
416 return CLI_SHOWUSAGE;
417 }
418
419 owcs = ari_conf_get_owcs();
420 if (!owcs) {
421 ast_cli(a->fd, "Error getting ARI configuration\n");
422 return CLI_FAILURE;
423 }
424
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);
427
429
430 return CLI_SUCCESS;
431}
432
433static char *ari_show_owc(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
434{
437 const char *id = NULL;
438 enum ari_conf_owc_fields invalid_fields;
439
440 switch (cmd) {
441 case CLI_INIT:
442 e->command = "ari show outbound-websocket";
443 e->usage =
444 "Usage: ari show outbound-websocket <connection id>\n"
445 " Shows a specific ARI outbound websocket\n";
446 return NULL;
447 case CLI_GENERATE:
448 complete_sorcery_object(owcs, a->word);
449 return NULL;
450 default:
451 break;
452 }
453
454 if (a->argc != 4) {
455 return CLI_SHOWUSAGE;
456 }
457
458 owc = ari_conf_get_owc(a->argv[3]);
459 if (!owc) {
460 ast_cli(a->fd, "Error getting ARI configuration\n");
461 return CLI_FAILURE;
462 }
464 invalid_fields = ari_conf_owc_get_invalid_fields(id);
465
466 ast_cli(a->fd, "[%s] %s\n", id,
467 invalid_fields == ARI_OWC_FIELD_NONE ? "" : "**INVALID**");
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,
471 invalid_fields & ARI_OWC_FIELD_APPS ? " (invalid)" : "");
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,
475 invalid_fields & ARI_OWC_FIELD_LOCAL_ARI_USER ? " (invalid)" : "");
476 ast_cli(a->fd, "connection_type = %s\n", ari_websocket_type_to_str(owc->websocket_client->connection_type));
477 ast_cli(a->fd, "subscribe_all = %s\n", AST_CLI_YESNO(owc->subscribe_all));
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);
481 ast_cli(a->fd, "tls_enabled = %s\n", AST_CLI_YESNO(owc->websocket_client->tls_enabled));
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);
486 ast_cli(a->fd, "verify_server = %s\n", AST_CLI_YESNO(owc->websocket_client->verify_server_cert));
487 ast_cli(a->fd, "verify_server_hostname = %s\n", AST_CLI_YESNO(owc->websocket_client->verify_server_hostname));
488 ast_cli(a->fd, "\n");
489
490 return CLI_SUCCESS;
491}
492
493static char *ari_start_owc(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
494{
497
498 if (!owcs) {
499 ast_cli(a->fd, "Error getting ARI configuration\n");
500 return CLI_FAILURE ;
501 }
502
503 switch (cmd) {
504 case CLI_INIT:
505 e->command = "ari start outbound-websocket";
506 e->usage =
507 "Usage: ari start outbound-websocket <connection id>\n"
508 " Starts a specific ARI outbound websocket\n";
509 return NULL;
510 case CLI_GENERATE:
511 complete_sorcery_object(owcs, a->word);
512 return NULL;
513 default:
514 break;
515 }
516
517 if (a->argc != 4) {
518 return CLI_SHOWUSAGE;
519 }
520
521 owc = ari_conf_get_owc(a->argv[3]);
522 if (!owc) {
523 ast_cli(a->fd, "Error getting ARI configuration\n");
524 return CLI_FAILURE;
525 }
526 ast_cli(a->fd, "Starting websocket session for outbound-websocket '%s'\n", a->argv[3]);
527
528 if (ari_outbound_websocket_start(owc) != 0) {
529 ast_cli(a->fd, "Error starting outbound websocket\n");
530 return CLI_FAILURE ;
531 }
532
533 return CLI_SUCCESS;
534}
535
536static int show_sessions_cb(void *obj, void *arg, int flags)
537{
538 struct ari_ws_session *session = obj;
539 struct ast_cli_args *a = arg;
540 char *apps = ast_vector_string_join(&session->websocket_apps, ",");
541
542 ast_cli(a->fd, "%-*s %-15s %-32s %-5s %s\n",
544 session->session_id,
546 S_OR(session->remote_addr, "N/A"),
548 ? "N/A" : (session->connected ? "Up" : "Down"),
549 S_OR(apps, ""));
550
551 ast_free(apps);
552 return 0;
553}
554
555#define DASHES "----------------------------------------------------------------------"
556static char *ari_show_sessions(struct ast_cli_entry *e, int cmd,
557 struct ast_cli_args *a)
558{
560
561 switch (cmd) {
562 case CLI_INIT:
563 e->command = "ari show websocket sessions";
564 e->usage =
565 "Usage: ari show websocket sessions\n"
566 " Shows all ARI websocket sessions\n";
567 return NULL;
568 case CLI_GENERATE:
569 return NULL;
570 default:
571 break;
572 }
573
574 if (a->argc != 4) {
575 return CLI_SHOWUSAGE;
576 }
577
579 if (!sessions) {
580 ast_cli(a->fd, "Error getting websocket sessions\n");
581 return CLI_FAILURE;
582 }
583
584 ast_cli(a->fd, "%-*.*s %-15.15s %-32.32s %-5.5s %-16.16s\n",
586 "Connection ID",
587 "Type",
588 "RemoteAddr",
589 "State",
590 "Apps"
591 );
592 ast_cli(a->fd, "%-*.*s %-15.15s %-32.32s %-5.5s %-16.16s\n",
594
596
597 return CLI_SUCCESS;
598}
599
600static char *ari_shut_sessions(struct ast_cli_entry *e, int cmd,
601 struct ast_cli_args *a)
602{
603
604 switch (cmd) {
605 case CLI_INIT:
606 e->command = "ari shutdown websocket sessions";
607 e->usage =
608 "Usage: ari shutdown websocket sessions\n"
609 " Shuts down all ARI websocket sessions\n";
610 return NULL;
611 case CLI_GENERATE:
612 return NULL;
613 default:
614 break;
615 }
616
617 if (a->argc != 4) {
618 return CLI_SHOWUSAGE;
619 }
620
621 ast_cli(a->fd, "Shutting down all websocket sessions\n");
623
624 return CLI_SUCCESS;
625}
626
628 const char *word)
629{
630 size_t wordlen = strlen(word);
631 struct ari_ws_session *session;
633
634 while ((session = ao2_iterator_next(&i))) {
635 if (!strncasecmp(word, session->session_id, wordlen)) {
637 }
638 ao2_ref(session, -1);
639 }
641}
642
643static char *ari_shut_session(struct ast_cli_entry *e, int cmd,
644 struct ast_cli_args *a)
645{
648
649 if (!sessions) {
650 ast_cli(a->fd, "Error getting ARI configuration\n");
651 return CLI_FAILURE ;
652 }
653
654 switch (cmd) {
655 case CLI_INIT:
656 e->command = "ari shutdown websocket session";
657 e->usage =
658 "Usage: ari shutdown websocket session <id>\n"
659 " Shuts down ARI websocket session\n";
660 return NULL;
661 case CLI_GENERATE:
663 return NULL;
664 default:
665 break;
666 }
667
668 if (a->argc != 5) {
669 return CLI_SHOWUSAGE;
670 }
671
673 if (!session) {
674 ast_cli(a->fd, "Websocket session '%s' not found\n", a->argv[4]);
675 return CLI_FAILURE ;
676 }
677 ast_cli(a->fd, "Shutting down websocket session '%s'\n", a->argv[4]);
679
680 return CLI_SUCCESS;
681}
682
683static struct ast_cli_entry cli_ari[] = {
684 AST_CLI_DEFINE(ari_show, "Show ARI settings"),
685 AST_CLI_DEFINE(ari_show_users, "List ARI users"),
686 AST_CLI_DEFINE(ari_show_user, "List single ARI user"),
687 AST_CLI_DEFINE(ari_mkpasswd, "Encrypts a password"),
688 AST_CLI_DEFINE(ari_show_apps, "List registered ARI applications"),
689 AST_CLI_DEFINE(ari_show_app, "Display details of a registered ARI application"),
690 AST_CLI_DEFINE(ari_set_debug, "Enable/disable debugging of an ARI application"),
691 AST_CLI_DEFINE(ari_show_owcs, "List outbound websocket connections"),
692 AST_CLI_DEFINE(ari_show_owc, "Show outbound websocket connection"),
693 AST_CLI_DEFINE(ari_start_owc, "Start outbound websocket connection"),
694 AST_CLI_DEFINE(ari_show_sessions, "Show websocket sessions"),
695 AST_CLI_DEFINE(ari_shut_session, "Shutdown websocket session"),
696 AST_CLI_DEFINE(ari_shut_sessions, "Shutdown websocket sessions"),
697};
698
701}
702
705}
static const char app[]
Definition: app_adsiprog.c:56
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_free(a)
Definition: astmm.h:180
#define ast_strdup(str)
A wrapper for strdup()
Definition: astmm.h:241
#define ao2_iterator_next(iter)
Definition: astobj2.h:1911
#define ao2_callback(c, flags, cb_fn, arg)
ao2_callback() is a generic function that applies cb_fn() to all objects in a container,...
Definition: astobj2.h:1693
#define ao2_cleanup(obj)
Definition: astobj2.h:1934
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.
Definition: astobj2.h:459
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
@ OBJ_NODATA
Definition: astobj2.h:1044
static struct unistimsession * sessions
Standard Command Line Interface.
#define CLI_SHOWUSAGE
Definition: cli.h:45
#define AST_CLI_YESNO(x)
Return Yes or No depending on the argument.
Definition: cli.h:71
#define CLI_SUCCESS
Definition: cli.h:44
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
Definition: clicompat.c:30
#define AST_CLI_DEFINE(fn, txt,...)
Definition: cli.h:197
int ast_cli_completion_add(char *value)
Add a result to a request for completion options.
Definition: main/cli.c:2768
void ast_cli(int fd, const char *fmt,...)
Definition: clicompat.c:6
@ CLI_INIT
Definition: cli.h:152
@ CLI_GENERATE
Definition: cli.h:153
#define CLI_FAILURE
Definition: cli.h:46
#define ast_cli_register_multiple(e, len)
Register multiple commands.
Definition: cli.h:265
short word
@ AST_WS_TYPE_CLIENT_PER_CALL_CONFIG
Internal API's for res_ari.
ari_conf_owc_fields
Definition: internal.h:96
@ ARI_OWC_FIELD_APPS
Definition: internal.h:99
@ ARI_OWC_FIELD_NONE
Definition: internal.h:97
@ ARI_OWC_FIELD_LOCAL_ARI_USER
Definition: internal.h:100
@ AST_JSON_PRETTY
Definition: json.h:795
static struct apps apps
static char * ari_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Definition: res/ari/cli.c:34
static int show_owc_cb(void *obj, void *arg, int flags)
Definition: res/ari/cli.c:380
static char * ari_mkpasswd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Definition: res/ari/cli.c:180
static char * ari_show_apps(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Definition: res/ari/cli.c:219
static char * ari_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Definition: res/ari/cli.c:320
static int show_sessions_cb(void *obj, void *arg, int flags)
Definition: res/ari/cli.c:536
static void complete_sorcery_object(struct ao2_container *container, const char *word)
Definition: res/ari/cli.c:123
static char * ari_show_sessions(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Definition: res/ari/cli.c:556
static char * ari_show_owc(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Definition: res/ari/cli.c:433
static int show_users_cb(void *obj, void *arg, int flags)
Definition: res/ari/cli.c:76
static char * ari_shut_session(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Definition: res/ari/cli.c:643
static char * ari_show_app(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Definition: res/ari/cli.c:279
static struct ast_cli_entry cli_ari[]
Definition: res/ari/cli.c:683
static void complete_app(struct ao2_container *container, const char *word)
Definition: res/ari/cli.c:263
static char * ari_show_owcs(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Definition: res/ari/cli.c:397
static char * ari_shut_sessions(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Definition: res/ari/cli.c:600
#define DASHES
Definition: res/ari/cli.c:555
static char * ari_show_users(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Definition: res/ari/cli.c:87
static char * ari_start_owc(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Definition: res/ari/cli.c:493
static void complete_session(struct ao2_container *container, const char *word)
Definition: res/ari/cli.c:627
void ari_cli_unregister(void)
Unregister CLI commands for ARI.
Definition: res/ari/cli.c:703
static char * ari_show_user(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Definition: res/ari/cli.c:140
int ari_cli_register(void)
Register CLI commands for ARI.
Definition: res/ari/cli.c:699
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
Definition: res_fax.c:531
static int debug
Global debug status.
Definition: res_xmpp.c:570
#define NULL
Definition: resample.c:96
const char * ast_sorcery_object_get_id(const void *object)
Get the unique identifier of a sorcery object.
Definition: sorcery.c:2317
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.
Definition: res_stasis.c:1742
struct ao2_container * stasis_app_get_all(void)
Gets the names of all registered Stasis applications.
Definition: res_stasis.c:1769
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.
Definition: strings.h:80
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
Definition: strings.h:87
Generic container type.
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Definition: astobj2.h:1821
Registered applications container.
Definition: pbx_app.c:68
Global configuration options for ARI.
Definition: internal.h:57
const ast_string_field apps
Definition: internal.h:116
struct ast_websocket_client * websocket_client
Definition: internal.h:119
Per-user configuration options.
Definition: internal.h:84
descriptor for a cli entry.
Definition: cli.h:171
char * command
Definition: cli.h:186
const char * usage
Definition: cli.h:177
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
static struct test_val a
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
Definition: utils.h:941
#define ARRAY_LEN(a)
Definition: utils.h:666
char * ast_crypt_encrypt(const char *key)
Asterisk wrapper around crypt(3) for encrypting passwords.
Definition: crypt.c:190
Universally unique identifier support.
#define AST_UUID_STR_LEN
Definition: uuid.h:27
char * ast_vector_string_join(struct ast_vector_string *vec, const char *delim)
Join the elements of a string vector into a single string.
Definition: strings.c:406