« Previous - Version 7/22 (diff) - Next » - Current version
Adrian Georgescu, 10/26/2008 06:32 pm


sip_publish_presence

To use this script you must to have a valid [wiki:configuration_file configuration file].

=== Description ===

[[Image(http://www.openxcap.org/chrome/site/SIMPLE-Server.png, align=right, nolink)]]

This script implements SIP PUBLISH method, for publishing event state. PUBLISH is similar to REGISTER in that it allows a user to create, modify, and remove state in another entity which manages this state on behalf of the user. Addressing a PUBLISH request is identical to addressing a SUBSCRIBE request. The Request-URI of a PUBLISH request is populated with the address of the resource for which the user wishes to publish event state. The user may in turn have multiple User Agents or endpoints that publish event state. Each endpoint may publish its own unique state, out of which the event state compositor generates the composite event state of the resource. In addition to a particular resource, all published event state is associated with a specific event package. Through a subscription to that event package, the user is able to discover the composite event state of all of the active publications.

Source code: [source:scripts/sip_publish_presence.py scripts/sip_publish_presence.py]

{{{
adigeo@ag-imac3:~$sip_publish_presence -h
Usage: sip_publish_presence [options]

This script will publish rich presence state of the specified SIP account to a
SIP Presence Agent, the presence information can be changed using a menu-
driven interface.

Options:
-h, --help show this help message and exit
-a NAME, --account-name=NAME
The account name from which to read account settings.
Corresponds to section Account_NAME in the
configuration file. If not supplied, the section
Account will be read.
--sip-address=SIP_ADDRESS
SIP address of the user in the form user@domain
-e EXPIRES, --expires=EXPIRES
"Expires" value to set in PUBLISH. Default is 300
seconds.
-o IP[:PORT], --outbound-proxy=IP[:PORT]
Outbound SIP proxy to use. By default a lookup of the
domain is performed based on SRV and A records. This
overrides the setting from the config file.
-s, --trace-sip Dump the raw contents of incoming and outgoing SIP
messages (disabled by default).
-l, --log-pjsip Print PJSIP logging output (disabled by default).
}}}

=== Example ===

{{{
adigeo@ag-imac3:~$sip_publish_presence
Accounts available: 'alice', 'ew', 'mrg', 'pbx', 'tf', 'umts', 'unet', default
Using default account:
Resolved DNS SRV record "_sip._udp.ag-projects.com" --> proxy.sipthor.net:5060
Resolved DNS A record "proxy.sipthor.net" --> 85.17.186.7, 81.23.228.150, 81.23.228.129

Commands:
a: set activities information
b: toggle basic status
m: set mood information
n: set note
q: quit program
s: show PIDF


  <tuple id="apgjjwtz">
    <status>
      <basic>open</basic>
    </status>
    <timestamp>2008-10-26T10:37:16+01:00</timestamp>
  </tuple>
  <dm:person id="yipgulqr">
    <rpid:time-offset>60</rpid:time-offset>
    <dm:timestamp>2008-10-26T10:37:16+01:00</dm:timestamp>
  </dm:person>
</presence>

Commands:
  a: set activities information
  b: toggle basic status
  m: set mood information
  n: set note
  q: quit program
  s: show PIDF

Commands:
  a: set activity
  c: clear all activity data
  d: delete activity
  n: set activity note
  q: quit program
  s: show current activity
  r: set random activity
  x: exit to upper level menu

Set note> I am working

Note set

Commands:
  a: set activities information
  b: toggle basic status
  m: set mood information
  n: set note
  q: quit program
  s: show PIDF

Commands:
  a: add a mood
  c: clear all mood data
  d: delete a mood
  n: set mood note
  q: quit program
  s: show current moods
  r: set random mood
  x: exit to upper level menu

You are now contended, sad, mean

Commands:
  a: set activities information
  b: toggle basic status
  m: set mood information
  n: set note
  q: quit program
  s: show PIDF

<?xml version='1.0' encoding='UTF-8'?>
<presence xmlns:rpid="urn:ietf:params:xml:ns:pidf:rpid" xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model" xmlns="urn:ietf:params:xml:ns:pidf" entity="31208005169@ag-projects.com">
  <tuple id="apgjjwtz">
    <status>
      <basic>open</basic>
    </status>
    <timestamp>2008-10-26T10:37:16+01:00</timestamp>
  </tuple>
  <dm:person id="yipgulqr">
    <rpid:mood>
      <rpid:mean/>
      <rpid:contended/>
      <rpid:sad/>
    </rpid:mood>
    <rpid:activities>
      <rpid:note xml:lang="en">I am working</rpid:note>
    </rpid:activities>
    <rpid:time-offset>60</rpid:time-offset>
    <dm:timestamp>2008-10-26T10:37:32+01:00</dm:timestamp>
  </dm:person>
</presence>

Commands:
  a: set activities information
  b: toggle basic status
  m: set mood information
  n: set note
  q: quit program
  s: show PIDF

Your basic status is now 'closed'

Commands:
  a: set activities information
  b: toggle basic status
  m: set mood information
  n: set note
  q: quit program
  s: show PIDF

Your basic status is now 'open'

Commands:
  a: set activities information
  b: toggle basic status
  m: set mood information
  n: set note
  q: quit program
  s: show PIDF

<?xml version='1.0' encoding='UTF-8'?>
<presence xmlns:rpid="urn:ietf:params:xml:ns:pidf:rpid" xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model" xmlns="urn:ietf:params:xml:ns:pidf" entity="31208005169@ag-projects.com">
  <tuple id="apgjjwtz">
    <status>
      <basic>open</basic>
    </status>
    <timestamp>2008-10-26T10:37:42+01:00</timestamp>
  </tuple>
  <dm:person id="yipgulqr">
    <rpid:mood>
      <rpid:mean/>
      <rpid:contended/>
      <rpid:sad/>
    </rpid:mood>
    <rpid:activities>
      <rpid:note xml:lang="en">I am working</rpid:note>
    </rpid:activities>
    <rpid:time-offset>60</rpid:time-offset>
    <dm:timestamp>2008-10-26T10:37:32+01:00</dm:timestamp>
  </dm:person>
</presence>

Commands:
  a: set activities information
  b: toggle basic status
  m: set mood information
  n: set note
  q: quit program
  s: show PIDF
}}}

{{fnlist}}

SIMPLE-Server.png (54 kB) Tijmen de Mes, 04/19/2012 09:23 pm