在我的应用程序中,我想让用户 A 拨打一个 twilio 号码,然后让用户 B 接听来自 twilio 号码的电话并让两个用户通话。
当按下呼叫按钮时,将呼叫 twilio 号码。
然后执行 /hello 函数。
Xcode
NSString *callString = [NSString stringWithFormat:@"telprompt://TwilioNumber"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:callString]];
我用 twilio 号码代替了“twilionumber”,并硬编码了一个号码代替了“ToCallNumber”。
Parse.com 云代码
////TWILIO
app.get('/hello', function(request, response) {
var twiml = new twilio.TwimlResponse('');
twiml.dial({callerId:'twilionumber'}, 'ToCallNumber'); //working
response.type('text/xml');
response.send(twiml.toString(''));
});
app.listen();
到目前为止没有问题。我想要的是根据谁拨打电话来更改 ToCallNumber。我已经在 Parse Datatable 中链接了用户。我需要在 /hello 函数中获取呼叫者的电话号码才能呼叫正确的用户。
在控制台中,我看到来电者的电话号码。
Input: {"method"=>"GET", "url"=>"/hello?AccountSid=....... From=%2B"CAllersPhonenumber"&.....
我尝试通过像 request.params.From、From、twiml.From、twiml.params.From 和其他可能超过两个小时的操作来获取 From 参数。有人能解释一下如何从价值中获得吗?