presence

I have the DND presence function working ok, however I was looking for examples for the additional presence features, like "out to lunch" & "meeting". I'd like to assign these to feature codes in asterisk, like *31, *32 etc, however I'm not able to make it work by looking at the DND feature code. Any hints/examples on how to make this work?

Thanks

Comments

  • I messed around with this and answered my own questions. In case anyone else is looking, this is what I did in freepbx. Create a custom destination that calls the context below, then created a Misc Application that directs to the custom destination with feature code *33. The context below checks if there is a fop2state set in the ASTDB for the extension, and if not then sets it with the value "Out to lunch". When the user is back from lunch and hits *33 again, it see's the entry in astdb, and removes it, clearing the status from the fop2 panel. I made a custom playback message (OutLunch), so you'd need to change that in the playback function below.

    This helps our receptionist know who is in & out of the office without having to intercom to the user to check.
    [app-lunch-toggle]
    exten => s,1,Answer
    exten => s,n,Wait(1)
    exten => s,n,Macro(user-callerid,)
    exten => s,n,Set(CHAN=${CUT(CHANNEL,-,1)})
    exten => s,n,Set(TEST=${DB_EXISTS(fop2state/${CHAN})})
    exten => s,n,GotoIf($[ "x${TEST}x" = "x0x" ]?50:70)
    exten => s,50,Set(DB(fop2state/${CHAN})=Out to lunch)
    exten => s,n,UserEvent(FOP2ASTDB|Family: fop2state|Channel: ${CHAN}|Value: Out to lunch)
    exten => s,n,Playback(custom/OutLunch&activated)
    exten => s,n,Macro(hangupcall,)
    exten => s,70,dbDel(fop2state/${CHAN})
    exten => s,n,UserEvent(FOP2ASTDB|Family: fop2state|Channel: ${CHAN}|Value: )
    exten => s,n,Playback(custom/OutLunch&de-activated)
    exten => s,n,Macro(hangupcall,)
    
  • Thanks for posting it out! I might add that to the FAQ or documentation in the future. Just for your information, the next fop release will have initial support for callback hooks in Perl. I am doing it in order to fire some custom dialplan applications when presence is changed (This way you can actually set your phone into DND in FreePBX when you set it in fop2 without the need to override freepbx dialplan). I am using it currently to set agents on pause.

    Best regards,
Sign In or Register to comment.