[app]
	name = asterisk
	metrics = asterisk.*
	private charts = yes
	gaps when not collected = no

[dictionary]
	# https://www.voip-info.org/asterisk-variable-hangupcause/
	q931.1 = unallocated 1
	q931.2 = no route transit net 2
	q931.3 = no route destination 3
	q931.6 = channel unacceptable 6
	q931.7 = call awarded delivered 7
	q931.16 = normal 16
	q931.17 = busy 17
	q931.18 = no response 18
	q931.19 = no answer 19
	q931.21 = rejected call 21
	q931.22 = number changed 22
	q931.27 = dst out of order 27
	q931.28 = invalid number 28
	q931.29 = rejected facility 29
	q931.30 = response to status 30
	q931.31 = normal unspecified 31
	q931.34 = congestion circuit 34
	q931.38 = net out of order 38
	q931.41 = normal tmp fail 41
	q931.42 = congestion switch 42
	q931.43 = access info discarded 43
	q931.44 = requested chan unavail 44
	q931.45 = pre empted 45
	q931.47 = resource unavailable, unspecified 47
	q931.50 = facility not subscribed 50
	q931.52 = outgoing call barred 52
	q931.54 = incoming call barred 54
	q931.57 = bearer capability not auth 57
	q931.58 = bearer capability not avail 58
	q931.65 = bearer capability not implemented 65
	q931.66 = chan not implemented 66
	q931.69 = facility not implemented 67
	q931.81 = invalid call reference 81
	q931.88 = incompatible destination 88
	q931.95 = invalid msg specified 95
	q931.96 = mandatory ie missing 96
	q931.97 = message type non exist 97
	q931.98 = wrong message 98
	q931.99 = ie non exist 99
	q931.100 = invalid ie contents 100
	q931.101 = wrong call state 101
	q931.102 = recovery on timer expire 102
	q931.103 = mandatory ie length error 103
	q931.111 = protocol error 111
	q931.127 = interworking 127


[channels]
	name = channels
	title = Active Channels
	family = channels
	context = asterisk.channels
	units = channels
	priority = 91000
	type = stacked
	dimension = pattern asterisk.channels.count 'channels' last 1 1
	# FIXME: netdata needs to prevent this from going negative

[endpoints]
	name = endpoints
	title = Active Endpoints
	family = endpoints
	context = asterisk.endpoints
	units = endpoints
	priority = 91005
	type = stacked
	dimension = pattern asterisk.endpoints.count 'endpoints' last 1 1

[endpoints_by_status]
	name = endpoints_by_status
	title = Active Endpoints by Status
	family = endpoints
	context = asterisk.endpoints_by_status
	units = endpoints
	priority = 91006
	type = stacked
	dimension = pattern asterisk.endpoints.state.* '' last 1 1

[sip_channels_by_endpoint]
	name = sip_channels_by_endpoint
	title = Active SIP channels by endpoint
	family = channels
	context = asterisk.sip_channels_by_endpoint
	units = channels
	priority = 91110
	type = stacked
	dimension = pattern asterisk.endpoints.SIP.*.channels '' last 1 1

[pjsip_channels_by_endpoint]
	name = pjsip_channels_by_endpoint
	title = Active PJSIP channels by endpoint
	family = channels
	context = asterisk.pjsip_channels_by_endpoint
	units = channels
	priority = 91111
	type = stacked
	dimension = pattern asterisk.endpoints.PJSIP.*.channels '' last 1 1

[dialstatuses]
	name = dialstatuses
	title = Distribution of Dial Statuses
	family = dial_statuses
	context = asterisk.dialstatus
	units = calls
	priority = 91150
	type = stacked
	dimension = pattern 'asterisk.dialstatus.*' '' last 1 1

[calltime]
	name = calltime
	title = Asterisk Channels Call Duration
	family = calltime
	context = asterisk.calltime
	units = milliseconds
	priority = 91160
	type = stacked
	dimension = asterisk.channels.calltime 'calltime' average 1 1
	dimension = asterisk.channels.calltime 'sum'      sum     1 1 hidden
	dimension = asterisk.channels.calltime 'count'    events  1 1 hidden

[hangupcause]
	name = hangupcause
	title = Distribution of Hangup Causes
	family = hangup_causes
	context = asterisk.hangupcause
	units = calls
	priority = 91200
	type = stacked
	dimension = pattern 'asterisk.hangupcause.*' 'q931.' last 1 1

[hangupcause_answer]
	name = hangupcause_answer
	title = Distribution of Hangup Causes for ANSWERed calls
	family = hangup_causes
	context = asterisk.hangupcause_answer
	units = calls
	priority = 91210
	type = stacked
	dimension = pattern 'asterisk.dialhangupcause.ANSWER.*' 'q931.' last 1 1

[hangupcause_busy]
	name = hangupcause_busy
	title = Distribution of Hangup Causes for BUSY calls
	family = hangup_causes
	context = asterisk.hangupcause_busy
	units = calls
	priority = 91215
	type = stacked
	dimension = pattern 'asterisk.dialhangupcause.BUSY.*' 'q931.' last 1 1

[hangupcause_cancel]
	name = hangupcause_cancel
	title = Distribution of Hangup Causes for CANCELled calls
	family = hangup_causes
	context = asterisk.hangupcause_cancel
	units = calls
	priority = 91220
	type = stacked
	dimension = pattern 'asterisk.dialhangupcause.CANCEL.*' 'q931.' last 1 1

[hangupcause_chanunavail]
	name = hangupcause_chanunavail
	title = Distribution of Hangup Causes for CHANUNVAILed calls
	family = hangup_causes
	context = asterisk.hangupcause_chanunavail
	units = calls
	priority = 91230
	type = stacked
	dimension = pattern 'asterisk.dialhangupcause.CHANUNAVAIL.*' 'q931.' last 1 1

[hangupcause_congestion]
	name = hangupcause_congestion
	title = Distribution of Hangup Causes for CONGESTIONed calls
	family = hangup_causes
	context = asterisk.hangupcause_congestion
	units = calls
	priority = 91240
	type = stacked
	dimension = pattern 'asterisk.dialhangupcause.CONGESTION.*' 'q931.' last 1 1

[events]
	name = events
	title = Asterisk Dialplan Events
	family = events
	context = asterisk.events
	units = events/s
	priority = 91400
	type = stacked
	dimension = pattern 'asterisk.stasis.message.ast_channel_*_type' '' last 1 1

[qualify]
	name = qualify
	title = Asterisk PJSIP Peers Qualify
	family = qualify
	context = asterisk.qualify
	units = milliseconds
	priority = 91500
	type = stacked
	dimension = pattern 'asterisk.PJSIP.contacts.*.rtt' '' max 1 1
	# FIXME: netdata needs to set update every = 15 on this
