Debian Codegraph @

res/ari/cli.c

raw symbols SCIP
1 /*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 2013, Digium, Inc.
5 *
6 * David M. Lee, II <[email protected]>
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 <[email protected]>
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
34 static 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
76 static 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 %-4s %s\n",
82 AST_CLI_YESNO(user->read_only),
83 AST_CLI_YESNO(user->acl && !ast_acl_list_is_empty(user->acl)),
84 ast_sorcery_object_get_id(user));
85 return 0;
86 }
87
88 static char *ari_show_users(struct ast_cli_entry *e, int cmd,
89 struct ast_cli_args *a)
90 {
91 RAII_VAR(struct ao2_container *, users, NULL, ao2_cleanup);
92
93 switch (cmd) {
94 case CLI_INIT:
95 e->command = "ari show users";
96 e->usage =
97 "Usage: ari show users\n"
98 " Shows all ARI users\n";
99 return NULL;
100 case CLI_GENERATE:
101 return NULL;
102 default:
103 break;
104 }
105
106 if (a->argc != 3) {
107 return CLI_SHOWUSAGE;
108 }
109
110 users = ari_conf_get_users();
111 if (!users) {
112 ast_cli(a->fd, "Error getting ARI configuration\n");
113 return CLI_FAILURE;
114 }
115
116 ast_cli(a->fd, "r/o? ACL? Username\n");
117 ast_cli(a->fd, "---- ---- --------\n");
118
119 ao2_callback(users, OBJ_NODATA, show_users_cb, a);
120
121 return CLI_SUCCESS;
122 }
123
124 static void complete_sorcery_object(struct ao2_container *container,
125 const char *word)
126 {
127 size_t wordlen = strlen(word);
128 void *object;
129 struct ao2_iterator i = ao2_iterator_init(container, 0);
130
131 while ((object = ao2_iterator_next(&i))) {
132 const char *id = ast_sorcery_object_get_id(object);
133 if (!strncasecmp(word, id, wordlen)) {
134 ast_cli_completion_add(ast_strdup(id));
135 }
136 ao2_ref(object, -1);
137 }
138 ao2_iterator_destroy(&i);
139 }
140
141 static char *ari_show_user(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
142 {
143 RAII_VAR(struct ari_conf_user *, user, NULL, ao2_cleanup);
144 RAII_VAR(struct ao2_container *, users, ari_conf_get_users(), ao2_cleanup);
145
146 if (!users) {
147 ast_cli(a->fd, "Error getting ARI configuration\n");
148 return CLI_FAILURE;
149 }
150
151 switch (cmd) {
152 case CLI_INIT:
153 e->command = "ari show user";
154 e->usage =
155 "Usage: ari show user <username>\n"
156 " Shows a specific ARI user\n";
157 return NULL;
158 case CLI_GENERATE:
159 complete_sorcery_object(users, a->word);
160 return NULL;
161 default:
162 break;
163 }
164
165 if (a->argc != 4) {
166 return CLI_SHOWUSAGE;
167 }
168
169 user = ari_conf_get_user(a->argv[3]);
170 if (!user) {
171 ast_cli(a->fd, "User '%s' not found\n", a->argv[3]);
172 return CLI_SUCCESS;
173 }
174
175 ast_cli(a->fd, "Username: %s\n", ast_sorcery_object_get_id(user));
176 ast_cli(a->fd, "Read only?: %s\n", AST_CLI_YESNO(user->read_only));
177 ast_cli(a->fd, "ACL?: %s\n", AST_CLI_YESNO(user->acl && !ast_acl_list_is_empty(user->acl)));
178 if (!ast_acl_list_is_empty(user->acl)) {
179 ast_acl_output(a->fd, user->acl, NULL);
180 }
181
182 return CLI_SUCCESS;
183 }
184
185 static char *ari_mkpasswd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
186 {
187 RAII_VAR(char *, crypted, NULL, ast_free);
188
189 switch (cmd) {
190 case CLI_INIT:
191 e->command = "ari mkpasswd";
192 e->usage =
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"
198 ;
199 return NULL;
200 case CLI_GENERATE:
201 return NULL;
202 default:
203 break;
204 }
205
206 if (a->argc != 3) {
207 return CLI_SHOWUSAGE;
208 }
209
210 crypted = ast_crypt_encrypt(a->argv[2]);
211 if (!crypted) {
212 ast_cli(a->fd, "Failed to encrypt password\n");
213 return CLI_FAILURE;
214 }
215
216 ast_cli(a->fd,
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);
220
221 return CLI_SUCCESS;
222 }
223
224 static char *ari_show_apps(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
225 {
226 struct ao2_container *apps;
227 struct ao2_iterator it_apps;
228 char *app;
229
230 switch (cmd) {
231 case CLI_INIT:
232 e->command = "ari show apps";
233 e->usage =
234 "Usage: ari show apps\n"
235 " Lists all registered applications.\n"
236 ;
237 return NULL;
238 case CLI_GENERATE:
239 return NULL;
240 default:
241 break;
242 }
243
244 if (a->argc != 3) {
245 return CLI_SHOWUSAGE;
246 }
247
248 apps = stasis_app_get_all();
249 if (!apps) {
250 ast_cli(a->fd, "Unable to retrieve registered applications!\n");
251 return CLI_FAILURE;
252 }
253
254 ast_cli(a->fd, "Application Name \n");
255 ast_cli(a->fd, "=========================\n");
256 it_apps = ao2_iterator_init(apps, 0);
257 while ((app = ao2_iterator_next(&it_apps))) {
258 ast_cli(a->fd, "%s\n", app);
259 ao2_ref(app, -1);
260 }
261
262 ao2_iterator_destroy(&it_apps);
263 ao2_ref(apps, -1);
264
265 return CLI_SUCCESS;
266 }
267
268 static void complete_app(struct ao2_container *container,
269 const char *word)
270 {
271 size_t wordlen = strlen(word);
272 void *object;
273 struct ao2_iterator i = ao2_iterator_init(container, 0);
274
275 while ((object = ao2_iterator_next(&i))) {
276 if (!strncasecmp(word, object, wordlen)) {
277 ast_cli_completion_add(ast_strdup(object));
278 }
279 ao2_ref(object, -1);
280 }
281 ao2_iterator_destroy(&i);
282 }
283
284 static char *ari_show_app(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
285 {
286 void *app;
287 RAII_VAR(struct ao2_container *, apps, stasis_app_get_all(), ao2_cleanup);
288
289 if (!apps) {
290 ast_cli(a->fd, "Error getting ARI applications\n");
291 return CLI_FAILURE;
292 }
293
294 switch (cmd) {
295 case CLI_INIT:
296 e->command = "ari show app";
297 e->usage =
298 "Usage: ari show app <application>\n"
299 " Provide detailed information about a registered application.\n"
300 ;
301 return NULL;
302 case CLI_GENERATE:
303 complete_app(apps, a->word);
304 return NULL;
305 default:
306 break;
307 }
308
309 if (a->argc != 4) {
310 return CLI_SHOWUSAGE;
311 }
312
313 app = stasis_app_get_by_name(a->argv[3]);
314 if (!app) {
315 return CLI_FAILURE;
316 }
317
318 stasis_app_to_cli(app, a);
319
320 ao2_ref(app, -1);
321
322 return CLI_SUCCESS;
323 }
324
325 static char *ari_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
326 {
327 RAII_VAR(struct ao2_container *, apps, stasis_app_get_all(), ao2_cleanup);
328 void *app;
329 int debug;
330
331 if (!apps) {
332 ast_cli(a->fd, "Error getting ARI applications\n");
333 return CLI_FAILURE;
334 }
335
336 switch (cmd) {
337 case CLI_INIT:
338 e->command = "ari set debug";
339 e->usage =
340 "Usage: ari set debug <application|all> <on|off>\n"
341 " Enable or disable debugging on a specific application.\n"
342 ;
343 return NULL;
344 case CLI_GENERATE:
345 if (a->argc == 3) {
346 ast_cli_completion_add(ast_strdup("all"));
347 complete_app(apps, a->word);
348 } else if (a->argc == 4) {
349 ast_cli_completion_add(ast_strdup("on"));
350 ast_cli_completion_add(ast_strdup("off"));
351 }
352 return NULL;
353 default:
354 break;
355 }
356
357 if (a->argc != 5) {
358 return CLI_SHOWUSAGE;
359 }
360
361 debug = !strcmp(a->argv[4], "on");
362
363 if (!strcmp(a->argv[3], "all")) {
364 stasis_app_set_global_debug(debug);
365 ast_cli(a->fd, "Debugging on all applications %s\n",
366 debug ? "enabled" : "disabled");
367 return CLI_SUCCESS;
368 }
369
370 app = stasis_app_get_by_name(a->argv[3]);
371 if (!app) {
372 return CLI_FAILURE;
373 }
374
375 stasis_app_set_debug(app, debug);
376 ast_cli(a->fd, "Debugging on '%s' %s\n",
377 stasis_app_name(app),
378 debug ? "enabled" : "disabled");
379
380 ao2_ref(app, -1);
381
382 return CLI_SUCCESS;
383 }
384
385 static int show_owc_cb(void *obj, void *arg, int flags)
386 {
387 struct ari_conf_outbound_websocket *owc = obj;
388 const char *id = ast_sorcery_object_get_id(owc);
389 enum ari_conf_owc_fields invalid_fields = ari_conf_owc_get_invalid_fields(id);
390 struct ast_cli_args *a = arg;
391
392 ast_cli(a->fd, "%-32s %-15s %-32s %-7s %s\n",
393 id,
394 ari_websocket_type_to_str(owc->websocket_client->connection_type),
395 owc->apps,
396 invalid_fields == ARI_OWC_FIELD_NONE ? "valid" : "INVALID",
397 owc->websocket_client->uri);
398 return 0;
399 }
400
401 #define DASHES "----------------------------------------------------------------------"
402 static char *ari_show_owcs(struct ast_cli_entry *e, int cmd,
403 struct ast_cli_args *a)
404 {
405 RAII_VAR(struct ao2_container *, owcs, NULL, ao2_cleanup);
406
407 switch (cmd) {
408 case CLI_INIT:
409 e->command = "ari show outbound-websockets";
410 e->usage =
411 "Usage: ari show outbound-websockets\n"
412 " Shows all ARI outbound-websockets\n";
413 return NULL;
414 case CLI_GENERATE:
415 return NULL;
416 default:
417 break;
418 }
419
420 if (a->argc != 3) {
421 return CLI_SHOWUSAGE;
422 }
423
424 owcs = ari_conf_get_owcs();
425 if (!owcs) {
426 ast_cli(a->fd, "Error getting ARI configuration\n");
427 return CLI_FAILURE;
428 }
429
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);
432
433 ao2_callback(owcs, OBJ_NODATA, show_owc_cb, a);
434
435 return CLI_SUCCESS;
436 }
437
438 static char *ari_show_owc(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
439 {
440 RAII_VAR(struct ari_conf_outbound_websocket *, owc, NULL, ao2_cleanup);
441 RAII_VAR(struct ao2_container *, owcs, ari_conf_get_owcs(), ao2_cleanup);
442 const char *id = NULL;
443 enum ari_conf_owc_fields invalid_fields;
444
445 switch (cmd) {
446 case CLI_INIT:
447 e->command = "ari show outbound-websocket";
448 e->usage =
449 "Usage: ari show outbound-websocket <connection id>\n"
450 " Shows a specific ARI outbound websocket\n";
451 return NULL;
452 case CLI_GENERATE:
453 complete_sorcery_object(owcs, a->word);
454 return NULL;
455 default:
456 break;
457 }
458
459 if (a->argc != 4) {
460 return CLI_SHOWUSAGE;
461 }
462
463 owc = ari_conf_get_owc(a->argv[3]);
464 if (!owc) {
465 ast_cli(a->fd, "Error getting ARI configuration\n");
466 return CLI_FAILURE;
467 }
468 id = ast_sorcery_object_get_id(owc);
469 invalid_fields = ari_conf_owc_get_invalid_fields(id);
470
471 ast_cli(a->fd, "[%s] %s\n", id,
472 invalid_fields == ARI_OWC_FIELD_NONE ? "" : "**INVALID**");
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,
476 invalid_fields & ARI_OWC_FIELD_APPS ? " (invalid)" : "");
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,
480 invalid_fields & ARI_OWC_FIELD_LOCAL_ARI_USER ? " (invalid)" : "");
481 ast_cli(a->fd, "connection_type = %s\n", ari_websocket_type_to_str(owc->websocket_client->connection_type));
482 ast_cli(a->fd, "subscribe_all = %s\n", AST_CLI_YESNO(owc->subscribe_all));
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);
486 ast_cli(a->fd, "tls_enabled = %s\n", AST_CLI_YESNO(owc->websocket_client->tls_enabled));
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);
491 ast_cli(a->fd, "verify_server = %s\n", AST_CLI_YESNO(owc->websocket_client->verify_server_cert));
492 ast_cli(a->fd, "verify_server_hostname = %s\n", AST_CLI_YESNO(owc->websocket_client->verify_server_hostname));
493 ast_cli(a->fd, "\n");
494
495 return CLI_SUCCESS;
496 }
497
498 static char *ari_start_owc(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
499 {
500 RAII_VAR(struct ari_conf_outbound_websocket *, owc, NULL, ao2_cleanup);
501 RAII_VAR(struct ao2_container *, owcs, ari_conf_get_owcs(), ao2_cleanup);
502
503 if (!owcs) {
504 ast_cli(a->fd, "Error getting ARI configuration\n");
505 return CLI_FAILURE ;
506 }
507
508 switch (cmd) {
509 case CLI_INIT:
510 e->command = "ari start outbound-websocket";
511 e->usage =
512 "Usage: ari start outbound-websocket <connection id>\n"
513 " Starts a specific ARI outbound websocket\n";
514 return NULL;
515 case CLI_GENERATE:
516 complete_sorcery_object(owcs, a->word);
517 return NULL;
518 default:
519 break;
520 }
521
522 if (a->argc != 4) {
523 return CLI_SHOWUSAGE;
524 }
525
526 owc = ari_conf_get_owc(a->argv[3]);
527 if (!owc) {
528 ast_cli(a->fd, "Error getting ARI configuration\n");
529 return CLI_FAILURE;
530 }
531 ast_cli(a->fd, "Starting websocket session for outbound-websocket '%s'\n", a->argv[3]);
532
533 if (ari_outbound_websocket_start(owc) != 0) {
534 ast_cli(a->fd, "Error starting outbound websocket\n");
535 return CLI_FAILURE ;
536 }
537
538 return CLI_SUCCESS;
539 }
540
541 static int show_sessions_cb(void *obj, void *arg, int flags)
542 {
543 struct ari_ws_session *session = obj;
544 struct ast_cli_args *a = arg;
545 char *apps = ast_vector_string_join(&session->websocket_apps, ",");
546
547 ast_cli(a->fd, "%-*s %-15s %-32s %-5s %s\n",
548 AST_UUID_STR_LEN,
549 session->session_id,
550 ari_websocket_type_to_str(session->type),
551 S_OR(session->remote_addr, "N/A"),
552 session->type == AST_WS_TYPE_CLIENT_PER_CALL_CONFIG
553 ? "N/A" : (session->connected ? "Up" : "Down"),
554 S_OR(apps, ""));
555
556 ast_free(apps);
557 return 0;
558 }
559
560 #define DASHES "----------------------------------------------------------------------"
561 static char *ari_show_sessions(struct ast_cli_entry *e, int cmd,
562 struct ast_cli_args *a)
563 {
564 RAII_VAR(struct ao2_container *, sessions, NULL, ao2_cleanup);
565
566 switch (cmd) {
567 case CLI_INIT:
568 e->command = "ari show websocket sessions";
569 e->usage =
570 "Usage: ari show websocket sessions\n"
571 " Shows all ARI websocket sessions\n";
572 return NULL;
573 case CLI_GENERATE:
574 return NULL;
575 default:
576 break;
577 }
578
579 if (a->argc != 4) {
580 return CLI_SHOWUSAGE;
581 }
582
583 sessions = ari_websocket_get_sessions();
584 if (!sessions) {
585 ast_cli(a->fd, "Error getting websocket sessions\n");
586 return CLI_FAILURE;
587 }
588
589 ast_cli(a->fd, "%-*.*s %-15.15s %-32.32s %-5.5s %-16.16s\n",
590 AST_UUID_STR_LEN, AST_UUID_STR_LEN,
591 "Connection ID",
592 "Type",
593 "RemoteAddr",
594 "State",
595 "Apps"
596 );
597 ast_cli(a->fd, "%-*.*s %-15.15s %-32.32s %-5.5s %-16.16s\n",
598 AST_UUID_STR_LEN, AST_UUID_STR_LEN, DASHES, DASHES, DASHES, DASHES, DASHES);
599
600 ao2_callback(sessions, OBJ_NODATA, show_sessions_cb, a);
601
602 return CLI_SUCCESS;
603 }
604
605 static char *ari_shut_sessions(struct ast_cli_entry *e, int cmd,
606 struct ast_cli_args *a)
607 {
608
609 switch (cmd) {
610 case CLI_INIT:
611 e->command = "ari shutdown websocket sessions";
612 e->usage =
613 "Usage: ari shutdown websocket sessions\n"
614 " Shuts down all ARI websocket sessions\n";
615 return NULL;
616 case CLI_GENERATE:
617 return NULL;
618 default:
619 break;
620 }
621
622 if (a->argc != 4) {
623 return CLI_SHOWUSAGE;
624 }
625
626 ast_cli(a->fd, "Shutting down all websocket sessions\n");
627 ari_websocket_shutdown_all();
628
629 return CLI_SUCCESS;
630 }
631
632 static void complete_session(struct ao2_container *container,
633 const char *word)
634 {
635 size_t wordlen = strlen(word);
636 struct ari_ws_session *session;
637 struct ao2_iterator i = ao2_iterator_init(container, 0);
638
639 while ((session = ao2_iterator_next(&i))) {
640 if (!strncasecmp(word, session->session_id, wordlen)) {
641 ast_cli_completion_add(ast_strdup(session->session_id));
642 }
643 ao2_ref(session, -1);
644 }
645 ao2_iterator_destroy(&i);
646 }
647
648 static char *ari_shut_session(struct ast_cli_entry *e, int cmd,
649 struct ast_cli_args *a)
650 {
651 RAII_VAR(struct ari_ws_session *, session, NULL, ao2_cleanup);
652 RAII_VAR(struct ao2_container *, sessions, ari_websocket_get_sessions(), ao2_cleanup);
653
654 if (!sessions) {
655 ast_cli(a->fd, "Error getting ARI configuration\n");
656 return CLI_FAILURE ;
657 }
658
659 switch (cmd) {
660 case CLI_INIT:
661 e->command = "ari shutdown websocket session";
662 e->usage =
663 "Usage: ari shutdown websocket session <id>\n"
664 " Shuts down ARI websocket session\n";
665 return NULL;
666 case CLI_GENERATE:
667 complete_session(sessions, a->word);
668 return NULL;
669 default:
670 break;
671 }
672
673 if (a->argc != 5) {
674 return CLI_SHOWUSAGE;
675 }
676
677 session = ari_websocket_get_session(a->argv[4]);
678 if (!session) {
679 ast_cli(a->fd, "Websocket session '%s' not found\n", a->argv[4]);
680 return CLI_FAILURE ;
681 }
682 ast_cli(a->fd, "Shutting down websocket session '%s'\n", a->argv[4]);
683 ari_websocket_shutdown(session);
684
685 return CLI_SUCCESS;
686 }
687
688 static struct ast_cli_entry cli_ari[] = {
689 AST_CLI_DEFINE(ari_show, "Show ARI settings"),
690 AST_CLI_DEFINE(ari_show_users, "List ARI users"),
691 AST_CLI_DEFINE(ari_show_user, "List single ARI user"),
692 AST_CLI_DEFINE(ari_mkpasswd, "Encrypts a password"),
693 AST_CLI_DEFINE(ari_show_apps, "List registered ARI applications"),
694 AST_CLI_DEFINE(ari_show_app, "Display details of a registered ARI application"),
695 AST_CLI_DEFINE(ari_set_debug, "Enable/disable debugging of an ARI application"),
696 AST_CLI_DEFINE(ari_show_owcs, "List outbound websocket connections"),
697 AST_CLI_DEFINE(ari_show_owc, "Show outbound websocket connection"),
698 AST_CLI_DEFINE(ari_start_owc, "Start outbound websocket connection"),
699 AST_CLI_DEFINE(ari_show_sessions, "Show websocket sessions"),
700 AST_CLI_DEFINE(ari_shut_session, "Shutdown websocket session"),
701 AST_CLI_DEFINE(ari_shut_sessions, "Shutdown websocket sessions"),
702 };
703
704 int ari_cli_register(void) {
705 return ast_cli_register_multiple(cli_ari, ARRAY_LEN(cli_ari));
706 }
707
708 void ari_cli_unregister(void) {
709 ast_cli_unregister_multiple(cli_ari, ARRAY_LEN(cli_ari));
710 }