【问题标题】:Fetching caller location (city/country) from historical Twilio call logs从历史 Twilio 通话记录中获取来电者位置(城市/国家)
【发布时间】:2018-09-16 22:44:45
【问题描述】:

我目前收到来自每个 Twilio 号码的数据,其中包含如下信息:

{
  "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",
}

这是在每次调用我的服务器结束时提供的。但是我需要获取历史数据来核对一些丢失的信息,所以我尝试使用调用日志 api 作为:

  const calls = await twilio.calls.list()

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

CallInstance {
  accountSid: 'xxxxxxxxxx',
  annotation: null,
  answeredBy: null,
  apiVersion: '2010-04-01',
  callerName: null,
  dateCreated: 2018-08-29T17:20:51.000Z,
  dateUpdated: 2018-08-29T17:21:52.000Z,
  direction: 'inbound',
  duration: '61',
  endTime: 2018-08-29T17:21:52.000Z,
  forwardedFrom: '+xxxxxxxxxx',
  from: '+xxxxxxxxxx',
  fromFormatted: 'xxxxxxxxxx,
  groupSid: null,
  parentCallSid: null,
  phoneNumberSid: 'xxxxxxxxxx',
  price: -0.017,
  priceUnit: 'USD',
  sid: 'xxxxxxxxxx',
  startTime: 2018-08-29T17:20:51.000Z,
  status: 'completed',
  subresourceUris:
   { notifications:
      '/2010-04-01/Accounts/xxxxxxxxxx/Calls/xxxxxxxxxx/Notifications.json',
     recordings:
      '/2010-04-01/Accounts/xxxxxxxxxx/Calls/xxxxxxxxxx/Recordings.json' },
  to: '+17603137608',
  toFormatted: '(760) 313-7608',
  uri:
   '/2010-04-01/Accounts/xxxxxxxxxx/Calls/xxxxxxxxxx.json'
}

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

【问题讨论】:

    标签: twilio


    【解决方案1】:

    因此,在深入研究之后,这似乎是不可能的。我最终使用 Google 手机库之类的工具来分析号码并返回国家/地区。

    【讨论】:

      猜你喜欢
      • 2016-07-16
      • 1970-01-01
      • 2018-11-07
      • 2017-04-09
      • 2010-11-27
      • 1970-01-01
      • 1970-01-01
      • 2013-01-12
      • 2013-02-08
      相关资源
      最近更新 更多