22 #include <pjsip_simple.h> 33 size_t remaining = len - 1;
37 while ((break_point = strpbrk(copy,
"<>\"&'\n\r")) && remaining) {
38 char to_escape = *break_point;
41 strncat(output, copy, remaining);
48 remaining = len - strlen(output) - 1;
52 strncat(output,
"<", remaining);
55 strncat(output,
">", remaining);
58 strncat(output,
""", remaining);
61 strncat(output,
"&", remaining);
64 strncat(output,
"'", remaining);
67 strncat(output,
" ", remaining);
70 strncat(output,
" ", remaining);
74 copy = break_point + 1;
75 remaining = len - strlen(output) - 1;
79 if (*copy && remaining) {
80 strncat(output, copy, remaining);
86 unsigned int notify_early_inuse_ringing)
90 *statestring =
"early";
92 *pidfstate =
"on-the-phone";
93 *pidfnote =
"Ringing";
96 if (notify_early_inuse_ringing) {
97 *statestring =
"early";
99 *statestring =
"confirmed";
102 *pidfstate =
"on-the-phone";
103 *pidfnote =
"Ringing";
106 *statestring =
"confirmed";
108 *pidfstate =
"on-the-phone";
109 *pidfnote =
"On the phone";
112 *statestring =
"confirmed";
114 *pidfstate =
"on-the-phone";
115 *pidfnote =
"On the phone";
118 *statestring =
"terminated";
121 *pidfnote =
"Unavailable";
124 *statestring =
"confirmed";
126 *pidfstate =
"on-the-phone";
127 *pidfnote =
"On hold";
132 *statestring =
"terminated";
143 pj_xml_attr *attr = PJ_POOL_ALLOC_T(pool, pj_xml_attr);
145 pj_strdup2(pool, &attr->name, name);
146 pj_strdup2(pool, &attr->value, value);
148 pj_xml_add_attr(node, attr);
153 pj_xml_node *parent,
const char*
name)
155 pj_xml_node *
node = PJ_POOL_ALLOC_T(pool, pj_xml_node);
157 pj_list_init(&node->attr_head);
158 pj_list_init(&node->node_head);
160 pj_strdup2(pool, &node->name, name);
162 node->content.ptr =
NULL;
163 node->content.slen = 0;
166 pj_xml_add_node(parent, node);
173 pj_xml_node *parent,
const char *node_name,
const char *attr_name,
174 pj_xml_node **
node, pj_xml_attr **attr)
178 if (!(*node = pj_xml_find_node(parent, pj_cstr(&name, node_name)))) {
182 if (!(*attr = pj_xml_find_attr(*node, pj_cstr(&name, attr_name),
NULL))) {
Asterisk main include file. File version handling, generic pbx functions.
void ast_sip_presence_xml_find_node_attr(pj_pool_t *pool, pj_xml_node *parent, const char *node_name, const char *attr_name, pj_xml_node **node, pj_xml_attr **attr)
Find an attribute within a given node.
static pj_pool_t * pool
Global memory pool for configuration and timers.
static int copy(char *infile, char *outfile)
Utility function to copy a file.
pj_xml_node * ast_sip_presence_xml_create_node(pj_pool_t *pool, pj_xml_node *parent, const char *name)
Create XML node.
static int input(yyscan_t yyscanner)
void ast_sip_sanitize_xml(const char *input, char *output, size_t len)
Replace offensive XML characters with XML entities.
#define ast_strdupa(s)
duplicate a string in memory from the stack
Core PBX routines and definitions.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
pj_xml_attr * ast_sip_presence_xml_create_attr(pj_pool_t *pool, pj_xml_node *node, const char *name, const char *value)
Create XML attribute.
Asterisk module definitions.
void ast_sip_presence_exten_state_to_str(int state, char **statestring, char **pidfstate, char **pidfnote, enum ast_sip_pidf_state *local_state, unsigned int notify_early_inuse_ringing)
Convert extension state to relevant PIDF strings.