* Get the callid of a message. If returned value is 0, the callid is stored * in the _cid field, otherwise -1 is returned on error */
| 484 | * in the _cid field, otherwise -1 is returned on error |
| 485 | */ |
| 486 | inline static int get_callid(struct sip_msg* _m, str* _cid) |
| 487 | { |
| 488 | if ((parse_headers(_m, HDR_CALLID_F, 0) == -1)) { |
| 489 | LM_ERR("failed to parse call-id header\n"); |
| 490 | return -1; |
| 491 | } |
| 492 | |
| 493 | if (_m->callid == NULL) { |
| 494 | LM_ERR("call-id not found\n"); |
| 495 | return -1; |
| 496 | } |
| 497 | |
| 498 | _cid->s = _m->callid->body.s; |
| 499 | _cid->len = _m->callid->body.len; |
| 500 | trim(_cid); |
| 501 | return 0; |
| 502 | } |
| 503 | |
| 504 | |
| 505 | /* |
no test coverage detected