twilio LAMBDA后端AWS [英] twilio Lambda backend aws

查看:140
本文介绍了twilio LAMBDA后端AWS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能使用LAMBDA作为后端Twilio?

我可以叫Twilio来回LAMBDA,但我需要从来电者信息,如preSS 1。我可以让一台服务器,但我可以调用lambda函数? (我知道我们不能援引拉姆达)。

下面是一个什么样我想做一个例子。

  exports.handler =函数(事件上下文){
  resp.say('bienvenue',{
    声音:爱丽丝,
    语言:FR-FR
  });
  resp.say('helloo',{
    声音:'女人',
    语言:FR-FR
  });
  。收集({
   方法:GET,
   finishOnKey:'*',
   动作:serveur_backend,
   超时:10
  }, 功能() {
   this.say('preSSE 1至****',{
   声音:爱丽丝,
   语言:FR-FR
  });

  VAR L =<响应>中+ S(resp.toString())之间。('<响应>','< /响应>')S +< /响应>中。
  VAR URL =htt​​p://twimlets.com/echo?Twiml="+en$c$cURIComponent(l);
  执行console.log(URL);
  client.calls.create({
    网址:网址,
    到:+ **********
    来自:+ *********
//超时:10
//    回电话
  },
  功能(ERR,调用){执行console.log(APPEL LANCE);
   process.stdout.write(call.sid);
    执行console.log(call.sid);
  context.done(NULL,有一个愉快的一天);
  });
 

解决方案

您可以使用API​​网关作为Twilio端点会触发你的lambda函数。看到这个:

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

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

解决方案

You can use the API Gateway as an endpoint for Twilio which triggers your lambda function. See this:

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

这篇关于twilio LAMBDA后端AWS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆