# Mobile phone WeChat call device(Linux Direct link)
Required plug-in 2.4.0 Version, Linux SDK 0x00097 Start support
If you want to get various events during a call, you can use the plug-in's
onVoipEvent
Interface.
# 1. Mobile phone WeChat terminal to initiate a call
Before initiating a call, the user generally needs to select the device and the type of call in the Mini Program (audio/Video).
To initiate a call, the developer needs and invokes the plug-in's callDevice
Interface acquisition RoomId, and then jump to the plugin's Initiate Call page.
const wmpfVoip = requirePlugin('wmpf-voip' ).default
try {
const { roomId } = await wmpfVoip.callDevice({
roomType: 'video', // Room type. voice: Audio Roomvideo: Video Room
sn: 'equipment SN',
modelId: 'equipment modelId',
nickName: "WeChat user name displayed on the device end,"
deviceName: My learning machine,
})
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',
})
}
# 2. Push call alerts
After initiating a call in WeChat, the developer should use its own message channel to roomId And so on equipment terminal joins the room to need the parameter passing to the equipment.
# 3. The device receives the call
The device end, after receiving the call reminder, first uses the wx_voip_session_new
Interface Creation Session, and then pass the wx_voip_listener_Join
Answer. Other interfaces used are similar to device calling cell phones. Session Once created, you can call wx_voip_session_hangup
Interface to end the call. Details can be found Mini Program audio and video calls SDK (Linux)》。
# 4. Device Reject Call
After the device side receives the call reminder, it can call the wx_voip_listener_hangup
(Only available in Session Call before creation) ends the call and realizes busy or reject. Details can be found Mini Program audio and video calls SDK (Linux)》。