diff --git a/console/linphonec.c b/console/linphonec.c index 81218be..1f9eec0 100644 --- a/console/linphonec.c +++ b/console/linphonec.c @@ -463,6 +463,9 @@ linphonec_general_state (LinphoneCore * lc, LinphoneGeneralState *gstate, Linpho case GSTATE_CALL_IDLE: printf("GSTATE_CALL_IDLE"); break; + case GSTATE_CALL_OUT_RINGING: + printf("GSTATE_CALL_OUT_RINGING"); + break; case GSTATE_CALL_OUT_INVITE: printf("GSTATE_CALL_OUT_INVITE"); break; diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index e37941f..4c23438 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -100,8 +100,13 @@ static void call_received(SalOp *h){ return; } /* the call is acceptable so we can now add it to our list */ - linphone_core_add_call(lc,call); - + if(linphone_core_add_call(lc,call)!= 0) + { + ms_warning("we cannot handle anymore call\n"); + sal_call_decline(h,SalReasonMedia,NULL); + linphone_call_unref(call); + return; + } from_parsed=linphone_address_new(sal_op_get_from(h)); linphone_address_clean(from_parsed); tmp=linphone_address_as_string(from_parsed); @@ -227,7 +232,11 @@ static void call_accepted(SalOp *op){ }//if there is an accepted incoming call else { - linphone_core_set_as_current_call (lc,call); + /* + * Do not set the call as current here, + * because we can go through this function not only when an incoming call is accepted + */ + //linphone_core_set_as_current_call (lc,call); gstate_new_state(lc, GSTATE_CALL_OUT_CONNECTED, gctx, NULL); linphone_connect_incoming(lc,call); } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index c1922fe..92da44b 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1479,7 +1479,7 @@ static void display_bandwidth(RtpSession *as, RtpSession *vs){ static void linphone_core_disconnected(LinphoneCore *lc, LinphoneCall *call){ char temp[256]; - char *from; + char *from=NULL; if(call) from = linphone_call_get_remote_address_as_string(call); if(from) @@ -1493,7 +1493,9 @@ static void linphone_core_disconnected(LinphoneCore *lc, LinphoneCall *call){ } if (lc->vtable.display_warning!=NULL) lc->vtable.display_warning(lc,temp); - linphone_core_terminate_call(lc,call);//TODO failure ?? + if(lc->vtable.failure_recv) + lc->vtable.failure_recv(lc,call, 480);//480 Temporarily Unavailable + linphone_core_terminate_call(lc,call); } static void monitor_network_state(LinphoneCore *lc, time_t curtime){