153 .
type =
"header_datastore",
175 pjsip_hdr *
hdr = msg->hdr.next;
178 while (hdr && hdr != &msg->hdr) {
180 le->
hdr = pjsip_hdr_clone(pool, hdr);
206 !(datastore->data = pj_pool_alloc(pool,
sizeof(
struct hdr_list))) ||
234 if (pj_stricmp2(&le->
hdr->name, header_name) == 0 && i++ == header_number) {
259 size_t pj_hdr_string_len;
266 if (!datastore || !datastore->data) {
267 ast_debug(1,
"There was no datastore from which to read headers.\n");
280 pj_hdr_string_len = pjsip_hdr_print_on(hdr, pj_hdr_string, data->
len);
281 pj_hdr_string[pj_hdr_string_len] =
'\0';
283 p = strchr(pj_hdr_string,
':');
286 "A malformed header was returned from pjsip_hdr_print_on.\n");
293 if (plen + 1 > data->
len) {
295 "Buffer isn't big enough to hold header value. %zu > %zu\n", plen + 1,
320 pj_str_t pj_header_name;
321 pj_str_t pj_header_value;
330 header_datastore.
type))
331 || !(datastore->data = pj_pool_alloc(pool,
sizeof(
struct hdr_list)))
345 le->
hdr = (pjsip_hdr *) pjsip_generic_string_hdr_create(pool, &pj_header_name,
347 list = datastore->data;
372 if (!datastore || !datastore->data) {
385 pj_strcpy2(&((pjsip_generic_string_hdr *) hdr)->hvalue, data->
header_value);
404 int removed_count = 0;
409 if (!datastore || !datastore->data) {
414 list = datastore->data;
417 if (pj_strnicmp2(&le->
hdr->name, data->
header_name, len - 1) == 0) {
430 if (data->
buf && data->
len) {
431 snprintf(data->
buf, data->
len,
"%d", removed_count);
466 if (!
args.header_number) {
469 sscanf(
args.header_number,
"%30d", &number);
482 if (!strcasecmp(
args.action,
"read")) {
485 }
else if (!strcasecmp(
args.action,
"remove")) {
490 "Unknown action '%s' is not valid, must be 'read' or 'remove'.\n",
525 if (!
args.header_number) {
528 sscanf(
args.header_number,
"%30d", &header_number);
529 if (header_number < 1) {
541 if (!strcasecmp(
args.action,
"add")) {
544 }
else if (!strcasecmp(
args.action,
"update")) {
547 }
else if (!strcasecmp(
args.action,
"remove")) {
552 "Unknown action '%s' is not valid, must be 'add', 'update', or 'remove'.\n",
559 .
name =
"PJSIP_HEADER",
584 if (!datastore || !datastore->data ||
585 (session->
inv_session->state >= PJSIP_INV_STATE_CONFIRMED)) {
589 list = datastore->data;
591 pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr *) pjsip_hdr_clone(pool, le->
hdr));
623 .requires =
"res_pjsip,res_pjsip_session",
Main Channel structure associated with a channel.
Asterisk main include file. File version handling, generic pbx functions.
void * ast_channel_tech_pvt(const struct ast_channel *chan)
struct hdr_list_entry::@482 nextptr
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
static pj_pool_t * pool
Global memory pool for configuration and timers.
Structure for a data store type.
A structure which contains a channel implementation and session.
struct ast_sip_session * session
Pointer to session.
Structure for a data store object.
void ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement)
Unregister a an supplement to SIP session processing.
struct pjsip_inv_session * inv_session
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
A structure describing a SIP session.
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
#define ast_strlen_zero(foo)
void ast_sip_session_remove_datastore(struct ast_sip_session *session, const char *name)
Remove a session datastore from the session.
#define ast_debug(level,...)
Log a DEBUG message.
General Asterisk PBX channel definitions.
struct ast_datastore * ast_sip_session_alloc_datastore(const struct ast_datastore_info *info, const char *uid)
Alternative for ast_datastore_alloc()
struct ast_datastore * ast_sip_session_get_datastore(struct ast_sip_session *session, const char *name)
Retrieve a session datastore.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
static struct ast_mansession session
int ast_sip_push_task_wait_serializer(struct ast_taskprocessor *serializer, int(*sip_task)(void *), void *task_data)
Push a task to the serializer and wait for it to complete.
Data structure associated with a custom dialplan function.
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
AST_LIST_HEAD_NOLOCK(contactliststruct, contact)
Core PBX routines and definitions.
struct ast_taskprocessor * serializer
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
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",)
A supplement to SIP message processing.
#define AST_LIST_HEAD_INIT_NOLOCK(head)
Initializes a list head structure.
Linked list for accumulating headers.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
const char * ast_channel_name(const struct ast_channel *chan)
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
#define ast_custom_function_register(acf)
Register a custom function.
int ast_sip_session_add_datastore(struct ast_sip_session *session, struct ast_datastore *datastore)
Add a datastore to a SIP session.
#define AST_APP_ARG(name)
Define an application argument.
#define ast_sip_session_register_supplement(supplement)