cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2608
Views
20
Helpful
5
Replies

callVariable1 not populated in custom gadget

RadDev01
Level 1
Level 1

 

I'm creating a custom gadget to open a browser tab like a screen pop, but I don't want it to open for internal numbers (4 digits) which you can't do with a workflow screenpop. 

 

The problem is callVariable1 is not populated in the call variables returned from dialog getMediaProperties. I do get DNIS, callType and dialedNumber. I based this off of the GoogleMapsScreenPop sample. 

 

1) We have callVariable1 in the call variables layout and it's populated there.

2) It also is there for a browser pop workflow. 

 

Can anyone help me get this populated?

1 Accepted Solution

Accepted Solutions


I got this working. Thanks for your help Denise and Gerry. 

 

I got the from address in handleNewDialog using: 

var fromAddress = dialog.getFromAddress();

 

According to this fromAddress is ANI.

https://developer.cisco.com/docs/finesse/#!basic-dialog-rest-apis/finesse-basic-dialog-rest-apis-with-xmpp-events

"For the media type "voice", this object represents a call and includes information about the call, such as the ANI (fromAddress), DNIS, callvariables, participants, call state, and allowable actions."

 

And then in the render function I don't pop if from address is <= 4. 

View solution in original post

5 Replies 5

dekwan
Cisco Employee
Cisco Employee

Hi,

 

How does your code look like?

 

I suggest using the browser's developer tools to debug this. Take a look at the whole event data at that moment to see if the data is there. Remember that call variables can originally be empty but get updated in the next event soon after. So, there is a slight chance that at that point of time, there is indeed no callvariable1. It is hard to tell to the naked eye because these events come within seconds of each other. So even though you see it in the call variable layout, it could be that event #2 populated it and your code is currently looking at data from event #1.

 

I hope that makes sense.

 

Thanx,

Denise


Debugger wasn't working in Edge but I switched to Chrome and now I see a lot of output in the console. I see the number in the fromAddress. Would it make sense to get it from here? 

 


<Update>
<data>
<dialogs>
<Dialog>
<associatedDialogUri/>
<fromAddress>2671234567</fromAddress>
<id>100059106</id>
<mediaProperties>
<DNIS>1639</DNIS>
<callType>ACD_IN</callType>
<dialedNumber>2551</dialedNumber>
<outboundClassification/>
<callvariables>
<CallVariable>
<name>callVariable1</name>
<value/>
</CallVariable>

 

 

This is from the google maps sample I just changed it to use callVariable 1 instead of 3. 

 

handleNewDialog = function(dialog) {
// increment the number of dialogs
numDialogs++;

// get the call variable data from the dialog
// getMediaProperties returns an array of properties
callvars = dialog.getMediaProperties();
clientLogs.log("cv1="+callvars["callVariable1"]);
// if callVariable3 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();
}
},

 

render = function () {
var currentState = user.getState();

if (numDialogs==1) {

// callvars was set in handleNewDialog
// get the call var 3 and put it in the address field

var cv1 = callvars["callVariable1"];
clientLogs.log("callVariable1=" + cv1);
$('#callVariable1').attr('value', cv1);
gadgets.window.adjustHeight('1000');
}
else {
// we don't have a call yet
$('#callVariable1').attr('value', "<not set>");
gadgets.window.adjustHeight('1000');
}
},

_processCall = function (dialog) {
// if here then callvar1 didnt show up on initial dialog
// get the latest callvariables
callvars = dialog.getMediaProperties();
render();
},


I got this working. Thanks for your help Denise and Gerry. 

 

I got the from address in handleNewDialog using: 

var fromAddress = dialog.getFromAddress();

 

According to this fromAddress is ANI.

https://developer.cisco.com/docs/finesse/#!basic-dialog-rest-apis/finesse-basic-dialog-rest-apis-with-xmpp-events

"For the media type "voice", this object represents a call and includes information about the call, such as the ANI (fromAddress), DNIS, callvariables, participants, call state, and allowable actions."

 

And then in the render function I don't pop if from address is <= 4. 

Gerry O'Rourke
Spotlight
Spotlight

Why use call variable1 all?

If you do want to use call variable1, are you sure it's been set in the cce script?

 

Why not use the ani?

If ani equals 4 then call is internal. 

Otherwise call is external.

This also covers anonymous ani which could happen for external calls. 

 

Gerry

 

 


I believe so. I'm not very familiar with it but I have seen and would have to check. I will look tomorrow. 

 

Using ani sounds perfect, I just need to find out how to get it into my script. I don't see it being logged in the browser console right now. 

 

Thank you.