Genesys CTI User Forum

Genesys CTI User Forum => Genesys-related Development => Topic started by: luchosrock on March 11, 2016, 04:06:37 PM

Title: Update callresult on outbound campaign using PSDK
Post by: luchosrock on March 11, 2016, 04:06:37 PM
I have a softphone solution made with PSDK 8.0. During an outbound campaign, how can I change the CallResult value of an established call? What type of request should I make?

Thanks in advance,

Regards
Title: Re: Update callresult on outbound campaign using PSDK
Post by: Kubig on March 11, 2016, 04:55:56 PM
Use the OCS HTTP API which offers you the operations on OCS records. Look into dep guide for more details.
Title: Re: Update callresult on outbound campaign using PSDK
Post by: luchosrock on March 11, 2016, 06:41:26 PM
Thanks Kubig for your quick reply,

So you say that I must do an HTTP request in order to update the callresult. But, is there a way I can achieve it by using the Platform SDK directly? I mean, I can see in the PSDK documentation that there are ScheduledCall and UpdateCallCompletionStats object types in the OutboundDesktop namespace that can be sent through protocolManagementService requests, I just can't quite get what call I should do  :(
Title: Re: Update callresult on outbound campaign using PSDK
Post by: cavagnaro on March 11, 2016, 07:07:18 PM
UpdateCallCompletitionStats with new call result
Title: Re: Update callresult on outbound campaign using PSDK
Post by: luchosrock on March 11, 2016, 07:45:38 PM
How do I add CallResult to an UpdateCallCompletionStats  object type? the class has only these properties:

- ApplicationId
- CampaignName
- OtherFields
- RecordHandle

Should I add a KVP Collection informing the CallResult on the OtherFields property? Sorry but I'm kind of lost here.... :/
Title: Re: Update callresult on outbound campaign using PSDK
Post by: cavagnaro on March 11, 2016, 08:20:32 PM
Yes
Check OCS guide for more details
Title: Re: Update callresult on outbound campaign using PSDK
Post by: luchosrock on March 15, 2016, 01:06:54 PM
Thanks Cav, I checked OCS guides, from which I now have this doubt:

Are OutboundDesktop requests made through TServer?
Title: Re: Update callresult on outbound campaign using PSDK
Post by: cavagnaro on March 15, 2016, 02:12:37 PM
Well, you send the request via monitored DN as a user event and then OCS receives it.
Title: Re: Update callresult on outbound campaign using PSDK
Post by: luchosrock on March 15, 2016, 02:44:44 PM
Thanks! I will try that way  ;D
Title: Re: Update callresult on outbound campaign using PSDK
Post by: luchosrock on March 15, 2016, 08:25:53 PM
Unfortunately, I couldn't find a way to make the appropiate request :(

I think I'm missing something important here, as I can't tell for sure trough which object/namespace I should make the request for update (I checked for TServer.Requests namespace and couldn't understand how to do it). There are threads related here, but pointing to a broken link.

Cavagnaro: I read about the Monitored DN, but I couldn't understand how the request is made (under what namespace).

Any help will be appreciated :/
Title: Re: Update callresult on outbound campaign using PSDK
Post by: PeteHoyle on March 16, 2016, 09:33:05 AM
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);
        }

Title: Re: Update callresult on outbound campaign using PSDK
Post by: cavagnaro on March 16, 2016, 12:16:40 PM
And what are the other ways? Using http commands to OCS?
Title: Re: Update callresult on outbound campaign using PSDK
Post by: luchosrock on March 16, 2016, 02:35:18 PM
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.

Title: Re: Update callresult on outbound campaign using PSDK
Post by: PeteHoyle on March 16, 2016, 03:45:52 PM
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.
Title: Re: Update callresult on outbound campaign using PSDK
Post by: PeteHoyle on March 16, 2016, 03:48:08 PM
[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..
Title: Re: Update callresult on outbound campaign using PSDK
Post by: PeteHoyle on March 17, 2016, 08:18:06 AM
[quote author=PeteHoyle link=topic=9421.msg42717#msg42717 date=1458143288]
[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..
[/quote]


Actually thinking about this more, I have some distant memory that some of the OCCS HTTP requests are specific to certain dialling modes and will only work with Power GVP and Progressive GVP modes. I think it is the RecordProcessed and UpdateCallCompletionStats requests that are only supported by these dialling modes.
Title: Re: Update callresult on outbound campaign using PSDK
Post by: cavagnaro on March 17, 2016, 01:31:12 PM
[quote author=PeteHoyle link=topic=9421.msg42728#msg42728 date=1458202686]
[quote author=PeteHoyle link=topic=9421.msg42717#msg42717 date=1458143288]
[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..
[/quote]


Actually thinking about this more, I have some distant memory that some of the OCCS HTTP requests are specific to certain dialling modes and will only work with Power GVP and Progressive GVP modes. I think it is the RecordProcessed and UpdateCallCompletionStats requests that are only supported by these dialling modes.
[/quote]


Yeah, only HTTP modes like Power GVP, Progressive GVP with GVP VXML client and Push Preview with ORS
Title: Re: Update callresult on outbound campaign using PSDK
Post by: luchosrock on March 17, 2016, 03:04:48 PM
[quote author=PeteHoyle link=topic=9421.msg42716#msg42716 date=1458143152]
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.
[/quote]

Thanks Pete for your quick reply.

When the agent is in NotReady status during after call work, is the record finished already?

Is the OCS option you mentioned campaign/group specific or is it globally scoped? I mean, will all outbound campaigns be affected by this configuration?
Title: Re: Update callresult on outbound campaign using PSDK
Post by: PeteHoyle on March 18, 2016, 03:06:10 PM
[quote author=luchosrock link=topic=9421.msg42742#msg42742 date=1458227088]
[quote author=PeteHoyle link=topic=9421.msg42716#msg42716 date=1458143152]
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.
[/quote]

Thanks Pete for your quick reply.

When the agent is in NotReady status during after call work, is the record finished already?

Is the OCS option you mentioned campaign/group specific or is it globally scoped? I mean, will all outbound campaigns be affected by this configuration?
[/quote]

If the Agent goes into Not Ready after the call without first going Ready then the record should still be able to be updated. Have a look at the TServer and OCS logs to see what is happening.

Looks like the option can either be set a application level or switch level..
Title: Re: Update callresult on outbound campaign using PSDK
Post by: facembani223 on March 25, 2016, 07:56:20 PM
Are OutboundDesktop requests made through TServer?
Title: Re: Update callresult on outbound campaign using PSDK
Post by: luchosrock on March 26, 2016, 03:57:51 PM
Yeah, they are made as a UserEvent through T-Server RequestSendEvent
Title: Re: Update callresult on outbound campaign using PSDK
Post by: cavagnaro on March 27, 2016, 03:15:43 PM
Post Tserver and OCS logs for a sample call. Indicate ConnID