Regarding port map for astrisk servser

Hi all,

I have successfully set up a asterisk server. This forum community helped lot for my success. But now i have a small issue Im connecting to the internet via adsl router with a dynamic Ip address. So now i need to map port on the router to asterisk server for sip trunk and normal sip phones.

I have a two problems.

1 / What are the ports i have to map on the adsl router to asterisk server
2 / I have a dynamic IP. so it change overtime i restart my router. Is thr any solution to overcome that. Can we use DDNS for this purpose. Because static ip addresses are verry expensive my country.

Thx.

Ports 5060 for Sip signaling and check your rtp.conf for voice, usually ports 10000-20000 need to be opened.
A DDNS is the best solution in this case, but need configure your sip.con with externhost and externrefresh for remote support and maybe a stunaddr server.

[quote=“esampathj”]But now i have a small issue Im connecting to the internet via adsl router with a dynamic Ip address. So now i need to map port on the router to asterisk server for sip trunk and normal sip phones.

I have a two problems.

1 / What are the ports i have to map on the adsl router to asterisk server[/quote]
I have my Asterisk PBX system hosted on a FON2100 device flashed with an OpenWRT firmware + several ATA devices registered either directly to VoSPs or my Asterisk PBX system. I use a Linksys WRT54GS v3 NAT/Firewall/WiFi router flashed with a DD-WRT firmware as my main router and I don’t have to do any ports forwarding, yet all my VoIP devices + my Asterisk PBX system work happily with no problems.

I use dynDNS with no problems. If your DSL provider changes your public IP Address @intervals, then you will need to find a way to refresh your dynDNS once the IP Address gets changed; otherwise, you will have problems with your VoIP.

[quote=“navaismo”]Ports 5060 for Sip signaling and check your rtp.conf for voice, usually ports 10000-20000 need to be opened.
A DDNS is the best solution in this case, but need configure your sip.con with externhost and externrefresh for remote support and maybe a stunaddr server.[/quote]

Thx for ur repply. I did the port forwarding for 5060. But how can we forward port range to single ip. what should be the destination port.

Below is the asterisk debug message when sip trying to take a call.

-- Registered SIP '100' at 93.96.53.250 port 58622
-- Unregistered SIP '100'
-- Registered SIP '100' at 93.96.53.250 port 58622
-- Unregistered SIP '100'

please advice.

It depends on your firewall/router ways, in many routers you can set the range by the hyphen (-) in the source and destination, many others need to open one by one. And dont forget configure the Sip.conf too.

[quote=“navaismo”][quote=“esampathj”]
Thx for ur repply. I did the port forwarding for 5060. But how can we forward port range to single ip. what should be the destination port.
[/quote]

It depends on your firewall/router ways, in many routers you can set the range by the hyphen (-) in the source and destination, many others need to open one by one. And dont forget configure the Sip.conf too.[/quote]

Below show my sip.conf file. can u please tell me, is it correctly configured ?

[root@localhost ~]# cat /etc/asterisk/sip.conf
;--------------------------------------------------------------------------------;
; Do NOT edit this file as it is auto-generated by FreePBX. All modifications to ;
; this file must be done via the web gui. There are alternative files to make ;
; custom modifications, details at: freepbx.org/configuration_files ;
;--------------------------------------------------------------------------------;
;

[general]

; These files will all be included in the [general] context
;
#include sip_general_additional.conf

;sip_general_custom.conf is the proper file location for placing any sip general
;options that you might need set. For example: enable and force the sip jitterbuffer.
;If these settings are desired they should be set the sip_general_custom.conf file.
;
; jbenable=yes
; jbforce=yes
;
;It is also the proper place to add the lines needed for sip nat’ing when going
;through a firewall. For nat’ing you’d need to add the following lines:
; nat=yes , externip= , localhost= , and optionally fromdomain= .
nat=yes
;
#include sip_general_custom.conf

;sip_nat.conf is here for legacy support reasons and for those that upgrade
;from previous versions. If you have this file with lines in it please make
;sure they are not duplicated in sip_general_custom.conf, if so remove them
;from sip_nat.conf as sip_general_custom.conf will have precedence.
#include sip_nat.conf

;sip_registrations_custom.conf is for any customizations you might need to do to
;the automatically generated registrations that FreePBX makes.
;
#include sip_registrations_custom.conf
#include sip_registrations.conf

; These files should all be expected to come after the [general] context
;
#include sip_custom.conf
#include sip_additional.conf

;sip_custom_post.conf If you have extra parameters that are needed for a
;extension to work to for example, those go here. So you have extension
;1000 defined in your system you start by creating a line 1000 in this
;file. Then on the next line add the extra parameter that is needed.
;When the sip.conf is loaded it will append your additions to the end of
;that extension.
;
#include sip_custom_post.conf

canreinvite = nonat
[root@localhost ~]#

I already forwarded port 5060. What else i have to do ?

Ah ok you are using freepbx. So i recommend to you download the module “asterisk sip settings” from module admin and you can edit via GUI.

You need to define your “externhost” “localnet” and “externrefresh” for remote support, and dont forget forward the rtp ports to your server.

thank you very much. i have successfully solved the problem. Thanks again for everyone who helped me.

But i got another problem when i use externhost parameter in my configuration file. I used externhost=mydomain in the configuration file. I’m using dynamic ip. So mydomain already mapped to my dynamic ip via ddns. When i restart my asterisk server it works fine. But my dynamic ip change after every 5 hr. When it occur i lost my audio for calls or getting one way audio.

I saw in a forum that when the dynamic ip change i have to restart the server to solve the ip.But its not practical for me. Any one have a good advice regarding this issue.

Thx.

you can use with externhost the externrefresh, or quit externhost and use externrefresh too. Also activate the dnsmgr and refresh every 5 minutes for all options.

… or you could simply use stun server to let asterisk find what your IP address is.