How to asdd call attrs. after the call droped just like mark done button?

176 views Asked by At

I am able to add call attrs using 'Genesyslab.Platform.Voice.Protocols.TServer.Requests.Userdata.RequestAttachUserData' when the call is online but how to do when the call is dropped?

I found this in WDE

void SelectDispositionCodeSetAttachedData(string dispositionCodeValueName);
    //
    // Summary:
    //     Update or add the keys of the specificed KeyValueCollection in the attached data
    //     of the interaction . The current list of attached data can then be retrieved
    //     using GetAttachedData. If the interaction media type is 'voice' or 'instant message'
    //     and the interaction is not released the added/updated values are immediately
    //     committed to T/SIP Server. If the interaction media type is 'voice' or 'instant
    //     message' and the interaction is released the added/updated values are sent to
    //     T/SIP Server as a UserEvent when the interaction is marked done (programmatic?aly
    //     or by Agent). If it is an eServices interaction (e-mail, chat, etc.) and the
    //     interaction is still handled by the agent the added/updated values are immediately
    //     committed to Interaction Server. After e-Services interaction is released, no
    //     further programmatical update is committed to Interaction Server. For all interaction
    //     types any attached data programmatical update applied after interaction release
    //     is not reflected in UI controls such as 'Case information'.

This is my code:

Genesyslab.Platform.Commons.Collections.KeyValueCollection keyValueCollectionUpDate = new Genesyslab.Platform.Commons.Collections.KeyValueCollection();
                keyValueCollectionUpDate.Add("Business Result", "Platform: Business Result");
                keyValueCollectionUpDate.Add("StrAttribute1", "AttachedData.Business Result"); RequestAttachUserData requestAttachUserData= RequestAttachUserData.Create("7012", GetConnectionID(ExtractedArtributes[1][0].Value.ToString()), keyValueCollectionUpDate); IMessage respondingEvent2=tserverProtocol.Request(requestAttachUserData);

Need to add call attts after the call is dropped

3

There are 3 answers

0
hynsey On

The way to attach data to voice calls after disconnect, is to send a UserEvent. This does require the AfterCallWork state to be enabled in your environment. You have already mentioned understanding how to insert Commands into the Command Chain. This example Execute function of a command can be inserted into the "BundleClose" Command Chain, prior to the "Close" Command.

This sample is in VB, apologies, but I guess you can easily convert to c#.

Public Function Execute(ByVal parameters As IDictionary(Of String, Object), ByVal progress As IProgressUpdater) As Boolean Implements IElementOfCommand.Execute
    ' To go to the main thread
    If Application.Current.Dispatcher IsNot Nothing AndAlso Not Application.Current.Dispatcher.CheckAccess() Then
        Dim result As Object = Application.Current.Dispatcher.Invoke(DispatcherPriority.Send, New ExecuteDelegate(AddressOf Execute), parameters, progress)
        Return CBool(result)
    Else

        Dim interactionsBundle As IInteractionsBundle = Nothing
        Dim interaction As IInteraction = Nothing
        interactionsBundle = parameters("CommandParameter")
        interaction = interactionsBundle.MainInteraction

        Dim channel As Enterprise.Model.Channel.IClientChannel = interaction.EntrepriseInteractionCurrent.ActiveChannel 'agent.Channel
        Dim protocol As IProtocol = channel.Protocol

        Dim kvp As Platform.Commons.Collections.KeyValueCollection = New Platform.Commons.Collections.KeyValueCollection()
        kvp.Add("keyname", "keyvalue")

        Dim userevent As Platform.Voice.Protocols.TServer.CommonProperties = Platform.Voice.Protocols.TServer.CommonProperties.Create()
        userevent.UserData = kvp

        Dim connID As Platform.Voice.Protocols.ConnectionId = Nothing

        Dim interactionVoice as IInteractionVoice = TryCast(interaction, IInteractionVoice)

        If interactionVoice IsNot Nothing Then
            userevent.UserEvent = Platform.Voice.Protocols.TServer.Events.EventUserEvent.MessageId
            connID = New Platform.Voice.Protocols.ConnectionId(interactionVoice.TConnectionId)
            
            Dim strDN As String = Nothing
            'ensure the correct DN is passed when attaching reason codes, in case agent is logged into multiple DNs
            Dim devices() As Enterprise.Model.Device.IDevice = interactionVoice.Device
            Dim device As Enterprise.Core.DN = devices(0)
            strDN = device.Name
            userevent.ThisDN = strDN
            userevent.ConnID = connID

            Dim req = Platform.Voice.Protocols.TServer.Requests.Special.RequestSendEvent.Create()
            req.UserEvent = userevent

            'send request
            protocol.Send(req)  

        End If
    End If
    
End Function
0
Jirayu Kaewprateep On

I do a workaround by using WDE itself to attach data when agent clicks 'mark done' in WDE custom command.

1
Wasakorn Pakdeesan On

You can't update attached data when the call is dropped.