* Get message body and check Content-Type header field */
| 160 | * Get message body and check Content-Type header field |
| 161 | */ |
| 162 | int extract_body(struct sip_msg *msg, str *body ) |
| 163 | { |
| 164 | struct body_part * p; |
| 165 | |
| 166 | if ( parse_sip_body(msg)<0 || msg->body==NULL ) |
| 167 | { |
| 168 | LM_DBG("No body found\n"); |
| 169 | return -1; |
| 170 | } |
| 171 | |
| 172 | for ( p=&msg->body->first ; p ; p=p->next ) |
| 173 | { |
| 174 | /* skip body parts which were deleted or newly added */ |
| 175 | if (!is_body_part_received(p)) |
| 176 | continue; |
| 177 | |
| 178 | *body = p->body; |
| 179 | if( p->mime != ((TYPE_APPLICATION << 16) + SUBTYPE_SDP) |
| 180 | || body->len == 0) |
| 181 | continue; |
| 182 | |
| 183 | /* found and return an SDP part */ |
| 184 | return 1; |
| 185 | } |
| 186 | |
| 187 | body->s = NULL; |
| 188 | body->len = 0; |
| 189 | return -1; |
| 190 | } |
| 191 | |
| 192 | |
| 193 | /* |
no test coverage detected