Sip session

Version 8 (Adrian Georgescu, 03/30/2009 11:39 am) → Version 9/44 (Adrian Georgescu, 03/30/2009 11:41 am)

== sip_session ==

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

To use this script you must to have a valid [wiki:SipSettingsAPI configuration].

=== 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 usine re-INVITE. The defaul behaviour is to establish outgoing session with both audio and chat media.

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

{{{
Usage: sip_session [options] [target-user@target-domain.com]

This script will either sit idle waiting for an incoming MSRP session, or
start a MSRP session with the specified target SIP address. The program will
close the session and quit when CTRL+D is pressed.

Options:
-h, --help show this help message and exit
-a ACCOUNT_ID, --account-id=ACCOUNT_ID
-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.
}}}

=== 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
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:
}}}

=== Example of SDP with RTP and MSRP proposal ===

{{{
INVITE sip:61@ag-projects.com SIP/2.0
Via: SIP/2.0/UDP 192.168.1.6:61335;rport;branch=z9hG4bKPjTgHt1tWJgdV0tXsSCX.h9EJBZneF1134
Max-Forwards: 70
From: "Adrian G." <sip:31208005169@ag-projects.com>;tag=yf.gdZqZwOE5qcCB02qcKL9tdjtHK3-r
To: sip:61@ag-projects.com
Contact: <sip:rlafgmkq@192.168.1.6:61335>
Call-ID: slXPhUalLN3tiJYDKI5UnNOspHkV4PNb
CSeq: 16232 INVITE
Route: <sip:85.17.186.7:5060;lr>
Allow: SUBSCRIBE, NOTIFY, PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, MESSAGE
Supported: 100rel
User-Agent: sip2sip-0.9.0-pjsip-1.0.2-trunk-r2553
Proxy-Authorization: Digest username="31208005169", realm="ag-projects.com",
nonce="49d092ef3dd41223af53ece9bc1b5ce903898ece", uri="sip:61@ag-projects.com", response="6baaa853d66bc376e8e56acbd512d16b"
Content-Type: application/sdp
Content-Length: 592

v=0
o=- 3447394641 3447394641 IN IP4 192.168.1.6
s=
c=IN IP4 192.168.1.6
t=0 0
m=audio 50048 RTP/AVP 104 103 102 0 8 117 3 9 101
a=rtcp:50049 IN IP4 192.168.1.6
a=rtpmap:104 speex/32000
a=rtpmap:103 speex/16000
a=rtpmap:102 speex/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:117 iLBC/8000
a=fmtp:117 mode=20
a=rtpmap:3 GSM/8000
a=rtpmap:9 G722/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
m=message 2855 TCP/TLS/MSRP *
a=path:msrps://192.168.1.6:2855/f2a8d0dcf07af4869cdd;tcp
a=accept-types:message/cpim text/*
a=accept-wrapped-types:*
}}}