diff --git a/manifests/site.pp b/manifests/site.pp index e7dd30faa6..8f523511f3 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -332,7 +332,16 @@ node 'zuul-dev.openstack.org' { node 'pbx.openstack.org' { class { 'openstack_project::pbx': - sysadmins => hiera('sysadmins'), + sysadmins => hiera('sysadmins'), + sip_providers => [ + { + provider => 'voipms', + hostname => 'dallas.voip.ms', + username => hiera('voipms_username'), + password => hiera('voipms_password'), + outgoing => false, + }, + ], } } diff --git a/modules/openstack_project/files/pbx/asterisk/extensions.conf b/modules/openstack_project/files/pbx/asterisk/extensions.conf index 015fb1a38e..34cd53a1da 100644 --- a/modules/openstack_project/files/pbx/asterisk/extensions.conf +++ b/modules/openstack_project/files/pbx/asterisk/extensions.conf @@ -26,3 +26,5 @@ exten => 7726,1,Answer() same => n,Playback(spam) same => n,Hangup() +; All other extensions go to s,1 +exten => _X.,1,Goto(s,1) diff --git a/modules/openstack_project/files/pbx/asterisk/sip.conf b/modules/openstack_project/files/pbx/asterisk/sip.conf deleted file mode 100644 index b3a1adbdef..0000000000 --- a/modules/openstack_project/files/pbx/asterisk/sip.conf +++ /dev/null @@ -1,14 +0,0 @@ -; sip.conf customizations for pbx.openstack.org - -[general](+) -udpbindaddr=:: -tcpenable=yes -tcpbindaddr=:: -context=public -allowguest=yes -disallow=all -allow=g722 -allow=ulaw -allow=alaw -allow=gsm -videosupport=yes diff --git a/modules/openstack_project/manifests/pbx.pp b/modules/openstack_project/manifests/pbx.pp index 49d3542ae5..cd046d6b43 100644 --- a/modules/openstack_project/manifests/pbx.pp +++ b/modules/openstack_project/manifests/pbx.pp @@ -17,6 +17,7 @@ # == Class: openstack_project::pbx class openstack_project::pbx ( $sysadmins = [], + $sip_providers = [], ) { class { 'openstack_project::server': sysadmins => $sysadmins, @@ -46,7 +47,7 @@ class openstack_project::pbx ( owner => 'asterisk', group => 'asterisk', mode => '0660', - source => 'puppet:///modules/openstack_project/pbx/asterisk/sip.conf', + content => template('openstack_project/pbx/asterisk/sip.conf.erb'), require => File['/etc/asterisk/'], } diff --git a/modules/openstack_project/templates/pbx/asterisk/sip.conf.erb b/modules/openstack_project/templates/pbx/asterisk/sip.conf.erb new file mode 100644 index 0000000000..cd6be33992 --- /dev/null +++ b/modules/openstack_project/templates/pbx/asterisk/sip.conf.erb @@ -0,0 +1,32 @@ +; sip.conf customizations for pbx.openstack.org + +[general](+) +udpbindaddr=:: +tcpenable=yes +tcpbindaddr=:: +context=public +allowguest=yes +disallow=all +allow=g722 +allow=ulaw +allow=alaw +allow=gsm +videosupport=yes +<% sip_providers.each do |provider| -%> +register => <%= provider['username'] %>:<%= provider['password'] %>@<%= provider['hostname'] %>:5060 +<% end -%> + + +<% sip_providers.each do |provider| -%> +<% if provider['outgoing'] == true -%> +[<%= provider['username'] %>] +context=public +host=<%= provider['hostname'] %> +secret=<%= provider['password'] %> +type=peer +defaultuser=<%= provider['username'] %> +fromuser=<%= provider['username'] %> +trustrpid=yes +sendrpid=yes +<% end -%> +<% end -%>