cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2063
Views
10
Helpful
12
Replies

Direct Transfer in a gadget

rufaidashafik21170
Spotlight
Spotlight

Hey can you help me I am getting problem to code transfer call action i tried to use https://github.com/CiscoDevNet/finesse-sample-code/tree/master/ClickToCallSampleGadget  api but unfortunately it is a consult call api i want to directly transfer my call to a certain extension how do i code that ?

1 Accepted Solution

Accepted Solutions

Hi,

 

I think you are misunderstanding what I am saying. In the HTML, you only need to pass in the from and the to. The onClick function finesse.modules.SampleGadget.initiateDirectTransfer is mapped to a method in the return clause of the js file, which you would have to add. You will also need to define an initiateDirectTransfer function up top that calls currentDialog.initiateDirectTransfer(mediaAddress, toAddress, handlers) with the appropriate handlers (success and error).

 

Thanx,

Denise

View solution in original post

12 Replies 12

dekwan
Cisco Employee
Cisco Employee

Hi,

 

Please create a new post rather than reply to an existing thread when it is a new topic. This helps users follow the discussion rather than being intertwined with another unrelated topic.

 

If you are trying to do a direct transfer, you want to use the direct transfer API which you can find here: https://developer.cisco.com/docs/finesse/#!rest-services-dialog/initiatedirecttransfermediaaddress-toaddress-handlers

 

Thanx,

Denise

Hey Sorry will definitely create a new discussion for the new topic next time.

 

Yes i saw this api still didnt got the idea of how to code as im new to this can you help me with the code im using uccx 11.6.

 

Hi,

 

I would recommend taking a look at the UpdateCallVariableSampleGadget (https://github.com/CiscoDevNet/finesse-sample-code/tree/master/UpdateCallVariableDataSampleGadget) instead because it shows how to use a dialog object which is what you need to use the initiateDirectTransfer method. You basically have to create a variable to keep track of the active call. Then call the initiateDirectTransfer method when the button is pushed.

 

Thanx,

Denise

How to keep track of the active call can you type the part that you trying to say it would be really helpful!

Hi,

 

Take a look at the currentDialog variable in the UpdateCallVariable sample gadget.

 

Thanx,

Denise

Okay something like this?
 
if(currentDialog){
html +=" <button onClick=\"finesse.modules.SampleGadget.initiateDirectTransfer('2205', '2207', handlers)">Transfer "</button>";
}
 
 initiateDirectTransfer = function (mediaAddresstoAddresshandlers) {
            this.isLoaded();
            var contentBody = {};
            contentBody[this.getRestType()] = {
                "targetMediaAddress": mediaAddress,
                "toAddress": toAddress,
                "requestedAction": Dialog.Actions.TRANSFER_SST
            };
            this._makeRequest(contentBodyhandlers);
            return this// Allow cascading
        },

Hi,

 

The initiateDirectTransfer(mediaAddress, toAddress, handlers) method that I had linked (https://developer.cisco.com/docs/finesse/#!rest-services-dialog/initiatedirecttransfermediaaddress-toaddress-handlers) is part of the Finesse JavaScript library that handles the REST API request to do a single step transfer. This method is available as part of the dialog object, which needs to be called on the active dialog object.

 

You need to copy all the code from the UpdateCallVariableSampleGadget that pertains to the currentDialog being set. Then in your equivalent updateCallVariable method, you need to check that the currentDialog is set. If so, call currentDialog.initiateDirectTransfer(mediaAddress, toAddress, handlers)

 

I hope that helps.

 

Thanx,

Denise

Thanks denise i did what you say but it gives an error im wondering what to pass in as handlers in button this is what im doing 

i need to innitiate the call from 2205 extenstion to 2207 extenstion

 

      html += "<button onClick=\"finesse.modules.SampleGadget.initiateDirectTransfer('2205','2207', handlers)\">Transfer </button>";
 
 updateCallVariable = function(namevalue) {
        if (currentDialog) {
            clientLogs.log("updateCallVariable(): Updating " + name + " to " + value + " for dialog with id: " + currentDialog.getId());

            currentDialog.initiateDirectTransfer(mediaAddresstoAddresshandlers)
            // Call the Dialog — Update Call Variable Data REST API
            var config = finesse.gadget.Config;
            var url = config.scheme + "://" + config.host + ":" + config.hostPort + currentDialog.getRestUrl();
            clientLogs.log("updateCallVariable(): URL is: " + url);

            // Build the content body
            var contentBody = {
                                "Dialog" : {
                                    "requestedAction": finesse.restservices.Dialog.Actions.UPDATE_CALL_DATA,
                                    "mediaProperties": {
                                        "callvariables": {
                                            "CallVariable": {
                                                "name": name,
                                                "value": value
                                            }
                                        }
                                    }
                                }
                              };
            makeRequest(url, {
                method: 'PUT',
                authorization: _util.getAuthHeaderString(finesse.gadget.Config),
                contentType: 'application/xml',
                content: _util.json2xml(contentBody),
            }, {
                success: handleResponseSuccess,
                error: handleResponseError
            });
        } else {
            clientLogs.log("updateCallVariable(): There are currently no active dialogs");
        }
 
It gives me this error

Uncaught ReferenceError: handlers is not defined
at HTMLButtonElement.onclick

Hi,

 

I think you are misunderstanding what I am saying. In the HTML, you only need to pass in the from and the to. The onClick function finesse.modules.SampleGadget.initiateDirectTransfer is mapped to a method in the return clause of the js file, which you would have to add. You will also need to define an initiateDirectTransfer function up top that calls currentDialog.initiateDirectTransfer(mediaAddress, toAddress, handlers) with the appropriate handlers (success and error).

 

Thanx,

Denise

Thanks alot it worked!

Great! I'm glad you were able to figure it out.

Hello rufaidashafik21170,

I need the same solution. Could you share your files complete?

Regards