WDE ConnID

Hi
???
How i can get ConnID from a WDE Extension?

If you cast your interaction to an InteractionVoice you can get the ConnId

 if (interaction is IInteractionVoice)
{
       IInteractionVoice iiv = interaction as IInteractionVoice;
       string connId = interaction.TConnectionId;

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?)

Well, obvious message, you need to add a reference to that DLL module…

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, EventArgs1 e) en System.EventHandler1.Invoke(Object sender, TEventArgs e)

You would need a reference to ‘Genesyslab.Desktop.Modules.Voice’

And then:

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

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 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?

Thanks Daniel san

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