Example #1
0
        public SIPRequest Call(SIPCallDescriptor sipCallDescriptor, SIPEndPoint serverEndPoint)
        {
            m_uacCallDescriptor = sipCallDescriptor;

            m_uac               = new SIPClientUserAgent(m_sipTransport, m_outboundProxy);
            m_uac.CallFailed   += ClientCallFailed;
            m_uac.CallTrying   += (uac, resp) => CallTrying?.Invoke(uac, resp);
            m_uac.CallRinging  += (uac, resp) => CallRinging?.Invoke(uac, resp);
            m_uac.CallAnswered += ClientCallAnswered;

            return(m_uac.Call(m_uacCallDescriptor));
        }
        private Task <SocketError> ServerInformationResponseReceived(SIPEndPoint localSIPEndPoint, SIPEndPoint remoteEndPoint, SIPTransaction sipTransaction, SIPResponse sipResponse)
        {
            logger.LogDebug("Information response " + sipResponse.StatusCode + " " + sipResponse.ReasonPhrase + " for " + m_serverTransaction.TransactionRequest.URI.ToString() + ".");

            if (m_callCancelled)
            {
                // Call was cancelled in the interim.
                Cancel();
            }
            else
            {
                if (sipResponse.Status == SIPResponseStatusCodesEnum.Ringing || sipResponse.Status == SIPResponseStatusCodesEnum.SessionProgress)
                {
                    CallRinging?.Invoke(this, sipResponse);
                }
                else
                {
                    CallTrying?.Invoke(this, sipResponse);
                }
            }

            return(Task.FromResult(SocketError.Success));
        }