* Parse Contact header field body and extract URI * Does not parse headers ! */
| 416 | * Does not parse headers ! |
| 417 | */ |
| 418 | static inline int get_contact_uri(struct sip_msg* msg, str* uri) |
| 419 | { |
| 420 | contact_t* c; |
| 421 | |
| 422 | uri->len = 0; |
| 423 | if (!msg->contact) return 1; |
| 424 | |
| 425 | if (parse_contact(msg->contact) < 0) { |
| 426 | LM_ERR("failed to parse Contact body\n"); |
| 427 | return -1; |
| 428 | } |
| 429 | |
| 430 | c = ((contact_body_t*)msg->contact->parsed)->contacts; |
| 431 | |
| 432 | if (!c) { |
| 433 | LM_ERR("body or * contact\n"); |
| 434 | return -2; |
| 435 | } |
| 436 | |
| 437 | *uri = c->uri; |
| 438 | return 0; |
| 439 | } |
| 440 | |
| 441 | |
| 442 |
no test coverage detected