Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e164 Mustache filter transforms UK phone number into US phone number #11

Open
eric-brechemier opened this issue Mar 15, 2022 · 4 comments

Comments

@eric-brechemier
Copy link
Owner

eric-brechemier commented Mar 15, 2022

I configured a new UK mobile phone number today, which failed to make calls due to an invalid caller id.

I am using the generic TwiML Bin from the guide, which extracts the phone number from the SIP Domain:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Dial callerId="{{#e164}}{{SipDomain}}{{/e164}}">{{#e164}}{{To}}{{/e164}}</Dial>
</Response>

The e164 Mustache filter used to extract my own phone number from the SIP Domain no longer works with that UK phone number. The caller id is reported as invalid.

I reproduced the issue using a fake UK phone number, which I included in the example below:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Dial callerId="{{#e164}}44-7355-547122.sip.twilio.com{{/e164}}">{{#e164}}{{To}}{{/e164}}</Dial>
</Response>

The error log shows the resulting value, which is quite unexpectedly a US Phone number:

invalidCallerId: "+17355547122"

I have also tried prefixing the value with a +

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Dial callerId="{{#e164}}+44-7355-547122.sip.twilio.com{{/e164}}">{{#e164}}{{To}}{{/e164}}</Dial>
</Response>

which makes no difference:

invalidCallerId: "+17355547122"
@eric-brechemier
Copy link
Owner Author

Calling the same UK phone number results in a correct conversion, however, in the {{To}} number.

The number is received by Twilio as:

To: "sip:+447355547122@44-7360-271984.sip.us1.twilio.com"

and correctly transformed to:

+447355547122

@eric-brechemier
Copy link
Owner Author

Let's try different values:

{{#e164}}+447355547122{{/e164}} -> +447355547122
{{#e164}}+44-7355547122{{/e164}} -> +447355547122
{{#e164}}447355547122{{/e164}} -> +447355547122

{{#e164}}44-7355-547122{{/e164}} -> +17355547122
{{#e164}}+44-7355-547122{{/e164}} -> +17355547122
{{#e164}}+44-7-355547122{{/e164}} -> +17355547122

{{#e164}}0044-7355-547122{{/e164}} -> 0044-7355-547122

@eric-brechemier
Copy link
Owner Author

eric-brechemier commented Mar 15, 2022

The {{#e164}} filter results in different phone numbers depending on the presence and the position of the dashes which separate groups of digits in the phone number.

@eric-brechemier
Copy link
Owner Author

eric-brechemier commented Mar 15, 2022

I have reported this issue to Twilio for their consideration.

As a workaround, I now recommend, for the configuration of any new phone number, to remove all dashes from the phone number value used as unique SIP domain.

There is no point in changing the configuration of existing phone numbers. If your number works correctly and you can make calls from your SIP phone to regular phone numbers, it means that your SIP domain name is not affected by the unexpected conversion to a different international country code when getting through the e164 Mustache filter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant