Built motion from commit (unavailable).|2.5.21
[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 _0x5df5=['custom_action_data','CustomActionData','stringify','request-promise','url','../../../../../config/logger','agi','exports','password','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','uniqueid','dnid','text','Bearer\x20','project','body','channelData','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction'];(function(_0x2fb511,_0x41cf72){var _0x44d001=function(_0x49f2cb){while(--_0x49f2cb){_0x2fb511['push'](_0x2fb511['shift']());}};_0x44d001(++_0x41cf72);}(_0x5df5,0xb2));var _0x55df=function(_0x406b53,_0x30ade3){_0x406b53=_0x406b53-0x0;var _0x3c83a0=_0x5df5[_0x406b53];return _0x3c83a0;};'use strict';var rp=require(_0x55df('0x0'));var url=require(_0x55df('0x1'));var logger=require(_0x55df('0x2'))(_0x55df('0x3'));module[_0x55df('0x4')]=function(_0x10ac6d,_0x5aa0dc){var _0x194457={'method':'POST','uri':url['resolve'](_0x5aa0dc['ndauth_url'],'/token'),'form':{'grant_type':_0x55df('0x5'),'username':_0x5aa0dc['username'],'password':_0x5aa0dc[_0x55df('0x5')]},'json':!![]};return rp(_0x194457)['then'](function(_0x471645){var _0x36c50f={'method':'POST','uri':url[_0x55df('0x6')](_0x5aa0dc[_0x55df('0x7')],_0x55df('0x8')),'body':{'type':_0x5aa0dc['ndaactivity_type']||_0x55df('0x9'),'channelId':'Nda','conversation':{'id':_0x10ac6d[_0x55df('0xa')]},'from':{'id':_0x10ac6d['callerid'],'name':_0x10ac6d['calleridname']},'recipient':{'id':_0x10ac6d[_0x55df('0xb')],'name':_0x10ac6d['extension']},'text':_0x5aa0dc[_0x55df('0xc')],'channelData':{}},'headers':{'Authorization':_0x55df('0xd')+_0x471645['access_token']},'json':!![]};if(_0x5aa0dc[_0x55df('0xe')]){_0x36c50f[_0x55df('0xf')][_0x55df('0x10')]['ProjectName']=_0x5aa0dc['project'];}if(_0x5aa0dc[_0x55df('0x11')]=='1'){_0x36c50f[_0x55df('0xf')][_0x55df('0x10')][_0x55df('0x12')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x55df('0x13')};}if(_0x5aa0dc[_0x55df('0x14')]){_0x36c50f[_0x55df('0xf')]['channelData'][_0x55df('0x15')]=_0x5aa0dc['custom_action'];if(_0x5aa0dc[_0x55df('0x16')]){_0x36c50f['body'][_0x55df('0x10')][_0x55df('0x17')]=_0x5aa0dc[_0x55df('0x16')];}}logger['info'](JSON[_0x55df('0x18')](_0x36c50f));return rp(_0x36c50f);});};