Asterisk - The Open Source Telephony Project GIT-master-80b953f
Loading...
Searching...
No Matches
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 %-4s %s\n",
82 AST_CLI_YESNO(user->read_only),
85 return 0;
86}
87
88static char *ari_show_users(struct ast_cli_entry *e, int cmd,
89 struct ast_cli_args *a)
90{
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
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
120
121 return CLI_SUCCESS;
122}
123
125 const char *word)
126{
127 size_t wordlen = strlen(word);
128 void *object;
130
131 while ((object = ao2_iterator_next(&i))) {
132 const char *id = ast_sorcery_object_get_id(object);
133 if (!strncasecmp(word, id, wordlen)) {
135 }
136 ao2_ref(object, -1);
137 }
139}
140
141static char *ari_show_user(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
142{
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:
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
185static 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
224static 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
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
269 const char *word)
270{
271 size_t wordlen = strlen(word);
272 void *object;
274
275 while ((object = ao2_iterator_next(&i))) {
276 if (!strncasecmp(word, object, wordlen)) {
278 }
279 ao2_ref(object, -1);
280 }
282}
283
284static char *ari_show_app(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
285{
286 void *app;
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
319
320 ao2_ref(app, -1);
321
322 return CLI_SUCCESS;
323}
324
325static char *ari_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
326{
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) {
347 complete_app(apps, a->word);
348 } else if (a->argc == 4) {
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")) {
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
376 ast_cli(a->fd, "Debugging on '%s' %s\n",
378 debug ? "enabled" : "disabled");
379
380 ao2_ref(app, -1);
381
382 return CLI_SUCCESS;
383}
384
385static 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);
390 struct ast_cli_args *a = arg;
391
392 ast_cli(a->fd, "%-32s %-15s %-32s %-7s %s\n",
393 id,
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 "----------------------------------------------------------------------"
402static 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
434
435 return CLI_SUCCESS;
436}
437
438static char *ari_show_owc(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
439{
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 }
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
498static char *ari_start_owc(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
499{
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
541static 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",
549 session->session_id,
551 S_OR(session->remote_addr, "N/A"),
553 ? "N/A" : (session->connected ? "Up" : "Down"),
554 S_OR(apps, ""));
555
556 ast_free(apps);
557 return 0;
558}
559
560#define DASHES "----------------------------------------------------------------------"
561static char *ari_show_sessions(struct ast_cli_entry *e, int cmd,
562 struct ast_cli_args *a)
563{
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
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",
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",
599
601
602 return CLI_SUCCESS;
603}
604
605static 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");
628
629 return CLI_SUCCESS;
630}
631
633 const char *word)
634{
635 size_t wordlen = strlen(word);
636 struct ari_ws_session *session;
638
639 while ((session = ao2_iterator_next(&i))) {
640 if (!strncasecmp(word, session->session_id, wordlen)) {
642 }
643 ao2_ref(session, -1);
644 }
646}
647
648static char *ari_shut_session(struct ast_cli_entry *e, int cmd,
649 struct ast_cli_args *a)
650{
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:
668 return NULL;
669 default:
670 break;
671 }
672
673 if (a->argc != 5) {
674 return CLI_SHOWUSAGE;
675 }
676
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]);
684
685 return CLI_SUCCESS;
686}
687
688static 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
707
void ast_acl_output(int fd, struct ast_acl_list *acl, const char *prefix)
output an ACL to the provided fd
Definition acl.c:1115
int ast_acl_list_is_empty(struct ast_acl_list *acl_list)
Determines if an ACL is empty or if it contains entries.
Definition acl.c:540
void ast_cli_unregister_multiple(void)
Definition ael_main.c:408
static const char app[]
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
#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:2845
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:99
@ ARI_OWC_FIELD_APPS
Definition internal.h:102
@ ARI_OWC_FIELD_NONE
Definition internal.h:100
@ ARI_OWC_FIELD_LOCAL_ARI_USER
Definition internal.h:103
@ AST_JSON_PRETTY
Definition json.h:795
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)
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)
Definition res/ari/cli.c:76
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)
#define DASHES
static char * ari_show_users(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Definition res/ari/cli.c:88
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
Definition res_fax.c:603
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:2381
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.
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:69
Global configuration options for ARI.
Definition internal.h:58
const ast_string_field apps
Definition internal.h:119
struct ast_websocket_client * websocket_client
Definition internal.h:122
Per-user configuration options.
Definition internal.h:85
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 phoneprov_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:981
#define ARRAY_LEN(a)
Definition utils.h:706
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