# Call Anomaly Troubleshooting Guide

During the call, if you encounterUnable to initiate call,Abnormal exit after call initiation,Hang up as soon as the receiver answers,Abnormal call exitOther problems, can refer to this article for investigation.

A call has Dialing party(orCaller、Caller) and Receiving party(orCalled) Two characters. In general, we can put a time between the hardware and the Mini Program VoIP Call is divided into initiate、join、wait forandcall Four stages. Different stages may have different types of problems, in the investigation, should first determine which stage is abnormal according to the performance, in accordance with the specific stage of the guidelines for further analysis.

Suggested use of plugins 2.3.2 And above versions.

# 1. Initiation phase

The initiation phase refers to the invocation of the plug-in initByCaller Interface or Linux SDK wx_voip_session_call create VoIP Stage of the room. During this stage, WeChat will perform a series of pre-call checks, including but not limited to:

  • VoipToken The effectiveness of.
  • Whether there is an authorization relationship between the user and the device.
  • Whether there is a margin for Mini Program traffic packets, or whether the device is bound to a valid license。

After checking the call, WeChat background will push the call reminder to the recipient.

If it fails during the initiation phase, the interface returns errCode, the developer can be based on thePlugin DocumentationThe explanation to troubleshoot the cause of the problem, the more common mistakes are the following categories.

# (1) User not authorized device (errCode: 9)

The device must be authorized to talk to WeChat users, please refer to the specific processUser Authorization Device Documentation

This error occurs in the following cases:

  • Not used wx.requestDeviceVoIP Authorization has been requested from the user, or the user denies the authorization after the request
  • The user had previously authorized, but subsequently cancelled the authorization
  • The user removed the Mini Program from recent use. This clears all authorization records between the user and the Mini Program
  • Incoming openId Not to dial to the user, for example: the authorization is the parent, here passed the child's openId。

In the case of a device group, the following situations are also common:

  • The user authorized the device group A, but the device is not added to the device group A In or have been removeIotGroupDevice Interface removal
  • The user authorized the device group A, but the equipment is used addIotGroupDevice (force_add=true) Forcibly transferred to another device group. B, will also cause the device to switch from the device group A Removed in.

Optimization proposal

Suggested UseAuthorization status query Interface, judging the user and device/Whether the device group directly has an authorization relationship.

  • It is recommended to call in advance before the call is initiated in WeChat.[wx.getDeviceVoIPList]((wx.getDeviceVoIPList )) Query the list of devices authorized by the user to determine that the device is authorized to reinitiate the call, otherwise the user should be requested to reauthorize
  • It is recommended to call the plug-in in advance before the device initiates a call getIotBindContactList Interface to determine whether there is an authorization relationship between the device and the user, and then initiate the call if there is, otherwise the user should be prompted to re-authorize

For device groups, you can use the [getIotGroupInfo ]((getIotGroupInfo )) Query the device list in the device group.

# (2) Device Call Mobile WeChat VoipToken error (errCode: 13)

For the use ofEquipment certification SDK Registered device (at this time VoipToken to import SDK Acquired deviceToken), often have the following conditions:

  • deviceToken Expired.deviceToken There is a certain period of validity, the need for regular updates, if the acquisition time is too long will fail.
  • Not passed VoipToken Field or pass in an empty character string. This applies only to the use of WMPF registerMiniProgramDevice Interface to register the device.

For the use of WMPF registeredOf the device, may have the following conditions:

  • Equipment before the use of equipment certification SDK Of, not used WMPF of [registerMiniProgramDevice](https://developers.weixin.qq.com/doc/oplatform /Miniprogram_Frame/api/cli/miniprogramdevices /registerMiniProgramDevice.html) The interface is re-registered.
  • WMPF Lower than 1.2.0, or a plug-in version less than 2.3.0。

# 2. Dialing partyAccession phase

create VoIP After the room was successful,Dialing partyWill join the room directly, the interface will showConnecting...The length of time to join is generally related to the current network state.

After joining successfully, the dialing party will trigger joinedRoomByCaller Events.

# (1) The device can call successfully before, suddenly start to continue to fail, need to restart WMPF In order to recover

Most likely Android. WMPF The lower version Bug, please upgrade to >= 2.0 Version resolved. If the new version still finds similar problems, please refer to 8 Section Feedback.

In this case the developer may receive joinFailCaller Events, errMsg Contain Already in room or Joining, at this point you can try to restart WMPF。

# (2) Keep showingIn connection(stuck at this stage), unable to join the room, the call was abruptly ended

The connection may be slow due to poor network conditions, at which point the call may end due to the receiver waiting for a timeout, triggering AbortVoip and endVoip Events.

# (3) Exit the call without joining the room

Common causes are:

  • Mini ProgramError callplug-in forceHangUpVoip Interface to hang up the call and trigger cancelVoip Events and endVoip Event (Toast prompt The call has been terminated by the Mini Program)。
    • Before the investigation encountered part of the Mini Program will set the timer to set the maximum length of the call, after the call, in some cases the timer is not cleaned up resulting in a subsequent call randomly hang up the call.
    • We suggest that by listening calling Events, and judge the keepTime To limit the length of the call,It is not recommended to use a timer
  • Failed to join a room due to a network timeout or other anomaly, in which case the caller will receive joinFailCaller Events, which can be accessed by Data Field to get errMsg and message To analyze the cause of the error.

# 3. Dialing partyWaiting phase

Dialing partyIf the room is successful,Receiving partyHas not yet entered the room,Dialing partyIt goes into a wait state. At this point the interface displays theConnecting...Turn intoWait for the call...。

Under normal circumstances, the following actions will result in the call ending directly at this stage:

  • Dialing partyThe user clicks the hang up button, which triggers the cancelVoip and endVoip event
  • Receiving partyNot answered in timeout (currently 60s), will trigger the timeout and endVoip event
  • Mini Program call plug-in forceHangUpVoip Interface to hang up the call and trigger cancelVoip Events and endVoip Events.

# (1) Just quit when the call is not connected

Common causes are:

  • Mini ProgramError callplug-in forceHangUpVoip Interface to hang up the call, it will trigger cancelVoip Events and endVoip Event (Toast prompt The call has been terminated by the Mini Program)。(Common reasons for the same 2(3))
  • When a call is interrupted due to a network timeout or other device-side exception, triggers the AbortVoip and endVoip Events, may refer to Section 8 Section feedback

# 4. Receiving partyJoin (answer) phase

The receiving party receives the call reminder and clicks the answer button,Receiving partyWill be added to the call room. The interface will showConnecting...The length of time to join is generally related to the current network state.

  • If the recipient device is making another call at this time, it will be judged to be busy and the caller will receive busy Events and endVoip event
  • If the receiving party clicks the refuse to answer button at this time, it will receive rejectVoip Events and endVoip event
  • (VoIP plug-in < 2.3.2 Version) the user to lock the screen, exit WeChat or exit the Mini Program, will also be considered a rejection, will receive rejectVoip Events and endVoip event

# (1) There is no connection when the call is answered, the call ends directly.

Common causes are:

  • Received late, when the call ended some time ago (possibly due to a message delay).
  • When answeringDialing partyJust hung up or the call ended due to a timeout.
  • Failed to join the room due to a network timeout or other anomaly, in which case the receiver receives a joinFailListener Events, which can be accessed by Data Field to get errMsg and message Object to analyze the cause of the error.
  • When answeringDialing partyThe call ended because an exception occurred during the join and wait phases when the room was exited.
  • When answering, the user is making a system call or other within WeChat VoIP Calls, resulting in the inability to join new calls again.

# (2) The call ends before the user chooses to answer or hang up, prompting the call to be rejected

(VoIP plug-in < 2.3.2 Version) the user to lock the screen, exit WeChat or exit the Mini Program, will also be considered a rejection, will receive rejectVoip Events and endVoip event

# 5. Receiving partyWaiting phase

Receiving partyIf the room is successful,Dialing partyHas not yet entered the room,Receiving partyWill enter a wait state, at which point the interface will display a wait state fromConnecting...Turn intoWaiting for the other party to join the call...。

At this stage, the following actions cause the call to end directly:

  • Receiving partyThe user clicks the hang up button, which triggers the rejectVoip and endVoip event
  • Mini Program call plug-in forceHangUpVoip Interface to hang up the call and trigger rejectVoip Events and endVoip Events.

# (1) Do not start the call after receiving, or wait for a while after the call automatically ends

Common causes are:

  • Dialing partyTimeout does not join successfully, will trigger AbortVoip and endVoip event
  • Mini ProgramError callplug-in forceHangUpVoip Interface to hang up the call and trigger rejectVoip Events and endVoip Event (Toast prompt The call has been terminated by the Mini Program)。

# 6. Call phase

When both parties have successfully joined the room, the call begins until one of them ends the call.

Normally, the end of a call is made byReceiving partyorDialing partyThe user clicks the hang up button or the Mini Program invokes the plug-in forceHangUpVoip Interface trigger. Will say at this point. HangUpVoip Events and endVoip event

The duration of the call is limited toCall phase, the deduction is also based on theCall phaseThe duration is chargeable, if not connected is not chargeable.

# (1) The user did not click to hang up, the call ended itself

Could be the following:

  • Mini Program call plug-in forceHangUpVoip Interface to hang up the call and trigger HangUpVoip Events and endVoip Event (Toast prompt The call has been terminated by the Mini Program)
  • Receiving partyorDialing partyUnexpected exit, such as the killing of Mini Programs, network interruptions, etc., the other party will trigger AbortVoip and endVoip event
  • During the callReceiving partyorDialing partyOther exceptions occur, the exception will trigger AbortVoip and endVoip Events, may refer to Section 8 Section feedback

# 7. About Call Alerts

Please refer to theCall alert anomaly detection guide

In other cases, reference may be made to section 8 Section Feedback.

# 8. Still unresolved

If the cause is still not determined, it can be found in[WeChat Open CommunityHardware servicesplate](https://developers.weixin.qq.com/community/Minihome /mixflow/2351405025148862470)Post Contact us for analysis.

If the post is posted in other boards, it may be fed back to other teams. There is no way to deal with it in time, please post it in theHardware servicesPlate to post again.

Please provide the following in the post

  • (Android) WMPF Version number: If v1.2.0 / v2.0.0
  • (Linux)SDK Version number: If 0xD5000088
  • VoIP Plugin version number: If v2.3.0
  • Mini Program appId: Such as wxabcdefhigklmnopq
  • Information that identifies a call (choose one)
    1. Returned by the call plug-in roomId And the date of the call.
    2. Information on at least one party to the call (the device SN Or WeChat users openId/WeChat ID), and the specific time point at which the call started (the more precise the better).

If necessary, we may also contact you to provide additional device or mobile WeChat logs, as follows:

Device Side Log

adb pull /storage/emulated/0/Android/Data/com.tencent.wmpf/files/xlog

And put the entire log folder xlog Send it to us.

Mobile WeChat terminal log

WeChat ClientI->Set up->Help and Feedback->Upper right corner wrench ->Upload log-> ChoiceLogs for the day of the anomalyUpload, and provide the problem occurred with thetimeandWeChat ID