Esempio n. 1
0
 protected override void ProcessRequestOverride(DialogResult result, SipRequestEvent requestEvent)
 {
 }
Esempio n. 2
0
 protected override void ProcessResponseOverride(DialogResult result, SipResponseEvent responseEvent)
 {
 }
Esempio n. 3
0
        protected override void ProcessResponseOverride(DialogResult result, SipResponseEvent responseEvent)
        {
            if(responseEvent.Response.StatusLine.StatusCode / 100 == 2)
            {
                _lastOKSequenceNr = responseEvent.Response.CSeq.Sequence;

                if(HasSentAck)
                {
                    if (_logger.IsDebugEnabled) _logger.Debug("ClientDialog[Id={0}]. Received retransmitted OK. Resending ACK...", GetId());

                    /*it's an ok retransmit. Resend ack*/
                    result.InformToUser = false;
                    var acKRequest = CreateAck();
                    SendAck(acKRequest);
                    if (_logger.IsDebugEnabled) _logger.Debug("ClientDialog[Id={0}]. ACK sent.", GetId());
                }
            }
        }
Esempio n. 4
0
 protected abstract void ProcessResponseOverride(DialogResult result, SipResponseEvent responseEvent);
Esempio n. 5
0
 protected abstract void ProcessRequestOverride(DialogResult result, SipRequestEvent requestEvent);
Esempio n. 6
0
        public void ProcessResponse(SipResponseEvent responseEvent)
        {
            var statusCode = responseEvent.Response.StatusLine.StatusCode;

            if (_logger.IsDebugEnabled) _logger.Debug("Dialog[Id={0}] received a response[StatusCode={1}]. Verifying if response is targetted to this Dialog...", GetId(), statusCode);

            var match = State == DialogState.Null ? IsMatchByFirstTransaction(responseEvent) : IsMatchByDialogId(responseEvent.Response);

            if (_logger.IsDebugEnabled) _logger.Debug("Response does {0} match.", match ? "" : "NOT");

            var r = new DialogResult();
            r.InformToUser = true;

            if (match)
            {
                if (_logger.IsDebugEnabled) _logger.Debug("Setting the Dialog on responseEvent.");

                responseEvent.Dialog = this;

                /*moved invocation out of ctx, to here. ctx now invokes ProcessResponse*/
                SetLastResponse(responseEvent.Response);

                ProcessResponseOverride(r, responseEvent);
            }

            if (r.InformToUser)
            {
                /*forward TODO: check rfc*/
                _listener.ProcessResponse(responseEvent);
            }
        }
Esempio n. 7
0
        public void ProcessRequest(SipRequestEvent requestEvent)
        {
            if (_logger.IsDebugEnabled) _logger.Debug("Dialog[Id={0}] received as request[method={1}]", GetId(), requestEvent.Request.RequestLine.Method);
            var result = new DialogResult();
            result.InformToUser = true;

            var seqNr = requestEvent.Request.CSeq.Sequence;

            /* If the remote sequence number is empty, it MUST be set to the value
              of the sequence number in the CSeq header field value in the request.
              If the remote sequence number was not empty, but the sequence number
              of the request is lower than the remote sequence number, the request
              is out of order and MUST be rejected with a 500 (Server Internal
              Error) response. remoteSequenceNr = unset value = -1*/

            if (seqNr < _remoteSequenceNr)
            {
                throw new SipException(SipResponseCodes.x500_Server_Internal_Error);
            }

            _remoteSequenceNr = seqNr;

            ProcessRequestOverride(result, requestEvent);

            if(result.InformToUser)
            {
                /*forward TODO: check rfc*/
                _listener.ProcessRequest(requestEvent);
            }
        }