Trying to understand Presence

We use Digium D70 phones with FreePBX. I have been running FOP2 for a couple years now, and we'd like to start taking advantage of presence. What I'm learning is that the presence icon will change on FOP only if setting DND via a feature code. Presence does not update when selecting DND via the soft-key on the actual phone. Is it possible to have FOP2 recognize when DND is set directly on the phone? I do know that hints are created for DND, but I don't know that FOP2 uses hints.

Thanks you.

Comments

  • Hi,

    FOP2 does not use hints for its presence box, it uses astdb entries for it. If you can program the phone to dial the FreePBX feature code, then it will update state. Otherwise it won't. I do not know if Digium phones can be programmed in that way. Does any hint changes on Asterisk itself when you press the dnd button on that phone? Are there any events triggered in asterisk AMI when doing so?

    Best regards,
  • I guess I was wrong and it does update astDB, but is maybe using a custom presence. See this thread: http://forums.asterisk.org/viewtopic.php?f=49&t=95036
  • Then we have an entry that could be used to poll for DND status at fop2 startup. But most importantly -and probably lacking- is that FOP2 needs an AMI event indicating of a status change. Without that, FOP2 won't detect when a phone changes status. If you can start FOP2 in debug mode and look at AMI events when you set a phone on DND to see if there is such an event, it would really help to add support for that custom state for digium phones.



  • Which Debug level? I've added the "all" permission to manager.conf and restarted FOP2. It in fact does register the DND, but when I change back to available, it does not register. I have to dial the feature code to toggle the status in FOP2
  • Adding an entry (or removing it) from ASTDB does not trigger an AMI event in Asterisk. FOP2 relies on those events to show status. If there is no event being fired via AMI there is no way to track real time status changes. With the FreePBX integration, what FOP2 does is inject some actions into the regular FreePBX feature codes so it fires an event via the UserEvent application, that FOP2 can understand to reflect the status change. So, in order to see if there is any AMI event broadcasted when you set/unset DND in your phone, you can start fop2_server with debug level set to 1, that will show only the AMI events. Something like this:

    service fop2 stop
    cd /usr/local/fop2
    script capture.log
    ./fop2_server -X 1

    AT this point log into FOP2 to see the panel, then try setting/unsetting DND with your phone, look at the screen to see if there is any related event when you press the button. Then

    ctrl-C
    exit
    service fop2 start

    AT this point you have the capture.log file to inspect in more detail if you want.. I do not know about DPMA and how it works.. if it talks directly to Asterisk with no way to alter behaviour, and it only sets/unset an astdb entry, then I guess you won't be seeing a related event reflecting that status change, making real time monitoring of that state just not possible.

    Best regards,


  • Ok, doing that, I see this activity:
    127.0.0.1            <- Event: PeerEntry
    127.0.0.1            <- Channeltype: SIP
    127.0.0.1            <- ObjectName: 4807
    127.0.0.1            <- ChanObjectType: peer
    127.0.0.1            <- IPaddress: x.x.x.x
    127.0.0.1            <- IPport: 5060
    127.0.0.1            <- Dynamic: yes
    127.0.0.1            <- Forcerport: no
    127.0.0.1            <- VideoSupport: no
    127.0.0.1            <- TextSupport: no
    127.0.0.1            <- ACL: yes
    127.0.0.1            <- Status: OK (2 ms)
    127.0.0.1            <- RealtimeDevice: no
    
    127.0.0.1            <- Response: Follows
    127.0.0.1            <- Privilege: Command
    127.0.0.1            <- ActionID: 8
    127.0.0.1            <- /fop2state/SIP/4807                               : Do not Disturb
    1 results found.
    
    127.0.0.1            <- Response: Success
    127.0.0.1            <- ActionID: 86
    127.0.0.1            <- Message: Mailbox Status
    127.0.0.1            <- Mailbox: 4807@default
    127.0.0.1            <- Waiting: 0
    
    127.0.0.1            <- Response: Success
    127.0.0.1            <- ActionID: 87
    127.0.0.1            <- Message: Mailbox Message Count
    127.0.0.1            <- Mailbox: 4807@default
    127.0.0.1            <- UrgMessages: 0
    127.0.0.1            <- NewMessages: 0
    127.0.0.1            <- OldMessages: 0
    
    127.0.0.1            <- Event: PeerStatus
    127.0.0.1            <- Privilege: system,all
    127.0.0.1            <- ChannelType: SIP
    127.0.0.1            <- Peer: SIP/4807
    127.0.0.1            <- PeerStatus: Registered
    127.0.0.1            <- Address: x.x.x.x:5060
    
    

    Seems that FOP2 reflects when DND is activated, but not when it's deactivated. I will have to use the feature code to get FOP2 to reflect available again, and sometimes I have to use the feature code twice. I'm wondering if there are too many events for FOP2 to keep up?
  • The event you saw is the initial poll of status when fop2 starts... it is not a runtime event when your phone changes status. As I have suspected, there is no such event. And because of that reason, FOP2 won't be able to monitor DND in real time.. and making it poll for DND status for all extensions every X time is not only unelegant, but also overkill. The phone or DPMA should be able to be customised the same way we do customizations to FreePBX dnd macros (using the generate_override_contexts.pl script provided with fop2), so we can fire a manager UserVent when state is changed via DND button.

    FOP2 monitors asterisk only, it does not monitor nor control phones themselves. Many phones can be programmed so the DND button dials the feature code directly, in those cases, you only need to program the DND button on the phone and it will work as expected.

    Unless DPMA allows you to inject some code in order to fire a manager event, then FOP2 won't notice a change when dnd is set or unset in your Digium phone.

    Best regards,
  • Makes perfect sense, thanks for your help.
Sign In or Register to comment.