Commit 3020133c authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Allocate ICE session when parsing SDP on incoming call.

parent c93c092c
......@@ -245,7 +245,7 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li
md->streams[i].crypto[1].algo = 0;
md->streams[i].crypto[2].algo = 0;
}
if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce){
if ((call->dir == LinphoneCallOutgoing) && (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce)){
md->streams[i].ice_check_list = ice_check_list_new();
ice_session_add_check_list(call->ice_session, md->streams[i].ice_check_list);
}
......@@ -388,7 +388,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro
linphone_call_init_common(call, from, to);
linphone_core_init_default_params(lc, &call->params);
call->params.has_video &= !!lc->video_policy.automatically_accept;
if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce) call->ice_session=ice_session_new();
if (((SalOpBase *)op)->remote_media->streams[0].ice_check_list != NULL) call->ice_session=((SalOpBase *)op)->remote_media->streams[0].ice_check_list->session;
call->localdesc=create_local_media_description (lc,call);
call->camera_active=call->params.has_video;
if (linphone_core_get_firewall_policy(call->core)==LinphonePolicyUseStun)
......
......@@ -390,6 +390,7 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc){
int i,j;
const char *mtype,*proto,*port,*addr,*number;
const char *ice_ufrag, *ice_pwd;
IceSession *ice_session = NULL;
sdp_bandwidth_t *sbw=NULL;
sdp_attribute_t *attr;
int media_attribute_nb;
......@@ -512,8 +513,13 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc){
unsigned int port;
int nb;
/* Allocate the ICE session if it has not been done yet. */
if (ice_session == NULL) ice_session = ice_session_new();
/* Allocate the ICE check list if it has not been done yet. */
if (desc->streams[i].ice_check_list == NULL) desc->streams[i].ice_check_list = ice_check_list_new();
if (desc->streams[i].ice_check_list == NULL) {
desc->streams[i].ice_check_list = ice_check_list_new();
ice_session_add_check_list(ice_session, desc->streams[i].ice_check_list);
}
nb = sscanf(attr->a_att_value, "%s %u UDP %u %s %u typ %s",
foundation, &componentID, &priority, ip, &port, type);
if (nb == 6) {
......@@ -539,9 +545,9 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc){
ice_pwd = attr->a_att_value;
}
}
if ((ice_ufrag != NULL) && (ice_pwd != NULL)) {
ms_error("ufrag: %s, pwd: %s", ice_ufrag, ice_pwd);
//ice_session_set_remote_credentials(session, ice_ufrag, ice_pwd);
if ((ice_session != NULL) && (ice_ufrag != NULL) && (ice_pwd != NULL)) {
ice_session_set_remote_credentials(ice_session, ice_ufrag, ice_pwd);
ice_dump_session(ice_session);
}
desc->nstreams=i;
return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment