Genesys CTI User Forum > Genesys-related Development

Update callresult on outbound campaign using PSDK

<< < (3/5) > >>

PeteHoyle:
There are various ways to do this.

The basic way is to send a UserEvent from the Agents DN.

To send a UserEvent have a look at the RequestSendEvent request.

Platform SDK 8.5 API Reference
RequestSendEvent Class

Namespaces ► Genesyslab.Platform.Voice.Protocols.TServer.Requests.Special ► RequestSendEvent

In the UserEvent need to add the required fields to the UserData for either a  UpdateCallCompletionStats or a RecordProcessed request (see the Outbound Contact Reference Manual)..


For example a RecordProcessed request would be something like:

        private void btnRecordProcess_Click(object sender, EventArgs e)
        {
            KeyValueCollection kvp = new KeyValueCollection();
            kvp.Add("GSW_AGENT_REQ_TYPE", "RecordProcessed");
            kvp.Add("GSW_CALL_RESULT", 9);//AnswerMachine Detected
            gc.ProcessRecord(prot_name, dn, kvp);
        }


        internal void ProcessRecord(string prot_name, string dn, KeyValueCollection kvp)
        {
            DNState state = DNStateHolder.Instance.getDNState(dn);
            if(state ==null)
                return;

            Dictionary<String, CallState> calls = state.Calls;
            foreach(String key in calls.Keys)
            {
                CallState call = calls[key];
                KeyValueCollection call_data = call.UserData;
                if (call_data.ContainsKey("GSW_RECORD_HANDLE"))
                {
                    kvp.Add("GSW_RECORD_HANDLE", call_data.GetAsInt("GSW_RECORD_HANDLE"));
                }

                if (call_data.ContainsKey("GSW_APPLICATION_ID"))
                {
                    kvp.Add("GSW_APPLICATION_ID", call_data.GetAsInt("GSW_APPLICATION_ID"));
                }

                if (call_data.ContainsKey("GSW_CALLING_LIST"))
                {
                    kvp.Add("GSW_CALLING_LIST", call_data.GetAsString("GSW_CALLING_LIST"));
                }

                if (call_data.ContainsKey("GSW_CAMPAIGN_NAME"))
                {
                    kvp.Add("GSW_CAMPAIGN_NAME", call_data.GetAsString("GSW_CAMPAIGN_NAME"));
                }

                if (call_data.ContainsKey("GSW_CAMPAIGN_NAME"))
                {
                    kvp.Add("GSW_CAMPAIGN_NAME", call_data.GetAsString("GSW_CAMPAIGN_NAME"));
                }
            }

            SendUserEvent(prot_name, dn, kvp);
        }

        internal void SendUserEvent(string prot_name, string dn, KeyValueCollection kvp)
        {
            RequestSendEvent req = RequestSendEvent.Create();   
            CommonProperties comm = CommonProperties.Create();
            comm.ThisDN = dn;
            comm.UserData = kvp;
            comm.UserEvent = EventUserEvent.MessageId;
            req.UserEvent = comm;
            sendRequest(prot_name, req);
        }

cavagnaro:
And what are the other ways? Using http commands to OCS?

luchosrock:
It worked like a charm Pete, thanks a lot!

Another question... When the call is finished (one of the parties hang up the phone), the record is marked as updated and I wouldn't be able to change it. Is it possible to reinject the record in AfterCallWork? If so, can I retrieve all the contact records related with the chain_id or recordhandle during the call in order to use them in AfterCallWork?

I'm just checkin' if it can be done, but the snippet you posted helped a lot and may be enough!

Thanks.

PeteHoyle:
Have a look at the OCS option below.

If the Agent goes into Ready at the end of a call the OCS will assume that record is finished with, so if you set this option to not let the Agent go into Ready that should mean you can still update the record.

outbound_release_action
Type: Optional
Default Value: soft_previous
Valid Value(s): hard_ready, hard_not_ready, soft_previous, hard_acw
Changes Take Effect: Immediately
Determines the agent’s place state after an outbound call is released.
• When set to hard_ready, OCS sends a request to T-Server to force the
teleset to the Ready state.
• When set to hard_not_ready, OCS sends a request to T-Server to force the
teleset to the Not Ready state.
• When set to soft_previous, OCS uses the Agent State provided by Stat
Server.
• When set to hard_acw, OCS sends a request to T-Server to force the teleset
to the After Call Work state after an outbound call is released from an
agent’s DN.

PeteHoyle:
[quote author=cavagnaro link=topic=9421.msg42706#msg42706 date=1458130600]
And what are the other ways? Using http commands to OCS?
[/quote]

Hi,

Yes as you say using http commands to OCS is one way.

The other way I was thinking was using the OutboundDesktop PSDK API, in the background it's the same in that it sends a UserEvent, just a slightly different API. I've never used this method though, always just create my own UserEvents..

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version