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

Function validate_msg

prime_hash.c:136–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136static int validate_msg(struct sip_msg * msg) {
137 if(!msg->callid && ((parse_headers(msg, HDR_CALLID_F, 0) == -1) || !msg->callid)) {
138 LM_ERR("Message has no Call-ID header\n");
139 return -1;
140 }
141 if(!msg->to && ((parse_headers(msg, HDR_TO_F, 0) == -1) || !msg->to)) {
142 LM_ERR("Message has no To header\n");
143 return -1;
144 }
145 if(!msg->from && ((parse_headers(msg, HDR_FROM_F, 0) == -1) || !msg->from)) {
146 LM_ERR("Message has no From header\n");
147 return -1;
148 }
149 //TODO it would make more sense to do the parsing just if its needed
150 // but parse_from_header is smart enough, so its probably not a huge problem
151 if (parse_from_header(msg) < 0) {
152 LM_ERR("Error while parsing From header field\n");
153 return -1;
154 }
155 return 0;
156}
157
158static int determine_call_id (struct sip_msg *msg, str *source_string) {
159 source_string->s = msg->callid->body.s;

Callers 1

determine_sourceFunction · 0.85

Calls 1

parse_from_headerFunction · 0.85

Tested by

no test coverage detected