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

Function ospGetRpidUser

modules/osp/sipheader.c:584–617  ·  view source on GitHub ↗

* Get user part from Remote-Party-ID header * param msg SIP message * param user User part of Remote-Party-ID header * param bufsize Size of fromuser buffer * return 0 success, 1 without RPID, -1 failure */

Source from the content-addressed store, hash-verified

582 * return 0 success, 1 without RPID, -1 failure
583 */
584int ospGetRpidUser(
585 struct sip_msg* msg,
586 char* rpiduser,
587 int bufsize)
588{
589 struct to_body* rpid;
590 struct sip_uri uri;
591 int result = -1;
592
593 if ((rpiduser != NULL) && (bufsize > 0)) {
594 rpiduser[0] = '\0';
595 if (msg->rpid != NULL) {
596 if (parse_rpid_header(msg) == 0) {
597 rpid = get_rpid(msg);
598 if (parse_uri(rpid->uri.s, rpid->uri.len, &uri) == 0) {
599 ospCopyStrToBuffer(&uri.user, rpiduser, bufsize);
600 ospSkipUserParam(rpiduser);
601 result = 0;
602 } else {
603 LM_ERR("failed to parse RPID uri\n");
604 }
605 } else {
606 LM_ERR("failed to parse RPID uri\n");
607 }
608 } else {
609 LM_DBG("without RPID header\n");
610 result = 1;
611 }
612 } else {
613 LM_ERR("bad parameters to parse user part from RPID\n");
614 }
615
616 return result;
617}
618
619/*
620 * Get host part from Remote-Party-ID header

Callers 2

ospReportUsageFromCookieFunction · 0.85
ospRequestRoutingFunction · 0.85

Calls 4

parse_rpid_headerFunction · 0.85
parse_uriFunction · 0.85
ospCopyStrToBufferFunction · 0.85
ospSkipUserParamFunction · 0.85

Tested by

no test coverage detected