# Introduction to initiating a call interface

The plug-in provides the ability to talk directly between the device and the WeChat user.

# 1. Select the interface

Developers should select different call interfaces depending on the scenario.

# 1.1 Android WMPF Device Calling Mobile WeChat

Using initByCaller interface, businessType Pass 1.

# 1.2 Linux device calling phone WeChat

Linux devices do not run the Weixin Mini Program plug-in. Use the Mini Program Audio and Video Calling SDK (Linux devices) .

# 1.3 Mobile WeChat Calling Android WMPF devices

  • **** : Use callWMPF interface.Plugin 2.4.0 is required to start support. If you use license billing, you must use this interface.
  • Using initByCaller interface, businessType Transfer 2.This method does not support license billing.

# 1.4 Mobile WeChat Calling Linux devices

Use callDevice interface.Plugin 2.4.0 is required to start support.

Please note that when calling a Linux device, WeChat does not push the message, requiring the developer to push the device-side parameters required to add a room (such as roomId) from WeChat to the device.

# 2. Required reading before use

# 2.1 Go to the call page

Several interfaces that initiate calls can be called either on the Weixin Mini Program page or on the plugins page.But the final call process must be on the plug-in page.

  • If the call is in the Weixin Mini Program page, after the interface call is successful, the developer needs to manually jump to the plug-in page, and enter the call process after the plug-in page is loaded.
  • If is in the plug-in page when the call is initiated, the interface will be directly entered into the call flow after the call is successful. Do not repeat the page jump at this time, or the current call will be interrupted.
  • It is not recommended that there be more than one plugin page instance within the page stack.
// Once the call is successfully initiated, a jump will only be required if the current page is not a plug-in page.
wx.redirectTo({
  // 此处只需要传入 path 即可,如果开发者有其他参数需要传递给小程序,也可以自行拼接 query,并通过插件 getPluginOnloadOptions 接口获取。
  url: wmpfVoip.CALL_PAGE_PATH,
  // 插件 2.3.9 开始支持 CALL_PAGE_PATH, 低版本请传入 'plugin-private://wxf830863afde621eb/pages/call-page-plugin/call-page-plugin',
})

# 2.2 Maximum call duration

In order to reduce development costs for developers, the plug-in provides the ability to limit the maximum number of calls.The maximum call duration should be a number > 0.

The call duration starts with thestartVoipevent, and after the timeout the call ends automatically and pops a toast prompting the user, while triggering thehangUpVoipevent with an origin of'timeLimit'

# 2.3 GroupId and roomId

In the plug-in version 2.4.0 below, the call room ID is called groupId ,This name is more likely to be confused with the ID of the device group , so starting from 2.4.0, the room number is renamed to roomId , but the groupId parameter is retained for backward compatibility.

The two have no differences other than their different names.