public void Setup() { _ipAddress = Dns.GetHostAddresses(string.Empty).Where(a => a.AddressFamily == AddressFamily.InterNetwork).First(); /*create stack*/ _stack = new SipStack(); /*create sipproviders*/ _senderProvider = _stack.CreateSipProvider(_stack.CreateUdpListeningPoint(_ipAddress, 12345)); _receiverProvider = _stack.CreateSipProvider(_stack.CreateUdpListeningPoint(_ipAddress, 23456)); /*start both providers*/ _senderProvider.Start(); _receiverProvider.Start(); }
public static ISoftPhone CreateSoftPhone(IPEndPoint listeningPoint) { var sipStack = new SipStack(); var sipListeningPoint = sipStack.CreateUdpListeningPoint(listeningPoint); var provider = sipStack.CreateSipProvider(sipListeningPoint); return(new SoftPhone(provider, sipStack.CreateMessageFactory(), sipStack.CreateHeaderFactory(), sipStack.CreateAddressFactory(), new SoftPhoneStateProvider(), new TimerFactory(), sipListeningPoint)); }
private void _btnStart_Click(object sender, EventArgs e) { var ipEndPoint = SipUtil.ParseIpEndPoint(_txtLocalIPAddress.Text); _stack = new SipStack(); var listeningPoint = _stack.CreateUdpListeningPoint(ipEndPoint); _sipProvider = _stack.CreateSipProvider(listeningPoint); _sipProvider.AddSipListener(this); _stack.Start(); _tmrDiagnostics.Start(); }
public void Start() { if (_configuration == null) { throw new InvalidOperationException("The server is not configured."); } _stack = new SipStack(); _stack.MaxWorkerThreads = _configuration.MaxThreadPoolSize; _stack.MinWorkerThreads = _configuration.MinThreadPoolSize; _stack.EnableThreadPoolPerformanceCounters = _configuration.EnableThreadPoolPerformanceCounters; var listeningPoint = _stack.CreateUdpListeningPoint(_ipEndPoint); _provider = (SipProvider)_stack.CreateSipProvider(listeningPoint); _listener = new SipServerListener(); _registrar = InitializeRegistrar(); _listener.AddRequestHandler(_registrar); _provider.AddSipListener(_listener); //_stack.Start(); }
private void _btnStartStop_Click(object sender, EventArgs e) { if (!_isStarted) { var ipEndPoint = SipUtil.ParseIpEndPoint(Configuration.BindIpEndPoint); var outboundProxy = SipUtil.ParseIpEndPoint(Configuration.OutboundProxyIpEndPoint); SipStack = new SipStack(); var listeningPoint = SipStack.CreateUdpListeningPoint(ipEndPoint); SipStack.MaxWorkerThreads = Configuration.MaxThreadPoolSize; SipStack.MinWorkerThreads = Configuration.MinThreadPoolSize; SipStack.OutBoundProxy = outboundProxy; SipStack.EnableThreadPoolPerformanceCounters = Configuration.EnableThreadPoolPerformanceCounters; //SipStack.IsStateFull = Configuration.IsStateFull; SipProvider = (SipProvider)SipStack.CreateSipProvider(listeningPoint); MainSipListener = new SipPipeLineListener(this); SipProvider.AddSipListener(MainSipListener); SipProvider.AddExceptionHandler(this); SipProvider.Start(); HeaderFactory = SipStack.CreateHeaderFactory(); MessageFactory = SipStack.CreateMessageFactory(); AddressFactory = SipStack.CreateAddressFactory(); ExecuteActionHelper.ExecuteAction(delegate() { FormsManager.OpenForm(typeof(LogForm), null); }); _lblIpAddress.Text = string.Format("IP:{0}", ipEndPoint.ToString()); } else { SipProvider.Stop(); } _isStarted = !_isStarted; _btnStartStop.Text = _isStarted ? "Stop" : "Start"; _grbNavigation.Enabled = _isStarted; }