Currently you are not logged in.

 Login | Register 

Main

Resources

Training

Events

Development

Resources -> Documentation -> Presence -> Presence Server -> Presence Module - Parameters and Functions

  1. Exported Functions
  2. Exported Parameters
  3. Developer's Guide
  4. Module Readme

Exported Functions

  • handle_publish()
  • handle_subscribe()

handle_publish()

  • function which handles PUBLISH requests. It stores and updates presence information in database and calls functions to send NOTIFY messages when changes in presence information occur;
  • it takes one optional parameter - the URI of the sender, used by the BLA feature( event dialog;sla ).

Actions:

  • verifies if the PUBLISH message is correct:
    • check its structure - calls an event specific function defined in a presence_ev module (presence_xml or presence_mwi);
    • if it has a SIP-if-Match header, checks is there is a previous record for the same presentity;
    • if not present checks if a body is present
  • if the conditions are not complied with it sends an adequate error message
  • if a correct message:
    • sends a 200Ok message with 2 extra header fields : Expires and SIP-if-Match
  • if a new PUBLISH without a Sip-if-Match header field
    • it generates one
    • inserts a new row in database
    • calls a function which sends Notify with presence to all the watchers which have subscribed to the presentity
  • if the PUBLISH message is a sequential one
    • updates the expires value
    • generates a new E-Tag and sends it in the Sip-Etag header of the 200OK reply
  • if body present
    • updates body (replace with the new one)
    • calls a function which sends Notify with presence to all watchers

handle_subscribe()

  • function which handles SUBSCRIBE requests. It stores or updates dialog information in and calls functions to send Notify messages to teh watcher and to the presentity (if a subscription for event presence.winfo exists for the presentity and the event)
  • it does not take any parameter.

Actions

  • checks if the SUBSCRIBE message is correct:
    • check its structure;
    • if inside a dialog tries to match the dialogs with the records stored
  • if the conditions are not complied with it sends an adequate error message
  • if a correct message sends 2XX reply
    • the reply contains an Expires header
    • for SUBSCRIBE messages for event "presence.winfo" the status of the reply is 202OK and for all the other 200OK
  • if a new SUBSCRIBE, saves the dialog information in cache
  • if a Subscribe inside a dialog
    • if the Expires header field value is 0
      • deletes the registration from cache and database
      • if event is a PUBLISH event - sends a Notify for winfo to the presentity with full state
    • if update
      • updates the expires value
      • sends Notifies
  • if a SUBSCRIBE for a PUBLISH event( 'presence', 'dialog.sla', 'message-summary'):
    • sends Notify with presence.winfo to the presentity(if a winfo subscription from the presentity exists) with a partial state informing only about the subscription status of the new watcher
    • sends Notify with the presence information
  • if a SUBSCRIBE for a winfo(watcher info) event
    • sends Notify with presence.winfo to the subscriber with full state informing about all the watchers

Exported Paramters

  • db_url : database url
  • presentity_table: the name of the database table used for storing published info
  • active_watchers_table: the name of the database table used for storing Subscribe dialog info
  • watchers_table: the name of the database table used for storing subscription status for watchers
  • clean_period : time period for cleaning expired PUBLISH or SUBSCRIBE messages from database
  • to_tag_pref : prefix used when generating to_tag when sending replies for SUBSCRIBE requests
  • expires_offset' : the value that should be substracted from the expires value when sending a 200OK for a publish or subscribe to force the client cu send an update before the old request expires
  • max_expires : reduce validity of PUBLISH/SUBSCRIBE to this value if the Expires in request is greater.
  • server_address': presence server address to be included in Contact header field for Subscribe and Publish replies and in Notify messages.
  • fallback2db: parameter which enables a fallback to db mode of operation. In this mode, in case a searched record is not found in cache, the search is continued in database. Useful for an architecture in which processing and memory load might be divided on more machines using the same database.
  • subs_htable_size: the size of the hash table storing subscription dialogs(used as the power of 2 when computing table size)
  • pres_htable_size: the size of the hash table storing published info (used as the power of 2 when computing table size)
  • enable_sphere_check: a flag that should be set if privacy rules include sphere checking. The sphere information is expected to be present in the RPID body published by the presentity. The flag is introduced as this check requires extra processing that should be avoided if this feature is not supported by the clients.

Developer's Guide

Module Readme

You can read the module's documentation here .

Your VoIP Account

News

OpenSIPS 1.6.2

11th of March 2010 OpenSIPS 1.6.2 is brings new features...
Read more...

OpenSIPS Control Panel 4.0

08th of March 2010 OpenSIPS CP 4.0 comes with user provisioning...
Read more...

Conference on "OpenSIPS 2.0"

5th of March 2010 VoIP Users Conference will host an audio conference
Read more...

OpenSIPS webinar

25th of February 2010 Next webinars is Explaining the default script
Read more...

OpenSIPS 2.0 Design

15th of February 2010 Design of OpenSIPS 2.0 is unveiled
Read more...

OpenSIPS webinar

28th of January 2010 Next OpenSIPS webinars is SIP Introduction
Read more...

Building Telephony Systems with OpenSIPS 1.6

21st of January 2010 New edition is available...
Read more...

OpenSIPS 1.6.1 is released

21st of December 2009 OpenSIPS 1.6.1 minor release is out...
Read more...

OpenSIPS Development Course

17th of December 2009 OpenSIPS Devel Course for 2010...
Read more...

OpenSIPS Bootcamps 2010

09th of December 2009 2010 Schedule for Bootcamp events...
Read more...

User Location is faster

13th of November 2009 USRLOC is 3 time faster than before...
Read more...

OpenSIPS Control Panel 3.0

30th of October 2009 OpenSIPS CP 3.0 major release is out...
Read more...

OpenSIPS 1.6.0 is released

16th of October 2009 OpenSIPS 1.6.0 major release is out...
Read more...

OpenSIPS VoIP Service

21th of September 2009 OpenSIPS project offers free VoIP services...
Read more...

OpenSIPS & Astricon

21th of September 2009 OpenSIPS talks and exhibits at Astricon 2009...
Read more...

SVN freeze

17th of September 2009 SVN trunk gets frozen to prepare 1.6 release...
Read more...

New types of script routes

10th of September 2009 New additions to configuration file routes...
Read more...

STUN server

7th of September 2009 OpenSIPS has now a built-in STUN server...
Read more...

Pseudovariable implementation extended

3rd of September 2009 Added new operations for pvars to give more power to the script writer...
Read more...

OpenSIPS Asterisk Integration

30th of August 2009 Tutorial for realtime integration...
Read more...

OpenSIPS 1.5.3 is released

27th of August 2009 OpenSIPS 1.5.3 minor release is out...
Read more...

AAA and RADIUS support

18th of April 2009 New AAA API and RADIUS enhancements in OpenSIPS
Read more...

OpenSIPS webinar

4th of April 2009 Next OpenSIPS webinars is Types of Routs in OpenSIPS
Read more...

B2BUA

3rd of August 2009 A B2BUA signaling implementation in OpenSIPS
Read more...

DB virtual

23th of July 2009 A DB conn mixer for failover, parallel and LB
Read more...

Codec manipulation

23th of July 2009 SDP codecs and priorities manipulation
Read more...

Memcached interfacing

16th of July 2009 memcached support for memory caching API
Read more...

OpenSIPS 1.5.2 is released

15th of July 2009 OpenSIPS 1.5.2 minor release is out...
Read more...

OpenSIPS@ClueCon

14th of July 2009 OpenSIPS talks at ClueCon
Read more...

OpenSIPS webinar

30th of June 2009 Next OpenSIPS webinars is Routing in SIP
Read more...

REGISTRAR enhancements

29th of June 2009 REGISTRAR module becomes more flexible
Read more...

OpenSIPS free webinars

01st of June 2009 OpenSIPS webinars program was launched
Read more...

OpenSIPS-CP 2.0 is released

13rd of April 2009 OpenSIPS Control Panel 2.0 major release is out...
Read more...

OpenSIPS 1.5.1 is released

13rd of April 2009 OpenSIPS 1.5.1 minor release is out...
Read more...

OpenSIPS 1.5.0 is released

23rd of March 2009 OpenSIPS 1.5.0 major release is out...
Read more...

OpenSIPS 1.4.5 is released

23rd of March 2009 OpenSIPS 1.4.5 minor release is out...
Read more...

OpenSIPS as Load Balancer

4th of March 2009
How to do real Load-Balancing for media servers ...
Read more...

OpenSIPS at Amoocon (AsteriskTAG)

24th of February 2009
3 hot topics presented at Amoocon ...
Read more...


Edit | History | Print | Recent Changes | Search
Page last modified on July 21, 2008, at 07:43 PM