pjsua_call_hangup method
Hangup call by using method that is appropriate according to the call state. This function is different than answering the call with 3xx-6xx response (with #pjsua_call_answer()), in that this function will hangup the call regardless of the state and role of the call, while #pjsua_call_answer() only works with incoming calls on EARLY state.
After calling this function, media will be deinitialized (call media callbacks, if any, will still be received) and then, on_call_state() will be immediately called with state DISCONNECTED. No further call callbacks will be received after this. The call hangup process itself (sending BYE, waiting for the response, and resource cleanup) will continue in the background and the call slot can be reused only after this process is completed. If application has limited call slots and would like to check if there are any free slots remaining, it can query the number of free slots using the APIs: pjsua_call_get_max_count()-pjsua_call_get_count()
Note that on_call_tsx_state() will not be called when using this API.
@param call_id Call identification. @param code Optional status code to be sent when we're rejecting incoming call. If the value is zero, "603/Decline" will be sent. @param reason Optional reason phrase to be sent when we're rejecting incoming call. If NULL, default text will be used. @param msg_data Optional list of headers etc to be added to outgoing request/response message.
@return PJ_SUCCESS on success, or the appropriate error code.
Implementation
int pjsua_call_hangup(
int call_id,
int code,
ffi.Pointer<pj_str_t> reason,
ffi.Pointer<pjsua_msg_data> msg_data,
) {
return _pjsua_call_hangup(
call_id,
code,
reason,
msg_data,
);
}