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