29#include <pjsip_simple.h>
51 pjxpidf_pres *pres = body;
53 static pj_str_t STR_ADDR_PARAM = {
";user=ip", 8 };
54 char *statestring =
NULL, *pidfstate =
NULL, *pidfnote =
NULL;
58 char sanitized[PJSIP_MAX_URL_SIZE];
62 pj_xml_node *msnsubstatus;
65 &pidfstate, &pidfnote, &local_state, 0);
69 pj_strdup2(state_data->
pool, &attr->value, state_data->
exten);
76 uri.ptr = (
char*) pj_pool_alloc(state_data->
pool,
77 strlen(sanitized) + STR_ADDR_PARAM.slen);
78 pj_strcpy2( &uri, sanitized);
79 pj_strcat( &uri, &STR_ADDR_PARAM);
80 pj_strdup(state_data->
pool, &attr->value, &uri);
85 "status",
"status", &
status, &attr);
86 pj_strdup2(state_data->
pool, &attr->value,
91 "msnsubstatus",
"substatus", &msnsubstatus, &attr);
92 pj_strdup2(state_data->
pool, &attr->value,
94 (local_state ==
NOTIFY_INUSE) ?
"onthephone" :
"offline");
99#define MAX_STRING_GROWTHS 5
103 pjxpidf_pres *pres = body;
124 .
type =
"application",
125 .subtype =
"xpidf+xml",
134 .
type =
"application",
135 .subtype =
"cpim-pidf+xml",
177 .
requires =
"res_pjsip,res_pjsip_pubsub",
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdupa(s)
duplicate a string in memory from the stack
Asterisk module definitions.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODPRI_CHANNEL_DEPEND
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
void ast_sip_sanitize_xml(const char *input, char *output, size_t len)
Replace offensive XML characters with XML entities.
#define AST_PJSIP_XML_PROLOG_LEN
Length of the XML prolog when printing presence or other XML in PJSIP.
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.
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.
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.
void ast_sip_pubsub_unregister_body_generator(struct ast_sip_pubsub_body_generator *generator)
Unregister a body generator with the pubsub core.
int ast_sip_pubsub_register_body_generator(struct ast_sip_pubsub_body_generator *generator)
Register a body generator with the pubsub core.
#define AST_SIP_EXTEN_STATE_DATA
static int xpidf_generate_body_content(void *body, void *data)
static void unregister_all(void)
static void * xpidf_allocate_body(void *data)
#define MAX_STRING_GROWTHS
static struct ast_sip_pubsub_body_generator xpidf_body_generator
static int load_module(void)
static int unload_module(void)
static void xpidf_to_string(void *body, struct ast_str **str)
static struct ast_sip_pubsub_body_generator cpim_pidf_body_generator
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
char * ast_strip_quoted(char *s, const char *beg_quotes, const char *end_quotes)
Strip leading/trailing whitespace and quotes from a string.
#define ast_str_make_space(buf, new_len)
void ast_str_update(struct ast_str *buf)
Update the length of the buffer, after using ast_str merely as a buffer.
size_t ast_str_size(const struct ast_str *buf)
Returns the current maximum length (without reallocation) of the current buffer.
structure used for presence XML bodies
char local[PJSIP_MAX_URL_SIZE]
enum ast_extension_states exten_state
char remote[PJSIP_MAX_URL_SIZE]
const char * type
Content type In "plain/text", "plain" is the type.
Support for dynamic strings.