Project

General

Profile

Sip audio session » History » Version 25

Adrian Georgescu, 01/24/2010 03:34 PM

1 24 Adrian Georgescu
== sip-audio-session ==
2 2 Adrian Georgescu
[[TOC(SipTesting*, sip_*, xcap*,depth=2)]]
3 1 Adrian Georgescu
4
=== Description ===
5
6 25 Adrian Georgescu
7 1 Adrian Georgescu
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.
8
9 25 Adrian Georgescu
> This script is available in ''sipclients'' package that must be installed separately from SIP SIMPLe client SDK package.
10 1 Adrian Georgescu
11
{{{
12 24 Adrian Georgescu
adigeo@ag-blink:~$sip-audio-session -h
13
Usage: sip-audio-session [options] [user@domain]
14 1 Adrian Georgescu
15 17 Adrian Georgescu
This script can sit idle waiting for an incoming audio session, or initiate an
16
outgoing audio session to a SIP address. The program will close the session
17
and quit when Ctrl+D is pressed.
18 1 Adrian Georgescu
19
Options:
20
  -h, --help            show this help message and exit
21 5 Adrian Georgescu
  -a NAME, --account=NAME
22
                        The account name to use for any outgoing traffic. If
23
                        not supplied, the default account will be used.
24 19 Adrian Georgescu
  -c FILE, --config-file=FILE
25 1 Adrian Georgescu
                        The path to a configuration file to use. This
26 5 Adrian Georgescu
                        overrides the default location of the configuration
27
                        file.
28 17 Adrian Georgescu
  -s, --trace-sip       Dump the raw contents of incoming and outgoing SIP
29
                        messages.
30
  -j, --trace-pjsip     Print PJSIP logging output.
31
  -n, --trace-notifications
32
                        Print all notifications (disabled by default).
33 5 Adrian Georgescu
  -S, --disable-sound   Disables initializing the sound card.
34 17 Adrian Georgescu
  --auto-answer         Interval after which to answer an incoming session
35 1 Adrian Georgescu
                        (disabled by default). If the option is specified but
36 17 Adrian Georgescu
                        the interval is not, it defaults to 0 (accept the
37 1 Adrian Georgescu
                        session as soon as it starts ringing).
38
  --auto-hangup         Interval after which to hang up an established session
39 19 Adrian Georgescu
                        (disabled by default). If the option is specified but
40
                        the interval is not, it defaults to 0 (hangup the
41
                        session as soon as it connects).
42
  -b, --batch           Run the program in batch mode: reading input from the
43
                        console is disabled and the option --auto-answer is
44
                        implied. This is particularly useful when running this
45
                        script in a non-interactive environment.
46
  -D, --daemonize       Enable running this program as a deamon. This option
47 20 Adrian Georgescu
                        implies --disable-sound, --auto-answer and --batch.
48 1 Adrian Georgescu
}}}
49
50
51
=== Example for incoming session ===
52
53
{{{
54 24 Adrian Georgescu
adigeo@ag-blink:~$sip-audio-session 
55 1 Adrian Georgescu
Using account 31208005169@ag-projects.com
56 21 Adrian Georgescu
Logging SIP trace to file "/Users/adigeo/Library/Application Support/Blink/logs/sip_trace.txt"
57
Logging PJSIP trace to file "/Users/adigeo/Library/Application Support/Blink/logs/pjsip_trace.txt"
58
Available audio input devices: None, system_default, Built-in Input, Built-in Microphone
59
Available audio output devices: None, system_default, Built-in Output
60 19 Adrian Georgescu
Using audio input device: Built-in Microphone
61
Using audio output device: Built-in Output
62
Using audio alert device: Built-in Output
63
64 1 Adrian Georgescu
Available control keys:
65
  s: toggle SIP trace on the console
66
  j: toggle PJSIP trace on the console
67
  n: toggle notifications trace on the console
68
  p: toggle printing RTP statistics on the console
69 19 Adrian Georgescu
  h: hang-up the active session
70
  r: toggle audio recording
71 21 Adrian Georgescu
  m: mute the microphone
72
  i: change audio input device
73
  o: change audio output device
74
  a: change audio alert device
75 1 Adrian Georgescu
  <>: adjust echo cancellation
76
  SPACE: hold/unhold
77
  Ctrl-d: quit the program
78
  ?: display this help message
79
80 21 Adrian Georgescu
2009-08-25 16:37:12 Registered contact "sip:hxsyungk@192.168.1.124:59164" for sip:31208005169@ag-projects.com at 81.23.228.150:5060;transport=udp (expires in 600 seconds).
81 1 Adrian Georgescu
Other registered contacts:
82 21 Adrian Georgescu
  sip:31208005169@192.168.1.123:5060 (expires in 274 seconds)
83
  sip:kwbfxyvl@192.168.1.124:59116 (expires in 522 seconds)
84
  sip:ilmegvkp@192.168.1.124:59003 (expires in 339 seconds)
85
  sip:31208005169@192.168.1.1;uniq=5B2860C44383A3D6705629A7E1FB8 (expires in 1162 seconds)
86 19 Adrian Georgescu
Detected NAT type: Port Restricted
87 21 Adrian Georgescu
Incoming audio session from 'sip:adi@umts.ro', do you want to accept? (y/n)
88
Audio session established using "speex" codec at 16000Hz
89
Audio RTP endpoints 192.168.1.124:50378 <-> 85.17.186.6:58868
90 19 Adrian Georgescu
RTP audio stream is encrypted
91 21 Adrian Georgescu
Remote SIP User Agent is "Blink-0.9.0"
92
Remote party has put the audio session on hold
93
Audio session is put on hold
94 8 Adrian Georgescu
Audio session ended by remote party
95 21 Adrian Georgescu
Session duration was 6 seconds
96
2009-08-25 16:37:44 Registration ended.
97 1 Adrian Georgescu
}}}
98
99
=== Example for outgoing session ===
100 11 Adrian Georgescu
101
{{{
102 24 Adrian Georgescu
adigeo@ag-blink:~$sip-audio-session -a umts ag@ag-projects.com
103 21 Adrian Georgescu
Using account adi@umts.ro
104
Logging SIP trace to file "/Users/adigeo/Library/Application Support/Blink/logs/sip_trace.txt"
105
Logging PJSIP trace to file "/Users/adigeo/Library/Application Support/Blink/logs/pjsip_trace.txt"
106
Available audio input devices: None, system_default, Built-in Input, Built-in Microphone
107
Available audio output devices: None, system_default, Built-in Output
108 1 Adrian Georgescu
Using audio input device: Built-in Microphone
109 11 Adrian Georgescu
Using audio output device: Built-in Output
110 1 Adrian Georgescu
Using audio alert device: Built-in Output
111 11 Adrian Georgescu
112 12 Adrian Georgescu
Available control keys:
113 11 Adrian Georgescu
  s: toggle SIP trace on the console
114 12 Adrian Georgescu
  j: toggle PJSIP trace on the console
115 11 Adrian Georgescu
  n: toggle notifications trace on the console
116
  p: toggle printing RTP statistics on the console
117 12 Adrian Georgescu
  h: hang-up the active session
118
  r: toggle audio recording
119 21 Adrian Georgescu
  m: mute the microphone
120
  i: change audio input device
121
  o: change audio output device
122
  a: change audio alert device
123 15 Adrian Georgescu
  <>: adjust echo cancellation
124 14 Adrian Georgescu
  SPACE: hold/unhold
125 16 Adrian Georgescu
  Ctrl-d: quit the program
126 14 Adrian Georgescu
  ?: display this help message
127
128 21 Adrian Georgescu
Initiating SIP audio session from 'sip:adi@umts.ro' to 'sip:ag@ag-projects.com' via sip:85.17.186.7:5060;transport=udp...
129
Audio session established using "speex" codec at 16000Hz
130
Audio RTP endpoints 192.168.1.124:50054 <-> 85.17.186.6:58866
131 18 Adrian Georgescu
RTP audio stream is encrypted
132 21 Adrian Georgescu
Audio session is put on hold
133
Remote party has put the audio session on hold
134
Detected NAT type: Port Restricted
135 18 Adrian Georgescu
Ending audio session...
136
Audio session ended by local party
137 21 Adrian Georgescu
Session duration was 7 seconds
138 18 Adrian Georgescu
}}}
139 1 Adrian Georgescu
140 23 Adrian Georgescu
=== Session with sip trace enabled ===
141
142
Use -s parameter you can see on the console detailed trace of all DNS queries/responses and SIP traffic exchanged during the session.
143
 
144
{{{
145 24 Adrian Georgescu
adigeo@ag-imac3:~$sip-audio-session -s -a umts ag@ag-projects.com
146 23 Adrian Georgescu
Using account adi@umts.ro
147
Logging SIP trace to file "/Users/adigeo/Desktop/FileTransfers/sip_trace.txt"
148
Logging PJSIP trace to file "/Users/adigeo/Desktop/FileTransfers/pjsip_trace.txt"
149
Logging notifications trace to file "/Users/adigeo/Desktop/FileTransfers/notifications_trace.txt"
150
Available audio input devices: None, system_default, Built-in Input, Built-in Microphone, Logitech Wireless Headset
151
Available audio output devices: None, system_default, Built-in Output, Logitech Wireless Headset
152
Using audio input device: Logitech Wireless Headset
153
Using audio output device: Logitech Wireless Headset
154
Using audio alert device: Built-in Output
155
156
Available control keys:
157
  s: toggle SIP trace on the console
158
  j: toggle PJSIP trace on the console
159
  n: toggle notifications trace on the console
160
  p: toggle printing RTP statistics on the console
161
  h: hang-up the active session
162
  r: toggle audio recording
163
  m: mute the microphone
164
  i: change audio input device
165
  o: change audio output device
166
  a: change audio alert device
167
  <>: adjust echo cancellation
168
  SPACE: hold/unhold
169
  Ctrl-d: quit the program
170
  ?: display this help message
171
172
2009-09-24 22:31:24.118467: DNS lookup SRV _stun._udp.umts.ro succeeded, ttl=10758: 0 0 3478 stun1.dns-hosting.info., 0 0 3479 stun2.dns-hosting.info.
173
2009-09-24 22:31:24.120425: DNS lookup NAPTR ag-projects.com succeeded, ttl=244: 20 0 "s" "SIP+D2U" "" _sip._udp.ag-projects.com.
174
2009-09-24 22:31:24.126619: DNS lookup A stun1.dns-hosting.info. succeeded, ttl=845: 81.23.228.150
175
2009-09-24 22:31:24.128383: DNS lookup SRV _sip._udp.ag-projects.com. succeeded, ttl=18: 0 0 5060 proxy.sipthor.net.
176
2009-09-24 22:31:24.132502: DNS lookup A stun2.dns-hosting.info. succeeded, ttl=845: 85.17.186.6
177
2009-09-24 22:31:24.136754: DNS lookup A proxy.sipthor.net. succeeded, ttl=5: 85.17.186.7, 81.23.228.129
178
Initiating SIP audio session from '"Adrian G." <sip:adi@umts.ro>' to 'sip:ag@ag-projects.com' via sip:85.17.186.7:5060;transport=udp...
179
2009-09-24 22:31:24.145751: DNS lookup SRV _stun._udp.umts.ro succeeded, ttl=10758: 0 0 3478 stun1.dns-hosting.info., 0 0 3479 stun2.dns-hosting.info.
180
2009-09-24 22:31:24.150530: DNS lookup A stun1.dns-hosting.info. succeeded, ttl=845: 81.23.228.150
181
2009-09-24 22:31:24.155510: DNS lookup A stun2.dns-hosting.info. succeeded, ttl=845: 85.17.186.6
182
2009-09-24 22:31:24.572498: SENDING: Packet 1, +0:00:00
183
192.168.1.6:62054 -(SIP over UDP)-> 85.17.186.7:5060
184
INVITE sip:ag@ag-projects.com SIP/2.0
185
Via: SIP/2.0/UDP 192.168.1.6:62054;rport;branch=z9hG4bKPjWy0ZCjWb9Ro6Cy15cBX3FE3H.er7.wzB
186
Max-Forwards: 70
187
From: "Adrian G." <sip:adi@umts.ro>;tag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF
188
To: <sip:ag@ag-projects.com>
189
Contact: <sip:pfxtjskq@192.168.1.6:62054>
190
Call-ID: TvSQ8UaRQkYIz53p8itOYiV.MLKdlzC3
191
CSeq: 16887 INVITE
192
Route: <sip:85.17.186.7;lr>
193
Allow: SUBSCRIBE, NOTIFY, PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, MESSAGE
194
Supported: 100rel
195
User-Agent: blink-0.9.0
196
Content-Type: application/sdp
197
Content-Length:  1087
198
199
v=0
200
o=- 3462813084 3462813084 IN IP4 192.168.1.6
201
s=blink-0.9.0
202
c=IN IP4 80.101.96.20
203
t=0 0
204
m=audio 62066 RTP/AVP 104 103 102 3 9 0 8 101
205
a=rtcp:62067 IN IP4 80.101.96.20
206
a=rtpmap:104 speex/32000
207
a=rtpmap:103 speex/16000
208
a=rtpmap:102 speex/8000
209
a=rtpmap:3 GSM/8000
210
a=rtpmap:9 G722/8000
211
a=rtpmap:0 PCMU/8000
212
a=rtpmap:8 PCMA/8000
213
a=rtpmap:101 telephone-event/8000
214
a=fmtp:101 0-15
215
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:eQ0XcBiuyy33zR2HEHLiaS5LCxA1T9rvP9J8GLw6
216
a=crypto:2 AES_CM_128_HMAC_SHA1_32 inline:zWQU33HIZ0a7otihkQe2Y4jvqpKpXtotNwoW9Xl8
217
a=ice-ufrag:0aa3379a
218
a=ice-pwd:619764ea
219
a=candidate:S 1 UDP 31 80.101.96.20 62066 typ srflx raddr 192.168.1.6 rport 62066
220
a=candidate:H 1 UDP 23 192.168.1.6 62066 typ host
221
a=candidate:H 1 UDP 23 10.211.55.2 62066 typ host
222
a=candidate:H 1 UDP 23 10.37.129.2 62066 typ host
223
a=candidate:S 2 UDP 30 80.101.96.20 62067 typ srflx raddr 192.168.1.6 rport 62067
224
a=candidate:H 2 UDP 22 192.168.1.6 62067 typ host
225
a=candidate:H 2 UDP 22 10.211.55.2 62067 typ host
226
a=candidate:H 2 UDP 22 10.37.129.2 62067 typ host
227
a=sendrecv
228
229
--
230
231
2009-09-24 22:31:24.601167: RECEIVED: Packet 2, +0:00:00.028669
232
85.17.186.7:5060 -(SIP over UDP)-> 192.168.1.6:62054
233
SIP/2.0 100 Giving a try
234
Via: SIP/2.0/UDP 192.168.1.6:62054;rport=62054;branch=z9hG4bKPjWy0ZCjWb9Ro6Cy15cBX3FE3H.er7.wzB;received=80.101.96.20
235
From: "Adrian G." <sip:adi@umts.ro>;tag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF
236
To: <sip:ag@ag-projects.com>
237
Call-ID: TvSQ8UaRQkYIz53p8itOYiV.MLKdlzC3
238
CSeq: 16887 INVITE
239
Server: SIP Thor on OpenSIPS XS 1.4.5
240
Content-Length: 0
241
242
243
--
244
245
2009-09-24 22:31:24.621860: RECEIVED: Packet 3, +0:00:00.049362
246
85.17.186.7:5060 -(SIP over UDP)-> 192.168.1.6:62054
247
SIP/2.0 407 Proxy Authentication Required
248
Via: SIP/2.0/UDP 192.168.1.6:62054;received=80.101.96.20;rport=62054;branch=z9hG4bKPjWy0ZCjWb9Ro6Cy15cBX3FE3H.er7.wzB
249
From: "Adrian G." <sip:adi@umts.ro>;tag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF
250
To: <sip:ag@ag-projects.com>;tag=e7d4d6b46afb9bf88242924a8d869ebf.962b
251
Call-ID: TvSQ8UaRQkYIz53p8itOYiV.MLKdlzC3
252
CSeq: 16887 INVITE
253
Proxy-Authenticate: Digest realm="umts.ro", nonce="4abbd73a48ba8c7fc6617208684ad122088d2207"
254
Server: SIP Thor on OpenSIPS XS 1.4.5
255
Content-Length: 0
256
257
258
--
259
260
2009-09-24 22:31:24.622019: SENDING: Packet 4, +0:00:00.049521
261
192.168.1.6:62054 -(SIP over UDP)-> 85.17.186.7:5060
262
ACK sip:ag@ag-projects.com SIP/2.0
263
Via: SIP/2.0/UDP 192.168.1.6:62054;rport;branch=z9hG4bKPjWy0ZCjWb9Ro6Cy15cBX3FE3H.er7.wzB
264
Max-Forwards: 70
265
From: "Adrian G." <sip:adi@umts.ro>;tag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF
266
To: <sip:ag@ag-projects.com>;tag=e7d4d6b46afb9bf88242924a8d869ebf.962b
267
Call-ID: TvSQ8UaRQkYIz53p8itOYiV.MLKdlzC3
268
CSeq: 16887 ACK
269
Route: <sip:85.17.186.7;lr>
270
User-Agent: blink-0.9.0
271
Content-Length:  0
272
273
274
--
275
276
2009-09-24 22:31:24.622214: SENDING: Packet 5, +0:00:00.049716
277
192.168.1.6:62054 -(SIP over UDP)-> 85.17.186.7:5060
278
INVITE sip:ag@ag-projects.com SIP/2.0
279
Via: SIP/2.0/UDP 192.168.1.6:62054;rport;branch=z9hG4bKPjwxj-gfiYVdjLvEWkt0l-pLfriN3gjo-T
280
Max-Forwards: 70
281
From: "Adrian G." <sip:adi@umts.ro>;tag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF
282
To: <sip:ag@ag-projects.com>
283
Contact: <sip:pfxtjskq@192.168.1.6:62054>
284
Call-ID: TvSQ8UaRQkYIz53p8itOYiV.MLKdlzC3
285
CSeq: 16888 INVITE
286
Route: <sip:85.17.186.7;lr>
287
Allow: SUBSCRIBE, NOTIFY, PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, MESSAGE
288
Supported: 100rel
289
User-Agent: blink-0.9.0
290
Proxy-Authorization: Digest username="adi", realm="umts.ro", nonce="4abbd73a48ba8c7fc6617208684ad122088d2207", uri="sip:ag@ag-projects.com", response="cb85bbe3dbe0dcd71820c6ceaa027566"
291
Content-Type: application/sdp
292
Content-Length:  1087
293
294
v=0
295
o=- 3462813084 3462813084 IN IP4 192.168.1.6
296
s=blink-0.9.0
297
c=IN IP4 80.101.96.20
298
t=0 0
299
m=audio 62066 RTP/AVP 104 103 102 3 9 0 8 101
300
a=rtcp:62067 IN IP4 80.101.96.20
301
a=rtpmap:104 speex/32000
302
a=rtpmap:103 speex/16000
303
a=rtpmap:102 speex/8000
304
a=rtpmap:3 GSM/8000
305
a=rtpmap:9 G722/8000
306
a=rtpmap:0 PCMU/8000
307
a=rtpmap:8 PCMA/8000
308
a=rtpmap:101 telephone-event/8000
309
a=fmtp:101 0-15
310
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:eQ0XcBiuyy33zR2HEHLiaS5LCxA1T9rvP9J8GLw6
311
a=crypto:2 AES_CM_128_HMAC_SHA1_32 inline:zWQU33HIZ0a7otihkQe2Y4jvqpKpXtotNwoW9Xl8
312
a=ice-ufrag:0aa3379a
313
a=ice-pwd:619764ea
314
a=candidate:S 1 UDP 31 80.101.96.20 62066 typ srflx raddr 192.168.1.6 rport 62066
315
a=candidate:H 1 UDP 23 192.168.1.6 62066 typ host
316
a=candidate:H 1 UDP 23 10.211.55.2 62066 typ host
317
a=candidate:H 1 UDP 23 10.37.129.2 62066 typ host
318
a=candidate:S 2 UDP 30 80.101.96.20 62067 typ srflx raddr 192.168.1.6 rport 62067
319
a=candidate:H 2 UDP 22 192.168.1.6 62067 typ host
320
a=candidate:H 2 UDP 22 10.211.55.2 62067 typ host
321
a=candidate:H 2 UDP 22 10.37.129.2 62067 typ host
322
a=sendrecv
323
324
--
325
326
2009-09-24 22:31:24.656088: RECEIVED: Packet 6, +0:00:00.083590
327
85.17.186.7:5060 -(SIP over UDP)-> 192.168.1.6:62054
328
SIP/2.0 100 Giving a try
329
Via: SIP/2.0/UDP 192.168.1.6:62054;rport=62054;branch=z9hG4bKPjwxj-gfiYVdjLvEWkt0l-pLfriN3gjo-T;received=80.101.96.20
330
From: "Adrian G." <sip:adi@umts.ro>;tag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF
331
To: <sip:ag@ag-projects.com>
332
Call-ID: TvSQ8UaRQkYIz53p8itOYiV.MLKdlzC3
333
CSeq: 16888 INVITE
334
Server: SIP Thor on OpenSIPS XS 1.4.5
335
Content-Length: 0
336
337
338
--
339
340
2009-09-24 22:31:24.721041: RECEIVED: Packet 7, +0:00:00.148543
341
85.17.186.7:5060 -(SIP over UDP)-> 192.168.1.6:62054
342
SIP/2.0 180 Ringing
343
Via: SIP/2.0/UDP 192.168.1.6:62054;rport=62054;received=80.101.96.20;branch=z9hG4bKPjwxj-gfiYVdjLvEWkt0l-pLfriN3gjo-T
344
Record-Route: <sip:85.17.186.7;lr;ftag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF;did=2f3.9e165924>
345
Record-Route: <sip:81.23.228.150;lr;ftag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF;did=2f3.e5ffeb2>
346
Record-Route: <sip:85.17.186.7;lr;ftag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF;did=2f3.8e165924>
347
Call-ID: TvSQ8UaRQkYIz53p8itOYiV.MLKdlzC3
348
From: "Adrian G." <sip:adi@umts.ro>;tag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF
349
To: <sip:ag@ag-projects.com>;tag=FkXkUNDcrT80u8GHaUIUuF4OrIJI6O8f
350
CSeq: 16888 INVITE
351
Server: blink-0.9.0
352
Contact: <sip:iwralmqz@80.101.96.20:61962>
353
Allow: SUBSCRIBE, NOTIFY, PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, MESSAGE
354
Content-Length:  0
355
356
357
--
358
359
2009-09-24 22:31:24.878489: RECEIVED: Packet 8, +0:00:00.305991
360
85.17.186.7:5060 -(SIP over UDP)-> 192.168.1.6:62054
361
SIP/2.0 180 Ringing
362
Via: SIP/2.0/UDP 192.168.1.6:62054;received=80.101.96.20;rport=62054;branch=z9hG4bKPjwxj-gfiYVdjLvEWkt0l-pLfriN3gjo-T
363
Record-Route: <sip:85.17.186.7;lr=on;ftag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF;did=2f3.9e165924>
364
Record-Route: <sip:81.23.228.150;lr=on;ftag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF;did=2f3.e5ffeb2>
365
Record-Route: <sip:85.17.186.7;lr=on;ftag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF;did=2f3.8e165924>
366
From: "Adrian G." <sip:adi@umts.ro>;tag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF
367
To: <sip:ag@ag-projects.com>;tag=96A4E0ACA527F9AF
368
Call-ID: TvSQ8UaRQkYIz53p8itOYiV.MLKdlzC3
369
CSeq: 16888 INVITE
370
Contact: <sip:31208005169@80.101.96.20:5060;uniq=5B2860C44383A3D6705629A7E1FB8>
371
User-Agent: AVM FRITZ!Box Fon WLAN 7170 29.04.56 (May  1 2008)
372
Content-Length: 0
373
374
375
--
376
377
2009-09-24 22:31:25.154425: RECEIVED: Packet 9, +0:00:00.581927
378
85.17.186.7:5060 -(SIP over UDP)-> 192.168.1.6:62054
379
SIP/2.0 180 Ringing
380
Via: SIP/2.0/UDP 192.168.1.6:62054;received=80.101.96.20;rport=62054;branch=z9hG4bKPjwxj-gfiYVdjLvEWkt0l-pLfriN3gjo-T
381
From: "Adrian G." <sip:adi@umts.ro>;tag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF
382
To: <sip:ag@ag-projects.com>;tag=000c854663c02cf2799a9168-4ae390b1
383
Call-ID: TvSQ8UaRQkYIz53p8itOYiV.MLKdlzC3
384
CSeq: 16888 INVITE
385
Server: CSCO/7
386
Contact: <sip:31208005169@80.101.96.20:61000>
387
Record-Route: <sip:81.23.228.129;lr=on;ftag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF;did=2f3.985cae24>,<sip:85.17.186.7;lr=on;ftag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF;did=2f3.9e165924>,<sip:81.23.228.150;lr=on;ftag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF;did=2f3.e5ffeb2>,<sip:85.17.186.7;lr=on;ftag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF;did=2f3.8e165924>
388
Content-Length: 0
389
390
391
--
392
393
2009-09-24 22:31:25.368613: RECEIVED: Packet 10, +0:00:00.796115
394
85.17.186.7:5060 -(SIP over UDP)-> 192.168.1.6:62054
395
SIP/2.0 200 OK
396
Via: SIP/2.0/UDP 192.168.1.6:62054;received=80.101.96.20;rport=62054;branch=z9hG4bKPjwxj-gfiYVdjLvEWkt0l-pLfriN3gjo-T
397
From: "Adrian G." <sip:adi@umts.ro>;tag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF
398
To: <sip:ag@ag-projects.com>;tag=000c854663c02cf2799a9168-4ae390b1
399
Call-ID: TvSQ8UaRQkYIz53p8itOYiV.MLKdlzC3
400
CSeq: 16888 INVITE
401
Server: CSCO/7
402
Contact: <sip:31208005169@80.101.96.20:61000>
403
Record-Route: <sip:81.23.228.129;lr=on;ftag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF;did=2f3.985cae24>,<sip:85.17.186.7;lr=on;ftag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF;did=2f3.9e165924>,<sip:81.23.228.150;lr=on;ftag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF;did=2f3.e5ffeb2>,<sip:85.17.186.7;lr=on;ftag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF;did=2f3.8e165924>
404
Content-Type: application/sdp
405
Content-Length: 197
406
407
v=0
408
o=Cisco-SIPUA 8420 8964 IN IP4 192.168.1.123
409
s=SIP Call
410
c=IN IP4 81.23.228.150
411
t=0 0
412
m=audio 51974 RTP/AVP 0 101
413
a=rtpmap:0 PCMU/8000
414
a=rtpmap:101 telephone-event/8000
415
a=fmtp:101 0-15
416
417
--
418
419
2009-09-24 22:31:25.369124: SENDING: Packet 11, +0:00:00.796626
420
192.168.1.6:62054 -(SIP over UDP)-> 85.17.186.7:5060
421
ACK sip:31208005169@80.101.96.20:61000 SIP/2.0
422
Via: SIP/2.0/UDP 192.168.1.6:62054;rport;branch=z9hG4bKPjkq3Y5tZfK3d.zASBBAHQHZMavNNRQw0W
423
Max-Forwards: 70
424
From: "Adrian G." <sip:adi@umts.ro>;tag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF
425
To: <sip:ag@ag-projects.com>;tag=000c854663c02cf2799a9168-4ae390b1
426
Call-ID: TvSQ8UaRQkYIz53p8itOYiV.MLKdlzC3
427
CSeq: 16888 ACK
428
Route: <sip:85.17.186.7;lr;ftag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF;did=2f3.8e165924>
429
Route: <sip:81.23.228.150;lr;ftag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF;did=2f3.e5ffeb2>
430
Route: <sip:85.17.186.7;lr;ftag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF;did=2f3.9e165924>
431
Route: <sip:81.23.228.129;lr;ftag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF;did=2f3.985cae24>
432
User-Agent: blink-0.9.0
433
Content-Length:  0
434
435
436
--
437
438
Audio session established using "PCMU" codec at 8000Hz
439
Audio RTP endpoints 80.101.96.20:62066 <-> 81.23.228.150:51974
440
Detected NAT type: Port Restricted
441
2009-09-24 22:31:40.495793: RECEIVED: Packet 12, +0:00:15.923295
442
85.17.186.7:5060 -(SIP over UDP)-> 192.168.1.6:62054
443
NOTIFY sip:80.101.96.20:62054 SIP/2.0
444
Via: SIP/2.0/UDP 85.17.186.7:5060;branch=0
445
From: sip:keepalive@85.17.186.7;tag=7c29b7d5
446
To: sip:80.101.96.20:62054
447
Call-ID: 296fc4b6-56ba6860-24109f@85.17.186.7
448
CSeq: 1 NOTIFY
449
Event: keep-alive
450
Content-Length: 0
451
452
453
--
454
455
2009-09-24 22:31:40.495929: SENDING: Packet 13, +0:00:15.923431
456
192.168.1.6:62054 -(SIP over UDP)-> 85.17.186.7:5060
457
SIP/2.0 405 Method Not Allowed
458
Via: SIP/2.0/UDP 85.17.186.7:5060;received=85.17.186.7;branch=0
459
Call-ID: 296fc4b6-56ba6860-24109f@85.17.186.7
460
From: <sip:keepalive@85.17.186.7>;tag=7c29b7d5
461
To: <sip:80.101.96.20>
462
CSeq: 1 NOTIFY
463
Server: blink-0.9.0
464
Content-Length:  0
465
466
467
--
468
469
2009-09-24 22:31:43.425393: RECEIVED: Packet 14, +0:00:18.852895
470
85.17.186.7:5060 -(SIP over UDP)-> 192.168.1.6:62054
471
BYE sip:pfxtjskq@80.101.96.20:62054 SIP/2.0
472
Record-Route: <sip:85.17.186.7;lr=on;ftag=000c854663c02cf2799a9168-4ae390b1>
473
Record-Route: <sip:81.23.228.150;lr=on;ftag=000c854663c02cf2799a9168-4ae390b1>
474
Record-Route: <sip:85.17.186.7;lr=on;ftag=000c854663c02cf2799a9168-4ae390b1>
475
Max-Forwards:  7
476
Record-Route: <sip:81.23.228.129;lr=on;ftag=000c854663c02cf2799a9168-4ae390b1>
477
Via: SIP/2.0/UDP 85.17.186.7;branch=z9hG4bK9c22.feada044.0
478
Via: SIP/2.0/UDP 81.23.228.150;branch=z9hG4bK9c22.3cf12dd3.0
479
Via: SIP/2.0/UDP 85.17.186.7;branch=z9hG4bK9c22.eeada044.0
480
Via: SIP/2.0/UDP 81.23.228.129;branch=z9hG4bK9c22.877deec6.0
481
Via: SIP/2.0/UDP 192.168.1.123:5060;rport=61000;received=80.101.96.20;branch=z9hG4bK63eb02c1
482
From: <sip:ag@ag-projects.com>;tag=000c854663c02cf2799a9168-4ae390b1
483
To: "Adrian G." <sip:adi@umts.ro>;tag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF
484
Call-ID: TvSQ8UaRQkYIz53p8itOYiV.MLKdlzC3
485
CSeq: 101 BYE
486
User-Agent: CSCO/7
487
Content-Length: 0
488
RTP-RxStat: Dur=18,Pkt=29,Oct=4640,LatePkt=0,LostPkt=0,AvgJit=0
489
RTP-TxStat: Dur=18,Pkt=889,Oct=142240
490
491
492
--
493
494
2009-09-24 22:31:43.425554: SENDING: Packet 15, +0:00:18.853056
495
192.168.1.6:62054 -(SIP over UDP)-> 85.17.186.7:5060
496
SIP/2.0 200 OK
497
Via: SIP/2.0/UDP 85.17.186.7;received=85.17.186.7;branch=z9hG4bK9c22.feada044.0
498
Via: SIP/2.0/UDP 81.23.228.150;branch=z9hG4bK9c22.3cf12dd3.0
499
Via: SIP/2.0/UDP 85.17.186.7;branch=z9hG4bK9c22.eeada044.0
500
Via: SIP/2.0/UDP 81.23.228.129;branch=z9hG4bK9c22.877deec6.0
501
Via: SIP/2.0/UDP 192.168.1.123:5060;rport=61000;received=80.101.96.20;branch=z9hG4bK63eb02c1
502
Record-Route: <sip:85.17.186.7;lr;ftag=000c854663c02cf2799a9168-4ae390b1>
503
Record-Route: <sip:81.23.228.150;lr;ftag=000c854663c02cf2799a9168-4ae390b1>
504
Record-Route: <sip:85.17.186.7;lr;ftag=000c854663c02cf2799a9168-4ae390b1>
505
Record-Route: <sip:81.23.228.129;lr;ftag=000c854663c02cf2799a9168-4ae390b1>
506
Call-ID: TvSQ8UaRQkYIz53p8itOYiV.MLKdlzC3
507
From: <sip:ag@ag-projects.com>;tag=000c854663c02cf2799a9168-4ae390b1
508
To: "Adrian G." <sip:adi@umts.ro>;tag=tv6vh5PXicua6Zuu0ZCv9smnXR.J-CxF
509
CSeq: 101 BYE
510
Server: blink-0.9.0
511
Content-Length:  0
512
513
514
--
515
516
Audio session ended by remote party
517
Session duration was 18 seconds
518
}}}
519 1 Adrian Georgescu
520
=== Alarm system ===
521
522 25 Adrian Georgescu
sip-audio-session script can be used for end-to-end testing of a SIP service including the RTP media path. The following failures can be detected:
523 1 Adrian Georgescu
524 22 Adrian Georgescu
 * Timeout
525
 * Negative response code
526
 * Lack of RTP media after the SIP session has been established
527
 * Missing ACK
528
529
530
To setup the alarm system start periodically a caller script from a monitoring software using the following arguments:
531
532 1 Adrian Georgescu
  {{{
533 24 Adrian Georgescu
sip-audio-session --auto-hangup user@domain
534 1 Adrian Georgescu
  }}}
535
536 22 Adrian Georgescu
Where the user@domain has been configured as the SIP account of the listener, can be an answering machine on the PSTN network. The caller script hangs up after each call. The shell return code can be used to determine if the session setup has failed.
537 1 Adrian Georgescu
538
To receive calls and answer them automatically you can also use sip_audio_session script as follows:
539
540
  {{{
541 24 Adrian Georgescu
sip-audio-session --daemonize
542 1 Adrian Georgescu
  }}}
543
544
You must run the script as user root. The --daemonize option puts the client in the background and the logging goes to /var/log/syslog. The program saves its pid file to /var/run/sip_audio_session.pid.