Esempio n. 1
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;
 }
Esempio n. 2
0
        /// <summary>
        /// Constructs an instance from settings passed as explicit parameters.
        /// </summary>
        /// <param name="transportType">The desired <see cref="SipTransportType" />.</param>
        /// <param name="binding">The network binding to be associated with the transport.</param>
        /// <param name="bufferSize">Size of the transport socket's send and receive buffers (or 0 for a reasonable default).</param>
        public SipTransportSettings(SipTransportType transportType, NetworkBinding binding, int bufferSize)
        {
            this.TransportType = transportType;
            this.Binding       = binding;
            this.BaseTimers    = new SipBaseTimers();

            if (bufferSize > 0)
            {
                this.BufferSize = bufferSize;
            }
        }
Esempio n. 3
0
        //---------------------------------------------------------------------
        // Static members

        /// <summary>
        /// Loads the timers from the application configuration.
        /// </summary>
        /// <param name="keyPrefix">The configuration key prefix.</param>
        /// <returns>The loaded <see cref="SipBaseTimers" />.</returns>
        /// <remarks>
        /// <para>
        /// Here's the list of the timers loaded.
        /// </para>
        /// <div class="tablediv">
        /// <table class="dtTABLE" cellspacing="0" ID="Table1">
        /// <tr valign="top">
        /// <th width="1">Setting</th>
        /// <th width="1">Default</th>
        /// <th width="90%">Description</th>
        /// </tr>
        /// <tr valign="top">
        ///     <td>T1</td>
        ///     <td>500ms</td>
        ///     <td>Round trip time estimate (RTT).</td>
        /// </tr>
        /// <tr valign="top">
        ///     <td>T2</td>
        ///     <td>4s</td>
        ///     <td>Maximum retransmit interval for non-INVITE requests and INVITE responses.</td>
        /// </tr>
        /// <tr valign="top">
        ///     <td>T4</td>
        ///     <td>5s</td>
        ///     <td>Maximum duration a message will remain in the network.</td>
        /// </tr>
        /// </table>
        /// </div>
        /// </remarks>
        public static SipBaseTimers LoadConfig(string keyPrefix)
        {
            var config = new Config(keyPrefix);
            var timers = new SipBaseTimers();

            timers.T1 = config.Get("T1", timers.T1);
            timers.T2 = config.Get("T2", timers.T2);
            timers.T4 = config.Get("T4", timers.T4);

            return(timers);
        }
Esempio n. 4
0
        //---------------------------------------------------------------------
        // Static members

        /// <summary>
        /// Constructs an instance from settings loaded from the application configuration.
        /// </summary>
        /// <param name="keyPrefix">The configuration key prefix.</param>
        /// <remarks>
        /// <para>
        /// The RADIUS client settings are loaded from the application
        /// configuration, using the specified key prefix.  The following
        /// settings are recognized by the class:
        /// </para>
        /// <div class="tablediv">
        /// <table class="dtTABLE" cellspacing="0" ID="Table1">
        /// <tr valign="top">
        /// <th width="1">Setting</th>
        /// <th width="1">Default</th>
        /// <th width="90%">Description</th>
        /// </tr>
        /// <tr valign="top">
        ///     <td>Type</td>
        ///     <td>UDP</td>
        ///     <td>
        ///     Specifies the transport type.  This must be one
        ///     of the following values: <b>UDP</b>, <b>TCP</b>, or <b>TLS</b>.
        ///     </td>
        /// </tr>
        /// <tr valign="top">
        ///     <td>Binding</td>
        ///     <td>ANY:SIP</td>
        ///     <td>
        ///     The <see cref="NetworkBinding" /> the transport should use
        ///     when binding to the network interface.
        ///     </td>
        /// </tr>
        /// <tr valign="top">
        ///     <td>ExternalBinding</td>
        ///     <td>(see note)</td>
        ///     <td>
        ///     The <see cref="NetworkBinding" /> that specifies how external clients
        ///     will access the transport.  This will typically be set to the IP
        ///     address and port on the WAN side of the firewall/router that is
        ///     mapped to the <b>Binding</b> specified above.  This defaults to
        ///     <b>Binding</b> unless its IP address is <see cref="IPAddress.Any" />.
        ///     If this is the case, then <b>ExternalBinding</b> will default to
        ///     the IP address of the first active network adapter found and the
        ///     port specified in <b>Binding</b>.
        ///     </td>
        /// </tr>
        /// <tr valign="top">
        ///     <td>BufferSize</td>
        ///     <td>32K</td>
        ///     <td>
        ///     Byte size of the socket's send and receive buffers.
        ///     </td>
        /// </tr>
        /// <tr valign="top">
        ///     <td>Timers.*</td>
        ///     <td>(see note)</td>
        ///     <td>
        ///     This subsection can be used to override the default
        ///     timers used by user agents for this transport.
        ///     See the <see cref="SipBaseTimers" /> class' <see cref="SipBaseTimers.LoadConfig" />
        ///     method for more information.
        ///     </td>
        /// </tr>
        /// </table>
        /// </div>
        /// <para>
        /// Transport settings can be specified in an application configuration
        /// section.  Applications will often use a configuration array so that
        /// multiple transports can be specified.
        /// </para>
        /// </remarks>
        public static SipTransportSettings LoadConfig(string keyPrefix)
        {
            var settings = new SipTransportSettings();
            var config   = new Config(keyPrefix);

            settings.TransportType   = config.Get <SipTransportType>("Type", settings.TransportType);
            settings.Binding         = config.Get("Binding", settings.Binding);
            settings.ExternalBinding = config.Get("ExternalBinding", settings.Binding);
            settings.BufferSize      = config.Get("BufferSize", settings.BufferSize);
            settings.BaseTimers      = SipBaseTimers.LoadConfig(config.KeyPrefix + "Timers");

            return(settings);
        }
Esempio n. 5
0
 /// <summary>
 /// Constructs a settings instance using defauls.
 /// </summary>
 /// <remarks>
 /// <para>
 /// The default settings specify:
 /// </para>
 /// <list type="bullet">
 ///     <item>UDP tranmsport</item>
 ///     <item>Binding to all network interfaces on port 5060.</item>
 ///     <item>32K socket buffer.</item>
 /// </list>
 /// </remarks>
 public SipTransportSettings()
 {
     this.BaseTimers = new SipBaseTimers();
 }