public IAsyncResult BeginEstablish( string conversationId, Guid applicationId, productType productInfo, IEnumerable <skillType> skills, AsyncCallback userCallback, object state) { agentDashboardInitType agentdashboardinitdata = new agentDashboardInitType(); agentdashboardinitdata.product = productInfo; agentdashboardinitdata.skills = new List <skillType>(skills).ToArray(); string serializedInitData; XmlSerializer serializer = new XmlSerializer(agentdashboardinitdata.GetType()); using (TextWriter writer = new StringWriter()) { serializer.Serialize(writer, agentdashboardinitdata); serializedInitData = writer.ToString(); } Console.WriteLine(serializedInitData); ConversationContextChannelEstablishOptions options = new ConversationContextChannelEstablishOptions(); options.ContextualData = serializedInitData; options.Toast = "hi"; options.RemoteConversationId = conversationId; m_innerChannel.DataReceived += InnerChannel_DataReceived; return(m_innerChannel.BeginEstablish(applicationId, options, userCallback, state)); }
public static Task EstablishAsync(this ConversationContextChannel self, Guid applicationId, ConversationContextChannelEstablishOptions options) { return Task.Factory.FromAsync<Guid, ConversationContextChannelEstablishOptions>( self.BeginEstablish, self.EndEstablish, applicationId, options, null); }
public IAsyncResult BeginEstablish(Guid applicationId, AsyncCallback userCallback, object state) { ConversationContextChannelEstablishOptions options = new ConversationContextChannelEstablishOptions(); options.Toast = "hi"; m_innerChannel.DataReceived += InnerChannel_DataReceived; return(m_innerChannel.BeginEstablish(applicationId, options, userCallback, state)); }
private void InitConversationContext() { if (_localConvContextChannel != null && _localEndpoint != null) { _localConvContextChannel = new ConversationContextChannel(_conversation, _remoteEndpoint); ConversationContextChannelEstablishOptions options = new ConversationContextChannelEstablishOptions(); options.ApplicationName = _appName; options.RemoteConversationId = _conversation.Id; options.ContextualData = GetTranscriptMessageContextualData(); _localConvContextChannel.BeginEstablish(_appId, options, BeginContextEstablishCB, _localConvContextChannel); } if (_convContextChannel != null && _remoteEndpoint != null) { _convContextChannel = new ConversationContextChannel(_conversation, _remoteEndpoint); ConversationContextChannelEstablishOptions options = new ConversationContextChannelEstablishOptions(); options.ApplicationName = _appName; options.RemoteConversationId = _conversation.Id; options.ContextualData = GetTranscriptMessageContextualData(); _convContextChannel.BeginEstablish(_appId, options, BeginContextEstablishCB, _convContextChannel); } }
public static Task EstablishAsync(this ConversationContextChannel channel, Guid applicationId, ConversationContextChannelEstablishOptions options) { return(Task.Factory.FromAsync(channel.BeginEstablish, channel.EndEstablish, applicationId, options, null)); }
/// <summary> /// Handle incoming IM call from the customer. /// </summary> /// <param name="imCall">IM call.</param> public void HandleIncomingInstantMessagingCall(InstantMessagingCall imCall) { lock (syncRoot) { if (this.conversation == null) { this.conversation = imCall.Conversation; this.RegisterConversationEventHandlers(this.conversation); } if (this.conversationContextChannel == null && !String.IsNullOrEmpty(this.application.CweGuid)) { this.conversationContextChannel = new ConversationContextChannel(this.conversation, imCall.RemoteEndpoint); this.RegisterContextChannelHandlers(this.conversationContextChannel); } this.imIvr = new InstantMessagingIVR(this, imCall, this.conversationContextChannel, this.menu, this.logger); this.imIvr.isUserEndpointFirstMessage = true; try { imCall.BeginAccept((asyncResult) => { try { imCall.EndAccept(asyncResult); if (this.conversationContextChannel != null && this.conversationContextChannel.State == ConversationContextChannelState.Idle) { ConversationContextChannelEstablishOptions channelOptions = new ConversationContextChannelEstablishOptions(); channelOptions.ApplicationName = this.application.Name; channelOptions.ContextualData = "Context channel is open."; channelOptions.Toast = "Please check the accompaining CWE window for Graphical Experience"; Guid appGuid = new Guid(this.application.CweGuid); try { this.conversationContextChannel.BeginEstablish(appGuid, channelOptions, (contextChannelAsyncResult) => { try { this.conversationContextChannel.EndEstablish(contextChannelAsyncResult); } catch (RealTimeException rte) { Console.WriteLine("Error establishing conversation context channel {0}", rte); this.logger.Log("Error establishing conversation context channel {0}", rte); } }, null); } catch (InvalidOperationException ioe) { Console.WriteLine("Error establishing conversation context channel {0}", ioe); this.logger.Log("Error establishing conversation context channel {0}", ioe); } } } catch (RealTimeException rte) { Console.WriteLine("Error accepting incoming IM call {0}", rte); this.logger.Log("Error accepting incoming IM call {0}", rte); } }, null); } catch (InvalidOperationException ioe) { Console.WriteLine("Error accepting incoming IM call {0}", ioe); this.logger.Log("Error accepting incoming IM call {0}", ioe); } } }