////////////////////////////////////////////////////////////////////////////////
// Client: outgoing calls, one per row of a values file
//
// No counterpart in this directory: it expects a proxy that challenges the
// INVITE with 407.
//
// Run it with a values file that has one line per call: [field0] is the caller,
// [field1] the called number, [field2] and [field3] the authentication user
// name and password. Example values file: values/PBX_call_series_values.txt.
//
// Messages with ;retrans are sent again over UDP until they are answered, and a copy
// of one that comes again is answered as before (RFC 3261; -t1, -t2).
//
// SIP Messages
//  ---> INVITE ;retrans
//  <--- 100 Trying (optional)
//  <--- 407 ;retrans
//  ---> ACK (for the 407)
//  ---> INVITE ;retrans (with Proxy-Authorization)
//  <--- 100 Trying (optional)
//  <--- 180 Ringing
//  <--- 200 OK ;retrans
//  ---> ACK
//  ---- play test.pcap, pause 15 s
//  ---> BYE ;retrans
//  <--- 200 OK
////////////////////////////////////////////////////////////////////////////////

---------->;retrans
INVITE sip:[field1]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=z9hG4bK[run_tag].[call_number]inv1
From: <sip:[field0]@[local_ip]:[local_port]>;tag=[call_number]
To: <sip:[field1]@[remote_ip]:[remote_port]>
Call-ID: 4fun[call_number].[run_tag]@[local_ip]
CSeq: [cseq+1] INVITE
Max-Forwards: 70
Contact: <sip:[field0]@[local_ip]:[local_port];transport=[transport]>
User-Agent: SIPInspector_v_[ver]
Content-Type: application/sdp
Content-Length: [len]

v=0
o=111 843670094 843670094 IN [IP_ver] [local_ip_sdp]
s=-
c=IN [IP_ver] [local_ip_sdp]
t=0 0
a=sendrecv
m=audio [media_port] RTP/AVP 0 8 18 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:20

<----------*
100 Trying

<----------;retrans
407 Proxy Authentication Required

---------->
ACK sip:[field1]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=z9hG4bK[run_tag].[call_number]inv1
From: <sip:[field0]@[local_ip]:[local_port]>;tag=[call_number]
To: <sip:[field1]@[remote_ip]:[remote_port]>;[peer_tag_param]
Call-ID: 4fun[call_number].[run_tag]@[local_ip]
CSeq: [cseq] ACK
Max-Forwards: 70
Contact: <sip:[field0]@[local_ip]:[local_port];transport=[transport]>
User-Agent: SIPInspector_v_[ver]
Content-Length: 0


---------->;retrans
INVITE sip:[field1]@[remote_ip]:[remote_port];transport=[transport] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]ab
From: <sip:[field0]@[local_ip]:[local_port]>;tag=[call_number]
To: <sip:[field1]@[remote_ip]:[remote_port]>
Call-ID: 4fun[call_number].[run_tag]@[local_ip]
CSeq: [cseq+1] INVITE
Max-Forwards: 70
Contact: <sip:[field0]@[local_ip]:[local_port];transport=[transport]>
User-Agent: SIPInspector_v_[ver]
Proxy-Authorization: [authentication username=[field2]; password=[field3];]
Content-Type: application/sdp
Content-Length: [len]

v=0
o=111 843670094 843670094 IN [IP_ver] [local_ip_sdp]
s=-
c=IN [IP_ver] [local_ip_sdp]
t=0 0
a=sendrecv
m=audio [media_port] RTP/AVP 0 8 18 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:20

<----------*
100 Trying

<----------
180 Ringing

<----------;retrans
200 OK

---------->
ACK sip:[field1]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: <sip:[field0]@[local_ip]:[local_port]>;tag=[call_number]
To: <sip:[field1]@[remote_ip]:[remote_port]>;[peer_tag_param]
Call-ID: 4fun[call_number].[run_tag]@[local_ip]
CSeq: [cseq] ACK
Max-Forwards: 70
Contact: <sip:[field0]@[local_ip]:[local_port];transport=[transport]>
User-Agent: SIPInspector_v_[ver]
Content-Length: 0


----------
cmd_PlayPcap=./pcap/test.pcap

----------
cmd_Pause=15000

---------->;retrans
BYE sip:[field1]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]cd
From: <sip:[field0]@[local_ip]:[local_port]>;tag=[call_number]
To: <sip:[field1]@[remote_ip]:[remote_port]>;[peer_tag_param]
Call-ID: 4fun[call_number].[run_tag]@[local_ip]
CSeq: [cseq+1] BYE
Max-Forwards: 70
Contact: <sip:[field0]@[local_ip]:[local_port];transport=[transport]>
User-Agent: SIPInspector_v_[ver]
Content-Length: 0


<----------
200 OK
