# Forcing E.164 formatting

**URL:** <https://community.freepbx.org/t/forcing-e-164-formatting/27040>\
**Category:** General Help\
**Created:** [January 31, 2015, 9:37pm UTC](https://community.freepbx.org/t/forcing-e-164-formatting/27040 "2015-01-31T21:37:20Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![CocoBellaDolls](https://community.freepbx.org/letter_avatar_proxy/v4/letter/c/7ab992/32.png) [@CocoBellaDolls](https://community.freepbx.org/u/CocoBellaDolls)\
**Post date:** [January 31, 2015, 9:37pm UTC](https://community.freepbx.org/t/forcing-e-164-formatting/27040/1 "2015-01-31T21:37:20Z")

</div>

I finally got everything connecting with the following dial plan.

```
[through-twilio]
; Call PSTN numbers through Twilio (any 10, 11 digit or E.164 formatted number)
exten => _!NXXNXXXXXX,1,NoOp(Dialing out from ${CALLERID(all)} to ${EXTEN} with DID ${DID})
exten => _!NXXNXXXXXX,n,Dial(SIP/TwilioProvider/${EXTEN},60)
exten => _!NXXNXXXXXX,n,Playtones(congestion)
exten => _!NXXNXXXXXX,n,Hangup()
; End of the "through-twilio" context

```

My question is if there is a way to append a + in front of the number. I tried:

```
exten => _!NXXNXXXXXX,n,Set(${EXTEN}="+"&${EXTEN})

```

On the line before making the call but I still see

```
[2015-01-31 21:31:32] VERBOSE[18210][C-00000002] pbx.c: -- Executing [s@macro-dialout-trunk:22] `Dial("SIP/818-00000003", "SIP/TwilioProvider/12404861200,300,") in new stack`

```

in the logs. I add 1 to all 10 Digit numbers but it doesn’t connect to Twilio unless the + is also there.

---

<div class="post-metadata">

**Author:** ![dicko](https://community.freepbx.org/user_avatar/community.freepbx.org/dicko/32/8712_2.png) [@dicko](https://community.freepbx.org/u/dicko)\
**Post date:** [January 31, 2015, 9:43pm UTC](https://community.freepbx.org/t/forcing-e-164-formatting/27040/2 "2015-01-31T21:43:30Z")

</div>

${EXTEN} is immutable, use a goto

---

<div class="post-metadata">

**Author:** ![CocoBellaDolls](https://community.freepbx.org/letter_avatar_proxy/v4/letter/c/7ab992/32.png) [@CocoBellaDolls](https://community.freepbx.org/u/CocoBellaDolls)\
**Post date:** [January 31, 2015, 9:49pm UTC](https://community.freepbx.org/t/forcing-e-164-formatting/27040/3 "2015-01-31T21:49:31Z")

</div>

How would a goto affect the value passed, I’m trying to dial +${Exten} not just skip the line, could you please clarify?

---

<div class="post-metadata">

**Author:** ![dicko](https://community.freepbx.org/user_avatar/community.freepbx.org/dicko/32/8712_2.png) [@dicko](https://community.freepbx.org/u/dicko)\
**Post date:** [January 31, 2015, 10:43pm UTC](https://community.freepbx.org/t/forcing-e-164-formatting/27040/4 "2015-01-31T22:43:34Z")

</div>

Did you try adding + to your twilio trunks “Outbound Dial Prefix” ?

---

<div class="post-metadata">

**Author:** ![CocoBellaDolls](https://community.freepbx.org/letter_avatar_proxy/v4/letter/c/7ab992/32.png) [@CocoBellaDolls](https://community.freepbx.org/u/CocoBellaDolls)\
**Post date:** [February 1, 2015, 12:24am UTC](https://community.freepbx.org/t/forcing-e-164-formatting/27040/5 "2015-02-01T00:24:04Z")

</div>

That worked.

THANK YOU!!!  
THANK YOU!!!  
THANK YOU!!!  
THANK YOU!!!

I’d tried that previously when I was having other issues but after I started connecting I didn’t think to try it again.

---

<div class="post-metadata">

**Author:** ![CocoBellaDolls](https://community.freepbx.org/letter_avatar_proxy/v4/letter/c/7ab992/32.png) [@CocoBellaDolls](https://community.freepbx.org/u/CocoBellaDolls)\
**Post date:** [February 1, 2015, 12:32am UTC](https://community.freepbx.org/t/forcing-e-164-formatting/27040/6 "2015-02-01T00:32:53Z")

</div>

So at this point I can connect but I can’t get audio. The phones are just connecting and then silence. Do you know where I should look first to deal with this issue?

---

<div class="post-metadata">

**Author:** ![dicko](https://community.freepbx.org/user_avatar/community.freepbx.org/dicko/32/8712_2.png) [@dicko](https://community.freepbx.org/u/dicko)\
**Post date:** [February 1, 2015, 12:41am UTC](https://community.freepbx.org/t/forcing-e-164-formatting/27040/7 "2015-02-01T00:41:48Z")

</div>

That is almost always a mis-configuration of your router(s)/NAT settings not correctly forwarding, without port translation, the rtp packets for the SDP session generated by the SIP invite, In asterisk CLI

sip set debug on  
rtp set debug on

to explore

---

<div class="post-metadata">

**Author:** ![mbike2000ru](https://community.freepbx.org/letter_avatar_proxy/v4/letter/m/ce7236/32.png) [@mbike2000ru](https://community.freepbx.org/u/mbike2000ru)\
**Post date:** [October 7, 2016, 4:02am UTC](https://community.freepbx.org/t/forcing-e-164-formatting/27040/8 "2016-10-07T04:02:20Z")

</div>

Hello

When I add + in the “Outbound Dial Prefix”  
“1” is added in the beginning of the line:  
“SIP/magic/1+4803311777,300,T”)

Is it possible to remove “1” in the beginning?

---

<div class="post-metadata">

**Author:** ![mbike2000ru](https://community.freepbx.org/letter_avatar_proxy/v4/letter/m/ce7236/32.png) [@mbike2000ru](https://community.freepbx.org/u/mbike2000ru)\
**Post date:** [October 7, 2016, 4:05am UTC](https://community.freepbx.org/t/forcing-e-164-formatting/27040/9 "2016-10-07T04:05:00Z")

</div>

SIP/magic/1+14803311777,300,T")

---

<div class="post-metadata">

**Author:** ![dicko](https://community.freepbx.org/user_avatar/community.freepbx.org/dicko/32/8712_2.png) [@dicko](https://community.freepbx.org/u/dicko)\
**Post date:** [October 7, 2016, 4:07am UTC](https://community.freepbx.org/t/forcing-e-164-formatting/27040/10 "2016-10-07T04:07:18Z")

</div>

Is your magic Trunk setting adding the 1 ?

---

<div class="post-metadata">

**Author:** ![mbike2000ru](https://community.freepbx.org/letter_avatar_proxy/v4/letter/m/ce7236/32.png) [@mbike2000ru](https://community.freepbx.org/u/mbike2000ru)\
**Post date:** [October 7, 2016, 4:10am UTC](https://community.freepbx.org/t/forcing-e-164-formatting/27040/11 "2016-10-07T04:10:52Z")

</div>

here is - what is in the trunk dial settings:  
1 in prefix(it is removed) and X. - in matching part

---

<div class="post-metadata">

**Author:** ![dicko](https://community.freepbx.org/user_avatar/community.freepbx.org/dicko/32/8712_2.png) [@dicko](https://community.freepbx.org/u/dicko)\
**Post date:** [October 7, 2016, 4:14am UTC](https://community.freepbx.org/t/forcing-e-164-formatting/27040/12 "2016-10-07T04:14:55Z")

</div>

X. will not match +1. if that is what you have in your outbound route, look at the “hover over” help

---

<div class="post-metadata">

**Author:** ![mbike2000ru](https://community.freepbx.org/letter_avatar_proxy/v4/letter/m/ce7236/32.png) [@mbike2000ru](https://community.freepbx.org/u/mbike2000ru)\
**Post date:** [October 7, 2016, 4:17am UTC](https://community.freepbx.org/t/forcing-e-164-formatting/27040/13 "2016-10-07T04:17:27Z")

</div>

outbound route:  
1 to prepend  
NXXNXXXXXX - in the matching part

It seems that “1” in the beginning is predefined somewhere

---

<div class="post-metadata">

**Author:** ![dicko](https://community.freepbx.org/user_avatar/community.freepbx.org/dicko/32/8712_2.png) [@dicko](https://community.freepbx.org/u/dicko)\
**Post date:** [October 7, 2016, 4:19am UTC](https://community.freepbx.org/t/forcing-e-164-formatting/27040/14 "2016-10-07T04:19:28Z")

</div>

Only by you 😉 the +1 belongs in your trunk if needed, NOT your outbound route, it all depends on how your VSP’s need to see your dialing, by no means is there a “standard”

---

<div class="post-metadata">

**Author:** ![mbike2000ru](https://community.freepbx.org/letter_avatar_proxy/v4/letter/m/ce7236/32.png) [@mbike2000ru](https://community.freepbx.org/u/mbike2000ru)\
**Post date:** [October 7, 2016, 4:23am UTC](https://community.freepbx.org/t/forcing-e-164-formatting/27040/15 "2016-10-07T04:23:00Z")

</div>

I do not have “1+” setting in the "Outbound Dial Prefix"  
I have “+” but it adds “1+”

---

<div class="post-metadata">

**Author:** ![mbike2000ru](https://community.freepbx.org/letter_avatar_proxy/v4/letter/m/ce7236/32.png) [@mbike2000ru](https://community.freepbx.org/u/mbike2000ru)\
**Post date:** [October 7, 2016, 4:25am UTC](https://community.freepbx.org/t/forcing-e-164-formatting/27040/16 "2016-10-07T04:25:08Z")

</div>

ISP requires E.164

---

<div class="post-metadata">

**Author:** ![dicko](https://community.freepbx.org/user_avatar/community.freepbx.org/dicko/32/8712_2.png) [@dicko](https://community.freepbx.org/u/dicko)\
**Post date:** [October 7, 2016, 4:26am UTC](https://community.freepbx.org/t/forcing-e-164-formatting/27040/17 "2016-10-07T04:26:00Z")

</div>

Review your work and the Wiki, you are doing it wrong somewhere, probably in your “magic” trunk which “requires” e164 , so you need to do it there.

---

<div class="post-metadata">

**Author:** ![mbike2000ru](https://community.freepbx.org/letter_avatar_proxy/v4/letter/m/ce7236/32.png) [@mbike2000ru](https://community.freepbx.org/u/mbike2000ru)\
**Post date:** [October 7, 2016, 4:47am UTC](https://community.freepbx.org/t/forcing-e-164-formatting/27040/18 "2016-10-07T04:47:05Z")

</div>

I changed to twilio and used there guide for terminnation trunk

SIP/landteam/1+14803311777

that’s what I get

---

<div class="post-metadata">

**Author:** ![dicko](https://community.freepbx.org/user_avatar/community.freepbx.org/dicko/32/8712_2.png) [@dicko](https://community.freepbx.org/u/dicko)\
**Post date:** [October 7, 2016, 5:24am UTC](https://community.freepbx.org/t/forcing-e-164-formatting/27040/19 "2016-10-07T05:24:20Z")

</div>

Your still doing it wrong, you can manipulate the dialing in the trunk and the outbound route, Again, check your work .

---

<div class="post-metadata">

**Author:** ![mbike2000ru](https://community.freepbx.org/letter_avatar_proxy/v4/letter/m/ce7236/32.png) [@mbike2000ru](https://community.freepbx.org/u/mbike2000ru)\
**Post date:** [October 7, 2016, 5:29am UTC](https://community.freepbx.org/t/forcing-e-164-formatting/27040/20 "2016-10-07T05:29:08Z")

</div>

Twilio Trunk settings:  
I placed X. to “match pattern” and no prepend and no prefix  
Outbound Dial Prefix ="+"

In the trunk settings there is no adding “1+”

[Next page](https://community.freepbx.org/t/forcing-e-164-formatting/27040.md?page=2)
