////////////////////////////////////////////////////////////////////////////////
// Client: attended call transfer, as a transferor (lab scenario)
//
// No counterpart in this directory: it needs two phones (extensions 105 and
// 106) and the transferor user 120. The addresses of the phones are the
// variables "phone105" and "phone106", set at the top of the scenario; change
// them for your network. Call_transfer_server / Call_transfer_client test a
// blind transfer on their own.
//
// It calls 105, puts the call on hold with a re-INVITE, calls 106 and then
// sends a REFER to 105 with a Refer-To that carries a Replaces header for the
// call to 106. It follows the NOTIFY messages and ends the calls.
//
// 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 (105) <--- 180, 200 OK ---> ACK
//  ---> INVITE (re-INVITE: hold, sendonly) <--- 200 ---> ACK
//  ---> INVITE (106) <--- 180, 200 OK ---> ACK
//  ---> REFER ;retrans (to 105, Refer-To 106 with Replaces)
//  <--- 202
//  <--- NOTIFY ---> 200 (progress reports)
//  ---> BYE (106) <--- 200
//  <--- BYE (from 105) ---> 200
////////////////////////////////////////////////////////////////////////////////

// Settings: where the phones are
----------
set_Variable=phone105 "-" "=192.168.1.110:55634"

----------
set_Variable=phone106 "-" "=192.168.1.105:5112"

---------->;retrans
INVITE sip:105@[remote_ip]:[remote_port];transport=[transport] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: <sip:120@[local_ip]:[local_port]>;tag=24417923471779367133
To: <sip:105@[remote_ip]:[remote_port]>
Call-ID: [call_number].[run_tag]-[local_ip]
CSeq: [cseq+1] INVITE
Max-Forwards: 70
Contact: <sip:120@[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 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:20

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

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

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

----------
set_Variable=toTag "To:" "tag=*"

----------
set_Variable=fromTag "From:" "tag=*"

----------
set_Variable=callId "Call-ID:" "*"

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


----------
cmd_Pause=2000

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

v=0
o=MxSIP 0 2092936035 IN [IP_ver] [local_ip_sdp]
s=SIP Call
c=IN [IP_ver] 0.0.0.0
t=0 0
m=audio [media_port] RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=silenceSupp:off - - - -
a=fmtp:101 0-15
a=sendonly

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

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


----------
cmd_Pause=2000

----------
cmd_setRemote=[$phone106]

---------->;retrans
INVITE sip:106@[remote_ip]:[remote_port];transport=[transport] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]gh
From: <sip:120@[local_ip]:[local_port]>;tag=244179234717793671
To: <sip:106@[remote_ip]:[remote_port]>
Call-ID: 106-[local_ip]
CSeq: [cseq+1] INVITE
Max-Forwards: 70
Contact: <sip:120@[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 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:20

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

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

----------
set_Variable=to2 "To:" "tag=*"

----------
set_Variable=from2 "From:" "tag=*"

----------
set_Variable=call2 "Call-ID:" "*"

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

---------->
ACK sip:106@[remote_ip]:[remote_port];transport=[transport] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]ij
From: <sip:120@[local_ip]:[local_port]>;tag=[$from2]
To: <sip:106@[remote_ip]:[remote_port]>;tag=[$to2]
Call-ID: [$call2]
CSeq: [cseq] ACK
Max-Forwards: 70
Contact: <sip:120@[local_ip]:[local_port];transport=[transport]>
User-Agent: SIPInspector_v_[ver]
Content-Length: 0


----------
cmd_Pause=2000

----------
cmd_setRemote=[$phone105]

---------->;retrans
REFER sip:105@[remote_ip]:[remote_port];transport=[transport] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]kl
From: <sip:120@[local_ip]:[local_port]>;tag=[$fromTag]
To: <sip:105@[remote_ip]:[remote_port]>;tag=[$toTag]
Call-ID: [$callId]
CSeq: [cseq+1] REFER
Max-Forwards: 70
Contact: <sip:120@[local_ip]:[local_port];transport=[transport]>
Refer-To: <sip:106@[$phone106];transport=[transport]?Replaces=[$call2]%3bto-tag%3d[$to2]%3bfrom-tag%3d[$from2]>
Referred-By: 120 <sip:120@[local_ip]:[local_port]>
User-Agent: SIPInspector_v_[ver]
Content-Length: 0


<----------
202 OK

<----------;retrans
NOTIFY

---------->
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:]
[last_Call-ID:]
[last_CSeq:]
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
User-Agent: SIPInspector_v_[ver]
Content-Length: [len]


----------
cmd_setRemote=[$phone106]

---------->;retrans
BYE sip:106@[remote_ip]:[remote_port];transport=[transport] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]mn
From: <sip:120@[local_ip]:[local_port]>;tag=[$from2]
To: <sip:106@[remote_ip]:[remote_port]>;tag=[$to2]
Call-ID: [$call2]
CSeq: [cseq] BYE
Max-Forwards: 70
Contact: <sip:120@[local_ip]:[local_port];transport=[transport]>
User-Agent: SIPInspector_v_[ver]
Content-Length: 0


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

<----------;retrans
BYE

---------->
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:]
[last_Call-ID:]
[last_CSeq:]
User-Agent: SIPInspector_v_[ver]
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
Content-Length: 0


<----------*;retrans
NOTIFY

---------->*
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:]
[last_Call-ID:]
[last_CSeq:]
User-Agent: SIPInspector_v_[ver]
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
Content-Length: 0


<----------*;retrans
NOTIFY

---------->*
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:]
[last_Call-ID:]
[last_CSeq:]
User-Agent: SIPInspector_v_[ver]
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
Content-Length: 0


<----------*;retrans
NOTIFY

---------->*
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:]
[last_Call-ID:]
[last_CSeq:]
User-Agent: SIPInspector_v_[ver]
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
Content-Length: 0


<----------;retrans
BYE

---------->
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:]
[last_Call-ID:]
[last_CSeq:]
User-Agent: SIPInspector_v_[ver]
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
Content-Length: 0

