Author Topic: WDE ConnID  (Read 4150 times)

Offline jvallejos

  • Newbie
  • *
  • Posts: 10
  • Karma: 0
WDE ConnID
« on: November 22, 2016, 12:48:37 PM »
Hi
???
How i can get ConnID from a WDE Extension?

Offline PeteHoyle

  • Full Member
  • ***
  • Posts: 126
  • Karma: 13
Re: WDE ConnID
« Reply #1 on: November 22, 2016, 01:55:57 PM »
If you cast your interaction to an InteractionVoice you can get the ConnId

[code] if (interaction is IInteractionVoice)
{
      IInteractionVoice iiv = interaction as IInteractionVoice;
      string connId = interaction.TConnectionId;[/code]

Offline jvallejos

  • Newbie
  • *
  • Posts: 10
  • Karma: 0
Re: WDE ConnID
« Reply #2 on: November 22, 2016, 02:06:24 PM »
Thanks PeteHoyle ,

but dont work form mi

Error 4 'Genesyslab.Desktop.Modules.Core.Model.Interactions.IInteraction' no contiene una definición de 'TConnectionId'(NotFound) ni se encontró ningún método de extensión 'TConnectionId' que acepte un primer argumento de tipo 'Genesyslab.Desktop.Modules.Core.Model.Interactions.IInteraction' (¿falta una directiva de uso o una referencia de ensamblado?)

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: WDE ConnID
« Reply #3 on: November 22, 2016, 02:19:29 PM »
Well, obvious message, you need to add a reference to that DLL module...

Offline jvallejos

  • Newbie
  • *
  • Posts: 10
  • Karma: 0
Re: WDE ConnID
« Reply #4 on: November 22, 2016, 02:48:34 PM »
i have the reference for Genesyslab.Desktop.Modules.Core.Model.Interactions.IInteraction but TConnectionId is the problem

Later i fix do this

        public void Initialize()
        {
            //aca se crea el listener para poder detectar las interaccions al momento de ejecurse
            interactionManager.InteractionEvent += new EventHandler<EventArgs<IInteraction>>(interactionManager_InteractionEvent);
        }     

    void interactionManager_InteractionEvent(object sender, EventArgs<IInteraction> e)
        {
            IInteraction interaction = e.Value;
         
            switch (interaction.EntrepriseLastInteractionEvent.Id)
            {
                   
             
                  case EventEstablished.MessageId:

                    if (interaction is IInteractionVoice)
                    {
                        IInteractionVoice iiv = e as IInteractionVoice;
                        //i try next to sentences
                        MessageBox.Show("El ConnId es:" +iiv.TConnectionId);
                      // MessageBox.Show("El ConnId es:" +iiv.TConnectionId.ToString());
                    }
             
     
                break;
            }
       
        }

But i found this Exception

Application.DispatcherUnhandledException
System.Reflection.TargetInvocationException: Se produjo una excepción en el destino de la invocación. ---> System.NullReferenceException: Referencia a objeto no establecida como instancia de un objeto.
  en Genesyslab.Desktop.Modules.Custom.CustomModule.interactionManager_InteractionEvent(Object sender, EventArgs`1 e)
  en System.EventHandler`1.Invoke(Object sender, TEventArgs e)
« Last Edit: November 22, 2016, 03:06:39 PM by jvallejos »

Offline PeteHoyle

  • Full Member
  • ***
  • Posts: 126
  • Karma: 13
Re: WDE ConnID
« Reply #5 on: November 22, 2016, 05:19:48 PM »
You would need a reference to 'Genesyslab.Desktop.Modules.Voice'

And then:

using Genesyslab.Desktop.Modules.Voice.Model.Interactions;


Offline daniel_san

  • Jr. Member
  • **
  • Posts: 84
  • Karma: 1
Re: WDE ConnID
« Reply #6 on: November 23, 2016, 03:35:01 PM »
During a voice call, the event interactionManager_InteractionEvent will be executed several times. Maybe sometimes the value is null, but on next event it´s not null.

You can try to do that:

void interactionManager_InteractionEvent(object sender, EventArgs<IInteraction> e)
{
      IInteraction interaction = e.Value;
      IInteractionVoice iv = interaction as IInteractionVoice;
            if(iv.TconnectionID!=null)
            //now you can work
}

I´m assuming, that you are working with Visual Studio, and not with another ide that not trigger some error before compilation.

Regards.

EDIT: what line are launching the error?

Offline jvallejos

  • Newbie
  • *
  • Posts: 10
  • Karma: 0
Re: WDE ConnID
« Reply #7 on: November 24, 2016, 04:49:19 PM »
Thanks Daniel san

With this line if(iv.TconnectionID!=null) work for me