Commit e0def942 authored by Simon Morlat's avatar Simon Morlat

Report call logs for calls aborted before they are notified to the application.

parent 5a46392c
......@@ -291,7 +291,7 @@ static void _linphone_account_creator_destroy(LinphoneAccountCreator *creator) {
if (creator->service != NULL && linphone_account_creator_service_get_destructor_cb(creator->service) != NULL)
linphone_account_creator_service_get_destructor_cb(creator->service)(creator);
linphone_account_creator_cbs_unref(creator->cbs);
linphone_proxy_config_destroy(creator->proxy_cfg);
linphone_proxy_config_unref(creator->proxy_cfg);
if (creator->username) ms_free(creator->username);
if (creator->display_name) ms_free(creator->display_name);
if (creator->password) ms_free(creator->password);
......@@ -626,11 +626,13 @@ LinphoneAccountCreatorStatus linphone_account_creator_update_account(LinphoneAcc
/************************** Start Account Creator Linphone **************************/
LinphoneAccountCreatorStatus linphone_account_creator_constructor_linphone(LinphoneAccountCreator *creator) {
LinphoneAddress *addr;
linphone_proxy_config_set_realm(creator->proxy_cfg, "sip.linphone.org");
linphone_proxy_config_set_route(creator->proxy_cfg, "sip.linphone.org");
linphone_proxy_config_set_server_addr(creator->proxy_cfg, "sip.linphone.org");
linphone_proxy_config_set_identity(creator->proxy_cfg, "sip:username@sip.linphone.org");
addr = linphone_address_new("sip:username@sip.linphone.org");
linphone_proxy_config_set_identity_address(creator->proxy_cfg, addr);
linphone_address_unref(addr);
return LinphoneAccountCreatorStatusRequestOk;
}
......
......@@ -507,10 +507,9 @@ static int is_media_description_acceptable(SalMediaDescription *md){
return TRUE;
}
static int process_sdp_for_invite(SalOp* op,belle_sip_request_t* invite) {
static SalReason process_sdp_for_invite(SalOp* op,belle_sip_request_t* invite) {
belle_sdp_session_description_t* sdp;
int err=0;
SalReason reason;
SalReason reason = SalReasonNone;
if (extract_sdp(op,BELLE_SIP_MESSAGE(invite),&sdp,&reason)==0) {
if (sdp){
......@@ -519,17 +518,16 @@ static int process_sdp_for_invite(SalOp* op,belle_sip_request_t* invite) {
sdp_to_media_description(sdp,op->base.remote_media);
/*make some sanity check about the SDP received*/
if (!is_media_description_acceptable(op->base.remote_media)){
err=-1;
reason=SalReasonNotAcceptable;
}
belle_sip_object_unref(sdp);
}else op->sdp_offering=TRUE; /*INVITE without SDP*/
}else err=-1;
}
if (err==-1){
if (reason != SalReasonNone){
sal_call_decline(op,reason,NULL);
}
return err;
return reason;
}
static void sal_op_reset_descriptions(SalOp *op) {
......@@ -550,6 +548,7 @@ static bool_t is_a_pending_invite_incoming_transaction(belle_sip_transaction_t *
static void process_request_event(void *op_base, const belle_sip_request_event_t *event) {
SalOp* op = (SalOp*)op_base;
SalReason reason;
belle_sip_server_transaction_t* server_transaction=NULL;
belle_sdp_session_description_t* sdp;
belle_sip_request_t* req = belle_sip_request_event_get_request(event);
......@@ -594,7 +593,7 @@ static void process_request_event(void *op_base, const belle_sip_request_event_t
ms_warning("replace header already set");
}
if (process_sdp_for_invite(op,req) == 0) {
if ( (reason = process_sdp_for_invite(op,req)) == SalReasonNone) {
if ((call_info=belle_sip_message_get_header(BELLE_SIP_MESSAGE(req),"Call-Info"))) {
if( strstr(belle_sip_header_get_unparsed_value(call_info),"answer-after=") != NULL) {
op->auto_answer_asked=TRUE;
......@@ -603,6 +602,8 @@ static void process_request_event(void *op_base, const belle_sip_request_event_t
}
op->base.root->callbacks.call_received(op);
}else{
sal_error_info_set(&op->error_info, reason, "SIP", 0, NULL, NULL);
op->base.root->callbacks.call_rejected(op);
/*the INVITE was declined by process_sdp_for_invite(). As we are not inside an established dialog, we can drop the op immediately*/
drop_op = TRUE;
}
......@@ -631,7 +632,7 @@ static void process_request_event(void *op_base, const belle_sip_request_event_t
belle_sip_server_transaction_send_response(server_transaction,resp);
} else if (strcmp("UPDATE",method)==0) {
sal_op_reset_descriptions(op);
if (process_sdp_for_invite(op,req)==0)
if (process_sdp_for_invite(op,req)==SalReasonNone)
op->base.root->callbacks.call_updating(op,TRUE);
} else {
belle_sip_error("Unexpected method [%s] for dialog state BELLE_SIP_DIALOG_EARLY",belle_sip_request_get_method(req));
......@@ -680,7 +681,7 @@ static void process_request_event(void *op_base, const belle_sip_request_event_t
} else {
/*re-invite*/
sal_op_reset_descriptions(op);
if (process_sdp_for_invite(op,req)==0)
if (process_sdp_for_invite(op,req)==SalReasonNone)
op->base.root->callbacks.call_updating(op,is_update);
}
} else if (strcmp("INFO",method)==0){
......
......@@ -259,6 +259,10 @@ bool_t linphone_call_log_was_conference(LinphoneCallLog *cl) {
return cl->was_conference;
}
const LinphoneErrorInfo *linphone_call_log_get_error_info(LinphoneCallLog *cl){
return cl->error_info;
}
/*******************************************************************************
* Reference and user data handling functions *
......@@ -293,6 +297,7 @@ static void _linphone_call_log_destroy(LinphoneCallLog *cl) {
if (cl->reporting.reports[LINPHONE_CALL_STATS_AUDIO]!=NULL) linphone_reporting_destroy(cl->reporting.reports[LINPHONE_CALL_STATS_AUDIO]);
if (cl->reporting.reports[LINPHONE_CALL_STATS_VIDEO]!=NULL) linphone_reporting_destroy(cl->reporting.reports[LINPHONE_CALL_STATS_VIDEO]);
if (cl->reporting.reports[LINPHONE_CALL_STATS_TEXT]!=NULL) linphone_reporting_destroy(cl->reporting.reports[LINPHONE_CALL_STATS_TEXT]);
if (cl->error_info) linphone_error_info_unref(cl->error_info);
}
LinphoneCallLog * linphone_call_log_new(LinphoneCallDir dir, LinphoneAddress *from, LinphoneAddress *to) {
......@@ -313,6 +318,7 @@ LinphoneCallLog * linphone_call_log_new(LinphoneCallDir dir, LinphoneAddress *fr
return cl;
}
/* DEPRECATED */
void linphone_call_log_destroy(LinphoneCallLog *cl) {
belle_sip_object_unref(cl);
......
......@@ -269,6 +269,7 @@ static void call_received(SalOp *h){
LinphoneAddress *from_address_to_search_if_me=NULL; /*address used to know if I'm the caller*/
SalMediaDescription *md;
const char * p_asserted_id;
LinphoneErrorInfo *ei = NULL;
/* Look if this INVITE is for a call that has already been notified but broken because of network failure */
replaced_call = look_for_broken_call_to_replace(h, lc);
......@@ -276,6 +277,27 @@ static void call_received(SalOp *h){
linphone_call_replace_op(replaced_call, h);
return;
}
p_asserted_id = sal_custom_header_find(sal_op_get_recv_custom_header(h),"P-Asserted-Identity");
/*in some situation, better to trust the network rather than the UAC*/
if (lp_config_get_int(lc->config,"sip","call_logs_use_asserted_id_instead_of_from",0)) {
LinphoneAddress *p_asserted_id_addr;
if (!p_asserted_id) {
ms_warning("No P-Asserted-Identity header found so cannot use it for op [%p] instead of from",h);
} else {
p_asserted_id_addr = linphone_address_new(p_asserted_id);
if (!p_asserted_id_addr) {
ms_warning("Unsupported P-Asserted-Identity header for op [%p] ",h);
} else {
ms_message("Using P-Asserted-Identity [%s] instead of from [%s] for op [%p]",p_asserted_id,sal_op_get_from(h),h);
from_addr=p_asserted_id_addr;
}
}
}
if (!from_addr)
from_addr=linphone_address_new(sal_op_get_from(h));
to_addr=linphone_address_new(sal_op_get_to(h));
/* first check if we can answer successfully to this invite */
if (linphone_presence_model_get_basic_status(lc->presence_model) == LinphonePresenceBasicStatusClosed) {
......@@ -286,6 +308,9 @@ static void call_received(SalOp *h){
if (alt_contact != NULL) {
sal_call_decline(h,SalReasonRedirect,alt_contact);
ms_free(alt_contact);
ei = linphone_error_info_new();
linphone_error_info_set(ei, LinphoneReasonMovedPermanently, 302, "Moved permanently", NULL);
linphone_core_report_early_failed_call(lc, LinphoneCallIncoming, from_addr, to_addr, ei);
sal_op_release(h);
return;
}
......@@ -298,29 +323,13 @@ static void call_received(SalOp *h){
if (!linphone_core_can_we_add_call(lc)){/*busy*/
sal_call_decline(h,SalReasonBusy,NULL);
ei = linphone_error_info_new();
linphone_error_info_set(ei, LinphoneReasonBusy, 486, "Busy - too many calls", NULL);
linphone_core_report_early_failed_call(lc, LinphoneCallIncoming, from_addr, to_addr, ei);
sal_op_release(h);
return;
}
p_asserted_id = sal_custom_header_find(sal_op_get_recv_custom_header(h),"P-Asserted-Identity");
/*in some situation, better to trust the network rather than the UAC*/
if (lp_config_get_int(lc->config,"sip","call_logs_use_asserted_id_instead_of_from",0)) {
LinphoneAddress *p_asserted_id_addr;
if (!p_asserted_id) {
ms_warning("No P-Asserted-Identity header found so cannot use it for op [%p] instead of from",h);
} else {
p_asserted_id_addr = linphone_address_new(p_asserted_id);
if (!p_asserted_id_addr) {
ms_warning("Unsupported P-Asserted-Identity header for op [%p] ",h);
} else {
ms_message("Using P-Asserted-Identity [%s] instead of from [%s] for op [%p]",p_asserted_id,sal_op_get_from(h),h);
from_addr=p_asserted_id_addr;
}
}
}
if (!from_addr)
from_addr=linphone_address_new(sal_op_get_from(h));
to_addr=linphone_address_new(sal_op_get_to(h));
if (sal_op_get_privacy(h) == SalPrivacyNone) {
from_address_to_search_if_me=linphone_address_clone(from_addr);
......@@ -334,6 +343,9 @@ static void call_received(SalOp *h){
char *addr = linphone_address_as_string(from_addr);
ms_warning("Receiving a call while one with same address [%s] is initiated, refusing this one with busy message.",addr);
sal_call_decline(h,SalReasonBusy,NULL);
ei = linphone_error_info_new();
linphone_error_info_set(ei, LinphoneReasonBusy, 486, "Busy - duplicated call", NULL);
linphone_core_report_early_failed_call(lc, LinphoneCallIncoming, from_addr, to_addr, ei);
sal_op_release(h);
linphone_address_unref(from_addr);
linphone_address_unref(to_addr);
......@@ -351,6 +363,9 @@ static void call_received(SalOp *h){
md=sal_call_get_final_media_description(call->op);
if (md){
if (sal_media_description_empty(md) || linphone_core_incompatible_security(lc,md)){
ei = linphone_error_info_new();
linphone_error_info_set(ei, LinphoneReasonNotAcceptable, 488, "Not acceptable here", NULL);
linphone_core_report_early_failed_call(lc, LinphoneCallIncoming, linphone_address_ref(from_addr), linphone_address_ref(to_addr), ei);
sal_call_decline(call->op,SalReasonNotAcceptable,NULL);
linphone_call_unref(call);
return;
......@@ -379,6 +394,13 @@ static void call_received(SalOp *h){
linphone_core_notify_incoming_call(lc,call);
}
static void call_rejected(SalOp *h){
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(h));
LinphoneErrorInfo *ei = linphone_error_info_new();
linphone_error_info_from_sal_op(ei, h);
linphone_core_report_early_failed_call(lc, LinphoneCallIncoming, linphone_address_new(sal_op_get_from(h)), linphone_address_new(sal_op_get_to(h)), ei);
}
static void try_early_media_forking(LinphoneCall *call, SalMediaDescription *md){
SalMediaDescription *cur_md=call->resultdesc;
int i;
......@@ -1457,6 +1479,7 @@ static void on_notify_response(SalOp *op){
SalCallbacks linphone_sal_callbacks={
call_received,
call_rejected,
call_ringing,
call_accepted,
call_ack,
......
......@@ -4690,9 +4690,9 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse
void linphone_call_log_completed(LinphoneCall *call){
LinphoneCore *lc=call->core;
bool_t call_logs_sqlite_db_found = FALSE;
call->log->duration=_linphone_call_get_duration(call); /*store duration since connected*/
call->log->error_info = linphone_error_info_ref((LinphoneErrorInfo*)linphone_call_get_error_info(call));
if (call->log->status==LinphoneCallMissed){
char *info;
......@@ -4703,28 +4703,7 @@ void linphone_call_log_completed(LinphoneCall *call){
linphone_core_notify_display_status(lc,info);
ms_free(info);
}
#ifdef SQLITE_STORAGE_ENABLED
if (lc->logs_db) {
call_logs_sqlite_db_found = TRUE;
linphone_core_store_call_log(lc, call->log);
}
#endif
if (!call_logs_sqlite_db_found) {
lc->call_logs=bctbx_list_prepend(lc->call_logs,linphone_call_log_ref(call->log));
if (bctbx_list_size(lc->call_logs)>(size_t)lc->max_call_logs){
bctbx_list_t *elem,*prevelem=NULL;
/*find the last element*/
for(elem=lc->call_logs;elem!=NULL;elem=elem->next){
prevelem=elem;
}
elem=prevelem;
linphone_call_log_unref((LinphoneCallLog*)elem->data);
lc->call_logs=bctbx_list_erase_link(lc->call_logs,elem);
}
call_logs_write_to_config_file(lc);
}
linphone_core_notify_call_log_updated(lc,call->log);
linphone_core_report_call_log(lc, call->log);
}
LinphoneCallState linphone_call_get_transfer_state(LinphoneCall *call) {
......
......@@ -2759,7 +2759,7 @@ bool_t linphone_core_sip_transport_supported(const LinphoneCore *lc, LinphoneTra
return sal_transport_available(lc->sal,(SalTransport)tp);
}
int linphone_core_set_sip_transports(LinphoneCore *lc, const LCSipTransports * tr_config /*config to be saved*/){
int linphone_core_set_sip_transports(LinphoneCore *lc, const LinphoneSipTransports * tr_config /*config to be saved*/){
LinphoneSipTransports tr=*tr_config;
if (lp_config_get_int(lc->config,"sip","sip_random_port",0)==1) {
......@@ -3568,7 +3568,7 @@ static LinphoneCall * get_unique_call(LinphoneCore *lc) {
}
int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call) {
return linphone_core_accept_call_with_params(lc, call, NULL);
return linphone_call_accept_with_params(call, NULL);
}
int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallParams *params) {
......
......@@ -1781,6 +1781,7 @@ void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call,
}
/* Functions to mainpulate the LinphoneIntRange structure */
int linphone_int_range_get_min(const LinphoneIntRange *range) {
......@@ -1798,3 +1799,40 @@ void linphone_int_range_set_min(LinphoneIntRange *range, int min) {
void linphone_int_range_set_max(LinphoneIntRange *range, int max) {
range->max = max;
}
void linphone_core_report_call_log(LinphoneCore *lc, LinphoneCallLog *call_log){
bool_t call_logs_sqlite_db_found = FALSE;
#ifdef SQLITE_STORAGE_ENABLED
if (lc->logs_db) {
call_logs_sqlite_db_found = TRUE;
linphone_core_store_call_log(lc, call_log);
}
#endif
if (!call_logs_sqlite_db_found) {
lc->call_logs=bctbx_list_prepend(lc->call_logs,linphone_call_log_ref(call_log));
if (bctbx_list_size(lc->call_logs)>(size_t)lc->max_call_logs){
bctbx_list_t *elem,*prevelem=NULL;
/*find the last element*/
for(elem=lc->call_logs;elem!=NULL;elem=elem->next){
prevelem = elem;
}
elem = prevelem;
linphone_call_log_unref((LinphoneCallLog*)elem->data);
lc->call_logs = bctbx_list_erase_link(lc->call_logs,elem);
}
call_logs_write_to_config_file(lc);
}
linphone_core_notify_call_log_updated(lc,call_log);
}
void linphone_core_report_early_failed_call(LinphoneCore *lc, LinphoneCallDir dir, LinphoneAddress *from, LinphoneAddress *to, LinphoneErrorInfo *ei){
LinphoneCallLog *l = linphone_call_log_new(dir, from, to);
l->error_info = ei;
l->status = LinphoneCallEarlyAborted;
linphone_core_report_call_log(lc, l);
linphone_call_log_unref(l);
}
......@@ -201,9 +201,10 @@ struct _LinphoneCallLog{
time_t connected_date_time; /**Connecting date of the call in seconds as expressed in a time_t */
char* call_id; /**unique id of a call*/
struct _LinphoneQualityReporting reporting;
unsigned int storage_id;
LinphoneErrorInfo *error_info;
bool_t video_enabled;
bool_t was_conference; /**<That call was a call with a conference server */
unsigned int storage_id;
};
BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneCallLog);
......@@ -415,7 +416,7 @@ void linphone_call_set_contact_op(LinphoneCall* call);
void linphone_call_set_compatible_incoming_call_parameters(LinphoneCall *call, SalMediaDescription *md);
void linphone_call_set_symmetric_rtp(LinphoneCall *call, bool_t val);
/* private: */
LinphoneCallLog * linphone_call_log_new(LinphoneCallDir dir, LinphoneAddress *local, LinphoneAddress * remote);
LinphoneCallLog * linphone_call_log_new(LinphoneCallDir dir, LinphoneAddress *from, LinphoneAddress * to);
void linphone_call_log_completed(LinphoneCall *call);
void linphone_call_set_transfer_state(LinphoneCall* call, LinphoneCallState state);
LinphonePlayer *linphone_call_build_player(LinphoneCall*call);
......@@ -1902,6 +1903,9 @@ struct _LinphoneErrorInfo{
};
BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneErrorInfo);
void linphone_core_report_call_log(LinphoneCore *lc, LinphoneCallLog *call_log);
void linphone_core_report_early_failed_call(LinphoneCore *lc, LinphoneCallDir dir, LinphoneAddress *from, LinphoneAddress *to, LinphoneErrorInfo *ei);
#ifdef __cplusplus
}
#endif
......
......@@ -1291,7 +1291,7 @@ void linphone_proxy_config_set_state(LinphoneProxyConfig *cfg, LinphoneRegistrat
linphone_registration_state_to_string(state),
cfg->lc);
if (linphone_core_should_subscribe_friends_only_when_registered(lc) && cfg->state!=state && state == LinphoneRegistrationOk){
ms_message("Updating friends for identity [%s] on core [%p]",linphone_proxy_config_get_identity(cfg),cfg->lc);
ms_message("Updating friends for identity [%s] on core [%p]",cfg->reg_identity,cfg->lc);
/* state must be updated before calling linphone_core_update_friends_subscriptions*/
cfg->state=state;
linphone_core_update_friends_subscriptions(lc);
......@@ -1358,7 +1358,7 @@ const char* linphone_proxy_config_get_transport(const LinphoneProxyConfig *cfg)
} else if(linphone_proxy_config_get_addr(cfg)) {
addr=linphone_proxy_config_get_addr(cfg);
} else {
ms_error("Cannot guess transport for proxy with identity [%s]",linphone_proxy_config_get_identity(cfg));
ms_error("Cannot guess transport for proxy with identity [%s]", cfg->reg_identity);
return NULL;
}
......
......@@ -158,6 +158,13 @@ LINPHONE_PUBLIC char * linphone_call_log_to_str(LinphoneCallLog *cl);
*/
LINPHONE_PUBLIC bool_t linphone_call_log_was_conference(LinphoneCallLog *cl);
/**
* When the call was failed, return an object describing the failure.
* @param[in] cl #LinphoneCallLog object
* @return information about the error encountered by the call associated with this call log.
**/
LINPHONE_PUBLIC const LinphoneErrorInfo *linphone_call_log_get_error_info(LinphoneCallLog *cl);
/*******************************************************************************
* Reference and user data handling functions *
......
......@@ -486,10 +486,8 @@ LINPHONE_DEPRECATED LINPHONE_PUBLIC void linphone_proxy_config_enable_avpf(Linph
* Indicates whether AVPF/SAVPF is being used for calls using this proxy config.
* @param[in] cfg #LinphoneProxyConfig object.
* @return True if AVPF/SAVPF is enabled, false otherwise.
* @deprecated use linphone_proxy_config_set_avpf_mode()
* @donotwrap
*/
LINPHONE_DEPRECATED LINPHONE_PUBLIC bool_t linphone_proxy_config_avpf_enabled(LinphoneProxyConfig *cfg);
LINPHONE_PUBLIC bool_t linphone_proxy_config_avpf_enabled(LinphoneProxyConfig *cfg);
/**
* Set the interval between regular RTCP reports when using AVPF/SAVPF.
......
......@@ -324,7 +324,8 @@ typedef enum _LinphoneCallStatus {
LinphoneCallSuccess, /**< The call was sucessful */
LinphoneCallAborted, /**< The call was aborted */
LinphoneCallMissed, /**< The call was missed (unanswered) */
LinphoneCallDeclined /**< The call was declined, either locally or by remote end */
LinphoneCallDeclined, /**< The call was declined, either locally or by remote end */
LinphoneCallEarlyAborted /**<The call was aborted before being advertised to the application - for protocol reasons*/
} LinphoneCallStatus;
/**
......
......@@ -527,6 +527,7 @@ typedef void (*SalOnExpire)(SalOp *salop);
typedef struct SalCallbacks{
SalOnCallReceived call_received;
SalOnCallReceived call_rejected;
SalOnCallRinging call_ringing;
SalOnCallAccepted call_accepted;
SalOnCallAck call_ack;
......
......@@ -131,7 +131,7 @@ void account_create_on_server(Account *account, const LinphoneProxyConfig *refcf
LinphoneAuthInfo *ai;
char *tmp;
LinphoneAddress *server_addr;
LCSipTransports tr;
LinphoneSipTransports tr;
char *chatdb;
vtable.registration_state_changed=account_created_on_server_cb;
......@@ -204,7 +204,6 @@ static LinphoneAddress *account_manager_check_account(AccountManager *m, Linphon
LinphoneAddress *id_addr=linphone_address_new(identity);
Account *account=account_manager_get_account(m,id_addr);
LinphoneAuthInfo *ai;
char *tmp;
bool_t create_account=FALSE;
const LinphoneAuthInfo *original_ai = linphone_core_find_auth_info(lc
,NULL
......@@ -224,9 +223,7 @@ static LinphoneAddress *account_manager_check_account(AccountManager *m, Linphon
}
/*modify the username of the identity of the proxy config*/
linphone_address_set_username(id_addr, linphone_address_get_username(account->modified_identity));
tmp=linphone_address_as_string(id_addr);
linphone_proxy_config_set_identity(cfg,tmp);
ms_free(tmp);
linphone_proxy_config_set_identity_address(cfg, id_addr);
if (create_account){
account_create_on_server(account,cfg,phone_alias);
......
......@@ -535,7 +535,7 @@ static void simple_call(void) {
static void simple_call_with_no_sip_transport(void){
LinphoneCoreManager* marie;
LinphoneCoreManager* pauline;
LCSipTransports tr={0};
LinphoneSipTransports tr={0};
LinphoneCall *call;
marie = linphone_core_manager_new( "marie_rc");
......@@ -657,7 +657,7 @@ static void direct_call_over_ipv6(void){
LinphoneCoreManager* pauline;
if (liblinphone_tester_ipv6_available()){
LCSipTransports pauline_transports;
LinphoneSipTransports pauline_transports;
LinphoneAddress* pauline_dest = linphone_address_new("sip:[::1];transport=tcp");
marie = linphone_core_manager_new( "marie_rc");
pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
......@@ -930,7 +930,7 @@ static void simple_call_compatibility_mode(void) {
const LinphoneAddress* identity;
LinphoneAddress* proxy_address;
char*tmp;
LCSipTransports transport;
LinphoneSipTransports transport;
proxy = linphone_core_get_default_proxy_config(lc_marie);
BC_ASSERT_PTR_NOT_NULL (proxy);
......@@ -1033,7 +1033,7 @@ void disable_all_video_codecs_except_one(LinphoneCore *lc, const char *mime) {
static void call_with_dns_time_out(void) {
LinphoneCoreManager* marie = linphone_core_manager_new2( "empty_rc", FALSE);
LCSipTransports transport = {9773,0,0,0};
LinphoneSipTransports transport = {9773,0,0,0};
int i;
linphone_core_set_sip_transports(marie->lc,&transport);
......@@ -1816,6 +1816,8 @@ static void audio_call_with_ice_no_matching_audio_codecs(void) {
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
LinphoneCall *out_call;
const bctbx_list_t *logs;
LinphoneCallLog *cl;
linphone_core_enable_payload_type(marie->lc, linphone_core_find_payload_type(marie->lc, "PCMU", 8000, 1), FALSE); /* Disable PCMU */
linphone_core_enable_payload_type(marie->lc, linphone_core_find_payload_type(marie->lc, "PCMA", 8000, 1), TRUE); /* Enable PCMA */
......@@ -1833,6 +1835,21 @@ static void audio_call_with_ice_no_matching_audio_codecs(void) {
BC_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallError, 1, 6000));
BC_ASSERT_EQUAL(linphone_call_get_reason(out_call), LinphoneReasonNotAcceptable, int, "%d");
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallIncomingReceived, 0, int, "%d");
logs = linphone_core_get_call_logs(pauline->lc);
BC_ASSERT_EQUAL(bctbx_list_size(logs), 1, int, "%d");
if (logs){
const LinphoneErrorInfo *ei;
cl = (LinphoneCallLog*)logs->data;
BC_ASSERT_EQUAL(linphone_call_log_get_status(cl), LinphoneCallEarlyAborted, int, "%d");
BC_ASSERT_TRUE(linphone_call_log_get_start_date(cl) != 0);
ei = linphone_call_log_get_error_info(cl);
BC_ASSERT_PTR_NOT_NULL(ei);
if (ei){
BC_ASSERT_EQUAL(linphone_error_info_get_reason(ei), LinphoneReasonNotAcceptable, int, "%d");
}
}
linphone_call_unref(out_call);
linphone_core_manager_destroy(marie);
......@@ -3282,6 +3299,8 @@ static void incoming_invite_with_invalid_sdp(void) {
LinphoneCoreManager* caller = linphone_core_manager_new( "pauline_tcp_rc");
LinphoneCoreManager* callee = linphone_core_manager_new( "marie_rc");
LinphoneCallTestParams caller_test_params = {0}, callee_test_params = {0};
LinphoneCallLog *cl;
const bctbx_list_t *logs;
callee_test_params.sdp_simulate_error = TRUE;
BC_ASSERT_FALSE(call_with_params2(caller,callee,&caller_test_params, &callee_test_params, FALSE));
......@@ -3290,6 +3309,20 @@ static void incoming_invite_with_invalid_sdp(void) {
BC_ASSERT_EQUAL(caller->stat.number_of_LinphoneCallError,1, int, "%d");
/*call will be drop before presented to the application, because it is invalid*/
BC_ASSERT_EQUAL(callee->stat.number_of_LinphoneCallIncomingReceived,0, int, "%d");
logs = linphone_core_get_call_logs(callee->lc);
BC_ASSERT_EQUAL(bctbx_list_size(logs), 1, int, "%i");
if (logs){
const LinphoneErrorInfo *ei;
cl = (LinphoneCallLog*)logs->data;
BC_ASSERT_EQUAL(linphone_call_log_get_status(cl), LinphoneCallEarlyAborted, int, "%d");
BC_ASSERT_TRUE(linphone_call_log_get_start_date(cl) != 0);
ei = linphone_call_log_get_error_info(cl);
BC_ASSERT_PTR_NOT_NULL(ei);
if (ei){
BC_ASSERT_EQUAL(linphone_error_info_get_reason(ei), LinphoneReasonNotAcceptable, int, "%d");
}
}
linphone_core_manager_destroy(callee);
linphone_core_manager_destroy(caller);
......@@ -3497,7 +3530,7 @@ static void call_with_generic_cn(void) {
}
static void call_state_changed_2(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *msg){
LCSipTransports sip_tr;
LinphoneSipTransports sip_tr;
if (cstate==LinphoneCallReleased) {
/*to make sure transport is changed*/
sip_tr.udp_port = 0;
......@@ -3521,7 +3554,7 @@ static void call_state_changed_3(LinphoneCore *lc, LinphoneCall *call, LinphoneC
}
static void call_with_transport_change_base(bool_t succesfull_call) {
LCSipTransports sip_tr;
LinphoneSipTransports sip_tr;
LinphoneCoreManager* marie;
LinphoneCoreManager* pauline;
LinphoneCoreVTable * v_table;
......
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