cl->from=from;
cl->to=to;
cl->status=LinphoneCallAborted; /*default status*/
+ cl->quality=-1;
return cl;
}
return linphone_call_get_remote_address(call);
}
+void linphone_core_set_log_handler(OrtpLogFunc logfunc) {
+ ortp_set_log_handler(logfunc);
+}
+
+void linphone_core_set_log_file(FILE *file) {
+ if (file == NULL) file = stdout;
+ ortp_set_log_file(file);
+}
+
+void linphone_core_set_log_level(OrtpLogLevel loglevel) {
+ ortp_set_log_level_mask(loglevel);
+}
+
/**
* Enable logs in supplied FILE*.
*
* @ingroup misc
+ * @deprecated Use #linphone_core_set_log_file and #linphone_core_set_log_level instead.
*
* @param file a C FILE* where to fprintf logs. If null stdout is used.
*
* Enable logs through the user's supplied log callback.
*
* @ingroup misc
+ * @deprecated Use #linphone_core_set_log_handler and #linphone_core_set_log_level instead.
*
* @param logfunc The address of a OrtpLogFunc callback whose protoype is
* typedef void (*OrtpLogFunc)(OrtpLogLevel lev, const char *fmt, va_list args);
* Entirely disable logging.
*
* @ingroup misc
+ * @deprecated Use #linphone_core_set_log_level instead.
**/
void linphone_core_disable_logs(){
ortp_set_log_level_mask(ORTP_ERROR|ORTP_FATAL);
linphone_core_set_firewall_policy(lc,tmp);
tmp=lp_config_get_int(lc->config,"net","nat_sdp_only",0);
lc->net_conf.nat_sdp_only=tmp;
- tmp=lp_config_get_int(lc->config,"net","mtu",0);
+ tmp=lp_config_get_int(lc->config,"net","mtu",1300);
linphone_core_set_mtu(lc,tmp);
tmp=lp_config_get_int(lc->config,"net","download_ptime",0);
linphone_core_set_download_ptime(lc,tmp);
}
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);
+ 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=24; 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=24; sizeLength=13; streamType=5");
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;
}
if (call->state==LinphoneCallIncomingReceived){
ms_message("incoming call ringing for %i seconds",elapsed);
if (elapsed>lc->sip_conf.inc_timeout){
+ LinphoneReason decline_reason;
ms_message("incoming call timeout (%i)",lc->sip_conf.inc_timeout);
- LinphoneReason decline_reason=lc->current_call ? LinphoneReasonBusy : LinphoneReasonDeclined;
+ decline_reason=lc->current_call ? LinphoneReasonBusy : LinphoneReasonDeclined;
call->log->status=LinphoneCallMissed;
call->reason=LinphoneReasonNotAnswered;
linphone_core_decline_call(lc,call,decline_reason);
lc->initial_subscribes_sent=TRUE;
}
- if (one_second_elapsed && lp_config_needs_commit(lc->config)){
- lp_config_sync(lc->config);
+ if (one_second_elapsed) {
+ if (lp_config_needs_commit(lc->config)) {
+ lp_config_sync(lc->config);
+ }
}
}
sal_call_set_local_media_description(call->op,call->localdesc);
}
- if (call->audiostream==NULL){
+ if (call->audiostream==NULL)
linphone_call_init_media_streams(call);
- // the local media description must be regenerated after the audiostream
- // is initialized, otherwise the ZRTP hello hash will not be available
- linphone_call_make_local_media_description(lc,call);
- sal_call_set_local_media_description(call->op,call->localdesc);
- }
-
if (!was_ringing && call->audiostream->ms.ticker==NULL){
audio_stream_prepare_sound(call->audiostream,lc->sound_conf.play_sndcard,lc->sound_conf.capt_sndcard);
}