📜 ⬆️ ⬇️

Testing Digium phones with Asterisk and setting up Smart BLF

Previously, our company's specialists tested Digium phones with Switchvox unified communications and one of the most common free distributions of AsteriskNow . And finally, we got to the “naked” Asterisk.

In this review, we will look at how to configure the device using the Digium handset interaction module with Asterisk - DPMA (Digium Phone Module for Asterisk), as well as setting up a Smart BLF.

All interested in asking under the cat.

So, let's begin.
')
First of all, you need to order a DPMA license on the official website of the manufacturer: store.digium.com/productview.php?product_code=804-00032
The license is free, but nonetheless the product still requires registration. Literally in a few minutes, an email from Digium with an activation code arrives. Naturally, to get a license you need to register on the site.

After obtaining the license, you need to download the register utility:

wget http://downloads.digium.com/pub/register/x86-32/register 


Next, we change the permissions for the register utility:

 chmod 500 /root/register 


And run it:

 /root/register 


Further, following the prompts of the wizard, we perform all the necessary manipulations:

Click 1, then 11.

And finally, enter the key sent to us from Digium.

We “read” the terms of the license agreement, enter the necessary data for registration.

And we see in the terminal the inscription that the license was successfully recorded.

It should be noted that in order for the license to be successfully activated, the server must have access to the Internet, because The utility climbs onto the Digium server for registration.

Go to the next step: download the DPMA module

 # cd /root # wget http://downloads.digium.com/pub/telephony/res_digium_phone/asterisk-11.0/x86-32/res_digium_phone-11.0_1.4.0.tar.gz 


Unzip and copy the res_digium_phone.so file to the folder with Asterisk modules (default / usr / lib / asterisk / modules /):

 tar xzvf res_digium_phone-11.0_1.4.0.tar.gz # cp /root/res_digium_phone-11.0_1.4.0/res_digium_phone.so /usr/lib/asterisk/modules 


Copy the configuration file to the asterisk configs folder (by default / etc / asterisk /):

 cp /root/res_digium_phone-11.0_1.4.0/res_digium_phone.conf.sample /etc/asterisk/res_digium_phone.conf 


Load the module:

 asterisk -rx "module load res_digium_phone.so" 


Connect to Asterisk, check license validity:

 #asterisk -rvvv *CLI> digium_phones license status OK, Valid product license found 


DPMA license is tied to the mac-address of your network card, in case of its replacement, you either have to re-register the module or replace the mac-address of a new network card

So, go to the phone settings.

In sip.conf we create users:
 [general] 

 accept_outofcall_message = yes
 outofcall_message_context = dpma_message_context
 auth_message_requests = no
 callcounter = yes

 [000] 
 type = friend 
 host = dynamic 
 context = dpma_phones 
 secret = qwaszx 
 mailbox = 000 
 qualify = yes 


 [111] 
 type = friend 
 host = dynamic 
 context = dpma_phones 
 secret = qwaszx 
 mailbox = 111 
 qualify = yes 


 [222] 
 type = friend 
 host = dynamic 
 context = dpma_phones 
 secret = qwaszx 
 mailbox = 222 
 qualify = yes 

 [333] 
 type = friend 
 host = dynamic 
 context = dpma_phones 
 secret = qwaszx 
 mailbox = 333 
 qualify = yes 

 [444] 
 type = friend 
 host = dynamic 
 context = dpma_phones 
 secret = qwaszx 
 mailbox = 444 
 qualify = yes 


 [555] 
 type = friend 
 host = dynamic 
 context = dpma_phones 
 secret = qwaszx 
 mailbox = 555 
 qualify = yes 


 [666] 
 type = friend 
 host = dynamic 
 context = dpma_phones 
 secret = qwaszx 
 mailbox = 666 
 qualify = yes 

 [777] 
 type = friend 
 host = dynamic 
 context = dpma_phones 
 secret = qwaszx 
 mailbox = 777 
 qualify = yes 

 [888] 
 type = friend 
 host = dynamic 
 context = dpma_phones 
 secret = qwaszx 
 mailbox = 888 
 qualify = yes 


 [999] 
 type = friend 
 host = dynamic 
 context = dpma_phones 
 secret = qwaszx 
 mailbox = 999 
 qualify = yes 


For convenience, I called them phone numbers.

In extensions.conf, we create rules for these subscribers:
 [dpma_phones] 

 include = parkedcalls 
 exten => XXX, hint, SIP / $ {EXTEN}
 exten => XXX, 1, Dial (SIP / $ {EXTEN}, 20) 
 same => n, Voicemail ($ {EXTEN}, $ {IF ($ ["{DIALSTATUS}" = "BUSY"]? b: u)}) 
 same => n, hangup ()



Set up mailboxes for our subscribers in voicemail.conf:
 [default] 
 000 => 1234,000 
 111 => 1234.111 
 222 => 1234,222 
 333 => 1234,333 
 444 => 1234,444 
 555 => 1234,555 
 666 => 1234,666 
 777 => 1234,777 
 888 => 1234,888 
 999 => 1234,999 



Next, go directly to the configuration file res_digium_phone.conf.

The file structure is divided into several required sections:


Let us dwell on each:

General Section
server_uuid
line
A unique name for your server.
Used by Voice Mail
to provide access to subscriber
mailboxes. Optional.
globalpin
number; for example: 10101019
Optional pin code for getting the config file and firmware
userlist_auth
disabled, globalpin
Indicates the receipt authentication method.
contact list. Two values: either disabled,
or authorization by global pin code.
config_auth
mac, pin, globalpin, disabled
Indicates the method of getting the config.
Or mac-address authentication,
either by pin-code or by global pin-code,
either disabled and any phone
can pick up any config
mdns_address
IP address or host name
Server address from which DPMA will receive
config via mDNS
mdns_port
Port, default 5060
The port that DPMA will knock on
service_name
String, for example Digium Phones Config Server
Server name
service_discovery_enabled
yes / no
Permission to find configuration servers
file_directory
Directory, for example / var / lib / asterisk / digium_phones
The folder in which the xml-files are contacts


Network section (section is optional for DPMA versions 1.2 and below, is required in new versions)
alias
String, for example MyNetwork
Network name
alternate_registration_address
IP address or hostname
Alternative registration address (if the primary is not available)
alternate_registration_port
Port number, for example: 5060
Alternative port of registration (if the primary is not available)
cidr
CIDR, for example 198.51.100.1/24
Network address mask
file_url_prefix
URL, for example: http://10.10.10.10/file_package_directory
The prefix of the URL from which the phone should receive information about the firmware,
logo, ringtone and smart blf (required!
A web server is required for correct operation, for example apache)
network_vlan_discovery_mode
NONE, MANUAL, LLDP
Vlan information
network_vlan_id
0-4095
Assigns vlan number (if any)
ntp_server
hostname, IP address, eg ntp.mycompany.com
NTP server
pc_qos
Integer (0-7)
QoS for PC port
pc_vlan_id
(Integer (0-4095)
Assigns vlan PC port
public_firmware_url_prefix
URL
Public URL prefix
from which the phone should receive information
about firmware in case of inaccessibility of the main server,
leads to the Digium server. Must have the form:
/VERSION/VERSION_MODEL_firmware.eff
registration_address
IP address or Hostname
Registration Server Address
registration_port
Port, as an Integer; eg 5060
Registration Server Port
rtp_dscp
Integer (0-63)
DSCP RTP
rtp_qos
Integer (0-7)
RTP QoS
sip_dscp
Integer (0-63)
SIP DSCP
sip_qos
Integer (0-7)
SIP QoS
syslog_level
debug, error, warning, information
Logging level of system messages
syslog_port
port, for example 514
The default port for system messages is 514.
syslog_server
hostname, IP address, for example syslog.mycompay.com
Server address to which system messages are sent.
udp_ka_interval
Time in seconds
Specifies the interval at which phones send keep-alive
messages, default is 0, never


Phone section
network
"network" in res_digium_phone.conf
The network name specified in the previous section
firmware
"firmware" in res_digium_phone.conf
Firmware name
mac
MAC address, for example, 0123456789ab
Mac address
pin
number for example 10101019
PIN code for configs
group_pin
number for example 101010109
Pin for grouped phones
line
line in res_digium_phone.conf
line (must be named the same as user in sip.conf)
external_line
external_line to res_digium_phone.conf
An external line not registered on your asterisk server
application
attachment
attachment
config_file
file, for example mycustomconfig.xml
DPMA automatically generates a configuration file for each phone based on the lines that are attached to the phone, but you can create a separate configuration file.
full_name
string for example Bob Johnson
Subscriber's full name
contact
file, for example, contacts.xml
Contacts XML
contacts_display_rules
a file, for example mydisplayrules.xml
XML file from file_directory with contact mapping rules.
blf_contact_group
String, for example “office-contacts”
Group. Obligatory field
blf_items
file, for example blfitems.xml
Xml file with settings for the behavior of speed dial buttons
contacts_max_subscriptions
number for example 40
Maximum number of phone registrations, default 40
timezone
Time zone for example
America / Chicago
Time zone
ntp_resync
time in seconds
Ntp sync interval
parking_exten
extension, for example, 700
Parking number
parking_transfer_type
blind / attended
Transfer type
ringtone
The name of the ringtone
Option loading the necessary ringtones to your phone
active_ringtone
Alarm, Chimes, Digium, GuitarStrum, Jingle, Office2, Office, RotaryPhone, SteelDrum, Techno,
Theme, Tweedle, Twinkle, Vibe or the name of your ringtone
Active ringtone
web_ui_enabled
no / yes
The availability of the web interface of the phone, the default when using DPMA
- the ability to access the phone via the web interface is disabled f
record_own_calls
no / yes
An option to record your own conversations.
During an active conversation with the option turned on, the “record” button will appear on the display, disabled by default.
alert
name
Warning message name
blf_unused_linekeys
no / yes
An option to use the line buttons as speed dial buttons.
send_to_vm
yes / no
Option, if inactive, the “send to mailbox” button is removed from the phone
use_local_storage
yes / no
When using this option, contacts will be stored directly in the phone.
d40_logo_file
line
Logo for Digium D40, png 150x45 pixels, 10kb
d50_logo_file
line
Logo for Digium D50, png 150x45 pixels, 10kb
d70_logo_file
line
Logo for Digium D40, png 205x85 pixels, 10kb
ehs
auto, plantronics, jabra_iq
Defines the type of headset to be connected.
lock_preferences
yes / no
The option allows you to assign settings to a specific phone.
login_password
number for example 789
Password to access the web interface
accept_local_calls
any, host
Allows you to receive calls either from the SIP server on which the phone is registered, or from anywhere
display_mc_notification
yes / no
An option that determines the display of information about missed calls
brightness
number, 0-10
Brightness, default 5
contrast
number, 0-10
Contrast, default 5
dim_backlight
yes, no
Screen dimming
backlight_timeout
number in seconds (0-3200)
Time to dim screen
backlight_dim_level
number (0-10)
The brightness level when the screen is dark
active_locale
de_DE, en_AU, en_CA, en_GB, en_US, es_ES, es_MX,
fr_BE, fr_CA, fr_FR, it_IT, nl_BE, nl_NL, pt_BR, pt_PT
Localization settings
ringer_volume
number (0-10)
Ring volume
speaker_volume
number (0-10)
Microphone volume
handset_volume
number (0-10)
Speaker tube volume
headset_volume
number (0-10)
Headset volume
handset_sidetone_db
number for example -25
The increase in the signal tube, dB
headset_sidetone_db
number for example -15
Headset signal increase factor, dB
reset_call_volume
yes / no
If this option is enabled, but the volume settings during one conversation are not saved after its completion
headset_answer
yes / no
Sets to use a headset or handset.
name_format
first_last, last_first
Setting the display of the full name of the contact
lan_port_mode
auto, 10hd, 10fd, 100hd, 100fd, 1000fd
LAN port mode
pc_port_mode
auto, 10hd, 10fd, 100hd, 100fd, 1000fd, off
PC port mode
enable_check_sync
yes / no
Permission to respond to SIP synchronization requests


Line section
exten
string for example 1000
Extension from sip.conf
digit_map
line
Dialing Rules
line_label
line
The name of the line that will be displayed on the phone
mailbox
mailbox from voicemail.conf
Mailbox from voicemail.conf
voicemail_uri
Stoka, in sip: user @ host format
Your mailbox URI, accessible by clicking the “Msgs” button
outboundproxy_address
Host / IP Address
Your SIP Server Address
outboundproxy_port
Port
Port of your SIP server
transport
udp, tcp
Transport method
reregistration_timeout
number in seconds
Number of seconds before re-registration
registration_retry_interval
number in seconds
Interval in seconds between requests for permission to re-register
registration_max_retries
number in seconds
Maximum number of registration attempts
secret
string, mymagicpassword
Password is required if the extension information is in ARA and not in sip.conf
context
Asterisk dialplan context
Context, required if the extension information is in ARA, not in sip.conf
callerid
caller id string, eg "Bob Jones" <1234>
Caller-ID, required if the extension information is in ARA and not in sip.conf
subscribecontext
Asterisk dialplan context
Context, if defined here, overwrites context data, overwriting data from sip.conf


External Line Section
server_address
string, for example otherpbx.othercompany.com
SIP server address
server_port
number
SIP server port
transport
tcp or udp
Transport method
secondary_server_address
string, for example backuppbx.othercompany.com
The address of the SIP server to which the phone will contact if the primary is not available
secondary_server_port
number
The port of the SIP server to which the phone will contact if the primary is not available
secondary_server_transport
tcp or udp
Transport method
userid
string, for example bob1234
Username, default = line name
authname
string, for example bob1234
SIP authorization name, if different from userid, the field must be filled
secret
line
password
register
yes / no
check in
callerid
line
Caller ID



Application - application configuration section, contains both standard applications and allows you to set your own application.
Queues Application

queue
string
Queue identifier defined in file queues.conf
membername
string
Name of the queue member, default = fullname from the [phone] section
location
Asterisk queue member location, eg Local / 6002 @ ext-queue / n
Location according to a given pattern
member
yes / no
Member / non member queue
permission
status, overview, details
The level of user access to the queue
login_exten
Asterisk extension @ context, eg * 451234 @ ext-queue
Number to dial in to queue up
logout_exten
Asterisk extension @ context, eg * 451234 @ ext-queue
Number to dial to log out of the queue


Status Application

status
available, dnd, away, xa, chat
Type of status
substatus
string
Add. status
send486
yes / no
If set, the phone will return error 486 to Asterisk.


Parking Application (parking application)

parkinglot
string
The name of the parking extension specified in the features.conf file


Voicemail Applications

translation
identifier of a type = voicemail section
Sets the localization of voicemail


Custom Applications (your own javascript application)

name
string
name
filename
string
the .zip file of the archive with the application, which lies in the folder defined by the file_url_prefix parameter.
autostart
yes / no
Startup at phone startup
key
value
Optional parameters that can be passed to the application


Ringtone section
alias
string
The name of the ringtone, for example FancyRinger.
filename
string
The name of your own ringtone, 16-bit 16kHz mono, not .wav, should be in file_url_prefix.


Alert section
alert_info
string
The header of the alert message that the phone must wait for when using this option
ring_type
normal, answer, ring-answer, visual
Call type
ringtone
Alarm, Chimes, Digium, GuitarStrum, Jingle,
Office2, Office, RotaryPhone, SteelDrum, Techno, Theme, Tweedle,
Twinkle, vibe, or one of the context names where type = ringtone
ringtone


Firmware section
model
D40, D50, D70
Phone model
version
version string identifier of firmware
Software version, file with ".eff"
file
string
The name of the software file located in the folder defined in the file_url_prefix network
public_firmware
yes, no
use of software on Digium public server, in case your server is unavailable


Translation Section
key
line
Sets the value to be replaced by the specified



For example:
 [voicemail_de_DE] type=translation INBOX=INBOX Work=Arbeit Family=Familie Friends=Freunde Recordings=Aufnahmen 


So, we have disassembled all sections of the res_digium_phone.conf configuration file

Below is a listing of my used config:
[general]
server_uuid = abcdefg123
globalpin = 1234
userlist_auth = disabled
config_auth = disabled
mdns_address = 192.168.1.253
mdns_port = 5060
service_name = Go 4 Phones
service_discovery_enabled = yes
file_directory = / var / lib / asterisk / digium_phones

[network1]
type = network
alias = My Default Network
cidr = 192.168.1.0 / 24
registration_address = 192.168.1.253
registration_port = 5060
; alternate_registration_address = 192.168.50.1
; alternate_registration_port = 5080

file_url_prefix = http: //192.168.1.253

; public_firmware_url_prefix = http: //dphone.dl.digium.com/firmware/asterisk/
ntp_server = 0.digium.pool.ntp.org
network_vlan_discovery_mode = NONE
sip_qos = 3
rtp_qos = 6
network_vlan_id = 4
pc_vlan_id = 10
pc_qos = 2
sip_dscp = 24
rtp_dscp = 46
udp_ka_interval = 60

[000]
type = phone
network = network1
; firmware = 1.1Firmware
; mac = 000fd306b59b
line = 000
line = 111
line = 222
line = 333
full_name = Mikhail
timezone = Europe / Moscow
ntp_resync = 86400
parking_exten = 700
parking_transfer_type = blind
ringtone = FancyTone
active_ringtone = GuitarStrum
web_ui_enabled = yes
record_own_calls = yes
alert = fancyringer
blf_unused_linekeys = no
send_to_vm = yes
use_local_storage = no
ehs = auto
lock_preferences = no
login_password = 1234
accept_local_calls = any
display_mc_notification = yes
brightness = 5
contrast = 5
dim_backlight = yes
backlight_timeout = 30
backlight_dim_level = 2
active_locale = en_GB
ringer_volume = 5
speaker_volume = 5
handset_volume = 5
headset_volume = 5
reset_call_volume = no
headset_answer = no
name_format = last_first
lan_port_mode = auto
pc_port_mode = 100fd
enable_check_sync = yes
blf_items = blf_test.xml
contact = contacts_test.xml
blf_contact_group = office-contacts

[000]
type = line
line_label = 000
exten = 000
outboundproxy_address = 192.168.1.253
outboundproxy_port = 5060
transport = udp
reregistration_timeout = 300
registration_retry_interval = 25
registration_max_retries = 5
mailbox = 000

[111]
type = line
line_label = 111
exten = 111
outboundproxy_address = 192.168.1.253
outboundproxy_port = 5060
transport = udp
reregistration_timeout = 300
registration_retry_interval = 25
registration_max_retries = 5
mailbox = 111

[222]
type = line
line_label = 222
exten = 222
outboundproxy_address = 192.168.1.253
outboundproxy_port = 5060
transport = udp
reregistration_timeout = 300
registration_retry_interval = 25
registration_max_retries = 5
mailbox = 222

[333]
type = line
line_label = 333
exten = 333
outboundproxy_address = 192.168.1.253
outboundproxy_port = 5060
transport = udp
reregistration_timeout = 300
registration_retry_interval = 25
registration_max_retries = 5
mailbox = 222

[444]
type = phone
network = network1
; firmware = 1.1Firmware
; mac = 000fd306b59b
line = 444
line = 555
line = 666
line = 777
line = 888
full_name = Mikhail
timezone = Europe / Moscow
ntp_resync = 86400
parking_exten = 700
parking_transfer_type = blind
ringtone = FancyTone
active_ringtone = GuitarStrum
web_ui_enabled = yes
record_own_calls = yes
alert = fancyringer
blf_unused_linekeys = no
send_to_vm = yes
use_local_storage = no
ehs = auto
lock_preferences = no
login_password = 1234
accept_local_calls = any
display_mc_notification = yes
brightness = 5
contrast = 5
dim_backlight = yes
backlight_timeout = 30
backlight_dim_level = 2
active_locale = en_GB
ringer_volume = 5
speaker_volume = 5
handset_volume = 5
headset_volume = 5
reset_call_volume = no
headset_answer = no
name_format = last_first
lan_port_mode = auto
pc_port_mode = 100fd
enable_check_sync = yes
blf_items = blf_test.xml
contact = contacts_test.xml
blf_contact_group = office-contacts

[444]
type = line
line_label = 444
exten = 444
outboundproxy_address = 192.168.1.253
outboundproxy_port = 5060
transport = udp
reregistration_timeout = 300
registration_retry_interval = 25
registration_max_retries = 5
mailbox = 444

[555]
type = line
line_label = 555
exten = 555
outboundproxy_address = 192.168.1.253
outboundproxy_port = 5060
transport = udp
reregistration_timeout = 300
registration_retry_interval = 25
registration_max_retries = 5
mailbox = 555

[666]
type = line
line_label = 666
exten = 666
outboundproxy_address = 192.168.1.253
outboundproxy_port = 5060
transport = udp
reregistration_timeout = 300
registration_retry_interval = 25
registration_max_retries = 5
mailbox = 666

[777]
type = line
line_label = 777
exten = 777
outboundproxy_address = 192.168.1.253
outboundproxy_port = 5060
transport = udp
reregistration_timeout = 300
registration_retry_interval = 25
registration_max_retries = 5
mailbox = 777

[888]
type = line
line_label = 888
exten = 888
outboundproxy_address = 192.168.1.253
outboundproxy_port = 5060
transport = udp
reregistration_timeout = 300
registration_retry_interval = 25
registration_max_retries = 5
mailbox = 888


Now let's deal with the structure of the xml-file with contacts:

Digium phones are equipped with the “Contacts” application with built-in speed dial, blf and presence status. The “Contacts” application is associated with the “Status” application, since both of these applications operate on the basis of information about the user's presence. The “Status” application relies only on the presence information of a local user, while the “Contacts” application also looks at the statuses of other users (information about which is assigned to the speed dial buttons).

Contacts without presence status can be downloaded locally to the phone by the owner of this phone, however this is not recommended. It is preferable to use an administrator-configured xml file for unification.

Starting with DPMA 1.3, Digium phones support the ability to transfer user-locally added contacts to Asterisk server. To activate this feature, the “editable” option must be set to 1 and the contact must have a unique identifier.

Although you can add contacts to the server from the phone, contacts formed on the server are not edited from the phone and are not deleted from the phone’s memory. Thus, Digium hints that it is better to abstain from the possibility of adding contacts from the phone in order to avoid losing the phone book ...

Download contact list

The contact files that the phone must download are defined in the DPMA module or in the main XML file of the phone’s provisioning.

Contact parameter

As mentioned above, there can be several contact fields that are sub-elements of the element.
Parameter Rapid Dial Keys

BLF is set by the blf_contact_group parameter (required field, BLF buttons will be assigned values ​​according to the order in which they are declared in the XML file.)

Contact file structure

Due to the fact that contacts and blf use XML syntax, it is very important to correctly construct the structure of the contact list, since Digium phones do not have an embedded XML validator and you will not see any error message.

The basic structure of the contact file is as follows:
 <phonebooks> <contacts> <contact> <emails> <email /> </emails> <actions> <action> <headers> <header /> </headers> </action> </actions> </contact> </contacts> </phonebooks> 


Contacts section
group_name
line
Name of contact group
editable
logical
Determines the ability to change contacts from the phone
id
line
Group unique identifier


Contact: child of the contacts section
server_uuid
line
Optional. The unique name of the server that the phone is accessing. Using
The DPMA name must be the same as the config_resigd_figium_phone.conf file.
id
line
The unique identifier of the contact, used for blf.
prefix
line
Contact prefix, for example: "Mr."
first_name
line
Contact name
second_name
line
The second name of the contact (not relevant for Russia, except to write in this parameter middle name)
last_name
line
Contact Name
suffix
line
Contact suffix, for example: "Jr."
contact_type
sip special
Type of contact. Contacts with the “Special” type can only send their own telephone
presence status
organization
line
Name of contact organization
job_title
line

location


notes

Add.
account_id

SIP-, id sip.conf
subscribe_to
SIP URI
SIP URI


Do not leave the parameters "first_name" and "last_name" empty avoid incorrect displaying the contact list
when using DPMA must use auto_hint parameter for correct blf-indication «auto_hint_,» format example: subscribe_to = «auto_hint_1234»

In the case of using DPMA propistyvat hints in Dialplan is optional.
If the DPMA parameter is not used, the subscribe_to parameter looks like this: subscribe_to = "sip: 500@my.pbx.com"

It is also necessary to register the hints in the dialplan:

 exten => 1234,hint,SIP/mypeer exten => 1234,1,NoOp() exten => 1234,n,Dial(SIP/mypeer,20) 


In any case, whether you are using DPMA or not, the callcounter parameter in sip.conf is required
Emails Section


Email: child emails
address

e-mail
label

e-mail
primary

e-mail


Actions Section


Action: child element
id

Required. , blf. id
"primary" .
dial

. ,
dial_prefix

. ,
app_id

. ( , )
label

Required. mandatory, . For example:
“” SIP-.
name

, action.


Headers: child element

Header: child headers
key

,X-Digium-Call-Feature"
value

, feature_send_to_vm, (Wildcard Variables)


Wildcard Variables (Special Characters)

% _ACCOUNT_USERNAME
_
%% _ACCOUNT_SERVER_%% _ACCOUNT_PORT_%

Display Rules


Starting with software version 1.4, the Contacts application works in conjunction with the BLF function. The actions defined for the contact are displayed by default when viewing contact information.

Sample XML File Display Rules
 <display_rules>    <display_rule id="1" action_id="monitor" show="0"/>    <display_rule id="2" action_id="monitor" target_status="on_the_phone" show="1"/>    <display_rule id="3" action_id="intercom" show="0"/>    <display_rule id="4" action_id="intercom" target_status="idle" show="1"/>    <display_rule id="5" action_id="dial_vm" phone_state="idle" show="0"/>    <display_rule id="6" action_id="transfer_vm" show="0"/>    <display_rule id="7" action_id="transfer_vm" phone_state="transfer" show="1"/> </display_rules> 


id
id
, 0, 1, 2 .
action_id

, monitor, intercom, dial_vm, transfer_vm
phone_state
idle, hold, transfer, incoming/transfer, incoming,
connected, dialing, calling, failed

target_status
unknown, idle, on_hold, ringing, on_the_phone
. ,
show

/


Below is a listing of my contact file:
 <?xml version="1.0"?> <phonebooks> <contacts group_name="office-contacts" editable="0" id="0"> <contact first_name="Digium D50" last_name="Line 1" organization="TEST" contact_type="sip" account_id="000" id="000" subscribe_to="000" > <numbers> <number dial="000" label="Extension" primary="1" /> </numbers> <actions> <action id="primary" dial="000" dial_prefix="" label="Extension" name="Office" /> </action> </actions> </contact> <contact first_name="Digium D50" last_name="Line 2" organization="TEST" contact_type="sip" account_id="111" id="111" subscribe_to="111" > <numbers> <number dial="111" label="Extension" primary="1" /> </numbers> <actions> <action id="primary" dial="111" dial_prefix="" label="Extension" name="Office" /> </action> </actions> </contact> <contact first_name="Digium D50" last_name="Line 3" organization="TEST" contact_type="sip" account_id="222" id="222" subscribe_to="222" > <numbers> <number dial="222" label="Extension" primary="1" /> </numbers> <actions> <action id="primary" dial="222" dial_prefix="" label="Extension" name="Office" /> </action> </actions> </contact> <contact first_name="Digium D50" last_name="Line 4" organization="TEST" contact_type="sip" account_id="333" id="333" subscribe_to="333" > <numbers> <number dial="333" label="Extension" primary="1" /> </numbers> <actions> <action id="primary" dial="333" dial_prefix="" label="Extension" name="Office" /> </action> </actions> </contact> <contact first_name="Digium D70" last_name="Line 1" organization="TEST" contact_type="sip" account_id="444" id="444" subscribe_to="444" > <numbers> <number dial="444" label="Extension" primary="1" /> </numbers> <actions> <action id="primary" dial="444" dial_prefix="" label="Extension" name="Office" /> </action> </actions> </contact> <contact first_name="Digium D70" last_name="Line 2" organization="TEST" contact_type="sip" account_id="555" id="555" subscribe_to="555" > <numbers> <number dial="555" label="Extension" primary="1" /> </numbers> <actions> <action id="primary" dial="555" dial_prefix="" label="Extension" name="Office" /> </action> </actions> </contact> <contact first_name="Digium D70" last_name="Line 3" organization="TEST" contact_type="sip" account_id="666" id="666" subscribe_to="666" > <numbers> <number dial="666" label="Extension" primary="1" /> </numbers> <actions> <action id="primary" dial="666" dial_prefix="" label="Extension" name="Office" /> </action> </actions> </contact> <contact first_name="Digium D70" last_name="Line 4" organization="TEST" contact_type="sip" account_id="777" id="777" subscribe_to="777" > <numbers> <number dial="777" label="Extension" primary="1" /> </numbers> <actions> <action id="primary" dial="777" dial_prefix="" label="Extension" name="Office" /> </action> </actions> </contact> <contact first_name="Digium D70" last_name="Line 5" organization="TEST" contact_type="sip" account_id="888" id="888" subscribe_to="888" > <numbers> <number dial="888" label="Extension" primary="1" /> </numbers> <actions> <action id="primary" dial="888" dial_prefix="" label="Extension" name="Office" /> </action> </actions> </contact> <contact first_name="Linphone" last_name="" organization="TEST" contact_type="sip" account_id="999" id="999" subscribe_to="999" > <numbers> <number dial="999" label="Extension" primary="1" /> </numbers> <actions> <action id="primary" dial="999" dial_prefix="" label="Extension" name="Office" /> </action> </actions> </contact> </contacts> </phonebooks> 


Structure of the smart blf file

Smart BLF describes the behavior of speed dial keys (starting with firmware version 1.4). BLF determines the position of the speed dial button, allows you to set a fixed location on the pages (relevant for D70), the behavior of the speed dial button, short and long press actions, and a special contact ringtone. The rules for the behavior of speed dial buttons are configured in a separate xml file, obtained via http.

Due to the fact that contacts and blf use xml syntax, it is very important to build a contact list structure correctly, because Digium phones do not have an XML validator built in and you will not see any error message.

The basic structure of the blf file is as follows:


 <smart_blf>    <blf_items>        <blf_item>            <behaviors>                <behavior />            </behaviors>            <indicators>                <indicator />            </indicators>        </blf_item>    </blf_items> </smart_blf> 


More detailed config example:

 <smart_blf>    <blf_items>        <blf_item location="side" index="0" paging="1" contact_id="101">            <behaviors>                <behavior phone_state="idle" target_status="on_the_phone" press_action="call_vm" press_function="dial" />                <behavior phone_state="idle" target_status="idle" press_action="regular_dial" press_function="dial" />                <behavior phone_state="idle" target_status="idle" long_press_action="anintercom" long_press_function="dial" />            </behaviors>            <indicators>                <indicator target_status="idle" ring="0" ringtone_id="Digium" led_color="green" led_state="on" />                <indicator target_status="ringing" ring="1" ringtone_id="Techno" led_color="red" led_state="fast" />            </indicators>        </blf_item>    </blf_items> </smart_blf> 


BLF Item
location
main, side
:
( ) .
D40 “main” .
D70 , .
“main”, index 1, .. 0
.
index

, “0”
paging
, 0, 1
1. 0,
.
contact_id

"id"
app_id


(contacts, voicemail, parking, status, queues)
.
contact_id, .
blank
, 0,1




Behaviors: child element blf_item


Behavior: child element
behavior . . .

phone_state
, phone state

target_status
unknown, idle, on_hold, ringing, on_the_phone

press_action
id
id .
press_function
dial, info, show_app, transfer, send_dtmf, none

long_press_action
An action id from the loaded contacts file
id ,
2
long_press_function
dial, info, show_app, transfer, send_dtmf, none
,
2


Phone states
, :

idle

hold

hold/transfer
,
, “Transfer“ “Hold” “Transfer”.
hold/preconference
,
hold/conference
,
incoming
, , .
incoming/transfer
, ,
“transfer” ,
connected
,
connected/conference

calling
,
dial
, ,
dialing
,
failed
, -
all



Indicators: child element blf_item


Indicator: indicators child
target_status
unknown, idle, on_hold, ringing, on_the_phone

ring

“true”,
ringtone_id
Alarm, Chimes, Digium, GuitarStrum, Jingle, Office2, Office,
RotaryPhone, SteelDrum, Techno, Theme,
Tweedle, Twinkle, Vibe, or one of ids from a custom-loaded ringtone

led_color
amber, green, red

led_state
off, on, slow, fast

(, , / )


Below is a listing of my Smart BLF file.
 <?xml version="1.0"?> <config> <smart_blf> <blf_items> <blf_item location="side" index="0" paging="1" contact_id="000"> <behaviors> <behavior phone_state="idle" target_status="on_the_phone" press_action="call_vm" press_function="dial" /> <behavior phone_state="idle" target_status="idle" press_action="regular_dial" press_function="dial" /> <behavior phone_state="idle" target_status="idle" long_press_action="anintercom" long_press_function="dial" /> </behaviors> <indicators> <indicator target_status="idle" ring="0" ringtone_id="Digium" led_color="green" led_state="on" /> <indicator target_status="ringing" ring="0" ringtone_id="Techno" led_color="red" led_state="fast" /> <indicator target_status="on_the_phone" ring="0" ringtone_id="Techno" led_color="red" led_state="on" /> </indicators> </blf_item> <blf_item location="side" index="1" paging="1" contact_id="111"> <behaviors> <behavior phone_state="idle" target_status="on_the_phone" press_action="call_vm" press_function="dial" /> <behavior phone_state="idle" target_status="idle" press_action="regular_dial" press_function="dial" /> <behavior phone_state="idle" target_status="idle" long_press_action="anintercom" long_press_function="dial" /> </behaviors> <indicators> <indicator target_status="idle" ring="0" ringtone_id="Digium" led_color="green" led_state="on" /> <indicator target_status="ringing" ring="0" ringtone_id="Techno" led_color="red" led_state="fast" /> <indicator target_status="on_the_phone" ring="0" ringtone_id="Techno" led_color="red" led_state="on" /> </indicators> </blf_item> <blf_item location="side" index="2" paging="1" contact_id="222"> <behaviors> <behavior phone_state="idle" target_status="on_the_phone" press_action="call_vm" press_function="dial" /> <behavior phone_state="idle" target_status="idle" press_action="regular_dial" press_function="dial" /> <behavior phone_state="idle" target_status="idle" long_press_action="anintercom" long_press_function="dial" /> </behaviors> <indicators> <indicator target_status="idle" ring="0" ringtone_id="Digium" led_color="green" led_state="on" /> <indicator target_status="ringing" ring="0" ringtone_id="Techno" led_color="red" led_state="fast" /> <indicator target_status="on_the_phone" ring="0" ringtone_id="Techno" led_color="red" led_state="on" /> </indicators> </blf_item> <blf_item location="side" index="3" paging="1" contact_id="333"> <behaviors> <behavior phone_state="idle" target_status="on_the_phone" press_action="call_vm" press_function="dial" /> <behavior phone_state="idle" target_status="idle" press_action="regular_dial" press_function="dial" /> <behavior phone_state="idle" target_status="idle" long_press_action="anintercom" long_press_function="dial" /> </behaviors> <indicators> <indicator target_status="idle" ring="0" ringtone_id="Digium" led_color="green" led_state="on" /> <indicator target_status="ringing" ring="0" ringtone_id="Techno" led_color="red" led_state="fast" /> <indicator target_status="on_the_phone" ring="0" ringtone_id="Techno" led_color="red" led_state="on" /> </indicators> </blf_item> <blf_item location="side" index="4" paging="1" contact_id="444"> <behaviors> <behavior phone_state="idle" target_status="on_the_phone" press_action="call_vm" press_function="dial" /> <behavior phone_state="idle" target_status="idle" press_action="regular_dial" press_function="dial" /> <behavior phone_state="idle" target_status="idle" long_press_action="anintercom" long_press_function="dial" /> </behaviors> <indicators> <indicator target_status="idle" ring="0" ringtone_id="Digium" led_color="green" led_state="on" /> <indicator target_status="ringing" ring="0" ringtone_id="Techno" led_color="red" led_state="fast" /> <indicator target_status="on_the_phone" ring="0" ringtone_id="Techno" led_color="red" led_state="on" /> </indicators> </blf_item> <blf_item location="side" index="5" paging="1" contact_id="555"> <behaviors> <behavior phone_state="idle" target_status="on_the_phone" press_action="call_vm" press_function="dial" /> <behavior phone_state="idle" target_status="idle" press_action="regular_dial" press_function="dial" /> <behavior phone_state="idle" target_status="idle" long_press_action="anintercom" long_press_function="dial" /> </behaviors> <indicators> <indicator target_status="idle" ring="0" ringtone_id="Digium" led_color="green" led_state="on" /> <indicator target_status="ringing" ring="0" ringtone_id="Techno" led_color="red" led_state="fast" /> <indicator target_status="on_the_phone" ring="0" ringtone_id="Techno" led_color="red" led_state="on" /> </indicators> </blf_item> <blf_item location="side" index="6" paging="1" contact_id="666"> <behaviors> <behavior phone_state="idle" target_status="on_the_phone" press_action="call_vm" press_function="dial" /> <behavior phone_state="idle" target_status="idle" press_action="regular_dial" press_function="dial" /> <behavior phone_state="idle" target_status="idle" long_press_action="anintercom" long_press_function="dial" /> </behaviors> <indicators> <indicator target_status="idle" ring="0" ringtone_id="Digium" led_color="green" led_state="on" /> <indicator target_status="ringing" ring="0" ringtone_id="Techno" led_color="red" led_state="fast" /> <indicator target_status="on_the_phone" ring="0" ringtone_id="Techno" led_color="red" led_state="on" /> </indicators> </blf_item> <blf_item location="side" index="7" paging="1" contact_id="777"> <behaviors> <behavior phone_state="idle" target_status="on_the_phone" press_action="call_vm" press_function="dial" /> <behavior phone_state="idle" target_status="idle" press_action="regular_dial" press_function="dial" /> <behavior phone_state="idle" target_status="idle" long_press_action="anintercom" long_press_function="dial" /> </behaviors> <indicators> <indicator target_status="idle" ring="0" ringtone_id="Digium" led_color="green" led_state="on" /> <indicator target_status="ringing" ring="0" ringtone_id="Techno" led_color="red" led_state="fast" /> <indicator target_status="on_the_phone" ring="0" ringtone_id="Techno" led_color="red" led_state="on" /> </indicators> </blf_item> <blf_item location="side" index="8" paging="1" contact_id="888"> <behaviors> <behavior phone_state="idle" target_status="on_the_phone" press_action="call_vm" press_function="dial" /> <behavior phone_state="idle" target_status="idle" press_action="regular_dial" press_function="dial" /> <behavior phone_state="idle" target_status="idle" long_press_action="anintercom" long_press_function="dial" /> </behaviors> <indicators> <indicator target_status="idle" ring="0" ringtone_id="Digium" led_color="green" led_state="on" /> <indicator target_status="ringing" ring="0" ringtone_id="Techno" led_color="red" led_state="fast" /> <indicator target_status="on_the_phone" ring="0" ringtone_id="Techno" led_color="red" led_state="on" /> </indicators> </blf_item> <blf_item location="side" index="9" paging="1" contact_id="999"> <behaviors> <behavior phone_state="idle" target_status="on_the_phone" press_action="call_vm" press_function="dial" /> <behavior phone_state="idle" target_status="idle" press_action="regular_dial" press_function="dial" /> <behavior phone_state="idle" target_status="idle" long_press_action="anintercom" long_press_function="dial" /> </behaviors> <indicators> <indicator target_status="idle" ring="0" ringtone_id="Digium" led_color="green" led_state="on" /> <indicator target_status="ringing" ring="0" ringtone_id="Techno" led_color="red" led_state="fast" /> <indicator target_status="on_the_phone" ring="0" ringtone_id="Techno" led_color="red" led_state="on" /> </indicators> </blf_item> </blf_items> </smart_blf> </config> 


A detailed description of all options and rules for building xml files with contacts and smart blf can be found on the wiki asterisk.

As described above, the files with the behavior of speed-dial buttons are loaded via http.

I chose apache2 for this purpose.

Testing was conducted on Centos 6.3. Installation example:

 yum install httpd 


Go to the configuration file:

 vim /etc/httpd/conf/httpd.conf 


Put in the parameter “ServerName” ip-address or domain name of the server from which the phone will receive configs. In my case: ServerName 192.168.1.253
(do not forget to remove the comments at the beginning of the line).

To check if there are any requests from Digium-phones to receive Xml-files, use the command:

 tail -f /var/log/httpd/* 


If the phone calls apache for the config, then we will see something like this in the console:

 192.168.1.143 - - [29/Jan/2014:18:39:15 +0400] "GET /blf_test.xml HTTP/1.1" 200 8564 "-" "Digium-D50/1_4_0_0_57389" 192.168.1.140 - - [29/Jan/2014:18:39:37 +0400] "GET /blf_test.xml HTTP/1.1" 200 8564 "-" "Digium-D70/1_4_0_0_57389" 


If everything is set up correctly, then after the Asterisk kernel has been rebooted, your Digium-phone friendly blinks with green and red diodes :)









And the guys from Digium in order to diversify gray everyday life sometimes do such things :)



Summarizing everything written above, I would like to note that the initial setup may seem rather complicated, however, if the admin has a fleet of 20 or more phones, then this option will greatly facilitate the work of setting up the phones. A wide choice of options, flexible customization, the use of standard services for automatic configuration, tight integration with asterisk and distributions based on it make Digium phones, in our opinion, the best solution in the market of IP telephony and unified communications.

Source: https://habr.com/ru/post/211464/


All Articles