Project

General

Profile

Sip session » History » Version 24

Adrian Georgescu, 04/14/2009 09:57 AM

1 2 Adrian Georgescu
== sip_session ==
2 1 Adrian Georgescu
3 2 Adrian Georgescu
[[TOC(SipTesting*, sip_*, depth=2)]]
4
5 4 Adrian Georgescu
=== Description ===
6 5 Adrian Georgescu
7 23 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 using re-INVITE.
8 5 Adrian Georgescu
9 6 Adrian Georgescu
[[Image(http://www.tech-invite.com/img/cf3665/cf3665-37.gif)]]
10
11 1 Adrian Georgescu
{{{
12 15 Adrian Georgescu
adigeo@ag-imac3:~$sip_session -h
13
Usage: sip_session [options] [target-user@target-domain.com] [audio|chat]
14 1 Adrian Georgescu
15 15 Adrian Georgescu
This script will either sit idle waiting for an incoming session, or start a
16
new session with the specified target SIP address. The program will close the
17
session and quit when CTRL-D is pressed. This scripts supports RTP audio and
18
MSRP chat sessions.
19 1 Adrian Georgescu
20
Options:
21
  -h, --help            show this help message and exit
22 15 Adrian Georgescu
  -a ACCOUNT_NAME, --account-name=ACCOUNT_NAME
23
                        The name of the account to use.
24
  --no-register         Bypass registration.
25
  -c FILE, --config_file=FILE
26 3 Adrian Georgescu
                        The path to a configuration file to use. This
27
                        overrides the default location of the configuration
28
                        file.
29
  -S, --disable-sound   Disables initializing the sound card.
30 1 Adrian Georgescu
  -s, --trace-sip       Dump the raw contents of incoming and outgoing SIP
31
                        messages.
32
  -j, --trace-pjsip     Print PJSIP logging output.
33
  --trace-engine        Print core's events.
34 3 Adrian Georgescu
  -m, --trace-msrp      Log the raw contents of incoming and outgoing MSRP
35
                        messages.
36
  --no-relay            Don't use the MSRP relay.
37
  --msrp-tcp            Use TCP for MSRP connections.
38 4 Adrian Georgescu
}}}
39
40 11 Adrian Georgescu
=== Available commands  ===
41
42
{{{
43
adigeo@ag-imac3:~/work/python-sipsimple$sip_session 
44
Using account 31208005169@ag-projects.com
45
Type :help to get information about commands and shortcuts
46
Waiting for incoming SIP session requests...
47
Registering "Adrian G." <sip:31208005169@ag-projects.com> at 81.23.228.129:5060
48
Registered SIP contact address: sip:mdbwqhek@192.168.1.6:61453 (expires in 600 seconds)
49
31208005169@ag-projects.com> :help
50
:add audio|chat             Add a new stream to the current session.
51
:call URI [audio|chat]      Make an outgoing call. By default, use audio+chat
52
:dtmf DIGITS                Send DTMF digits. Also try CTRL-SPACE for virtual numpad
53
:help                       Print this help message
54
:hold                       Put the current session on hold
55
:remove audio|chat          Remove the stream from the current session
56
:switch  (or CTRL-N)        Switch between active sessions
57
:unhold                     Un-hold the current session
58
}}}
59
60 4 Adrian Georgescu
61 8 Adrian Georgescu
=== Example of audio only session ===
62 4 Adrian Georgescu
63
{{{
64
adigeo@ag-imac3:~$sip_session   
65
Using account 31208005169@ag-projects.com
66
Press Ctrl-d to quit or Control-n to switch between active sessions
67
Waiting for incoming SIP session requests...
68
Registering "Adrian G." <sip:31208005169@ag-projects.com> at 81.23.228.150:5060
69
Registered SIP contact address: sip:hctoyfvx@192.168.1.6:61277 (expires in 600 seconds)
70 24 Adrian Georgescu
71 4 Adrian Georgescu
Incoming Audio request from "Adrian G." <sip:31208005169@ag-projects.com>, do you accept? (y/n) y
72
Connecting SIP session to "Adrian G." <sip:31208005169@ag-projects.com>
73
Session established, using "speex" codec at 32000Hz
74
Audio RTP endpoints 192.168.1.6:50018 <-> 81.23.228.150:58260
75
Remote SIP User Agent is "sip2sip-0.9.0-pjsip-1.0.2-trunk-r2553"
76
Detected NAT type: Port Restricted
77
Audio to Adrian G. (31208005169@ag-projects.com): 
78 1 Adrian Georgescu
79 8 Adrian Georgescu
}}}
80
81
82
=== Example of chat only session ===
83
84 1 Adrian Georgescu
{{{
85 24 Adrian Georgescu
adigeo@ag-imac3:~$sip_session room1@chatserver.ag-projects.com chat
86 8 Adrian Georgescu
Using account 31208005169@ag-projects.com
87
Press Ctrl-d to quit or Control-n to switch between active sessions
88
Registering "Adrian G." <sip:31208005169@ag-projects.com> at 85.17.186.7:5060
89 10 Adrian Georgescu
Initiating SIP session from "Adrian G." <sip:31208005169@ag-projects.com> 
90
to sip:room1@chatserver.ag-projects.com via udp:81.23.228.146:6060 ...
91 8 Adrian Georgescu
Registered SIP contact address: sip:lpgdqwes@192.168.1.6:61392 (expires in 600 seconds)
92
Connecting SIP session to sip:room1@chatserver.ag-projects.com
93
Remote SIP User Agent is "sip-chatserver-0.9.1"
94
10:38:55 room1@chatserver.ag-projects.com: Welcome to the room, Adrian G.. You are the only participant in the room
95
Chat to room1@chatserver.ag-projects.com: 
96
}}}
97
98 22 Adrian Georgescu
=== DTMF interaction ===
99 16 Adrian Georgescu
100
{{{
101
adigeo@ag-imac3:~$sip_session 61@ag-projects.com
102
Using account 31208005169@ag-projects.com
103
Type :help to get information about commands and shortcuts
104
Registering "Adrian G." <sip:31208005169@ag-projects.com> at 81.23.228.150:5060
105
Registered SIP contact address: sip:ijpmwqbg@192.168.1.6:56320 (expires in 600 seconds)
106
Initiating SIP session from "Adrian G." <sip:31208005169@ag-projects.com> to sip:61@ag-projects.com via udp:81.23.228.150:5060 ...
107
Connecting SIP session to sip:61@ag-projects.com (Ok)
108
Session established, using "GSM" codec at 8000Hz
109
Audio RTP endpoints 192.168.1.6:50250 <-> 81.23.228.150:51318
110
Remote SIP User Agent is "pbxnsip-PBX/3.0.0.2896"
111
+------+-----+------+
112
|  1   |  2  |  3   |
113
|      | ABC | DEF  |
114
+------+-----+------+
115
|  4   |  5  |  6   |
116
| GHI  | JKL | MNO  |
117
+------+-----+------+
118
|  7   |  8  |  9   |
119
| PQRS | TUV | WXYZ |
120
+------+-----+------+
121
|  *   |  0  |  #   |
122
+-------------------+
123
Detected NAT type: Port Restricted
124
> 0000#
125
Disconnecting SIP session to sip:61@ag-projects.com
126
Disconnected SIP session to sip:61@ag-projects.com (Ok)
127
Session ended by local party.
128
Session duration was 13 seconds.
129
31208005169@ag-projects.com> 
130
}}}
131
132
133 20 Adrian Georgescu
See [wiki:sip_trace_msrp_rtp] for a sample SIP trace captured with this command line tool.