public ClienteGT(string host, string port) { // this.form = f; // Set up GT client = new Client(new DefaultClientConfiguration()); client.ErrorEvent += es => Console.WriteLine(es); // client.ErrorEvent += es => MessageBox.Show(es.ToString()); // Evento do client client.ConnexionRemoved += client_ConnexionRemoved; client.Start(); // Evento do client client.MessageSent += new MessageHandler(this.MensagemEnviada); // updates: controle de acesso à sessão updates = client.OpenSessionChannel(host, port, SessionUpdatesChannelId, ChannelDeliveryRequirements.SessionLike); // Evento do updates updates.MessagesReceived += updates_SessionMessagesReceived; // Utilizar o OpenObjectChannel para enviar objetos genéricos objts = client.OpenObjectChannel(host, port, ObjectChannelId, ChannelDeliveryRequirements.CommandsLike); objts.MessagesReceived += new Action<IObjectChannel>(objts_MessagesReceived); }
/// <summary> /// Constructs a new instance of the session. /// </summary> /// <param name="channel">The channel used to communicate with the server.</param> /// <param name="configuration">The configuration for the client application.</param> /// <param name="endpoint">The endpoint use to initialize the channel.</param> public Session( ISessionChannel channel, ApplicationConfiguration configuration, ConfiguredEndpoint endpoint) : this(channel as ITransportChannel, configuration, endpoint, null) { }
/// <summary> /// Add session channel /// </summary> /// <param name="channel"></param> public void AddChannel(ISessionChannel channel) { if (!base.IsDisposed) { CodeContract.RequiresArgumentNotNull <ISessionChannel>(channel, "channel"); eventProcessorContext.Router.AddChannel(channel); } }
public bool IsValid(ISessionChannel channelToValidate) { CodeContract.RequiresArgumentNotNull <ISessionChannel>(channelToValidate, "channelToValidate"); if ((channelToValidate.Properties & ChannelProperties.InternalOnly) != ChannelProperties.InternalOnly) { return(true); } return(userInformationProvider.IsUserMicrosoftInternal); }
/// <summary> /// Check whether channel is valid to be added to active channel list /// </summary> /// <param name="channelToValidate"></param> /// <returns></returns> public bool IsValid(ISessionChannel channelToValidate) { CodeContract.RequiresArgumentNotNull <ISessionChannel>(channelToValidate, "channelToValidate"); ChannelInternalSetting channelSettings = internalSettings.GetChannelSettings(channelToValidate.ChannelId); if (channelSettings == ChannelInternalSetting.ExplicitlyEnabled) { channelToValidate.Properties |= ChannelProperties.Default; } return(channelSettings != ChannelInternalSetting.ExplicitlyDisabled); }
private bool IsValidChannel(ISessionChannel sessionChannel) { foreach (IChannelValidator channelValidator in channelValidators) { if (!channelValidator.IsValid(sessionChannel)) { return(false); } } return(true); }
public bool Run(ISessionChannel pChannel, string pOrigIPAddress, string pAccessNumber, string pANI) { ISessionScript _sessionScript = create(pChannel, pOrigIPAddress, pAccessNumber, pANI); if (_sessionScript == null) { return(false); } _sessionScript.Run(true); return(true); }
//------------------------------------------------ Private -------------------------------------------------- ISessionScript create(ISessionChannel pChannel, string pOrigIPAddress, string pAccessNumber, string pANI) { ISessionScript _sessionScript; try { ISession _session = new Session(pChannel, pOrigIPAddress, pAccessNumber, pANI); Thread.SetData(Thread.GetNamedDataSlot(Thread.CurrentThread.Name), _session.Id); ScriptInfo _scriptInfo; RbrResult _rc = rbr.InitRetailSession(_session, out _scriptInfo); if (_scriptInfo == null) { return(null); } switch (_scriptInfo.ScriptType) { case ScriptType.PhoneCard: { _scriptInfo.PinLength += 1; //NOTE: this is so that we pickup '#' terminator too, since standard prompt directs user to pres '#' after the PinNumber _sessionScript = new PhoneCardCallScript(_rc, _session, _scriptInfo); break; } case ScriptType.Residential: { _sessionScript = new ResidentialCallScript(_rc, _session, _scriptInfo); break; } case ScriptType.LD: { _sessionScript = new LDCallScript(_rc, _session, _scriptInfo); break; } case ScriptType.LadyGuadalupe: { _scriptInfo.PinLength += 1; //NOTE: this is so that we pickup '#' terminator too, since standard prompt directs user to pres '#' after the PinNumber _sessionScript = new LadyGuadalupeCallScript(_rc, _session, _scriptInfo); break; } default: { T.LogRbr(LogSeverity.Critical, "SessionScript.create", string.Format("Error: Unknown RetailType {0}", _scriptInfo)); return(null); } } } catch (Exception _ex) { T.LogRbr(LogSeverity.Critical, "SessionScriptFactory.create", string.Format("CallFlowFactory.Create, Exception:\r\n{0}", _ex)); return(null); } return(_sessionScript); }
public ChannelListener(IIVRPlugin pIVR, int pModuleNumber, int pChannelNumber, ISessionDispatcher pSessionDispatcher) { ivr = pIVR; moduleNumber = pModuleNumber; channelNumber = pChannelNumber; sessionDispatcher = pSessionDispatcher; channel = ivr.CreateChannel(moduleNumber, channelNumber); thread = new Thread(channelListener, Convert.ToInt32(Configuration.Instance.IVR.ThreadStackSize)); thread.Name = string.Format("Channel_{0}{1}", moduleNumber, channelNumber); thread.Start(); }
/// <summary> /// Add new session channel to the list of active channels. /// </summary> /// <param name="sessionChannel"></param> public void AddSessionChannel(ISessionChannel sessionChannel) { RequiresNotDisposed(); CodeContract.RequiresArgumentNotNull <ISessionChannel>(sessionChannel, "sessionChannel"); if (IsValidChannel(sessionChannel)) { EventProcessor.AddChannel(sessionChannel); if ((sessionChannel.Properties & ChannelProperties.Default) == ChannelProperties.Default) { defaultSessionChannelsId.Add(sessionChannel.ChannelId); } } }
//------------------------------------------------ Private -------------------------------------------------- ISessionScript create(ISessionChannel pChannel, string pOrigIPAddress, string pAccessNumber, string pANI) { ISessionScript _sessionScript; try { ISession _session = new Session(pChannel, pOrigIPAddress, pAccessNumber, pANI); ScriptInfo _scriptInfo = new ScriptInfo(); _sessionScript = new TestCallScript(RbrResult.Success, _session, _scriptInfo); } catch (Exception _ex) { T.LogRbr(LogSeverity.Critical, "SessionScriptFactory.create", string.Format("CallFlowFactory.Create, Exception:\r\n{0}", _ex)); return(null); } return(_sessionScript); }
public Form1() { InputDialog d = new InputDialog("Connection details", "Which server:port ?", "localhost:9999"); if (d.ShowDialog() != DialogResult.OK) { throw new InvalidOperationException(); } string[] parts = d.Input.Split(':'); string host = parts[0]; string port = parts.Length > 1 ? parts[1] : "9999"; client = new Client(); client.ConnexionRemoved += client_ConnexionRemoved; client.Start(); chats = client.OpenStringChannel(host, port, ChatMessagesChannelId, ChannelDeliveryRequirements.ChatLike); updates = client.OpenSessionChannel(host, port, SessionUpdatesChannelId, ChannelDeliveryRequirements.SessionLike); InitializeComponent(); this.Disposed += Form1_Disposed; }
public Session(ISessionChannel pSessionChannel) { //State = SessionState.Leg1; Channel = pSessionChannel; CallId = pSessionChannel.CallId; OrigIPAddress = pSessionChannel.OrigIPAddress; parseAccessNumber(pSessionChannel.AccessNumber); getInfoDigits(); if (InfoDigits > 0) { AccessNumber = AccessNumber.Substring(0, 10); } ANI = pSessionChannel.ANI; Id = Guid.NewGuid().ToString("N"); }
public bool Run(ISessionChannel pChannel) { try { session = new Session(pChannel); script = (new ScriptFactory()).Create(session); if (script == null) { TimokLogger.Instance.LogRbr(LogSeverity.Error, "ScriptFactory.Run, Error: ScriptInfo == null"); return(false); } var _script = createScript(); return(_script.Run()); } catch (Exception _ex) { TimokLogger.Instance.LogRbr(LogSeverity.Critical, "SessionDispatcher.create", string.Format("SessionDispatcher.Run, Exception:\r\n{0}", _ex)); } return(false); }
public bool Run(ISessionChannel pChannel, string pOrigIPAddress, string pAccessNumber, string pANI) { ISessionScript _sessionScript = create(pChannel, pOrigIPAddress, pAccessNumber, pANI); if (_sessionScript == null) { return(false); } if (_sessionScript.Welcome()) { for (int _i = 1; _i <= _sessionScript.NumberOfSubSessions; _i++) { if (!_sessionScript.Authenticate(_i)) { return(false); } _sessionScript.Run(_i == _sessionScript.NumberOfSubSessions); } } return(true); }
/// <summary> /// Process an update about my fellows /// </summary> /// <param name="channel"></param> private void updates_SessionMessagesReceived(ISessionChannel channel) { SessionMessage m; while ((m = channel.DequeueMessage(0)) != null) { // Console.WriteLine("Session: " + m); if (m.Action == SessionAction.Left) { // telepointers.Remove(m.ClientId); // Redraw(); } } }
private void Form1_Load(object sender, EventArgs e) { InputDialog d = new InputDialog("Connection details", "Which server:port ?", "localhost:9999"); if (d.ShowDialog() != DialogResult.OK) { throw new InvalidOperationException(); } string[] parts = d.Input.Split(':'); string host = parts[0]; string port = parts.Length > 1 ? parts[1] : "9999"; // Aqui vou colocar a chamada para o cliente GT! // cGT = new ClienteGT(host, port); // Set up GT client = new Client(new DefaultClientConfiguration()); client.ErrorEvent += es => Console.WriteLine(es); // Evento do client client.ConnexionRemoved += client_ConnexionRemoved; client.Start(); // Evento do client client.MessageSent += new MessageHandler(this.MensagemEnviada); updates = client.OpenSessionChannel(host, port, SessionUpdatesChannelId, ChannelDeliveryRequirements.SessionLike); // Evento do updates updates.MessagesReceived += updates_SessionMessagesReceived; // coords armazena os dados recebidos (é a tupla) // coords = client.OpenStreamedTuple<int, int>(host, port, TelepointersChannelId, // TimeSpan.FromMilliseconds(50), // ChannelDeliveryRequirements.AwarenessLike); coords = client.OpenStreamedTuple<int, int>(host, port, TelepointersChannelId, TimeSpan.FromMilliseconds(50), ChannelDeliveryRequirements.AwarenessLike); // Evento do coords coords.StreamedTupleReceived += coords_StreamedTupleReceived; // coords.Identity // Utilizar o OpenObjectChannel para enviar um objeto ao invés de enviar uma tupla // objts = client.OpenObjectChannel(host, port, ObjectChannelId, ChannelDeliveryRequirements.AwarenessLike); objts = client.OpenObjectChannel(host, port, ObjectChannelId, ChannelDeliveryRequirements.CommandsLike); objts.MessagesReceived += new Action<IObjectChannel>(objts_MessagesReceived); }
private void updates_SessionMessagesReceived(ISessionChannel channel) { SessionMessage m; while ((m = channel.DequeueMessage(0)) != null) { Console.WriteLine("Session: " + m); if (m.Action == SessionAction.Lives) { // we get this message if other clients are already on the // server, meaning we should be player 2 playerID = 1; } } }
void Form1_Load(object sender, EventArgs e) { if (Program.kinectEnabled) kinectClient.RecalculateTable(); // Set up GT var config = new DefaultClientConfiguration(); client = new GT.Net.Client(config); client.ErrorEvent += delegate(ErrorSummary es) { Console.WriteLine(es); if (es.Context is GT.Net.CannotConnectException) { Cursor.Show(); MessageBox.Show(this, "Could not connect to server. Make sure the ClientRepeater is started."); quitting = true; } }; client.ConnexionRemoved += client_ConnexionRemoved; client.Start(); updates = client.OpenSessionChannel(host, port, SessionUpdatesChannelId, ChannelDeliveryRequirements.SessionLike); updates.MessagesReceived += updates_SessionMessagesReceived; coords = client.OpenStreamedTuple<int, int>(host, port, PointersChannelId, TimeSpan.FromMilliseconds(25), ChannelDeliveryRequirements.AwarenessLike); coords.StreamedTupleReceived += coords_StreamedTupleReceived; control = client.OpenStringChannel(host, port, ControlChannelId, ChannelDeliveryRequirements.CommandsLike); control.MessagesReceived += control_MessagesReceived; clicks = client.OpenStringChannel(host, port, ClickChannelId, ChannelDeliveryRequirements.CommandsLike); clicks.MessagesReceived += clicks_MessagesReceived; armImages = client.OpenObjectChannel(host, port, ArmImageChannelId, ChannelDeliveryRequirements.AwarenessLike); armImages.MessagesReceived += armImages_MessagesReceived; origins = client.OpenStreamedTuple<int, int>(host, port, OriginsChannelId, TimeSpan.FromMilliseconds(25), ChannelDeliveryRequirements.AwarenessLike); origins.StreamedTupleReceived += origins_StreamedTupleReceived; showArms = client.OpenStreamedTuple<bool>(host, port, ShowArmsChannelId, TimeSpan.FromMilliseconds(25), ChannelDeliveryRequirements.AwarenessLike); showArms.StreamedTupleReceived += showArms_StreamedTupleReceived; kinectCalibrationChannel = client.OpenObjectChannel(host, port, KinectCalibrationChannelId, ChannelDeliveryRequirements.CommandsLike); kinectCalibrationChannel.MessagesReceived += kinectCalibrationChannel_MessagesReceived; boxGrabChannel = client.OpenObjectChannel(host, port, BoxGrabChannelId, ChannelDeliveryRequirements.CommandsLike); boxGrabChannel.MessagesReceived += boxGrabChannel_MessagesReceived; if (Program.useTouch) { tuioClient = new TuioClient(); tuioClient.addTuioListener(this); tuioClient.connect(); } }
private void Form1_Load(object sender, EventArgs e) { InputDialog d = new InputDialog("Connection details", "Which server:port ?", "localhost:9999"); if (d.ShowDialog() != DialogResult.OK) { throw new InvalidOperationException(); } string[] parts = d.Input.Split(':'); string host = parts[0]; string port = parts.Length > 1 ? parts[1] : "9999"; // Set up GT client = new Client(new DefaultClientConfiguration()); client.ErrorEvent += es => Console.WriteLine(es); client.ConnexionRemoved += client_ConnexionRemoved; client.Start(); updates = client.OpenSessionChannel(host, port, SessionUpdatesChannelId, ChannelDeliveryRequirements.SessionLike); updates.MessagesReceived += updates_SessionMessagesReceived; coords = client.OpenStreamedTuple<int, int>(host, port, TelepointersChannelId, TimeSpan.FromMilliseconds(50), ChannelDeliveryRequirements.AwarenessLike); coords.StreamedTupleReceived += coords_StreamedTupleReceived; }
/// <summary> /// Add session channel /// </summary> /// <param name="channel"></param> public void AddChannel(ISessionChannel channel) { CodeContract.RequiresArgumentNotNull <ISessionChannel>(channel, "channel"); channelList.Add(channel); OnUpdateChannelList(); }
/// <summary> /// Check whether channel is valid to be added to active channel list /// </summary> /// <param name="channelToValidate"></param> /// <returns></returns> public bool IsValid(ISessionChannel channelToValidate) { return(!internalSettings.IsTelemetryDisabledCompletely()); }