96ceb4196775544bc1ae5c5281b80aa37252a5c9
[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 _0xbdd9=['CustomActionData','info','stringify','request-promise','url','agi','exports','POST','ndauth_url','/token','password','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','channelData'];(function(_0x21dc36,_0x54664b){var _0xcd8586=function(_0xb973f4){while(--_0xb973f4){_0x21dc36['push'](_0x21dc36['shift']());}};_0xcd8586(++_0x54664b);}(_0xbdd9,0x66));var _0x9bdd=function(_0x5534fe,_0x43c22e){_0x5534fe=_0x5534fe-0x0;var _0x3d1dc2=_0xbdd9[_0x5534fe];return _0x3d1dc2;};'use strict';var rp=require(_0x9bdd('0x0'));var url=require(_0x9bdd('0x1'));var logger=require('../../../../../config/logger')(_0x9bdd('0x2'));module[_0x9bdd('0x3')]=function(_0x57a032,_0x3b75c2){var _0x2d554a={'method':_0x9bdd('0x4'),'uri':url['resolve'](_0x3b75c2[_0x9bdd('0x5')],_0x9bdd('0x6')),'form':{'grant_type':_0x9bdd('0x7'),'username':_0x3b75c2['username'],'password':_0x3b75c2[_0x9bdd('0x7')]},'json':!![]};return rp(_0x2d554a)[_0x9bdd('0x8')](function(_0xfe9c5c){var _0xa6b3d4={'method':_0x9bdd('0x4'),'uri':url[_0x9bdd('0x9')](_0x3b75c2[_0x9bdd('0xa')],_0x9bdd('0xb')),'body':{'type':_0x3b75c2[_0x9bdd('0xc')]||_0x9bdd('0xd'),'channelId':'Nda','conversation':{'id':_0x57a032['uniqueid']},'from':{'id':_0x57a032['callerid'],'name':_0x57a032[_0x9bdd('0xe')]},'recipient':{'id':_0x57a032[_0x9bdd('0xf')],'name':_0x57a032[_0x9bdd('0x10')]},'text':_0x3b75c2[_0x9bdd('0x11')],'channelData':{}},'headers':{'Authorization':_0x9bdd('0x12')+_0xfe9c5c[_0x9bdd('0x13')]},'json':!![]};if(_0x3b75c2[_0x9bdd('0x14')]){_0xa6b3d4[_0x9bdd('0x15')]['channelData'][_0x9bdd('0x16')]=_0x3b75c2[_0x9bdd('0x14')];}if(_0x3b75c2[_0x9bdd('0x17')]=='1'){_0xa6b3d4[_0x9bdd('0x15')]['channelData'][_0x9bdd('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x9bdd('0x19')};}if(_0x3b75c2[_0x9bdd('0x1a')]){_0xa6b3d4[_0x9bdd('0x15')]['channelData'][_0x9bdd('0x1b')]=_0x3b75c2[_0x9bdd('0x1a')];if(_0x3b75c2[_0x9bdd('0x1c')]){_0xa6b3d4[_0x9bdd('0x15')][_0x9bdd('0x1d')][_0x9bdd('0x1e')]=_0x3b75c2[_0x9bdd('0x1c')];}}logger[_0x9bdd('0x1f')](JSON[_0x9bdd('0x20')](_0xa6b3d4));return rp(_0xa6b3d4);});};