328    .
type = 
"header_datastore",
 
 
  332    .
type = 
"response_header_datastore",
 
 
  355    pjsip_hdr *hdr = msg->hdr.next;
 
  358    while (
hdr && 
hdr != &msg->hdr) {
 
  360        le->
hdr = pjsip_hdr_clone(pool, 
hdr);
 
 
  378    pj_pool_t *pool = 
session->inv_session->dlg->pool;
 
  386            !(datastore->data = pj_pool_alloc(pool, 
sizeof(
struct hdr_list))) ||
 
 
  408    pj_pool_t *pool = 
session->inv_session->dlg->pool;
 
  411    pjsip_status_line 
status = rdata->msg_info.msg->line.status;
 
  414    if (
session->inv_session->state != PJSIP_INV_STATE_CONNECTING || 
status.code!=200) {
 
  422            !(datastore->data = pj_pool_alloc(pool, 
sizeof(
struct hdr_list))) ||
 
 
  450        if (pj_stricmp2(&le->
hdr->name, header_name) == 0 && i++ == header_number) {
 
 
  473    pjsip_hdr *hdr = 
NULL;
 
  475    int pj_hdr_string_len;
 
  478    size_t plen, wlen = 0;
 
  486    if (!datastore || !datastore->data) {
 
  487        ast_debug(1, 
"There was no datastore from which to read headers.\n");
 
  491    list = datastore->data;
 
  498            pj_hdr_string_len = pjsip_hdr_print_on(hdr, pj_hdr_string, data->
len - 1);
 
  499            if (pj_hdr_string_len == -1) {
 
  501                    "Not enough buffer space in pjsip_hdr_print_on\n");
 
  504            pj_hdr_string[pj_hdr_string_len] = 
'\0';
 
  505            p = strchr(pj_hdr_string, 
':');
 
  508                    "A malformed header was returned from pjsip_hdr_print_on\n");
 
  512            pj_hdr_string[p - pj_hdr_string] = 
'\0';
 
  515            if (wlen + plen + 1 > data->
len) {
 
  517                        "Buffer isn't big enough to hold header value.  %zu > %zu\n", plen + 1,
 
  521            pos = strstr(data->
buf, p);
 
  522            if (pos && pos[1] == 
',') {
 
  523                if (pos == data->
buf) {
 
  525                } 
else if (pos[-1] == 
',') {
 
  545        data->
buf[wlen-1] = 
'\0';
 
 
  564    pjsip_hdr *hdr = 
NULL;
 
  566    int pj_hdr_string_len;
 
  576    if (!datastore || !datastore->data) {
 
  577        ast_debug(1, 
"There was no datastore from which to read headers.\n");
 
  581    list = datastore->data;
 
  602    pj_hdr_string_len = pjsip_hdr_print_on(hdr, pj_hdr_string, data->
len - 1);
 
  603    if (pj_hdr_string_len == -1) {
 
  605            "Not enough buffer space in pjsip_hdr_print_on\n");
 
  609    pj_hdr_string[pj_hdr_string_len] = 
'\0';
 
  611    p = strchr(pj_hdr_string, 
':');
 
  614                "A malformed header was returned from pjsip_hdr_print_on.\n");
 
  621    if (plen + 1 > data->
len) {
 
  623                "Buffer isn't big enough to hold header value.  %zu > %zu\n", plen + 1,
 
 
  647    pj_pool_t *pool = 
session->inv_session->dlg->pool;
 
  648    pj_str_t pj_header_name;
 
  649    pj_str_t pj_header_value;
 
  659            || !(datastore->data = pj_pool_alloc(pool, 
sizeof(
struct hdr_list)))
 
  673    le->
hdr = (pjsip_hdr *) pjsip_generic_string_hdr_create(pool, &pj_header_name,
 
  675    list = datastore->data;
 
 
  696    pjsip_hdr *hdr = 
NULL;
 
  701    if (!datastore || !datastore->data) {
 
  714    pj_strdup2(pool, &((pjsip_generic_string_hdr *) hdr)->hvalue, data->
header_value);
 
 
  733    int removed_count = 0;
 
  738    if (!datastore || !datastore->data) {
 
  743    list = datastore->data;
 
  759    if (data->
buf && data->
len) {
 
  760        snprintf(data->
buf, data->
len, 
"%d", removed_count);
 
 
  855    if (!
args.header_number) {
 
  872    if (!strcasecmp(
args.action, 
"read")) {
 
  874    } 
else if (!strcasecmp(
args.action, 
"remove")) {
 
  879                "Unknown action '%s' is not valid, must be 'read' or 'remove'.\n",
 
 
  913    if (!
args.header_number) {
 
  930    if (!strcasecmp(
args.action, 
"read")) {
 
  934                "Unknown action '%s' is not valid, must be 'read'.\n",
 
 
  969    if (!
args.header_number) {
 
  986    if (!strcasecmp(
args.action, 
"add")) {
 
  989    } 
else if (!strcasecmp(
args.action, 
"update")) {
 
  992    } 
else if (!strcasecmp(
args.action, 
"remove")) {
 
  997                "Unknown action '%s' is not valid, must be 'add', 'update', or 'remove'.\n",
 
 
 1004    .
name = 
"PJSIP_HEADER",
 
 
 1010    .
name = 
"PJSIP_HEADERS",
 
 
 1015    .
name = 
"PJSIP_RESPONSE_HEADER",
 
 
 1020    .
name = 
"PJSIP_RESPONSE_HEADERS",
 
 
 1043    if (!datastore || !datastore->data ||
 
 1044        (
session->inv_session->state >= PJSIP_INV_STATE_CONFIRMED)) {
 
 1048    list = datastore->data;
 
 1050        pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr *) pjsip_hdr_clone(tdata->pool, le->
hdr));
 
 
 1083    pj_str_t param_name;
 
 1085    pjsip_fromto_hdr *dlg_info;
 
 1086    pjsip_name_addr *dlg_info_name_addr;
 
 1087    pjsip_sip_uri *dlg_info_uri;
 
 1091    dlg_info = 
session->inv_session->dlg->remote.info; 
 
 1092    dlg_info_name_addr = (pjsip_name_addr *) dlg_info->uri;
 
 1093    dlg_info_uri = pjsip_uri_get_uri(dlg_info_name_addr);
 
 1098        param = pjsip_param_find(&dlg_info_uri->other_param, ¶m_name);
 
 1100        param = pjsip_param_find(&dlg_info->other_param, ¶m_name);
 
 1104        ast_debug(1, 
"No %s parameter found named %s\n",
 
 1109    param_len = pj_strlen(¶m->value);
 
 1110    if (param_len >= data->
len) {
 
 1111        ast_log(
LOG_ERROR, 
"Buffer is too small for parameter value (%zu > %zu)\n", param_len, data->
len);
 
 1115    ast_debug(2, 
"Successfully read %s parameter %s (length %zu)\n",
 
 1120    data->
buf[param_len] = 
'\0';
 
 
 1135    pj_pool_t *pool = 
session->inv_session->dlg->pool;
 
 1137    pjsip_fromto_hdr *dlg_info;
 
 1138    pjsip_name_addr *dlg_info_name_addr;
 
 1139    pjsip_sip_uri *dlg_info_uri;
 
 1141    dlg_info = 
session->inv_session->dlg->local.info; 
 
 1142    dlg_info_name_addr = (pjsip_name_addr *) dlg_info->uri;
 
 1143    dlg_info_uri = pjsip_uri_get_uri(dlg_info_name_addr);
 
 1144    if (!PJSIP_URI_SCHEME_IS_SIP(dlg_info_uri) && !PJSIP_URI_SCHEME_IS_SIPS(dlg_info_uri)) {
 
 1149    ast_debug(1, 
"Adding custom %s param %s = %s\n",
 
 1162#define param_add(pool, list, pname, pvalue) { \ 
 1163    pjsip_param *param; \ 
 1164    param = PJ_POOL_ALLOC_T(pool, pjsip_param); \ 
 1165    pj_strdup2(pool, ¶m->name, pname); \ 
 1166    pj_strdup2(pool, ¶m->value, pvalue); \ 
 1167    pj_list_insert_before(list, param); \ 
 
 1214    if (!strcasecmp(
args.param_type, 
"header")) {
 
 1216    } 
else if (!strcasecmp(
args.param_type, 
"uri")) {
 
 
 1263    if (!strcasecmp(
args.param_type, 
"header")) {
 
 1265    } 
else if (!strcasecmp(
args.param_type, 
"uri")) {
 
 
 1277    .
name = 
"PJSIP_HEADER_PARAM",
 
 
 1310    .
requires = 
"res_pjsip,res_pjsip_session",
 
Asterisk main include file. File version handling, generic pbx functions.
static struct ast_mansession session
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
General Asterisk PBX channel definitions.
const char * ast_channel_name(const struct ast_channel *chan)
void * ast_channel_tech_pvt(const struct ast_channel *chan)
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
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.
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
#define AST_APP_ARG(name)
Define an application argument.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
#define ast_debug(level,...)
Log a DEBUG message.
#define AST_LIST_HEAD_INIT_NOLOCK(head)
Initializes a list head structure.
#define AST_LIST_HEAD_NOLOCK(name, type)
Defines a structure to be used to hold a list of specified type (with no lock).
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
Asterisk module definitions.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
Core PBX routines and definitions.
#define ast_custom_function_register(acf)
Register a custom function.
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
@ AST_SIP_SUPPLEMENT_PRIORITY_CHANNEL
struct ast_datastore * ast_sip_session_get_datastore(struct ast_sip_session *session, const char *name)
Retrieve a session datastore.
int ast_sip_session_add_datastore(struct ast_sip_session *session, struct ast_datastore *datastore)
Add a datastore to a SIP session.
void ast_sip_session_remove_datastore(struct ast_sip_session *session, const char *name)
Remove a session datastore from the session.
#define ast_sip_session_register_supplement(supplement)
struct ast_datastore * ast_sip_session_alloc_datastore(const struct ast_datastore_info *info, const char *uid)
Alternative for ast_datastore_alloc()
void ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement)
Unregister a an supplement to SIP session processing.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
Main Channel structure associated with a channel.
Data structure associated with a custom dialplan function.
Structure for a data store type.
Structure for a data store object.
A structure which contains a channel implementation and session.
struct ast_sip_session * session
Pointer to session.
A supplement to SIP message processing.
struct ast_module *const char * method
A structure describing a SIP session.
struct pjsip_inv_session * inv_session
struct ast_taskprocessor * serializer
Linked list for accumulating headers.
struct hdr_list_entry::@495 nextptr
enum param_type paramtype
struct ast_sip_channel_pvt * channel
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.