7f58df4409d1b97637e80d6feca06c7931705c96
[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 _0xd64b=['POST','username','password','then','resolve','ndaactivity_type','message','Nda','callerid','calleridname','dnid','extension','Bearer\x20','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','custom_action','CustomAction','CustomActionData','custom_action_data','info','stringify','request-promise','../../../../../config/logger','exports'];(function(_0x170c23,_0x1fff6e){var _0x46eb81=function(_0x213ee4){while(--_0x213ee4){_0x170c23['push'](_0x170c23['shift']());}};_0x46eb81(++_0x1fff6e);}(_0xd64b,0xc1));var _0xbd64=function(_0x57182a,_0x1f0016){_0x57182a=_0x57182a-0x0;var _0x4fddc6=_0xd64b[_0x57182a];return _0x4fddc6;};'use strict';var rp=require(_0xbd64('0x0'));var url=require('url');var logger=require(_0xbd64('0x1'))('agi');module[_0xbd64('0x2')]=function(_0xcbecd5,_0x64bd3b){var _0x3f1f05={'method':_0xbd64('0x3'),'uri':url['resolve'](_0x64bd3b['ndauth_url'],'/token'),'form':{'grant_type':'password','username':_0x64bd3b[_0xbd64('0x4')],'password':_0x64bd3b[_0xbd64('0x5')]},'json':!![]};return rp(_0x3f1f05)[_0xbd64('0x6')](function(_0x38204e){var _0x3f1f17={'method':_0xbd64('0x3'),'uri':url[_0xbd64('0x7')](_0x64bd3b['ndassistant_url'],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x64bd3b[_0xbd64('0x8')]||_0xbd64('0x9'),'channelId':_0xbd64('0xa'),'conversation':{'id':_0xcbecd5['uniqueid']},'from':{'id':_0xcbecd5[_0xbd64('0xb')],'name':_0xcbecd5[_0xbd64('0xc')]},'recipient':{'id':_0xcbecd5[_0xbd64('0xd')],'name':_0xcbecd5[_0xbd64('0xe')]},'text':_0x64bd3b['text'],'channelData':{}},'headers':{'Authorization':_0xbd64('0xf')+_0x38204e['access_token']},'json':!![]};if(_0x64bd3b[_0xbd64('0x10')]){_0x3f1f17[_0xbd64('0x11')][_0xbd64('0x12')][_0xbd64('0x13')]=_0x64bd3b[_0xbd64('0x10')];}if(_0x64bd3b[_0xbd64('0x14')]=='1'){_0x3f1f17[_0xbd64('0x11')][_0xbd64('0x12')][_0xbd64('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x64bd3b[_0xbd64('0x16')]){_0x3f1f17[_0xbd64('0x11')][_0xbd64('0x12')][_0xbd64('0x17')]=_0x64bd3b[_0xbd64('0x16')];if(_0x64bd3b['custom_action_data']){_0x3f1f17[_0xbd64('0x11')]['channelData'][_0xbd64('0x18')]=_0x64bd3b[_0xbd64('0x19')];}}logger[_0xbd64('0x1a')](JSON[_0xbd64('0x1b')](_0x3f1f17));return rp(_0x3f1f17);});};