rfc3261_8_2_2_2 function
Implementation
bool rfc3261_8_2_2_2() {
String? fromTag = message.from_tag;
String? call_id = message.call_id;
int? cseq = message.cseq;
// Accept any in-dialog request.
if (message.to_tag != null) {
return true;
}
bool result = true;
// INVITE request.
if (message.method == SipMethod.INVITE) {
// If the branch matches the key of any IST then assume it is a retransmission
// and ignore the INVITE.
// TODO(cloudwebrtc): we should reply the last response.
if (ua.transactions
.getTransaction(InviteServerTransaction, message.via_branch!) !=
null) {
result = false;
}
// Otherwise check whether it is a merged request.
else {
ua.transactions.getAll(InviteServerTransaction).forEach((dynamic tr) {
if (tr.request.from_tag == fromTag &&
tr.request.call_id == call_id &&
tr.request.cseq == cseq) {
reply(482);
result = false;
return;
}
});
}
}
// Non INVITE request.
// If the branch matches the key of any NIST then assume it is a retransmission
// and ignore the request.
// TODO(cloudwebrtc): we should reply the last response.
else if (ua.transactions
.getTransaction(NonInviteServerTransaction, message.via_branch!) !=
null) {
result = false;
}
// Otherwise check whether it is a merged request.
else {
ua.transactions.getAll(NonInviteServerTransaction).forEach((dynamic tr) {
if (tr.request.from_tag == fromTag &&
tr.request.call_id == call_id &&
tr.request.cseq == cseq) {
reply(482);
result = false;
return;
}
});
}
return result;
}