////////////////////////////////////////////////////////////////////////////////
// Server: registrar, message-waiting notifier and call server
//
// Counterpart of Reg_subscribe_call_client.
//
// After the registration it accepts a SUBSCRIBE for message-summary events and
// sends a NOTIFY ("Messages-Waiting: yes") to the subscriber's Contact, then
// answers one call and plays a pcap file.
//
// 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
//  <--- REGISTER ;retrans
//  ---> 200
//  (new dialog)
//  <--- SUBSCRIBE ;retrans
//  ---> 200
//  ---> NOTIFY ;retrans
//  <--- 200
//  (new dialog)
//  <--- INVITE ;retrans
//  ---> 100 Trying
//  ---> 180 Ringing
//  ---> 200 OK ;retrans (SDP)
//  <--- ACK
//  ---- play test.pcap
//  <--- BYE ;retrans
//  ---> 200 OK
////////////////////////////////////////////////////////////////////////////////

<----------;retrans
REGISTER

---------->
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:];tag=[call_number]
[last_Call-ID:]
[last_CSeq:]
[last_Contact:];expires=3600
Expires: 3600
User-Agent: SIPInspector_v_[ver]
Content-Length: 0


----------
cmd_NewDialog

<----------;retrans
SUBSCRIBE

----------
set_Variable=contact "Contact:" "<*>"

----------
set_Variable=fromUser "From:" "<sip:*@"

----------
set_Variable=toUser "To:" "<sip:*@"

----------
set_Variable=toHdr "To:" "*"

----------
set_Variable=fromHdr "From:" "*"

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


---------->;retrans
NOTIFY [$contact] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: [$toHdr];tag=q5rq543afasfdaf5
To: [$fromHdr]
[last_Call-ID:]
CSeq: [cseq+1] NOTIFY
Max-Forwards: 70
[last_Event:]
Contact: <sip:[$toUser]@[local_ip]:[local_port];transport=[transport]>
User-Agent: SIPInspector_v_[ver]
Subscription-State: active; expires=3600
Content-Type: application/simple-message-summary
Content-Length: [len]

Messages-Waiting: yes
Message-Account: sip:[$fromUser]@[remote_ip]
Voice-Message: 1/0

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

----------
cmd_NewDialog

<----------;retrans
INVITE

---------->
SIP/2.0 100 Trying
[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


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


---------->;retrans
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:];tag=[call_number]
[last_Call-ID:]
[last_CSeq:]
User-Agent: SIPInspector_v_[ver]
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
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

<----------
ACK

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

<----------;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

