Project

General

Profile

Sip register » History » Version 18

Adrian Georgescu, 03/12/2009 08:05 PM

1 16 Adrian Georgescu
== sip_register ==
2 1 Adrian Georgescu
3 17 Adrian Georgescu
[[TOC(SipTesting*, sip_*, depth=2)]]
4
5 18 Adrian Georgescu
To use this script you must to have a valid [wiki:SipSettingsAPI configuration].
6 2 Adrian Georgescu
7 16 Adrian Georgescu
=== Description ===
8 6 Adrian Georgescu
9 12 Adrian Georgescu
SIP protocol offers a discovery capability. If a user wants to initiate a session
10
with another user, he must discover the current host(s) at which the
11 8 Adrian Georgescu
destination user is reachable. To do this, SIP network elements consult an
12
abstract service known as a location service, which provides address
13
bindings for a particular domain. Registration entails sending a REGISTER
14
request to a special type of UAS known as a registrar.  A registrar acts as
15
the front end to the location service for a domain, reading and writing
16
mappings based on the contents of REGISTER requests. This location service
17
is then typically consulted by a proxy server that is responsible for
18
routing requests for that domain.
19
20
This script implements REGISTER method, which registers the contact (ip:port
21
address) for a given address of record (SIP address).
22
23 6 Adrian Georgescu
Source code: [source:scripts/sip_register.py scripts/sip_register.py]
24 3 Adrian Georgescu
25 1 Adrian Georgescu
{{{
26
adigeo@ag-imac3:~$sip_register.py -h
27
Usage: sip_register.py [options]
28
29
This script will register a SIP account to a SIP registrar and refresh it
30
while the program is running. When Ctrl+D is pressed it will unregister.
31
32
Options:
33
  -h, --help            show this help message and exit
34
  -a ACCOUNT_NAME, --account-name=ACCOUNT_NAME
35
                        The account name from which to read account settings.
36
                        Corresponds to section Account_NAME in the
37
                        configuration file.
38
  --sip-address=SIP_ADDRESS
39
                        SIP login account
40
  -p PASSWORD, --password=PASSWORD
41
                        Password to use to authenticate the local account.
42
                        This overrides the setting from the config file.
43
  -n DISPLAY_NAME, --display-name=DISPLAY_NAME
44
                        Display name to use for the local account. This
45
                        overrides the setting from the config file.
46
  -e EXPIRES, --expires=EXPIRES
47
                        "Expires" value to set in REGISTER. Default is 300
48
                        seconds.
49
  -o IP[:PORT], --outbound-proxy=IP[:PORT]
50
                        Outbound SIP proxy to use. By default a lookup of the
51
                        domain is performed based on SRV and A records. This
52
                        overrides the setting from the config file.
53
  -s, --trace-sip       Dump the raw contents of incoming and outgoing SIP
54
                        messages (disabled by default).
55
  -l, --log-pjsip       Print PJSIP logging output (disabled by default).
56 7 Adrian Georgescu
  -r MAX_REGISTERS, --max-registers=MAX_REGISTERS
57
                        Max number of REGISTERs sent (default 1).
58 1 Adrian Georgescu
}}}
59
60 16 Adrian Georgescu
=== Example ===
61 1 Adrian Georgescu
62
{{{
63
adigeo@ag-imac3:~$sip_register 
64
Using default account: 31208005169@ag-projects.com
65
Resolved DNS SRV record "_sip._udp.ag-projects.com" --> proxy.sipthor.net:5060
66
Resolved DNS A record "proxy.sipthor.net" --> 85.17.186.7, 81.23.228.150, 81.23.228.129
67
Registering ""Adrian G." <sip:31208005169@ag-projects.com>" at 81.23.228.150:5060
68
REGISTER was successful
69
Contact: <sip:163d949d32@192.168.1.6:49521> (expires in 300 seconds)
70
Other registered contacts:
71
<sip:31208005169@192.168.1.122:5062;line=634g6j67> (expires in 559 seconds)
72
<sip:31208005169@192.168.1.123:5060> (expires in 205 seconds)
73
<sip:4429c5c061@192.168.1.6:49515> (expires in 152 seconds)
74
<sip:5a9c042eb4@192.168.1.6:49511> (expires in 135 seconds)
75
<sip:31208005169@192.168.1.1;uniq=5B2860C44383A3D6705629A7E1FB8> (expires in 1014 seconds)
76
<sip:31208005169@80.101.96.20:61359> (expires in 981 seconds)
77
Press Ctrl+D to stop the program
78
}}}