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.
static void * pidf_allocate_body(void *data)
const char * type
Content type In "plain/text", "plain" is the type.
size_t ast_str_size(const struct ast_str *buf)
Returns the current maximum length (without reallocation) of the current buffer.
#define ast_str_make_space(buf, new_len)
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
#define MAX_STRING_GROWTHS
char remote[PJSIP_MAX_URL_SIZE]
static int load_module(void)
enum ast_extension_states exten_state
int ast_sip_pubsub_register_body_generator(struct ast_sip_pubsub_body_generator *generator)
Register a body generator with the pubsub core.
static struct ast_sip_pubsub_body_generator pidf_body_generator
#define AST_SIP_EXTEN_STATE_DATA
char * ast_strip_quoted(char *s, const char *beg_quotes, const char *end_quotes)
Strip leading/trailing whitespace and quotes from a string.
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.
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define AST_PJSIP_XML_PROLOG_LEN
Length of the XML prolog when printing presence or other XML in PJSIP.
char local[PJSIP_MAX_URL_SIZE]
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
static int pidf_generate_body_content(void *body, void *data)
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.
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
structure used for presence XML bodies
static void pidf_to_string(void *body, struct ast_str **str)
void ast_str_update(struct ast_str *buf)
Update the length of the buffer, after using ast_str merely as a buffer.
#define ASTERISK_GPL_KEY
The text the key() function should return.
static int unload_module(void)
Asterisk module definitions.
void ast_sip_pubsub_unregister_body_generator(struct ast_sip_pubsub_body_generator *generator)
Unregister a body generator with the pubsub core.