diff --git a/software/asterisk/instance-freepbx.cfg.in b/software/asterisk/instance-freepbx.cfg.in new file mode 100644 index 0000000000000000000000000000000000000000..42e6ac0f7c43393f2f1cf32a85de111541125ee1 --- /dev/null +++ b/software/asterisk/instance-freepbx.cfg.in @@ -0,0 +1,213 @@ +############################### +# +# Instanciate freepbx, asterisk +# +############################### +[buildout] +parts = + asterisk-service + mariadb-service + mariadb-create-database + mariadb-init-database + apache-service + freepbx-configuration + freepbx-copy-configuration + +eggs-directory = ${buildout:eggs-directory} +develop-eggs-directory = ${buildout:develop-eggs-directory} +offline = true + +[directory] +recipe = slapos.cookbook:mkdirectory +etc = $${buildout:directory}/etc +bin = $${buildout:directory}/bin +astetc = $${:etc}/asterisk +# bin = $${buildout:directory}/bin +srv = $${buildout:directory}/srv +var = $${buildout:directory}/var +varlib = $${:var}/lib +varspool = $${:var}/spool +astmonitor = $${:varspool}/monitor +astfax = $${:varspool}/fax +astvarlib = $${:varlib}/asterisk +astvarlibbin = $${:astvarlib}/bin +astspool = $${:varspool}/asterisk +log = $${:var}/log +www = $${:var}/www +wwwhtml = $${:www}/html +wwwhtmlpanel = $${:wwwhtml}/panel +wwwcgi = $${:www}/cgi-bin +astlog = $${:log}/asterisk +tmp = $${buildout:directory}/tmp +scripts = $${:etc}/run +services = $${:etc}/service +mariadb-data = $${:srv}/mariadb +apache-htdocs = $${:srv}/htdocs +# promises = $${:etc}/promise +# novnc-conf = $${:etc}/novnc +run = $${:var}/run +astrun = $${:run}/asterisk +# ca-dir = $${:srv}/ssl + +[mariadb-create-database] +recipe = slapos.recipe.template +url = ${template-mariadb-create-database:output} +output = $${directory:scripts}/mariadb-create-database +mode = 0700 + +[mariadb-init-database] +recipe = slapos.recipe.template +url = ${template-mariadb-init-database:output} +output = $${directory:bin}/mariadb-init-database +mode = 0700 + +[mariadb-create-database-sql] +recipe = slapos.recipe.template +url = ${template-mariadb-create-database-sql:output} +output = $${directory:etc}/mariadb-create-database.sql +mode = 0600 + +[mariadb-freepbx-database] +passwd = asterisk + +[mariadb-freepbx-login] +recipe = slapos.cookbook:generate.password +storage-path = $${directory:srv}/mariadb-freepbx-login +bytes = 8 + +[mariadb-freepbx-password] +recipe = slapos.cookbook:generate.password +storage-path = $${directory:srv}/mariadb-freepbx-passwd +bytes = 24 + +[mariadb-asterisk-database] +passwd = asteriskcdrdb + +[mariadb-asterisk-login] +recipe = slapos.cookbook:generate.password +storage-path = $${directory:srv}/mariadb-asterisk-login +bytes = 8 + +[mariadb-asterisk-password] +recipe = slapos.cookbook:generate.password +storage-path = $${directory:srv}/mariadb-asterisk-passwd +bytes = 24 + +[mariadb-service] +recipe = slapos.recipe.template +url = ${template-mariadb-service:output} +output = $${directory:services}/mariadb +mode = 0700 + +[mariadb-configuration] +recipe = slapos.recipe.template +url = ${template-mariadb-configuration:output} +output = $${directory:etc}/mariadb.cnf +mode = 0600 +socket = $${directory:run}/mariadb.sock +pid-file = $${directory:run}/mariadb.pid +error-log = $${directory:log}/mariadb_error.log +slow-log = $${directory:log}/mariadb_slowquery.log +bin-log = $${directory:log}/mariadb-bin.log + +[apache-service] +recipe = slapos.recipe.template +url = ${template-apache-service:output} +output = $${directory:services}/apache +mode = 0700 + +[apache-configuration] +recipe = slapos.recipe.template +url = ${template-apache-configuration:output} +output = $${directory:etc}/httpd.conf +mode = 0600 +pid-file = $${directory:run}/httpd.pid +ip = $${slap-network-information:local-ipv4} +port = 9080 +error-log = $${directory:log}/httpd_error.log +access-log = $${directory:log}/httpd_access.log +php-ini-dir = $${directory:apache-htdocs} +document-root = $${directory:apache-htdocs} + +[freepbx-configuration] +recipe = slapos.recipe.template +url = ${template-freepbx-configuration:output} +output = $${directory:etc}/amportal.conf +mode = 0600 +virtual-depends = + $${asterisk-version:output} + $${asterisk-configuration:output} + +[freepbx-php-configuration] +recipe = slapos.recipe.template +url = ${template-freepbx-php-configuration:output} +output = $${directory:etc}/freepbx.conf +mode = 0600 +debug-log = $${directory:log}/freepbx_debug.log +error-log = $${directory:log}/freepbx_error.log + +[freepbx-copy-configuration] +recipe = slapos.recipe.template +url = ${template-freepbx-copy-configuration:output} +output = $${directory:bin}/freepbx-copy-configuration +mode = 0700 + +[freepbx-panel-password] +recipe = slapos.cookbook:generate.password +storage-path = $${directory:srv}/freepbx-panel-password +bytes = 8 + +[freepbx-ari-login] +recipe = slapos.cookbook:generate.password +storage-path = $${directory:srv}/freepbx-ari-login +bytes = 8 + +[freepbx-ari-password] +recipe = slapos.cookbook:generate.password +storage-path = $${directory:srv}/freepbx-ari-password +bytes = 8 + +[asterisk-configuration] +recipe = slapos.recipe.template +url = ${template-asterisk-configuration:output} +output = $${directory:astetc}/asterisk.conf +mode = 0600 +virtual-depends = + $${asterisk-cdr-configuration:output} + $${asterisk-manager-configuration:output} + +[asterisk-cdr-configuration] +recipe = slapos.recipe.template +url = ${template-asterisk-cdr-configuration:output} +output = $${directory:astetc}/cdr_mysql.conf +mode = 0600 + +[asterisk-manager-configuration] +recipe = slapos.recipe.template +url = ${template-asterisk-manager-configuration:output} +output = $${directory:astetc}/manager.conf +mode = 0600 +ip = $${slap-network-information:local-ipv4} +port = 5038 + +[asterisk-manager-login] +recipe = slapos.cookbook:generate.password +storage-path = $${directory:srv}/asterisk-manager-login +bytes = 8 + +[asterisk-manager-password] +recipe = slapos.cookbook:generate.password +storage-path = $${directory:srv}/asterisk-manager-password +bytes = 8 + +[asterisk-version] +recipe = slapos.recipe.template +url = ${template-asterisk-version:output} +output = $${directory:astetc}/version +mode = 0600 + +[asterisk-service] +recipe = slapos.recipe.template +url = ${template-asterisk-service:output} +output = $${directory:services}/asterisk +mode = 0700 diff --git a/software/asterisk/instance.cfg.in b/software/asterisk/instance.cfg.in new file mode 100644 index 0000000000000000000000000000000000000000..4a037c7de324a817e65fc9cfe60b0c5093af1a01 --- /dev/null +++ b/software/asterisk/instance.cfg.in @@ -0,0 +1,21 @@ +[buildout] +parts = + switch-softwaretype + +eggs-directory = ${buildout:eggs-directory} +develop-eggs-directory = ${buildout:develop-eggs-directory} +offline = true + +[switch-softwaretype] +recipe = slapos.cookbook:softwaretype +default = ${template-freepbx:output} +freepbx = ${template-freepbx:output} + +[slap-connection] +# part to migrate to new - separated words +computer-id = $${slap_connection:computer_id} +partition-id = $${slap_connection:partition_id} +server-url = $${slap_connection:server_url} +software-release-url = $${slap_connection:software_release_url} +key-file = $${slap_connection:key_file} +cert-file = $${slap_connection:cert_file} diff --git a/software/asterisk/software.cfg b/software/asterisk/software.cfg new file mode 100644 index 0000000000000000000000000000000000000000..4e51fbf295e53f238318248ac930f2b25580cee5 --- /dev/null +++ b/software/asterisk/software.cfg @@ -0,0 +1,181 @@ +# Based on http://wiki.freepbx.org/display/HTGS/Installing+FreePBX+on+Debian+Wheezy +[buildout] +extends = + ../../component/dash/buildout.cfg + ../../component/dcron/buildout.cfg + ../../component/logrotate/buildout.cfg + ../../component/asterisk/buildout.cfg + ../../component/apache-php/buildout.cfg + ../../component/freepbx/buildout.cfg + ../../stack/slapos.cfg + +parts = + asterisk + apache-php + freepbx + php-db + template + template-freepbx + +[networkcache] +# signature certificates of the following uploaders. +# Romain Courteaud +# Test Agent +signature-certificate-list = + -----BEGIN CERTIFICATE----- + MIIB4DCCAUkCADANBgkqhkiG9w0BAQsFADA5MQswCQYDVQQGEwJGUjEZMBcGA1UE + CBMQRGVmYXVsdCBQcm92aW5jZTEPMA0GA1UEChMGTmV4ZWRpMB4XDTExMDkxNTA5 + MDAwMloXDTEyMDkxNTA5MDAwMlowOTELMAkGA1UEBhMCRlIxGTAXBgNVBAgTEERl + ZmF1bHQgUHJvdmluY2UxDzANBgNVBAoTBk5leGVkaTCBnzANBgkqhkiG9w0BAQEF + AAOBjQAwgYkCgYEApYZv6OstoqNzxG1KI6iE5U4Ts2Xx9lgLeUGAMyfJLyMmRLhw + boKOyJ9Xke4dncoBAyNPokUR6iWOcnPHtMvNOsBFZ2f7VA28em3+E1JRYdeNUEtX + Z0s3HjcouaNAnPfjFTXHYj4um1wOw2cURSPuU5dpzKBbV+/QCb5DLheynisCAwEA + ATANBgkqhkiG9w0BAQsFAAOBgQBCZLbTVdrw3RZlVVMFezSHrhBYKAukTwZrNmJX + mHqi2tN8tNo6FX+wmxUUAf3e8R2Ymbdbn2bfbPpcKQ2fG7PuKGvhwMG3BlF9paEC + q7jdfWO18Zp/BG7tagz0jmmC4y/8akzHsVlruo2+2du2freE8dK746uoMlXlP93g + QUUGLQ== + -----END CERTIFICATE----- + -----BEGIN CERTIFICATE----- + MIIB9jCCAV+gAwIBAgIJAKRvzcy7OH0UMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV + BAMMCENPTVAtNzcyMCAXDTEyMDgxMDE1NDI1MVoYDzIxMTIwNzE3MTU0MjUxWjAT + MREwDwYDVQQDDAhDT01QLTc3MjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA + o7aipd6MbnuGDeR1UJUjuMLQUariAyQ2l2ZDS6TfOwjHiPw/mhzkielgk73kqN7A + sUREx41eTcYCXzTq3WP3xCLE4LxLg1eIhd4nwNHj8H18xR9aP0AGjo4UFl5BOMa1 + mwoyBt3VtfGtUmb8whpeJgHhqrPPxLoON+i6fIbXDaUCAwEAAaNQME4wHQYDVR0O + BBYEFEfjy3OopT2lOksKmKBNHTJE2hFlMB8GA1UdIwQYMBaAFEfjy3OopT2lOksK + mKBNHTJE2hFlMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAaNRx6YN2 + M/p3R8/xS6zvH1EqJ3FFD7XeAQ52WuQnKSREzuw0dsw12ClxjcHiQEFioyTiTtjs + 5pW18Ry5Ie7iFK4cQMerZwWPxBodEbAteYlRsI6kePV7Gf735Y1RpuN8qZ2sYL6e + x2IMeSwJ82BpdEI5niXxB+iT0HxhmR+XaMI= + -----END CERTIFICATE----- + +[directory] +recipe = slapos.cookbook:mkdirectory +template = ${buildout:directory}/template + +########################################################## +# Service startup scripts and configuration files +########################################################## +[template-asterisk-configuration] +recipe = slapos.recipe.template +url = ${:_profile_base_location_}/template-asterisk.conf.in +md5sum = a7f239be1f3fc47c96946a00e926a75e +output = ${directory:template}/template-asterisk.conf.in +mode = 0644 + +[template-asterisk-cdr-configuration] +recipe = slapos.recipe.template +url = ${:_profile_base_location_}/template-asterisk.cdr_mysql.conf.in +md5sum = c6348ff0136cff90b74252d292fbaf0a +output = ${directory:template}/template-asterisk.cdr_mysql.conf.in +mode = 0644 + +[template-asterisk-manager-configuration] +recipe = slapos.recipe.template +url = ${:_profile_base_location_}/template-asterisk.manager.conf.in +md5sum = 2c4eb1aab29b8387c32bba73d7c22e90 +output = ${directory:template}/template-asterisk.manager.conf.in +mode = 0644 + +[template-asterisk-version] +recipe = plone.recipe.command +stop-on-error = true +update-command = ${:command} +command = ${asterisk:location}/sbin/asterisk -V > ${:output} +output = ${directory:template}/template-asterisk.version + +[template-asterisk-service] +recipe = slapos.recipe.template +url = ${:_profile_base_location_}/template-asterisk-service.sh.in +md5sum = 88cb162c57bfe71d29d0a6da9870b60e +output = ${directory:template}/template-asterisk-service.sh.in +mode = 0644 + +[template-mariadb-create-database] +recipe = slapos.recipe.template +url = ${:_profile_base_location_}/template-mariadb-create-database.sh.in +md5sum = b4ed05d296dc99ae31755a173185b5cb +output = ${directory:template}/template-mariadb-create-database.sh.in +mode = 0644 + +[template-mariadb-create-database-sql] +recipe = slapos.recipe.template +url = ${:_profile_base_location_}/template-mariadb-create-database.sql.in +md5sum = 338eeb0ae7256a077ec4bc84938d760c +output = ${directory:template}/template-mariadb-create-database.sql.in +mode = 0644 + +[template-mariadb-init-database] +recipe = slapos.recipe.template +url = ${:_profile_base_location_}/template-mariadb-init-database.sh.in +md5sum = b82dfc91706cbfd2f80fe388f6eea79e +output = ${directory:template}/template-mariadb-init-database.sh.in +mode = 0644 + +[template-mariadb-configuration] +recipe = slapos.recipe.template +url = ${:_profile_base_location_}/template-mariadb.cnf.in +md5sum = 1cca66ad506d9ca9764908e439b96776 +output = ${directory:template}/template-mariadb.cnf.in +mode = 0644 + +[template-mariadb-service] +recipe = slapos.recipe.template +url = ${:_profile_base_location_}/template-mariadb-service.sh.in +md5sum = ffdab23da2d2a3aa78fe26ed9d407609 +output = ${directory:template}/template-mariadb-service.sh.in +mode = 0644 + +[template-apache-configuration] +recipe = slapos.recipe.template +url = ${:_profile_base_location_}/template-apache.conf.in +md5sum = d586c448c97f1259f9de0a22a67b8223 +output = ${directory:template}/template-apache.conf.in +mode = 0644 + +[template-apache-service] +recipe = slapos.recipe.template +url = ${:_profile_base_location_}/template-apache-service.sh.in +md5sum = 88b77bd408cd2206c9a8c63c02673b48 +output = ${directory:template}/template-apache-service.sh.in +mode = 0644 + +[template-freepbx-configuration] +recipe = slapos.recipe.template +url = ${:_profile_base_location_}/template-amportal.conf.in +md5sum = eb5264421261c192bc20d6b42bda0e2b +output = ${directory:template}/template-amportal.conf.in +mode = 0644 + +[template-freepbx-php-configuration] +recipe = slapos.recipe.template +url = ${:_profile_base_location_}/template-freepbx-configuration.in +md5sum = e21ed8993199ec20d96283887832e4ce +output = ${directory:template}/template-freepbx-configuration.in +mode = 0644 + +[template-freepbx-copy-configuration] +recipe = slapos.recipe.template +url = ${:_profile_base_location_}/template-freepbx-copy-configuration.sh.in +md5sum = 7fa1d0b588414d83a8a77f1dc8834b9d +output = ${directory:template}/template-freepbx-copy-configuration.sh.in +mode = 0644 + +########################################################## +# Buildout instance.cfg templates +########################################################## +[template-freepbx] +recipe = slapos.recipe.template +url = ${:_profile_base_location_}/instance-freepbx.cfg.in +md5sum = e21751f2853fbc5f981d4cbc724d302c +output = ${directory:template}/template-freepbx.cfg +mode = 0644 + +[template] +recipe = slapos.recipe.template +url = ${:_profile_base_location_}/instance.cfg.in +md5sum = 3008b6064d88cd3e3b5e4deeb0d231e9 +output = ${buildout:directory}/template.cfg +mode = 0644 + +[versions] diff --git a/software/asterisk/template-amportal.conf.in b/software/asterisk/template-amportal.conf.in new file mode 100644 index 0000000000000000000000000000000000000000..2b7067176cd95be721544acedfb640b97d0e1df0 --- /dev/null +++ b/software/asterisk/template-amportal.conf.in @@ -0,0 +1,163 @@ +# This file contains settings for components of the Asterisk Management Portal +# Spaces are not allowed! +# Run ${freepbx:location}/apply_conf.sh $${:output} after making changes to this file + +# AMPDBHOST: the host to connect to the database named 'asterisk' +AMPDBHOST="unix($${mariadb-configuration:socket})" +# AMPDBHOST=localhost +# AMPDBUSER: the user to connect to the database named 'asterisk' +AMPDBUSER=$${mariadb-freepbx-login:passwd} +# AMPDBENGINE: the type of database to use +AMPDBENGINE=mysql +# AMPDBPASS: the password for AMPDBUSER +AMPDBPASS=$${mariadb-freepbx-password:passwd} +AMPDBNAME=$${mariadb-freepbx-database:passwd} + +# AMPENGINE: the telephony backend engine to use +AMPENGINE=asterisk +# AMPMGRUSER: the user to access the Asterisk manager interface +AMPMGRUSER=$${asterisk-manager-login:passwd} +# AMPMGRPASS: the password for AMPMGRUSER +AMPMGRPASS=$${asterisk-manager-password:passwd} + +# AMPBIN: where command line scripts live +AMPBIN=$${directory:astvarlibbin} +#AMPSBIN: where (root) command line scripts live +AMPSBIN=${asterisk:location}/sbin +# AMPWEBROOT: the path to Apache's webroot (leave off trailing slash) +AMPWEBROOT=$${directory:wwwhtml} +# AMPCGIBIN: the path to Apache's cgi-bin dir (leave off trailing slash) +AMPCGIBIN=$${directory:wwwcgi} +# AMPWEBADDRESS: the IP address or host name used to access the AMP web admin +AMPWEBADDRESS=$${apache-configuration:ip} + +# FOPWEBROOT:web root for the Flash Operator Panel +FOPWEBROOT=$${directory:wwwhtmlpanel} +# FOPPASSWORD: the secret code for performing transfers and hangups in the Flash Operator Panel +FOPPASSWORD=$${freepbx-panel-password:passwd} +# FOPSORT: FOP should sort extensions by Last Name [lastname] or by Extension [extension] +FOPSORT=extension +# FOPRUN: set to true if you want FOP started by freepbx_engine (amportal_start), false otherwise +FOPRUN=false + +# AUTHTYPE: authentication type to use for web admin +# If type set to 'database', the primary AMP admin credentials will be the AMPDBUSER/AMPDBPASS above +# valid: none, database +AUTHTYPE=database + +# AMPADMINLOGO: Defines the logo that is to be displayed at the TOP RIGHT of the admin screen. +# This enables you to customize the look of the administration screen. +# NOTE: images need to be saved in the ..../admin/images directory of your AMP install +# This image should be 55px in height +AMPADMINLOGO=logo.png + +# USECATEGORIES: Controls if the menu items in the admin interface are sorted by category (true), +# or sorted alphebetically with no categories shown (false). Defaults to true. +#USECATEGORIES=false + +# AMPEXTENSIONS: the type of view for extensions admin +# If set to 'deviceanduser' Devices and Users will be administered seperately, and Users will be able to "login" to devices. +# If set to 'extensions' Devices and Users will me administered in a single screen. +AMPEXTENSIONS=extensions + +# POST_RELOAD: automatically execute a script after applying changes in the AMP admin +# Set POST_RELOAD to the script you wish to execute after applying changes +# If POST_RELOAD_DEBUG=true, you will see the output of the script in the web page +# POST_RELOAD= +POST_RELOAD_DEBUG=true + +# ENABLECW: Enable call waiting by default when an extension is created (DEFAULT is yes) +# Set to 'no' to if you don't want phones to be commissioned with call waiting already +# enabled. The user would then be required to dial the CW feature code (*70 default) to +# enable their phone. Most installations should leave this alone. It allows multi-line +# phones to receive multiple calls on their line appearances. +ENABLECW=yes + +#CWINUSEBUSY: Set to yes for extensions that have CW enabled to report as busy if +# they don't answer (resulting in busy voicemail greeting). Otherwise they simply +# report as no-answer (e.g. busy greeting servers no purpose +CWINUSEBUSY=yes + +# AMPBADNUMBER: Set to false if you do not want the bad-number context generated which +# traps any bogus number or freature code and plays a message to the effect. If you use +# the Early Dial feature on some Grandstream phones, you will want to set this to false +AMPBADNUMBER=true + +# The following are used to optionally have the freepbx backup program optionally +# send the generated backup to an ftp server +# +# FTPBACKUP=YES to enable +# FTPUSER, FTPPASSWORD, FTPSERVER must be set +# FTPSUBDIR is an optional subdirectory at the ftp server, it will cause ftp to do a cd +# +# There is no error checking so you should check to make sure these are set correctly. The +# ftp is saved after the backup, so it will not cause the local backup file to be effected +# +# FTPBACKUP=yes +#FTPUSER=asterisk +#FTPPASSWORD=password +#FTPSUBDIR=mybackupfolder +#FTPSERVER=myftpserver + +# SSH BACKUP INFO: must have a valid SSHRSAKEY file and server, only supported through +# ssh. SUBDIR is optional and will be created if it does not exist. +# +# If SSHUSER is not set, it will default to the current user which is asterisk in any +# standard configuration. +# +#SSHBACKUP=yes +#SSHUSER=backups +#SSHRSAKEY=/etc/asterisk/backup_rsa +#SSHSUBDIR=mysubdir +#SSHSERVER=mybackupserver.com + +# AMPPROVROOT=/var/ftp /tftpboot +# One or more directories where there are provisioning files that should be included in the backup. Currently +# these get backed up only, the FreePBX utility does not automatically restore them. +# +#AMPPROVROOT=/var/ftp /tftpboot +# AMPPROVEXCLUDE=/var/ftp/exclude-from-file-list +# a list of files to exclude, to be used in tar's --exclude-from argument +# +#AMPPROVEXCLUDE=/var/ftp/exclude-from-file-list + +# If CUSTOMASERROR is set to false, then the Destination Registry will not report unknow destinations as errors +# this should be left to the default true and custom destinations should be moved into the new custom apps registry +# CUSTOMASERROR=false + +# if DYNAMICHINTS is set to true, Core will not statically generate hints. Instead it will make a call to the +# AMPBIN php script, generate_hints.php, through an Asteirsk's #exec call. This requires Asterisk.conf to be +# configured with "execincludes=yes" set in the [options] section. +# DYNAMICHINTS=true + +# XTNCONFLICTABORT, BADDESTABORT +# setting either of these to true will result in retrieve_conf aborting during a reload if an extension +# conflict is detected or a destination is detected. It is usually better to allow the reload to go +# through and then correct the problem but these can be set if a more strict behavior is desired +# both default to false if not set +XTNCONFLICTABORT=false +BADDESTABORT=false + +# SERVERINTITLE if set to true, the browser title will be preceded with the server name. default false +SERVERINTITLE=false +ASTETCDIR=$${directory:astetc} +ASTMODDIR=${asterisk:location}/lib/asterisk/modules +ASTVARLIBDIR=$${directory:astvarlib} +ASTAGIDIR=$${directory:astvarlib}/agi-bin +ASTSPOOLDIR=$${directory:astspool} +ASTRUNDIR=$${directory:astrun} +ASTLOGDIR=$${directory:astlog} + +# This is the default admin name used to allow an administrator to login to ARI bypassing all security. +# Change this to whatever you want, don't forget to change the ARI_ADMIN_PASSWORD as well +ARI_ADMIN_USERNAME=$${freepbx-ari-login:passwd} + +# This is the default admin password to allow an administrator to login to ARI bypassing all security. +# Change this to a secure password. +ARI_ADMIN_PASSWORD=$${freepbx-ari-password:passwd} + +ASTMANAGERHOST=$${asterisk-manager-configuration:ip} +ASTMANAGERPORT=$${asterisk-manager-configuration:port} + +FPBXDBUGFILE=$${freepbx-php-configuration:debug-log} +FPBX_LOG_FILE=$${freepbx-php-configuration:error-log} diff --git a/software/asterisk/template-amportal2.conf.in b/software/asterisk/template-amportal2.conf.in new file mode 100644 index 0000000000000000000000000000000000000000..1dac6def475897204170c39bc31939ebfe2c931e --- /dev/null +++ b/software/asterisk/template-amportal2.conf.in @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/software/asterisk/template-amportal3.conf.in b/software/asterisk/template-amportal3.conf.in new file mode 100644 index 0000000000000000000000000000000000000000..c085fd1734a043eac8579bf8b865a3e52d2e2559 --- /dev/null +++ b/software/asterisk/template-amportal3.conf.in @@ -0,0 +1,60 @@ + + 'AMPSYSLOGLEVEL' => array(CONF_TYPE_SELECT, 'FILE'), + 'NOOPTRACE' => array(CONF_TYPE_INT, '1'), + 'ARI_ADMIN_PASSWORD' => array(CONF_TYPE_TEXT, 'ari_password'), + 'CFRINGTIMERDEFAULT' => array(CONF_TYPE_SELECT, '0'), + + 'AMPASTERISKWEBUSER' => array(CONF_TYPE_TEXT, 'asterisk'), + 'AMPASTERISKWEBGROUP' => array(CONF_TYPE_TEXT, 'asterisk'), + 'AMPASTERISKUSER' => array(CONF_TYPE_TEXT, 'asterisk'), + 'AMPASTERISKGROUP' => array(CONF_TYPE_TEXT, 'asterisk'), + 'AMPDEVUSER' => array(CONF_TYPE_TEXT, 'apache'), + 'AMPDEVGROUP' => array(CONF_TYPE_TEXT, 'apache'), + + 'ASTETCDIR' => array(CONF_TYPE_DIR, '/etc/asterisk'), + 'ASTMODDIR' => array(CONF_TYPE_DIR, '/usr/lib/asterisk/modules'), + 'ASTVARLIBDIR' => array(CONF_TYPE_DIR, '/var/lib/asterisk'), + 'ASTAGIDIR' => array(CONF_TYPE_DIR, '/var/lib/asterisk/agi-bin'), + 'ASTSPOOLDIR' => array(CONF_TYPE_DIR, '/var/spool/asterisk/'), + 'ASTRUNDIR' => array(CONF_TYPE_DIR, '/var/run/asterisk'), + 'ASTLOGDIR' => array(CONF_TYPE_DIR, '/var/log/asterisk'), + 'AMPBIN' => array(CONF_TYPE_DIR, '/var/lib/asterisk/bin'), + 'AMPSBIN' => array(CONF_TYPE_DIR, '/usr/sbin'), + 'AMPWEBROOT' => array(CONF_TYPE_DIR, '/var/www/html'), + 'MOHDIR' => array(CONF_TYPE_DIR, 'mohmp3'), + 'FPBXDBUGFILE' => array(CONF_TYPE_DIR, '/tmp/freepbx_debug.log'), + + 'ENABLECW' => array(CONF_TYPE_BOOL, true), + 'CWINUSEBUSY' => array(CONF_TYPE_BOOL, true), + 'AMPBADNUMBER' => array(CONF_TYPE_BOOL, true), + 'DEVEL' => array(CONF_TYPE_BOOL, false), + 'DEVELRELOAD' => array(CONF_TYPE_BOOL, false), + 'CUSTOMASERROR' => array(CONF_TYPE_BOOL, true), + 'DYNAMICHINTS' => array(CONF_TYPE_BOOL, false), + 'BADDESTABORT' => array(CONF_TYPE_BOOL, false), + 'SERVERINTITLE' => array(CONF_TYPE_BOOL, false), + 'USEDEVSTATE' => array(CONF_TYPE_BOOL, false), + 'MODULEADMINWGET'=> array(CONF_TYPE_BOOL, false), + 'AMPDISABLELOG' => array(CONF_TYPE_BOOL, true), + 'CHECKREFERER' => array(CONF_TYPE_BOOL, true), + 'RELOADCONFIRM' => array(CONF_TYPE_BOOL, true), + 'DIVERSIONHEADER' => array(CONF_TYPE_BOOL, false), + 'ZAP2DAHDICOMPAT' => array(CONF_TYPE_BOOL, false), + 'XTNCONFLICTABORT' => array(CONF_TYPE_BOOL, false), + 'AMPENABLEDEVELDEBUG' => array(CONF_TYPE_BOOL, false), + 'DISABLECUSTOMCONTEXTS' => array(CONF_TYPE_BOOL, false), + + // Time Conditions (2.9 New) + 'TCINTERVAL' => array(CONF_TYPE_INT, '60'), + 'TCMAINT' => array(CONF_TYPE_BOOL, true), + + // Queues + 'USEQUEUESTATE' => array(CONF_TYPE_BOOL, false), + + // Day Night (2.9 New) + 'DAYNIGHTTCHOOK' => array(CONF_TYPE_BOOL, false), + + // Music + 'AMPMPG123' => array(CONF_TYPE_BOOL, true), + ); + diff --git a/software/asterisk/template-apache-service.sh.in b/software/asterisk/template-apache-service.sh.in new file mode 100644 index 0000000000000000000000000000000000000000..1b52c7e949442bb0970dbd1d215a02f09c38b1d7 --- /dev/null +++ b/software/asterisk/template-apache-service.sh.in @@ -0,0 +1,7 @@ +#!${dash:location}/bin/dash +# BEWARE: This file is operated by slapgrid +# BEWARE: It will be overwritten automatically + +# XXX +export FREEPBX_CONF=$${freepbx-php-configuration:output} +exec ${apache:location}/bin/httpd -f $${apache-configuration:output} -DFOREGROUND diff --git a/software/asterisk/template-apache.conf.in b/software/asterisk/template-apache.conf.in new file mode 100644 index 0000000000000000000000000000000000000000..66c2e4a3bb06c92991a1c3cd85a1dd6d8bc8dba8 --- /dev/null +++ b/software/asterisk/template-apache.conf.in @@ -0,0 +1,62 @@ +# Apache static configuration +# Automatically generated + +# Basic server configuration +PidFile "$${apache-configuration:pid-file}" +Listen $${apache-configuration:ip}:$${apache-configuration:port} +# PHPINIDir $${apache-configuration:php-ini-dir} +PHPINIDir $${directory:wwwhtml}/htdocs +ServerAdmin someone@email +# DefaultType text/plain +TypesConfig conf/mime.types +AddType application/x-compress .Z +AddType application/x-gzip .gz .tgz +AddType application/x-httpd-php .php .phtml .php5 .php4 +AddType application/x-httpd-php-source .phps + +# Log configuration +ErrorLog "$${apache-configuration:error-log}" +LogLevel warn +LogFormat "%h %{REMOTE_USER}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined +LogFormat "%h %{REMOTE_USER}i %l %u %t \"%r\" %>s %b" common +CustomLog "$${apache-configuration:access-log}" common + +# Directory protection +<Directory /> + Options FollowSymLinks + AllowOverride None + Order deny,allow + Deny from all +</Directory> + +<Directory $${directory:wwwhtml}/htdocs> + Options FollowSymLinks + AllowOverride All + Order allow,deny + Allow from all +</Directory> +DocumentRoot $${directory:wwwhtml}/htdocs +# DocumentRoot $${apache-configuration:document-root} +DirectoryIndex index.html index.php + +# List of modules +LoadModule unixd_module modules/mod_unixd.so +LoadModule access_compat_module modules/mod_access_compat.so +LoadModule authz_core_module modules/mod_authz_core.so +LoadModule authz_host_module modules/mod_authz_host.so +LoadModule log_config_module modules/mod_log_config.so +LoadModule setenvif_module modules/mod_setenvif.so +LoadModule version_module modules/mod_version.so +LoadModule proxy_module modules/mod_proxy.so +LoadModule proxy_http_module modules/mod_proxy_http.so +LoadModule mime_module modules/mod_mime.so +LoadModule dav_module modules/mod_dav.so +LoadModule dav_fs_module modules/mod_dav_fs.so +LoadModule negotiation_module modules/mod_negotiation.so +LoadModule rewrite_module modules/mod_rewrite.so +LoadModule headers_module modules/mod_headers.so +LoadModule dir_module modules/mod_dir.so +LoadModule php5_module modules/libphp5.so +LoadModule alias_module modules/mod_alias.so +LoadModule env_module modules/mod_env.so +LoadModule autoindex_module modules/mod_autoindex.so diff --git a/software/asterisk/template-asterisk-service.sh.in b/software/asterisk/template-asterisk-service.sh.in new file mode 100644 index 0000000000000000000000000000000000000000..c9d167cea6226aa78fe8905412d31359f9528515 --- /dev/null +++ b/software/asterisk/template-asterisk-service.sh.in @@ -0,0 +1,5 @@ +#!${dash:location}/bin/dash +# BEWARE: This file is operated by slapgrid +# BEWARE: It will be overwritten automatically + +exec ${asterisk:location}/sbin/asterisk -f -p -C $${asterisk-configuration:output} diff --git a/software/asterisk/template-asterisk.cdr_mysql.conf.in b/software/asterisk/template-asterisk.cdr_mysql.conf.in new file mode 100644 index 0000000000000000000000000000000000000000..6262821dcbe689461243aed598d9dfeca0873622 --- /dev/null +++ b/software/asterisk/template-asterisk.cdr_mysql.conf.in @@ -0,0 +1,20 @@ +; +; Note - if the database server is hosted on the same machine as the +; asterisk server, you can achieve a local Unix socket connection by +; setting hostname = localhost +; +; port and sock are both optional parameters. If hostname is specified +; and is not "localhost", then cdr_mysql will attempt to connect to the +; port specified or use the default port. If hostname is not specified +; or if hostname is "localhost", then cdr_mysql will attempt to connect +; to the socket file specified by sock or otherwise use the default socket +; file. +; +[global] +hostname = localhost +dbname = $${mariadb-asterisk-database:passwd} +password = $${mariadb-asterisk-password:passwd} +user = $${mariadb-asterisk-login:passwd} +userfield=1 +;port=3306 +sock=$${mariadb-configuration:socket} diff --git a/software/asterisk/template-asterisk.conf.in b/software/asterisk/template-asterisk.conf.in new file mode 100644 index 0000000000000000000000000000000000000000..0dd4acf8520716519469fcb2bd754105d2b20d75 --- /dev/null +++ b/software/asterisk/template-asterisk.conf.in @@ -0,0 +1,14 @@ +[directories] +astetcdir => $${directory:astetc} +astmoddir => ${asterisk:location}/lib/asterisk/modules +astvarlibdir => $${directory:astvarlib} +astagidir => $${directory:astvarlib}/agi-bin +astspooldir => $${directory:astspool} +astrundir => $${directory:astrun} +astlogdir => $${directory:astlog} + +[options] +transmit_silence_during_record = yes +languageprefix=yes +execincludes=yes + diff --git a/software/asterisk/template-asterisk.manager.conf.in b/software/asterisk/template-asterisk.manager.conf.in new file mode 100644 index 0000000000000000000000000000000000000000..ce19a39205135918d2936215dcc4746dda5cd39e --- /dev/null +++ b/software/asterisk/template-asterisk.manager.conf.in @@ -0,0 +1,17 @@ +; +; Asterisk Call Management support +; +[general] +enabled = yes +port = $${:port} +bindaddr = $${:ip} + +[$${asterisk-manager-login:passwd}] +secret = $${asterisk-manager-password:passwd} +deny=0.0.0.0/0.0.0.0 +permit=$${:ip}/255.255.255.0 +read = system,call,log,verbose,command,agent,user +write = system,call,log,verbose,command,agent,user + +; #include manager_additional.conf +; #include manager_custom.conf diff --git a/software/asterisk/template-freepbx-configuration.in b/software/asterisk/template-freepbx-configuration.in new file mode 100644 index 0000000000000000000000000000000000000000..caa4185c380c8c8729a91bfedad04d081352b1f8 --- /dev/null +++ b/software/asterisk/template-freepbx-configuration.in @@ -0,0 +1,15 @@ +<?php +$amp_conf['AMPDBUSER'] = '$${mariadb-freepbx-login:passwd}'; +$amp_conf['AMPDBPASS'] = '$${mariadb-freepbx-password:passwd}'; +$amp_conf['AMPDBHOST'] = 'unix($${mariadb-configuration:socket})'; +$amp_conf['AMPDBNAME'] = '$${mariadb-freepbx-database:passwd}'; +$amp_conf['AMPDBENGINE'] = 'mysql'; +$amp_conf['FPBXDBUGFILE'] = '$${:debug-log}'; +$amp_conf['FPBX_LOG_FILE'] = '$${:error-log}'; +$amp_conf['AMPORTAL_CONF_FILE'] = '$${freepbx-configuration:output}'; +$amp_conf['ASTMANAGERHOST'] = '$${asterisk-manager-configuration:ip}'; +$amp_conf['ASTMANAGERPORT'] = '$${asterisk-manager-configuration:port}'; +$amp_conf['ASTETCDIR'] = '$${directory:astetc}'; +$amp_conf['AMPMGRUSER'] = '$${asterisk-manager-login:passwd}'; +$amp_conf['AMPMGRPASS'] = '$${asterisk-manager-password:passwd}'; +require_once('$${directory:wwwhtml}/htdocs/admin/bootstrap.php'); diff --git a/software/asterisk/template-freepbx-copy-configuration.sh.in b/software/asterisk/template-freepbx-copy-configuration.sh.in new file mode 100644 index 0000000000000000000000000000000000000000..730c03606d0fad9e83522a4e2e22fa2546ff9b63 --- /dev/null +++ b/software/asterisk/template-freepbx-copy-configuration.sh.in @@ -0,0 +1,24 @@ +#!${dash:location}/bin/dash +# BEWARE: This file is operated by slapgrid +# BEWARE: It will be overwritten automatically + +${apache-php:location}/bin/php ${freepbx:location}/install_amp \ + --dbhost "unix($${mariadb-configuration:socket})" \ + --dbname $${mariadb-freepbx-database:passwd} \ + --username $${mariadb-freepbx-login:passwd} \ + --password $${mariadb-freepbx-password:passwd} \ + --webroot $${directory:wwwhtml} \ + --uid `echo "$USER"` \ + --gid "" \ + --debug \ + --engine asterisk + +# cp -v -a ${freepbx:location}/amp_conf/moh $${directory:astvarlib} +# # XXX mohmp3 +# cp -v -a ${freepbx:location}/amp_conf/agi-bin $${directory:astvarlib} +# cp -v -a ${freepbx:location}/amp_conf/astetc/* $${directory:astetc} +# cp -v -a ${freepbx:location}/amp_conf/bin/* $${directory:astvarlibbin} +# cp -v -a ${freepbx:location}/amp_conf/htdocs $${directory:wwwhtml} +# # cp -v -a ${freepbx:location}/amp_conf/sbin ${asterisk:location}/sbin +# cp -v -a ${freepbx:location}/amp_conf/sounds $${directory:astvarlib} + diff --git a/software/asterisk/template-mariadb-create-database.sh.in b/software/asterisk/template-mariadb-create-database.sh.in new file mode 100644 index 0000000000000000000000000000000000000000..6d1e916595ade0b6a1bbcf483c88c4541f5bb7d9 --- /dev/null +++ b/software/asterisk/template-mariadb-create-database.sh.in @@ -0,0 +1,16 @@ +#!${dash:location}/bin/dash +# BEWARE: This file is operated by slapgrid +# BEWARE: It will be overwritten automatically + +${mariadb:location}/bin/mysql_upgrade \ + --no-defaults \ + --user=root \ + --socket=$${mariadb-configuration:socket} + +${mariadb:location}/bin/mysql \ + --no-defaults \ + --user=root \ + --socket=$${mariadb-configuration:socket} \ + -B \ + < $${mariadb-create-database-sql:output} + diff --git a/software/asterisk/template-mariadb-create-database.sql.in b/software/asterisk/template-mariadb-create-database.sql.in new file mode 100644 index 0000000000000000000000000000000000000000..e27fb53fa695e36eabc97c96c0b99c82cd59c15a --- /dev/null +++ b/software/asterisk/template-mariadb-create-database.sql.in @@ -0,0 +1,6 @@ +CREATE DATABASE IF NOT EXISTS $${mariadb-freepbx-database:passwd}; +GRANT ALL PRIVILEGES ON $${mariadb-freepbx-database:passwd}.* TO $${mariadb-freepbx-login:passwd}@'%%' IDENTIFIED BY '$${mariadb-freepbx-password:passwd}'; +CREATE DATABASE IF NOT EXISTS $${mariadb-asterisk-database:passwd}; +GRANT ALL PRIVILEGES ON $${mariadb-asterisk-database:passwd}.* TO $${mariadb-asterisk-login:passwd}@'%%' IDENTIFIED BY '$${mariadb-asterisk-password:passwd}'; +FLUSH PRIVILEGES; +EXIT; diff --git a/software/asterisk/template-mariadb-init-database.sh.in b/software/asterisk/template-mariadb-init-database.sh.in new file mode 100644 index 0000000000000000000000000000000000000000..853e3684124d10ec578dac229bc9f3f23dc355a5 --- /dev/null +++ b/software/asterisk/template-mariadb-init-database.sh.in @@ -0,0 +1,17 @@ +#!${dash:location}/bin/dash +# BEWARE: This file is operated by slapgrid +# BEWARE: It will be overwritten automatically + +${mariadb:location}/bin/mysql \ + --no-defaults \ + --user=root \ + --socket=$${mariadb-configuration:socket} \ + $${mariadb-asterisk-database:passwd} \ + < ${freepbx:location}/SQL/cdr_mysql_table.sql + +${mariadb:location}/bin/mysql \ + --no-defaults \ + --user=root \ + --socket=$${mariadb-configuration:socket} \ + $${mariadb-freepbx-database:passwd} \ + < ${freepbx:location}/SQL/newinstall.sql diff --git a/software/asterisk/template-mariadb-service.sh.in b/software/asterisk/template-mariadb-service.sh.in new file mode 100644 index 0000000000000000000000000000000000000000..b472c18893da22b4dc6f199b319e8bc4f27a0404 --- /dev/null +++ b/software/asterisk/template-mariadb-service.sh.in @@ -0,0 +1,13 @@ +#!${dash:location}/bin/dash +# BEWARE: This file is operated by slapgrid +# BEWARE: It will be overwritten automatically + +# XXX if no directory +${mariadb:location}/scripts/mysql_install_db \ + --skip-name-resolve \ + --no-defaults \ + --datadir=$${directory:mariadb-data} \ + --basedir=${mariadb:location} + +exec ${mariadb:location}/bin/mysqld \ + --defaults-file=$${mariadb-configuration:output} diff --git a/software/asterisk/template-mariadb.cnf.in b/software/asterisk/template-mariadb.cnf.in new file mode 100644 index 0000000000000000000000000000000000000000..c8a12a1996bd900e6aacf8f652d0c822bd230a86 --- /dev/null +++ b/software/asterisk/template-mariadb.cnf.in @@ -0,0 +1,62 @@ +[mysqld] +# +# * Basic Settings +# +pid-file = $${mariadb-configuration:pid-file} +socket = $${mariadb-configuration:socket} +basedir = ${mariadb:location} +datadir = $${directory:mariadb-data} +tmpdir = $${directory:tmp} +skip-external-locking +skip-networking +# +# * Fine Tuning +# +key_buffer = 16M +max_allowed_packet = 16M +thread_stack = 128K +thread_cache_size = 8 +# +# * Query Cache Configuration +# +query_cache_limit = 1M +query_cache_size = 16M +# +# * Logging and Replication +# +# Both location gets rotated by the cronjob. +# Be aware that this log type is a performance killer. +#log = /var/log/mysql/mysql.log +# +log-error = $${mariadb-configuration:error-log} +# +# Here you can see queries with especially long duration +slow_query_log +slow_query_log_file = $${mariadb-configuration:slow-log} +long_query_time = 1 +log-queries-not-using-indexes +# +# The following can be used as easy to replay backup logs or for replication. +#server-id = 1 +log_bin = $${mariadb-configuration:bin-log} +# WARNING: Using expire_logs_days without bin_log crashes the server! See README.Debian! +expire_logs_days = 10 +max_binlog_size = 100M +#binlog_do_db = include_database_name +#binlog_ignore_db = include_database_name +# +# * InnoDB +# +# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/. +# Read the manual for more InnoDB related options. There are many! +# You might want to disable InnoDB to shrink the mysqld process by circa 100MB. +#skip-innodb +# + +[mysqldump] +quick +quote-names +max_allowed_packet = 16M + +[isamchk] +key_buffer = 16M