Search code examples
asterisklanpbx

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.


Solution

  • 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.