Route a provider's numbers to specific extensions - asterisk

We installed asterisk VOIP server in our company and published a VOIP service in a village.
We configured inbound routing based on an extension of 4 numbers (ex: 7002) and its working fine.
A Service Provider is gonna provide us with a range of phone numbers, and we want to route each of these numbers to a different extension, so that the users of our VOIP service can reach other (external) providers networks...how to do this??
This is the extensions part in the (sip.conf) file:
[7000]
type=friend
context=default
allow=gsm
secret=123
host=dynamic
[7001]
type=friend
context=default
allow=gsm
secret=123
host=dynamic
And this is the internal route in the (extension.conf) file:
exten => _XXXX,1,DIAL(SIP/${EXTEN},,L(${calltime},3000))
exten => _XXXX,2,NOOP()
exten => _XXXX,3,hangup()
Any help please??
Thank you.

sip.conf
...
[trunk-from-provider]
....
context = from-provider
....
extensions.conf
[from-provider]
exten = _12345[012],1,Dial(SIP/7000,30,Tt)
exten = _12345[345],1,Dial(SIP/7001,30,Tt)
...
This will route incoming numbers 123450, 123451, 123452 to 7000, 123453, 123454, 123455 to 7001, etc..

Related

Call not audible via flowroute with asterisk

I have configured asterisk with flowroute. The registration is successful and outbound call connects but i am unable to hear any sound. My configurations are as follow
sip.conf
[general]
register => username:password#sip.flowroute.com
allow=ulaw
sip-custom-contexts.conf
[flowroute] ; keep this lowercase, do not change format
type=friend
secret=username
username=password
host=sip.flowroute.com
type=peer
transport=udp
port=5060
dtmfmode=rfc2833
context=to-pstn ; change to 'ext-did' or 'from-trunk' for asterisk#home
canreinvite=no
allow=ulaw
;allow=g729 ;uncomment this line if you have G.729 licenses installed.
insecure=port,invite
fromdomain=sip.flowroute.com
keepalive=yes
qualify=no
progressinband=yes
rtp.conf
[general]
rtpstart=10000
rtpend=2000
Kindly guide in this regard
The problem is solved by changing codec. After changing
allow=ulaw
to
allow=all
The call was working fine, with audible voice.
Please check your nat and external ip settings.
https://www.voip-info.org/wiki/view/Asterisk+SIP+NAT+solutions
I'd like to suggest reaching out to Flowroute's support for help on this. And I'd like to second advice from lvl to get those SIP credentials removed for your own account security.

asterisk SIP User-to-User

I am trying to make a SIP transfer from one Asterisk to another with passing UUI.
On my asterisk 13 i have a simple dialplan:
exten => 2222,1,Answer
exten => 2222,n,Transfer(SIP/1111#asterisk14&User-to-User=342342ef34;encoding=hex)
exten => 2222,n,Hangup
I have registered SIP trunk between my asterisk 13 ans asterisk 1.4
register => asterisk13:welcome#10.254.2.115/asterisk14
[asterisk14]
type=friend
secret=welcome
context=asterisk14_incomming
host=dynamic
and done similar config on the second asterisk
Now I have error:
Purely numeric hostname (1111), and not a peer--rejecting!
I have read all I can find about this error but cant find how to resolve it.
thanks in advance for any suggestions
No way pass like that. Use SIPAddHeader

Asterisk: Connecting an Asterisk System To SIP Provider

Setup:
Centos 6
OS: Linux CentOS 64-Bit
CPU: Intel® Core™ i7 - 4 cores
Asterisk 11
libpri 1.4
dahdi 2.9.1
I want to send calls to my SIP provider via asterisk. I want to use a softphone to make outgoing calls, when I make outgoing calls on the softphone it needs to route through my asterisk server and then out to the SIP Provider. Currently when I make an outbound call it produces a "Failed to authenticate" and status is 'CONGESTION' notices.
My question is simple: Since my softphone is calling from "User1" (as shown below) What do I need to write in my sip.conf and extensions.conf files in order for the SIP provider to make the outgoing call for me?
My Thoughts:
I feel like I am missing a part of the process, like how User1 is set up to handle outgoing calls...
See an overview of how I set these two files up currently:
notes: - all username and passwords have been removed for this post. - sip.us is the sip provider
sip.conf:
[general]
transport=udp
register => username:password#gw1.sip.us
[myprovider]
type=peer
insecure=port,invite
host=gw1.sip.us
port=5060
dtmfmode=rfc2833
canrevinvite=no
disallow=all
allow=ulaw
qualify=yes
qualifyfreq=30
nat=force_rport,comedia
trustrpid=yes
fromdomain=gw1.sip.us
username=*****
secret=*****
context=from-trunk
rfc2833compensate=yes
session-timers=refuse
[friends_internal](!)
type=friend
host=dynamic
context=users
disallow=all
allow=ulaw
allow=alaw
[user1](friends_internal)
secret=****
[user2](friends_internal)
secret=****
now the extensions.conf:
...
...
exten=>_1NXXNXXXXXX,1,Dial(SIP/${EXTEN}#gw1.sip.us)
[users]
exten=>6001,1,Dial(SIP/user1,20)
exten=>6002,1,Dial(SIP/user2,20)
now the asterisk cli output when i try making an outgoing call using softphone:
== Using SIP RTP CoS mark 5
-- Executing [12015550155#users:1] Dial("SIP/user1-0000001e",
"SIP/12015550155#gw1.sip.us") in new stack
== Using SIP RTP CoS mark 5
-- Called SIP/12015550155#gw1.sip.us
[May 4 10:02:13] NOTICE[28935][C-0000002a]: chan_sip.c:23094
handle_response_invite: Failed to authenticate on INVITE to
'<sip:user1#501.62.174.2>;tag=as798e5009'
-- SIP/gw1.sip.us-0000001f is circuit-busy
== Everyone is busy/congested at this time (1:0/1/0)
-- Auto fallthrough, channel 'SIP/user1-0000001e' status is 'CONGESTION'
asterisk cli> sip show registery
Host dnsmgr Username Refresh State Reg.Time
gw1.sip.us:5060 N username 105 Registered Sun, 04 May 2014 10:28:05
1 SIP registrations.
asterisk cli> sip show peers
Name/username Host Dyn Forcerport Comedia ACL Port Status
user1/user1 68.198.. D Auto (No) No 55461 Unmonitored
user2/user2 68.198.. D Auto (No) No 55461 Unmonitored
myprovider/username 65.254.44.194 Yes Yes 5060 OK (42 ms)
Try changing the #gw1.sip.us to #myprovider and see if there's any changes. This will force asterisk to use the configured trunk [myprovider] instead of directly forward the call to gw.sip.us directly.
Hope this helps.
Your DialPlan is not correct clearly from your configuration files.
Аs a first step change your register string like:
register => username:password#gw1.sip.us\Myprovider
and then add the outgoing and incoming dialplan in your extensions.conf and include these dialplans into your users context. like:
e.g: you use 6XXX series to dial to the provider:
[outgoing]
exten => _6XXX,1,Dial(SIP/Myprovider/${EXTEN:0})
exten => _6XXX,2,Hangup
and for incoming calls
[incoming]
include = users ; this will go into your local context and dial your extensions
and in users context add outgoing context like
[users]
include = outgoing
I hope this will help you :)

Asterisk don't receive rtp message

I'm need to use SIP server.
My choice is 'Asterisk'
That's version is 1.8.0
I configured all of the asterisk.
and... i'm calling two users (0000FFFF0001,0000FFFF0002) using X-lite, Zoiper.
User Calling is not problem. It's fantastic.
But i can't hear nothing.
I just can calling other user, end the call.
My source is below.
sip.conf
[office-phone](!)
type=friend
host=dynamic
nat=yes
secret=pspsps
dtmfmode=auto
disallow=all
allow=alaw
allow=ulaw
qualify=yes
canreinvite=no
context=LocalSets
[0000FFFF0001](office-phone)
defaultip=223.33.184.3
[0000FFFF0002](office-phone)
externip=192.168.194.2
localnet=192.168.0.100/255.255.255.0
extensions.conf
[LocalSets]
exten => 100,1,Dial(SIP/0000FFFF0001)
exten => 101,1,Dial(SIP/0000FFFF0002)
exten => 200,1,Answer()
exten => 200,n,SayNumber(5)
exten => 200,n,Wait(1)
exten => 200,n,SayNumber(5)
exten => 200,n,Hangup()
I expected rtp problem.
I was opened TCP/UDP ports 20000~30000.
and my sharer NAT was configured.
help me. i need advise of you.
I believe you need to put your externip, localnet, and canreinvite in your general setting, Not in the sip peer itself.
Do you have the ports in rtp.conf natted to your server and allowed through your firewall?
I recommend you make two test extensions, Let's use 201 that answers and calls the MusicOnHold application, If you call that extension from your sip phone do you get audio?
Create Extension 202 that answers and calls the Echo Application, If you speak into your phone do you hear your voice Echo'd back to you?

How to transfer call using transfer application with H323

I am using the asterisks. I want to transfer call using transfer application with h323 protocols. But I am not able to transfer call.
In the extensions.conf file I have added the following content.
exten => 118,1,answer()
exten => 118,n,set(__TRANSFER_CONTEXT=transfer)
exten => 118,n,saynumber(567)
exten => 118,n,wait(1)
exten => 118,n,transfer(H323/119)
exten => 119,1,answer()
exten => 119,n,saynumber(222)
exten => 119,n,hangup()
For anyone with a similar issue, sometimes transfer will not be possible if there is a mismatch with channel technology.
If one wants to use Transfer application
Transfer([Tech/]dest[|options]):
You must ensure that if TECH (SIP, IAX2, LOCAL etc) is used, only
an incoming call with the same channel technology will be transferred. If the incoming channel is SIP but you want to transfer to IAX it won't allow that.
What you are trying to do can be achieved with Goto command. Transfer is used to transfer calls to real devices/users but if you want to stick with that you can try:
exten => 118,n,transfer(Local/119#your_context)
or simply
exten => 118,n,transfer(Local/119)

Resources