diff options
author | Matthew Jordan <mjordan@digium.com> | 2013-12-11 12:31:57 +0000 |
---|---|---|
committer | Matthew Jordan <mjordan@digium.com> | 2013-12-11 12:31:57 +0000 |
commit | f46b30bd36457cf349ef18ee854cce9f4dd0daaf (patch) | |
tree | 46e9b42fb083340e40c9be2249ddbb94e6faf346 /main/sorcery.c | |
parent | 5b4aab75ef39ee79d04bd8c48516a7d87d319a78 (diff) |
func_pjsip_endpoint: Add PJSIP_ENDPOINT function for querying endpoint details
This patch adds a new function, PJSIP_ENDPOINT, which lets the dialplan query,
for any endpoint, any property configured on an endpoint. This function is a
companion to the CHANNEL function, which can be used to extract the endpoint
name for a channel.
Review: https://reviewboard.asterisk.org/r/3035
........
Merged revisions 403616 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403617 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/sorcery.c')
-rw-r--r-- | main/sorcery.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/main/sorcery.c b/main/sorcery.c index 2ea6d9ead..c7e1a03f3 100644 --- a/main/sorcery.c +++ b/main/sorcery.c @@ -34,6 +34,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/logger.h" #include "asterisk/sorcery.h" #include "asterisk/astobj2.h" +#include "asterisk/format.h" +#include "asterisk/format_cap.h" #include "asterisk/strings.h" #include "asterisk/config_options.h" #include "asterisk/netsock2.h" @@ -217,11 +219,19 @@ static int chararray_handler_fn(const void *obj, const intptr_t *args, char **bu return !(*buf = ast_strdup(field)) ? -1 : 0; } +static int codec_handler_fn(const void *obj, const intptr_t *args, char **buf) +{ + char tmp_buf[256]; + struct ast_format_cap **cap = (struct ast_format_cap **)(obj + args[1]); + return !(*buf = ast_strdup(ast_getformatname_multiple(tmp_buf, sizeof(tmp_buf), *cap))); +} + static sorcery_field_handler sorcery_field_default_handler(enum aco_option_type type) { switch(type) { case OPT_BOOL_T: return bool_handler_fn; case OPT_CHAR_ARRAY_T: return chararray_handler_fn; + case OPT_CODEC_T: return codec_handler_fn; case OPT_DOUBLE_T: return double_handler_fn; case OPT_INT_T: return int_handler_fn; case OPT_SOCKADDR_T: return sockaddr_handler_fn; |