d7f18eb5decd98bebc24dc43aa495f9f80247ed1
[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 _0x7035=['project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','request-promise','../../../../../config/logger','agi','POST','resolve','/token','password','then','ndaactivity_type','Nda','calleridname','dnid','extension','Bearer\x20'];(function(_0x88435d,_0x1de21c){var _0x30ddcc=function(_0x373259){while(--_0x373259){_0x88435d['push'](_0x88435d['shift']());}};_0x30ddcc(++_0x1de21c);}(_0x7035,0x15e));var _0x5703=function(_0xd4371b,_0x3b2b6e){_0xd4371b=_0xd4371b-0x0;var _0x5e4fa3=_0x7035[_0xd4371b];return _0x5e4fa3;};'use strict';var rp=require(_0x5703('0x0'));var url=require('url');var logger=require(_0x5703('0x1'))(_0x5703('0x2'));module['exports']=function(_0xcc3f27,_0x4183e5){var _0x431dc3={'method':_0x5703('0x3'),'uri':url[_0x5703('0x4')](_0x4183e5['ndauth_url'],_0x5703('0x5')),'form':{'grant_type':_0x5703('0x6'),'username':_0x4183e5['username'],'password':_0x4183e5[_0x5703('0x6')]},'json':!![]};return rp(_0x431dc3)[_0x5703('0x7')](function(_0x401d33){var _0x291988={'method':_0x5703('0x3'),'uri':url[_0x5703('0x4')](_0x4183e5['ndassistant_url'],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x4183e5[_0x5703('0x8')]||'message','channelId':_0x5703('0x9'),'conversation':{'id':_0xcc3f27['uniqueid']},'from':{'id':_0xcc3f27['callerid'],'name':_0xcc3f27[_0x5703('0xa')]},'recipient':{'id':_0xcc3f27[_0x5703('0xb')],'name':_0xcc3f27[_0x5703('0xc')]},'text':_0x4183e5['text'],'channelData':{}},'headers':{'Authorization':_0x5703('0xd')+_0x401d33['access_token']},'json':!![]};if(_0x4183e5[_0x5703('0xe')]){_0x291988[_0x5703('0xf')][_0x5703('0x10')][_0x5703('0x11')]=_0x4183e5[_0x5703('0xe')];}if(_0x4183e5[_0x5703('0x12')]=='1'){_0x291988[_0x5703('0xf')][_0x5703('0x10')][_0x5703('0x13')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x5703('0x14')};}if(_0x4183e5[_0x5703('0x15')]){_0x291988['body'][_0x5703('0x10')][_0x5703('0x16')]=_0x4183e5[_0x5703('0x15')];if(_0x4183e5[_0x5703('0x17')]){_0x291988[_0x5703('0xf')][_0x5703('0x10')][_0x5703('0x18')]=_0x4183e5[_0x5703('0x17')];}}logger[_0x5703('0x19')](JSON['stringify'](_0x291988));return rp(_0x291988);});};