Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIP networking configuration #24

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
$ext_userscontext,
$ext_includes,
$ext_execs,
$localnet_sip,
$externip_sip,
$domain_sip,
) inherits asterisk {
File {
owner => 'root',
Expand Down
20 changes: 20 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,9 @@
$ext_userscontext = 'default'
$ext_includes = []
$ext_execs = []

# SIP networking configuration
$localnet_sip = []
$externip_sip = ''
$domain_sip = ''
}
10 changes: 10 additions & 0 deletions templates/sip.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down