Member
Last active 9 years ago
Here is another question: How can user change his status to "Out to lunch" by future code?
I read this message before posting View Post 601
Probably we need put a code which is a simular to DND and CF codes, don't we?
/fop2state/SIP/0351 : Do not Disturb
/fop2state/SIP/0352 : Do not Disturb
/fop2state/SIP/0503 : Do not Disturb
/fop2state/USER/0352 : Do not Disturb
after service fop2 restart
I see DND status on 0352..
so ..it looks like everything is fine now..?!
source extensions_override_fop2.conf:
[app-dnd-off]
include => app-dnd-off-custom
exten => 79,1,Answer
exten => 79,n,Wait(1)
exten => 79,n,Macro(user-callerid,)
; added for fop2
exten => 79,n,Set(CHAN=${CUT(CHANNEL,-,1)})
exten => 79,n,dbDel(fop2state/${CHAN})
exten => 79,n,UserEvent(FOP2ASTDB,Family: fop2state,Channel: ${CHAN},Value: )
; end fop2 addition
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(agent-loginok)
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,)
; added for fop2
exten => 78,n,Set(DB(DND/${AMPUSER})=YES)
exten => 78,n,Set(CHAN=${CUT(CHANNEL,-,1)})
exten => 78,n,Set(DB(fop2state/${CHAN})=Do not Disturb)
exten => 78,n,UserEvent(FOP2ASTDB,Family: fop2state,Channel: ${CHAN},Value: Do not Disturb)
; end fop2 addition
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(agent-loggedoff)
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()
a new one, after source was changed:
[app-dnd-off]
include => app-dnd-off-custom
exten => 79,1,Answer
exten => 79,n,Wait(1)
exten => 79,n,Macro(user-callerid,)
; added for fop2
exten => 79,n,Set(CHAN=${CUT(CHANNEL,-,1)})
exten => 79,n,dbDel(fop2state/USER/${AMPUSER})
exten => 79,n,UserEvent(FOP2ASTDB,Family: fop2state,Channel: USER/${AMPUSER},Value: )
; end fop2 addition
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,)
; added for fop2
exten => 78,n,Set(DB(DND/${AMPUSER})=YES)
exten => 78,n,Set(CHAN=${CUT(CHANNEL,-,1)}) ; guess we don't need this one???
exten => 78,n,Set(DB(fop2state/USER/${AMPUSER})=Do not Disturb)
exten => 78,n,UserEvent(FOP2ASTDB,Family: fop2state,Channel: USER/${AMPUSER},Value: Do not Disturb)
; end fop2 addition
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()
Unfortunately it still doesn't show DND
Thanks for your answer Nicolás,
First of all, Yes I have /fop2state/SIP/0226 : Do not Disturb
my first post in this topic about dnd status in database.
Secondly, fop2admin had been installed succesfuly after module Parking Lot installing.
Regards,
Thanks for the answer Nicolás,
I'm using a FreePBX based distro Elastix. Freepbx
I used autoconfig-buttons-freepbx.sh
[USER/0226]
type=extension
extension=0226
label=Smith
mailbox=2226@default
context=from-internal
queuecontext=from-queue
extenvoicemail=*2226@from-internal
group=work
here is my manager_additional.conf
[fopp2]
secret = fop2secret
deny=0.0.0.0/0.0.0.0
permit=0.0.0.0/0.0.0.0
read = system,call,log,verbose,command,agent,user,config,dtmf,reporting,cdr,dialplan,originate
write = system,call,log,verbose,command,agent,user,config,dtmf,reporting,cdr,dialplan,originate
in button.cfg I added : customastdb=DND/0226
besides that, I installed fop2admin, than uninstalled it. Second installation showed me a mistake - exit: 1
[FATAL] SELECT if(`defaultlot`='no',concat('PARK/parkinglot_',id),'PARK/default') AS channel,parkext AS exten FROM parkplus [nativecode=1146 ** Table 'asterisk.parkplus' doesn't exist]SQL -
SELECT if(`defaultlot`='no',concat('PARK/parkinglot_',id),'PARK/default') AS channel,parkext AS exten FROM parkplus
Trace Back:
/var/www/html/admin/libraries/sql.functions.php:11 die_freepbx()
[0]: SELECT if(`defaultlot`='no',concat('PARK/parkinglot_',id),'PARK/default') AS channel,parkext AS exten FROM parkplus [nativecode=1146 ** Table 'asterisk.parkplus' doesn't exist]SQL -
SELECT if(`defaultlot`='no',concat('PARK/parkinglot_',id),'PARK/default') AS channel,parkext AS exten FROM parkplus
/var/www/html/admin/modules/fop2admin/functions.inc.php:70 sql()
[0]: SELECT if(`defaultlot`='no',concat('PARK/parkinglot_',id),'PARK/default') AS channel,parkext AS exten FROM parkplus
[1]: getAll
[2]: 2
/var/lib/asterisk/bin/retrieve_conf:606 fop2admin_get_config()
[0]: asterisk
1 error(s) occurred, you should view the notification log on the dashboard or main screen to check for more details.
Thanks a lot..everything is fine now.
Here is a code:
// start replaced by Sipk;
set_queue_hint($user, $device);
if (version_compare(get_var("ASTVERSION"), "1.8.21.0", "ge")) {
$user_event_body = "\"UserDeviceAdded,Data: {$user}\\\\,{$device}\"";
} else if(version_compare(get_var("ASTVERSION"), "1.6.1", "ge")) {
$user_event_body = "\"UserDeviceAdded|Data: {$user}\\,{$device}\"";
} else if(version_compare(get_var("ASTVERSION"), "1.6.0", "ge")) {
$user_event_body = "UserDeviceAdded,\"Data: {$user}\\\\,{$device}\"";
} else {
$user_event_body = "\"UserDeviceAdded|Data: {$user},{$device}\"";
}
// end replaced by Sipk;
// start replaced by Sipk;
if(version_compare(get_var("ASTVERSION"), "1.8.21.0", "ge")) {
$user_event_body = "\"UserDeviceRemoved,Data: {$current_user}\\\\,{$device}\"";
} else if(version_compare(get_var("ASTVERSION"), "1.6.1", "ge")) {
$user_event_body = "\"UserDeviceRemoved|Data: {$current_user}\\,{$device}\"";
} else if(version_compare(get_var("ASTVERSION"), "1.6.0", "ge")) {
$user_event_body = "UserDeviceRemoved,\"Data: {$current_user}\\\\,{$device}\"";
} else {
$user_event_body = "\"UserDeviceRemoved|Data: {$current_user},{$device}\"";
}
// end replaced by Sipk;
{quote} status change in realtime {quote}
Yea, it works fine..
but after service fop2 restart ..fop2 doesn't show DND status unfortunately
Thanks for your answer Nicolás
Here is my buttons.cfg
[USER/0226]
type=extension
extension=0226
label=Smith
mailbox=2226@default
context=from-internal
queuecontext=from-queue
extenvoicemail=*2226@from-internal
group=work
which i created by autoconfig-buttons-freepbx.sh
Also i have all permissions to /etc/asterisk/manager.conf
After I started ./generate_override_contexts.pl -write
got a new extensions_override_fop2.conf which looks like:
[app-dnd-off]
include => app-dnd-off-custom
exten => 79,1,Answer
exten => 79,n,Wait(1)
exten => 79,n,Macro(user-callerid,)
; added for fop2
exten => 79,n,Set(CHAN=${CUT(CHANNEL,-,1)})
exten => 79,n,dbDel(fop2state/${CHAN})
exten => 79,n,UserEvent(FOP2ASTDB,Family: fop2state,Channel: ${CHAN},Value: )
; end fop2 addition
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()
here I changed a standart meaning *78 -> 78 by manual...guess it was my fault.
Now I've repeated ./generate_override_contexts.pl -write and everything works fine!
fop2 is located on asterisk server.
But I have another fop2 which separated from asterisk and this one doesn't show DND status.
Any suggestions would be great.
Got it working by modifying the agi.
Seems when they switched to 1.8 in the distro they neglected to update the agi scripts.
I have the same problem and asterisk/freepbx versions
what exactly did you modifyed in agi?
I'm trying to do this:
set_hint($user, $new_devices);
if(version_compare(get_var("ASTVERSION"), "1.6.1", "ge")) {
$user_event_body = "\"UserDeviceAdded|Data: {$user}\\,{$device}\"";
} else if(version_compare(get_var("ASTVERSION"), "1.6.0", "ge")) {
$user_event_body = "UserDeviceAdded,\"Data: {$user}\\\\,{$device}\"";
} else {
$user_event_body = "\"UserDeviceAdded|Data: {$user},{$device}\"";
}
//Added for FOP2 by
$user_event_body = "\"UserDeviceAdded,Data: {$user}\\\\,{$device}\"";
$agi->exec("UserEvent", $user_event_body);
but still have the problem.
I'm interested in Different color if not logged in too. Is it possible now?