# callDevice(Object req)

This interface is asynchronous and returns Promise Object.

Required plug-in 2.4.0 Version Start Support

Call from the Mini Program of the mobile client Linux Equipment, RTOS Equipment. When you call this interface, you create VoIP Room. Developers should push call reminders to the device themselves. Details ReferenceMobile WeChat Calling Device(Linux Direct link)》

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
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 Does the caller have a camera enabled?
enableListenerCamera boolean true no Whether or not the receiver has cameras enabled
nickName string no WeChat user name displayed on the device, only recorded
deviceName string no Device name displayed on WeChat 2.4.1
isCloud boolean false no If it's a call RTOS Device, set to true To trigger a message callback
payload string no call RTOS When, you can bring payload To the callback message

# 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.callDevice({
    roomType: 'video',
    sn: 'equipment SN',
    modelId: 'equipment modelId',
    nickName: "WeChat user name displayed on the device end,"
  })

  if (/* Currently not in plugin page */) {
    wx.redirectTo({
      url: wmpfVoip.CALL_PAGE_PATH,
    })
  }
} catch (e) {
  console.error('callDevice failed:', e)
  wx.showToast({
    title: Call failure,
    icon: 'error',
  })
}