Sip subscribe presence » History » Version 6
Adrian Georgescu, 10/26/2008 06:23 PM
| 1 | 1 | Adrian Georgescu | == sip_subscribe_presence == |
|---|---|---|---|
| 2 | |||
| 3 | To use this script you must to have a valid [wiki:configuration_file configuration file]. |
||
| 4 | |||
| 5 | === Description === |
||
| 6 | |||
| 7 | 6 | Adrian Georgescu | [[Image(http://www.openxcap.org/chrome/site/SIMPLE-Server.png, align=right, nolink)]] |
| 8 | 4 | Adrian Georgescu | |
| 9 | 3 | Adrian Georgescu | Source code: [source:scripts/sip_subscribe_presence.py scripts/sip_subscribe_presence.py] |
| 10 | |||
| 11 | 1 | Adrian Georgescu | {{{ |
| 12 | adigeo@ag-imac3:~$sip_subscribe_presence -h |
||
| 13 | 5 | Adrian Georgescu | Usage: sip_subscribe_presence [options] [target-user@target-domain.com] |
| 14 | 1 | Adrian Georgescu | |
| 15 | 5 | Adrian Georgescu | This script will SUBSCRIBE to the presence event published by the specified |
| 16 | SIP target. If a SIP target is not specified, it will subscribe to its own |
||
| 17 | address. It will then interprete PIDF bodies contained in NOTIFYs and display |
||
| 18 | their meaning. The program will un-SUBSCRIBE and quit when CTRL+D is pressed. |
||
| 19 | 1 | Adrian Georgescu | |
| 20 | Options: |
||
| 21 | -h, --help show this help message and exit |
||
| 22 | -a NAME, --account-name=NAME |
||
| 23 | The account name from which to read account settings. |
||
| 24 | Corresponds to section Account_NAME in the |
||
| 25 | configuration file. If not supplied, the section |
||
| 26 | Account will be read. |
||
| 27 | --sip-address=SIP_ADDRESS |
||
| 28 | SIP address of the user in the form user@domain |
||
| 29 | -p PASSWORD, --password=PASSWORD |
||
| 30 | Password to use to authenticate the local account. |
||
| 31 | This overrides the setting from the config file. |
||
| 32 | -n DISPLAY_NAME, --display-name=DISPLAY_NAME |
||
| 33 | Display name to use for the local account. This |
||
| 34 | overrides the setting from the config file. |
||
| 35 | -e EXPIRES, --expires=EXPIRES |
||
| 36 | "Expires" value to set in SUBSCRIBE. Default is 300 |
||
| 37 | seconds. |
||
| 38 | -o IP[:PORT], --outbound-proxy=IP[:PORT] |
||
| 39 | Outbound SIP proxy to use. By default a lookup of the |
||
| 40 | domain is performed based on SRV and A records. This |
||
| 41 | overrides the setting from the config file. |
||
| 42 | -c CONTENT_TYPE, --content-type=CONTENT_TYPE |
||
| 43 | "Content-Type" the UA expects to receving in a NOTIFY |
||
| 44 | for this subscription. For the known events this does |
||
| 45 | not need to be specified, but may be overridden". |
||
| 46 | -s, --trace-sip Dump the raw contents of incoming and outgoing SIP |
||
| 47 | messages (disabled by default). |
||
| 48 | -l, --log-pjsip Print PJSIP logging output (disabled by default). |
||
| 49 | }}} |
||
| 50 | 2 | Adrian Georgescu | |
| 51 | === Example === |
||
| 52 | |||
| 53 | {{{ |
||
| 54 | adigeo@ag-imac3:~$sip_subscribe_presence -a umts ag@ag-projects.com |
||
| 55 | Accounts available: 'alice', 'ew', 'mrg', 'pbx', 'tf', 'umts', 'unet', default |
||
| 56 | Using account 'umts': adi@umts.ro |
||
| 57 | Resolved DNS SRV record "_sip._udp.umts.ro" --> proxy.sipthor.net:5060 |
||
| 58 | Resolved DNS A record "proxy.sipthor.net" --> 81.23.228.150, 81.23.228.129, 85.17.186.7 |
||
| 59 | Subscribing to "<sip:ag@ag-projects.com>" for the presence event, at 85.17.186.7:5060 |
||
| 60 | Received NOTIFY: |
||
| 61 | ---------------- |
||
| 62 | Presence for 31208005169@ag-projects.com: |
||
| 63 | Person id yipgulqr |
||
| 64 | Timestamp: 2008-10-26 10:37:32 |
||
| 65 | Activities |
||
| 66 | Note(en): I am working |
||
| 67 | Mood: sad, contended, mean |
||
| 68 | Time offset from UTC: 60 minutes |
||
| 69 | --- |
||
| 70 | Service id apgjjwtz |
||
| 71 | Timestamp: 2008-10-26 10:37:42 |
||
| 72 | Status: open |
||
| 73 | ---------------- |
||
| 74 | Received NOTIFY: |
||
| 75 | ---------------- |
||
| 76 | Presence for 31208005169@ag-projects.com: |
||
| 77 | Person id ksgxtgwo |
||
| 78 | Timestamp: 2008-10-26 10:41:04 |
||
| 79 | Mood: impressed, flirtatious, thirsty |
||
| 80 | Time offset from UTC: 60 minutes |
||
| 81 | Person id yipgulqr |
||
| 82 | Timestamp: 2008-10-26 10:37:32 |
||
| 83 | Activities |
||
| 84 | Note(en): I am working |
||
| 85 | Mood: sad, contended, mean |
||
| 86 | Time offset from UTC: 60 minutes |
||
| 87 | --- |
||
| 88 | Service id apgjjwtz |
||
| 89 | Timestamp: 2008-10-26 10:37:42 |
||
| 90 | Status: open |
||
| 91 | Service id hxpzsnfp |
||
| 92 | Timestamp: 2008-10-26 10:41:00 |
||
| 93 | Status: open |
||
| 94 | ---------------- |
||
| 95 | Received NOTIFY: |
||
| 96 | ---------------- |
||
| 97 | Presence for 31208005169@ag-projects.com: |
||
| 98 | Person id ksgxtgwo |
||
| 99 | Timestamp: 2008-10-26 10:41:04 |
||
| 100 | Mood: impressed, flirtatious, thirsty |
||
| 101 | Time offset from UTC: 60 minutes |
||
| 102 | Person id yipgulqr |
||
| 103 | Timestamp: 2008-10-26 10:37:32 |
||
| 104 | Activities |
||
| 105 | Note(en): I am working |
||
| 106 | Mood: sad, contended, mean |
||
| 107 | Time offset from UTC: 60 minutes |
||
| 108 | --- |
||
| 109 | Service id apgjjwtz |
||
| 110 | Timestamp: 2008-10-26 10:37:42 |
||
| 111 | Status: open |
||
| 112 | Service id hxpzsnfp |
||
| 113 | Timestamp: 2008-10-26 10:41:07 |
||
| 114 | Status: closed |
||
| 115 | ---------------- |
||
| 116 | |||
| 117 | }}} |