从历史记录的Twilio呼叫日志中获取呼叫者的位置(城市/国家)

时间:2018-09-16 22:44:46

标签: twilio

我目前每次通话都收到Twilio号码的数据,其中包含如下信息:

Function runs_test(avg As Double, setter As Range)
Option explicit

Dim i As Variant
Dim counter As Double
Dim er As Double


For Each i In setter

    er = (avg - i.Value) ^ 2
    counter = counter + er

Next i


total = setter.Cells.Count

er = counter / total
er = er ^ (1 / 2)

runs = er

End Function

这是在每次致电我的服务器时提供的。但是,我需要获取历史数据以协调一些丢失的信息,因此我尝试将调用日志api用作:

{
  "Called": "+xxxxxxxx",
  "ToState": "CA",
  "CallerCountry": "US",
  "Direction": "inbound",
  "Timestamp": "Sat, 25 Aug 2018 00:01:46 +0000",
  "CallbackSource": "call-progress-events",
  "CallerState": "CA",
  "ToZip": "92111",
  "SequenceNumber": "0",
  "To": "+1xxxxxx",
  "CallSid": "xxxxxxxxxxxxx",
  "ToCountry": "US",
  "CallerZip": "92117",
  "CalledZip": "92111",
  "ApiVersion": "2010-04-01",
  "CallStatus": "completed",
  "CalledCity": "SAN DIEGO",
  "Duration": "1",
  "From": "+1xxxxxxxxxx",
  "CallDuration": "10",
  "AccountSid": "xxxxxxxxxxxxx",
  "CalledCountry": "US",
  "CallerCity": "POWAY",
  "ToCity": "SAN DIEGO",
  "FromCountry": "US",
  "Caller": "+1xxxxxxxxxxx",
  "FromCity": "POWAY",
  "CalledState": "CA",
  "FromZip": "92117",
  "FromState": "CA",
}

这将返回不同类型的结构:

  const calls = await twilio.calls.list()

但是,它没有呼叫者的位置数据,例如城市/国家。是否还有另一个API调用来获取位置数据,还是我通过分析电话号码留给自己的设备使用?

1 个答案:

答案 0 :(得分:0)

所以潜入它似乎是不可能的。我最终使用了类似Google手机库的工具来分析电话号码并返回国家/地区。