Built motion from commit 3c2ce842.|2.6.31
[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 _0x6075=['access_token','body','channelData','project','ndagenerate_audio','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','agi','exports','ndauth_url','password','POST','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','text','Bearer\x20'];(function(_0x213ed5,_0x26712a){var _0x191514=function(_0x2d9305){while(--_0x2d9305){_0x213ed5['push'](_0x213ed5['shift']());}};_0x191514(++_0x26712a);}(_0x6075,0x142));var _0x5607=function(_0x274b75,_0x2b87ea){_0x274b75=_0x274b75-0x0;var _0x1440d6=_0x6075[_0x274b75];return _0x1440d6;};'use strict';var rp=require(_0x5607('0x0'));var url=require(_0x5607('0x1'));var logger=require('../../../../../config/logger')(_0x5607('0x2'));module[_0x5607('0x3')]=function(_0x5ab30d,_0x48cde9){var _0x1a5179={'method':'POST','uri':url['resolve'](_0x48cde9[_0x5607('0x4')],'/token'),'form':{'grant_type':_0x5607('0x5'),'username':_0x48cde9['username'],'password':_0x48cde9[_0x5607('0x5')]},'json':!![]};return rp(_0x1a5179)['then'](function(_0x415836){var _0x5f92ad={'method':_0x5607('0x6'),'uri':url[_0x5607('0x7')](_0x48cde9[_0x5607('0x8')],_0x5607('0x9')),'body':{'type':_0x48cde9[_0x5607('0xa')]||_0x5607('0xb'),'channelId':_0x5607('0xc'),'conversation':{'id':_0x5ab30d[_0x5607('0xd')]},'from':{'id':_0x5ab30d[_0x5607('0xe')],'name':_0x5ab30d[_0x5607('0xf')]},'recipient':{'id':_0x5ab30d[_0x5607('0x10')],'name':_0x5ab30d['extension']},'text':_0x48cde9[_0x5607('0x11')],'channelData':{}},'headers':{'Authorization':_0x5607('0x12')+_0x415836[_0x5607('0x13')]},'json':!![]};if(_0x48cde9['project']){_0x5f92ad[_0x5607('0x14')][_0x5607('0x15')]['ProjectName']=_0x48cde9[_0x5607('0x16')];}if(_0x48cde9[_0x5607('0x17')]=='1'){_0x5f92ad['body'][_0x5607('0x15')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x5607('0x18')};}if(_0x48cde9[_0x5607('0x19')]){_0x5f92ad[_0x5607('0x14')][_0x5607('0x15')][_0x5607('0x1a')]=_0x48cde9[_0x5607('0x19')];if(_0x48cde9[_0x5607('0x1b')]){_0x5f92ad[_0x5607('0x14')][_0x5607('0x15')][_0x5607('0x1c')]=_0x48cde9[_0x5607('0x1b')];}}logger[_0x5607('0x1d')](JSON[_0x5607('0x1e')](_0x5f92ad));return rp(_0x5f92ad);});};