5e197abacbc61a5b96d1b1d11948d8c98287b0e5
[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 _0xbfcc=['custom_action_data','request-promise','agi','exports','/token','password','POST','resolve','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','dnid','extension','text','Bearer\x20','access_token','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','CustomActionData'];(function(_0x2a3b3a,_0x97a664){var _0xaab42b=function(_0x57ef61){while(--_0x57ef61){_0x2a3b3a['push'](_0x2a3b3a['shift']());}};_0xaab42b(++_0x97a664);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x485abd,_0x32c7c1){_0x485abd=_0x485abd-0x0;var _0x3379f1=_0xbfcc[_0x485abd];return _0x3379f1;};'use strict';var rp=require(_0xcbfc('0x0'));var url=require('url');var logger=require('../../../../../config/logger')(_0xcbfc('0x1'));module[_0xcbfc('0x2')]=function(_0x72a76d,_0x1a82e5){var _0x57f2e3={'method':'POST','uri':url['resolve'](_0x1a82e5['ndauth_url'],_0xcbfc('0x3')),'form':{'grant_type':_0xcbfc('0x4'),'username':_0x1a82e5['username'],'password':_0x1a82e5[_0xcbfc('0x4')]},'json':!![]};return rp(_0x57f2e3)['then'](function(_0x2ea130){var _0x1f8b71={'method':_0xcbfc('0x5'),'uri':url[_0xcbfc('0x6')](_0x1a82e5['ndassistant_url'],_0xcbfc('0x7')),'body':{'type':_0x1a82e5[_0xcbfc('0x8')]||_0xcbfc('0x9'),'channelId':_0xcbfc('0xa'),'conversation':{'id':_0x72a76d[_0xcbfc('0xb')]},'from':{'id':_0x72a76d[_0xcbfc('0xc')],'name':_0x72a76d['calleridname']},'recipient':{'id':_0x72a76d[_0xcbfc('0xd')],'name':_0x72a76d[_0xcbfc('0xe')]},'text':_0x1a82e5[_0xcbfc('0xf')],'channelData':{}},'headers':{'Authorization':_0xcbfc('0x10')+_0x2ea130[_0xcbfc('0x11')]},'json':!![]};if(_0x1a82e5['project']){_0x1f8b71[_0xcbfc('0x12')][_0xcbfc('0x13')][_0xcbfc('0x14')]=_0x1a82e5['project'];}if(_0x1a82e5[_0xcbfc('0x15')]=='1'){_0x1f8b71[_0xcbfc('0x12')][_0xcbfc('0x13')][_0xcbfc('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xcbfc('0x17')};}if(_0x1a82e5['custom_action']){_0x1f8b71[_0xcbfc('0x12')][_0xcbfc('0x13')][_0xcbfc('0x18')]=_0x1a82e5[_0xcbfc('0x19')];if(_0x1a82e5['custom_action_data']){_0x1f8b71['body'][_0xcbfc('0x13')][_0xcbfc('0x1a')]=_0x1a82e5[_0xcbfc('0x1b')];}}logger['info'](JSON['stringify'](_0x1f8b71));return rp(_0x1f8b71);});};