void linphone_core_set_log_level(OrtpLogLevel loglevel) {
ortp_set_log_level_mask(loglevel);
- if (loglevel == 0) {
- sal_disable_logs();
- } else {
- sal_enable_logs();
- }
}
/**
int ipv6;
int random_port;
- tmp=lp_config_get_int(lc->config,"sip","use_info",0);
- linphone_core_set_use_info_for_dtmf(lc,tmp);
-
if (lp_config_get_int(lc->config,"sip","use_session_timers",0)==1){
sal_use_session_timers(lc->sal,200);
}
sal_reuse_authorization(lc->sal, lp_config_get_int(lc->config,"sip","reuse_authorization",0));
sal_expire_old_registration_contacts(lc->sal,lp_config_get_int(lc->config,"sip","expire_old_registration_contacts",0));
- tmp=lp_config_get_int(lc->config,"sip","use_rfc2833",1);
- linphone_core_set_use_rfc2833_for_dtmf(lc,tmp);
-
ipv6=lp_config_get_int(lc->config,"sip","use_ipv6",-1);
if (ipv6==-1){
ipv6=0;
}codec_desc_t;
static codec_desc_t codec_pref_order[]={
+ {"opus", 48000},
{"SILK", 16000},
{"speex", 16000},
{"speex", 8000},
}
static void misc_config_read (LinphoneCore *lc) {
LpConfig *config=lc->config;
- lc->max_call_logs=lp_config_get_int(config,"misc","history_max_size",15);
- lc->max_calls=lp_config_get_int(config,"misc","max_calls",NB_MAX_CALLS);
- linphone_core_set_log_level((OrtpLogLevel)lp_config_get_int(config,"misc","log_level",0));
+ lc->max_call_logs=lp_config_get_int(config,"misc","history_max_size",15);
+ lc->max_calls=lp_config_get_int(config,"misc","max_calls",NB_MAX_CALLS);
}
-static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vtable, const char *config_path,
- const char *factory_config_path, void * userdata)
+static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vtable, LpConfig *config, void * userdata)
{
ms_message("Initializing LinphoneCore %s", linphone_core_get_version());
memset (lc, 0, sizeof (LinphoneCore));
+ lc->config=config;
lc->data=userdata;
lc->ringstream_autorelease=TRUE;
linphone_core_assign_payload_type(lc,&payload_type_silk_wb,-1,NULL);
linphone_core_assign_payload_type(lc,&payload_type_silk_swb,-1,NULL);
linphone_core_assign_payload_type(lc,&payload_type_g729,18,"annexb=no");
+ linphone_core_assign_payload_type(lc,&payload_type_aaceld_22k,-1,"config=F8EE2000; constantDuration=512; indexDeltaLength=3; indexLength=3; mode=AAC-hbr; profile-level-id=76; sizeLength=13; streamType=5");
+ linphone_core_assign_payload_type(lc,&payload_type_aaceld_44k,-1,"config=F8E82000; constantDuration=512; indexDeltaLength=3; indexLength=3; mode=AAC-hbr; profile-level-id=76; sizeLength=13; streamType=5");
+ linphone_core_assign_payload_type(lc,&payload_type_opus,-1,"useinbandfec=1; usedtx=1");
linphone_core_handle_static_payloads(lc);
ms_init();
lc->msevq=ms_event_queue_new();
ms_set_global_event_queue(lc->msevq);
- lc->config=lp_config_new(config_path);
- if (factory_config_path)
- lp_config_read_file(lc->config,factory_config_path);
-
lc->sal=sal_init();
sal_set_user_pointer(lc->sal,lc);
sal_set_callbacks(lc->sal,&linphone_sal_callbacks);
* It is OPTIONAL, use NULL if unneeded.
* @param userdata an opaque user pointer that can be retrieved at any time (for example in
* callbacks) using linphone_core_get_user_data().
- *
+ * @see linphone_core_new_with_config
**/
LinphoneCore *linphone_core_new(const LinphoneCoreVTable *vtable,
const char *config_path, const char *factory_config_path, void * userdata)
{
- LinphoneCore *core=ms_new(LinphoneCore,1);
- linphone_core_init(core,vtable,config_path, factory_config_path, userdata);
+ LpConfig *config = lp_config_new_with_factory(config_path, factory_config_path);
+ return linphone_core_new_with_config(vtable, config, userdata);
+}
+
+LinphoneCore *linphone_core_new_with_config(const LinphoneCoreVTable *vtable, struct _LpConfig *config, void *userdata)
+{
+ LinphoneCore *core = ms_new(LinphoneCore, 1);
+ linphone_core_init(core, vtable, config, userdata);
return core;
}
**/
bool_t linphone_core_get_use_info_for_dtmf(LinphoneCore *lc)
{
- return lc->sip_conf.use_info;
+ return lp_config_get_int(lc->config, "sip", "use_info", 0);
}
/**
**/
void linphone_core_set_use_info_for_dtmf(LinphoneCore *lc,bool_t use_info)
{
- lc->sip_conf.use_info=use_info;
+ if (linphone_core_ready(lc)) {
+ lp_config_set_int(lc->config, "sip", "use_info", use_info);
+ }
}
/**
**/
bool_t linphone_core_get_use_rfc2833_for_dtmf(LinphoneCore *lc)
{
- return lc->sip_conf.use_rfc2833;
+ return lp_config_get_int(lc->config, "sip", "use_rfc2833", 1);
}
/**
**/
void linphone_core_set_use_rfc2833_for_dtmf(LinphoneCore *lc,bool_t use_rfc2833)
{
- lc->sip_conf.use_rfc2833=use_rfc2833;
+ if (linphone_core_ready(lc)) {
+ lp_config_set_int(lc->config, "sip", "use_rfc2833", use_rfc2833);
+ }
}
/**
}
if (one_second_elapsed) {
- if (ortp_get_log_level_mask() != lp_config_get_int(lc->config, "misc", "log_level", 0)) {
- lp_config_set_int(lc->config, "misc", "log_level", ortp_get_log_level_mask());
- }
if (lp_config_needs_commit(lc->config)) {
lp_config_sync(lc->config);
}
**/
int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallParams *params){
int err=0;
+#ifdef VIDEO_ENABLED
+ bool_t has_video = FALSE;
+#endif
if (params!=NULL){
linphone_call_set_state(call,LinphoneCallUpdating,"Updating call");
#ifdef VIDEO_ENABLED
- bool_t has_video = call->params.has_video;
+ has_video = call->params.has_video;
// Video removing
if((call->videostream != NULL) && !params->has_video) {
return lc->net_conf.stun_server;
}
-bool_t linphone_core_upnp_available(const LinphoneCore *lc){
+bool_t linphone_core_upnp_available(){
#ifdef BUILD_UPNP
return TRUE;
#else
* If not set the core will create its own window.
**/
void linphone_core_set_native_preview_window_id(LinphoneCore *lc, unsigned long id){
- lc->preview_window_id=id;
#ifdef VIDEO_ENABLED
LinphoneCall *call=linphone_core_get_current_call(lc);
+ lc->preview_window_id=id;
if (call!=NULL && call->videostream){
video_stream_set_native_preview_window_id(call->videostream,id);
}else if (lc->previewstream){
**/
void linphone_core_show_video(LinphoneCore *lc, bool_t show){
#ifdef VIDEO_ENABLED
- ms_error("linphone_core_show_video %d", show);
LinphoneCall *call=linphone_core_get_current_call(lc);
+ ms_error("linphone_core_show_video %d", show);
if (call!=NULL && call->videostream){
video_stream_show_video(call->videostream,show);
}
ms_message("%s : rotation=%d\n", __FUNCTION__, rotation);
lc->device_rotation = rotation;
#ifdef VIDEO_ENABLED
- LinphoneCall *call=linphone_core_get_current_call(lc);
- if (call!=NULL && call->videostream){
- video_stream_set_device_rotation(call->videostream,rotation);
+ {
+ LinphoneCall *call=linphone_core_get_current_call(lc);
+ if (call!=NULL && call->videostream){
+ video_stream_set_device_rotation(call->videostream,rotation);
+ }
}
#endif
}
else ms_filter_call_method(f, MS_DTMF_GEN_START, &dtmf);
}
-/**
- * @ingroup media_parameters
- * Plays a repeated tone to the local user until next further call to #linphone_core_stop_dtmf()
- * @param lc #LinphoneCore
-**/
-void linphone_core_play_tone(LinphoneCore *lc){
- MSFilter *f=get_dtmf_gen(lc);
- MSDtmfGenCustomTone def;
- if (f==NULL){
- ms_error("No dtmf generator at this time !");
- return;
- }
- memset(&def,0,sizeof(def));
- def.duration=300;
- def.frequencies[0]=500;
- def.amplitude=1;
- def.interval=2000;
- ms_filter_call_method(f, MS_DTMF_GEN_PLAY_CUSTOM,&def);
-}
-
void linphone_core_play_named_tone(LinphoneCore *lc, LinphoneToneID toneid){
if (linphone_core_tone_indications_enabled(lc)){
MSFilter *f=get_dtmf_gen(lc);
lp_config_set_int(lc->config,"sip","inc_timeout",config->inc_timeout);
lp_config_set_int(lc->config,"sip","in_call_timeout",config->in_call_timeout);
lp_config_set_int(lc->config,"sip","delayed_timeout",config->delayed_timeout);
- lp_config_set_int(lc->config,"sip","use_info",config->use_info);
- lp_config_set_int(lc->config,"sip","use_rfc2833",config->use_rfc2833);
lp_config_set_int(lc->config,"sip","use_ipv6",config->ipv6_enabled);
lp_config_set_int(lc->config,"sip","register_only_when_network_is_up",config->register_only_when_network_is_up);
lp_config_set_int(lc->config,"sip","register_only_when_upnp_is_ok",config->register_only_when_upnp_is_ok);