Audio and video instant messaging-video call business logic process

Source: Internet
Author: User
Tags constant definition

 

The video call business logic is used to control the call Request process between two terminal PCs, mobile phones, and tablets. The process includes Request, Reply, Start, and end Finish. process dialing, waiting, calling, and hanging up.

The following uses AnyChat video call business logic as an example to describe

 

1. Business logic flowchart

See 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 callback

// Define the callback function for video call notifications

Typedefvoid (CALLBACK * BRAC_VideoCallEvent_CallBack) (DWORD dwEventType, DWORDdwUserId, DWORD dwErrorCode, DWORD dwFlags, DWORD dwParam, LPCTSTR lpUserStr, LPVOID lpUserValue );

 

// Sets the callback function for video call notifications.

BRAC_APIDWORD BRAC_SetVideoCallEventCallBack (BRAC_VideoCallEvent_CallBack lpFunction, LPVOID lpUserValue );

 

// Video call event control requests, replies, and hangs up

BRAC_APIDWORD BRAC_VideoCallControl (DWORD dwEventType, DWORD dwUserId, DWORDdwErrorCode, DWORD dwFlags, DWORD dwParam, LPCTSTR lpUserStr );

 

Server-related API interfaces and event callback

// Define the callback function for video call notifications

TypedefDWORD (CALLBACK * identifier) (DWORD dwEventType, DWORDdwSrcUserId, DWORD dwTarUserId, DWORD dwErrorCode, DWORD dwFlags, DWORDdwParam, LPCTSTR lpUserStr, LPVOID lpUserValue );

 

// Sets the callback function for video call notifications.

BRAS_APIDWORD BRAS_SetOnVideoCallEventCallBack (BRAS_OnVideoCallEvent_CallBacklpFunction, LPVOID lpUserValue = NULL );

 

// Video call event control requests, replies, and hangs up

BRAS_APIDWORD BRAS_VideoCallControl (DWORD dwEventType, DWORD dwUserId, DWORDdwErrorCode, DWORD dwFlags, DWORD dwParam, LPCTSTR lpUserStr );

 

Constant definition

/Define APIBRAS_VideoCallControl and OnVideoCallEvent callback parameters for video call events.

# DefineBRAS_VIDEOCALL_EVENT_REQUEST 1 // <call request

# DefineBRAS_VIDEOCALL_EVENT_REPLY 2 // <call request Reply

# DefineBRAS_VIDEOCALL_EVENT_START 3 // <video call session start event

# DefineBRAS_VIDEOCALL_EVENT_FINISH 4 // <end call session

 

3. Description

3.1 The dwUserId in the client APIBRAC_VideoCallControl and callback function BRAC_VideoCallEvent_CallBack are the user ID of the caller of the other party.

 

3.2 send a Reply to Reply command dwErrorCode = 100104 when the caller rejects the call

 

3.3 when the caller agrees to the call, the Reply command dwErrorCode = 0 will be sent to both parties. Then the server will send the call Start command dwParam = RoomId the room number is automatically allocated by the core server.

 

3.4 when a call ends, either party, including the Business Server, can send the end Finish command, and then the server will send the call end Finish command to both parties.

 

3.5 The Service server can intervene in the call process. After BRAS_OnVideoCallEvent_CallBack receives the call request command, it returns 0, indicating that the call is allowed. Otherwise, the error code does not allow the call. During the session, the end Finish command can be sent to force the end user. call

 

3.6. The dwParam integer and lpUserStr strings in the API are user-defined purposes

 

3.7 a single user can initiate only one call request and be called by only one user at the same time.

 

3.8 The video call business process can be independently supported by the core server without secondary development on the server side.

& 4 & Cross-platform communication provides the possibility of communication between various terminals



Audio and video instant messaging-video call business logic process

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.