b.liu | b17525e | 2025-05-14 17:22:29 +0800 | [diff] [blame] | 1 | #include <stdlib.h>
|
| 2 | #include <stdint.h>
|
| 3 | #include <string.h>
|
| 4 | #include <stdbool.h>
|
| 5 | #include <stdio.h>
|
| 6 |
|
| 7 | // GSW includes
|
| 8 | #define GSW_HAL_SUCCESS 0
|
| 9 | #define GSW_HAL_FAIL -1
|
| 10 | #define GSW_HAL_MEM_INVAILD -2
|
| 11 |
|
| 12 |
|
| 13 | typedef int CallHandle;
|
| 14 | typedef enum {
|
| 15 | GSW_VOICE_CALL_HOLDING = 0,
|
| 16 | GSW_VOICE_CALL_DIALING,
|
| 17 | GSW_VOICE_CALL_ALERTING,
|
| 18 | GSW_VOICE_CALL_CONNECTED,
|
| 19 | GSW_VOICE_CALL_INCOMING,
|
| 20 | GSW_VOICE_CALL_WAITING,
|
| 21 | GSW_VOICE_CALL_END,
|
| 22 | }VoiceCallState;
|
| 23 |
|
| 24 | typedef enum{
|
| 25 | GSW_AUDIO_MODE_CODEC = 0,
|
| 26 | GSW_AUDIO_MODE_RTP = 1,
|
| 27 | }AudioMode;
|
| 28 |
|
| 29 | typedef enum {
|
| 30 | GSW_RTP_CLIENT = 0,
|
| 31 | GSW_RTP_SERVER,
|
| 32 | }RTPMode;
|
| 33 |
|
| 34 | typedef void (*CallStateInd)(CallHandle, VoiceCallState);
|
| 35 |
|
| 36 | /**
|
| 37 | * @brief init voice sdk,and register the status indicated callback function
|
| 38 | * @param [in] CallStateInd ind: status indicated callback function
|
| 39 | * @param [out] None
|
| 40 | * @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
|
| 41 | */
|
| 42 | int32_t gsw_voice_sdk_init(CallStateInd ind);
|
| 43 |
|
| 44 |
|
| 45 | /**
|
| 46 | * @brief set speaker_volume
|
| 47 | * @param [in] int32_t volumeļ¼1(Min)-7(Max)
|
| 48 | * @param [out] None
|
| 49 | * @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
|
| 50 | */
|
| 51 | int32_t gsw_voice_set_speaker_volume(int32_t volume);
|
| 52 |
|
b.liu | b17525e | 2025-05-14 17:22:29 +0800 | [diff] [blame] | 53 | /**
|
| 54 | * @brief start a voice call
|
| 55 | * @param [in] char *callNumber
|
| 56 | * @param [out] CallHandle *handle
|
| 57 | * @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
|
| 58 | */
|
| 59 | int32_t gsw_voice_normal_voice_start(CallHandle *handle, const char *callNumber);
|
| 60 |
|
| 61 | /**
|
| 62 | * @brief answer a voice call
|
| 63 | * @param [in] CallHandle handle
|
| 64 | * @param [out] None
|
| 65 | * @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
|
| 66 | */
|
| 67 | int32_t gsw_voice_answer(CallHandle handle);
|
| 68 |
|
| 69 | /**
|
| 70 | * @brief hangup a voice call
|
| 71 | * @param [in] CallHandle handle
|
| 72 | * @param [out] None
|
| 73 | * @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
|
| 74 | */
|
| 75 | int32_t gsw_voice_hangup(CallHandle handle);
|
| 76 |
|
| 77 |
|
| 78 | /**
|
| 79 | * @brief set auto answer mode
|
| 80 | * @param [in] int32_t mode:0-1, 0:NO(close auto answer), 1:YES(auto answer)
|
| 81 | * @param [out] None
|
| 82 | * @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
|
| 83 | */
|
| 84 | int32_t gsw_voice_set_auto_answer_mode(int32_t mode);
|
| 85 |
|
| 86 | /**
|
b.liu | 68a94c9 | 2025-05-24 12:53:41 +0800 | [diff] [blame^] | 87 | * @brief set audio mode
|
| 88 | * @param [in] AudioMode audioMode
|
| 89 | * @param [out] None
|
| 90 | * @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
|
| 91 | */
|
| 92 | int32_t gsw_voice_set_audio_mode(AudioMode audioMode);
|
| 93 |
|
| 94 | /**
|
b.liu | b17525e | 2025-05-14 17:22:29 +0800 | [diff] [blame] | 95 | * @brief set rtp ip address of remote
|
| 96 | * @param [in] char *ip :ip address
|
| 97 | * @param [in] int32_t len: length
|
| 98 | * @param [out] None
|
| 99 | * @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
|
| 100 | */
|
| 101 | int32_t gsw_voice_set_remote_rtp_ip(const char *ip, int32_t len);
|
| 102 |
|
b.liu | b17525e | 2025-05-14 17:22:29 +0800 | [diff] [blame] | 103 | /**
|
| 104 | * @brief set rtp mode and port
|
| 105 | * @param [in] RTPMode rtpMode: rtp mode
|
| 106 | * @param [in] int32_t port:rtp port
|
| 107 | * @param [out] None
|
| 108 | * @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
|
| 109 | */
|
| 110 | int32_t gsw_voice_set_rtp_port(RTPMode rtpMode, int32_t port);
|
| 111 |
|
| 112 | /**
|
| 113 | * @brief set rtp mode and port
|
| 114 | * @param [in] int32_t clockRate: clock rate
|
| 115 | * @param [in] int32_t channel:channel
|
| 116 | * @param [in] int32_t latency:latency
|
| 117 | * @param [out] None
|
| 118 | * @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
|
| 119 | */
|
| 120 | int32_t gsw_voice_set_rtp_param(int32_t clockRate, int32_t channel, int32_t latency);
|
b.liu | 68a94c9 | 2025-05-24 12:53:41 +0800 | [diff] [blame^] | 121 |
|
| 122 | /**
|
| 123 | * @brief get current call end reason
|
| 124 | * @param [in] CallHandle handle
|
| 125 | * @param [out] None
|
| 126 | * @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
|
| 127 | */
|
| 128 | int32_t gsw_voice_get_current_call_end_reason(CallHandle handle);
|