コード例 #1
0
        /// <summary>
        /// Attempts to establish a new VoIP call via the Google Voice gateway.
        /// </summary>
        /// <param name="destination">The destination number to call.</param>
        public void Call(string destination)
        {
            if (!_isBound)
            {
                throw new ApplicationException("The Google Voice call could not proceed as the XMPP client is not bound.");
            }
            else
            {
                _audioChannel = new AudioChannel();

                // Call to Google Voice over XMPP & Gingle (Google's version of Jingle).
                XMPPPhoneSession phoneSession = m_xmppClient.GetPhoneSession();

                m_xmppCall           = m_xmppClient.GetPhoneSession();
                m_xmppCall.Accepted += XMPPAnswered;
                m_xmppCall.Rejected += XMPPCallFailed;
                m_xmppCall.Hungup   += Hangup;

                // Create the SDP packet to send to GV. Customise it with the ICE credentials that GV require.
                SDP xmppSDP = _audioChannel.GetSDP(true);
                xmppSDP.IcePwd   = Crypto.GetRandomString(12);
                m_localSTUNUFrag = Crypto.GetRandomString(8);
                xmppSDP.IceUfrag = m_localSTUNUFrag;

                m_xmppCall.PlaceCall(destination + "@" + GOOGLE_VOICE_HOST, xmppSDP);
            }
        }
コード例 #2
0
 private static void XMPPPlaceCall(SIPServerUserAgent uas)
 {
     if (!uas.IsCancelled)
     {
         XMPPPhoneSession phoneSession = m_xmppClient.GetPhoneSession();
         SIPToXMPPCall    call         = new SIPToXMPPCall(uas, phoneSession, m_sipTransport, m_ipAddress);
         m_activeCalls.Add(uas.CallRequest.Header.CallId, call);
         call.Call(uas.CallRequest.URI.User);
     }
 }
コード例 #3
0
        public SIPToXMPPCall(SIPServerUserAgent uas, XMPPPhoneSession xmppCall, SIPTransport sipTransport, IPAddress ipAddress)
        {
            m_uas          = uas;
            m_xmppCall     = xmppCall;
            m_sipTransport = sipTransport;
            m_ipAddress    = ipAddress;

            m_uas.CallCancelled += SIPCallCancelled;
            m_xmppCall.Accepted += Answered;
            m_xmppCall.Rejected += CallFailed;
            m_xmppCall.Hungup   += Hangup;
        }