9075615be70ad61ac158aa81375fd4b20b53d99e
[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 _0xed3d=['ndagenerate_audio','audio/wav','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','agi','resolve','ndauth_url','/token','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','dnid','extension','text','Bearer\x20','access_token','body','channelData','ProjectName','project'];(function(_0x255ac0,_0x3f6645){var _0x437bf1=function(_0x5baff0){while(--_0x5baff0){_0x255ac0['push'](_0x255ac0['shift']());}};_0x437bf1(++_0x3f6645);}(_0xed3d,0xbb));var _0xded3=function(_0x16b0c6,_0x1dc29e){_0x16b0c6=_0x16b0c6-0x0;var _0x559d36=_0xed3d[_0x16b0c6];return _0x559d36;};'use strict';var rp=require(_0xded3('0x0'));var url=require(_0xded3('0x1'));var logger=require('../../../../../config/logger')(_0xded3('0x2'));module['exports']=function(_0x497955,_0x3c2632){var _0x34bd75={'method':'POST','uri':url[_0xded3('0x3')](_0x3c2632[_0xded3('0x4')],_0xded3('0x5')),'form':{'grant_type':_0xded3('0x6'),'username':_0x3c2632[_0xded3('0x7')],'password':_0x3c2632[_0xded3('0x6')]},'json':!![]};return rp(_0x34bd75)['then'](function(_0x1e93f1){var _0x432962={'method':'POST','uri':url[_0xded3('0x3')](_0x3c2632[_0xded3('0x8')],_0xded3('0x9')),'body':{'type':_0x3c2632['ndaactivity_type']||_0xded3('0xa'),'channelId':_0xded3('0xb'),'conversation':{'id':_0x497955[_0xded3('0xc')]},'from':{'id':_0x497955[_0xded3('0xd')],'name':_0x497955['calleridname']},'recipient':{'id':_0x497955[_0xded3('0xe')],'name':_0x497955[_0xded3('0xf')]},'text':_0x3c2632[_0xded3('0x10')],'channelData':{}},'headers':{'Authorization':_0xded3('0x11')+_0x1e93f1[_0xded3('0x12')]},'json':!![]};if(_0x3c2632['project']){_0x432962[_0xded3('0x13')][_0xded3('0x14')][_0xded3('0x15')]=_0x3c2632[_0xded3('0x16')];}if(_0x3c2632[_0xded3('0x17')]=='1'){_0x432962[_0xded3('0x13')][_0xded3('0x14')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xded3('0x18')};}if(_0x3c2632[_0xded3('0x19')]){_0x432962[_0xded3('0x13')]['channelData']['CustomAction']=_0x3c2632['custom_action'];if(_0x3c2632[_0xded3('0x1a')]){_0x432962[_0xded3('0x13')][_0xded3('0x14')][_0xded3('0x1b')]=_0x3c2632[_0xded3('0x1a')];}}logger[_0xded3('0x1c')](JSON[_0xded3('0x1d')](_0x432962));return rp(_0x432962);});};