/// <summary> /// Constructs B2BUA event arguments. /// </summary> /// <param name="core">The <see cref="SipCore" /> that raised the event.</param> /// <param name="b2bUserAgent">The <see cref="SipB2BUserAgent{TState}" /> that raised the event.</param> /// <param name="session">The <see cref="SipB2BUASession{TState}" /> associated with the event.</param> internal SipB2BUAEventArgs(SipCore core, SipB2BUserAgent <TState> b2bUserAgent, SipB2BUASession <TState> session) { this.Core = core; this.B2BUserAgent = b2bUserAgent; this.Session = session; }
/// <summary> /// Constructs B2BUA event arguments for a received <see cref="SipResponse" />. /// </summary> /// <param name="core">The <see cref="SipCore" /> that raised the event.</param> /// <param name="b2bUserAgent">The <see cref="SipB2BUserAgent{TState}" /> that raised the event.</param> /// <param name="session">The <see cref="SipB2BUASession{TState}" /> associated with the event.</param> /// <param name="receivedResponse">The received <see cref="SipResponse" />.</param> /// <param name="response">The proposed <see cref="SipResponse" /> to be forwarded.</param> internal SipB2BUAEventArgs(SipCore core, SipB2BUserAgent <TState> b2bUserAgent, SipB2BUASession <TState> session, SipResponse receivedResponse, SipResponse response) { Assertion.Test(receivedResponse != null); Assertion.Test(response != null); this.Core = core; this.B2BUserAgent = b2bUserAgent; this.Session = session; this.ReceivedResponse = receivedResponse; this.Response = response; }
/// <summary> /// Starts the gateway and the associated <see cref="SipCore" /> if it has not /// already been started. /// </summary> /// <remarks> /// <note><see cref="SipMssGateway" /> instances cannot be restarted.</note> /// </remarks> public void Start() { using (TimedLock.Lock(core)) { if (isRunning) { throw new InvalidOperationException("MSS Gateway is already running."); } if (isUsed) { throw new InvalidOperationException("Cannot restart a MSS Gateway."); } isRunning = true; isUsed = true; } Helper.GetNetworkInfo(out localAddress, out localSubnet); b2bua = new SipB2BUserAgent <object>(core); b2bua.InviteRequestReceived += new SipB2BUAEventDelegate <object>(OnInviteRequestReceived); b2bua.InviteResponseReceived += new SipB2BUAEventDelegate <object>(OnInviteResponseReceived); b2bua.SessionConfirmed += new SipB2BUAEventDelegate <object>(OnSessionConfirmed); b2bua.SessionClosing += new SipB2BUAEventDelegate <object>(OnSessionClosing); b2bua.ClientRequestReceived += new SipB2BUAEventDelegate <object>(OnClientRequestReceived); b2bua.ServerRequestReceived += new SipB2BUAEventDelegate <object>(OnServerRequestReceived); b2bua.ClientResponseReceived += new SipB2BUAEventDelegate <object>(OnClientResponseReceived); b2bua.ServerResponseReceived += new SipB2BUAEventDelegate <object>(OnServerResponseReceived); if (!core.IsRunning) { core.Start(); } b2bua.Start(); if (settings.Register.Length > 1) { SysLog.LogWarning("MSS Gateway currently supports only one registration URI. Only the first URI will be registered."); } if (settings.Register.Length > 0) { core.StartAutoRegistration((string)settings.TrunkUri, (string)settings.Register[0]); } }