Route Call in Asterisk Server - asterisk

I have a scenario in which I want to route calls to sip a server from Asterisk but I want to do some thing like this
the sip server is running on : 192.168.1.10 and
Asterisk server is running on : 192.168.1.4
client Diales---->sip:111#192.168.1.4---->To Asterisk and then Asterisk route the calls------->sip:111#192.168.1.10 --------> sip server
Can someone tell me how can I do this in Asterisk configuration routing file .

As os11k said, you need SIP trunk to do this. I'll add some detail information about issues we encountered when we setup SIP trunk between two cities.
Add a SIP trunk in sip.conf
Make sure you put sendrpid=yes in the SIP trunk configuration, or, 192.168.1.10 will not get the caller id.
Optionally, you may want to set context of the SIP trunk to a different context rather than default, say context=sip-server-192-168-1-10.
Optionally, you may disallow or allow some codecs if 192.168.1.10 only works with specific codecs.
SIP trunk sample
[general]
register => SIP_ACCOUNT:SIP_PASSWORD#TheOtherSipServer
[TheOtherSipServer]
type=peer
context=sip-server-192-168-1-10
host=192.168.1.10
defaultuser=THE_ACCOUNT_HERE
fromuser=THE_ACCOUNT_HERE
remotesecret=THE_PASSWORD_OF_ACCOUNT_HERE
; if you want to send the remote caller id to 192.168.1.10, then set sendrpid=yes .
; you also need to trust the remote caller id in 192.168.1.10 .
sendrpid=yes
; if 192.168.1.10 can dial out from here, you need to set trustrpid=yes so you can get the caller id
;trustrpid=yes
; if 192.168.1.10 is picky on codecs
;disallow=all
;allow=THE_CODEC_NAME_ALLOWED_BY_THE_OTHER_SIP_SERVER
Setup dial plan in extensions.conf
Dial is all you needed unless you need special requirement.
Dialplan sample
[globals]
SIPTrunk=SIP/TheOtherSipServer
[sip-server-192-168-1-10]
;exten=>111,1,Dial(SIP/TheOtherSipServer/111)
exten=>111,1,Dial(${SIPTrunk}/${EXTEN})

You need to set-up sip trunk on your Asterisk server.
Check this page for more info:
https://www.beardy.se/how-to-set-up-a-sip-trunk-in-the-asterisk-pbx
http://www.voip-info.org/wiki/view/Asterisk+config+sip.conf

Related

Asterisk sip trunk peer NIC

I'm working with Asterisk 14.7.6 and Freepbx 14.0.13.23 in a ec2 instance on AWS
At this moment I have a sip trunk with 3CX server working, I need to make another one with the same one.
I have had an idea of add another NIC in the asterisk and add externip parameter in the sip.conf file to add anocher sip trunk and I did it. When I puted sip show peers in the asterisk console, it shows "Status OK (100 ms)" but in 3CX the traffic incoming was from the first trunk.
It's possible create this kind of sip trunk? or I need to launch another machine create a kind of bridge between my asterisk and 3CX?
Thanks,
Only way do that without starting second INSTANCE of asterisk is use chan_pjsip or combination of chan_pjsip+chan_sip.
For first variant you should do multiple endpoints entity. For second just put one channel on one ip, second on other ip.
You also can start more than one asterisk process on host by using
asterisk -C asterisk_config.conf

Asterisk sip.conf Configuartion for outbound calls

I'm sending outbound calls from asterisk server using sip account. I want to use separate IPs for voice an signaling for these outbound calls. Please guide if any idea regarding this, how should I configure it in sip.conf.
You can set the RTP / media address IP in the [general] section of your sip.conf:
[general]
; media address
media_address=10.10.5.2
; depending on your nat & situation you might need for signalling:
externaddr=10.10.5.1
localnet=192.168.1.0/255.255.255.0
Then you can confirm this by running:
ast*CLI> sip set debug on
And look for the media address in the SDP payload under c=.
Word to the wise: make sure you check your routing on your box too, e.g. route -n and make sure things are headed where you expect them to.

asterisk sip extension to receive sip call from anyone having my sip address

I need a sip extension to receive sip call from anyone who have my sip address.
e.g. if anyone calls 101#xyz.com then sip call should drop on 101 extension configured in a soft phone, where xyz.com can be considered as my asterisk server IP address.
Help me. I am new to asterisk server.
Please provide me a step wise step guide to achieve the goal.
I got success in setting up sip extension that work in local network now I want to set sip extension which capable to receive incoming sip call from anywhere.
Thanks in advance.
You have set in sip.conf in general section
allowguest=yes
context=strangers
After that you can define in extensions.conf context strangers which have determine where to calls.

Asterisk to Asterisk connection via sip details

I'm using Asterisk server as sip server.
When I use sip details on softphone or any sip client it work properly.
But when i try to connect other asterisk server to this sip server it failed to connect.
There is no any info about exact issue in your qeustion.
Check this article
http://www.voip-info.org/wiki/view/Asterisk+Connect+2+servers
Make sure the iptables are disabled on another side. You may try to use IAX2 as it requires very less configuration on firewall.
It is a question of how did you set up trunk to connect to another asterisk.
If you use same behaviour as your softphones - add register line to slave asterisk.
Or set up friend trunk to act without registration
Maybe a little late but I had to do something similar a few weeks ago.
sip.conf (Group1)
register=>group01:12345#10.0.2.2/group02
You are group 1 and the IP Address of the Asterisk Server of the remote site is 10.0.2.2
In you extensions.conf (Group1)
[group02]
exten => _2xxx,1,Answer()
exten => _2xxx,2,Dial(SIP/${EXTEN}#group02,60,r)
exten => _2xxx,3,Hangup()
Group 2 has to do the same thing vice versa
sip.conf (Group2)
register=>group02:12345#10.0.1.2/group01
extensions.conf (Group2)
[group01]
exten=>_1xxx,1,Answer()
exten=>_1xxx,2,Dial(SIP/${EXTEN}#group01,60,r)
exten=>_1xxx,3,Hangup()
Hope this helps

How to connect asterisk server (in LAN) to an external softphone?

My asterisk is running in a LAN having local IP 192.168.1.8,broadcast address 192.168.1.255 and subnet mask 255.255.255.0.The external ip shown is 117.200.236.236 and port 59282 (using IPMANGO). Its dynamic.
I want to connect my mobile to asterisk.For that I use CSipSimple(android) as softphone and 3g service (BSNL,India)
NOTE:If instead of running asterisk in LAN if I use a data card (direct access, no LAN) I am successfully able to register my softphone.
I followed this tutorial but it does not help.
sip.conf
[1000abc]
type=peer
externip=117.200.236.236
localnet=192.168.1.8/255.255.255.0
nat=yes,true,y,t,1,on
qualify=no
allow=all
udpbindaddr=0.0.0.0
bindaddr=0.0.0.0
secret=mysecret
host=dynamic
context=incoming-call
CSipSimple Basic Account
Account name:myAccount
Username:1000abc
Server:117.200.236.236
Password:mysecret
I have not made any change in rtp.conf.
Firstly, network access:
Set your firewall / router to forward your external IP to 192.168.1.8 on Ports 5060 (SIP) and 10000-20000 (for RTP), both with UDP packets
Use a packet capture like wireshark or tcpdump to ensure network connectivity.
Secondly, nat setting:
You've got nat=yes,true,y,t,1,on, where you really need just:
nat=yes
That's proper for asterisk 1.8. Asterisk 11 will require different options, see the sip.conf file as generated by make samples -- which I highly recommend if you're new to asterisk, the sample configurations contain the best documentation about the settings.
Lastly, in cSipSimple:
In Settings -> Network tick the box for use 3G (and better) in order to send data over 3G, otherwise it typically defaults to just use Wifi.
Make sure that your network public ip it is also configure in your SoftPhone. Also make sure that your external ip matches your public ip in your network.
sip.conf
[1000abc]
type=peer
externip=XXX.XXX.XXX.XXXX
You can use this site to find your external IP.

Resources