Commit e829fa6e authored by Simon Morlat's avatar Simon Morlat

add int linphone_core_decline_call(LinphoneCore *lc, LinphoneCall * call, LinphoneReason reason)

parent 353465b2
......@@ -2096,6 +2096,7 @@ bool_t linphone_call_is_in_conference(const LinphoneCall *call) {
/**
* Perform a zoom of the video displayed during a call.
* @param call the call.
* @param zoom_factor a floating point number describing the zoom factor. A value 1.0 corresponds to no zoom applied.
* @param cx a floating point number pointing the horizontal center of the zoom to be applied. This value should be between 0.0 and 1.0.
* @param cy a floating point number pointing the vertical center of the zoom to be applied. This value should be between 0.0 and 1.0.
......
......@@ -2917,6 +2917,7 @@ static void terminate_call(LinphoneCore *lc, LinphoneCall *call){
linphone_call_stop_media_streams(call);
if (lc->vtable.display_status!=NULL)
lc->vtable.display_status(lc,_("Call ended") );
linphone_call_set_state(call,LinphoneCallEnd,"Call terminated");
}
int linphone_core_redirect_call(LinphoneCore *lc, LinphoneCall *call, const char *redirect_uri){
......@@ -2924,7 +2925,6 @@ int linphone_core_redirect_call(LinphoneCore *lc, LinphoneCall *call, const char
sal_call_decline(call->op,SalReasonRedirect,redirect_uri);
call->reason=LinphoneReasonDeclined;
terminate_call(lc,call);
linphone_call_set_state(call,LinphoneCallEnd,"Call terminated");
}else{
ms_error("Bad state for call redirection.");
return -1;
......@@ -2958,8 +2958,35 @@ int linphone_core_terminate_call(LinphoneCore *lc, LinphoneCall *the_call)
}
sal_call_terminate(call->op);
terminate_call(lc,call);
return 0;
}
linphone_call_set_state(call,LinphoneCallEnd,"Call terminated");
/**
* Decline a pending incoming call, with a reason.
* @param lc the linphone core
* @param call the LinphoneCall, must be in the IncomingReceived state.
* @param reason the reason for rejecting the call: LinphoneReasonDeclined or LinphoneReasonBusy
**/
int linphone_core_decline_call(LinphoneCore *lc, LinphoneCall * call, LinphoneReason reason){
SalReason sal_reason=SalReasonUnknown;
if (call->state!=LinphoneCallIncomingReceived && call->state!=LinphoneCallIncomingEarlyMedia){
ms_error("linphone_core_decline_call(): Cannot decline a call that is in state %s",linphone_call_state_to_string(call->state));
return -1;
}
switch(reason){
case LinphoneReasonDeclined:
sal_reason=SalReasonDeclined;
break;
case LinphoneReasonBusy:
sal_reason=SalReasonBusy;
break;
default:
ms_error("linphone_core_decline_call(): unsupported reason %s",linphone_reason_to_string(reason));
return -1;
break;
}
sal_call_decline(call->op,sal_reason,NULL);
terminate_call(lc,call);
return 0;
}
......@@ -4975,6 +5002,8 @@ const char *linphone_reason_to_string(LinphoneReason err){
return "User not found";
case LinphoneReasonNotAnswered:
return "Not answered";
case LinphoneReasonBusy:
return "Busy";
}
return "unknown error";
}
......
......@@ -222,7 +222,8 @@ enum _LinphoneReason{
LinphoneReasonBadCredentials, /**<Authentication failed due to bad or missing credentials*/
LinphoneReasonDeclined, /**<The call has been declined*/
LinphoneReasonNotFound, /**<Destination of the calls was not found.*/
LinphoneReasonNotAnswered
LinphoneReasonNotAnswered, /**<The call was not answered in time*/
LinphoneReasonBusy /**<Phone line was busy */
};
/**
......@@ -964,6 +965,8 @@ int linphone_core_terminate_call(LinphoneCore *lc, LinphoneCall *call);
int linphone_core_redirect_call(LinphoneCore *lc, LinphoneCall *call, const char *redirect_uri);
int linphone_core_decline_call(LinphoneCore *lc, LinphoneCall * call, LinphoneReason reason);
int linphone_core_terminate_all_calls(LinphoneCore *lc);
int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call);
......
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