Puppet Class: asterisk

Inherits:
asterisk::params
Defined in:
manifests/init.pp

Summary

Install and configure an asterisk server.

Overview

TODO:

Purge unmanaged configs by default. Add parameter to disable purging.

TODO:

Add hash-based params that can be used to create a set of resources for each type with create_resource. This can be useful for pushing data out to hiera.

TODO:

make it possible to manage dialplan with the two other methods (e.g. AEL and Lua)

TODO:

overhaul README file before release. lots of things have changed

Examples:

simple install

class { 'asterisk': }

Parameters:

  • manage_service (Boolean) (defaults to: true)

    Set this to false to avoid managing the asterisk service. By default puppet will enable the service and ensure that it is running.

  • manage_package (Boolean) (defaults to: true)

    Set this to false to avoid installing the asterisk package.

  • package_name (String) (defaults to: 'asterisk')

    Name of the package being installed for asterisk.

  • service_name (String) (defaults to: 'asterisk')

    Name of the asterisk service.

  • confdir (Stdlib::Absolutepath) (defaults to: '/etc/asterisk')

    Absolute path to the asterisk configuration directory.

  • iax_general (Hash) (defaults to: {})

    Global configurations for IAX2. Options are set in the file as key = value in the [general] section of iax.conf.

  • sip_general (Hash) (defaults to: {})

    Global configurations for SIP. Options are set in the file as key = value in the [general] section of the sip.conf file.

  • voicemail_general (Hash) (defaults to: {})

    Global configurations for voicemail. Options are set in the file as key = value in the [general] section of the voicemail.conf file.

  • extensions_general (Hash) (defaults to: {})

    Global configurations for the dialplan. Options are set in the file as key = value in the [general] section of the extensions.conf file.

  • extensions_globals (Asterisk::ExtGlobalVars) (defaults to: {})

    Hash of global variables for the dialplan, placed in the [globals] section of the extensions.conf file. The variables defined here can be accessed throughout the dialplan with the GLOBAL() function. Global variables can make dialplans reusable by different servers with different use cases. They also make dialplans easier to maintain by concentrating certain information in one location (e.g. to avoid having to modify the same value through many contexts and macros). Global variables can also be used for hiding passwords from Asterisk logs, for example for register lines or calls to Dial() where information about the provider is combined with username and password: when using a global variable, the variable name will be shown in logs, not the actual password. Variables are set in the file as key = value. If you pass in a Sensitive type as the value, it will be unwrapped for outputting in the configuration file: this can avoid showing certain sensitive information (as passwords) in puppet logs.

  • agents_multiplelogin (Boolean) (defaults to: true)

    Set this to false to disable possibility for agents to be logged in multiple times. This option is set in the [general] section of the agents.conf file.

  • agents_global (Hash) (defaults to: {})

    Global configurations for agents. Options are set in the file as key = value in the [agents] section of the agents.conf file.

  • features_general (Asterisk::FeaturesGeneral) (defaults to: $asterisk::params::features_general)

    Global call features. Options are set in the file as key = value in the [general] section of features.conf.

  • features_featuremap (Asterisk::Featuremap) (defaults to: {})

    Global feature maps. Options are set in the file as key => value in the [featuremap] section of features.conf.

  • features_applicationmap (Hash[String,String]) (defaults to: {})

    Global application feature maps. Options are set in the file as key => value in the [applicationmap] section of features.conf.

  • queues_general (Hash) (defaults to: {})

    Global configurations for queues. Options are set in the file as key = value in the [general] section of the queues.conf file.

  • modules_autoload (Boolean) (defaults to: true)

    Set this to false to avoid having asterisk load modules automatically on an as-needed basis. This can be used to configure modules in a more restrictive manner.

  • modules_noload (Array[String]) (defaults to: $asterisk::params::modules_noload)

    List of modules that asterisk should not load. This can be useful if modules_autoload is set to true.

  • modules_load (Array[String]) (defaults to: $asterisk::params::modules_load)

    List of modules that asterisk should load on startup. This is useful if you've set modules_autoload to false.

  • modules_global (Hash) (defaults to: {})

    Global configurations for modules. Options are set in the file as key = value in the [global] section of the modules.conf file.

  • manager_enable (Boolean) (defaults to: true)

    Set this to false to disable asterisk manager.

  • manager_port (Integer) (defaults to: 5038)

    Port number on which asterisk will listen to for manager connections. Defaults to 5038.

  • manager_bindaddr (String) (defaults to: '127.0.0.1')

    IP address to have asterisk bind to for manager connections. Defaults to binding to localhost.

See Also:



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'manifests/init.pp', line 93

class asterisk (
  Boolean                   $manage_service          = true,
  Boolean                   $manage_package          = true,
  String                    $package_name            = 'asterisk',
  String                    $service_name            = 'asterisk',
  Stdlib::Absolutepath      $confdir                 = '/etc/asterisk',
  Hash                      $iax_general             = {},
  Hash                      $sip_general             = {},
  Hash                      $voicemail_general       = {},
  Hash                      $extensions_general      = {},
  Asterisk::ExtGlobalVars   $extensions_globals      = {},
  Boolean                   $agents_multiplelogin    = true,
  Hash                      $agents_global           = {},
  Asterisk::FeaturesGeneral $features_general        = $asterisk::params::features_general,
  Asterisk::Featuremap      $features_featuremap     = {},
  Hash[String,String]       $features_applicationmap = {},
  Hash                      $queues_general          = {},
  Boolean                   $modules_autoload        = true,
  Array[String]             $modules_noload          = $asterisk::params::modules_noload,
  Array[String]             $modules_load            = $asterisk::params::modules_load,
  Hash                      $modules_global          = {},
  Boolean                   $manager_enable          = true,
  Integer                   $manager_port            = 5038,
  String                    $manager_bindaddr        = '127.0.0.1',
) inherits asterisk::params {

  # We'll only ensure the type of some of the *_general on which templates iterate

  $real_iax_general = merge($asterisk::params::iax_general, $iax_general)
  assert_type(Array[String], $real_iax_general['allow'])
  assert_type(Array[String], $real_iax_general['disallow'])
  $real_sip_general = merge($asterisk::params::sip_general, $sip_general)
  assert_type(Array[String], $real_sip_general['allow'])
  assert_type(Array[String], $real_sip_general['disallow'])
  assert_type(Array[String], $real_sip_general['domain'])
  assert_type(Array[String], $real_sip_general['localnet'])
  $real_voicemail_general = merge(
    $asterisk::params::voicemail_general, $voicemail_general
  )
  $real_extensions_general = merge(
    $asterisk::params::extensions_general,
    $extensions_general
  )
  $real_agents_multiplelogin = bool2str($agents_multiplelogin, 'yes', 'no')
  $real_features_general = merge(
    $asterisk::params::features_general,
    $features_general
  )
  $real_queues_general = merge(
    $asterisk::params::queues_general,
    $queues_general
  )
  $real_modules_autoload = bool2str($modules_autoload, 'yes', 'no')
  $real_manager_enable = bool2str($manager_enable, 'yes', 'no')

  contain asterisk::install
  contain asterisk::config
  contain asterisk::service

  Class['asterisk::install']
  -> Class['asterisk::config']
  ~> Class['asterisk::service']

}