简体   繁体   English

如何在node.js-socketstream框架中使用tropo?

[英]How to use tropo with node.js-socketstream framework?

In my application im using node.js with socketstream framework.Now i need to use tropo module to send an sms,receive an sms,make a call and answering an incoming call.I installed tropo-webapi using npm.i added this node code in server side.While running the below code i didn't get any output.i dont know how to link this file in tropo website and how to receive the sms and phone call. 在我的应用程序中,我将node.js与socketstream框架一起使用。现在我需要使用tropo模块发送短信,接收短信,拨打电话并接听来电。我使用npm.i安装了tropo-webapi,我添加了此节点代码在服务器端。虽然运行以下代码,但我没有任何输出。我不知道如何在tropo网站中链接此文件,以及如何接收短信和电话。

  exports.actions = function(req, res, ss) {
  return{

sendMessage:function(){

    var tropoAPI = require('tropo-webapi');
    var tropo = new tropoAPI.TropoWebAPI(); 
  tropo.call("+18197924547", null, null, null, null, null, "SMS", null,  null,null);
        tropo.say("HI How Are You!!");

    },
makeCall:function(){

      var tropoAPI = require('tropo-webapi');
      var tropo = new tropoAPI.TropoWebAPI(); 
      tropo.call("+18197924547");
      tropo.say("Hi,how ary yoo!");

    }


};


     };

So you did not specify from which file is this snippet from but I got the feeling, it is from one under server/rpc/<yourfilename> where the Remote Procedure Calls are. 因此,您没有指定此摘录来自哪个文件,但我有感觉,它来自“远程过程调用”所在的server/rpc/<yourfilename>下的文件。
!!! !!! NOTE THE <yourfilename> 注意<yourfilename>

The methods which you define are generated for the client in a way that he can trigger it trough the socket interfaces, let me write a snippet, I think you will understand: 您定义的方法是为客户端生成的,他可以通过套接字接口触发它,让我写一个代码段,我想您会理解的:
- lets write into this file => client/code/app/app.js -让我们写入此文件=> client/code/app/app.js

ss.rpc('<yourfilename>.sendMessage','here comes params which is now a string');

To get a sense what this ss object is look into your client/code/app/entry.js you will see it. 为了了解这个ss对象是什么,您可以在client/code/app/entry.js看到它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM