#include <stdlib.h> | |
#include <stdint.h> | |
#include <string.h> | |
#include <stdbool.h> | |
#include <stdio.h> | |
// GSW includes | |
#define GSW_HAL_SUCCESS 0 | |
#define GSW_HAL_FAIL -1 | |
#define GSW_HAL_MEM_INVAILD -2 | |
typedef int CallHandle; | |
typedef enum { | |
GSW_VOICE_CALL_HOLDING = 0, | |
GSW_VOICE_CALL_DIALING, | |
GSW_VOICE_CALL_ALERTING, | |
GSW_VOICE_CALL_CONNECTED, | |
GSW_VOICE_CALL_INCOMING, | |
GSW_VOICE_CALL_WAITING, | |
GSW_VOICE_CALL_END, | |
}VoiceCallState; | |
typedef enum{ | |
GSW_AUDIO_MODE_CODEC = 0, | |
GSW_AUDIO_MODE_RTP = 1, | |
}AudioMode; | |
typedef enum { | |
GSW_RTP_CLIENT = 0, | |
GSW_RTP_SERVER, | |
}RTPMode; | |
typedef void (*CallStateInd)(CallHandle, VoiceCallState); | |
/** | |
* @brief init voice sdk,and register the status indicated callback function | |
* @param [in] CallStateInd ind: status indicated callback function | |
* @param [out] None | |
* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL | |
*/ | |
int32_t gsw_voice_sdk_init(CallStateInd ind); | |
/** | |
* @brief set speaker_volume | |
* @param [in] int32_t volumeļ¼1(Min)-7(Max) | |
* @param [out] None | |
* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL | |
*/ | |
int32_t gsw_voice_set_speaker_volume(int32_t volume); | |
/** | |
* @brief start a voice call | |
* @param [in] char *callNumber | |
* @param [out] CallHandle *handle | |
* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL | |
*/ | |
int32_t gsw_voice_normal_voice_start(CallHandle *handle, const char *callNumber); | |
/** | |
* @brief answer a voice call | |
* @param [in] CallHandle handle | |
* @param [out] None | |
* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL | |
*/ | |
int32_t gsw_voice_answer(CallHandle handle); | |
/** | |
* @brief hangup a voice call | |
* @param [in] CallHandle handle | |
* @param [out] None | |
* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL | |
*/ | |
int32_t gsw_voice_hangup(CallHandle handle); | |
/** | |
* @brief set auto answer mode | |
* @param [in] int32_t mode:0-1, 0:NO(close auto answer), 1:YES(auto answer) | |
* @param [out] None | |
* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL | |
*/ | |
int32_t gsw_voice_set_auto_answer_mode(int32_t mode); | |
/** | |
* @brief set audio mode | |
* @param [in] AudioMode audioMode | |
* @param [out] None | |
* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL | |
*/ | |
int32_t gsw_voice_set_audio_mode(AudioMode audioMode); | |
/** | |
* @brief set rtp ip address of remote | |
* @param [in] char *ip :ip address | |
* @param [in] int32_t len: length | |
* @param [out] None | |
* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL | |
*/ | |
int32_t gsw_voice_set_remote_rtp_ip(const char *ip, int32_t len); | |
/** | |
* @brief set rtp mode and port | |
* @param [in] RTPMode rtpMode: rtp mode | |
* @param [in] int32_t port:rtp port | |
* @param [out] None | |
* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL | |
*/ | |
int32_t gsw_voice_set_rtp_port(RTPMode rtpMode, int32_t port); | |
/** | |
* @brief set rtp mode and port | |
* @param [in] int32_t clockRate: clock rate | |
* @param [in] int32_t channel:channel | |
* @param [in] int32_t latency:latency | |
* @param [out] None | |
* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL | |
*/ | |
int32_t gsw_voice_set_rtp_param(int32_t clockRate, int32_t channel, int32_t latency); | |
/** | |
* @brief get current call end reason | |
* @param [in] CallHandle handle | |
* @param [out] None | |
* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL | |
*/ | |
int32_t gsw_voice_get_current_call_end_reason(CallHandle handle); |