Howto Provision beroNet Gateways with XML file

From berofix - professional SIP gateway
Jump to: navigation, search

Overview

The new format of the Gateway's configuration-file and provisioning-file is the same. To get a basic provisioning-file (which contains the Gateway's configuration as the configuration of its installed apps can be retrieved by creating a configuration-backup.

To provision Firmware-Images and/or Apps the corresponding sections need to be added to this file.

File-Naming

The deferenciation between the new configuration-file-format and the old one is made through the files extension.

The extension has to be .config.xml to use the new format.

Style

The new configuration- / provisioning-file is formatted in a simplyfied XML-style. Its basic structure is as follows:

<?xml version="1.0"?>
<beroNetProvisioning>
	<Config>
		<Update>[yes|no]</Update>
		<File>
			<Name>FILENAME</Name>
			<Contents>
FILE-CONTENTS
			</Contents>
		</File>
	</Config>
	<Firmware>
		<Install>[yes|no]</Install>
		<Filename>FIRMWARE.[tar.gz|fw]</Filename>
	</Firmware>
</beroNetProvisioning>

If the configuration is updated during provisioning is set in the Update-field. If a configuration is imported through the Backup/Restore functionality of the Gateways GUI og API this field is ignored and the changes are applied in any case.

Each configuration-file has its File-section which contains the fields Name for the filename and Contents for the contents of the respective configuration-file. The contents of a file can be edited directly.

When provisioning a firmware to a gateway, the section Firmware has to contain the fields Install and Filename. The Firmware is only provisioned, if the installed version is older than the provisioned.

Provisioning of Apps

Apps can be provisioned by putting the App-Installation-Package into the same folder as the provisioning-file and adding the following section it:

	<Apps>
		<App>
			<Install>[yes|no]</Install>
			<Filename>APP_INSTALL_PACKAGE.tar.gz</Filename>
		</App>
	</Apps>

The Apps-Section can contain several App-subsections.

Provisioning of App-Configurations

App-Configurations can also be provisioned. Normal text-files will work without base64-encoding, binary databases and XML-files need to be base64-encoded.

An Example of App-Configuration-Provisioning can be found below:

	<AppConfig>
		<App>
			<Name>OpenPBX</Name>
			<File>
				<Name>OpenPBX/OpenPBX.db</Name>
				<Mode>binary</Mode>
				<Content>
BASE64_ENCODED_BINARY_DATA==
				</Content>
			</File>
			<File>
				<Name>OpenPBX/asterisk</Name>
				<Mode>directory</Mode>
			</File>
			<File>
				<Name>OpenPBX/settings</Name>
				<Mode>directory</Mode>
			</File>
			<File>
				<Name>OpenPBX/asterisk/extensions.conf</Name>
				<Mode>text</Mode>
				<Content>
[general](+)
static=yes
writeprotect=no

[default]

[globals]
CONSOLE=Console/dsp			; Console interface for demo

[macro-dialintern]
exten=>s,1,Set(DAD=${ARG1})

;Sample for CFWD
exten=>s,n,Set(CFWD=${DB(CFWD/${DAD})})
exten=>s,n,GotoIf($["${CFWD}"!="0"]?cfwd)
exten=>s,n,Dial(SIP/${DAD},60,t)
exten=>s,n,GotoIf($["${DIALSTATUS}"="BUSY"]?busy)
exten=>s,n,GotoIf($["${DIALSTATUS}"!="BUSY"]?noanswer)
exten=>s,n,Goto(exit)

;busy
exten=>s,n(busy),NoOp(callstate: BUSY)
exten=>s,n,Set(CFB=${DB(CFB/${DAD})})
exten=>s,n,GotoIf($["${CFB}"="0"]?busy-busy)
exten=>s,n,GotoIf($["${CFB}"="vb"]?busy-vb)
exten=>s,n,Goto(intern,${CFB},1)
exten=>s,n,Goto(exit)
exten=>s,n(busy-busy),busy(20)
exten=>s,n,Goto(exit)
exten=>s,n(busy-vb),NoOp(callstate: BUSY => VoiceMail)
exten=>s,n,Voicemail(${DAD},u)
exten=>s,n,Goto(exit)

;noAnswer
exten=>s,n(noanswer),NoOp(callstate: NoAnswer)
exten=>s,n,Set(CFU=${DB(CFU/${DAD})})
exten=>s,n,Gotoif($["${CFU}"="0"]?exit)
exten=>s,n,Gotoif($["${CFU}"="vb"]?noanswer-vb)
exten=>s,n,Goto(intern,${CFU},1)
exten=>s,n,Goto(exit)
exten=>s,n(noanswer-vb),NoOp(callstate: NoAnswer => VoiceMail)
exten=>s,n,Voicemail(${DAD},u)
exten=>s,n,Goto(exit)

;cfwd
exten=>s,n(cfwd),NoOp(callstate: CFWD)
exten=>s,n,Set(CFWD=${DB(CFWD/${DAD})})
exten=>s,n,GotoIf($["${CFWD}"="vb"]?cfwd-vb)
exten=>s,n(cfwd-vb),NoOp(callstate: CFWD => VoiceMail)
exten=>s,n,Voicemail(${DAD},u)
exten=>s,n,Goto(exit)
exten=>s,n,Goto(intern,${CFWD},1)
exten=>s,n,Goto(exit)

;exit
exten=>s,n(exit)NoOp(Exit)
exten=>s,n,HangUp

#include /apps/OpenPBX/etc/asterisk/extensions_OpenPBX.conf
				</Content>
			</File>
			<File>
				<Name>OpenPBX/asterisk/extensions_OpenPBX.conf</Name>
				<Mode>text</Mode>
				<Content>
; Generated by OpenPBX 'create_files_ext.php'
[OpenPBX]
exten => _openpbx-gatewayX.,1,Goto(intern/${EXTEN:15})

[intern]
; user 'testuser'
exten => 100,hint,SIP/testuser
exten => 100,1,NoOp(Incoming call for 100 - user testuser)
exten => 100,n,Macro(dialintern,testuser)
exten => 100,n,HangUp

include => outbound


[outbound]
				</Content>
			</File>
			<File>
				<Name>OpenPBX/asterisk/manager.conf</Name>
				<Mode>text</Mode>
				<Content>
[YmVyb1BCWF91c2VybmFtZV8yMDEy]
secret = YmVyb1BCWF9wYXNzd29yZF8yMDEy
permit=127.0.0.1/255.255.255.0
read = system,config,all,call,log,verbose,command,agent,user,originate
write = system,config,all,call,log,verbose,command,agent,user,originate
				</Content>
			</File>
			<File>
				<Name>OpenPBX/asterisk/sip.conf</Name>
				<Mode>text</Mode>
				<Content>
[general](+)
context = default			; Default context for incoming calls
allowoverlap = no			; Disable overlap dialing support. (Default is yes)
srvlookup = yes				; Enable DNS SRV lookups on outbound calls
allow = ulaw				; dtmfmode = inband only works with ulaw or alaw!
defaultexpire = 60
allowsubscribe = yes
notifyringing = yes
notifyhold = yes
progressinband = yes

[default]
call-limit = 2

#include /apps/OpenPBX/etc/asterisk/sip_OpenPBX.conf
				</Content>
			</File>
			<File>
				<Name>OpenPBX/asterisk/sip_OpenPBX.conf</Name>
				<Mode>text</Mode>
				<Content>
; Generated by OpenPBX 'create_files_sip.php'

[general](+)
register => openpbx-gateway:openpbx-gateway@172.20.14.101

[openpbx-gateway]
context = inbound_openpbx-gateway
type = friend
host = 172.20.14.101
username = openpbx-gateway
secret = openpbx-gateway
proxy = 172.20.14.101
dtmfmode = rfc2833
fromuser = openpbx-gateway
disallow = all
allow = all

[testuser]
context = intern
type = friend
host = dynamic
username = testuser
secret = testuser
callerid = "testuser" <100>
dtmfmode = rfc2833
disallow = all
allow = alaw
nat = no
canreinvite = no
call-limit = 2
subscribecontext = intern
				</Content>
			</File>
			<File>
				<Name>OpenPBX/asterisk/voicemail.conf</Name>
				<Mode>text</Mode>
				<Content>
[general](+)
format = wav
attach = yes
skipms = 3000
maxmessage = 300
maxsilence = 10
silencethreshold = 128
maxlogins = 3
mailcmd = /apps/OpenPBX/bin/ssmtp -C /apps/OpenPBX/etc/ssmtp/ssmtp.conf -t
serveremail =
fromstring = OpenPBX VoiceMail
emailsubject = VoiceMail received from ${VM_CALLERID}
emailbody = Dear ${VM_NAME},\n\nYou have received a new VoiceMail from ${VM_CIDNUM} on ${VM_DATE} in mailbox ${VM_MAILBOX}\nThe VoiceMail is attached to this mail.\n\nOpenPBX\n

#include /apps/OpenPBX/etc/asterisk/voicemail_OpenPBX.conf
				</Content>
			</File>
			<File>
				<Name>OpenPBX/asterisk/voicemail_OpenPBX.conf</Name>
				<Mode>text</Mode>
				<Content>
[default]
				</Content>
			</File>
			<File>
				<Name>OpenPBX/settings/default</Name>
				<Mode>directory</Mode>
			</File>
			<File>
				<Name>OpenPBX/settings/default/snom.xml</Name>
				<Mode>binary</Mode>
				<Content>
BASE64_ENCODED_BINARY_DATA==
				</Content>
			</File>
		</App>
	</AppConfig>

Example provisioning file

<?xml version="1.0"?>
<beroNetProvisioning>
	<!-- Created on 2014-01-01T00:02:26+00:00 -->
	<Config>
		<Update>yes</Update>
		<File>
			<Name>hardware.conf</Name>
			<Contents>
[lif0]
type=none
master=0


[lif1]
type=none
master=0


[pcm]
type=pcm
master=0
			</Contents>
		</File>
		<File>
			<Name>isgw.analog</Name>
			<Contents>
[general]
			</Contents>
		</File>
		<File>
			<Name>isgw.cas</Name>
			<Contents>
[general]
			</Contents>
		</File>
		<File>
			<Name>isgw.causes</Name>
			<Contents>
;FROM	TO	INCAUSE	OUTCAUSE	OUTTEXT
SIP	ISGW	901	503	No channel processing resources
SIP	ISGW	902	503	No free ISDN channels
SIP	ISGW	903	503	No resources
SIP	ISGW	904	404	Number not in dialplan
SIP	ISGW	905	603	Invalid number
SIP	ISGW	906	503	No free ISDN channels (ports are down)
SIP	ISGW	907	503	No free ANALOG ports
SIP	ISGW	908	503	No free ANALOG ports (ports are down)
SIP	ISGW	910	503	No free GSM ports
SIP	ISGW	911	503	No free dialplan destination
SIP	ISGW	912	503	ISDN timeout
SIP	ISGW	913	503	Not Enough SIP Licenses
SIP	ISDN	1	404	Unallocated number
SIP	ISDN	2	404	No Route to Network
SIP	ISDN	3	404	No Route To Destination
SIP	ISDN	17	486	User busy
SIP	ISDN	18	408	Request Timeout
SIP	ISDN	19	480	Temporarily Unavailable
SIP	ISDN	20	480	Temporarily Unavailable
SIP	ISDN	21	603	Forbidden
SIP	ISDN	22	410	Gone
SIP	ISDN	23	410	Gone
SIP	ISDN	26	404	Not Found
SIP	ISDN	27	502	Bad Gateway
SIP	ISDN	28	484	Address Incomplete
SIP	ISDN	29	510	Not Implemented
SIP	ISDN	31	480	Temporarily Unavailable Resource Unavailable
SIP	ISDN	34	503	Service Unavailable
SIP	ISDN	38	503	Service Unavailable
SIP	ISDN	41	503	Service Unavailable
SIP	ISDN	42	503	Service Unavailable
SIP	ISDN	47	503	Service Unavailable Service or Option not available
SIP	ISDN	55	403	Forbidden
SIP	ISDN	57	403	Forbidden
SIP	ISDN	58	503	Service Unavailable
SIP	ISDN	65	488	Not Acceptable Here
SIP	ISDN	70	488	Not Acceptable Here
SIP	ISDN	79	501	Not Implemented
SIP	ISDN	87	403	Forbidden
SIP	ISDN	88	503	Service Unavailable
SIP	ISDN	102	504	Gateway Timeout
SIP	ISDN	111	504	Server internal error Interworking
SIP	ISDN	127	500	Server Internal Error
SIP	ISDN	ANY	486	Busy here
ISDN	ISGW	901	17
ISDN	ISGW	902	34
ISDN	ISGW	903	17
ISDN	ISGW	904	1
ISDN	ISGW	906	34
ISDN	ISGW	915	21
ISDN	SIP	400	41
ISDN	SIP	401	21
ISDN	SIP	402	21
ISDN	SIP	403	21
ISDN	SIP	404	1
ISDN	SIP	405	63
ISDN	SIP	406	79
ISDN	SIP	407	21
ISDN	SIP	408	102
ISDN	SIP	410	22
ISDN	SIP	413	127
ISDN	SIP	414	127
ISDN	SIP	415	79
ISDN	SIP	416	127
ISDN	SIP	421	127
ISDN	SIP	423	127
ISDN	SIP	480	18
ISDN	SIP	481	41
ISDN	SIP	482	25
ISDN	SIP	483	25
ISDN	SIP	484	28
ISDN	SIP	485	1
ISDN	SIP	486	17
ISDN	SIP	500	41
ISDN	SIP	501	79
ISDN	SIP	502	38
ISDN	SIP	503	41
ISDN	SIP	504	102
ISDN	SIP	505	127
ISDN	SIP	513	127
ISDN	SIP	600	17
ISDN	SIP	603	21
ISDN	SIP	604	1
ISDN	SIP	ANY	17
SIP	ANALOG	17	486	Busy here
SIP	ANALOG	21	603	Rejected
SIP	ANALOG	ANY	486	Busy here
			</Contents>
		</File>
		<File>
			<Name>isgw.conf</Name>
			<Contents>
[general]
statusport=54322
logserver=127.0.0.1:54323
logging_active=1
logging_message=1
loglevel_message=
syslog_facility=16
reject_calls_under_load=0
pcm_server=0
pcm_server_port=54329
logcdr=1
msp_bridging=YES
experimental_options=
			</Contents>
		</File>
		<File>
			<Name>isgw.cpt</Name>
			<Contents>

			</Contents>
		</File>
		<File>
			<Name>isgw.dialplan</Name>
			<Contents>
;From	To	FromID	ToID	Destination	NewDestination	Source	NewSource	Config
sip	sip	192.168.0.2	192.168.0.3	(.*)	\1	(.*)	\1
			</Contents>
		</File>
		<File>
			<Name>isgw.gsm</Name>
			<Contents>
[general]
pin=
smsc=
			</Contents>
		</File>
		<File>
			<Name>isgw.isdn</Name>
			<Contents>
[general]
time_from_isdn=
			</Contents>
		</File>
		<File>
			<Name>isgw.sip</Name>
			<Contents>
[general]
sip_address=sip:0.0.0.0:5060
udpports=6000-7000
sip_transport=udp
ssl_version=
tos_rtp=160
tos_sip=160
rtp_port_selection=
			</Contents>
		</File>
		<File>
			<Name>isgw.tdm</Name>
			<Contents>
; isgw.tdm: autogenerated by /usr/local/sbin/mktdmconf (Wed Jan  1 00:01:25 GMT 2014)

; tdm_delay: bus clocks_delay_transmitter clocks_delay_receiver
tdm_delay 1 14 14
tdm_delay 2 14 14

; clock_mode: bus mode_transmitter mode_receiver  (single_clock/double_clock)
clock_mode 1 double_clock double_clock
clock_mode 2 double_clock double_clock

; frame_edge: bus frame_edge_detect (on_rising/on_falling)
frame_edge 1 on_falling
frame_edge 2 on_falling

; receive_clock_edge: bus frame_edge_detect (on_rising/on_falling)
receive_clock_edge 1 on_rising
receive_clock_edge 2 on_rising

; timeslot: bus port channel timeslot
timeslot 1 1 1 0
timeslot 2 2 1 0
			</Contents>
		</File>
		<File>
			<Name>misc.conf</Name>
			<Contents>
[general]
ntphost=
timezone=
root-version=29
lan-iface=eth0
lan-ipaddr=
lan-netmask=
lan-gateway=
lan-nameserver=
lan-dhcp=1
hostname=
msp-iface=eth1
msp-ipaddr=auto
app-image=appfs-15-06-03-15_02.fw
app-status=running
lan-mtu=1500
use-boot-prov=
tftp-host=
tftp-url=
provisioning-option=
vlan-enable=
vlan-id=
routing=
routing=
cifs_log_enabled=
cifs_log_share=
cifs_log_user=
cifs_log_password=
cifs_log_domain=
snmp-enabled=
snmptraps=
snmptraps_sink=
snmptraps_intervall=
snmp-community-ro=
snmp-community-rw=
snmp-community-trap=
httpsOnly=
cloud_enable=
cloud_key=
vlan-prio=
userapp-enabled=1
userapp-user-enabled=1
beroAvahi-enabled=
system-check-enabled=
safeguard=
cloudAddress=berocloud.beronet.com
proxyEnabled=
proxyAddress=
proxyPort=
proxyType=
proxyUser=
proxySecret=
summer_winter_time=
set_hw=
bnfos-ipaddr=
bnfos-mac=
bnfos-intv=
bnfos-hb-on-boot=
admin-pass=d73b128b9c86524c362ab4420c987827:f2
admin-user=admin
sessions-disable=0
excludelan=
			</Contents>
		</File>
		<File>
			<Name>network.acl</Name>
			<Contents>
INPUT;;80;0.0.0.0/0;ACCEPT
INPUT;;443;0.0.0.0/0;ACCEPT
INPUT;;5060;0.0.0.0/0;ACCEPT
INPUT;;5061;0.0.0.0/0;ACCEPT
INPUT;;65001;0.0.0.0/0;ACCEPT
INPUT;;161;0.0.0.0/0;ACCEPT
INPUT;;162;0.0.0.0/0;ACCEPT
			</Contents>
		</File>
	</Config>
	<Firmware>
		<Install>yes</Install>
		<Filename>appfs-3.1.tar.gz</Filename>
	</Firmware>
</beroNetProvisioning>