[ English | 简体中文 ]
Call Management API
Voice call control, including dialing, answering, hanging up, holding, and more.
Header: #include <tapi_call.h>
openvela Implementation Notes
- SIM identification: Some interfaces do not take a
slot_idand use the default slot; usetapi_call_set_default_slotto switch when a specific slot is needed - Synchronous/Asynchronous: Time-consuming operations such as dialing and answering provide both synchronous versions and
_asyncversions (callback-style) - Operate by ID: Long-lived calls are uniquely identified by the call ID (string) returned;
*_by_idinterfaces operate on the call accordingly - DTMF: Keypad tones are triggered via
tapi_call_send_tones(batch) ortapi_call_start_dtmf/tapi_call_stop_dtmf(continuous key press) - Conference calls: Organized via
tapi_call_dial_confereceandtapi_call_merge_call, and split viatapi_call_separate_call
Dialing and Answering
tapi_call_dial
int tapi_call_dial(tapi_context context, int slot_id, char* number, int hide_callerid, int event_id, tapi_async_function p_handle);
Initiate a voice call.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).numberPhone number.hide_calleridWhether to hide the caller ID.event_idEvent ID, used for callback matching.p_handleAsynchronous callback function.
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_call_dial_async
int tapi_call_dial_async(tapi_context context, int slot_id, char* number, int hide_callerid, int event_id, void* user_data, tapi_async_function p_handle);
Initiate a voice call (asynchronous version).
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).numberPhone number.hide_calleridWhether to hide the caller ID.event_idEvent ID, used for callback matching.user_dataUser data passed to the callback function.p_handleAsynchronous callback function.
Returns:
Returns 0 on success, or a negative error code on failure.
Hangup Control
tapi_call_hangup_all_calls
int tapi_call_hangup_all_calls(tapi_context context, int slot_id);
Hang up all calls.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).
Returns:
Returns 0 on success, or a negative error code on failure.
Hold and Swap
tapi_call_release_and_answer
int tapi_call_release_and_answer(tapi_context context, int slot_id);
Release the current call and answer the waiting incoming call.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_call_hold_and_answer
int tapi_call_hold_and_answer(tapi_context context, int slot_id);
Hold the current call and answer the waiting incoming call.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_call_release_and_swap
int tapi_call_release_and_swap(tapi_context context, int slot_id);
Release the current call and swap to the held call.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_call_hold_call
int tapi_call_hold_call(tapi_context context, int slot_id);
Hold the current call.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_call_unhold_call
int tapi_call_unhold_call(tapi_context context, int slot_id);
Resume the held call.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).
Returns:
Returns 0 on success, or a negative error code on failure.
Transfer and Conference
tapi_call_transfer
int tapi_call_transfer(tapi_context context, int slot_id);
Transfer the call.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_call_merge_call
int tapi_call_merge_call(tapi_context context, int slot_id, int event_id, tapi_async_function p_handle);
Merge calls (multi-party call).
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).event_idEvent ID, used for callback matching.p_handleAsynchronous callback function.
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_call_merge_call_async
int tapi_call_merge_call_async(tapi_context context, int slot_id, int event_id, void* user_data, tapi_async_function p_handle);
Merge calls (multi-party call) (asynchronous version).
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).event_idEvent ID, used for callback matching.user_dataUser data passed to the callback function.p_handleAsynchronous callback function.
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_call_separate_call
int tapi_call_separate_call(tapi_context context, int slot_id, int event_id, char* call_id, tapi_async_function p_handle);
Separate a specified call from a multi-party call.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).event_idEvent ID, used for callback matching.call_idCall ID.p_handleAsynchronous callback function.
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_call_hangup_multiparty
int tapi_call_hangup_multiparty(tapi_context context, int slot_id);
Hang up a conference call session.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).
Returns:
Returns 0 on success, or a negative error code on failure.
DTMF and Dial Tones
tapi_call_send_tones
int tapi_call_send_tones(void* context, int slot_id, char* tones);
Send a DTMF tone playing request.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).tonesDTMF tone sequence.
Returns:
Returns 0 on success, or a negative error code on failure.
Call Queries
tapi_call_get_all_calls
int tapi_call_get_all_calls(tapi_context context, int slot_id, int event_id, tapi_async_function p_handle);
Get all current calls.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).event_idEvent ID, used for callback matching.p_handleAsynchronous callback function.
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_call_get_call_by_state
int tapi_call_get_call_by_state(tapi_context context, int slot_id, int state, tapi_call_info* call_list, int size, tapi_call_info* out_list);
Filter calls by the given call state.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).stateState.call_listCall list.sizeSize.out_listOutput list.
Returns:
Returns 0 on success, or a negative error code on failure.
Emergency Numbers
tapi_call_get_ecc_list
int tapi_call_get_ecc_list(tapi_context context, int slot_id, ecc_info* out);
Get the emergency call number list.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).outOutput parameter.
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_call_is_emergency_number
int tapi_call_is_emergency_number(tapi_context context, char* number);
Check whether the given number is an emergency number.
Parameters:
contextTelephony context handle.numberPhone number.
Returns:
Returns 0 on success, or a negative error code on failure.
Event Subscription
tapi_call_register_emergency_list_change
int tapi_call_register_emergency_list_change(tapi_context context, int slot_id, void* user_obj, tapi_async_function p_handle);
Register a callback for emergency number list changes.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).user_objUser object pointer.p_handleAsynchronous callback function.
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_call_register_ringback_tone_change
int tapi_call_register_ringback_tone_change(tapi_context context, int slot_id, void* user_obj, tapi_async_function p_handle);
Register a callback for ringback tone changes.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).user_objUser object pointer.p_handleAsynchronous callback function.
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_call_register_default_voicecall_slot_change
int tapi_call_register_default_voicecall_slot_change(tapi_context context, void* user_obj, tapi_async_function p_handle);
Register a callback for default voice call slot changes.
Parameters:
contextTelephony context handle.user_objUser object pointer.p_handleAsynchronous callback function.
Returns:
Returns 0 on success, or a negative error code on failure.
Conference Calls
tapi_call_dial_conferece
int tapi_call_dial_conferece(tapi_context context, int slot_id, char* participants[], int size);
Initiate an IMS conference call.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).participantsParticipant list.sizeSize.
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_call_invite_participants
int tapi_call_invite_participants(tapi_context context, int slot_id, char* participants[], int size);
Request the conference server to invite additional participants to the conference.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).participantsParticipant list.sizeSize.
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_call_register_call_state_change
int tapi_call_register_call_state_change(tapi_context context, int slot_id, void* user_obj, tapi_async_function p_handle);
Register a callback for call state changes.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).user_objUser object pointer.p_handleAsynchronous callback function.
Returns:
Returns 0 on success, or a negative error code on failure.
Operate by ID
tapi_call_answer_by_id
int tapi_call_answer_by_id(tapi_context context, int slot_id, char* call_id);
Answer a call by its ID.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).call_idCall ID.
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_call_answer_by_id_async
int tapi_call_answer_by_id_async(tapi_context context, int slot_id, char* call_id, void* user_obj, tapi_async_function p_handle);
Answer a call by its ID (asynchronous version; the result is returned via callback).
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).call_idCall ID.user_objUser object pointer.p_handleAsynchronous callback function.
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_call_hangup_by_id
int tapi_call_hangup_by_id(tapi_context context, int slot_id, char* call_id);
Hang up a call by its ID.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).call_idCall ID.
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_call_deflect_by_id
int tapi_call_deflect_by_id(tapi_context context, int slot_id, char* call_id, char* number);
Deflect an incoming call to the specified number.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).call_idCall ID.numberPhone number.
Returns:
Returns 0 on success, or a negative error code on failure.
Continuous DTMF
tapi_call_start_dtmf
int tapi_call_start_dtmf(tapi_context context, int slot_id, unsigned char digit, int event_id, tapi_async_function p_handle);
Start sending a DTMF tone.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).digitDTMF key character.event_idEvent ID, used for callback matching.p_handleAsynchronous callback function.
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_call_stop_dtmf
int tapi_call_stop_dtmf(tapi_context context, int slot_id, int event_id, tapi_async_function p_handle);
Stop sending a DTMF tone.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).event_idEvent ID, used for callback matching.p_handleAsynchronous callback function.
Returns:
Returns 0 on success, or a negative error code on failure.
Default Slot
tapi_call_set_default_slot
int tapi_call_set_default_slot(tapi_context context, int slot_id);
Set the default voice call slot.
Parameters:
contextTelephony context handle.slot_idSIM slot ID (0 or 1).
Returns:
Returns 0 on success, or a negative error code on failure.
tapi_call_get_default_slot
int tapi_call_get_default_slot(tapi_context context, int* out);
Get the default voice call slot.
Parameters:
contextTelephony context handle.outOutput parameter.
Returns:
Returns 0 on success, or a negative error code on failure.