# Frequently Asked Questions (FAQ)
# Call related exceptions, please refer to theCall Anomaly Detection Guide
# 1. Functional Related (General)
# 1.1 How do I limit the length of a single call?
Suggested Use initByCaller
of timeLimit
Parameters. The lower version of the plugin can also be based on the calling
The event's keepTime
Field to calculate the length of the call. After the limit is exceeded, the plug-in can be called forceHangUpVoip
Interrupt.
It is not recommended to use a timer to achieve this function, which is prone to some abnormal conditions causing the timer to not be cleaned up. Which affects subsequent calls.
# 1.2 In the access control, door lock scene, how to achieve the phone call pageOpen the doorSuch functions?
The plugin provides setCustomBtnText
Interface in the mobile phone to answer the page custom button, developers can configure a custom shell layer to achieve specific functions.
C The user experience is shown below:
# 1.3 How do users cancel their authorization?
Users can deauthorize from the Mini Program settings page, or clear the authorization log by deleting the Mini Program in recent use. Please refer to the[Dealing with cases where authorization lapses](./voip/auth.md#_2 - Dealing with cases where authorization lapses)。
# 1.4 How do I find out if a user has authorized a device (group)?
Please refer to the[Authorization status query](./voip/auth.md#_4 - Authorization Status Inquiry)。
# 1.5 How do I set the call timeout (stop calling if I don't answer for a long time)? Does polling call support?
The developer can control the timeout time and call the plug-in after the time out forceHangUpVoip
Interface to interrupt the call.
After the timeout, the developer can choose to automatically dial to other users according to the business scenario, and realize the ability of polling calls. for example 101 Room number has A、B、C Three owners. Call A owner 30 Seconds do not answer, you can automatically call B Owners, and so on.
# 1.6 How do I customize the device call name that the phone side sees?
In order to strengthen the awareness of device calls and ensure a unified user experience, the name of the device authorized by the mobile user and the name of the device to answer the call need to be consistent.
Authorized Device Name = Caller name = Developer Custom Name + Device Type Name
Such asEmma's shivo learning machineDevelopers need to consider the name display, the name of the specification.
(Case Sketch: Subscription Device Name, Caller Name, Voice Call Device Name)
# 1.7 When using an IoT card, how to configure a domain name and IP The White List?
VoIP The business relies on WeChat basic services and Mini Program-related business content, involving more IP (on the order of thousands) and domain names, temporarily failing to provide complete domain names and IP List, it is currently recommended to use non-directed traffic.
If there is a demand for targeted traffic, it can be found in[WeChat Open CommunityHardware servicesplate](https://developers.weixin.qq.com/community/Minihome /mixflow/2351405025148862470)Post to contact us.
Note: IP Itself will be added or removed as the business changes, so it can not provide a stable list for the time being.
# 1.8 Traffic usage for audio and video calls?
According to calculations, the voice call was probably 2MB/Minutes, the video is 10-30MB/Minutes.
# 1.9 The device does not have a camera or does not want to transmit pictures due to privacy reasons (access control, door lock client), how to disable the camera by default?
When the plug-in initiates a call, you can set the caller.cameraStatus or Listener.cameraStatus, which sets whether the camera is turned on by default on both ends, see initByCaller
Interface documentation.
If you want to disable the user from switching cameras, you can use the plugin's setUIConfig Set up callerUI/listenerUI of enableToggleCamera Options.
# 1.10 Why does the push message show the length of the call and the end of a call or endVoip Inconsistent acquisition of events? How do I get the exact length of the call?
VOIP plug-in 2.2.1 And below, the time displayed on the end of the call page is the time calculated by the local timer, endVoip The event's keepTime This is also the time provided. However, due to the network delay between the two sides of the call, the time here may not be consistent with the actual charge time (usually more than the actual charge time).
VOIP plug-in 2.2.2 Version to start, will be after the end of the call (i.e. endVoip After the event) to get the actual chargeback length from the background and pass the finishVoip The event's keepTime Back to the developer. The End of Call page will also be updated to show the actual amount charged.
# 2. Feature Related (Android Devices)
# 2.1 How is parameter passing and communication between Android apps and Mini Programs? How do Android apps receive messages from Mini Programs?
- SimpleAndroid app -> Mini ProgramOne-way single this transfer parameters of the scene, you can directly start the Mini Program path Middle splicing query。
- If the Android app wants to receive events from the Mini Program, needs two-way communication, or has a large amount of data, it can use the WMPF Provided[Communication channel(Invoke Channel)](https://developers.weixin.qq.com/doc/oplatform /Miniprogram_Frame/invoke-channel.html)
# 2.2 How do I close the Mini Program after the call is complete?
When the device-side Mini Program only carries VOIP Call ability, you may need to cut the Mini Program into the background or close it after the call.
The Mini Program receives the plug-in endVoIP
After the event, through WMPF Provided[Communication channel(Invoke Channel)](https://developers.weixin.qq.com/doc/oplatform /Miniprogram_Frame/invoke-channel.html)notice App。
After receiving the notification, the app You can choose to call [closeWxaApp](https://developers.weixin.qq.com/doc/oplatform /Miniprogram_Frame/api/cli/miniprogram/closeWxaApp.html) Cut the Mini Program to the background or close (refer to the[Performance and Experience Optimization Guide](./voip/performance.md#_4 - Android - WMPF - Cut background when closing Mini Programs)Of the illustrative selection).
# 2.3 How to determine whether the current Mini Program is open on the device side (WMPF) or the phone side
in WMPF At runtime, the Mini Program can access wmpf
This global variable. You can tell by the presence of this global variable:typeof wmpf !== 'undefined'
For the device end.
Note: Calling wmpf Before the method on, should be judged in advance wmpf Whether this global variable exists, otherwise it will report an error when it comes to this logic on the WeChat side of the mobile phone.
# 3. Exception Related (Generic)
# 3.1 The mobile phone has not received a strong reminder of WeChat call or the reminder intensity is not in line with expectations (lock screen is not reminded, not ringing, not vibrating, etc.)
Please refer to theCall alert anomaly detection guide。
# 3.2 Get Equipment Tickets getSnTicket Interface return 48001 (api unauthorized)
Mini Program appId imperfectHardware device accessLeading to... Please confirm:
- appId The corresponding Mini Program is inMini Program management backgroundComplete hardware device access.
- Used at the time of the request access_Token Approval is the completion of the application for the mini-program appId Applied for, rather than the other Mini Program's appId Or a mobile app. hostAppId。
# 3.3 wx.requestDeviceVoIP
Misrepresent invalid scope
Mini Program appId imperfectHardware device accessOr Access Without ApplicationMini Program audio and video capabilitiesEquipment capacity. Please confirm that the Mini Program is inMini Program management backgroundComplete the hardware device access and apply the audio and video capabilities through the Mini Program.
# 3.4 wx.getEnterOptionsSync
Or plug-in's getPluginEnteroptions
Unable to get access to the Mini Program query
There are generally the following situations:
- These two functions can only get the parameters of the Mini Program when it starts (cold or hot), if it is through the
wx.navigateTo
And other routing way to jump the page, you need to be in the corresponding page of theonLoad
Life cycle acquisition. - Due to the security policy restrictions of plug-ins and host Mini Programs, when the Mini Programs launch path is a plug-in page, it is necessary to pass the VOIP Provided by the plug-in
getPluginEnteroptions
Obtain queryWhen the Mini Program startup path is an Mini Program page, you need to go through thewx.getEnterOptionsSync
Obtain query。
It is recommended that you print the path
Field, confirming whether it is the expected incoming query
of path
。
# 3.5 Prompt when receiving party answersThis page does not exist
There are generally the following situations:
- Calling plug-in
initByCaller
Time not setminiprogramState
, or set up theminiprogramState: formal
At this time, the recipient will open the official version of the Mini Program. And the equipment VOIP Capabilities have not yet been released in official form. - Calling plug-in
initByCaller
Time is set.miniprogramState: trial
At this time, the recipient will open the experience version of the Mini Program. And the current set as the experience version of the Mini Program does not support the device VOIP Ability. - Calling plug-in
initByCaller
Time is set.miniprogramState: developer
At this time, the recipient will open the development version of the Mini Program. At this point, the receiver needs to scan the code in advance to download the same development version of the Mini Program as the caller.
# 3.6 After the call is initiated, the plugin page stays in theWait for a callInterface unresponsive
There are generally the following situations:
- Mini Program does not call the plug-in
initByCaller
Initiate the call. It may be a pre-logic exception or not go to the branch where the call originated. The developer should first make sure that the interface is invoked. - Mini Program call plug-in
initByCaller
Failed, may throw an exception or return a non 0 of errCode。Developers should properly catch and handle interface exceptions and give users the necessary hints.
# 3.7 Why am I here? wecopper Can't find the public key in the device management?
This is because your device type is a Weixin Pay face swipe device, which currently does not support hardware. Voip Mode, you need to reapply the device type.
# 4. Abnormal Correlation (Android Device)
# 4.1 WMPF Not getting the right camera, or camera screen rotation
Can be used [InitGlobalConfig
](https://developers.weixin.qq.com/doc/oplatform /Miniprogram_Frame/api/client/InitGlobalConfig .html) Interface to specify the Mini Program to use the camera, you can also specify the camera screen angle of swing.
fun initGlobalConfig () {
val jsonConfig = JSONObject()
// Please note: USB The camera and the built-in camera use different parameter names.
try {
// case 1: WeChat end screen upside down
jsonConfig.put("cameraPushFlip", true) // USB Camera needs to be used usbCameraPushFlip parameter
// case 2: Use built-in camera, WeChat end display screen rotation
jsonConfig.put("cameraRotationAngle", 90) // Adjust the angle according to the actual situation
// case 3: By specifying internalCameraName Use the device's built-in camera (required WMPF 2.0.0 Support)
jsonConfig.put("internalCameraName", "xxxx")
// case 4: By specifying cameraId Use the device's built-in camera
jsonConfig.put("cameraId", 0)
// case 5: Use by directly specifying the camera device path USB Camera (with Case 5 In the case of two choices)
jsonConfig.put("usbCameraName", "/dev/xx/xx/xx")
// case 6: Use by specifying triples USB Camera (with Case 4 In the case of two choices)
jsonConfig.put("usbCameraProductId", 0)
jsonConfig.put("usbCameraVendorId" 0)
jsonConfig.put("usbSerialNumber", "xxx")
// case 7: Use USB Portrait, WMPF Preview and WeChat end display screen rotation
jsonConfig.put("usbCameraRotationAngle", 90) // Adjust the angle according to the actual situation
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 setting up camera rotation does not take effect, it is recommended to check according to the following guidelines:
InitGlobalConfig
Must be inActivateDevice
Called after the callback succeeds and before starting the Mini Program. Suggested in theActivateDevice
of onSuccess Called after the callback.InitGlobalConfig
Setting is a one-off, in each WMPF All need to be called after startup.- Please confirm that the device is using USB Camera or built-in camera?。
- If passed
usbCameraName
, orusbCameraProductId + usbCameraVendorId + usbSerialNumber
Specifies the use of USB Camera needs to be used.usbCameraPushFlip
andusbCameraRotationAngle
Set Screen Rotation - Other situations using the built-in camera, you can use the
internalCameraName
Designated Camera cameraId。Need to use at this timecameraPushFlip
andCameraRotationAngle
Set screen rotation. At this point, only the rotation of the push stream screen seen by the WeChat client can be set, and the preview screen seen by the device can not be changed.
- If passed
# 4.2 The device sometimes does not receive the push call reminder
Can be checked according to the following guidelines
- confirm WMPF Upgrade to v1.1.5 And above version
- Confirm that the device is connected and that the network is open
- Confirm Device End WMPF Have started and completed activation (ActivateDevice), ensuring that WMPF Normal operation
- WMPF because crash After the cause of abnormal exit, you need to restart. Suggested Listening
IPCInvoker.addRemoteProcDiedListener(WMPFService.WMPF_SERVICE_PROCESS_NAME, listener)
, In WMPF Pull up after exit.
# 4.3 Why does the device end need users WeChat scan code login?
Audio and video calls using Mini Program (for Hardware) capability, the user does not need to scan the code on the device side to log in. However, if the Mini Program calls the interface related to the WeChat login state, such as wx.login
, will pop up a scan screen asking the user to log in.
Suggested Developer Reference 2.3 Determine whether the Mini Program is WMPF When running within the environment, avoid calling related interfaces.
# 4.4 WMPF ActivateDevice Misrepresent signature err 1
signature err Is when the parameters in the signature are found in the background with the ActivateDevice The parameters passed in do not match. It is recommended to check in accordance with the following guidelines:
Please note that successful signature verification only indicates that the parameters contained in the signature match the parameters provided at the time of verification. ActivateDevice No mistakes.
- confirm WMPF Upgrade to v1.1.5 And above version
- Confirm that the signature is generated productId、deviceId And the version of the key used(keyVersion) and ActivateDevice The incoming parameters are consistent.
- Verify that the key pair used to generate the signature is the same as the Wecooper Consistent with the registration. If the key pair is replaced, please promptly Wecooper Update on, and use the new key pair and keyVersion For a signature.
- When a signature is generated in the developer background, the openssl Version Recommended Use 1.1.1, Determined 1.0.x and 3.0.x There will be problems with the version, other version developers can try on their own.
- WMPF Provided in the documentation[Auxiliary tools](https://developers.weixin.qq.com/doc/oplatform /Miniprogram_Frame/utils.html)For debugging only, mmIoT_ecdsa _sign.sh Script or java The interface does not support concurrent operations when generating signatures.
# 4.5 WMPF Callback when calling interface onBridgeNotFound,或提示 bridge not found
This error indicates WMPF Service Not running. WMPF Client Will attempt to automatically pull up when the interface is called WMPF Service, but it may fail for a number of reasons. It is recommended to check in accordance with the following guidelines:
- confirm WMPF Service APK Installed
- Confirm that the system settings are enabled WMPF Service Of the self-start permissions. Otherwise, you need to start manually. WMPF Service。
- confirm WMPF Currently alive (not killed by the system)
# 4.6 WMPF Error during call Failed to find provider Info for com.tencent.wmpf.comm.provider
application targetSdkVersion >= 30 Android requires that you add it to your app's manifest file <queries>
Element, please refer to theAndroid DocumentationFor configuration.
<manifest>
...
<queries>
<provider android:authroities="com.tencent.wmpf.comm.provider"/>
</queries>
...
</manifest>
# 4.7 WMPF ActivateDevice Misrepresent 10013 request timeout
Please follow the following steps to check
- Confirm that the device network is working
- Confirm that the device Android is 7.1 And above (WMPF Minimum requirements 7.1)
- If the device is to pay for the face brushing device, use the hardware VOIP Ensure that all payment-related apps and services have been removed or disabled, otherwise there will be conflicts.
# 4.8 WMPF call v2 Interface Times Error call WMPF.apk fail, is it installed? (errCode=10001)
- WMPFDevice Cannot be inherited, or data deserialization may fail.
- if v1 Version interface can be called successfully, it is generally wmpf-cli and WMPF Service APK Version mismatch results. Both should be upgraded to >= 2.1.0 Official version。
- if v1 Version also fails, then the reference 4.5 And run a sweep.
# 4.9 WMPF Misrepresent err:TRANSFER errCode:33
This error indicates WMPF Network request with WeChat backend time out (30s), may have the following reasons
- The network connection itself appears abnormal, such as equipment off the network or network instability.
- After the device login state timed out, the WMPF A re-login occurs automatically, and failure to re-login can cause this problem.
- The same deviceId Activated on another device, causes others to use this deviceId The device login state is kicked. After being kicked WMPF A re-login occurs automatically, and failure to re-login can cause this problem.
# 4.10 Small operation times error wmpf is undefined
wmpf
Is the Mini Program hardware framework(WMPF) Unique global variables that can only be used in WMPF The mobile WeChat client does not exist this global variable.
This error occurs, usually the developer directly accesses this global variable without judging the current environment, causing the Mini Program to run the Times Error in the mobile phone WeChat client.
If you use wmpf The logic for global variables will run simultaneously on the WMPF And mobile phone WeChat, it is recommended to judge the current operating environment before use, such as:
if (typeof wmpf !== 'undefined') {
// WMPF, you can use the wmpf Environmental variables
wmpf.Channel.invoke({
Command: 'test',
success: function(res) {
console.log(res.data)
}
})
} else {
// Mobile WeChat
}
# 4.11 in WMPF Using the wrong SN After the information activation fails, modify it to the correct SN Still abnormal.
wmpf As a service, it will cache some information registered for the first time, and generally clean up this kind of exception wmpf Cache and try again.