////////////////////////////////////////////////////////////////////////////////
// Client: call with live speech and dialled digits, with pass/fail assertions
//
// Same as Call_speech_dials_client, but after the 200 OK it checks:
//   assert=status 2xx               the final response to the INVITE is a 2xx
//   assert=responseTime 2000        the 200 OK arrived within 2000 ms of the INVITE
//   assert=header Contact exists    the 200 OK has a Contact
//   assert=body contains PCMU       its SDP offers PCMU
// and before the BYE, the RTP that came from the server while the call ran:
//   assert=rtp packets > 100        at least 100 packets
//   assert=rtp loss <= 2            at most 2% of them lost
//   assert=rtp mos >= 3.5           an estimated MOS of 3.5 or better
// A failed assertion drops the call and is reported in the end-of-run summary,
// so the CLI exits non-zero (useful as a CI/regression gate).
//
// 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)
//  <--- 180 Ringing
//  <--- 200 OK ;retrans
//  ---- assert status 2xx
//  ---- assert responseTime 2000
//  ---- assert header Contact exists
//  ---- assert body contains PCMU
//  ---> ACK
//  ---- live speech, pause 9 s
//  ---- dial a random 7 digit number, pause 11 s
//  ---- assert rtp packets > 100, loss <= 2, mos >= 3.5
//  ---> BYE ;retrans
//  <--- 200 OK
////////////////////////////////////////////////////////////////////////////////

---------->;retrans
INVITE sip:[toUsername]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: <sip:[fromUsername]@[local_ip]:[local_port]>;tag=[call_number]
To: <sip:[toUsername]@[remote_ip]:[remote_port]>
Call-ID: [call_number].[run_tag]@[local_ip]
CSeq: [cseq+1] INVITE
Max-Forwards: 70
Contact: <sip:[fromUsername]@[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

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

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

----------
assert=status 2xx

----------
assert=responseTime 2000

----------
assert=header Contact exists

----------
assert=body contains PCMU

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


----------
cmd_RTPSpeech

----------
cmd_Pause=9000

----------
rndVal=rand[1000000-9999999]

----------
cmd_DialDigits=[$rndVal]

----------
cmd_Pause=11000

----------
assert=rtp packets > 100

----------
assert=rtp loss <= 2

----------
assert=rtp mos >= 3.5

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


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