twilio / twilio-node

Node.js helper library
MIT License
1.39k stars 509 forks source link

Missing ForwardedFrom attribute #948

Closed justsomeofl closed 4 months ago

justsomeofl commented 1 year ago

I did set up a webhook on a french phone number (+33). Then I made a call to another phone number that is forwarding to the webhook phone number. But the ForwardedFrom attribute is missing. Is it the expected behavior?

AsabuHere commented 1 year ago

HI @justsomeofl, Thank you for the heads up! Can you please share more details on this issue? What were the other fields returned as part of the response? Can you share the code snippet used for this, after removing custom details?

justsomeofl commented 1 year ago

Hi @AsabuHere,

here are the other fields:

{
  AccountSid: 'AXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
  ApiVersion: '2010-04-01',
  CallSid: 'CXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
  CallStatus: 'ringing',
  Called: '+331XXXXXXXX',
  CalledCity: '',
  CalledCountry: 'FR',
  CalledState: '',
  CalledZip: '',
  Caller: '+337XXXXXXXX',
  CallerCity: '',
  CallerCountry: 'FR',
  CallerState: '',
  CallerZip: '',
  Direction: 'inbound',
  From: '+337XXXXXXXX',
  FromCity: '',
  FromCountry: 'FR',
  FromState: '',
  FromZip: '',
  To: '+331XXXXXXXX',
  ToCity: '',
  ToCountry: 'FR',
  ToState: '',
  ToZip: ''
}
const call = await client.calls(request.body.CallSid)
        .fetch();

console.log("ForwardedFrom", request.body.CallSid, request.body.ForwardedFrom, call?.forwarded_from); 
//ForwardedFrom CXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX undefined undefined

Thanks

AsabuHere commented 1 year ago

Can you try accessing the attribute from call like this client.calls .create({ url: 'http://demo.twilio.com/docs/voice.xml', to: '+1XXXXXXXXX', from: '+1XXXXXXXXX' }) .then(call => console.log(call.forwardedFrom)); I can access the value like this in the latest version of twilio-node

justsomeofl commented 1 year ago

I am able to access it with the way you mentionned. But when i catch a real call redirected to a webhook, this attribute is missing. Maybe this value is filled only for twilio created calls ?

tiwarishubham635 commented 5 months ago

Hi @justsomeofl! I rechecked it again and I am able to get the forwardedFrom field in the response of fetch. In my case it is not showing undefined. Can you recheck again? I will list my steps here:

  1. I followed this documentation
  2. I created a call resource using this
  3. Then I fetched the call using this
  4. The response had forwardedFrom field as expected. It was set to null in my case.

Please let me know if we are doing something differently. Thanks!

tiwarishubham635 commented 4 months ago

Closing this as no response received