Inheritance: IVoIPClient
Example #1
0
        private SIPRegistrationUserAgent _sipRegistrationClient;   // Can be used to register with an external SIP provider if incoming calls are required.

        public SoftPhone()
        {
            InitializeComponent();

            // Do some UI initialisation.
            m_uasGrid.Visibility      = Visibility.Collapsed;
            m_cancelButton.Visibility = Visibility.Collapsed;
            m_byeButton.Visibility    = Visibility.Collapsed;

            // Set up the SIP client. It can receive calls and initiate outgoing calls.
            _sipClient = new SIPClient();
            _sipClient.IncomingCall  += SIPCallIncoming;
            _sipClient.CallAnswer    += SIPCallAnswered;
            _sipClient.CallEnded     += ResetToCallStartState;
            _sipClient.StatusMessage += (message) => { SetStatusText(m_signallingStatus, message); };

            // Set up the Gingle client.
            _gingleClient                = new GingleClient();
            _gingleClient.CallEnded     += ResetToCallStartState;
            _gingleClient.StatusMessage += (message) => { SetStatusText(m_signallingStatus, message); };

            // Lookup and periodically check the public IP address of the host machine.
            _stunClient = new SoftphoneSTUNClient();

            // Comment this out if you don't want the app to register with your SIP server.
            _sipRegistrationClient = new SIPRegistrationUserAgent(
                _sipClient.SIPClientTransport,
                null,
                null,
                new SIPURI(m_sipUsername, m_sipServer, null, SIPSchemesEnum.sip, SIPProtocolsEnum.udp),
                m_sipUsername,
                m_sipPassword,
                null,
                m_sipServer,
                new SIPURI(m_sipUsername, _sipClient.SIPClientTransport.GetDefaultSIPEndPoint().GetIPEndPoint().ToString(), null),
                180,
                null,
                null,
                (message) => { logger.Debug(message); });
            _sipRegistrationClient.Start();

            //videoElement.NewVideoSample += new EventHandler<WPFMediaKit.DirectShow.MediaPlayers.VideoSampleArgs>(videoElement_NewVideoSample);
        }
Example #2
0
        private SoftphoneSTUNClient _stunClient; // STUN client to periodically check the public IP address.

        #endregion Fields

        #region Constructors

        public SoftPhone()
        {
            InitializeComponent();

            // Do some UI initialisation.
            m_uasGrid.Visibility = Visibility.Collapsed;
            m_cancelButton.Visibility = Visibility.Collapsed;
            m_byeButton.Visibility = Visibility.Collapsed;

            // Set up the SIP client. It can receive calls and initiate outgoing calls.
            _sipClient = new SIPClient();
            _sipClient.IncomingCall += SIPCallIncoming;
            _sipClient.CallAnswer += SIPCallAnswered;
            _sipClient.CallEnded += ResetToCallStartState;
            _sipClient.StatusMessage += (message) => { SetStatusText(m_signallingStatus, message); };

            // Set up the Gingle client.
            _gingleClient = new GingleClient();
            _gingleClient.CallEnded += ResetToCallStartState;
            _gingleClient.StatusMessage += (message) => { SetStatusText(m_signallingStatus, message); };

            // Lookup and periodically check the public IP address of the host machine.
            _stunClient = new SoftphoneSTUNClient();

            // Comment this out if you don't want the app to register with your SIP server.
            //_sipRegistrationClient = new SIPRegistrationUserAgent(
            //    _sipClient.SIPClientTransport,
            //    null,
            //    null,
            //    new SIPURI(m_sipUsername, m_sipServer, null, SIPSchemesEnum.sip, SIPProtocolsEnum.udp),
            //    m_sipUsername,
            //    m_sipPassword,
            //    null,
            //    m_sipServer,
            //    new SIPURI(m_sipUsername, _sipClient.SIPClientTransport.GetDefaultSIPEndPoint().GetIPEndPoint().ToString(), null),
            //    180,
            //    null,
            //    null,
            //    (message) => { logger.Debug(message); });
            //_sipRegistrationClient.Start();
        }