MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / parse_sdp

Function parse_sdp

parser/sdp/sdp.c:686–730  ·  view source on GitHub ↗

* Parse all SDP parts from the SIP body. * * returns the first found SDP on success * returns NULL if no SDP found or if error */

Source from the content-addressed store, hash-verified

684 * returns NULL if no SDP found or if error
685 */
686sdp_info_t* parse_sdp(struct sip_msg* _m)
687{
688 struct body_part *part;
689 sdp_info_t *sdp, *ret;
690
691 if ( parse_sip_body(_m)<0 || _m->body==NULL) {
692 LM_DBG("message body has length zero: %p\n", _m->body);
693 return NULL;
694 }
695
696 ret = NULL;
697
698 /* iterate all body parts and look for the SDP mime */
699 for( part=&_m->body->first ; part ; part=part->next) {
700
701 /* skip body parts which were deleted or newly added */
702 if (!is_body_part_received(part))
703 continue;
704
705 if ( part->mime != ((TYPE_APPLICATION<<16)+SUBTYPE_SDP) )
706 continue;
707
708 if (part->parsed) {
709 if (!ret)
710 ret = part->parsed;
711 continue;
712 }
713
714 if ( (sdp=new_sdp())==NULL ) {
715 LM_ERR("Can't create new sdp, skipping\n");
716 } else {
717 if (parse_sdp_session(&part->body, 0, NULL, sdp)<0) {
718 LM_ERR("failed to parse SDP for body part, skipping\n");
719 free_sdp( sdp );
720 } else {
721 part->parsed = (void*)sdp;
722 part->free_parsed_f = (free_parsed_part_function)free_sdp;
723 /* remember the first found SDP */
724 if (!ret) ret = sdp;
725 }
726 }
727 }
728
729 return ret;
730}
731
732void free_sdp_content(sdp_info_t* sdp)
733{

Callers 15

pv_set_sdpFunction · 0.85
is_audio_on_holdFunction · 0.85
w_sip_validateFunction · 0.85
do_for_all_streamsFunction · 0.85
handle_streamsFunction · 0.85
get_sdp_peer_infoFunction · 0.85
b2b_apply_lumpsFunction · 0.85
sca_logic_notifyFunction · 0.85
w_handle_callFunction · 0.85
qos_dialog_created_CBFunction · 0.85
qos_dialog_request_CBFunction · 0.85
qos_dialog_response_CBFunction · 0.85

Calls 4

parse_sip_bodyFunction · 0.85
new_sdpFunction · 0.85
parse_sdp_sessionFunction · 0.85
free_sdpFunction · 0.85

Tested by

no test coverage detected