027306c9ab85bd664b87c6f2a09cd249e4364d77
[motion2.git] / server / services / agi / scripts / sestek / nda / index.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x6c9f=['CustomActionData','info','request-promise','../../../../../config/logger','exports','POST','resolve','/token','password','username','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','Bearer\x20','access_token','project','body','ndagenerate_audio','channelData','AudioOutputSettings','audio/wav','CustomAction','custom_action_data'];(function(_0x58dd4a,_0x87e88b){var _0x4e32d7=function(_0x42509c){while(--_0x42509c){_0x58dd4a['push'](_0x58dd4a['shift']());}};_0x4e32d7(++_0x87e88b);}(_0x6c9f,0x16a));var _0xf6c9=function(_0x98e2e0,_0x10b4b2){_0x98e2e0=_0x98e2e0-0x0;var _0x3c5be2=_0x6c9f[_0x98e2e0];return _0x3c5be2;};'use strict';var rp=require(_0xf6c9('0x0'));var url=require('url');var logger=require(_0xf6c9('0x1'))('agi');module[_0xf6c9('0x2')]=function(_0x3280da,_0x66f7d0){var _0x3528a5={'method':_0xf6c9('0x3'),'uri':url[_0xf6c9('0x4')](_0x66f7d0['ndauth_url'],_0xf6c9('0x5')),'form':{'grant_type':_0xf6c9('0x6'),'username':_0x66f7d0[_0xf6c9('0x7')],'password':_0x66f7d0[_0xf6c9('0x6')]},'json':!![]};return rp(_0x3528a5)[_0xf6c9('0x8')](function(_0x3d8579){var _0x24901b={'method':_0xf6c9('0x3'),'uri':url[_0xf6c9('0x4')](_0x66f7d0['ndassistant_url'],_0xf6c9('0x9')),'body':{'type':_0x66f7d0[_0xf6c9('0xa')]||_0xf6c9('0xb'),'channelId':_0xf6c9('0xc'),'conversation':{'id':_0x3280da[_0xf6c9('0xd')]},'from':{'id':_0x3280da[_0xf6c9('0xe')],'name':_0x3280da[_0xf6c9('0xf')]},'recipient':{'id':_0x3280da[_0xf6c9('0x10')],'name':_0x3280da[_0xf6c9('0x11')]},'text':_0x66f7d0['text'],'channelData':{}},'headers':{'Authorization':_0xf6c9('0x12')+_0x3d8579[_0xf6c9('0x13')]},'json':!![]};if(_0x66f7d0[_0xf6c9('0x14')]){_0x24901b[_0xf6c9('0x15')]['channelData']['ProjectName']=_0x66f7d0[_0xf6c9('0x14')];}if(_0x66f7d0[_0xf6c9('0x16')]=='1'){_0x24901b[_0xf6c9('0x15')][_0xf6c9('0x17')][_0xf6c9('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xf6c9('0x19')};}if(_0x66f7d0['custom_action']){_0x24901b['body'][_0xf6c9('0x17')][_0xf6c9('0x1a')]=_0x66f7d0['custom_action'];if(_0x66f7d0[_0xf6c9('0x1b')]){_0x24901b[_0xf6c9('0x15')][_0xf6c9('0x17')][_0xf6c9('0x1c')]=_0x66f7d0[_0xf6c9('0x1b')];}}logger[_0xf6c9('0x1d')](JSON['stringify'](_0x24901b));return rp(_0x24901b);});};