# callWMPF(Object req)
This interface is asynchronous and returns
Promise
Object.Required plug-in 2.4.0 Version Start Support
Call the Mini Program running Android from the mobile client WMPF Of the equipment. When you call this interface, you create VoIP Room, and push to the device WMPF pushMsg Reminder. Details ReferenceMobile WeChat Calling Device(Android)》。
This interface can only be used in the WeChat client, not in the WMPF Use within. It is recommended to read firstIntroduction to Interface。
# parameter
# Object req
attribute | type | Default value | Required | Introductions | Minimum version |
---|---|---|---|---|---|
roomType | string | yes | Call type. voice: Audio callvideo: Video call | ||
sn | string | yes | Receiver device SN | ||
modelId | string | yes | Receiver device modelId | ||
pushToken | string | yes | Obtained from the device [pushToken ](https://developers.weixin.qq.com/doc/oplatform /Miniprogram_Frame/push.html) | ||
nickName | string | yes | WeChat user name displayed on device | ||
deviceName | string | no | Device name displayed on WeChat | 2.4.1 | |
chargeType | string | 'license' | no | Billing method. duration: Duration chargelicense:license Billing | |
timeLimit | number | no | The maximum length of the call is required. > 0 The number of | ||
enableCallerCamera | boolean | true | no | Whether the dialing party has a camera enabled. | |
enableListenerCamera | boolean | true | no | Whether or not the receiver has cameras enabled. | |
envVersion | string | 'release' | no | Type of Mini Program opened by the recipient. Value: release: Official version trial: Experience version develop: Development version. The official version of the Mini Program can only be dialed to the official version, setting this field is invalid. | |
customQuery | string | no | When the listener opens the Mini Program, it will act as query After splicing into the plugin page path, the format is as a=1&b=2 Can be accessed within the listener Mini Program via the getPluginOnloadOptions or getPluginEnterOptions Interface gets to the |
# Return value
This interface call fails and throwsabnormal。
# Object
Interface call is successful, returns the following:
attribute | type | Introductions | Minimum version |
---|---|---|---|
roomId | string | The room number for this call |
# sample code
const wmpfVoip = requirePlugin('wmpf-voip' ).default
try {
const { roomId } = await wmpfVoip.callWMPF({
roomType: 'video',
sn: 'equipment SN',
modelId: 'equipment modelId',
nickName: "WeChat user name displayed on the device end,"
pushToken: 'xxxx*****xxxx',
})
if (/* Currently not in plugin page */) {
wx.redirectTo({
url: wmpfVoip.CALL_PAGE_PATH,
})
}
} catch (e) {
console.error('callWMPF failed:', e)
wx.showToast({
title: Call failure,
icon: 'error',
})
}