将Twilio SIP调用到Google表并发送到SIP TRUNK FREEPBX
我们在Twilio中配置了电话号码,以使用sip中继线处理语音呼叫,该sip troung访问了我们办公室中的freepbx服务器。
我的目标是在完成时将所有调用都记录到Google表格。我试图设置两种方法:
- 使用以下方式配置Twilio号码:Webhook。将传入的呼叫指向Google Apps脚本Webhook URL,脚本记录呼叫,然后返回Twiml消息以将呼叫转发到我的手机。这可以将呼叫记录到Google Sheet,但是我们无法使用Office FreepBX电话系统接听电话,因为它配置了Webhook而不是SIP TRUNK(并转发到我的单元格,而不是由FreepBX服务器处理)。
这是Google Apps脚本代码:
function doGet(args) {
var spreadsheetID = 'xxxxxxxxxxxxxxxxxxxx';
// Create a date object for the current date and time.
var now = new Date();
now = Utilities.formatDate(now, 'America/Chicago', 'yyyy-MM-dd\'T\'HH:mm:ss');
//Incoming parameters from Twilio. Documentation here: https://www.twilio.com/docs/voice/twiml
var callStatus = args.parameter.CallStatus;
var callerName = args.parameter.CallerName;
var fromNumber = args.parameter.From;
var toNumber = args.parameter.To;
var callDirection = args.parameter.Direction;
SpreadsheetApp.openById(spreadsheetID).appendRow([now, callStatus, callerName, fromNumber, toNumber, callDirection]);
var text = ContentService.createTextOutput("<Response><Dial>+14055991234</Dial></Response>").setMimeType(ContentService.MimeType.XML);
return text;
}
同样,这会记录呼叫,但随后不会使用Twilio SIP TRUNK处理。
- Twilio“新通话”的Zapier触发事件。这为我提供了一个Webhook URL和以下说明:
“设置您的回调URL!登录到Twilio并访问您的传入号码页,编辑要触发的号码,然后将以下URL粘贴到呼叫状态更改中。单击“保存”! “
为了将Webhook URL放入Twilio的Call状态更改框中,必须使用Webhooks在Twilio中配置该数字,但是我们正在使用SIP TRUNK进行配置。 因此,我不知道如何使用我们的Twilio号码使用SIP中继,还可以使用Webhook进行呼叫状态更改,以便我可以将呼叫记录到Google Sheet
。
We configure our phone numbers in Twilio to handle Voice Calls with a SIP Trunk that goes to our FreePBX server in our office.
My goal is to log all calls to a Google Sheet when they are completed. I have tried to set this up two ways:
- Configure the Twilio number with: Webhook. Point the incoming call to a Google Apps Script webhook URL, the script logs the call, then return TwiML message to forward the call to my cell phone. This works to log the call to the Google Sheet, but then we cannot use our office FreePBX phone system to take the call since it is configured with Webhook rather than SIP Trunk (and forwarded to my cell rather than handled by the FreePBX server).
Here is that Google Apps Script code:
function doGet(args) {
var spreadsheetID = 'xxxxxxxxxxxxxxxxxxxx';
// Create a date object for the current date and time.
var now = new Date();
now = Utilities.formatDate(now, 'America/Chicago', 'yyyy-MM-dd\'T\'HH:mm:ss');
//Incoming parameters from Twilio. Documentation here: https://www.twilio.com/docs/voice/twiml
var callStatus = args.parameter.CallStatus;
var callerName = args.parameter.CallerName;
var fromNumber = args.parameter.From;
var toNumber = args.parameter.To;
var callDirection = args.parameter.Direction;
SpreadsheetApp.openById(spreadsheetID).appendRow([now, callStatus, callerName, fromNumber, toNumber, callDirection]);
var text = ContentService.createTextOutput("<Response><Dial>+14055991234</Dial></Response>").setMimeType(ContentService.MimeType.XML);
return text;
}
Again, this logs the call, but does not subsequently handle it with a Twilio SIP Trunk.
- A Zapier trigger event for Twilio "New Call". This provides me a Webhook URL and the following instructions:
"Set up your Callback URL! Log into Twilio and visit your incoming numbers page, edit the number you want to trigger on, and paste the below URL into Call Status Changes. Click save!"
In order to place the Webhook URL into the Call Status Changes box in Twilio, the number must be configured in Twilio with Webhooks, but we are configuring with SIP Trunk. So I don't know how to use a SIP Trunk with our Twilio numbers and also use a Webhook for the Call Status Changes so I can log the calls to a Google Sheet.
Any guidance is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用Elastic SIP中继设置设置的Twilio电话号码也不会触发Webhooks。
解决这一问题的一种方法可能是打开语音见解a href =“ https://www.twilio.com/docs/events” rel =“ nofollow noreferrer”> event streams to 触发webhook 。有各种不同的事件相信网关事件(由呼叫进度事件触发)将是聆听和反应的正确事件。
另外,您可以将一些内容添加到FreepBX安装中,以触发呼叫后的更新到Google Sheet。
Twilio Phone Numbers that are setup with Elastic SIP Trunking do not also trigger webhooks.
One way around this could be to turn on Voice Insights for your SIP trunk and use Event Streams to trigger a webhook. There are various different events available but I believe the gateway events (which are triggered by call progress events) would be the right ones to listen for and react on.
Alternatively, you could look to add something into your FreePBX installation that could trigger the update to the Google Sheet once your call is finished.