Built motion from commit f7863d46.|2.5.41
[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 _0x50c1=['uniqueid','callerid','dnid','extension','text','access_token','channelData','ProjectName','project','ndagenerate_audio','body','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','info','stringify','request-promise','agi','exports','POST','resolve','ndauth_url','/token','password','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda'];(function(_0x25f344,_0x12398e){var _0xaf131f=function(_0x537176){while(--_0x537176){_0x25f344['push'](_0x25f344['shift']());}};_0xaf131f(++_0x12398e);}(_0x50c1,0x1a5));var _0x150c=function(_0x348751,_0x5de3cb){_0x348751=_0x348751-0x0;var _0x4675bc=_0x50c1[_0x348751];return _0x4675bc;};'use strict';var rp=require(_0x150c('0x0'));var url=require('url');var logger=require('../../../../../config/logger')(_0x150c('0x1'));module[_0x150c('0x2')]=function(_0xef6612,_0x1f68cd){var _0x24cd1b={'method':_0x150c('0x3'),'uri':url[_0x150c('0x4')](_0x1f68cd[_0x150c('0x5')],_0x150c('0x6')),'form':{'grant_type':'password','username':_0x1f68cd['username'],'password':_0x1f68cd[_0x150c('0x7')]},'json':!![]};return rp(_0x24cd1b)['then'](function(_0x5b10b4){var _0xb16344={'method':_0x150c('0x3'),'uri':url[_0x150c('0x4')](_0x1f68cd[_0x150c('0x8')],_0x150c('0x9')),'body':{'type':_0x1f68cd[_0x150c('0xa')]||_0x150c('0xb'),'channelId':_0x150c('0xc'),'conversation':{'id':_0xef6612[_0x150c('0xd')]},'from':{'id':_0xef6612[_0x150c('0xe')],'name':_0xef6612['calleridname']},'recipient':{'id':_0xef6612[_0x150c('0xf')],'name':_0xef6612[_0x150c('0x10')]},'text':_0x1f68cd[_0x150c('0x11')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x5b10b4[_0x150c('0x12')]},'json':!![]};if(_0x1f68cd['project']){_0xb16344['body'][_0x150c('0x13')][_0x150c('0x14')]=_0x1f68cd[_0x150c('0x15')];}if(_0x1f68cd[_0x150c('0x16')]=='1'){_0xb16344[_0x150c('0x17')][_0x150c('0x13')][_0x150c('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x150c('0x19')};}if(_0x1f68cd[_0x150c('0x1a')]){_0xb16344[_0x150c('0x17')][_0x150c('0x13')][_0x150c('0x1b')]=_0x1f68cd['custom_action'];if(_0x1f68cd[_0x150c('0x1c')]){_0xb16344['body'][_0x150c('0x13')]['CustomActionData']=_0x1f68cd['custom_action_data'];}}logger[_0x150c('0x1d')](JSON[_0x150c('0x1e')](_0xb16344));return rp(_0xb16344);});};