daniel,
i fixed the crash like this:
*************** *** 482,495 **** int sdp_keep_codecs_by_name(sip_msg_t* msg, str* codecs) { str idslist;
! if(parse_sdp(msg) < 0) { LM_ERR("Unable to parse sdp\n"); return -1; }
! LM_ERR("attempting to keep codecs in sdp: [%.*s]\n", ! codecs->len, codecs->s);
if(sdpops_build_ids_list((sdp_info_t*)msg->body, codecs, &idslist)<0) return -1; --- 482,498 ---- int sdp_keep_codecs_by_name(sip_msg_t* msg, str* codecs) { str idslist; + int res;
! res = parse_sdp(msg); ! if(res < 0) { LM_ERR("Unable to parse sdp\n"); return -1; } + if(res == 1) return 0;
! LM_DBG("attempting to keep codecs in sdp: [%.*s]\n", ! codecs->len, codecs->s);
if(sdpops_build_ids_list((sdp_info_t*)msg->body, codecs, &idslist)<0) return -1;
and tried again sdp_keep_codecs_by_name("PCMU,PCMA,speex"); on
v=0. o=twinkle 1548176998 229186862 IN IP4 192.98.102.10. s=-. c=IN IP4 192.98.102.10. t=0 0. m=audio 8000 RTP/AVP 99 97 8 0 3 101. a=rtpmap:99 speex/32000. a=rtpmap:97 speex/8000. a=rtpmap:8 PCMA/8000. a=rtpmap:0 PCMU/8000. a=rtpmap:3 GSM/8000. a=rtpmap:101 telephone-event/8000. a=fmtp:101 0-15. a=ptime:20. a=zrtp.
the result was
v=0. o=twinkle 1548176998 229186862 IN IP4 192.98.102.10. s=-. c=IN IP4 192.98.102.10. t=0 0. m=audio 8000 RTP/AVP 0. a=rtpmap:0 PCMU/8000. a=ptime:20. a=zrtp.
your turn.
-- juha