引入呼叫组件后话单无法展示?

更新时间: 2026/02/05 17:06:46

问题描述

若您在 V9.3.0 之前的 UIKit 版本中引入呼叫组件实现音视频通话时,可能会出现话单无法展示的问题。

解决方法

在呼叫组件初始化时,或者在您接入 IM 的 Activity 中的 onCreate 中设置呼叫组件的话单发送监听以及复写话单发送功能。

以 Activity 为例,MainActivity 是您展示会话列表和好友的页面。更多请参考 实现音视频通话

javapublic class MainActivity extends AppCompatActivity {
    protected void onCreate(Bundle savedInstanceState) {
        //设置呼叫组件话单监听
        NERTCVideoCall.sharedInstance()
        .setCallOrderListener(
        new DefaultCallOrderImpl() {
          @Override
          public void onTimeout(ChannelType channelType, String accountId, int callType) {
            ALog.dApi(
                "CallOrderImpl",
                new ParameterMap("onTimeout")
                    .append("channelType", channelType)
                    .append("callType", callType)
                    .append("accountId", accountId)
                    .append("enableOrder", isEnable())
                    .toValue());
            if (!isEnable()) {
              return;
            }
            if (NERTCVideoCall.sharedInstance().getCurrentState() == CallState.STATE_INVITED) {
              return;
            }
            if (NetworkUtils.isConnected()) {
              sendOrder(
                  channelType, accountId, NrtcCallStatus.NrtcCallStatusTimeout);
            } else {
              sendOrder(
                  channelType, accountId, NrtcCallStatus.NrtcCallStatusCanceled);
            }
          }

          @Override
          public void onCanceled(ChannelType channelType, String accountId, int callType) {
            sendOrder(channelType, accountId, NrtcCallStatus.NrtcCallStatusCanceled);
          }

          @Override
          public void onReject(ChannelType channelType, String accountId, int callType) {
            sendOrder(channelType, accountId, NrtcCallStatus.NrtcCallStatusRejected);
          }

          @Override
          public void onBusy(ChannelType channelType, String accountId, int callType) {
            sendOrder(channelType, accountId, NrtcCallStatus.NrtcCallStatusBusy);
          }
        });
  }   
        
private void sendOrder(ChannelType channelType, String accountId, int status) {
  NetCallAttachment netCallAttachment =
          new NetCallAttachment.NetCallAttachmentBuilder()
                  .withType(channelType.getValue())
                  .withStatus(status)
                  .build();
  IMMessage message =
          MessageBuilder.createNrtcNetcallMessage(accountId, SessionTypeEnum.P2P, netCallAttachment);
  ChatRepo.sendMessage(message,true,null);
}
}
此文档是否对你有帮助?
有帮助
去反馈
  • 问题描述
  • 解决方法