【发布时间】:2015-08-11 03:39:12
【问题描述】:
是否可以使用 Lambda 作为 Twilio 的后端?
我可以从 Lambda 呼叫 Twilio,但我需要从呼叫者那里获取信息,例如“按 1”。我可以做一个服务器,但我可以调用 Lambda 函数吗? (我知道我们不能调用 Lambda)。
这是我想做的一个例子。
exports.handler = function(event, context) {
resp.say('bienvenue ', {
voice:'alice',
language:'fr-FR'
});
resp.say('helloo', {
voice:'woman',
language:'fr-FR'
});
.gather({
method:"GET",
finishOnKey:'*',
action : 'serveur_backend',
timeout: "10"
}, function() {
this.say('presse 1 to **** ', {
voice:'alice',
language:'fr-FR'
});
var l = "<Response>"+S(resp.toString()).between('<Response>', '</Response>').s+"</Response>";
var URL = "http://twimlets.com/echo?Twiml="+encodeURIComponent(l);
console.log(URL);
client.calls.create({
url: URL,
to: "+**********",
from: "+*********"
// timeout: "10"
// callback
},
function(err, call) { console.log("appel lancé");
process.stdout.write(call.sid);
console.log(call.sid);
context.done(null, " have a nice day ");
});
【问题讨论】:
标签: amazon-web-services twilio aws-lambda