Twilio 可编程语音自定义参数问题
Twilio Programmable Voice Custom Params Issue
我们无法接收来电方发送的客户参数。
这是我们发送的方式
func performVoiceCall(uuid: UUID, client: String?, completionHandler: @escaping (Bool) ->
Void) {
let connectOptions = ConnectOptions(accessToken: accessToken) { builder in
builder.params = [twimlParamTo: self.callToUserId, "displayName": "zeshan"]
builder.uuid = uuid
}
let call = TwilioVoiceSDK.connect(options: connectOptions, delegate: self)
activeCall = call
activeCalls[call.uuid!.uuidString] = call
callKitCompletionCallback = completionHandler
}
这里是我们如何接收但在呼叫接收端无法获取任何客户参数
func callInviteReceived(callInvite: CallInvite) {
NSLog("callInviteReceived:")
UserDefaults.standard.set(Date(), forKey: kCachedBindingDate)
let callerInfo: TVOCallerInfo = callInvite.callerInfo
if let verified: NSNumber = callerInfo.verified {
if verified.boolValue {
NSLog("Call invite received from verified caller number!")
}
}
let from = (callInvite.from ?? "Voice Bot").replacingOccurrences(of: "client:", with: "")
let customParam = callInvite.customParameters?["displayName"]
// Always report to CallKit
reportIncomingCall(from: from, uuid: callInvite.uuid)
activeCallInvites[callInvite.uuid.uuidString] = callInvite
}
customParam 收到 null
请指教
这里是 Twilio 开发人员布道者。
当您通过 Twilio Voice SDK connect
方法设置参数时,会将参数发送到您的 TwiML 应用程序的 webhook。
为了发送这些参数以便 Twilio Voice SDK 客户端可以读取来电,您需要使用嵌套在 <Client>
中的 the <Parameter>
TwiML element 再次设置它们元素。例如:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial>
<Client>
<Identity>user-jane</Identity>
<Parameter name="displayName" value="zeshan"/>
</Client>
</Dial>
</Response>
我们无法接收来电方发送的客户参数。 这是我们发送的方式
func performVoiceCall(uuid: UUID, client: String?, completionHandler: @escaping (Bool) ->
Void) {
let connectOptions = ConnectOptions(accessToken: accessToken) { builder in
builder.params = [twimlParamTo: self.callToUserId, "displayName": "zeshan"]
builder.uuid = uuid
}
let call = TwilioVoiceSDK.connect(options: connectOptions, delegate: self)
activeCall = call
activeCalls[call.uuid!.uuidString] = call
callKitCompletionCallback = completionHandler
}
这里是我们如何接收但在呼叫接收端无法获取任何客户参数
func callInviteReceived(callInvite: CallInvite) {
NSLog("callInviteReceived:")
UserDefaults.standard.set(Date(), forKey: kCachedBindingDate)
let callerInfo: TVOCallerInfo = callInvite.callerInfo
if let verified: NSNumber = callerInfo.verified {
if verified.boolValue {
NSLog("Call invite received from verified caller number!")
}
}
let from = (callInvite.from ?? "Voice Bot").replacingOccurrences(of: "client:", with: "")
let customParam = callInvite.customParameters?["displayName"]
// Always report to CallKit
reportIncomingCall(from: from, uuid: callInvite.uuid)
activeCallInvites[callInvite.uuid.uuidString] = callInvite
}
customParam 收到 null 请指教
这里是 Twilio 开发人员布道者。
当您通过 Twilio Voice SDK connect
方法设置参数时,会将参数发送到您的 TwiML 应用程序的 webhook。
为了发送这些参数以便 Twilio Voice SDK 客户端可以读取来电,您需要使用嵌套在 <Client>
中的 the <Parameter>
TwiML element 再次设置它们元素。例如:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial>
<Client>
<Identity>user-jane</Identity>
<Parameter name="displayName" value="zeshan"/>
</Client>
</Dial>
</Response>