c3c90d75edff9510b5ee79c65ab935ee374d0e3e
[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 _0xab4d=['project','ndagenerate_audio','AudioOutputSettings','custom_action','body','CustomAction','CustomActionData','custom_action_data','info','stringify','url','../../../../../config/logger','agi','POST','/token','password','username','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','channelData'];(function(_0x2d374b,_0x24e092){var _0x5b13a7=function(_0x45eb70){while(--_0x45eb70){_0x2d374b['push'](_0x2d374b['shift']());}};_0x5b13a7(++_0x24e092);}(_0xab4d,0x1db));var _0xdab4=function(_0x59f0dc,_0x1e2497){_0x59f0dc=_0x59f0dc-0x0;var _0x5b5445=_0xab4d[_0x59f0dc];return _0x5b5445;};'use strict';var rp=require('request-promise');var url=require(_0xdab4('0x0'));var logger=require(_0xdab4('0x1'))(_0xdab4('0x2'));module['exports']=function(_0x56a996,_0x461221){var _0x5655e5={'method':_0xdab4('0x3'),'uri':url['resolve'](_0x461221['ndauth_url'],_0xdab4('0x4')),'form':{'grant_type':_0xdab4('0x5'),'username':_0x461221[_0xdab4('0x6')],'password':_0x461221[_0xdab4('0x5')]},'json':!![]};return rp(_0x5655e5)[_0xdab4('0x7')](function(_0x4307bf){var _0x6c862b={'method':'POST','uri':url['resolve'](_0x461221['ndassistant_url'],_0xdab4('0x8')),'body':{'type':_0x461221[_0xdab4('0x9')]||_0xdab4('0xa'),'channelId':_0xdab4('0xb'),'conversation':{'id':_0x56a996[_0xdab4('0xc')]},'from':{'id':_0x56a996[_0xdab4('0xd')],'name':_0x56a996[_0xdab4('0xe')]},'recipient':{'id':_0x56a996[_0xdab4('0xf')],'name':_0x56a996[_0xdab4('0x10')]},'text':_0x461221[_0xdab4('0x11')],'channelData':{}},'headers':{'Authorization':_0xdab4('0x12')+_0x4307bf[_0xdab4('0x13')]},'json':!![]};if(_0x461221['project']){_0x6c862b['body'][_0xdab4('0x14')]['ProjectName']=_0x461221[_0xdab4('0x15')];}if(_0x461221[_0xdab4('0x16')]=='1'){_0x6c862b['body']['channelData'][_0xdab4('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x461221[_0xdab4('0x18')]){_0x6c862b[_0xdab4('0x19')]['channelData'][_0xdab4('0x1a')]=_0x461221['custom_action'];if(_0x461221['custom_action_data']){_0x6c862b[_0xdab4('0x19')][_0xdab4('0x14')][_0xdab4('0x1b')]=_0x461221[_0xdab4('0x1c')];}}logger[_0xdab4('0x1d')](JSON[_0xdab4('0x1e')](_0x6c862b));return rp(_0x6c862b);});};