如何在iOS上为Twilio TVOCallInvite设置自定义参数?

我正在尝试在通话邀请结构中传递自定义参数,但不会在接收方接收到它们。

let connectOptions: TVOConnectOptions = TVOConnectOptions(accessToken: token) { (builder) in
    builder.params = ["To": "Recipeint Id","From": "Caller name"]
    builder.uuid = uuid
}

self.call = TwilioVoice.connect(with: connectOptions,delegate: self)

有什么想法吗?

ningruohai1 回答:如何在iOS上为Twilio TVOCallInvite设置自定义参数?

您需要在后端添加逻辑,也可以说相同的服务器代码。

在节点中链接服务器代码 https://github.com/twilio/voice-quickstart-server-node

需要修改以下功能

function makeCall(request,response) {

  // The recipient of the call,a phone number or a client

  var to = null;

  if (request.method == 'POST') {

    to = request.body.to;
    callerId = request.body.from; //--> new added line for caller name
  } else {

    to = request.query.to;
    callerId = request.body.from; //--> new added line for caller name
  }




  const voiceResponse = new VoiceResponse();




  if (!to) {

      voiceResponse.say("Congratulations! You have made your first call! Good bye.");

  } else if (isNumber(to)) {

      const dial = voiceResponse.dial({callerId : callerNumber});

      dial.number(to);

  } else {

      const dial = voiceResponse.dial({callerId : callerId});

      dial.client(to);

  }

  console.log('Response:' + voiceResponse.toString());

  return response.send(voiceResponse.toString());

}

对于callerId变量,还需要使用make var而不是const,并且如果要传递调用者名称,则节点代码格式应将值保存为这种格式

'client:callername'

client:,并从iOS应用程序

传递该值之后 ,

实际上放弃了这个主意...紧跟instruction,以便该应用报告对CallKit的呼叫,然后在此之后更新呼叫者名称。

本文链接:https://www.f2er.com/3154790.html

大家都在问