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

Function ospGetPaiUser

modules/osp/sipheader.c:471–504  ·  view source on GitHub ↗

* Get user part from P-Asserted-Identity header * param msg SIP message * param user User part of P-Asserted-Identity header * param bufsize Size of fromuser buffer * return 0 success, 1 without PAI, -1 failure */

Source from the content-addressed store, hash-verified

469 * return 0 success, 1 without PAI, -1 failure
470 */
471int ospGetPaiUser(
472 struct sip_msg* msg,
473 char* paiuser,
474 int bufsize)
475{
476 struct to_body* pai;
477 struct sip_uri uri;
478 int result = -1;
479
480 if ((paiuser != NULL) && (bufsize > 0)) {
481 paiuser[0] = '\0';
482 if (msg->pai != NULL) {
483 if (parse_pai_header(msg) == 0) {
484 pai = get_pai(msg);
485 if (parse_uri(pai->uri.s, pai->uri.len, &uri) == 0) {
486 ospCopyStrToBuffer(&uri.user, paiuser, bufsize);
487 ospSkipUserParam(paiuser);
488 result = 0;
489 } else {
490 LM_ERR("failed to parse PAI uri\n");
491 }
492 } else {
493 LM_ERR("failed to parse PAI uri\n");
494 }
495 } else {
496 LM_DBG("without PAI header\n");
497 result = 1;
498 }
499 } else {
500 LM_ERR("bad parameters to parse user part from PAI\n");
501 }
502
503 return result;
504}
505
506/*
507 * Get host part from P-Asserted-Identity header

Callers 2

ospReportUsageFromCookieFunction · 0.85
ospRequestRoutingFunction · 0.85

Calls 4

parse_pai_headerFunction · 0.85
parse_uriFunction · 0.85
ospCopyStrToBufferFunction · 0.85
ospSkipUserParamFunction · 0.85

Tested by

no test coverage detected