Built motion from commit (unavailable).|2.4.20
[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 _0x004c=['/token','username','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','project','body','ProjectName','ndagenerate_audio','AudioOutputSettings','channelData','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url'];(function(_0x25e531,_0x16065c){var _0x429a60=function(_0x1723b7){while(--_0x1723b7){_0x25e531['push'](_0x25e531['shift']());}};_0x429a60(++_0x16065c);}(_0x004c,0xbe));var _0xc004=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x004c[_0x19b3f9];return _0x18c3f6;};'use strict';var rp=require(_0xc004('0x0'));var url=require(_0xc004('0x1'));var logger=require(_0xc004('0x2'))(_0xc004('0x3'));module[_0xc004('0x4')]=function(_0x506ac6,_0xffe3c5){var _0xa2b473={'method':_0xc004('0x5'),'uri':url[_0xc004('0x6')](_0xffe3c5[_0xc004('0x7')],_0xc004('0x8')),'form':{'grant_type':'password','username':_0xffe3c5[_0xc004('0x9')],'password':_0xffe3c5['password']},'json':!![]};return rp(_0xa2b473)[_0xc004('0xa')](function(_0x1eaff2){var _0xe98c45={'method':_0xc004('0x5'),'uri':url[_0xc004('0x6')](_0xffe3c5['ndassistant_url'],_0xc004('0xb')),'body':{'type':_0xffe3c5[_0xc004('0xc')]||_0xc004('0xd'),'channelId':_0xc004('0xe'),'conversation':{'id':_0x506ac6[_0xc004('0xf')]},'from':{'id':_0x506ac6[_0xc004('0x10')],'name':_0x506ac6[_0xc004('0x11')]},'recipient':{'id':_0x506ac6[_0xc004('0x12')],'name':_0x506ac6[_0xc004('0x13')]},'text':_0xffe3c5[_0xc004('0x14')],'channelData':{}},'headers':{'Authorization':_0xc004('0x15')+_0x1eaff2['access_token']},'json':!![]};if(_0xffe3c5[_0xc004('0x16')]){_0xe98c45[_0xc004('0x17')]['channelData'][_0xc004('0x18')]=_0xffe3c5[_0xc004('0x16')];}if(_0xffe3c5[_0xc004('0x19')]=='1'){_0xe98c45['body']['channelData'][_0xc004('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0xffe3c5['custom_action']){_0xe98c45[_0xc004('0x17')][_0xc004('0x1b')][_0xc004('0x1c')]=_0xffe3c5['custom_action'];if(_0xffe3c5[_0xc004('0x1d')]){_0xe98c45['body'][_0xc004('0x1b')][_0xc004('0x1e')]=_0xffe3c5['custom_action_data'];}}logger[_0xc004('0x1f')](JSON[_0xc004('0x20')](_0xe98c45));return rp(_0xe98c45);});};