artem
29.03.2013
9344

Отображение статуса DND на BLF клавише

Поиски в интернете показали, что эта функция и так должна входить в FreePBX, однако в FreePBX 2.10 с последними модулями её, почему-то, не оказалось.

Ниже приведены действия для добавления этой функции в FreePBX:

Переопределяем контексты:

[app-dnd-off], [app-dnd-on] и [app-dnd-toggle] в файле

/etc/asterisk/extensions_override_freepbx.conf

[app-dnd-off]
include => app-dnd-off-custom
exten => *79,1,Answer
exten => *79,n,Wait (1)
exten => *79,n,Macro (user-callerid,)
exten => *79,n,Noop (Deleting: DND/${AMPUSER} ${DB_DELETE (DND/${AMPUSER})})
exten => *79,n,Set (STATE=NOT_INUSE)
exten => *79,n,Gosub (app-dnd-off,sstate,1)
exten => *79,n (hook_1),Playback (do-not-disturb&de-activated)
exten => *79,n,Macro (hangupcall,)
exten => sstate,1,Set (DEVICE_STATE (Custom:DND${AMPUSER})=${STATE})                                                                                                 
exten => sstate,n,Set (DEVICES=${DB (AMPUSER/${AMPUSER}/device)})                                                                                                    
exten => sstate,n,GotoIf ($[»${DEVICES}» =» » ]?return)                                                                                                             
exten => sstate,n,Set (LOOPCNT=${FIELDQTY (DEVICES,&)})                                                                                                              
exten => sstate,n,Set (ITER=1)                                                                                                                                      
exten => sstate,n (begin),Set (DEVICE_STATE (Custom:DEVDND${CUT (DEVICES,&,${ITER})})=${STATE})                                                                        
exten => sstate,n,Set (ITER=$[${ITER} + 1])                                                                                                                         
exten => sstate,n,GotoIf ($[${ITER} ≤ ${LOOPCNT}]?begin)                                                                                                           
exten => sstate,n (return),Return ()
[app-dnd-on]
include => app-dnd-on-custom
exten => *78,1,Answer
exten => *78,n,Wait (1)
exten => *78,n,Macro (user-callerid,)
exten => *78,n,Set (DB (DND/${AMPUSER})=YES)
exten => *78,n,Set (STATE=BUSY)
exten => *78,n,Gosub (app-dnd-on,sstate,1)
exten => *78,n (hook_1),Playback (do-not-disturb&activated)
exten => *78,n,Macro (hangupcall,)
exten => sstate,1,Set (DEVICE_STATE (Custom:DND${AMPUSER})=${STATE})                                                                                                 
exten => sstate,n,Set (DEVICES=${DB (AMPUSER/${AMPUSER}/device)})                                                                                                    
exten => sstate,n,GotoIf ($[»${DEVICES}» =» » ]?return)                                                                                                             
exten => sstate,n,Set (LOOPCNT=${FIELDQTY (DEVICES,&)})                                                                                                              
exten => sstate,n,Set (ITER=1)                                                                                                                                      
exten => sstate,n (begin),Set (DEVICE_STATE (Custom:DEVDND${CUT (DEVICES,&,${ITER})})=${STATE})                                                                        
exten => sstate,n,Set (ITER=$[${ITER} + 1])                                                                                                                         
exten => sstate,n,GotoIf ($[${ITER} ≤ ${LOOPCNT}]?begin)                                                                                                           
exten => sstate,n (return),Return ()
[app-dnd-toggle]
include => app-dnd-toggle-custom
exten => *76,1,Answer
exten => *76,n,Wait (1)
exten => *76,n,Macro (user-callerid,)
exten => *76,n,GotoIf ($[»${DB (DND/${AMPUSER})}» =» »]?activate:deactivate)
exten => *76,n (activate),Set (DB (DND/${AMPUSER})=YES)
exten => *76,n,Set (STATE=BUSY)
exten => *76,n,Gosub (app-dnd-toggle,sstate,1)
exten => *76,n (hook_on),Playback (do-not-disturb&activated)
exten => *76,n,Macro (hangupcall,)
exten => *76,n (deactivate),Noop (Deleting: DND/${AMPUSER} ${DB_DELETE (DND/${AMPUSER})})
exten => *76,n,Set (STATE=NOT_INUSE)
exten => *76,n,Gosub (app-dnd-toggle,sstate,1)
exten => *76,n (hook_off),Playback (do-not-disturb&de-activated)
exten => *76,n,Macro (hangupcall,)
exten => sstate,1,Set (DEVICE_STATE (Custom:DND${AMPUSER})=${STATE})                                                                                                 
exten => sstate,n,Set (DEVICES=${DB (AMPUSER/${AMPUSER}/device)})                                                                                                    
exten => sstate,n,GotoIf ($[»${DEVICES}» =» » ]?return)                                                                                                             
exten => sstate,n,Set (LOOPCNT=${FIELDQTY (DEVICES,&)})                                                                                                              
exten => sstate,n,Set (ITER=1)                                                                                                                                      
exten => sstate,n (begin),Set (DEVICE_STATE (Custom:DEVDND${CUT (DEVICES,&,${ITER})})=${STATE})                                                                        
exten => sstate,n,Set (ITER=$[${ITER} + 1])                                                                                                                         
exten => sstate,n,GotoIf ($[${ITER} ≤ ${LOOPCNT}]?begin)                                                                                                           
exten => sstate,n (return),Return ()

Добавляем хинты для номеров:

Можно добавить хинты в [ext-local-custom], например:

[ext-local-custom]
exten => *76100,hint,Custom:DEVDND100

Но так придется добавлять хинт для каждого номера, и, для наблюдения за состоянием DND придется выделить дополнительную клавишу BLF.

Альтернативно, можно создать новый контекст для SIP SUBSCRIBE.

/etc/asterisk/extensions_custom.conf

[blf-all]
exten => _XXX,hint,SIP/${EXTEN}&Custom:DEVDND${EXTEN}

/etc/asterisk/sip_general_custom.conf

subscribecontext=blf-all

Настраиваем BLF-клавиши на телефоне или перезагружаем телефон, если они уже были настроены. Теперь, если включить DND на любом трёхзначном номере, состояние его хинта станет «Busy» до отключения DND.

 

 
avatar
  Подписаться  
Уведомление о

Остались вопросы?

Я - Виталий Шелест, менеджер компании Voxlink. Хотите уточнить детали или готовы оставить заявку? Укажите номер телефона, я перезвоню в течение 3-х секунд.

VoIP оборудование

ближайшие курсы

ближайшие Вебинары

ONLINE

Why Choose HUGE?

Unlimited pre-designed elements

Each and every design element is designed for retina ready display on all kind of devices

User friendly interface and design

Each and every design element is designed for retina ready display on all kind of devices

100% editable layered PSD files

Each and every design element is designed for retina ready display on all kind of devices

Created using shape layers

Each and every design element is designed for retina ready display on all kind of devices