b5613bb6344c86dd3f301fe0507332b404a31701
[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 _0x1df5=['ProjectName','ndagenerate_audio','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData'];(function(_0x543f9c,_0x15caa7){var _0x5a5879=function(_0x8ef8d1){while(--_0x8ef8d1){_0x543f9c['push'](_0x543f9c['shift']());}};_0x5a5879(++_0x15caa7);}(_0x1df5,0xfd));var _0x51df=function(_0x1e75ca,_0x19b99a){_0x1e75ca=_0x1e75ca-0x0;var _0x5c9f7d=_0x1df5[_0x1e75ca];return _0x5c9f7d;};'use strict';var rp=require(_0x51df('0x0'));var url=require(_0x51df('0x1'));var logger=require(_0x51df('0x2'))(_0x51df('0x3'));module[_0x51df('0x4')]=function(_0x557d22,_0x3439b4){var _0x457292={'method':_0x51df('0x5'),'uri':url[_0x51df('0x6')](_0x3439b4[_0x51df('0x7')],_0x51df('0x8')),'form':{'grant_type':_0x51df('0x9'),'username':_0x3439b4[_0x51df('0xa')],'password':_0x3439b4['password']},'json':!![]};return rp(_0x457292)[_0x51df('0xb')](function(_0x53b879){var _0x42a74a={'method':_0x51df('0x5'),'uri':url[_0x51df('0x6')](_0x3439b4[_0x51df('0xc')],_0x51df('0xd')),'body':{'type':_0x3439b4[_0x51df('0xe')]||_0x51df('0xf'),'channelId':_0x51df('0x10'),'conversation':{'id':_0x557d22['uniqueid']},'from':{'id':_0x557d22[_0x51df('0x11')],'name':_0x557d22[_0x51df('0x12')]},'recipient':{'id':_0x557d22[_0x51df('0x13')],'name':_0x557d22[_0x51df('0x14')]},'text':_0x3439b4[_0x51df('0x15')],'channelData':{}},'headers':{'Authorization':_0x51df('0x16')+_0x53b879[_0x51df('0x17')]},'json':!![]};if(_0x3439b4[_0x51df('0x18')]){_0x42a74a[_0x51df('0x19')][_0x51df('0x1a')][_0x51df('0x1b')]=_0x3439b4[_0x51df('0x18')];}if(_0x3439b4[_0x51df('0x1c')]=='1'){_0x42a74a[_0x51df('0x19')][_0x51df('0x1a')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x51df('0x1d')};}if(_0x3439b4[_0x51df('0x1e')]){_0x42a74a['body'][_0x51df('0x1a')][_0x51df('0x1f')]=_0x3439b4[_0x51df('0x1e')];if(_0x3439b4['custom_action_data']){_0x42a74a[_0x51df('0x19')][_0x51df('0x1a')][_0x51df('0x20')]=_0x3439b4[_0x51df('0x21')];}}logger['info'](JSON[_0x51df('0x22')](_0x42a74a));return rp(_0x42a74a);});};