cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1851
Views
3
Helpful
14
Replies

embedded webapp gadget startup with userid

jdickinson
Level 5
Level 5

I would like to start the gadget up passing in the userID. Is this possible?

Here is my current script tag.

is there a parameter I can use at the end of index.html?FINESSE_USERID  ?

Or do I need to make the user enter the id manually?

  <script type="text/javascript">

                // initialize the gadget running the init handler defined in EmbeddedWebApp.js

                gadgets.HubSettings.onConnect = function () {

                    finesse.modules.EmbeddedWebAppGadget.init("https://uccx-001-app-prod.statebridgecompany.com:8445/3rdpartygadget/files/release/index.html");

                };

            </script>

1 Accepted Solution

Accepted Solutions

dekwan
Cisco Employee
Cisco Employee

Hi Joe,

You would need to concatenate the userId in the init method in the js file. The embedded JS init doesn't currently get the userId, so take a look at another sample such as the ScreenPopSampleGadget. You would need to do something similar as the screen pop's init where it gets the userId from the finesse.gadget.Config.

Thanx,

Denise

View solution in original post

14 Replies 14

dekwan
Cisco Employee
Cisco Employee

Hi Joe,

You would need to concatenate the userId in the init method in the js file. The embedded JS init doesn't currently get the userId, so take a look at another sample such as the ScreenPopSampleGadget. You would need to do something similar as the screen pop's init where it gets the userId from the finesse.gadget.Config.

Thanx,

Denise

thanks I figured you may suggest that.  I should be able to start testing tomorrow.

Hi. I logged this event when answering the queue

agent state:READY

concat:18451 num dialogs:-1

concat:18452 callvars: undefined

num dialogs -1  the sample gadget triggers when dialogs are 1. Why would it be -1?

Hi Joe,

Probably because you refreshed the page while the agent already has a call. Notice how numDialogs is just + and - from default 0. So if you refreshed the page while the agent has a call, then the call ends, then it will go 0 - 1 = -1. You can make the code smarter and start from the number of dialogs rather than 0.

Thanx,

Denise

this is my log code:

   console.log("callvars length=" + callvars.length);

        for (var i = 0; i < callvars.length; i++)

        {

            console.log("var:" + i + ' = ' + callvars[i]);


        }

         console.log("agent state:" + user.getState());

        

         console.log("num dialogs:" + numDialogs);

these are the results

concat?container=default&gadget=http%3A%2F%2Flocalhost%3A8082%2F3rdpartygadget%2Ffiles%2FScreenPop.…:18452 callvars length=0

concat?container=default&gadget=http%3A%2F%2Flocalhost%3A8082%2F3rdpartygadget%2Ffiles%2FScreenPop.…:18458 agent state:READY

concat?container=default&gadget=http%3A%2F%2Flocalhost%3A8082%2F3rdpartygadget%2Ffiles%2FScreenPop.…:18460 num dialogs:-1

notice the length of callvars = 0; where is this suppose to get populated from?  It doesn't seem that I am able to know what these are based on the incoming call.

other logging information on the desktop is sending this:

finesse.js:15992 2017-03-23T14:28:50.168 -06:00: : uccx-001-app-prod.statebridgecompany.com: Mar 23 2017 14:28:50.194 -0600: Header : [ClientServices] MasterPublisher._parseAndPublishXMLEvent() - Received XML event on node '/finesse/api/User/jdickinson/Dialogs': <Update><data><dialog><associatedDialogUri></associatedDialogUri><fromAddress>+17203138707</fromAddress><id>16784085</id><mediaProperties><DNIS>4001004098</DNIS><callType>ACD_IN</callType><dialedNumber>4001005503</dialedNumber><outboundClassification></outboundClassification><callvariables><CallVariable><name>callVariable1</name><value>327524552</value></CallVariable><CallVariable><name>callVariable2</name><value>FHLMC</value></CallVariable><CallVariable><name>callVariable3</name><value>5000</value></CallVariable><CallVariable><name>callVariable4</name><value>N</value></CallVariable><CallVariable><name>callVariable5</name><value>0</value></CallVariable><CallVariable><name>callVariable6</name><value>Mortgage</value></CallVariable><CallVariable><name>callVariable7</name><value>CURRENT</value></CallVariable><CallVariable><name>callVariable8</name><value>Current</value></CallVariable><CallVariable><name>callVariable9</name><value>NONE</value></CallVariable><CallVariable><name>callVariable10</name><value>GA</value></CallVariable><CallVariable><name>userLoanID</name><value>0000029700</value></CallVariable><CallVariable><name>userCSQ</name><value>Test_CSQ</value></CallVariable><CallVariable><name>user.Layout</name><value>Inbound Agent Layout</value></CallVariable></callvariables></mediaProperties><mediaType>Voice</mediaType><participants><Participant><actions><action>CONSULT_CALL</action><action>HOLD</action><action>UPDATE_CALL_DATA</action><action>SEND_DTMF</action><action>START_RECORDING</action><action>DROP</action></actions><mediaAddress>+17203138707</mediaAddress><mediaAddressType></mediaAddressType><startTime>2017-03-23T20:28:23.509Z</startTime><state>ACTIVE</state><stateCause></stateCause><stateChangeTime>2017-03-23T20:28:50.103Z</stateChangeTime></Participant><Participant><actions><action>CONSULT_CALL</action><action>HOLD</action><action>UPDATE_CALL_DATA</action><action>SEND_DTMF</action><action>START_RECORDING</action><action>DROP</action></actions><mediaAddress>4001005050</mediaAddress><mediaAddressType></mediaAddressType><startTime>2017-03-23T20:28:23.509Z</startTime><state>ACTIVE</state><stateCause></stateCause><stateChangeTime>2017-03-23T20:28:23.509Z</stateChangeTime></Participant><Participant><actions><action>CONSULT_CALL</action><action>HOLD</action><action>UPDATE_CALL_DATA</action><action>SEND_DTMF</action><action>START_RECORDING</action><action>DROP</action></actions><mediaAddress>4001004098</mediaAddress><mediaAddressType>AGENT_DEVICE</mediaAddressType><startTime>2017-03-23T20:28:50.103Z</startTime><state>ACTIVE</state><stateCause></stateCause><stateChangeTime>2017-03-23T20:28:50.103Z</stateChangeTime></Participant></participants><state>ACTIVE</state><toAddress>4001005503</toAddress><uri>/finesse/api/Dialog/16784085</uri></dialog></data><event>PUT</event><requestId>d1339d89-8f88-4db8-8aa3-ceec05b588b5</requestId><source>/finesse/api/Dialog/16784085</source></Update>

finesse.js:15992 2017-03-23T14:28:50.169 -06:00: : uccx-001-app-prod.statebridgecompany.com: Mar 23 2017 14:28:50.195 -0600: Header : [WorkflowEngine] Received dialog event.

finesse.js:15992 2017-03-23T14:28:50.170 -06:00: : uccx-001-app-prod.statebridgecompany.com: Mar 23 2017 14:28:50.196 -0600: Header : [WorkflowEngine] Converting event to xml document. Type: Dialog Action: change Uri: /finesse/api/Dialog/16784085 Event: {"Dialog":{"associatedDialogUri":null,"fromAddress":"+17203138707","id":"16784085","mediaProperties":{"DNIS":"4001004098","callType":"ACD_IN","dialedNumber":"4001005503","outboundClassification":null,"callvariables":{"CallVariable":[{"name":"callVariable1","value":"327524552"},{"name":"callVariable2","value":"FHLMC"},{"name":"callVariable3","value":"5000"},{"name":"callVariable4","value":"N"},{"name":"callVariable5","value":"0"},{"name":"callVariable6","value":"Mortgage"},{"name":"callVariable7","value":"CURRENT"},{"name":"callVariable8","value":"Current"},{"name":"callVariable9","value":"NONE"},{"name":"callVariable10","value":"GA"},{"name":"userLoanID","value":"0000029700"},{"name":"userCSQ","value":"Test_CSQ"},{"name":"user.Layout","value":"Inbound Agent Layout"}]}},"mediaType":"Voice","participants":{"Participant":[{"actions":{"action":["CONSULT_CALL","HOLD","UPDATE_CALL_DATA","SEND_DTMF","START_RECORDING","DROP"]},"mediaAddress":"+17203138707","mediaAddressType":null,"startTime":"2017-03-23T20:28:23.509Z","state":"ACTIVE","stateCause":null,"stateChangeTime":"2017-03-23T20:28:50.103Z"},{"actions":{"action":["CONSULT_CALL","HOLD","UPDATE_CALL_DATA","SEND_DTMF","START_RECORDING","DROP"]},"mediaAddress":"4001005050","mediaAddressType":null,"startTime":"2017-03-23T20:28:23.509Z","state":"ACTIVE","stateCause":null,"stateChangeTime":"2017-03-23T20:28:23.509Z"},{"actions":{"action":["CONSULT_CALL","HOLD","UPDATE_CALL_DATA","SEND_DTMF","START_RECORDING","DROP"]},"mediaAddress":"4001004098","mediaAddressType":"AGENT_DEVICE","startTime":"2017-03-23T20:28:50.103Z","state":"ACTIVE","stateCause":null,"stateChangeTime":"2017-03-23T20:28:50.103Z"}]},"state":"ACTIVE","toAddress":"4001005503","uri":"/finesse/api/Dialog/16784085"}}

finesse.js:15992 2017-03-23T14:28:50.172 -06:00: : uccx-001-app-prod.statebridgecompany.com: Mar 23 2017 14:28:50.198 -0600: Header : [WorkflowEngine] Calling state machine's workflowEvent method for /finesse/api/Dialog/16784085 (action: change)

which has info I need to access.

Hi Joe,

How did you populate the callvars variable? Your snippet of code doesn't show.

Looking at the ScreenPopSampleGadget I pointed you to...

handleNewDialog = function(dialog) {

        // increment the number of dialogs

        numDialogs++;

           

        // get the call variable data from the dialog

        // dialog.getMediaProperties() returns an array of properties

        callvars = dialog.getMediaProperties();

        ...

}

Is this what you did?

Thanx,

Denise

Yes, I basically have the same screenPop sample, and I am trying to log the call variables just to see what they are.

This is that part ofo the function. I added these logs, but not seeing them in the log. 
handleNewDialog = function(dialog) {

            // increment the number of dialogs

            numDialogs++;

           

            // get the call variable data from the dialog

            // dialog.getMediaProperties() returns an array of properties

            callvars = dialog.getMediaProperties();

           

            clientLogs.log("handleNewDialog:cv1="+callvars["callVariable1"]);

            clientLogs.log("handleNewDialog:cv2="+callvars["callVariable2"]);

            clientLogs.log("handleNewDialog:cv3="+callvars["callVariable3"]);

            clientLogs.log("handleNewDialog:cv4="+callvars["callVariable4"]);

            clientLogs.log("handleNewDialog:cv5="+callvars["callVariable5"]);

            clientLogs.log("handleNewDialog:cv6="+callvars["callVariable6"]);

            clientLogs.log("handleNewDialog:cv7="+callvars["callVariable7"]);

            clientLogs.log("handleNewDialog:cv8="+callvars["callVariable8"]);

            clientLogs.log("handleNewDialog:cv9="+callvars["callVariable9"]);

            clientLogs.log("handleNewDialog:cv10="+callvars["callVariable10"]);


            // if callVariable1 is null then add a handler for subsequent dialog events

            //  where the call data will have been updated

            if (callvars["callVariable1"] == null )

            {

                dialog.addHandler('change', _processCall);

            }

            else

            {

            // render the html in the gadget

               clientLogs.log("rendering dialog");

               render();

            }

   


    },

If you notice, the callvars is an object with keys and not an array with an index. So you need to do this:

clientLogs.log("handleNewDialog(): callVariable Length=" + Object.keys(callvars).length);

        for (var key in callvars) {

            clientLogs.log("key " + key + " has value " + callvars[key]);

        }

Using the generic screenpopsamplegadget, the above works.

These are sent to the clientlogs, so you either need to push "Send client logs" and get them from the clientlogs folder, or just look at the browser's developer tools console.

To make sure we are apples to apples.

My process is added the screen pop gadget to the system.

Then I use my cell phone to make a voice call to the ivr and punch in some numbers.

The numbers show up in the log, but I am not able to obtain them for populating the screen pop, which is what I want to do.

Are we on the same page?

The log from that code is this: so  I am not seeing any info here.

concat?container=default&gadget=http%3A%2F%2Flocalhost%3A8082%2F3rdpartygadget%2Ffiles%2FScreenPop.…:15999 2017-03-23T15:32:49.522 -06:00: : uccx-001-app-prod.statebridgecompany.com: Mar 23 2017 15:32:49.560 -0600: ScreenPop : handleNewDialog(): callVariable Length=0

concat?container=default&gadget=http%3A%2F%2Flocalhost%3A8082%2F3rdpartygadget%2Ffiles%2FScreenPop.…:18455 agent state:READY

concat?container=default&gadget=http%3A%2F%2Flocalhost%3A8082%2F3rdpartygadget%2Ffiles%2FScreenPop.…:18457 num dialogs:-1

I did the same thing of loading the screenpop with the new logs, made a IVR call to the agent and was able to see the call variables in the logs.

I don't understand why your number of dialogs is -1. Make sure the agent doesn't have any calls, then refresh the desktop.

You are going to have to use the browser's developer tools to debug why it keeps on showing 0. I am unable to reproduce this on my side.

I started from scratch. I think I was using a version 10x instead of 11.

Starting to see data now.

Thank you.