Forcing E.164 formatting

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.

${EXTEN} is immutable, use a goto

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

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

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.

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?

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

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?

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

Is your magic Trunk setting adding the 1 ?

1 Like

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

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

1 Like

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

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

Only by you :wink: 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”

1 Like

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

ISP requires E.164

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.

1 Like

I changed to twilio and used there guide for terminnation trunk

SIP/landteam/1+14803311777

that’s what I get

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

1 Like

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+”