Built motion from commit ffdca78c.|2.6.24
[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 _0xbdeb=['project','ndagenerate_audio','channelData','AudioOutputSettings','audio/wav','custom_action_data','info','url','agi','POST','/token','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','access_token','body','ProjectName'];(function(_0x54522a,_0x519c28){var _0x57def8=function(_0x2b91eb){while(--_0x2b91eb){_0x54522a['push'](_0x54522a['shift']());}};_0x57def8(++_0x519c28);}(_0xbdeb,0x6f));var _0xbbde=function(_0x156742,_0x6c77b4){_0x156742=_0x156742-0x0;var _0x3bb165=_0xbdeb[_0x156742];return _0x3bb165;};'use strict';var rp=require('request-promise');var url=require(_0xbbde('0x0'));var logger=require('../../../../../config/logger')(_0xbbde('0x1'));module['exports']=function(_0x1279b0,_0x365857){var _0x20d4f0={'method':_0xbbde('0x2'),'uri':url['resolve'](_0x365857['ndauth_url'],_0xbbde('0x3')),'form':{'grant_type':_0xbbde('0x4'),'username':_0x365857[_0xbbde('0x5')],'password':_0x365857[_0xbbde('0x4')]},'json':!![]};return rp(_0x20d4f0)['then'](function(_0x49966c){var _0x3215c9={'method':_0xbbde('0x2'),'uri':url['resolve'](_0x365857[_0xbbde('0x6')],_0xbbde('0x7')),'body':{'type':_0x365857[_0xbbde('0x8')]||_0xbbde('0x9'),'channelId':_0xbbde('0xa'),'conversation':{'id':_0x1279b0[_0xbbde('0xb')]},'from':{'id':_0x1279b0[_0xbbde('0xc')],'name':_0x1279b0[_0xbbde('0xd')]},'recipient':{'id':_0x1279b0[_0xbbde('0xe')],'name':_0x1279b0[_0xbbde('0xf')]},'text':_0x365857['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x49966c[_0xbbde('0x10')]},'json':!![]};if(_0x365857['project']){_0x3215c9[_0xbbde('0x11')]['channelData'][_0xbbde('0x12')]=_0x365857[_0xbbde('0x13')];}if(_0x365857[_0xbbde('0x14')]=='1'){_0x3215c9[_0xbbde('0x11')][_0xbbde('0x15')][_0xbbde('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xbbde('0x17')};}if(_0x365857['custom_action']){_0x3215c9[_0xbbde('0x11')][_0xbbde('0x15')]['CustomAction']=_0x365857['custom_action'];if(_0x365857[_0xbbde('0x18')]){_0x3215c9['body'][_0xbbde('0x15')]['CustomActionData']=_0x365857[_0xbbde('0x18')];}}logger[_0xbbde('0x19')](JSON['stringify'](_0x3215c9));return rp(_0x3215c9);});};