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

Function ospGetIdentity

modules/osp/sipheader.c:909–936  ·  view source on GitHub ↗

* Get Identity header * param msg SIP message * param identity Identity header * param bufsize Size of identity header buffer * return 0 success, 1 without Identity, -1 failure */

Source from the content-addressed store, hash-verified

907 * return 0 success, 1 without Identity, -1 failure
908 */
909int ospGetIdentity(
910 struct sip_msg* msg,
911 char* identity,
912 int bufsize)
913{
914 struct hdr_field* hf;
915 int result = -1;
916
917 if ((identity != NULL) && (bufsize > 0)) {
918 identity[0] = '\0';
919 if (parse_headers(msg, HDR_EOH_F, 0) == 0) {
920 hf = get_header_by_name(msg, IDENTITY, strlen(IDENTITY));
921 if (hf) {
922 ospCopyStrToBuffer(&hf->body, identity, bufsize);
923 result = 0;
924 } else {
925 LM_DBG("without Identity header\n");
926 result = 1;
927 }
928 } else {
929 LM_ERR("failed to parse message\n");
930 }
931 } else {
932 LM_ERR("bad parameters to parse Identity header\n");
933 }
934
935 return result;
936}
937
938/*
939 * Get host part from Contact header

Callers 1

ospRequestRoutingFunction · 0.85

Calls 2

get_header_by_nameFunction · 0.85
ospCopyStrToBufferFunction · 0.85

Tested by

no test coverage detected