6.1 Create VOIP Create a CVoipManager object Add the callback function pointer
The class which the object belongs to needs to implement the IVoipManagerListener interface. m_pVoipManager = new XHVoipManager(this);
6.2 Callback function description
/** * The called party responses * The called party receives the call from the calling party * @param fromID */ virtual void onCalling(string fromID);
/** * The receiver responses the audio call * The called party receives the audio call from the calling party * @param fromID */ virtual void onAudioCalling(string fromID);
/** * The called party responses * The calling party hangs up before the called party answers (the call is cancelled) * @param fromID */ virtual void onCancled(string fromID);
/** * The calling party response * The called party refused to connect (the call was refused) * @param fromID */ virtual void onRefused(string fromID);
/** * The calling party response * The called party is busy (the other party is in a call) * @param fromID */ virtual void onBusy(string fromID);
/** * Missed calls during a call */ virtual void onMiss(CIMMessage* pMsg);
/** * The calling party response * The called party is connected (the call is starting) * @param fromID */ virtual void onConnected(string fromID);
/** * The other party has hung up * @param fromID */ virtual void onHangup(string fromID);
/** * Receive real-time data * @param data */ virtual void onReceiveRealtimeData(uint8_t* data, int length);
/** * Receive video data * @param data */ virtual int getVideoRaw(string strUserId, int w, int h, uint8_t* videoData, int videoDataLen);
/** * Data transfer mode has changed * @param state */ virtual void onTransStateChanged(int state);
6.3 XHVoipManager API Description
/** * Set the media type (audio and video, audio, video) * @param mediaTypeEnum media type */ void setRtcMediaType(int mediaTypeEnum);
/** * Get the media type(audio and video, audio, video) */ int getRtcMediaType();
/** * The calling party call the function * Start a video call * @param strTargetId The called user ID */ bool call(string strTargetId);
/** * The calling call the function * Start an audio call * @param strTargetId 对方ID */ bool audioCall(string strTargetId);
/** * The calling call the function * Before the other party answers or rejects, the calling party cancels the call actively. */ void cancel();
/** * It is called by the called party * Agree to talk to the calling party * @param fromID */ void accept(string fromID);
/** * It is called by the called party * Refuse to talk to the calling party */ void refuse();
/** * Both sieds can call the function * hangup */ void hangup(int isActive);
/** * Insert audio data * @param audioData * @param dataLen */ void insertAudioRaw(uint8_t* audioData, int dataLen); /** * Insert video data * @param videoData * @param dataLen * @param isBig */ void insertVideoRaw(uint8_t* videoData, int dataLen, int isBig); /** * Crop the video data */ int cropVideoRawNV12(int w, int h, uint8_t* videoData, int dataLen, int yuvProcessPlan, int rotation, int needMirror, uint8_t* outVideoDataBig, uint8_t* outVideoDataSmall); /** * Query the audio data */ void querySoundData(uint8_t** pData, int* nLength);