Sip session

Version 24 (Adrian Georgescu, 04/14/2009 09:57 am) → Version 25/44 (Adrian Georgescu, 08/25/2009 10:53 am)

== sip_session ==

[[TOC(SipTesting*, sip_*, depth=2)]]

=== Description ===

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.

[[Image(http://www.tech-invite.com/img/cf3665/cf3665-37.gif)]]

{{{
adigeo@ag-imac3:~$sip_session -h
Usage: sip_session [options] [target-user@target-domain.com] [audio|chat]

This script will either sit idle waiting for an incoming session, or start a
new session with the specified target SIP address. The program will close the
session and quit when CTRL-D
is currently rewritten. pressed. This scripts supports RTP audio and
MSRP chat sessions.


[[Image(http://www.tech-invite.com/img/cf3665/cf3665-37.gif)]] Options:
-h, --help show this help message and exit
-a ACCOUNT_NAME, --account-name=ACCOUNT_NAME
The name of the account to use.
--no-register Bypass registration.
-c FILE, --config_file=FILE
The path to a configuration file to use. This
overrides the default location of the configuration
file.
-S, --disable-sound Disables initializing the sound card.
-s, --trace-sip Dump the raw contents of incoming and outgoing SIP
messages.
-j, --trace-pjsip Print PJSIP logging output.
--trace-engine Print core's events.
-m, --trace-msrp Log the raw contents of incoming and outgoing MSRP
messages.
--no-relay Don't use the MSRP relay.
--msrp-tcp Use TCP for MSRP connections.
}}}


=== Available commands ===

{{{
adigeo@ag-imac3:~/work/python-sipsimple$sip_session
Using account 31208005169@ag-projects.com
Type :help to get information about commands and shortcuts
Waiting for incoming SIP session requests...
Registering "Adrian G." <sip:31208005169@ag-projects.com> at 81.23.228.129:5060
Registered SIP contact address: sip:mdbwqhek@192.168.1.6:61453 (expires in 600 seconds)
31208005169@ag-projects.com> :help
:add audio|chat Add a new stream to the current session.
:call URI [audio|chat] Make an outgoing call. By default, use audio+chat
:dtmf DIGITS Send DTMF digits. Also try CTRL-SPACE for virtual numpad
:help Print this help message
:hold Put the current session on hold
:remove audio|chat Remove the stream from the current session
:switch (or CTRL-N) Switch between active sessions
:unhold Un-hold the current session
}}}

=== Example of audio only session ===

{{{
adigeo@ag-imac3:~$sip_session
Using account 31208005169@ag-projects.com
Press Ctrl-d to quit or Control-n to switch between active sessions
Waiting for incoming SIP session requests...
Registering "Adrian G." <sip:31208005169@ag-projects.com> at 81.23.228.150:5060
Registered SIP contact address: sip:hctoyfvx@192.168.1.6:61277 (expires in 600 seconds)

Incoming Audio request from "Adrian G." <sip:31208005169@ag-projects.com>, do you accept? (y/n) y
Connecting SIP session to "Adrian G." <sip:31208005169@ag-projects.com>
Session established, using "speex" codec at 32000Hz
Audio RTP endpoints 192.168.1.6:50018 <-> 81.23.228.150:58260
Remote SIP User Agent is "sip2sip-0.9.0-pjsip-1.0.2-trunk-r2553"
Detected NAT type: Port Restricted
Audio to Adrian G. (31208005169@ag-projects.com):

}}}

=== Example of chat only session ===

{{{
adigeo@ag-imac3:~$sip_session room1@chatserver.ag-projects.com chat
Using account 31208005169@ag-projects.com
Press Ctrl-d to quit or Control-n to switch between active sessions
Registering "Adrian G." <sip:31208005169@ag-projects.com> at 85.17.186.7:5060
Initiating SIP session from "Adrian G." <sip:31208005169@ag-projects.com>
to sip:room1@chatserver.ag-projects.com via udp:81.23.228.146:6060 ...
Registered SIP contact address: sip:lpgdqwes@192.168.1.6:61392 (expires in 600 seconds)
Connecting SIP session to sip:room1@chatserver.ag-projects.com
Remote SIP User Agent is "sip-chatserver-0.9.1"
10:38:55 room1@chatserver.ag-projects.com: Welcome to the room, Adrian G.. You are the only participant in the room
Chat to room1@chatserver.ag-projects.com:
}}}

=== DTMF interaction ===

{{{
adigeo@ag-imac3:~$sip_session 61@ag-projects.com
Using account 31208005169@ag-projects.com
Type :help to get information about commands and shortcuts
Registering "Adrian G." <sip:31208005169@ag-projects.com> at 81.23.228.150:5060
Registered SIP contact address: sip:ijpmwqbg@192.168.1.6:56320 (expires in 600 seconds)
Initiating SIP session from "Adrian G." <sip:31208005169@ag-projects.com> to sip:61@ag-projects.com via udp:81.23.228.150:5060 ...
Connecting SIP session to sip:61@ag-projects.com (Ok)
Session established, using "GSM" codec at 8000Hz
Audio RTP endpoints 192.168.1.6:50250 <-> 81.23.228.150:51318
Remote SIP User Agent is "pbxnsip-PBX/3.0.0.2896"
+------+-----+------+
| 1 | 2 | 3 |
| | ABC | DEF |
+------+-----+------+
| 4 | 5 | 6 |
| GHI | JKL | MNO |
+------+-----+------+
| 7 | 8 | 9 |
| PQRS | TUV | WXYZ |
+------+-----+------+
| * | 0 | # |
+-------------------+
Detected NAT type: Port Restricted
> 0000#
Disconnecting SIP session to sip:61@ag-projects.com
Disconnected SIP session to sip:61@ag-projects.com (Ok)
Session ended by local party.
Session duration was 13 seconds.
31208005169@ag-projects.com>
}}}

See [wiki:sip_trace_msrp_rtp] for a sample SIP trace captured with this command line tool.