Changing presence (with FOP2)

So, FOP2 has a cool little thing that will set an extension to different states, such as “Out to Lunch” or “In a Meeting” as well as DND.

BUT… two issues:

  1. It doesn’t actually change it on the phone display (Yealink T46G’s)
  2. Other than DND, there is no way to change the presence on the PHONE to something besides DND (Let alone have it display on FOP2)

The desired system would work like this:

  • If I change the presence from FOP2 to something, it would change it on the phone as well (even if it just put the phone on DND for “in a meeting” or whatever)
  • The phone would have either soft keys or dial codes to change the presence (“in a meeting”, etc.) that would put the phone on DND and change the presence on FOP2.

So, I’ve played with this a little… but I haven’t gotten very far. Has anyone done this with FOP2, a custom dial-plan or feature code that would change presence to something besides DND? When I change it in FOP2, and watch what Asterisk is doing, no matter the presence I select, it sets it to “Busy” (or “Idle” when I set it back to available). It seems FOP2 has more presence choices than are understood by Asterisk.

You’re confusing two things here, which isn’t uncommon.

A phone’s DND function is a phone level function. So when you hit that DND button it’s DNDing the entire phone regardless of how many accounts or different PBXes those accounts are related to. Using things such as Feature Codes, UCP or FOP2 to set DND does this at the PBX level for the “extension” in question.

Presence is for the state of the User not the Device. So for the most part FOP will set the device to DND for certain Presence statuses but to see the Presence status you need to use FOP since it will update the button for the extension to show it’s state.

As far as getting the Presence updated to the phone, that would require Asterisk to send a NOTIFY message to the phone (which it can do), however, Asterisk’s Presence implementation is not that standard so the phones would need to be able to accept how Asterisk’s NOTIFY messages are formatted. So a part of this will depend on what the phone can support as well.

What type of phones are you using?

We are using Yealink T46G’s.

Yeah… I get that I’m kind of “intermixing” the station status (DND) with a presence status… I guess what I’d really like to do is to tie them together a little… so when a person taps a speed dial button on their phone “out to lunch”, it puts their station on DND, and changes the presence on FOP2 to “out to lunch”.

Meanwhile, on the other end, an employee calls in sick, the operator through FOP2 can set their presence status to “Sick” and their phone to DND…

I know… I’m asking a lot… lol

I haven’t messed with Presence on Yealink’s yet but let me take a look at my docs and see if something sticks out.

As for what you want to do, it’s going to require some custom code for this to update the Presence state for FOP2 to see it and do the DND. I’d have to take a look at FOP2’s code to see the best method but it is doable.

1 Like

I need to update my current version of FOP but this is the override they setup for DND for the Feature Codes. Should give you a starting point. Note that it uses AMI UserEvents to update the FOP interface via its AMI listener.

[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()

    [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(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)
    ; added for fop2
    exten => *76,n,Set(CHAN=${CUT(CHANNEL,-,1)})
    exten => *76,n,Set(DB(fop2state/${CHAN})=Do not Disturb)
    exten => *76,n,UserEvent(FOP2ASTDB,Family: fop2state,Channel: ${CHAN},Value: Do not Disturb)
    ; end fop2 addition
    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})})
    ; added for fop2
    exten => *76,n,Set(CHAN=${CUT(CHANNEL,-,1)})
    exten => *76,n,dbDel(fop2state/${CHAN})
    exten => *76,n,UserEvent(FOP2ASTDB,Family: fop2state,Channel: ${CHAN},Value: )
    ; end fop2 addition
    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()

There is a ‘fop2state’ family in the asteriskdb sqlite3 database that can be set where the key might be for example SIP/1000 , you can set the ‘value’ to one of

‘Available’
‘Other’
‘Do not Disturb’
‘Out to lunch’
‘Break’
‘Meeting’

in one of any supported language.

it is set by FOP2 gui and can be used as a ‘hint’ within Asterisk (and presumably will reflect on the FOP2 screen if you set/remove them, never tried it that way around though)

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.