Sip subscribe presence

Version 4 (Adrian Georgescu, 10/26/2008 02:19 pm) → Version 5/22 (Adrian Georgescu, 10/26/2008 02:32 pm)

== sip_subscribe_presence ==

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

=== Description ===

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

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

{{{
adigeo@ag-imac3:~$sip_subscribe_presence -h
Usage: sip_subscribe_presence [options] [target-user@target-domain.com] [presentity@presentity-domain.com]

This script will use SUBSCRIBE to the presence event published by the
specified
SIP target. address. If a SIP target address is not specified, it will subscribe to
its own
address.
presence. It will then interprete PIDF bodies contained in NOTIFYs and
display
their meaning. The program will un-SUBSCRIBE and quit when CTRL+D is
pressed.

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
-p PASSWORD, --password=PASSWORD
Password to use to authenticate the local account.
This overrides the setting from the config file.
-n DISPLAY_NAME, --display-name=DISPLAY_NAME
Display name to use for the local account. This
overrides the setting from the config file.
-e EXPIRES, --expires=EXPIRES
"Expires" value to set in SUBSCRIBE. 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.
-c CONTENT_TYPE, --content-type=CONTENT_TYPE
"Content-Type" the UA expects to receving in a NOTIFY
for this subscription. For the known events this does
not need to be specified, but may be overridden".
-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_subscribe_presence -a umts ag@ag-projects.com
Accounts available: 'alice', 'ew', 'mrg', 'pbx', 'tf', 'umts', 'unet', default
Using account 'umts': adi@umts.ro
Resolved DNS SRV record "_sip._udp.umts.ro" --> proxy.sipthor.net:5060
Resolved DNS A record "proxy.sipthor.net" --> 81.23.228.150, 81.23.228.129, 85.17.186.7
Subscribing to "<sip:ag@ag-projects.com>" for the presence event, at 85.17.186.7:5060
Received NOTIFY:
----------------
Presence for 31208005169@ag-projects.com:
Person id yipgulqr
Timestamp: 2008-10-26 10:37:32
Activities
Note(en): I am working
Mood: sad, contended, mean
Time offset from UTC: 60 minutes
---
Service id apgjjwtz
Timestamp: 2008-10-26 10:37:42
Status: open
----------------
Received NOTIFY:
----------------
Presence for 31208005169@ag-projects.com:
Person id ksgxtgwo
Timestamp: 2008-10-26 10:41:04
Mood: impressed, flirtatious, thirsty
Time offset from UTC: 60 minutes
Person id yipgulqr
Timestamp: 2008-10-26 10:37:32
Activities
Note(en): I am working
Mood: sad, contended, mean
Time offset from UTC: 60 minutes
---
Service id apgjjwtz
Timestamp: 2008-10-26 10:37:42
Status: open
Service id hxpzsnfp
Timestamp: 2008-10-26 10:41:00
Status: open
----------------
Received NOTIFY:
----------------
Presence for 31208005169@ag-projects.com:
Person id ksgxtgwo
Timestamp: 2008-10-26 10:41:04
Mood: impressed, flirtatious, thirsty
Time offset from UTC: 60 minutes
Person id yipgulqr
Timestamp: 2008-10-26 10:37:32
Activities
Note(en): I am working
Mood: sad, contended, mean
Time offset from UTC: 60 minutes
---
Service id apgjjwtz
Timestamp: 2008-10-26 10:37:42
Status: open
Service id hxpzsnfp
Timestamp: 2008-10-26 10:41:07
Status: closed
----------------

}}}