The video call business logic mainly realizes the call request process Control between two terminals (PC, mobile phone, pad, etc.), including request, reply (Reply), start (start) and end (finish) process, can be visualized as the process of calling: dialing, waiting, Call, hang up.
The following is an example of chat video calling business logic:
1. Business logic Flowchart
Please refer to Http://bbs.anychat.cn/forum.php?mod=viewthread&tid=150&extra=page%3D1
2. API interface and constant definition
client-related API interfaces and event callbacks:
//Video Call message notification callback function definition
Typedef void (CALLBACK * brac_videocallevent_callback) (DWORD dwEventType, DWORD Dwuserid, DWORD Dwerrorcode, DWORD DwF Lags, DWORD dwparam, LPCTSTR lpuserstr, LPVoid lpuservalue);
Set up a video call message notification callback function
brac_api DWORD brac_setvideocalleventcallback (brac_videocallevent_callback lpfunction, LPVOID lpUserValue);
Video Call Event control (request, reply, hang up, etc.)
Brac_api DWORD Brac_videocallcontrol (DWORD dwEventType, DWORD Dwuserid, DWORD Dwerrorcode, DWORD DwFlags, DWORD Dwpar AM, LPCTSTR lpuserstr);
Server-related API interfaces and event callbacks:
//Video Call message notification callback function definition
typedef DWORD (CALLBACK * Bras_onvideocallevent_callback) (DWORD dwEventType, DWORD Dwsrcuserid, DWORD Dwtaruserid, DWORD Dwerrorcode, DWORD DwFlags, DWORD Dwparam, LPCTSTR Lpuserstr, LPVoid lpuservalue);
Set up a video call message notification callback function
bras_api DWORD bras_setonvideocalleventcallback (bras_onvideocallevent_callback lpfunction, LPVOID lpUserValue= NULL);
Video Call Event control (request, reply, hang up, etc.)
Bras_api DWORD Bras_videocallcontrol (DWORD dwEventType, DWORD Dwuserid, DWORD Dwerrorcode, DWORD DwFlags, DWORD Dwpar AM, LPCTSTR lpuserstr);
Constant definition
/Video Call Event type definition (api:bras_videocallcontrol incoming parameter, onvideocallevent callback parameter)
#define BRAS_VIDEOCALL_EVENT_REQUEST 1///< Call request
#define BRAS_VIDEOCALL_EVENT_REPLY 2///< Call request reply
#define BRAS_VIDEOCALL_EVENT_START 3///< Video Call session start Event
#define Bras_videocall_event_finish 4///< Hang Up (end) Call session
3. Related Instructions
3.1, the Client API (Brac_videocallcontrol) and the callback function (Brac_videocallevent_callback) in the Dwuserid are the other party (callee) user ID;
3.2, the caller refused to call, send a reply (Reply) instructions, dwerrorcode=100104;
3.3, the callee agreed to the call, send a reply (Reply) instructions, dwerrorcode=0, and then the server will send a call start (start) instructions to both parties, Dwparam=roomid, the room number is automatically assigned by the core server;
3.4, the end of the call, either party (including the Business Server) can send the end (finish) instruction, and then the server will send the end of call (finish) instructions to both parties;
3.5, the Business Server can intervene the call process: After Bras_onvideocallevent_callback receives the call request instruction, returns 0 means the call is allowed, otherwise it is the error code, the call is not allowed, and the end (finish) instruction can be sent during the session. Force the call of the specified user to hang up;
3.6, the API Interface Dwparam (integer), Lpuserstr (string) are user-defined purposes;
3.7, a user can only initiate one call request at the same time can only be called by one user;
3.8, Video Call business process can be separated from the business Server, by the core server independent support, you can not need to do two development on the server side.
Online customer service Video Call business logic detailed