Presence
About
Presence allows one UA to "watch" others by subscribing to related event packages.
Click here to expand Table of Contents
SIP Presence
FreeSWITCH supports presence out of the box.
On the client side, if you use xlite/eyebeam, create a new contact and check "Show this contact's availability". It should then SUBSCRIBE to that contact and start getting NOTIFY messages like this:
NOTIFY sip:1004@192.168.0.24:16106 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.24;rport;branch=z9hG4bK1ZyZg6vmjcQXK
Max-Forwards: 70
From: "1000" <sip:1000@192.168.0.24>;tag=DUpS1eSZBN9Sj
To: "Seven3" <sip:1004@192.168.0.24>;tag=e0dec858
Call-ID: MDcxOTc1ODZlMGFhN2M4Yjc0YmViYzYyMzdjYzVhOTk.
CSeq: 20695499 NOTIFY
Contact: <sip:1000@192.168.0.24:5060>
User-Agent: FreeSWITCH-mod_sofia/1.0.head-git-dac9d6e 2011-11-19 19-12-08 -0600
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, UPDATE, INFO, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, precondition, path, replaces
Event: presence
Allow-Events: talk, hold, presence, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
Subscription-State: terminated;reason=noresource
Content-Type: application/pidf+xml
Content-Length: 431
<?xml version="1.0" encoding="ISO-8859-1"?>
<presence xmlns='urn:ietf:params:xml:ns:pidf'
xmlns:dm='urn:ietf:params:xml:ns:pidf:data-model'
xmlns:rpid='urn:ietf:params:xml:ns:pidf:rpid'
xmlns:c='urn:ietf:params:xml:ns:pidf:cipid' entity='sip:1000@192.168.0.24'>
<tuple id='t6a5ed77e'>
<status>
<basic>open</basic>
</status>
</tuple>
<dm:person id='p06360c4a'>
<dm:note>Available</dm:note>
</dm:person>
</presence>
FreeSWITCH as a client
FreeSWITCH can work as a client to SUBSCRIBE to a server (another FreeSWITCH), to enable this, add a subscriptions section to your gateway config, e.g.
<include>
<gateway name="fs2">
<param name="realm" value="192.168.7.2"/>
<param name="username" value="1000"/>
<param name="password" value="1234"/>
<param name="register" value="false"/>
<subscriptions name="x">
<!-- <subscription event="presence">
<param name="retry-seconds" value="50"/>
<param name="expire-seconds" value="60"/>
<param name="content-type" value="application/pidf+xml"/>
</subscription> -->
<subscription event="dialog">
<param name="retry-seconds" value="40"/>
<param name="expire-seconds" value="60"/>
<param name="content-type" value="application/dialog-info+xml"/>
<!-- when username-in-request is true the SIP request line will be in the format sip:user@server
by default it's false and request line sill be in the format of sip:server -->
<param name="username-in-request" value="true"/>
</subscription>
<!-- <subscription event="eventlist">
<param name="retry-seconds" value="40"/>
<param name="expire-seconds" value="60"/>
<param name="content-type" value="application/rlmi+xml"/>
</subscription> -->
</subscriptions>
</gateway>
</include>
Note, FreeSWITCH (server) also supports dialog events in addition to presence. eventlist is not supported (on server side) at this time.
On getting NOTIFY, a NOTIFY_IN event will be fired.
XMPP presence
not tested.