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
manolocruzAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

manolocruzAuthor Commented:
i was thinking on something like exten => 0111XXXXXXXXXX,1,Macro(outgoing-sip,,${EXTEN:4},operadora${CALLERID(num)})

Anyone think this will work?
0
nasirbestCommented:
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
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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?
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

nasirbestCommented:
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!
0
manolocruzAuthor Commented:
right now my context is:
[from-internal]
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)
0
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?
0
manolocruzAuthor Commented:
the right line was...

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

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

before }
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
IP Telephony

From novice to tech pro — start learning today.