Author Topic: Create a Transfer button in IWS Customization  (Read 7366 times)

Offline David Alvarez

  • Newbie
  • *
  • Posts: 17
  • Karma: -1
Create a Transfer button in IWS Customization
« on: March 10, 2015, 08:34:51 PM »
Is it possible to create a button on " InteractionVoiceCustomButtonRegion " to make a transfer directly to a routing point ?

Now I have the button created , but I can not find a way to make the transfer

Offline abudwill

  • Full Member
  • ***
  • Posts: 157
  • Karma: 4
Re: Create a Transfer button in IWS Customization
« Reply #1 on: March 11, 2015, 10:23:03 AM »
Hi David,

What version of IWS?

My suggestion is to utilize existing command chains.  See documentation at http://docs.genesys.com/Documentation/IW/latest/Developer/Voice

You might want to consider the InteractionVoiceSingleStepTransfer command chain.

Documentation at http://docs.genesys.com/Documentation/IW/latest/Developer/UseCustomizableCommands should help you understand how to execute commands in your buttons click event.

Regards,
Andrew

Offline daniel_san

  • Jr. Member
  • **
  • Posts: 84
  • Karma: 1
Re: Create a Transfer button in IWS Customization
« Reply #2 on: March 18, 2015, 04:17:43 PM »
[quote author=David Alvarez link=topic=8749.msg38847#msg38847 date=1426019691]
Is it possible to create a button on " InteractionVoiceCustomButtonRegion " to make a transfer directly to a routing point ?

Now I have the button created , but I can not find a way to make the transfer
[/quote]

You can do it on two ways.

[b]Using Commands Chain: [/b]

IDictionary<string, object> parameters = new Dictionary<string, object>();
parameters.Add("CommandParameter", Interaction); [b](Interaction to transfer, You can  retrieve it from InteractionManager)[/b]
parameters.Add("Destination", destiny); [b](Routing Point o place of destination)[/b]
parameters.Add("Location", null);
parameters.Add("UserData", new KeyValueCollection());
parameters.Add("Reasons", null);
parameters.Add("Extensions", null);
parameters.Add("SingleStepUserData", null);
container.Resolve<ICommandManager>().GetChainOfCommandByName("InteractionVoiceSingleStepTransfer").Execute(parameters);

[b]Another way. Working directly with Plattform: [/b]

Platform.Voice.Protocols.ConnectionId conid = new Platform.Voice.Protocols.ConnectionId(TConnectionID);
string[] place = _agent.LoginDNs[0].Split('@'); [b](Origin PLace, your place)[/b]
Genesyslab.Platform.Commons.Collections.KeyValueCollection kvc =new Genesyslab.Platform.Commons.Collections.KeyValueCollection();
kvc.Add("COMMENT", "TryTo");
RequestSingleStepTransfer rsst = RequestSingleStepTransfer.Create(place[0].ToString(), conid, destiny,"",kvc,kvc,kvc); [b](destiny)[/b]
createChannel(_agent);         
channel.Protocol.Send(rsst);
destroyChannel(channel);

Regards.
« Last Edit: March 18, 2015, 10:39:31 PM by daniel_san »

Offline David Alvarez

  • Newbie
  • *
  • Posts: 17
  • Karma: -1
Re: Create a Transfer button in IWS Customization
« Reply #3 on: March 19, 2015, 03:33:00 PM »
Thak you Daniel_San, i could make.
Regards.

Offline falegria

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Re: Create a Transfer button in IWS Customization
« Reply #4 on: September 20, 2016, 04:22:11 PM »
Hi Daniel and David,

    I have a question about, how do you implement this solution.... finally, you use a button click event for make a SingleStepTransfer? If the answer is "yes", I would appreciate explaining how made it.
In summary, I need to know how execute commands in a button click event.

Thank you.

Best Regards.

p.d: Sorry my poor english  ::)

Offline jvallejos

  • Newbie
  • *
  • Posts: 10
  • Karma: 0
Re: Create a Transfer button in IWS Customization
« Reply #5 on: November 08, 2016, 02:52:49 AM »
Hello,
I used your code in my botton of my form

using Genesyslab.Desktop.Infrastructure;
using Genesyslab.Desktop.Infrastructure.Commands;
using Genesyslab.Desktop.Infrastructure.Configuration;
using Genesyslab.Desktop.Infrastructure.DependencyInjection;
using Genesyslab.Desktop.Infrastructure.ViewManager;
using Genesyslab.Desktop.Modules.Core.Model.Agents;
using Genesyslab.Desktop.Modules.Core.Model.Interactions;
using Genesyslab.Desktop.Modules.Windows.Event;
using Genesyslab.Desktop.Modules.Windows.IWMessageBox;
using Genesyslab.Enterprise.Commons.Collections;
using Genesyslab.Platform.Commons.Logging;
using Genesyslab.Platform.Voice.Protocols.TServer.Events;
using Microsoft.Practices.Composite.Events;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Windows;
using Genesyslab.Desktop.Modules.Voice.Model.Interactions;
using System.Windows.Threading;
using System.IO;


        private void btn_ITransferencia_Click(object sender, RoutedEventArgs e)
        {
            IDictionary<string, object> parameters = new Dictionary<string, object>();
            //parameters.Add("CommandParameter", IInteraction);
            IInteractionVoice interactionVoice = parameters["CommandParameter"] as IInteractionVoice;
            parameters.Add("CommandParameter", interactionVoice);
            parameters.Add("Destination", "31001000");
            parameters.Add("Location", "");
            parameters.Add("UserData", new KeyValueCollection());
            parameters.Add("Reasons", new KeyValueCollection());
            parameters.Add("Extensions", new KeyValueCollection());
            parameters.Add("CorrelatorData", "");
 
            container.Resolve<ICommandManager>().GetChainOfCommandByName("InteractionVoiceSingleStepTransfer").Execute(parameters);
        }

but the call not transfer and show me this error in the log of  WDE

16-11-07 23:41:56.488 [            1] ERROR .BootstrapController - Application.DispatcherUnhandledException
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
  at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
  at Genesyslab.Desktop.Modules.InteractionExtensionSample.MySample.MySampleView.btn_ITransferencia_Click(Object sender, RoutedEventArgs e)
  at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
  at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
  at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
  at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
  at System.Windows.Controls.Primitives.ButtonBase.OnClick()
  at System.Windows.Controls.Button.OnClick()
  at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
  at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
  at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
  at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
  at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
  at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
  at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
  at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
  at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
  at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
  at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
  at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
  at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
  at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
  at System.Windows.Input.InputManager.ProcessStagingArea()
  at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
  at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
  at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
  at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
  at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
  at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
  at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
  at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
  at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

Please, what am I doing wrong? My WDE is version 8.5.110.16

Best regards

Offline PeteHoyle

  • Full Member
  • ***
  • Posts: 126
  • Karma: 13
Re: Create a Transfer button in IWS Customization
« Reply #6 on: November 08, 2016, 08:39:54 AM »
The problem is that you create a Dictionary called parameters:

IDictionary<string, object> parameters = new Dictionary<string, object>();

And then without adding anything to the Dictionary you try and get an IInteractionVoice object with a key name of 'CommandParameter' from the Dictionary

IInteractionVoice interactionVoice = parameters["CommandParameter"] as IInteractionVoice;

And so you get an error that they key name does not exist.

You need to find another way to get the IInteractionVoice that you want to transfer.

Offline daniel_san

  • Jr. Member
  • **
  • Posts: 84
  • Karma: 1
Re: Create a Transfer button in IWS Customization
« Reply #7 on: November 08, 2016, 01:52:59 PM »
[quote author=PeteHoyle link=topic=8749.msg45115#msg45115 date=1478594394]
The problem is that you create a Dictionary called parameters:

IDictionary<string, object> parameters = new Dictionary<string, object>();

And then without adding anything to the Dictionary you try and get an IInteractionVoice object with a key name of 'CommandParameter' from the Dictionary

IInteractionVoice interactionVoice = parameters["CommandParameter"] as IInteractionVoice;

And so you get an error that they key name does not exist.

You need to find another way to get the IInteractionVoice that you want to transfer.
[/quote]

PeteHoyle explained you very well.

So, you have to get the IInteracionVoice. Try with InteractionManager...

container.Resolve<IInteractionManager>();

Regards.

Offline jvallejos

  • Newbie
  • *
  • Posts: 10
  • Karma: 0
Re: Create a Transfer button in IWS Customization
« Reply #8 on: November 08, 2016, 03:59:11 PM »
Hello PeteHoyle and daniel_san,
Please. Your  have other code to the transfer ?
Me Can sharing you please.
I used container.Resolve<IInteractionManager>(); but not know how I use this interface.

Best regards

Offline daniel_san

  • Jr. Member
  • **
  • Posts: 84
  • Karma: 1
Re: Create a Transfer button in IWS Customization
« Reply #9 on: November 10, 2016, 08:18:44 AM »
[quote author=jvallejos link=topic=8749.msg45132#msg45132 date=1478620751]
Hello PeteHoyle and daniel_san,
Please. Your  have other code to the transfer ?
Me Can sharing you please.
I used container.Resolve<IInteractionManager>(); but not know how I use this interface.

Best regards
[/quote]

To use the container you have to resolve  it on the contructor of the class.

You can see it on the documentation and examples.

Offline PeteHoyle

  • Full Member
  • ***
  • Posts: 126
  • Karma: 13
Re: Create a Transfer button in IWS Customization
« Reply #10 on: November 10, 2016, 10:32:09 AM »
[quote author=jvallejos link=topic=8749.msg45132#msg45132 date=1478620751]
Hello PeteHoyle and daniel_san,
Please. Your  have other code to the transfer ?
Me Can sharing you please.
I used container.Resolve<IInteractionManager>(); but not know how I use this interface.

Best regards
[/quote]

It depends where your custom button is located, if it is in the IntearctionView area you can get the IInteractionVoice from the Context:

[code]
        public void Create()
        {
            IDictionary<string, object> contextDictionary = Context as IDictionary<string, object>;
            object caseObject;
            contextDictionary.TryGetValue("Case", out caseObject);
            ICase @case = caseObject as ICase;
            if (@case != null)
            {
                if (@case.MainInteraction is IInteractionVoice)
                {
                    IInteractionVoice iv = @case.MainInteraction as IInteractionVoice;
                    if (iv != null)
                    {
                    }
                }
            }
        }
[/code]