Getting DND (presence) status via php

  1. 11 years ago

    I'm trying to make a simple webpage to show a single extension's status. I'm going to use this as their phone idle screen. How do I retrieve the status for a single extension via a standalone php page?

    Thanks.

  2. admin

    2 Apr 2013 Administrator

    Hi,

    FOP2 is not a php application. If you want to retrieve asterisk status from a php application the easier and best option is to enable AJAM in asterisk and use that.

    https://wiki.asterisk.org/wiki/display/ ... s+via+HTTP

    FOP2 uses a socket connection and custom protocol that is much much harder to work on, and it does not have a way to "query" for individual status.

  3. I was hoping that the status info was somehow available in a file or other database that could be accessed directly. I want to allow people to use the user panel to set their status and then query that status as well. I wonder if a callback to store that status elsewhere would work.

  4. admin

    2 Apr 2013 Administrator

    Fop2 has its own daemon that has its own state machine. It does not store data in any database or anything like it. If you want to see how fop2 talks to its clients, you can run it with debug level 12 and capture output. However, as I said before, it is not the right tool for the job in your case. You should be using ajam.

    Best regards,

  5. If you say so. I just thought there was somewhere that stored I'd set my status in FOP2 to be "out to lunch". since I can restart the service and retain that info (can't I?) I am not looking for off hook or in call, just the DND status.

    I really think a little API option to set and query statuses would be useful, but maybe that's another product.

    Tom...

  6. admin

    4 Apr 2013 Administrator

    I am sorry, I read your message (body) and did not pay much attention to the subject. I was talking about status (busy,fre,ringing) but you were talking about presence. In that case you can query the asterisk database (astdb) where that value is stored (family fop2state). And you can use Ajam to retrieve that value or asterisk itself:

    asterisk -rx "database show fop2state"

  7. This was exactly what I needed, and I learned some extra stuff as well. I now have the idlehome screen of my phone showing my DND presence.

    Them only other thing I'd like to see is have the panel show the presence as text in addition to the color/hint on the FOP2 panel.

    Thanks

  8. admin

    5 Apr 2013 Administrator

    If you mouse over the icon, it will display the full presence text.

    Best regards,

  9. just wondering if it could be displayed all the time without having to use the mouseover.

  10. admin

    8 Apr 2013 Administrator

    just wondering if it could be displayed all the time without having to use the mouseover.

    Not without coding. It *might* be possible to use jcallbakc.js hacks to do something about it, but I am not totally sure.

or Sign Up to reply!