diff --git a/src/core/parser/contact/parse_contact.c b/src/core/parser/contact/parse_contact.c index af0cd39c2c7..37a075a17d9 100644 --- a/src/core/parser/contact/parse_contact.c +++ b/src/core/parser/contact/parse_contact.c @@ -226,3 +226,31 @@ int contact_iterator(contact_t** c, struct sip_msg* msg, contact_t* prev) return 0; } } + +/** + * + */ +int parse_contact_headers(sip_msg_t *msg) +{ + hdr_field_t* hdr; + + if (parse_headers(msg, HDR_EOH_F, 0) < 0) { + LM_ERR("failed to parse headers\n"); + return -1; + } + + if (msg->contact) { + hdr = msg->contact; + while(hdr) { + if (hdr->type == HDR_CONTACT_T) { + if (!hdr->parsed && (parse_contact(hdr) < 0)) { + LM_ERR("failed to parse Contact body\n"); + return -1; + } + } + hdr = hdr->next; + } + } + + return 0; +} diff --git a/src/core/parser/contact/parse_contact.h b/src/core/parser/contact/parse_contact.h index 36389b5e069..4d8e1cd6427 100644 --- a/src/core/parser/contact/parse_contact.h +++ b/src/core/parser/contact/parse_contact.h @@ -70,5 +70,9 @@ void print_contact(FILE* _o, contact_body_t* _c); */ int contact_iterator(contact_t** c, struct sip_msg* msg, contact_t* prev); +/* + * parse all Contact headers + */ +int parse_contact_headers(sip_msg_t *msg); #endif /* PARSE_CONTACT_H */