MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / parse_pai_header

Function parse_pai_header

parser/parse_pai.c:40–79  ·  view source on GitHub ↗

* This method is used to parse P-Asserted-Identity header (RFC 3325). * * params: msg : sip msg * returns 0 on success, * -1 on failure. */

Source from the content-addressed store, hash-verified

38 * -1 on failure.
39 */
40int parse_pai_header( struct sip_msg *msg )
41{
42 struct to_body* pai_b;
43
44 if ( !msg->pai &&
45 (parse_headers(msg, HDR_PAI_F,0)==-1 || !msg->pai)) {
46 goto error;
47 }
48
49 /* maybe the header is already parsed! */
50 if (msg->pai->parsed)
51 return 0;
52
53 /* bad luck! :-( - we have to parse it */
54 /* first, get some memory */
55 pai_b = pkg_malloc(sizeof(struct to_body));
56 if (pai_b == NULL) {
57 LM_ERR("out of pkg memory\n");
58 goto error;
59 }
60
61 /* now parse it as a multi name-addr/addr-spec instance header !! */
62 parse_multi_to( msg->pai->body.s, msg->pai->body.s + msg->pai->body.len+1,
63 pai_b);
64 if (pai_b->error == PARSE_ERROR) {
65 LM_ERR("failed to parse P-Asserted-Identity header\n");
66 pkg_free(pai_b);
67 set_err_info(OSER_EC_PARSER, OSER_EL_MEDIUM,
68 "error parsing PAI header");
69 set_err_reply(400, "bad header");
70 goto error;
71 }
72
73 /* check header validity */
74 msg->pai->parsed = pai_b;
75
76 return 0;
77error:
78 return -1;
79}

Callers 7

pv_get_paiFunction · 0.85
ospGetPaiUserFunction · 0.85
ospGetPaiHostFunction · 0.85
found_CBNFunction · 0.85
w_sip_captureFunction · 0.85
init_iam_defaultFunction · 0.85
get_orig_tn_from_msgFunction · 0.85

Calls 3

parse_multi_toFunction · 0.85
set_err_infoFunction · 0.85
set_err_replyFunction · 0.85

Tested by

no test coverage detected