Asterisk sip.conf Configuartion for outbound calls - asterisk

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.

Related

1 way audio only when registering to OpenSIPs in front of Asterisk

Long time Asterisk user but fairly new to OpenSIPs. I have a SIP phone working with audio both directions when registering to and receiving calls directly from Asterisk. The same phone works with 2 way audio if I register to OpenSIPs and receive a call from OpenSIPs but only IF the call originated from somewhere OTHER than our Asterisk server.
Example that works:
Call from PSTN > OpenSIPs > SIP Phone (registered to OpenSIPs)
Call from PSTN > Asterisk > SIP Phone (registered to Asterisk)
Example that does NOT work, one way audio issues:
Call from PSTN > Asterisk > OpenSIPs > SIP Phone (registered to OpenSIPs)
I am trying to offload all our registrations from Asterisk to OpenSIPs but when we pass the call from Asterisk to OpenSIPs the call goes to the phone registered to OpenSIPs but has one way audio.
Don't believe it to be a firewall issue because we have tested while firewalls on both Asterisk and OpenSIPs are off.
Have tested many theories but, I'm at a loss at this point, out of ideas. I thought I would ask the smart folks here.
Thanks in advance for any help.
I fixed this by setting nat=yes in the sip.conf on Asterisk server under the configuration for the OpenSIPs server.
I noticed that when I tested on a newer version of Asterisk I got better errors in the Asterisk console. I noticed Asterisk was trying to send the RTP to the private LAN IP of the endpoint (my sip phone) instead of the public IP of my internet connection where the phone is located. Not sure why it was trying to do that. I am wondering if OpenSIPs needs to be modified. Was puzzles me is that I have NEVER had to set nat=yes on Asterisk when sending calls to servers with static public IP. In this case I am sending calls to an extension like 456#xxx.xxx.xxx.xxx where xxx is the public static IP of my OpenSIPs server so, no NAT involved there. The NAT comes into play when the call is sent to the endpoint which is behind a NAT. Makes no sense to me why I should have to set nat=yes to make this work but, this was an immediate fix. Will research more later, might need a change on the OpenSIPs side instead of nat=yes on the Asterisk side.

PJSIP transport parameter in sip contact

I am using PJSIP for a SIP application and have the following problem. When I register via UDP with register URI "sip:test#172.31.5.153:5060" the register works fine. When a SipPhone calls via UDP it works fine but when the SoftPhone calls via TCP the application answers with a SIP OK where the "transport=tcp" param is missing in the contact of the SIP OK and so the Softphone declines the call. Does anybody knwos this problem and knows a easy solution? Thanks
The behaviour you described sounds like it could be perfectly "valid" sip proxy behaviour as defined in the SIP RFC depending on what the proxy supports against what you have setup in pjsip.
My guess is that you didn't setup the UDP transport correctly in pjsip setup?
What you have to remember is that the proxy is perfectly valid to send NEW dialog messages to the "contact" address.
Normally you have to setup both a UDP and TCP transport for pjsip even with using UDP by default because the SIP message size can get too big for UDP and have to use a TCP connection.
If you want to always connect via TCP you must add ";tansport=tcp" in the account pjsua_acc_config::id field where you setup the sip address for the account.
I would also recommend that if the pjsip client is connect via the internet via a NAT that you also turn on rport support (and hope that the proxy server support rport correctly) as it may be impossible for the sip server to create a TCP/UDP connection back to you when you are behind a NAT.

Route Call in Asterisk Server

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

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.

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