mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 19:18:06 +00:00
Restart ICE if the c= line is set to 0.0.0.0.
This commit is contained in:
parent
32ef8c9994
commit
bccc94646a
3 changed files with 43 additions and 10 deletions
|
|
@ -359,6 +359,11 @@ static void call_ack(SalOp *op){
|
|||
|
||||
static void call_accept_update(LinphoneCore *lc, LinphoneCall *call){
|
||||
SalMediaDescription *md;
|
||||
SalMediaDescription *rmd=sal_call_get_remote_media_description(call->op);
|
||||
if ((rmd!=NULL) && (call->ice_session!=NULL)) {
|
||||
linphone_core_update_ice_from_remote_media_description(call,rmd);
|
||||
linphone_core_update_local_media_description_from_ice(call->localdesc,call->ice_session);
|
||||
}
|
||||
sal_call_accept(call->op);
|
||||
md=sal_call_get_final_media_description(call->op);
|
||||
if (md && !sal_media_description_empty(md))
|
||||
|
|
|
|||
|
|
@ -2897,6 +2897,8 @@ int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call)
|
|||
return -1;
|
||||
}
|
||||
update_local_media_description(lc,call);
|
||||
if (call->ice_session != NULL)
|
||||
linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session);
|
||||
if (sal_media_description_has_dir(call->resultdesc,SalStreamSendRecv)){
|
||||
sal_media_description_set_dir(call->localdesc,SalStreamSendOnly);
|
||||
subject="Call on hold";
|
||||
|
|
@ -2974,6 +2976,8 @@ int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *the_call)
|
|||
if (call->audiostream) audio_stream_play(call->audiostream, NULL);
|
||||
|
||||
update_local_media_description(lc,the_call);
|
||||
if (call->ice_session != NULL)
|
||||
linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session);
|
||||
sal_call_set_local_media_description(call->op,call->localdesc);
|
||||
sal_media_description_set_dir(call->localdesc,SalStreamSendRecv);
|
||||
if (call->params.in_conference && !call->current_params.in_conference) subject="Conference";
|
||||
|
|
|
|||
|
|
@ -703,14 +703,33 @@ static void get_default_addr_and_port(uint16_t componentID, const SalMediaDescri
|
|||
|
||||
void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md)
|
||||
{
|
||||
bool_t ice_restarted = FALSE;
|
||||
|
||||
if ((md->ice_pwd[0] != '\0') && (md->ice_ufrag[0] != '\0')) {
|
||||
int i, j;
|
||||
|
||||
/* Check for ICE restart and set remote credentials. */
|
||||
if ((strcmp(md->addr, "0.0.0.0") == 0) || (strcmp(md->addr, "::0") == 0)) {
|
||||
ice_session_restart(call->ice_session);
|
||||
ice_restarted = TRUE;
|
||||
} else {
|
||||
for (i = 0; i < md->nstreams; i++) {
|
||||
const SalStreamDescription *stream = &md->streams[i];
|
||||
IceCheckList *cl = ice_session_check_list(call->ice_session, i);
|
||||
if (cl && (strcmp(stream->rtp_addr, "0.0.0.0") == 0)) {
|
||||
ice_session_restart(call->ice_session);
|
||||
ice_restarted = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((ice_session_remote_ufrag(call->ice_session) == NULL) && (ice_session_remote_pwd(call->ice_session) == NULL)) {
|
||||
ice_session_set_remote_credentials(call->ice_session, md->ice_ufrag, md->ice_pwd);
|
||||
} else if (ice_session_remote_credentials_changed(call->ice_session, md->ice_ufrag, md->ice_pwd)) {
|
||||
ice_session_restart(call->ice_session);
|
||||
if (ice_restarted == FALSE) {
|
||||
ice_session_restart(call->ice_session);
|
||||
ice_restarted = TRUE;
|
||||
}
|
||||
ice_session_set_remote_credentials(call->ice_session, md->ice_ufrag, md->ice_pwd);
|
||||
}
|
||||
for (i = 0; i < md->nstreams; i++) {
|
||||
|
|
@ -718,7 +737,10 @@ void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call,
|
|||
IceCheckList *cl = ice_session_check_list(call->ice_session, i);
|
||||
if (cl && (stream->ice_pwd[0] != '\0') && (stream->ice_ufrag[0] != '\0')) {
|
||||
if (ice_check_list_remote_credentials_changed(cl, stream->ice_ufrag, stream->ice_pwd)) {
|
||||
ice_session_restart(call->ice_session);
|
||||
if (ice_restarted == FALSE) {
|
||||
ice_session_restart(call->ice_session);
|
||||
ice_restarted = TRUE;
|
||||
}
|
||||
ice_session_set_remote_credentials(call->ice_session, md->ice_ufrag, md->ice_pwd);
|
||||
break;
|
||||
}
|
||||
|
|
@ -761,14 +783,16 @@ void linphone_core_update_ice_from_remote_media_description(LinphoneCall *call,
|
|||
ice_add_remote_candidate(cl, candidate->type, candidate->addr, candidate->port, candidate->componentID,
|
||||
candidate->priority, candidate->foundation, default_candidate);
|
||||
}
|
||||
for (j = 0; j < SAL_MEDIA_DESCRIPTION_MAX_ICE_REMOTE_CANDIDATES; j++) {
|
||||
const SalIceRemoteCandidate *candidate = &stream->ice_remote_candidates[j];
|
||||
const char *addr = NULL;
|
||||
int port = 0;
|
||||
int componentID = j + 1;
|
||||
if (candidate->addr[0] == '\0') break;
|
||||
get_default_addr_and_port(componentID, md, stream, &addr, &port);
|
||||
ice_add_losing_pair(ice_session_check_list(call->ice_session, i), j + 1, candidate->addr, candidate->port, addr, port);
|
||||
if (ice_restarted == FALSE) {
|
||||
for (j = 0; j < SAL_MEDIA_DESCRIPTION_MAX_ICE_REMOTE_CANDIDATES; j++) {
|
||||
const SalIceRemoteCandidate *candidate = &stream->ice_remote_candidates[j];
|
||||
const char *addr = NULL;
|
||||
int port = 0;
|
||||
int componentID = j + 1;
|
||||
if (candidate->addr[0] == '\0') break;
|
||||
get_default_addr_and_port(componentID, md, stream, &addr, &port);
|
||||
ice_add_losing_pair(ice_session_check_list(call->ice_session, i), j + 1, candidate->addr, candidate->port, addr, port);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue