diff options
author | Matthew Jordan <mjordan@digium.com> | 2013-12-20 21:32:13 +0000 |
---|---|---|
committer | Matthew Jordan <mjordan@digium.com> | 2013-12-20 21:32:13 +0000 |
commit | b172d369c4057cddad18c0d6b1100233c07ebbd7 (patch) | |
tree | 0665c20e48161773916473a951bac27315d26d2b /main | |
parent | a0c288bb23164c6ff91019172980c8aff6fd8c8d (diff) |
res_pjsip: Add PJSIP CLI commands
Implements the following cli commands:
pjsip list aors
pjsip list auths
pjsip list channels
pjsip list contacts
pjsip list endpoints
pjsip show aor(s)
pjsip show auth(s)
pjsip show channels
pjsip show endpoint(s)
Also...
Minor modifications made to the AMI command implementations to facilitate
reuse.
New function ast_variable_list_sort added to config.c and config.h to implement
variable list sorting.
(issue ASTERISK-22610)
patches:
pjsip_cli_v2.patch uploaded by george.joseph (License 6322)
........
Merged revisions 404480 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404507 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r-- | main/channel.c | 2 | ||||
-rw-r--r-- | main/config.c | 34 | ||||
-rw-r--r-- | main/sorcery.c | 8 |
3 files changed, 44 insertions, 0 deletions
diff --git a/main/channel.c b/main/channel.c index 4789943c0..9ff3d0746 100644 --- a/main/channel.c +++ b/main/channel.c @@ -733,6 +733,8 @@ const char *ast_state2str(enum ast_channel_state state) return "Dialing Offhook"; case AST_STATE_PRERING: return "Pre-ring"; + case AST_STATE_MUTE: + return "Mute"; default: if (!(buf = ast_threadstorage_get(&state2str_threadbuf, STATE2STR_BUFSIZE))) return "Unknown"; diff --git a/main/config.c b/main/config.c index b8356a9bc..c6458caaf 100644 --- a/main/config.c +++ b/main/config.c @@ -70,6 +70,7 @@ static char *extconfig_conf = "extconfig.conf"; static struct ao2_container *cfg_hooks; static void config_hook_exec(const char *filename, const char *module, struct ast_config *cfg); +inline struct ast_variable *variable_list_switch(struct ast_variable *l1, struct ast_variable *l2); /*! \brief Structure to keep comments for rewriting configuration files */ struct ast_comment { @@ -581,6 +582,39 @@ struct ast_variable *ast_variable_browse(const struct ast_config *config, const return (cat) ? cat->root : NULL; } +inline struct ast_variable *variable_list_switch(struct ast_variable *l1, struct ast_variable *l2) +{ + l1->next = l2->next; + l2->next = l1; + return l2; +} + +struct ast_variable *ast_variable_list_sort(struct ast_variable *start) +{ + struct ast_variable *p, *q, *top; + int changed = 1; + top = ast_calloc(1, sizeof(struct ast_variable)); + top->next = start; + if (start != NULL && start->next != NULL) { + while (changed) { + changed = 0; + q = top; + p = top->next; + while (p->next != NULL) { + if (p->next != NULL && strcmp(p->name, p->next->name) > 0) { + q->next = variable_list_switch(p, p->next); + + changed = 1; + } + q = p; + if (p->next != NULL) + p = p->next; + } + } + } + return top->next; +} + const char *ast_config_option(struct ast_config *cfg, const char *cat, const char *var) { const char *tmp; diff --git a/main/sorcery.c b/main/sorcery.c index c7e1a03f3..1753ba198 100644 --- a/main/sorcery.c +++ b/main/sorcery.c @@ -1583,3 +1583,11 @@ void ast_sorcery_observer_remove(const struct ast_sorcery *sorcery, const char * ao2_callback(object_type->observers, OBJ_NODATA | OBJ_UNLINK, sorcery_observer_remove, cbs); } + +int ast_sorcery_object_id_compare(const void *obj_left, const void *obj_right, int flags) +{ + if (!obj_left || !obj_right) { + return 0; + } + return strcmp(ast_sorcery_object_get_id(obj_left), ast_sorcery_object_get_id(obj_right)); +} |