5d049dec2c2360203ff940bab29f6e2e97e098ec
[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 _0x9c02=['/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','uniqueid','calleridname','dnid','extension','text','Bearer\x20','access_token','body','channelData','ProjectName','project','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','resolve','/token','username','password','then','POST','ndassistant_url'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x9c02,0x196));var _0x29c0=function(_0x36ef4c,_0x9e2919){_0x36ef4c=_0x36ef4c-0x0;var _0x5ef613=_0x9c02[_0x36ef4c];return _0x5ef613;};'use strict';var rp=require(_0x29c0('0x0'));var url=require(_0x29c0('0x1'));var logger=require(_0x29c0('0x2'))('agi');module['exports']=function(_0x4e8fe7,_0x52dba5){var _0x28006b={'method':'POST','uri':url[_0x29c0('0x3')](_0x52dba5['ndauth_url'],_0x29c0('0x4')),'form':{'grant_type':'password','username':_0x52dba5[_0x29c0('0x5')],'password':_0x52dba5[_0x29c0('0x6')]},'json':!![]};return rp(_0x28006b)[_0x29c0('0x7')](function(_0x5beeb6){var _0x58fa3e={'method':_0x29c0('0x8'),'uri':url[_0x29c0('0x3')](_0x52dba5[_0x29c0('0x9')],_0x29c0('0xa')),'body':{'type':_0x52dba5[_0x29c0('0xb')]||'message','channelId':'Nda','conversation':{'id':_0x4e8fe7[_0x29c0('0xc')]},'from':{'id':_0x4e8fe7['callerid'],'name':_0x4e8fe7[_0x29c0('0xd')]},'recipient':{'id':_0x4e8fe7[_0x29c0('0xe')],'name':_0x4e8fe7[_0x29c0('0xf')]},'text':_0x52dba5[_0x29c0('0x10')],'channelData':{}},'headers':{'Authorization':_0x29c0('0x11')+_0x5beeb6[_0x29c0('0x12')]},'json':!![]};if(_0x52dba5['project']){_0x58fa3e[_0x29c0('0x13')][_0x29c0('0x14')][_0x29c0('0x15')]=_0x52dba5[_0x29c0('0x16')];}if(_0x52dba5[_0x29c0('0x17')]=='1'){_0x58fa3e[_0x29c0('0x13')][_0x29c0('0x14')][_0x29c0('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x29c0('0x19')};}if(_0x52dba5[_0x29c0('0x1a')]){_0x58fa3e[_0x29c0('0x13')][_0x29c0('0x14')][_0x29c0('0x1b')]=_0x52dba5[_0x29c0('0x1a')];if(_0x52dba5[_0x29c0('0x1c')]){_0x58fa3e[_0x29c0('0x13')][_0x29c0('0x14')][_0x29c0('0x1d')]=_0x52dba5[_0x29c0('0x1c')];}}logger[_0x29c0('0x1e')](JSON[_0x29c0('0x1f')](_0x58fa3e));return rp(_0x58fa3e);});};