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){
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;
}
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;
}
return "User not found";
case LinphoneReasonNotAnswered:
return "Not answered";
+ case LinphoneReasonBusy:
+ return "Busy";
}
return "unknown error";
}
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 */
};
/**
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);