022fd0bd759a0789d3de6e81e715fd87ab1775f2
[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 _0xead0=['resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','dnid','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','request-promise','url','../../../../../config/logger','agi','exports','POST'];(function(_0x117979,_0x37671b){var _0x5de520=function(_0x2dbb2b){while(--_0x2dbb2b){_0x117979['push'](_0x117979['shift']());}};_0x5de520(++_0x37671b);}(_0xead0,0xa4));var _0x0ead=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0xead0[_0x1c34e7];return _0x378cb1;};'use strict';var rp=require(_0x0ead('0x0'));var url=require(_0x0ead('0x1'));var logger=require(_0x0ead('0x2'))(_0x0ead('0x3'));module[_0x0ead('0x4')]=function(_0x2aa051,_0x3131d0){var _0x215017={'method':_0x0ead('0x5'),'uri':url[_0x0ead('0x6')](_0x3131d0[_0x0ead('0x7')],_0x0ead('0x8')),'form':{'grant_type':_0x0ead('0x9'),'username':_0x3131d0[_0x0ead('0xa')],'password':_0x3131d0[_0x0ead('0x9')]},'json':!![]};return rp(_0x215017)[_0x0ead('0xb')](function(_0x155e4a){var _0x1ab3ba={'method':_0x0ead('0x5'),'uri':url[_0x0ead('0x6')](_0x3131d0[_0x0ead('0xc')],_0x0ead('0xd')),'body':{'type':_0x3131d0[_0x0ead('0xe')]||_0x0ead('0xf'),'channelId':_0x0ead('0x10'),'conversation':{'id':_0x2aa051[_0x0ead('0x11')]},'from':{'id':_0x2aa051['callerid'],'name':_0x2aa051['calleridname']},'recipient':{'id':_0x2aa051[_0x0ead('0x12')],'name':_0x2aa051['extension']},'text':_0x3131d0[_0x0ead('0x13')],'channelData':{}},'headers':{'Authorization':_0x0ead('0x14')+_0x155e4a[_0x0ead('0x15')]},'json':!![]};if(_0x3131d0[_0x0ead('0x16')]){_0x1ab3ba[_0x0ead('0x17')][_0x0ead('0x18')][_0x0ead('0x19')]=_0x3131d0['project'];}if(_0x3131d0[_0x0ead('0x1a')]=='1'){_0x1ab3ba[_0x0ead('0x17')][_0x0ead('0x18')][_0x0ead('0x1b')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x0ead('0x1c')};}if(_0x3131d0[_0x0ead('0x1d')]){_0x1ab3ba[_0x0ead('0x17')][_0x0ead('0x18')][_0x0ead('0x1e')]=_0x3131d0[_0x0ead('0x1d')];if(_0x3131d0[_0x0ead('0x1f')]){_0x1ab3ba[_0x0ead('0x17')][_0x0ead('0x18')][_0x0ead('0x20')]=_0x3131d0[_0x0ead('0x1f')];}}logger[_0x0ead('0x21')](JSON['stringify'](_0x1ab3ba));return rp(_0x1ab3ba);});};