2

Is it possible to use Lambda as a backend for Twilio?

I can call Twilio fro Lambda, but I need to get information from the caller, such as "press 1". I could make a server, but can I invoke Lambda functions? (I know we can't invoke Lambda).

Here's an example of what I'd like to do.

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 ");
  });
4

1 回答 1

1

您可以将 API 网关用作触发 lambda 函数的 Twilio 的端点。看到这个:

http://docs.aws.amazon.com/apigateway/latest/developerguide/getting-started.html

于 2015-07-28T16:11:48.120 回答