Built motion from commit (unavailable).|2.5.9
[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 _0xc80a=['access_token','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','custom_action_data','CustomActionData','stringify','request-promise','../../../../../config/logger','agi','exports','POST','ndauth_url','password','username','then','/api/NaturalDialogAssistant/v1/Run','Nda','uniqueid','callerid','calleridname','extension','text','Bearer\x20'];(function(_0x351cbc,_0x30380c){var _0x37b81b=function(_0x50afa8){while(--_0x50afa8){_0x351cbc['push'](_0x351cbc['shift']());}};_0x37b81b(++_0x30380c);}(_0xc80a,0xcf));var _0xac80=function(_0x4b8c55,_0x21484a){_0x4b8c55=_0x4b8c55-0x0;var _0x37998b=_0xc80a[_0x4b8c55];return _0x37998b;};'use strict';var rp=require(_0xac80('0x0'));var url=require('url');var logger=require(_0xac80('0x1'))(_0xac80('0x2'));module[_0xac80('0x3')]=function(_0x48f837,_0x79aad2){var _0x1235d9={'method':_0xac80('0x4'),'uri':url['resolve'](_0x79aad2[_0xac80('0x5')],'/token'),'form':{'grant_type':_0xac80('0x6'),'username':_0x79aad2[_0xac80('0x7')],'password':_0x79aad2[_0xac80('0x6')]},'json':!![]};return rp(_0x1235d9)[_0xac80('0x8')](function(_0x293f19){var _0xb5f205={'method':_0xac80('0x4'),'uri':url['resolve'](_0x79aad2['ndassistant_url'],_0xac80('0x9')),'body':{'type':_0x79aad2['ndaactivity_type']||'message','channelId':_0xac80('0xa'),'conversation':{'id':_0x48f837[_0xac80('0xb')]},'from':{'id':_0x48f837[_0xac80('0xc')],'name':_0x48f837[_0xac80('0xd')]},'recipient':{'id':_0x48f837['dnid'],'name':_0x48f837[_0xac80('0xe')]},'text':_0x79aad2[_0xac80('0xf')],'channelData':{}},'headers':{'Authorization':_0xac80('0x10')+_0x293f19[_0xac80('0x11')]},'json':!![]};if(_0x79aad2['project']){_0xb5f205[_0xac80('0x12')][_0xac80('0x13')][_0xac80('0x14')]=_0x79aad2['project'];}if(_0x79aad2[_0xac80('0x15')]=='1'){_0xb5f205[_0xac80('0x12')][_0xac80('0x13')][_0xac80('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xac80('0x17')};}if(_0x79aad2['custom_action']){_0xb5f205['body'][_0xac80('0x13')]['CustomAction']=_0x79aad2[_0xac80('0x18')];if(_0x79aad2[_0xac80('0x19')]){_0xb5f205[_0xac80('0x12')][_0xac80('0x13')][_0xac80('0x1a')]=_0x79aad2['custom_action_data'];}}logger['info'](JSON[_0xac80('0x1b')](_0xb5f205));return rp(_0xb5f205);});};