int sdp_keep_codecs_by_name(sip_msg_t* msg, str* codecs, str *media) { sdp_info_t *sdp = NULL; str idslist; if(parse_sdp(msg) < 0) { LM_ERR("Unable to parse sdp\n"); return -1; } sdp = (sdp_info_t*)msg->body; if(sdp==NULL) { LM_DBG("No sdp body\n"); return -1; } LM_DBG("attempting to keep codecs in sdp: [%.*s]\n", codecs->len, codecs->s); if(sdpops_build_ids_list(sdp, codecs, &idslist)<0) return -1; if(sdp_keep_codecs_by_id(msg, &idslist, media)<0) return -1; return 0; }
int sdp_with_codecs_by_name(sip_msg_t* msg, str* codecs) { str idslist; sdp_info_t *sdp = NULL; int ret; if(parse_sdp(msg) < 0) { LM_ERR("Unable to parse sdp\n"); return -1; } sdp = (sdp_info_t*)msg->body; if(sdp==NULL) { LM_DBG("No sdp body\n"); return -1; } if(sdpops_build_ids_list(sdp, codecs, &idslist)<0) return -1; ret = sdp_with_codecs_by_id(msg, &idslist); /* ret: -1 error; 0 not found */ if(ret<=0) return (ret - 1); return ret; }
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(codecs, &idslist)<0) return -1; if(sdp_keep_codecs_by_id(msg, &idslist)<0) return -1; return 0; }