Beispiel #1
0
            public void Start(ISipAgent agent)
            {
                this.agent = agent;

                base.SetRouter(this);
                base.Agents.Add(agent);
                base.Start();
            }
Beispiel #2
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="request">The initiating <see cref="SipRequest" />.</param>
 /// <param name="dialog">The <see cref="SipDialog" /> for requests that initiate a dialog (or <c>null</c>).</param>
 /// <param name="agent">The <see cref="ISipAgent" /> that sent the request and received the response.</param>
 /// <param name="response">The final <see cref="SipResponse" />.</param>
 public SipResult(SipRequest request, SipDialog dialog, ISipAgent agent, SipResponse response)
 {
     this.Request  = request;
     this.Response = response;
     this.Status   = response.Status;
     this.Dialog   = dialog;
     this.Agent    = agent;
 }
Beispiel #3
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="request">The initiating <see cref="SipRequest" />.</param>
 /// <param name="dialog">The <see cref="SipDialog" /> for requests that initiate a dialog (or <c>null</c>).</param>
 /// <param name="agent">The <see cref="ISipAgent" /> that sent the request and received the response.</param>
 /// <param name="status">The final operation status.</param>
 public SipResult(SipRequest request, SipDialog dialog, ISipAgent agent, SipStatus status)
 {
     this.Request  = request;
     this.Response = null;
     this.Status   = status;
     this.Dialog   = dialog;
     this.Agent    = agent;
 }
Beispiel #4
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="agent">The <see cref="ISipAgent" /> that owns this transaction.</param>
 /// <param name="id">The globally unique transaction ID.</param>
 /// <param name="transport">The <see cref="ISipTransport" /> to be used for this transaction.</param>
 /// <remarks>
 /// The timers <see cref="TimerA" /> through <see cref="TimerK" /> are initialized
 /// with the correct <see cref="PolledTimer.Interval" /> values for the given transport.
 /// These timers will then need to be <see cref="PolledTimer.Reset()" /> before they
 /// are actually used so they will be scheduled to fire at the correct time.
 /// </remarks>
 protected SipTransaction(ISipAgent agent, string id, ISipTransport transport)
 {
     this.agent      = agent;
     this.id         = id;
     this.state      = SipTransactionState.Unknown;
     this.transport  = transport;
     this.baseTimers = transport.Settings.BaseTimers;
     this.agentState = null;
 }
Beispiel #5
0
        /// <summary>
        /// Returns the <see cref="ISipTransport" /> that will be used to
        /// deliver a <see cref="SipMessage" /> from a source <see cref="ISipAgent" />.
        /// </summary>
        /// <param name="agent">The source agent.</param>
        /// <param name="request">The <see cref="SipRequest" /> to be delivered.</param>
        /// <param name="remoteEP">Returns as the destination server's <see cref="NetworkBinding" />.</param>
        /// <returns>The <see cref="ISipTransport" /> that will be used for delivery (or <c>null</c>).</returns>
        /// <remarks>
        /// <note>
        /// <c>null</c> is a valid return value.  This indicates that there are
        /// no appropriate transports available to deliver this message.
        /// </note>
        /// </remarks>
        public ISipTransport SelectTransport(ISipAgent agent, SipRequest request, out NetworkBinding remoteEP)
        {
            SipTransportType transportType;
            SipUri           proxyUri;

            proxyUri = base.OutboundProxyUri;
            if (proxyUri != null)
            {
                // Select a transport to route the message to the outbound proxy.

                if (!SipHelper.TryGetRemoteBinding("<" + proxyUri + ">", out remoteEP, out transportType))
                {
                    return(null);
                }
            }
            else if (!SipHelper.TryGetRemoteBinding("<" + request.Uri + ">", out remoteEP, out transportType))
            {
                return(null);
            }

            // Select the first transport that looks decent.  If the desired transport
            // is not specified, then favor UDP since most of the world is compatible
            // with that.

            if (transportType == SipTransportType.UDP || transportType == SipTransportType.Unspecified)
            {
                foreach (ISipTransport transport in base.Transports)
                {
                    if (transport.TransportType == SipTransportType.UDP)
                    {
                        return(transport);
                    }
                }

                return(null);
            }

            // Otherwise match the transport.

            foreach (ISipTransport transport in base.Transports)
            {
                if (transport.TransportType == transportType)
                {
                    return(transport);
                }
            }

            return(null);
        }
Beispiel #6
0
            /// <summary>
            /// Returns the <see cref="ISipTransport" /> that will be used to
            /// deliver a <see cref="SipMessage" /> from a source <see cref="ISipAgent" />.
            /// </summary>
            /// <param name="agent">The source agent.</param>
            /// <param name="request">The <see cref="SipRequest" /> to be delivered.</param>
            /// <param name="remoteEP">Returns as the destination server's <see cref="NetworkBinding" />.</param>
            /// <returns>The <see cref="ISipTransport" /> that will be used for delivery (or <c>null</c>).</returns>
            /// <remarks>
            /// <note>
            /// <c>null</c> is a valid return value.  This indicates that there are
            /// no appropriate transports available to deliver this message.
            /// </note>
            /// </remarks>
            public ISipTransport SelectTransport(ISipAgent agent, SipRequest request, out NetworkBinding remoteEP)
            {
                SipTransportType transportType;

                if (!SipHelper.TryGetRemoteBinding(request.Uri, out remoteEP, out transportType))
                {
                    return(null);
                }

                // Select the first transport that looks decent.  If the desired transport
                // is not specified, then favor UDP since most of the world is compatible
                // with that.

                if (transportType == SipTransportType.UDP || transportType == SipTransportType.Unspecified)
                {
                    foreach (ISipTransport transport in base.Transports)
                    {
                        if (transport.TransportType == SipTransportType.UDP)
                        {
                            return(transport);
                        }
                    }

                    return(null);
                }

                // Otherwise match the transport.

                foreach (ISipTransport transport in base.Transports)
                {
                    if (transport.TransportType == transportType)
                    {
                        return(transport);
                    }
                }

                return(null);
            }
Beispiel #7
0
 public ISipTransport SelectTransport(ISipAgent agent, SipRequest request, out NetworkBinding remoteEP)
 {
     remoteEP = null;    // NOP
     return(null);
 }