Sip session

Version 12 (Adrian Georgescu, 03/31/2009 02:44 pm)

1 2 Adrian Georgescu
== sip_session ==
2 1 Adrian Georgescu
3 2 Adrian Georgescu
[[TOC(SipTesting*, sip_*, depth=2)]]
4 2 Adrian Georgescu
5 2 Adrian Georgescu
To use this script you must to have a valid [wiki:SipSettingsAPI configuration].
6 1 Adrian Georgescu
7 4 Adrian Georgescu
=== Description ===
8 5 Adrian Georgescu
9 7 Adrian Georgescu
This script can be used to establish SIP sessions with more than one media type. One can add and remove RTP audio and MSRP chat to the same SIP session usine re-INVITE. The defaul behaviour is to establish outgoing session with both audio and chat media.
10 5 Adrian Georgescu
11 6 Adrian Georgescu
[[Image(http://www.tech-invite.com/img/cf3665/cf3665-37.gif)]]
12 6 Adrian Georgescu
13 1 Adrian Georgescu
{{{
14 1 Adrian Georgescu
Usage: sip_session [options] [target-user@target-domain.com]
15 1 Adrian Georgescu
16 1 Adrian Georgescu
This script will either sit idle waiting for an incoming MSRP session, or
17 1 Adrian Georgescu
start a MSRP session with the specified target SIP address. The program will
18 1 Adrian Georgescu
close the session and quit when CTRL+D is pressed.
19 1 Adrian Georgescu
20 1 Adrian Georgescu
Options:
21 1 Adrian Georgescu
  -h, --help            show this help message and exit
22 1 Adrian Georgescu
  -a ACCOUNT_ID, --account-id=ACCOUNT_ID
23 3 Adrian Georgescu
  -c [FILE], --config_file=[FILE]
24 3 Adrian Georgescu
                        The path to a configuration file to use. This
25 3 Adrian Georgescu
                        overrides the default location of the configuration
26 3 Adrian Georgescu
                        file.
27 3 Adrian Georgescu
  -S, --disable-sound   Disables initializing the sound card.
28 1 Adrian Georgescu
  -s, --trace-sip       Dump the raw contents of incoming and outgoing SIP
29 1 Adrian Georgescu
                        messages.
30 1 Adrian Georgescu
  -j, --trace-pjsip     Print PJSIP logging output.
31 1 Adrian Georgescu
  --trace-engine        Print core's events.
32 3 Adrian Georgescu
  -m, --trace-msrp      Log the raw contents of incoming and outgoing MSRP
33 3 Adrian Georgescu
                        messages.
34 3 Adrian Georgescu
  --no-relay            Don't use the MSRP relay.
35 3 Adrian Georgescu
  --msrp-tcp            Use TCP for MSRP connections.
36 4 Adrian Georgescu
}}}
37 4 Adrian Georgescu
38 11 Adrian Georgescu
=== Available commands  ===
39 11 Adrian Georgescu
40 11 Adrian Georgescu
{{{
41 11 Adrian Georgescu
adigeo@ag-imac3:~/work/python-sipsimple$sip_session 
42 11 Adrian Georgescu
Using account 31208005169@ag-projects.com
43 11 Adrian Georgescu
Type :help to get information about commands and shortcuts
44 11 Adrian Georgescu
Waiting for incoming SIP session requests...
45 11 Adrian Georgescu
Registering "Adrian G." <sip:31208005169@ag-projects.com> at 81.23.228.129:5060
46 11 Adrian Georgescu
Registered SIP contact address: sip:mdbwqhek@192.168.1.6:61453 (expires in 600 seconds)
47 11 Adrian Georgescu
31208005169@ag-projects.com> :help
48 11 Adrian Georgescu
:add audio|chat             Add a new stream to the current session.
49 11 Adrian Georgescu
:call URI [audio|chat]      Make an outgoing call. By default, use audio+chat
50 11 Adrian Georgescu
:dtmf DIGITS                Send DTMF digits. Also try CTRL-SPACE for virtual numpad
51 11 Adrian Georgescu
:help                       Print this help message
52 11 Adrian Georgescu
:hold                       Put the current session on hold
53 11 Adrian Georgescu
:remove audio|chat          Remove the stream from the current session
54 11 Adrian Georgescu
:switch  (or CTRL-N)        Switch between active sessions
55 11 Adrian Georgescu
:unhold                     Un-hold the current session
56 11 Adrian Georgescu
}}}
57 11 Adrian Georgescu
58 4 Adrian Georgescu
59 8 Adrian Georgescu
=== Example of audio only session ===
60 4 Adrian Georgescu
61 4 Adrian Georgescu
{{{
62 4 Adrian Georgescu
adigeo@ag-imac3:~$sip_session   
63 4 Adrian Georgescu
Using account 31208005169@ag-projects.com
64 4 Adrian Georgescu
Press Ctrl-d to quit or Control-n to switch between active sessions
65 4 Adrian Georgescu
Waiting for incoming SIP session requests...
66 4 Adrian Georgescu
Registering "Adrian G." <sip:31208005169@ag-projects.com> at 81.23.228.150:5060
67 4 Adrian Georgescu
Registered SIP contact address: sip:hctoyfvx@192.168.1.6:61277 (expires in 600 seconds)
68 4 Adrian Georgescu
Incoming Audio request from "Adrian G." <sip:31208005169@ag-projects.com>, do you accept? (y/n) y
69 4 Adrian Georgescu
Connecting SIP session to "Adrian G." <sip:31208005169@ag-projects.com>
70 4 Adrian Georgescu
Session established, using "speex" codec at 32000Hz
71 4 Adrian Georgescu
Audio RTP endpoints 192.168.1.6:50018 <-> 81.23.228.150:58260
72 4 Adrian Georgescu
Remote SIP User Agent is "sip2sip-0.9.0-pjsip-1.0.2-trunk-r2553"
73 4 Adrian Georgescu
Detected NAT type: Port Restricted
74 4 Adrian Georgescu
Audio to Adrian G. (31208005169@ag-projects.com): 
75 1 Adrian Georgescu
76 8 Adrian Georgescu
}}}
77 8 Adrian Georgescu
78 8 Adrian Georgescu
79 8 Adrian Georgescu
=== Example of chat only session ===
80 8 Adrian Georgescu
81 8 Adrian Georgescu
{{{
82 8 Adrian Georgescu
adigeo@ag-imac3:~$sip_session room1@chatserver.ag-projects.com
83 8 Adrian Georgescu
Using account 31208005169@ag-projects.com
84 8 Adrian Georgescu
Press Ctrl-d to quit or Control-n to switch between active sessions
85 8 Adrian Georgescu
Registering "Adrian G." <sip:31208005169@ag-projects.com> at 85.17.186.7:5060
86 10 Adrian Georgescu
Initiating SIP session from "Adrian G." <sip:31208005169@ag-projects.com> 
87 10 Adrian Georgescu
to sip:room1@chatserver.ag-projects.com via udp:81.23.228.146:6060 ...
88 8 Adrian Georgescu
Registered SIP contact address: sip:lpgdqwes@192.168.1.6:61392 (expires in 600 seconds)
89 8 Adrian Georgescu
Connecting SIP session to sip:room1@chatserver.ag-projects.com
90 8 Adrian Georgescu
Remote SIP User Agent is "sip-chatserver-0.9.1"
91 8 Adrian Georgescu
10:38:55 room1@chatserver.ag-projects.com: Welcome to the room, Adrian G.. You are the only participant in the room
92 8 Adrian Georgescu
Chat to room1@chatserver.ag-projects.com: 
93 8 Adrian Georgescu
}}}
94 8 Adrian Georgescu
95 8 Adrian Georgescu
=== Example of SDP with RTP and MSRP proposal ===
96 8 Adrian Georgescu
97 8 Adrian Georgescu
{{{
98 8 Adrian Georgescu
INVITE sip:61@ag-projects.com SIP/2.0
99 8 Adrian Georgescu
Via: SIP/2.0/UDP 192.168.1.6:61335;rport;branch=z9hG4bKPjTgHt1tWJgdV0tXsSCX.h9EJBZneF1134
100 8 Adrian Georgescu
Max-Forwards: 70
101 8 Adrian Georgescu
From: "Adrian G." <sip:31208005169@ag-projects.com>;tag=yf.gdZqZwOE5qcCB02qcKL9tdjtHK3-r
102 8 Adrian Georgescu
To: sip:61@ag-projects.com
103 8 Adrian Georgescu
Contact: <sip:rlafgmkq@192.168.1.6:61335>
104 8 Adrian Georgescu
Call-ID: slXPhUalLN3tiJYDKI5UnNOspHkV4PNb
105 8 Adrian Georgescu
CSeq: 16232 INVITE
106 8 Adrian Georgescu
Route: <sip:85.17.186.7:5060;lr>
107 8 Adrian Georgescu
Allow: SUBSCRIBE, NOTIFY, PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, MESSAGE
108 8 Adrian Georgescu
Supported: 100rel
109 8 Adrian Georgescu
User-Agent: sip2sip-0.9.0-pjsip-1.0.2-trunk-r2553
110 9 Adrian Georgescu
Proxy-Authorization: Digest username="31208005169", realm="ag-projects.com", 
111 9 Adrian Georgescu
nonce="49d092ef3dd41223af53ece9bc1b5ce903898ece", uri="sip:61@ag-projects.com", response="6baaa853d66bc376e8e56acbd512d16b"
112 8 Adrian Georgescu
Content-Type: application/sdp
113 8 Adrian Georgescu
Content-Length:   592
114 8 Adrian Georgescu
115 8 Adrian Georgescu
v=0
116 8 Adrian Georgescu
o=- 3447394641 3447394641 IN IP4 192.168.1.6
117 8 Adrian Georgescu
s= 
118 8 Adrian Georgescu
c=IN IP4 192.168.1.6
119 8 Adrian Georgescu
t=0 0
120 8 Adrian Georgescu
m=audio 50048 RTP/AVP 104 103 102 0 8 117 3 9 101
121 8 Adrian Georgescu
a=rtcp:50049 IN IP4 192.168.1.6
122 8 Adrian Georgescu
a=rtpmap:104 speex/32000
123 8 Adrian Georgescu
a=rtpmap:103 speex/16000
124 8 Adrian Georgescu
a=rtpmap:102 speex/8000
125 8 Adrian Georgescu
a=rtpmap:0 PCMU/8000
126 8 Adrian Georgescu
a=rtpmap:8 PCMA/8000
127 8 Adrian Georgescu
a=rtpmap:117 iLBC/8000
128 8 Adrian Georgescu
a=fmtp:117 mode=20
129 8 Adrian Georgescu
a=rtpmap:3 GSM/8000
130 8 Adrian Georgescu
a=rtpmap:9 G722/8000
131 8 Adrian Georgescu
a=rtpmap:101 telephone-event/8000
132 8 Adrian Georgescu
a=fmtp:101 0-15
133 8 Adrian Georgescu
a=sendrecv
134 8 Adrian Georgescu
m=message 2855 TCP/TLS/MSRP *
135 8 Adrian Georgescu
a=path:msrps://192.168.1.6:2855/f2a8d0dcf07af4869cdd;tcp
136 8 Adrian Georgescu
a=accept-types:message/cpim text/*
137 8 Adrian Georgescu
a=accept-wrapped-types:*
138 1 Adrian Georgescu
}}}