/// <summary>
        /// Receive parcel voice cap
        /// </summary>
        /// <param name="client"></param>
        /// <param name="result"></param>
        /// <param name="error"></param>
        void pCap_OnComplete(OpenMetaverse.Http.CapsClient client,
                             OpenMetaverse.StructuredData.OSD result,
                             Exception error)
        {
            parcelCap.OnComplete -=
                new OpenMetaverse.Http.CapsClient.CompleteCallback(pCap_OnComplete);
            parcelCap = null;

            if (error != null)
            {
                Logger.Log("Region voice cap " + error.Message, Helpers.LogLevel.Error);
                return;
            }

            OpenMetaverse.StructuredData.OSDMap pMap = result as OpenMetaverse.StructuredData.OSDMap;

            regionName = pMap["region_name"].AsString();
            ReportConnectionState(ConnectionState.RegionCapAvailable);

            if (pMap.ContainsKey("voice_credentials"))
            {
                OpenMetaverse.StructuredData.OSDMap cred =
                    pMap["voice_credentials"] as OpenMetaverse.StructuredData.OSDMap;

                if (cred.ContainsKey("channel_uri"))
                {
                    spatialUri = cred["channel_uri"].AsString();
                }
                if (cred.ContainsKey("channel_credentials"))
                {
                    spatialCredentials = cred["channel_credentials"].AsString();
                }
            }

            if (spatialUri == null || spatialUri == "")
            {
                // "No voice chat allowed here");
                return;
            }

            Logger.Log("Voice connecting for region " + regionName, Helpers.LogLevel.Info);

            // STEP 5
            int reqId = SessionCreate(
                accountHandle,
                spatialUri,         // uri
                "",                 // Channel name seems to be always null
                spatialCredentials, // spatialCredentials, // session password
                true,               // Join Audio
                false,              // Join Text
                "");

            if (reqId < 0)
            {
                Logger.Log("Voice Session ReqID " + reqId.ToString(), Helpers.LogLevel.Error);
            }
        }
        /// <summary>
        /// Request info from a parcel capability Uri.
        /// </summary>
        /// <param name="cap"></param>

        void RequestParcelInfo(Uri cap)
        {
            Logger.Log("Requesting region voice info", Helpers.LogLevel.Info);

            parcelCap             = new OpenMetaverse.Http.CapsClient(cap);
            parcelCap.OnComplete +=
                new OpenMetaverse.Http.CapsClient.CompleteCallback(pCap_OnComplete);
            OSD postData = new OSD();

            currentParcelCap = cap;
            parcelCap.BeginGetResponse(postData, OSDFormat.Xml, 10000);
        }
        void RequestVoiceProvision(System.Uri cap)
        {
            OpenMetaverse.Http.CapsClient capClient =
                new OpenMetaverse.Http.CapsClient(cap);
            capClient.OnComplete +=
                new OpenMetaverse.Http.CapsClient.CompleteCallback(cClient_OnComplete);
            OSD postData = new OSD();

            // STEP 0
            Logger.Log("Requesting voice capability", Helpers.LogLevel.Info);
            capClient.BeginGetResponse(postData, OSDFormat.Xml, 10000);
        }
        /// <summary>
        /// Handle completion of main voice cap request.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="result"></param>
        /// <param name="error"></param>
        void cClient_OnComplete(OpenMetaverse.Http.CapsClient client,
                                OpenMetaverse.StructuredData.OSD result,
                                Exception error)
        {
            if (error != null)
            {
                Logger.Log("Voice cap error " + error.Message, Helpers.LogLevel.Error);
                return;
            }

            Logger.Log("Voice provisioned", Helpers.LogLevel.Info);
            ReportConnectionState(ConnectionState.Provisioned);

            OpenMetaverse.StructuredData.OSDMap pMap = result as OpenMetaverse.StructuredData.OSDMap;

            // We can get back 4 interesting values:
            //      voice_sip_uri_hostname
            //      voice_account_server_name   (actually a full URI)
            //      username
            //      password
            if (pMap.ContainsKey("voice_sip_uri_hostname"))
            {
                sipServer = pMap["voice_sip_uri_hostname"].AsString();
            }
            if (pMap.ContainsKey("voice_account_server_name"))
            {
                acctServer = pMap["voice_account_server_name"].AsString();
            }
            voiceUser     = pMap["username"].AsString();
            voicePassword = pMap["password"].AsString();

            // Start the SLVoice daemon
            slvoicePath = GetVoiceDaemonPath();

            // Test if the executable exists
            if (!System.IO.File.Exists(slvoicePath))
            {
                Logger.Log("SLVoice is missing", Helpers.LogLevel.Error);
                return;
            }

            // STEP 1
            StartDaemon(slvoicePath, slvoiceArgs);
        }
Esempio n. 5
0
        /// <summary>
        /// Request info from a parcel capability Uri.
        /// </summary>
        /// <param name="cap"></param>
        void RequestParcelInfo(Uri cap)
        {
            Logger.Log("Requesting region voice info", Helpers.LogLevel.Info);

            parcelCap = new OpenMetaverse.Http.CapsClient(cap);
            parcelCap.OnComplete +=
                new OpenMetaverse.Http.CapsClient.CompleteCallback(pCap_OnComplete);
            OSD postData = new OSD();

            currentParcelCap = cap;
            parcelCap.BeginGetResponse(postData, OSDFormat.Xml, 10000);
        }
Esempio n. 6
0
        /// <summary>
        /// Receive parcel voice cap
        /// </summary>
        /// <param name="client"></param>
        /// <param name="result"></param>
        /// <param name="error"></param>
        void pCap_OnComplete(OpenMetaverse.Http.CapsClient client,
            OpenMetaverse.StructuredData.OSD result,
            Exception error)
        {
            parcelCap.OnComplete -=
                new OpenMetaverse.Http.CapsClient.CompleteCallback(pCap_OnComplete);
            parcelCap = null;

            if (error != null)
            {
                Logger.Log("Region voice cap " + error.Message, Helpers.LogLevel.Error);
                return;
            }

            OpenMetaverse.StructuredData.OSDMap pMap = result as OpenMetaverse.StructuredData.OSDMap;

            regionName = pMap["region_name"].AsString();
            ReportConnectionState(ConnectionState.RegionCapAvailable);

            if (pMap.ContainsKey("voice_credentials"))
            {
                OpenMetaverse.StructuredData.OSDMap cred =
                    pMap["voice_credentials"] as OpenMetaverse.StructuredData.OSDMap;

                if (cred.ContainsKey("channel_uri"))
                    spatialUri = cred["channel_uri"].AsString();
                if (cred.ContainsKey("channel_credentials"))
                    spatialCredentials = cred["channel_credentials"].AsString();
            }

            if (spatialUri == null || spatialUri == "")
            {
                // "No voice chat allowed here");
                return;
            }

            Logger.Log("Voice connecting for region " + regionName, Helpers.LogLevel.Info);

            // STEP 5
            int reqId = SessionCreate(
                accountHandle,
                spatialUri, // uri
                "", // Channel name seems to be always null
                spatialCredentials, // spatialCredentials, // session password
                true,   // Join Audio
                false,   // Join Text
                "");
            if (reqId < 0)
            {
                Logger.Log("Voice Session ReqID " + reqId.ToString(), Helpers.LogLevel.Error);
            }
        }
Esempio n. 7
0
        void RequestVoiceProvision(System.Uri cap)
        {
            OpenMetaverse.Http.CapsClient capClient =
                new OpenMetaverse.Http.CapsClient(cap);
            capClient.OnComplete +=
                new OpenMetaverse.Http.CapsClient.CompleteCallback(cClient_OnComplete);
            OSD postData = new OSD();

            // STEP 0
            Logger.Log("Requesting voice capability", Helpers.LogLevel.Info);
            capClient.BeginGetResponse(postData, OSDFormat.Xml, 10000);
        }