LinphoneCallParams * linphone_call_params_copy(const LinphoneCallParams *cp){ unsigned int i; LinphoneCallParams *ncp=linphone_call_params_new(); memcpy(ncp,cp,sizeof(LinphoneCallParams)); if (cp->record_file) ncp->record_file=ms_strdup(cp->record_file); if (cp->session_name) ncp->session_name=ms_strdup(cp->session_name); /* * The management of the custom headers is not optimal. We copy everything while ref counting would be more efficient. */ if (cp->custom_headers) ncp->custom_headers=sal_custom_header_clone(cp->custom_headers); if (cp->custom_sdp_attributes) ncp->custom_sdp_attributes = sal_custom_sdp_attribute_clone(cp->custom_sdp_attributes); for (i = 0; i < (unsigned int)LinphoneStreamTypeUnknown; i++) { if (cp->custom_sdp_media_attributes[i]) ncp->custom_sdp_media_attributes[i] = sal_custom_sdp_attribute_clone(cp->custom_sdp_media_attributes[i]); } return ncp; }
void linphone_call_params_set_custom_sdp_media_attributes(LinphoneCallParams *params, LinphoneStreamType type, const SalCustomSdpAttribute *csa) { if (params->custom_sdp_media_attributes[type]) { sal_custom_sdp_attribute_free(params->custom_sdp_media_attributes[type]); params->custom_sdp_media_attributes[type] = NULL; } if (csa) { params->custom_sdp_media_attributes[type] = sal_custom_sdp_attribute_clone(csa); } }
void linphone_call_params_set_custom_sdp_attributes(LinphoneCallParams *params, const SalCustomSdpAttribute *csa) { if (params->custom_sdp_attributes) { sal_custom_sdp_attribute_free(params->custom_sdp_attributes); params->custom_sdp_attributes = NULL; } if (csa) { params->custom_sdp_attributes = sal_custom_sdp_attribute_clone(csa); } }
/** * Returns a media description to run the streams with, based on the local capabilities and * and the received offer. * The returned media description is an answer and should be sent to the offerer. **/ int offer_answer_initiate_incoming(MSFactory *factory, const SalMediaDescription *local_capabilities, const SalMediaDescription *remote_offer, SalMediaDescription *result, bool_t one_matching_codec){ int i; const SalStreamDescription *ls=NULL,*rs; for(i=0;i<remote_offer->nb_streams;++i){ rs = &remote_offer->streams[i]; ls = &local_capabilities->streams[i]; if (ls && rs->type == ls->type && rs->proto == ls->proto){ initiate_incoming(factory, ls,rs,&result->streams[i],one_matching_codec); // Handle global RTCP FB attributes result->streams[i].rtcp_fb.generic_nack_enabled = rs->rtcp_fb.generic_nack_enabled; result->streams[i].rtcp_fb.tmmbr_enabled = rs->rtcp_fb.tmmbr_enabled; // Handle media RTCP XR attribute memset(&result->streams[i].rtcp_xr, 0, sizeof(result->streams[i].rtcp_xr)); if (rs->rtcp_xr.enabled == TRUE) { const OrtpRtcpXrConfiguration *rtcp_xr_conf = NULL; if (ls->rtcp_xr.enabled == TRUE) rtcp_xr_conf = &ls->rtcp_xr; else if (local_capabilities->rtcp_xr.enabled == TRUE) rtcp_xr_conf = &local_capabilities->rtcp_xr; if ((rtcp_xr_conf != NULL) && (ls->dir == SalStreamSendRecv)) { memcpy(&result->streams[i].rtcp_xr, rtcp_xr_conf, sizeof(result->streams[i].rtcp_xr)); } else { result->streams[i].rtcp_xr.enabled = TRUE; } } }else { ms_message("Declining mline %i, no corresponding stream in local capabilities description.",i); /* create an inactive stream for the answer, as there where no matching stream in local capabilities */ result->streams[i].dir=SalStreamInactive; result->streams[i].rtp_port=0; result->streams[i].type=rs->type; result->streams[i].proto=rs->proto; if (rs->type==SalOther){ strncpy(result->streams[i].typeother,rs->typeother,sizeof(rs->typeother)-1); } if (rs->proto==SalProtoOther){ strncpy(result->streams[i].proto_other,rs->proto_other,sizeof(rs->proto_other)-1); } } result->streams[i].custom_sdp_attributes = sal_custom_sdp_attribute_clone(ls->custom_sdp_attributes); } result->nb_streams=i; strcpy(result->username, local_capabilities->username); strcpy(result->addr,local_capabilities->addr); result->bandwidth=local_capabilities->bandwidth; result->session_ver=local_capabilities->session_ver; result->session_id=local_capabilities->session_id; strcpy(result->ice_pwd, local_capabilities->ice_pwd); strcpy(result->ice_ufrag, local_capabilities->ice_ufrag); result->ice_lite = local_capabilities->ice_lite; result->set_nortpproxy = local_capabilities->set_nortpproxy; result->custom_sdp_attributes = sal_custom_sdp_attribute_clone(local_capabilities->custom_sdp_attributes); strcpy(result->name,local_capabilities->name); // Handle session RTCP XR attribute memset(&result->rtcp_xr, 0, sizeof(result->rtcp_xr)); if (remote_offer->rtcp_xr.enabled == TRUE) { if ((local_capabilities->rtcp_xr.enabled == TRUE) && (local_capabilities->dir == SalStreamSendRecv)) { memcpy(&result->rtcp_xr, &local_capabilities->rtcp_xr, sizeof(result->rtcp_xr)); } else { result->rtcp_xr.enabled = TRUE; } } return 0; }