receiveNotify method

void receiveNotify(
  1. IncomingRequest request
)

Implementation

void receiveNotify(IncomingRequest request) {
  logger.debug('receiveNotify()');

  if (request.body == null) {
    return;
  }

  String status_line = request.body!.trim();
  dynamic parsed = Grammar.parse(status_line, 'Status_Line');

  if (parsed == -1) {
    logger.debug(
        'receiveNotify() | error parsing NOTIFY body: "${request.body}"');
    return;
  }

  String status_code = parsed.status_code.toString();
  if (Utils.test100(status_code)) {
    /// 100 Trying
    emit(EventReferTrying(request: request, status_line: status_line));
  } else if (Utils.test1XX(status_code)) {
    /// 1XX Progressing
    emit(EventReferProgress(request: request, status_line: status_line));
  } else if (Utils.test2XX(status_code)) {
    /// 2XX OK
    emit(EventReferAccepted(request: request, status_line: status_line));
  } else {
    /// 200+ Error
    emit(EventReferFailed(request: request, status_line: status_line));
  }
}