📜 ⬆️ ⬇️

Asterisk + Cisco SPA5XX, SPA3XX - DND with server notification

Recently, the company changed the IP phones. Replaced gigaset'am came cisco SPA504G and cisco SPA303 . I am not an expert in telephony, so the dnd mode (Do not Disturb) was a novelty for me. The novelty quickly got accustomed to the company. But here's the ill luck: the phone does not notify the server when switching modes in any way. A call to an unavailable phone ended in a status of "busy." The caller had to guess - the subscriber is talking on the phone now or he is not there. I decided to correct this problem.

On Habré there is already a similar post , but it does not take into account the features of the cisco phone. In order for the server to be able to check the dnd activity on the phone, I used the muon user experience . Add the following content to the dialplan (do not forget to include this content where it is needed):

[dnd_on-off] exten => *75,1,Answer exten => *75,n,Set(STATE=RINGING) exten => *75,n,Set(DEVICE_STATE(Custom:DND${CALLERID(number)})=${STATE}) exten => *75,n,Hangup exten => *76,1,Answer exten => *76,n,Set(STATE=NOT_INUSE) exten => *76,n,Set(DEVICE_STATE(Custom:DND${CALLERID(number)})=${STATE}) exten => *76,n,Hangup 

To install the phone (on the server) in dnd mode, you need to dial * 76 to remove it * 75 . Thus, checking the ${DEVICE_STATE(Custom:DND< >)} variable on the server ${DEVICE_STATE(Custom:DND< >)} we will know the state of the phone.
')
At this stage, it is not very convenient, because we do not have any indication on the phone ( problem 1 ). And also the perplexity of the user: “I used to set and remove the dnd mode by pressing one button, and now I need to type some strange combinations.” ( Problem 2 ). We act further.

Solution to problem 1:
In the web admin of the phone, in the Admin login mode , Advanced, on the Regional tab, there is a Vertical Service Activation Codes section. Find the parameters DND Act Code and DND Deact Code , set the values * 76 and * 75, respectively. Now, when dialing these service codes on the phone, the dnd mode will turn on and off (on the phone). But bad luck, the phone again does not notify the server.

To solve this problem, you must force the phone to dial these codes. We are looking for a section Vertical Service Announcement Codes. Find the Service Annc Base Number parameter, write there * 7 (this is the prefix of the number that the phone will call when dialing any service code), the Service Annc Extension Codes : DDT: 6 parameter ; DDF: 5 (this is the number suffix, depending on the operation, DDT - setting dnd, DDF - removing dnd). Next, go to the Phone tab and in the Supplementary Services section, set the Service Annc Serv parameter to yes . Thanks to this parameter, the phone will now dial the number by suffix and prefix as we indicated. Hooray, problem 1 solved.

Solving Problem 2 :
The phone has the ability to reassign buttons, use this. Here it was necessary to complicate the process of removing and setting dnd. Previously, this was done by pressing one button, now one button will be responsible for the installation, the other for removal. I could not solve this problem, although here (the last post) they write that it is possible to assign two actions alternately to one programmable key, but it did not work for me. Who knows how to do this, write in the comments, I will be grateful.

On the Phone tab, in the Programmable Softkeys section, create two programmable buttons.
PKS1 : fnc = sd; ext = * 75; nme = dnd
PKS2 : fnc = sd; ext = * 76; nme = -dnd
I assigned PKS2 (dnd removal) to the former dnd button, and no one used the one that was left of it (I don’t remember what the function was on it) PKS1 . To do this, in the Idle Key List parameter write psk1 | 7; psk2 | 8; in the appropriate place. Do not forget to enable the programmable keys, the Programmable Softkey Enable parameter, the value yes . We press Submit All Changes , wait until the phone reboots and you can use.

I did not write a check on the dnd for an incoming call in the dialplan - until the hands reached it. In the above post with Habra it is already implemented. To display phone statuses, we use software on a computer based on AMI requests.

PS
It immediately became interesting who how many times a day puts this mode, for how long, etc. Maybe someone will be interested. In MySQL, for these purposes, I created a table:

 CREATE TABLE `dnd` ( `id` int(11) NOT NULL AUTO_INCREMENT, `number` varchar(3) NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `action` tinyint(1) NOT NULL, PRIMARY KEY (`id`) ) 

and changed the content

 [dnd_on-off] exten => *75,1,Answer exten => *75,n,Set(STATE=RINGING) exten => *75,n,Set(DEVICE_STATE(Custom:DND${CALLERID(number)})=${STATE}) exten => *75,n,MYSQL(Connect connid localhost user password database) exten => *75,n,MYSQL(Query resultid ${connid} INSERT INTO dnd (number, action) VALUES ("${CALLERID(number)}", false)) exten => *75,n,MYSQL(Disconnect ${connid}) exten => *75,n,Hangup exten => *76,1,Answer exten => *76,n,Set(STATE=NOT_INUSE) exten => *76,n,Set(DEVICE_STATE(Custom:DND${CALLERID(number)})=${STATE}) exten => *76,n,MYSQL(Connect connid localhost user password database) exten => *76,n,MYSQL(Query resultid ${connid} INSERT INTO dnd (number, action) VALUES ("${CALLERID(number)}", true)) exten => *76,n,MYSQL(Disconnect ${connid}) exten => *76,n,Hangup 


That's all, thank you for your attention.

UPD

It turned out to do everything on one button, for this it was necessary to update the firmware to version 7.5.5.
PKS1 : fnc = sd; ext = * 75; nme = dnd; ext2 = * 76; nme2 = -dnd

The truth is an annoying little thing. If you put the phone on dnd and reboot, the button is in state 1 (put dnd), although dnd is already on.

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


All Articles