| 134 | } |
| 135 | |
| 136 | static 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 | |
| 158 | static int determine_call_id (struct sip_msg *msg, str *source_string) { |
| 159 | source_string->s = msg->callid->body.s; |
no test coverage detected