Sip audio session » History » Version 6
Adrian Georgescu, 03/30/2009 11:27 AM
1 | 1 | Adrian Georgescu | == sip_audio_session == |
---|---|---|---|
2 | 2 | Adrian Georgescu | [[TOC(SipTesting*, sip_*, xcap*,depth=2)]] |
3 | 1 | Adrian Georgescu | |
4 | 3 | Adrian Georgescu | To use this script you must to have a valid [wiki:SipSettingsAPI configuration]. |
5 | 1 | Adrian Georgescu | |
6 | === Description === |
||
7 | |||
8 | This script can be used for interactive audio session or for scripting alarms. The script returns appropriate shell response codes for failed or successful sessions. The script can be setup to auto answer and auto hangup after predefined number of seconds, detects SIP negative response codes, missing ACK and the lack of RTP media after a session has been established. |
||
9 | 6 | Adrian Georgescu | |
10 | [[Image(http://www.tech-invite.com/img/cf3665/cf3665-31.gif)]] |
||
11 | 1 | Adrian Georgescu | |
12 | Source code: [source:scripts/sip_audio_session.py scripts/sip_audio_session.py] |
||
13 | |||
14 | {{{ |
||
15 | 5 | Adrian Georgescu | adigeo@ag-oxygen:~$sip_audio_session --help |
16 | 1 | Adrian Georgescu | Usage: sip_audio_session [options] [target-user@target-domain.com] |
17 | |||
18 | This script can sit idle waiting for an incoming audio call, or perform an |
||
19 | outgoing audio call to the target SIP account. The program will close the |
||
20 | session and quit when Ctrl+D is pressed. |
||
21 | |||
22 | Options: |
||
23 | -h, --help show this help message and exit |
||
24 | 5 | Adrian Georgescu | -a NAME, --account=NAME |
25 | The account name to use for any outgoing traffic. If |
||
26 | not supplied, the default account will be used. |
||
27 | -c [FILE], --config_file=[FILE] |
||
28 | The path to a configuration file to use. This |
||
29 | overrides the default location of the configuration |
||
30 | file. |
||
31 | -s [stdout|file|all|none], --trace-sip=[stdout|file|all|none] |
||
32 | Dump the raw contents of incoming and outgoing SIP |
||
33 | messages. The argument specifies where the messages |
||
34 | are to be dumped. |
||
35 | -j [stdout|file|all|none], --trace-pjsip=[stdout|file|all|none] |
||
36 | Print PJSIP logging output. The argument specifies |
||
37 | 1 | Adrian Georgescu | where the messages are to be dumped. |
38 | 5 | Adrian Georgescu | -S, --disable-sound Disables initializing the sound card. |
39 | --auto-answer Interval after which to answer an incoming call |
||
40 | (disabled by default). If the option is specified but |
||
41 | the interval is not, it defaults to 0 (answer the call |
||
42 | as soon as it starts ringing). |
||
43 | 1 | Adrian Georgescu | --auto-hangup Interval after which to hangup an on-going call |
44 | (applies only to outgoing calls, disabled by default). |
||
45 | If the option is specified but the interval is not, it |
||
46 | defaults to 0 (hangup the call as soon as it |
||
47 | connects). |
||
48 | }}} |
||
49 | |||
50 | |||
51 | === Example for incoming session === |
||
52 | |||
53 | {{{ |
||
54 | adigeo@ag-imac3:~/Business/Personal$sip_audio_session |
||
55 | Accounts available: 'alice', 'as', 'bob', 'ew', 'ewt', 'mrg', 'pbx', 's', 'tf', 'umts', 'umts_test', 'unet', 'unet_test', default |
||
56 | Using default account: 31208005169@ag-projects.com |
||
57 | Registering ""Adrian G." <sip:31208005169@ag-projects.com>" at 81.23.228.129:5060 |
||
58 | REGISTER was successful |
||
59 | Contact: sip:HZ1BYFQtHR@192.168.1.6:49421;transport=udp (expires in 300 seconds) |
||
60 | Available control keys: |
||
61 | h: hang-up the active session |
||
62 | r: toggle audio recording |
||
63 | t: toggle SIP trace on the console |
||
64 | <> : adjust echo cancellation |
||
65 | SPACE: hold/on-hold |
||
66 | Ctrl-d: quit the program |
||
67 | ?: display this help message |
||
68 | Waiting for incoming session... |
||
69 | Detected NAT type: Port Restricted |
||
70 | Incoming session... |
||
71 | Incoming audio session from "sip:adi@umts.ro", do you want to accept? (y/n) |
||
72 | Session established, using "speex" codec at 32000Hz |
||
73 | Audio RTP endpoints 192.168.1.6:40064 <-> 81.23.228.150:56618 |
||
74 | Remote SIP User Agent is "sip2sip-0.4.0-pjsip-1.0.1-r2453" |
||
75 | Call is put on hold |
||
76 | Call is taken out of hold |
||
77 | Ending session... |
||
78 | Session ended by local party. |
||
79 | Session duration was 6 seconds |
||
80 | }}} |
||
81 | |||
82 | === Example for outgoing session === |
||
83 | |||
84 | {{{ |
||
85 | adigeo@ag-imac3:~$sip -a umts ag@ag-projects.com |
||
86 | Accounts available: 'alice', 'as', 'bob', 'ew', 'ewt', 'mrg', 'pbx', 's', 'tf', 'umts', 'umts_test', 'unet', 'unet_test', default |
||
87 | Using account 'umts': adi@umts.ro |
||
88 | Call from "Adi UMTS" <sip:adi@umts.ro> to sip:ag@ag-projects.com through proxy udp:85.17.186.7:5060 |
||
89 | Available control keys: |
||
90 | h: hang-up the active session |
||
91 | r: toggle audio recording |
||
92 | t: toggle SIP trace on the console |
||
93 | <> : adjust echo cancellation |
||
94 | SPACE: hold/on-hold |
||
95 | Ctrl-d: quit the program |
||
96 | ?: display this help message |
||
97 | Ringing... |
||
98 | Ringing... |
||
99 | Ringing... |
||
100 | Session established, using "speex" codec at 32000Hz |
||
101 | Audio RTP endpoints 192.168.1.6:40048 <-> 81.23.228.150:56616 |
||
102 | Remote SIP User Agent is "sip2sip-0.4.0-pjsip-1.0.1-r2453" |
||
103 | Remote party has put the call on hold |
||
104 | Remote party has taken the call out of hold |
||
105 | Session ended by remote party. |
||
106 | Session duration was 6 seconds |
||
107 | |||
108 | }}} |
||
109 | |||
110 | |||
111 | === Ongoing sessions === |
||
112 | |||
113 | During an ongoing session you can record the audio stream in a file by pressing r. You can hangup by pressing h. |