cancel
Showing results for 
Search instead for 
Did you mean: 
cancel

Update Call Data using Finesse Gadget

2393
Views
0
Helpful
6
Comments
This document was generated from CDN thread

Created by: yogesh kumar on 08-11-2013 10:27:32 AM
During an incoming call I want to update call data (eg. Call variable 1) and then transfer the call. I can see API for the same using Finesse API but I am not sure how I acchive the same using Finesse gadget API.

Subject: RE: New Message from yogesh kumar in Finesse - General Questions: Update Ca
Replied by: David Lender on 08-11-2013 12:02:44 PM
The finesse gadget javascript does not provide a method to update call variables only one to updateWrapUpReason.  Look for updateCallVariable in a future release.

To transfer  a call use the Dialog.initiateDirectTransfer method of Dialog.

Subject: RE: New Message from yogesh kumar in Finesse - General Questions: Update Ca
Replied by: Joseph Horvath on 08-11-2013 05:32:28 PM
It's quite easy to add the JavaScript code that is required to modify Call Variables. Just pattern it after the "updateWrapUpReason" code.

Subject: RE: New Message from Joseph Horvath in Finesse - General Questions: RE: New
Replied by: Jin Tiam Loh on 08-11-2013 09:59:45 PM
Hi,



Does this mean the only way (currently) to update the call variables is to send them back into IVR? Or its possible based on Joseph recommendation?



Thanks!

-JT-

Subject: RE: New Message from Joseph Horvath in Finesse - General Questions: RE: New
Replied by: Jin Tiam Loh on 08-11-2013 09:59:44 PM
Hi,



Does this mean the only way (currently) to update the call variables is to send them back into IVR? Or its possible based on Joseph recommendation?



Thanks!

-JT-

Subject: RE: New Message from yogesh kumar in Finesse - General Questions: Update Ca
Replied by: yogesh kumar on 09-11-2013 01:39:43 AM
Joseph Horvath:
It's quite easy to add the JavaScript code that is required to modify Call Variables. Just pattern it after the "updateWrapUpReason" code.

How can I do it…. Right now iam setting wrap up like this:
                                ActiveDialog.updateWrapUpReason(wrapUpReason, {
                                success: setWrapupReasonSuccess,
                                error: setWrapupReasonError
                                });          
Do I need to append call variable in this function only(How?) or just after it.
                

Subject: RE: New Message from Joseph Horvath in Finesse - General Questions: RE: New
Replied by: Joseph Horvath on 11-11-2013 09:09:57 AM
Something like this (for Finesse 9.x):

   /**
     * Update a Call Variable in this dialog.
     *
     * @param {String} name
     *     The Call Variable Name in this dialog
     * @param {String} value
     *     The new value for this named Call Variable in this dialog
     * @param {Object} handlers
     *     An object containing the following (optional) handlers for the request:<ul>
     *         <li><b>success(rsp):</b> A callback function for a successful request to be invoked with the following
     *         response object as its only parameter:<ul>
     *             <li><b>status:</b> {Number} The HTTP status code returned</li>
     *             <li><b>content:</b> {String} Raw string of response</li>
     *             <li><b>object:</b> {Object} Parsed object of response</li></ul>
     *         <li>A error callback function for an unsuccessful request to be invoked with the
     *         error response object as its only parameter:<ul>
     *             <li><b>status:</b> {Number} The HTTP status code returned</li>
     *             <li><b>content:</b> {String} Raw string of response</li>
     *             <li><b>object:</b> {Object} Parsed object of response (HTTP errors)</li>
     *             <li><b>error:</b> {Object} Wrapped exception that was caught:<ul>
     *                 <li><b>errorType:</b> {String} Type of error that was caught</li>
     *                 <li><b>errorMessage:</b> {String} Message associated with error</li>
     *             </ul></li>
     *         </ul>
     */
    updateCallVariable: function (name, value, options)
    {
        this.isLoaded();

        var callvariables =
            {
                "CallVariable" :
                {
                    "name" : name,
                    "value" : value
                }
            };

        var mediaProperties =
        {
            "callvariables" : callvariables
        };

        options = options || {};
        options.content = {};
        options.content[this.getRestType()] =
        {
            "requestedAction": finesse.restservices.Dialog.Actions.UPDATE_CALL_DATA,
            "mediaProperties": mediaProperties
        };
        options.method = "PUT";
        this.restRequest(this.getRestUrl(), options);

        return this;
    }
,

Subject: RE: Update Call Data using Finesse Gadget
Replied by: yogesh kumar on 12-11-2013 11:24:29 AM
Hi Joseph,
Thanks for providing the code snippet to update call variable. It worked for me. However I am not very sure how you done. There is no mention of this in any of the documents. Can you please explain me the process so I can probably use it somewhere else where documents does not described these methods.

Thanks

Subject: RE: Update Call Data using Finesse Gadget
Replied by: Joseph Horvath on 12-11-2013 12:54:37 PM
The code simply builds an XML request (as per the Cisco Finesse Web Services Developer Guide description of "Dialog - Update Call Variable Data") and submits it using the Finesse JavaScript Gadget library.
Comments

@Joseph Horvath Can you please explain a little more what is "options" in the parameters?  

Cisco Employee

Hi Rana,

Joseph uses the options parameter to pass into this.restRequest. So looking at the javaDoc for restRequest in the finesse.js, it states:

* @param {Object} options

  * An object containing additional options for the request.

  * @param {Object} options.content

  * An object to send in the content body of the request. Will be

  * serialized into XML before sending.

  * @param {String} options.method

  * The type of request. Defaults to "GET" when none is specified.

  * @param {Function} options.success(rsp)

  * A callback function to be invoked for a successful request.

  * {

  * status: {Number} The HTTP status code returned

  * content: {String} Raw string of response

  * object: {Object} Parsed object of response

  * }

  * @param {Function} options.error(rsp)

  * A callback function to be invoked for an unsuccessful request.

  * {

  * status: {Number} The HTTP status code returned

  * content: {String} Raw string of response

  * object: {Object} Parsed object of response

  * error: {Object} Wrapped exception that was caught

  * error.errorType: {String} Type of error that was caught

  * error.errorMessage: {String} Message associated with error

  * }

Hope this helps.

Thanx,

Denise

What do I pass to this method for `options`? Can you please share an example of "options"? I thought it is dialog, but now it is not clear what is the structure of this object and is it already in gadget context, or I have to make a new one.

Thanks,

Waqas

Cisco Employee

Hi,

Take a look at the javaDoc above, it states:

* @param {Object} options.content

  * An object to send in the content body of the request. Will be

  * serialized into XML before sending.

  * @param {String} options.method

  * The type of request. Defaults to "GET" when none is specified.

  * @param {Function} options.success(rsp)

Unfortunately, I do not have an example.

Thanx,

Denise

I used this method and getting the errors about

this.isLoaded

is undefined.

options.content[this.getRestType()] =

  {

  "requestedAction": finesse.restservices.Dialog.Actions.UPDATE_CALL_DATA,
  "mediaProperties": mediaProperties

  };

this.getRestType is not a function exception.

I am testing this on Cisco Finesse 11.0(1)

Hi Rana

Hope you are able to fix this. Could you please share your fix here.

Thanks

Sultan Al Arif