You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure Communication Services添加PSTN参与者报错:已传参数仍提示需指定

Azure Communication Services 添加PSTN参与者时sourceCallerIdNumber参数不生效问题

使用Azure Communication Services(ACS)向已连接的通话中添加PSTN电话号码参与者时,明明已经在代码中配置了sourceCallerIdNumber参数,却依然收到错误提示要求指定该参数。

相关代码

case 'Microsoft.Communication.CallConnected':
      const callConnectedId = event.data.callConnectionId;
      console.log('Connected ', callConnectedId);
      const callConnection = client.getCallConnection(callConnectedId);
      const participant = await callConnection.addParticipant({
            targetParticipant: { phoneNumber: config.line1 },
            sourceDisplayName: "Caller",
            sourceCallerIdNumber: { phoneNumber: '+xxxxxxxxx' } // 我的Azure号码
      });
      console.log('Participant ', participant);

错误信息

Connected 09004a80-1807-4ac9-941e-c7f1da0f0ecf
RestError: 呼叫或添加PSTN号码时,必须指定SourceCallerIdNumber或TeamsAppSource。
at new RestError (C:\Users\Amigo\Desktop\Shan Potts\call-record\node_modules@azure\core-rest-pipeline\dist\commonjs\restError.js:19:16)
at handleErrorResponse (C:\Users\Amigo\Desktop\Shan Potts\call-record\node_modules@azure\core-client\dist\commonjs\deserializationPolicy.js:148:19)
at deserializeResponseBody (C:\Users\Amigo\Desktop\Shan Potts\call-record\node_modules@azure\core-client\dist\commonjs\deserializationPolicy.js:83:45)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

排查与解决建议

  • 检查参数结构匹配性:部分ACS SDK版本中,sourceCallerIdNumber可能需要直接传入字符串格式的电话号码,而非嵌套对象。尝试修改为:
    sourceCallerIdNumber: '+xxxxxxxxx'
    
  • 验证号码有效性:确认填入的电话号码是已在ACS资源中购买并验证的PSTN号码,且未被其他会话占用。
  • 核对SDK版本:使用较新版本的@azure/communication-calling或@azure/communication-call-automation SDK,旧版本可能存在参数解析的bug。
  • 检查权限配置:确保ACS资源的服务主体拥有CommunicationCallParticipant.Add权限,且号码所在的资源与当前调用的ACS客户端属于同一订阅。

内容的提问来源于stack exchange,提问作者Carter

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.13 00:06:00