io error repporting for calls

This commit is contained in:
Jehan Monnier 2013-02-28 16:06:13 +01:00
parent 644008c629
commit bf0db8f9e4
6 changed files with 48 additions and 10 deletions

View file

@ -582,8 +582,8 @@ MSList * sal_get_pending_auths(Sal *sal){
/*misc*/
void sal_get_default_local_ip(Sal *sal, int address_family, char *ip, size_t iplen){
ms_fatal("sal_get_default_local_ip not implemented yet");
return ;
strncpy(ip,address_family==AF_INET6 ? "::1" : "127.0.0.1",iplen);
ms_error("Could not find default routable ip address !");
}
const char *sal_get_root_ca(Sal* ctx) {
@ -611,3 +611,9 @@ void sal_nat_helper_enable(Sal *sal,bool_t enable) {
bool_t sal_nat_helper_enabled(Sal *sal) {
return sal->nat_helper_enabled;
}
void sal_set_dns_timeout(Sal* sal,int timeout) {
belle_sip_stack_set_dns_timeout(sal->stack, timeout);
}
int sal_get_dns_timeout(const Sal* sal) {
return belle_sip_stack_get_dns_timeout(sal->stack);
}

View file

@ -81,7 +81,14 @@ static int set_sdp_from_desc(belle_sip_message_t *msg, const SalMediaDescription
}
static void call_process_io_error(void *user_ctx, const belle_sip_io_error_event_t *event){
ms_error("call_process_io_error not implemented yet");
SalOp* op=(SalOp*)user_ctx;
if (!op->dialog) {
/*call terminated very early*/
op->base.root->callbacks.call_failure(op,SalErrorNoResponse,SalReasonUnknown,"Service Unavailable",503);
op->state=SalOpStateTerminated;
} else {
/*dialog will terminated shortly, nothing to do*/
}
}
static void process_dialog_terminated(void *ctx, const belle_sip_dialog_terminated_event_t *event) {
SalOp* op=(SalOp*)ctx;

View file

@ -169,7 +169,7 @@ static int _sal_op_send_request_with_contact(SalOp* op, belle_sip_request_t* req
}
int sal_op_send_request(SalOp* op, belle_sip_request_t* request) {
bool_t need_ack=FALSE;
bool_t need_contact=FALSE;
/*
Header field where proxy ACK BYE CAN INV OPT REG
___________________________________________________________
@ -179,9 +179,9 @@ int sal_op_send_request(SalOp* op, belle_sip_request_t* request) {
||strcmp(belle_sip_request_get_method(request),"REGISTER")==0
||strcmp(belle_sip_request_get_method(request),"SUBSCRIBE")==0
||strcmp(belle_sip_request_get_method(request),"OPTION")==0)
need_ack=TRUE;
need_contact=TRUE;
return _sal_op_send_request_with_contact(op, request,need_ack);
return _sal_op_send_request_with_contact(op, request,need_contact);
}

View file

@ -519,4 +519,7 @@ void sal_set_recv_error(Sal *sal,int value);
/*enable contact fixing*/
void sal_nat_helper_enable(Sal *sal,bool_t enable);
bool_t sal_nat_helper_enabled(Sal *sal);
void sal_set_dns_timeout(Sal* sal,int timeout);
int sal_get_dns_timeout(const Sal* sal);
#endif

View file

@ -197,6 +197,22 @@ static void call_canceled() {
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
static void call_with_dns_time_out() {
LinphoneCoreManager* marie = linphone_core_manager_new(NULL);
LCSipTransports transport = {9773,0,0,0};
linphone_core_set_sip_transports(marie->lc,&transport);
linphone_core_iterate(marie->lc);
sal_set_dns_timeout(marie->lc->sal,0);
linphone_core_invite(marie->lc,"sip:toto@toto.com");
linphone_core_iterate(marie->lc);
linphone_core_iterate(marie->lc);
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallOutgoingInit,1);
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallOutgoingProgress,1);
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallError,1);
linphone_core_manager_destroy(marie);
}
static void call_ringing_canceled() {
LinphoneCoreManager* marie = linphone_core_manager_new("./tester/marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new("./tester/pauline_rc");
@ -585,6 +601,10 @@ int call_test_suite () {
if (NULL == CU_add_test(pSuite, "call_canceled", call_canceled)) {
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "call_with_dns_time_out", call_with_dns_time_out)) {
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "call_ringing_canceled", call_ringing_canceled)) {
return CU_get_error();
}

View file

@ -159,17 +159,19 @@ LinphoneCoreManager* linphone_core_manager_new(const char* rc_file) {
mgr->v_table.new_subscription_request=new_subscribtion_request;
mgr->v_table.notify_presence_recv=notify_presence_received;
mgr->v_table.transfer_state_changed=linphone_transfer_state_changed;
mgr->lc=configure_lc_from(&mgr->v_table,rc_file,1);
mgr->lc=configure_lc_from(&mgr->v_table,rc_file,rc_file?1:0);
enable_codec(mgr->lc,"PCMU",8000);
linphone_core_set_user_data(mgr->lc,&mgr->stat);
linphone_core_get_default_proxy(mgr->lc,&proxy);
mgr->identity = linphone_address_new(linphone_proxy_config_get_identity(proxy));
linphone_address_clean(mgr->identity);
if (proxy) {
mgr->identity = linphone_address_new(linphone_proxy_config_get_identity(proxy));
linphone_address_clean(mgr->identity);
}
return mgr;
}
void linphone_core_manager_destroy(LinphoneCoreManager* mgr) {
linphone_core_destroy(mgr->lc);
linphone_address_destroy(mgr->identity);
if (mgr->identity) linphone_address_destroy(mgr->identity);
free(mgr);
}