Create Route on Asterisk

We recently changed our IAX Terminator on our asterisk box.

The old one, required us to dial 011 + Country Code + City Code + Telephone number, no matter what country i dialed.

The new one, it is the same thing, BUT to call USA and CANADA, i dont need to dial 011, i just have to dial 1-xxx-xxx-xxxx, i dont want to over the training of 550 users, to explain them that only for USA they dont have to dial 011-1-305-xxx-xxxx...

So i need to create what i think it is called a route, that when my users dial                            011-1-XXX-XXX-XXXX, asterisk will only dial 1-XXX-XXX-XXXX

But when they dial like to UK, country code 44, would it be 011-44-xxx-xxxx, asterisk will dial 011-44-xxx-xxxx and not 44-xxx-xxxx....

It is very easy, but as i need it very quickly, im giving out 500 points.

Thanks you all
Who is Participating?
nasirbestConnect With a Mentor Commented:
locate your existing code in /etc/asterisk/extensions.conf which is responsible to dial number on trunk.
I assume you have something like following in your extensions.conf

exten => _011XXXX,1,Dial(IAX2/user@oldtrunk/${EXTEN})

In this case you have to add one addition line for USA like

exten => _0111XXXX,1,Dial(IAX2/user@newtrunk/${EXTEN}:4)  ; <-- add this line
exten => _011XXXX,1,Dial(IAX2/user@newtrunk/${EXTEN})

please note ${EXTEN:4} we have to delete first 4 characters from dialled number, just before dialing this number on new trunk
manolocruzAuthor Commented:
i was thinking on something like exten => 0111XXXXXXXXXX,1,Macro(outgoing-sip,,${EXTEN:4},operadora${CALLERID(num)})

Anyone think this will work?
manolocruzAuthor Commented:
would not the right be to use exten => _0111XXXX,1,Dial(IAX2/user@newtrunk/${EXTEN}:3) using EXTEN:3 instead 4, i have to remove the 3 first digits? wich in this case are 011?
The new generation of project management tools

With’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

remember 011 = internation dial prefix  1  = USA / Canada dial code XXXXX = number

if you think that your trunk have no issue with 1XXXXXX then you can do it!
manolocruzAuthor Commented:
right now my context is:
exten => _1NXXNXXXXXX,1,Dial(IAX2/USER@voipms/${EXTEN}) ; calls to usa and canada
exten => _1NXXNXXXXXX,n,Hangup() ; what does this line do?
exten => _01155.,1,Hangup() ; to hangup calls to Brazil
exten => _011.,2,Dial(IAX2/USER@voipms/${EXTEN}) ; to call international numbers
exten => _011.,n,Hangup() ; What does this line do?
exten => _00.,1,Dial(IAX2/USER@voipms/${EXTEN}) ; international calls
exten => _00.,n,Hangup() ; ????

Where to put the line : exten => _0111XXXX,1,Dial(IAX2/user@voipms/${EXTEN}:4)
manolocruzAuthor Commented:
one last thing, the :3 must be after the } or before?

exten => _0111XXXX,1,Dial(IAX2/user@newtrunk/${EXTEN}:4) this way ?

exten => _0111XXXX,1,Dial(IAX2/user@newtrunk/${EXTEN:4}) or this way?
manolocruzAuthor Commented:
the right line was...

exten => _0111XXXXXXXXXX,1,Dial(IAX2/USER@voipms/${EXTEN:3})
add following two lines just after [from-internal]

exten => _0111NXXNXXXXXX,1,Dial(IAX2/USER@voipms/${EXTEN:4})
exten => _0111NXXNXXXXXX,n,Hangup()

before }
All Courses

From novice to tech pro — start learning today.