/*#define UNSTANDART_GSM_11K 1*/
static const char *liblinphone_version=LIBLINPHONE_VERSION;
-static void set_network_reachable(LinphoneCore* lc,bool_t isReachable);
+static void set_network_reachable(LinphoneCore* lc,bool_t isReachable, time_t curtime);
#include "enum.h"
extern SalCallbacks linphone_sal_callbacks;
+
void lc_callback_obj_init(LCCallbackObj *obj,LinphoneCoreCbFunc func,void* ud)
{
obj->_func=func;
char *tmp;
LpConfig *cfg=lc->config;
- if (!lc->ready) return;
+ if (linphone_core_get_global_state (lc)==LinphoneGlobalStartup) return;
for(i=0,elem=lc->call_logs;elem!=NULL;elem=elem->next,++i){
LinphoneCallLog *cl=(LinphoneCallLog*)elem->data;
ui_config_read(lc);
if (lc->vtable.display_status)
lc->vtable.display_status(lc,_("Ready"));
- linphone_core_set_state(lc,LinphoneGlobalOn,"Ready");
lc->auto_net_state_mon=lc->sip_conf.auto_net_state_mon;
-
- lc->ready=TRUE;
+ linphone_core_set_state(lc,LinphoneGlobalOn,"Ready");
}
/**
if (new_status){
ms_message("New local ip address is %s",result);
}
- set_network_reachable(lc,new_status);
+ set_network_reachable(lc,new_status, curtime);
last_status=new_status;
}
}
linphone_core_do_plugin_tasks(lc);
+ if (lc->initial_subscribes_sent==FALSE && lc->netup_time!=0 &&
+ (curtime-lc->netup_time)>3){
+ linphone_core_send_initial_subscribes(lc);
+ lc->initial_subscribes_sent=TRUE;
+ }
+
if (one_second_elapsed && lp_config_needs_commit(lc->config)){
lp_config_sync(lc->config);
}
return found_cfg;
}
+const char *linphone_core_find_best_identity(LinphoneCore *lc, const LinphoneAddress *to, const char **route){
+ LinphoneProxyConfig *cfg=linphone_core_lookup_known_proxy(lc,to);
+ if (cfg==NULL)
+ linphone_core_get_default_proxy (lc,&cfg);
+ if (cfg!=NULL){
+ *route=linphone_proxy_config_get_route(cfg);
+ return linphone_proxy_config_get_identity (cfg);
+ }
+ return linphone_core_get_primary_contact (lc);
+}
+
static char *get_fixed_contact(LinphoneCore *lc, LinphoneCall *call , LinphoneProxyConfig *dest_proxy){
LinphoneAddress *ctt;
const char *localip=call->localip;
int linphone_core_set_ringer_device(LinphoneCore *lc, const char * devid){
MSSndCard *card=get_card_from_string_id(devid,MS_SND_CARD_CAP_PLAYBACK);
lc->sound_conf.ring_sndcard=card;
- if (card && lc->ready)
+ if (card && linphone_core_ready(lc))
lp_config_set_string(lc->config,"sound","ringer_dev_id",ms_snd_card_get_string_id(card));
return 0;
}
int linphone_core_set_playback_device(LinphoneCore *lc, const char * devid){
MSSndCard *card=get_card_from_string_id(devid,MS_SND_CARD_CAP_PLAYBACK);
lc->sound_conf.play_sndcard=card;
- if (card && lc->ready)
+ if (card && linphone_core_ready(lc))
lp_config_set_string(lc->config,"sound","playback_dev_id",ms_snd_card_get_string_id(card));
return 0;
}
int linphone_core_set_capture_device(LinphoneCore *lc, const char * devid){
MSSndCard *card=get_card_from_string_id(devid,MS_SND_CARD_CAP_CAPTURE);
lc->sound_conf.capt_sndcard=card;
- if (card && lc->ready)
+ if (card && linphone_core_ready(lc))
lp_config_set_string(lc->config,"sound","capture_dev_id",ms_snd_card_get_string_id(card));
return 0;
}
ms_free(lc->sound_conf.local_ring);
}
lc->sound_conf.local_ring=ms_strdup(path);
- if (lc->ready && lc->sound_conf.local_ring)
+ if ( linphone_core_ready(lc) && lc->sound_conf.local_ring)
lp_config_set_string(lc->config,"sound","local_ring",lc->sound_conf.local_ring);
}
**/
void linphone_core_enable_echo_cancellation(LinphoneCore *lc, bool_t val){
lc->sound_conf.ec=val;
- if (lc->ready)
+ if ( linphone_core_ready(lc))
lp_config_set_int(lc->config,"sound","echocancellation",val);
}
if (olddev!=NULL && olddev!=lc->video_conf.device){
toggle_video_preview(lc,FALSE);/*restart the video local preview*/
}
- if (lc->ready && lc->video_conf.device){
+ if ( linphone_core_ready(lc) && lc->video_conf.device){
vd=ms_web_cam_get_string_id(lc->video_conf.device);
if (vd && strstr(vd,"Static picture")!=NULL){
vd=NULL;
toggle_video_preview(lc,FALSE);
toggle_video_preview(lc,TRUE);
}
- if (lc->ready)
+ if ( linphone_core_ready(lc))
lp_config_set_string(lc->config,"video","size",video_size_get_name(vsize));
}
}
linphone_core_set_state(lc,LinphoneGlobalOff,"Off");
}
-static void set_network_reachable(LinphoneCore* lc,bool_t isReachable){
+static void set_network_reachable(LinphoneCore* lc,bool_t isReachable, time_t curtime){
ms_message("Network state is now [%s]",isReachable?"UP":"DOWN");
// second get the list of available proxies
const MSList *elem=linphone_core_get_proxy_config_list(lc);
}
}
}
+ lc->netup_time=curtime;
lc->network_reachable=isReachable;
}
ms_message("Disabling automatic network state monitoring");
lc->auto_net_state_mon=FALSE;
}
- set_network_reachable(lc,isReachable);
+ set_network_reachable(lc,isReachable, ms_time(NULL));
}
bool_t linphone_core_is_network_reachabled(LinphoneCore* lc) {