PRESENCE_STATE(provider,field[,options])
The PRESENCE_STATE function can be used to retrieve the presence from any presence provider. For example:
NoOp(SIP/mypeer has presence ${PRESENCE_STATE(SIP/mypeer,value)})
NoOp(Conference number 1234 has presence message ${PRESENCE_STATE(MeetMe:1234,message)})
The PRESENCE_STATE function can also be used to set custom presence state from the dialplan. The CustomPresence: prefix must be used. For example:
Set(PRESENCE_STATE(CustomPresence:lamp1)=away,temporary,Out to lunch)
Set(PRESENCE_STATE(CustomPresence:lamp2)=dnd,,Trying to get work done)
Set(PRESENCE_STATE(CustomPresence:lamp3)=xa,T24gdmFjYXRpb24=,,e)
Set(BASE64_LAMP3_PRESENCE=${PRESENCE_STATE(CustomPresence:lamp3,subtype,e)})
You can subscribe to the status of a custom presence state using a hint in the dialplan:
exten => 1234,hint,,CustomPresence:lamp1
The possible values for both uses of this function are:
not_set | unavailable | available | away | xa | chat | dnd
providerrequired - The provider of the presence, such asCustomPresencefieldrequired - Which field of the presence state information is wanted.value- The current presence, such asawaysubtype- Further information about the current presencemessage- A custom message that may indicate further details about the presence
optionse- On Write - Use this option when the subtype and message provided are Base64 encoded. The values will be stored encoded within Asterisk, but all consumers of the presence state (e.g. the SIP presence event package) will receive decoded values. On Read - Retrieves unencoded message/subtype in Base64 encoded form.
User Notes
No notes yet. Be the first to contribute a tip or example.
Contribute a note
Share a tip, gotcha, or practical example. Keep it under 2000 characters. No questions (use the Asterisk community forums for support). Wrap code in backticks.