/// <summary>
 /// 
 /// </summary>
 /// <returns></returns>
 internal SessionModel PostSession(SessionModel session, DeviceProfile device)
 {
     try
     {
         string absoluteUri = TywiConfiguration.TywiServiceUri + UriTemplates.POST_SESSION_URI;
         SessionApiRequest<SessionModel, SessionModel> request = new SessionApiRequest<SessionModel, SessionModel>(
             device, absoluteUri, Http.HttpUtilities.Methods.POST, session);
         return this.ProcessRequest<SessionModel, SessionModel>(request);
     }
     catch (Exception exc)
     {
         throw new AccessDeniedException(String.Format("Failed to post audio from device {0}: {1}", device.profile.id, exc.Message), exc);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 
        /// </summary>
        private void InitSession()
        {
            if (String.IsNullOrEmpty(SessionId))
            {
                SessionCapabilityModel[] capabilities = new SessionCapabilityModel[] {
                    new SessionCapabilityModel() { name = "allowSecondarySpeakers", value = "true" },
                    new SessionCapabilityModel() { name = "defaultLayout", value = "medium" },
                    new SessionCapabilityModel() { name = "defaultTTS", value = "false" },
                };
                SessionModel session = new SessionModel() { capabilities = capabilities };
                SessionModel returnedSession = _service.PostSession(session, Device);
                this.SessionId = returnedSession.sessionId;
            }

            if (this.SessionConnected != null)
            {
                SessionConnected(this, EventArgs.Empty);
            }
        }