diff --git a/manifests/config.pp b/manifests/config.pp index 5af5f81..759b2d2 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -56,6 +56,9 @@ $ext_userscontext, $ext_includes, $ext_execs, + $localnet_sip, + $externip_sip, + $domain_sip, ) inherits asterisk { File { owner => 'root', diff --git a/manifests/init.pp b/manifests/init.pp index 980a8e0..e6b7e96 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -151,6 +151,19 @@ # asterisk, this is the registration string. # Default: '' # +# [*localnet_sip*] +# Array of Strings. Specify networks inside the NAT +# Default: [] +# +# [*externip_sip*] +# String. When acting behind a NAT, use this parameter to specify the public +# address +# Default: '' +# +# [*domain_sip*] +# String. list of allowed domains +# Default: '' +# # [*rtpstart*] # String. Lower limit for RTP port range # Default: 10000 @@ -273,6 +286,9 @@ $manager_port = $asterisk::params::manager_port, $manager_webenabled = $asterisk::params::manager_webenabled, $register_sip = $asterisk::params::register_sip, + $localnet_sip = $asterisk::params::localnet_sip, + $externip_sip = $asterisk::params::externip_sip, + $domain_sip = $asterisk::params::domain_sip, $rtpstart = $asterisk::params::rtpstart, $rtpend = $asterisk::params::rtpend, $udpbindaddr = $asterisk::params::udpbindaddr, @@ -306,6 +322,7 @@ validate_string($ext_writeprotect, $ext_autofallthrough, $ext_patternmatchnew) validate_string($ext_static, $ext_clearglobalvars, $ext_userscontext) validate_array($ext_includes, $ext_execs) + validate_array($localnet_sip) class { '::asterisk::install': package_ensure => $package_ensure, @@ -356,6 +373,9 @@ ext_userscontext => $ext_userscontext, ext_includes => $ext_includes, ext_execs => $ext_execs, + localnet_sip => $localnet_sip, + externip_sip => $externip_sip, + domain_sip => $domain_sip, } -> class { '::asterisk::service': service_ensure => $service_ensure, diff --git a/manifests/params.pp b/manifests/params.pp index fb86f74..bf78f32 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -104,4 +104,9 @@ $ext_userscontext = 'default' $ext_includes = [] $ext_execs = [] + + # SIP networking configuration + $localnet_sip = [] + $externip_sip = '' + $domain_sip = '' } diff --git a/templates/sip.conf.erb b/templates/sip.conf.erb index 7a1a03f..ffca59f 100644 --- a/templates/sip.conf.erb +++ b/templates/sip.conf.erb @@ -850,6 +850,13 @@ register => <%= @register_sip %> ; ; subscribe_network_change_event = yes ; on by default +<%- @localnet_sip.each do |net| -%> +localnet = <%= net %> +<%- end -%> +<%- if @externip_sip!='' -%> +externip = <%= @externip_sip %> +<%- end -%> + ;----------------------------------- MEDIA HANDLING -------------------------------- ; By default, Asterisk tries to re-invite media streams to an optimal path. If there's ; no reason for Asterisk to stay in the media path, the media will be redirected. @@ -977,6 +984,9 @@ register => <%= @register_sip %> ; To disallow requests for domains not serviced by this server: ; allowexternaldomains=no +<%- if @domain_sip!='' -%> +domain = <%= @domain_sip %> +<%- end -%> ;domain=mydomain.tld,mydomain-incoming ; Add domain and configure incoming context ; for external calls to this domain