Built motion from commit bab6f49e.|2.6.17
[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 _0x1752=['custom_action_data','info','stringify','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','calleridname','access_token','body','channelData','project','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x1752,0xa5));var _0x2175=function(_0x231801,_0xec9986){_0x231801=_0x231801-0x0;var _0x4a538a=_0x1752[_0x231801];return _0x4a538a;};'use strict';var rp=require('request-promise');var url=require(_0x2175('0x0'));var logger=require(_0x2175('0x1'))(_0x2175('0x2'));module[_0x2175('0x3')]=function(_0x1b2344,_0xe2453c){var _0x56c315={'method':_0x2175('0x4'),'uri':url[_0x2175('0x5')](_0xe2453c[_0x2175('0x6')],_0x2175('0x7')),'form':{'grant_type':_0x2175('0x8'),'username':_0xe2453c[_0x2175('0x9')],'password':_0xe2453c[_0x2175('0x8')]},'json':!![]};return rp(_0x56c315)[_0x2175('0xa')](function(_0x339e4d){var _0x672ff1={'method':'POST','uri':url[_0x2175('0x5')](_0xe2453c[_0x2175('0xb')],_0x2175('0xc')),'body':{'type':_0xe2453c[_0x2175('0xd')]||_0x2175('0xe'),'channelId':'Nda','conversation':{'id':_0x1b2344['uniqueid']},'from':{'id':_0x1b2344['callerid'],'name':_0x1b2344[_0x2175('0xf')]},'recipient':{'id':_0x1b2344['dnid'],'name':_0x1b2344['extension']},'text':_0xe2453c['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x339e4d[_0x2175('0x10')]},'json':!![]};if(_0xe2453c['project']){_0x672ff1[_0x2175('0x11')][_0x2175('0x12')]['ProjectName']=_0xe2453c[_0x2175('0x13')];}if(_0xe2453c[_0x2175('0x14')]=='1'){_0x672ff1[_0x2175('0x11')][_0x2175('0x12')][_0x2175('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x2175('0x16')};}if(_0xe2453c[_0x2175('0x17')]){_0x672ff1[_0x2175('0x11')]['channelData']['CustomAction']=_0xe2453c[_0x2175('0x17')];if(_0xe2453c[_0x2175('0x18')]){_0x672ff1[_0x2175('0x11')]['channelData']['CustomActionData']=_0xe2453c['custom_action_data'];}}logger[_0x2175('0x19')](JSON[_0x2175('0x1a')](_0x672ff1));return rp(_0x672ff1);});};