29#include <pjsip_simple.h>
54 char *statestring =
NULL, *pidfstate =
NULL, *pidfnote =
NULL;
56 char sanitized[PJSIP_MAX_URL_SIZE];
57 pjpidf_pres *pres = body;
61 &pidfstate, &pidfnote, &local_state, 0);
63 if (!pjpidf_pres_add_note(state_data->
pool, pres, pj_cstr(¬e, pidfnote))) {
68 if (!(tuple = pjpidf_pres_add_tuple(state_data->
pool, pres,
69 pj_cstr(&
id, state_data->
exten)))) {
75 pjpidf_tuple_set_contact(state_data->
pool, tuple, pj_cstr(&contact, sanitized));
76 pjpidf_tuple_set_contact_prio(state_data->
pool, tuple, pj_cstr(&
priority,
"1"));
77 pjpidf_status_set_basic_open(pjpidf_tuple_get_status(tuple),
83#define MAX_STRING_GROWTHS 5
87 pjpidf_pres *pres = body;
108 .
type =
"application",
109 .subtype =
"pidf+xml",
136 .
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.
static void pidf_to_string(void *body, struct ast_str **str)
static void * pidf_allocate_body(void *data)
static int pidf_generate_body_content(void *body, void *data)
#define MAX_STRING_GROWTHS
static struct ast_sip_pubsub_body_generator pidf_body_generator
static int load_module(void)
static int unload_module(void)
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_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.
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
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.