I have a home automation system that tracks when we are at home and away. I’m looking for examples of setting users presence state from an external program – googling the questions I came up with mostly pointed at how to use presence but nothing I could find about controlling it externally.
I’m wanting to have the HA system set presence state for my wife and I so that FreePBX knows if we are home or not and can route calls accordingly.
But unless you often travel separately, I don’t see how it would help much.
Calls to my number, if not answered quickly at the desk phone, start ringing other home phones and my mobile. If we’re not home, I don’t care whether the home phones ring or not. I suppose it would be better to avoid the five second delay; in rare cases when the mobile is not answered fast enough, the caller will abandon the call. That’s usually not a disaster as I just call back.
But when one person is in and one out, you could prevent calls for the one out from disturbing the one at home.
I cloned and fixed the bug so I could try your script. It seems to work but I’m clearly not understanding presence state and all its implications. I’ll try more tests tofay.
But IMO, you will want finer controls than presence offers. Examples:
Setting the built-in DND means your phone doesn’t ring at all. But you probably still want calls from the alarm company or fraud alerts to ring. If your kid calls, maybe an IVR “If this is urgent, press 1 to ring through, or stay on the line to leave a message.”
Likewise, turning follow-me on or off is pretty coarse. If you’re home, you may want the kitchen phone to ring if you don’t quickly answer the desk phone.
Possibly, you might want different rules for combinations of states:
Me at home - true or false
Her at home - true or false
House occupied - true if one or both of us are home, false if neither of us are home.
I already have the allowlist module set up to screen calls.
Non-allowlisted callers get sent to an ant-spam IVR where they have to choose who they are calling. If they make the correct selection then the call is routed to either mine or my wife’s destination which rings all the phones in the house but when executing follow me goes to either mine or her cell phone.
What I want the system to do is recognize the status of her or my at home flags and skip ringing the house phones and go straight to follow me which will ring one of our cell phones.
The home automation system takes care of the state management but I am looking for a way of making FreePBX take it into account.
Trying out Lorne’s script, the device presence state changes according to the script when it reads it back but the UCP doesn’t show that, and calls still go right through rather than off to follow-me. More research needed…
I take it back – the UCP is seeing the state changes. I wonder why follow-me doesn’t pay attention even after I set the action in UCP for away to be Findme/Follow Me.
Well well - it looks like presence states work fine – its my findme/followme I need to work on – I need to find a setting that does not ring the primary extension.
I finally punted to dynamic routing – Presence really seems like a weird animal and maybe a bit of a step child? I could only set the actions (e.g. the meaning) of the various states on the UCP. Seems like at least defaults should be available in the presence module.
Follow me did not work as I expected either – it didn’t seem at all sensitive to state of Away though it did DND did seem to prevent any phones from ringing.