reply function
void
reply(
- int status_code
)
Implementation
void reply(int status_code) {
List<dynamic> vias = message.getHeaders('via');
dynamic to;
String response =
'SIP/2.0 $status_code ${DartSIP_C.REASON_PHRASE[status_code]}\r\n';
for (dynamic via in vias) {
response += 'Via: $via\r\n';
}
to = message.getHeader('To');
if (message.to_tag == null) {
to += ';tag=${Utils.newTag()}';
}
response += 'To: $to\r\n';
response += 'From: ${message.getHeader('From')}\r\n';
response += 'Call-ID: ${message.call_id}\r\n';
response +=
'CSeq: ${message.cseq} ${SipMethodHelper.getName(message.method)}\r\n';
response += '\r\n';
transport.send(response);
}