mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-03 19:16:46 +00:00
func_channel, chan_pjsip: Add CHANNEL read function support for chan_pjsip
This patch adds CHANNEL read support for chan_pjsip. This allows the dialplan to use the CHANNEL function on a chan_pjsip channel to obtain run-time information about the channel from the PJSIP channel driver and the PJSIP stack. This includes: * RTP information, including source/destination media addresses, whether or not the media is secure, held, and other properties. * RTCP information. This includes sets of parseable information, as well as individual statistic attriutes. * PJSIP information. This includes URIs, local/remote signalling addresses, whether or not the signalling is secure, and other properties. * The endpoint name. This can be used in conjunction with the PJSIP_ENDPOINT function to obtain more detailed endpoint information. Review: https://reviewboard.asterisk.org/r/3038/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@403618 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
108
main/xmldoc.c
108
main/xmldoc.c
@@ -70,6 +70,7 @@ struct documentation_tree {
|
||||
|
||||
static char *xmldoc_get_syntax_cmd(struct ast_xml_node *fixnode, const char *name, int printname);
|
||||
static int xmldoc_parse_enumlist(struct ast_xml_node *fixnode, const char *tabs, struct ast_str **buffer);
|
||||
static void xmldoc_parse_parameter(struct ast_xml_node *fixnode, const char *tabs, struct ast_str **buffer);
|
||||
static int xmldoc_parse_info(struct ast_xml_node *node, const char *tabs, const char *posttabs, struct ast_str **buffer);
|
||||
static int xmldoc_parse_para(struct ast_xml_node *node, const char *tabs, const char *posttabs, struct ast_str **buffer);
|
||||
static int xmldoc_parse_specialtags(struct ast_xml_node *fixnode, const char *tabs, const char *posttabs, struct ast_str **buffer);
|
||||
@@ -1490,58 +1491,6 @@ static int xmldoc_parse_specialtags(struct ast_xml_node *fixnode, const char *ta
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \internal
|
||||
* \brief Parse an 'info' tag inside an element.
|
||||
*
|
||||
* \param node A pointer to the 'info' xml node.
|
||||
* \param tabs A string to be appended at the beginning of each line being printed
|
||||
* inside 'buffer'
|
||||
* \param posttabs Add this string after the content of the <para> element, if one exists
|
||||
* \param String buffer to put values found inide the info element.
|
||||
*
|
||||
* \retval 2 if the information contained a para element, and it returned a value of 2
|
||||
* \retval 1 if information was put into the buffer
|
||||
* \retval 0 if no information was put into the buffer or error
|
||||
*/
|
||||
static int xmldoc_parse_info(struct ast_xml_node *node, const char *tabs, const char *posttabs, struct ast_str **buffer)
|
||||
{
|
||||
const char *tech;
|
||||
char *internaltabs;
|
||||
int internal_ret;
|
||||
int ret = 0;
|
||||
|
||||
if (strcasecmp(ast_xml_node_get_name(node), "info")) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ast_asprintf(&internaltabs, "%s ", tabs);
|
||||
if (!internaltabs) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
tech = ast_xml_get_attribute(node, "tech");
|
||||
if (tech) {
|
||||
ast_str_append(buffer, 0, "%s<note>Technology: %s</note>\n", internaltabs, tech);
|
||||
ast_xml_free_attr(tech);
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
|
||||
for (node = ast_xml_node_get_children(node); node; node = ast_xml_node_get_next(node)) {
|
||||
if (!strcasecmp(ast_xml_node_get_name(node), "enumlist")) {
|
||||
xmldoc_parse_enumlist(node, internaltabs, buffer);
|
||||
} else if ((internal_ret = xmldoc_parse_common_elements(node, internaltabs, posttabs, buffer))) {
|
||||
if (internal_ret > ret) {
|
||||
ret = internal_ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
ast_free(internaltabs);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \internal
|
||||
* \brief Parse an <argument> element from the xml documentation.
|
||||
@@ -1829,6 +1778,7 @@ static int xmldoc_parse_enum(struct ast_xml_node *fixnode, const char *tabs, str
|
||||
}
|
||||
|
||||
xmldoc_parse_enumlist(node, optiontabs, buffer);
|
||||
xmldoc_parse_parameter(node, optiontabs, buffer);
|
||||
}
|
||||
|
||||
ast_free(optiontabs);
|
||||
@@ -2051,6 +2001,60 @@ static void xmldoc_parse_parameter(struct ast_xml_node *fixnode, const char *tab
|
||||
ast_free(internaltabs);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \internal
|
||||
* \brief Parse an 'info' tag inside an element.
|
||||
*
|
||||
* \param node A pointer to the 'info' xml node.
|
||||
* \param tabs A string to be appended at the beginning of each line being printed
|
||||
* inside 'buffer'
|
||||
* \param posttabs Add this string after the content of the <para> element, if one exists
|
||||
* \param String buffer to put values found inide the info element.
|
||||
*
|
||||
* \retval 2 if the information contained a para element, and it returned a value of 2
|
||||
* \retval 1 if information was put into the buffer
|
||||
* \retval 0 if no information was put into the buffer or error
|
||||
*/
|
||||
static int xmldoc_parse_info(struct ast_xml_node *node, const char *tabs, const char *posttabs, struct ast_str **buffer)
|
||||
{
|
||||
const char *tech;
|
||||
char *internaltabs;
|
||||
int internal_ret;
|
||||
int ret = 0;
|
||||
|
||||
if (strcasecmp(ast_xml_node_get_name(node), "info")) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ast_asprintf(&internaltabs, "%s ", tabs);
|
||||
if (!internaltabs) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
tech = ast_xml_get_attribute(node, "tech");
|
||||
if (tech) {
|
||||
ast_str_append(buffer, 0, "%s<note>Technology: %s</note>\n", internaltabs, tech);
|
||||
ast_xml_free_attr(tech);
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
|
||||
for (node = ast_xml_node_get_children(node); node; node = ast_xml_node_get_next(node)) {
|
||||
if (!strcasecmp(ast_xml_node_get_name(node), "enumlist")) {
|
||||
xmldoc_parse_enumlist(node, internaltabs, buffer);
|
||||
} else if (!strcasecmp(ast_xml_node_get_name(node), "parameter")) {
|
||||
xmldoc_parse_parameter(node, internaltabs, buffer);
|
||||
} else if ((internal_ret = xmldoc_parse_common_elements(node, internaltabs, posttabs, buffer))) {
|
||||
if (internal_ret > ret) {
|
||||
ret = internal_ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
ast_free(internaltabs);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \internal
|
||||
* \brief Build the arguments for an item
|
||||
|
Reference in New Issue
Block a user