Project

General

Profile

Sip session » History » Version 20

Adrian Georgescu, 03/31/2009 03:03 PM

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