# Frequently Asked Questions (FAQ)
# Call-related anomalies, please refer to "Call Anomaly Troubleshooting Guide"
# 1. Functionally relevant (universal)
# 1.1 How can you limit the length of a user's single call?
Recommended use initByCaller ThetimeLimitparameter.The plug-in version also calculates the call duration from thecallingevent'skeepTimefield.When the limit is exceeded, you can call the plug-in forceHangUpVoip to interrupt the call.
It is not recommended to implement this function using a timer, because there are a number of exceptions that cause the timer not to be cleaned. This affected the subsequent call.
# 1.2 In the access control and lock scenario, how can I implement "open door" and other functions on the phone call page?
Plug-in provides setCustomBtnText The interface receives page custom buttons on the phone, and developers can configure a custom pop-up layer to implement specific functions.
The C-end user experience is shown below:

# 1.3 How can a user revoke authorization?
Users can unauthorize in the Weixin Mini Program settings page, or clear authorization records by deleting the Mini Program in recent use.Please refer to " Handling Cases of Invalidation of Authorization ."
# 1.4 How do I query if a user has authorized a device (group)?
Please refer to " authorization status query ."
# 1.5 How do I set up a call to be super long (stop calling when you don't answer for a long time)? Is a questioning call supported?
The developer can control the timeout, and when the timeout calls the plugin forceHangUpVoip The interface interrupted the call.
After the timeout, developers can choose to make automated calls to other users depending on the business scenario, enabling the ability to make a round call. For example, room 101 has A, B, C three owners, call A owners 30 seconds not answered, can automatically call B owners, and so on.
# 1.6 How do I customize the name of the device-side call seen on my phone?
In order to strengthen the awareness of device calls and ensure the unified user experience, the name of the device authorized by the mobile user and the name of receiving the device call need to be maintained consistently.
Authorized device name = caller name = developer name + device type name.Examples include Emma's Hero's web class learning machine. Developers need to consider name displays and regulate names.



(Case illustration: name of the subscription device, name of the caller, name of device in the voice call)
# 1.7 How do I whitelist my domain name and IP when using an IoT card?
VoIP services rely on WeChat basic services and Weixin Mini Program related business content, and involve a relatively large number of IPs (in the order of thousands) and domain names. A complete list of domain names and IPs is not available at this time, and non-directed traffic is currently recommended.
If there is a demand for targeted traffic, you can contact us at WeChat open community "hardware services" section .
Note: IPs themselves can be added or deleted as business changes, so there is no way to provide a stable list for the time being.
# 1.8 How much traffic is used for audio and video calls?
According to estimates, voice calls are about 2MB / minute, and video is 10-30MB / minute.
# 1.9 How do I disable the camera by default if the device does not have a camera or does not want to transmit the video for privacy reasons (user-side access control, door lock)?
When the plug-in initiates a call, you can set caller.cameraStatus or listener.cameraStatus to set whether the camera is turned on by default at both ends, see initByCaller interface documentation.
To prevent the user from switching the camera, you can set the callerUI / listenerUI enableToggleCamera option with the plug-in's setUIConfig .
# 1.10 Why is the call duration displayed in push messages inconsistent with the call end or endVoip event acquisition? How should I obtain an accurate call duration?
For VOIP plug-ins 2.2.1 and later, the end of the call page displays the time calculated by the local timer, and the keepTime for endVoip events provides the same time. However, due to some network latency between the two parties, the time here may not coincide with the actual charge time (generally more than the actual charge period).
Starting with version 2.2.2, the VOIP plugin gets the actual billing time from the background after the call ends (i.e. after the endVoip event) and returns it to the developer via the keepTime of the finishVoip event. The call end page will also be updated to show the actual charge time.
# 2. Functionally relevant (Android devices)
# 2.1 How is parameter passing and communication done between Android apps and Weixin Mini Program? How does an Android app receive messages from a Mini Program?
- Simple "Android application - > Weixin Mini Program" one-way single this pass parameter scene, you can directly start the Mini Program in the path of splicing query.
- If an Android application wants to receive events from Weixin Mini Program, needs two-way communication, or has a large amount of data, it can use the Invoke Channel provided by WMPF.
# 2.2 How do I close Weixin Mini Program after the call is complete?
When the device side Weixin Mini Program only carries VOIP call capability, you may need to cut the Mini Program back or close it after the call.
Weixin Mini Program After receiving theendVoIPevent of the plug-in, the InvokeChannel informs the App via the WMPF.
After receiving a notification, the App can choose to call closeWxaApp to cut Weixin Mini Program out of the background or to shut down (refer to the [performance and experience optimization guide]] explaination options).
# 2.3 How to determine whether the current Weixin Mini Program is open on the device side (WMPF) or the phone side
When WMPF is running, Weixin Mini Program can access the local variablewmpf.This can be determined by the presence or absence of this local variable:typeof wmpf!= = 'undefined'is the device side.
Note: Before calling a method on wmpf, you should determine whether wmpf this local variable exists in advance, otherwise the phone WeChat side will report an error when it comes to this logic.
# 3. Exceptionally relevant (generic)
# 3.1 The phone did not receive WeChat call strong reminder or reminder strength does not meet expectations (lock screen did not remind, did not ring, did not shake, etc.)
Please refer to Call Alert Exception Troubleshooting Guide .
# 3.2 Get device ticket getSnTicket interface returns 48001 (api unauthorized)
Weixin Mini Program appId not completed hardware device access Please confirm:
- ApplId corresponds to Weixin Mini Program has completed hardware device access in the "Mini Program management background."
- The access_token used in the request is the appId that completes the application Weixin Mini Program, not the appId of another Mini Program or the hostAppId of Mobile App.
# 3.3wx.requestDeviceVoIPError reportinvalid scope
Weixin Mini Program appId failed to complete hardware device access or failed to apply for "Mini Programs audio and video capability" device capability after access. Please confirm that the Mini Program has completed hardware device access in the Mini Program management background and applied for audio and video capabilities through the Mini Program.
# 3.4wx.getEnterOptionsSyncorgetPluginEnteroptionscannot get a query into Weixin Mini Program
There are generally the following situations:
- These two functions only get the parameters of Weixin Mini Program when it starts (cold or hot),If this is the case of a page being redirected by
wx.navigateTo]], you need to get it in theonLoad]]lifecycle of the corresponding page. - Due to the security policy restrictions of the plug-in and host Weixin Mini Program, when the Mini Program launch path is the plug-in page, it needs to be provided by the VOIP plug-in.
getPluginEnteroptionsget query; When the Mini Program boot path is the Mini Program page, you need to get the query throughwx.getEnterOptionsSync.
It is recommended that thepathfield in the returned value be printed at the same time during the lookup to confirm whether it is the intended incomingquery[[TAG-1-DATA]]path。
# 3.5 Recipient prompts "The page does not exist" when answering
There are generally the following situations:
- The plug-in
initByCalleris called withoutminiprogramState, orminiprogramState: formal, when the receiver opens the formal version Weixin Mini Program.The device's VOIP capabilities have not yet been released. initByCalleris called withminiprogramState: trial,At this point, the receiver will open the experience version Weixin Mini Program.And currently set to experience version of the Mini Program does not support the device VOIP capabilities.- When calling the plug-in
initByCaller,miniprogramState: developer, The receiver opens the development version Weixin Mini Program. At this time, the receiver needs to scan the code in advance to download the same development version of the Mini Program as the caller to use it.
# 3.6 After initiating a call, the plug-in page remains in the "Wait to make a call" interface without responding
There are generally the following situations:
- Weixin Mini Program Plugin
initByCallerwas not called to initiate the call.It could be a pre-existing logic exception or a failure to go to the branch that initiated the call. The developer should first make sure that the interface is called. - Weixin Mini Program Calling the plug-in
initByCallerfailed, possibly throwing an exception or returning a non-0 errCode.Developers should properly capture and handle interface anomalies and give users the necessary prompts.
# 3.7 Why can't I find the public key in wecopper's provisioning?
This is because your device type is a WeChat payment facial device, currently this type of device does not support hardware Voip mode, you need to reapply the device type.
# 4. Exceptionally related (Android devices)
# 4.1 WMPF does not get the correct image, or the image rotates
InitGlobalConfig The interface specifies the camera used by Weixin Mini Program. You can also specify the angle of swing of the camera image.
fun initGlobalConfig() {
val jsonConfig = JSONObject()
// 请注意:USB 摄像头和内置摄像头使用的参数名称是不一样的。
try {
// 案例 1:微信端画面颠倒
jsonConfig.put("cameraPushFlip", true) // USB 摄像头需使用 usbCameraPushFlip 参数
// 案例 2:使用内置摄像头,微信端显示画面旋转
jsonConfig.put("cameraRotationAngle", 90) // 根据实际情况调整角度
// 案例 3:通过指定 internalCameraName 使用设备内置摄像头(需 WMPF 2.0.0 支持)
jsonConfig.put("internalCameraName", "xxxx")
// 案例 4:通过指定 cameraId 使用设备内置摄像头
jsonConfig.put("cameraId", 0)
// 案例 5:通过直接指定摄像头设备路径使用 USB 摄像头(与案例 5 的情况二选一)
jsonConfig.put("usbCameraName", "/dev/xx/xx/xx")
// 案例 6:通过指定三元组使用 USB 摄像头(与案例 4 的情况二选一)
jsonConfig.put("usbCameraProductId", 0)
jsonConfig.put("usbCameraVendorId", 0)
jsonConfig.put("usbSerialNumber", "xxx")
// 案例 7:使用 USB 摄像头,WMPF 预览和微信端显示画面旋转
jsonConfig.put("usbCameraRotationAngle", 90) // 根据实际情况调整角度
val json = jsonConfig.toString()
LogUtils.d(TAG, "initGlobalConfig", json)
Api.initGlobalConfig(json)
.subscribe({
LogUtils.d(TAG, GsonUtils.toJson(it))
warmLaunch()
}, {
LogUtils.d(TAG, GsonUtils.toJson(it))
warmLaunch()
})
} catch (e: Exception) { }
}
If the setting of camera frame rotation does not work, it is recommended to check by following the following guidelines:
InitGlobalConfigmust be called after theActivateDevicecallback is successful and before starting Weixin Mini Program.It is recommended to call after the onSuccess callback ofActivateDevice.InitGlobalConfigsettings are one-time and need to be called after each WMPF startup.- Make sure the device uses a USB camera or a built-in camera.
- If through
usbCameraName, orusbCamera ProductId + usbCameraVendorId + usbSerialNumberSpecify the use of USB camera, useusbCameraPushFlipandusbCameraRotationAngleto set the screen rotation - In other cases where the built-in cameraId is used, the
internalCameraNamecan be specified.UsecameraPushFlipandcameraRotationAngleto set the frame rotation.At this time, you can only set the rotation of the push stream screen seen by the passenger, and you can't change the preview screen seen by the device.
- If through
# 4.2 Sometimes the device does not receive pushed call reminders
You can check them according to the following guidelines
- Confirm that WMPF is upgraded to v1.1.5 and above;
- Confirm that the device is connected to the network and confirm that the network is up and running;
- Verify that the device side WMPF is started and ActivateDevice is completed to ensure that the WMPF is running correctly
- WMPF due to crash and other reasons abnormal exit, need to pull up again.Suggested listening
IPCInvoker.addRemoteProcDiedListener(WMPFService.WMPF_SERVICE_PROCESS_NAME,Listener), pull up again after WMPF exits.
# 4.3 Why does the device need the user to scan the code to log in?
When using Weixin Mini Program audio and video calling (for hardware) capabilities, users do not need to scan the code on the device side to log in.But if the Mini Program calls an interface related to the WeChat login state, such aswx.login,A barcode screen pops up asking the user to log in.
It is recommended that developers refer to 2.3 and avoid calling related interfaces when Weixin Mini Program is running in a WMPF environment.
# 4.4 WMPF ActivateDevice errorsignature err 1
Signature err is when the background discovers that the parameters in the signature do not match the parameters passed in by ActivateDevice. It is recommended to follow the following guidelines for checking:
Note that a successful signature verification only indicates that the parameters included in the signature are the same as those provided during verification, and does not mean that ActivateDevice will not report errors.
- Confirm that WMPF is upgraded to v1.1.5 and above;
- Verify that the productId, deviceId, and version of the key used (keyVersion) at the time of generating the signature match the parameters passed in by ActivateDevice.
- Verify that the key pair used to generate the signature matches those registered on wecooper. If the key pair is changed, please update it on wecooper and sign it with the new key pair and keyVersion.
- When generating a signature in the developer background, the version of openssl that generates the signature environment recommends 1.1.1, and it has been determined that there will be problems with the 1.0.x and 3.0.x versions, which developers can try on their own.
- The [aids provided in the WMPF documentation are only suitable for debugging and do not support concurrent operations when the mmIoT_ecdsa_sign.sh script or the java interface generate signatures.
# 4.5 WMPF 调用接口时回调 onBridgeNotFound,或提示bridge not found
This error indicates that the WMPF Service is not running. The WMPF Client will attempt to pull up the WMPF Service automatically when calling the interface, but it may fail for a number of reasons. It is recommended to follow the following guidelines for checking:
- Verify that the WMPF Service APK is installed;
- Verify that the WMPF Service's self-start permissions are turned on in the Tie Settings. Otherwise, you need to start the WMPF Service manually.
- Verify that WMPF is currently alive (not killed by the system)
# 4.6 WMPF call errorFailed to find provider info for com.tencent.wmpf.comm.provider
When applying targetSdkVersion > = 30, Android requires adding "elements to the application manifest file. Please refer to Android documentation for configuration.
<manifest>
...
<queries>
<provider android:authroities="com.tencent.wmpf.comm.provider"/>
</queries>
...
</manifest>
# 4.7 WMPF ActivateDevice error10013 request timeout
Please follow these steps to check out
- Confirm that the device network is normal;
- Confirm that the device is Android version 7.1 and above (WMPF minimum 7.1);
- If the device is a payment device, when using hardware VOIP, you should ensure that the payment related applications and services have been deleted or disabled, otherwise there will be conflicts.
# 4.8 WMPF call v2 version interface times errorcall WMPF.apk fail, is it installed? (errCode=10001)
- WMPFDevice cannot be inherited, or it may cause data deserialization to fail.
- If the v1 version of the interface can be successfully invoked, it is generally due to a mismatch between the wmpf-cli and the WMPF Service APK version.Both should be upgraded to > = 2.1.0 Official .
- If v1 also fails, refer to 4.5 for troubleshooting.
# 4.9 WMPF errorerr: TRANSFER errCode: 33
This error indicates that the network request in the WMPF and WeChat background timed out (30 s). It may be due to the following reasons
- The network connection itself appears to be abnormal, such as the device being offline or the network unstable.
- WMPF automatically re-logs in after the device logon state timeouts, and failure to re-log in can cause this problem.
- Activation of the same deviceId on another device causes other devices using this deviceId to be kicked off. WMPF will automatically re-login after being kicked, and failure to re-login will cause this problem.
# 4.10 Weixin Mini Program Run times errorwmpf is undefined
Wmpfis a global variable unique to the Weixin Mini Program hardware framework (WMPF) and can only be accessed within WMPF. This global variable does not exist for mobile phone WeChat clients.
This error usually occurs when the developer accesses the global variable directly without knowing the current environment, causing Weixin Mini Program to run the error within the mobile WeChat client.
If the logic using the wmpf local variable will run on both WMPF and mobile WeChat, it is recommended to determine the current environment before using it, for example:
if (typeof wmpf !== 'undefined') {
// WMPF,可以使用 wmpf 环境变量
wmpf.Channel.invoke({
command: 'test',
success: function(res) {
console.log(res.data)
}
})
} else {
// 手机微信
}
# 4.11 After activation fails in WMPF with information such as the wrong SN, the correct SN is still abnormal.
WMPF as a service to run, is the first registration of some information to do cache, generally encountered this exception, clean up the WMPF cache and retry.