return l;
}
+static void update_media_description_from_stun(SalMediaDescription *md, const StunCandidate *ac, const StunCandidate *vc){
+ if (ac->port!=0){
+ strcpy(md->streams[0].rtp_addr,ac->addr);
+ md->streams[0].rtp_port=ac->port;
+ if ((ac->addr[0]!='\0' && vc->addr[0]!='\0' && strcmp(ac->addr,vc->addr)==0) || md->nstreams==1){
+ strcpy(md->addr,ac->addr);
+ }
+ }
+ if (vc->port!=0){
+ strcpy(md->streams[1].rtp_addr,vc->addr);
+ md->streams[1].rtp_port=vc->port;
+ }
+
+}
+
+
static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, LinphoneCall *call, unsigned int session_id, unsigned int session_ver){
MSList *l;
PayloadType *pt;
ice_session_add_check_list(call->ice_session, ice_check_list_new());
}
}
-
+ update_media_description_from_stun(md,&call->ac,&call->vc);
linphone_address_destroy(addr);
return md;
}
stats->ice_state = LinphoneIceStateNotActivated;
}
-static void update_media_description_from_stun(SalMediaDescription *md, const StunCandidate *ac, const StunCandidate *vc){
- if (ac->port!=0){
- strcpy(md->streams[0].rtp_addr,ac->addr);
- md->streams[0].rtp_port=ac->port;
- if ((ac->addr[0]!='\0' && vc->addr[0]!='\0' && strcmp(ac->addr,vc->addr)==0) || md->nstreams==1){
- strcpy(md->addr,ac->addr);
- }
- }
- if (vc->port!=0){
- strcpy(md->streams[1].rtp_addr,vc->addr);
- md->streams[1].rtp_port=vc->port;
- }
-
-}
static void discover_mtu(LinphoneCore *lc, const char *remote){
int mtu;
}
}
-#define STUN_CANDIDATE_INIT {{0},0}
-
LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, const LinphoneCallParams *params)
{
LinphoneCall *call=ms_new0(LinphoneCall,1);
- StunCandidate ac=STUN_CANDIDATE_INIT,vc=STUN_CANDIDATE_INIT;
int ping_time=-1;
call->dir=LinphoneCallOutgoing;
call->op=sal_op_new(lc->sal);
ice_session_set_role(call->ice_session, IR_Controlling);
}
if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseStun) {
- ping_time=linphone_core_run_stun_tests(call->core,call,&ac, &vc);
+ ping_time=linphone_core_run_stun_tests(call->core,call);
}
if (ping_time>=0) {
linphone_core_adapt_to_network(lc,ping_time,&call->params);
}
call->localdesc=create_local_media_description(lc,call);
- update_media_description_from_stun(call->localdesc,&ac,&vc);
call->camera_active=params->has_video;
discover_mtu(lc,linphone_address_get_domain (to));
LinphoneCall *call=ms_new0(LinphoneCall,1);
char *from_str;
int ping_time=-1;
- StunCandidate ac=STUN_CANDIDATE_INIT,vc=STUN_CANDIDATE_INIT;
call->dir=LinphoneCallIncoming;
sal_op_set_user_pointer(op,call);
}
break;
case LinphonePolicyUseStun:
- ping_time=linphone_core_run_stun_tests(call->core,call,&ac, &vc);
+ ping_time=linphone_core_run_stun_tests(call->core,call);
/* No break to also destroy ice session in this case. */
default:
break;
linphone_core_adapt_to_network(lc,ping_time,&call->params);
};
call->localdesc=create_local_media_description(lc,call);
- update_media_description_from_stun(call->localdesc,&ac,&vc);
call->camera_active=call->params.has_video;
discover_mtu(lc,linphone_address_get_domain(from));
char* external_body_url;
LinphoneAddress* from;
};
-
+
+typedef struct StunCandidate{
+ char addr[64];
+ int port;
+}StunCandidate;
+
+
struct _LinphoneCall
{
int magic; /*used to distinguish from proxy config*/
void * user_pointer;
int audio_port;
int video_port;
+ StunCandidate ac,vc; /*audio video ip/port discovered by STUN*/
struct _AudioStream *audiostream; /**/
struct _VideoStream *videostream;
MSAudioEndpoint *endpoint; /*used for conferencing*/
void linphone_core_update_allocated_audio_bandwidth(LinphoneCore *lc);
void linphone_core_update_allocated_audio_bandwidth_in_call(LinphoneCall *call, const PayloadType *pt);
-typedef struct StunCandidate{
- char addr[64];
- int port;
-}StunCandidate;
-
-int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call, StunCandidate *ac, StunCandidate *vc);
+int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call);
void linphone_core_adapt_to_network(LinphoneCore *lc, int ping_time_ms, LinphoneCallParams *params);
int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call);
void linphone_core_update_ice_state_in_call_stats(LinphoneCall *call);