Built motion from commit d32f51f5.|2.6.31
[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 _0x38c3=['body','AudioOutputSettings','audio/wav','custom_action','custom_action_data','info','stringify','request-promise','url','agi','exports','POST','ndauth_url','password','username','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','calleridname','dnid','text','access_token','project','channelData','ProjectName','ndagenerate_audio'];(function(_0x1c34e7,_0x33f9a8){var _0x378cb1=function(_0x10b5e3){while(--_0x10b5e3){_0x1c34e7['push'](_0x1c34e7['shift']());}};_0x378cb1(++_0x33f9a8);}(_0x38c3,0x13d));var _0x338c=function(_0x538bd3,_0x1e3c75){_0x538bd3=_0x538bd3-0x0;var _0x5e2fd7=_0x38c3[_0x538bd3];return _0x5e2fd7;};'use strict';var rp=require(_0x338c('0x0'));var url=require(_0x338c('0x1'));var logger=require('../../../../../config/logger')(_0x338c('0x2'));module[_0x338c('0x3')]=function(_0x36a187,_0x971816){var _0x381963={'method':_0x338c('0x4'),'uri':url['resolve'](_0x971816[_0x338c('0x5')],'/token'),'form':{'grant_type':_0x338c('0x6'),'username':_0x971816[_0x338c('0x7')],'password':_0x971816['password']},'json':!![]};return rp(_0x381963)[_0x338c('0x8')](function(_0x2864c3){var _0x46286d={'method':'POST','uri':url[_0x338c('0x9')](_0x971816[_0x338c('0xa')],_0x338c('0xb')),'body':{'type':_0x971816[_0x338c('0xc')]||_0x338c('0xd'),'channelId':_0x338c('0xe'),'conversation':{'id':_0x36a187[_0x338c('0xf')]},'from':{'id':_0x36a187['callerid'],'name':_0x36a187[_0x338c('0x10')]},'recipient':{'id':_0x36a187[_0x338c('0x11')],'name':_0x36a187['extension']},'text':_0x971816[_0x338c('0x12')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x2864c3[_0x338c('0x13')]},'json':!![]};if(_0x971816[_0x338c('0x14')]){_0x46286d['body'][_0x338c('0x15')][_0x338c('0x16')]=_0x971816[_0x338c('0x14')];}if(_0x971816[_0x338c('0x17')]=='1'){_0x46286d[_0x338c('0x18')][_0x338c('0x15')][_0x338c('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x338c('0x1a')};}if(_0x971816[_0x338c('0x1b')]){_0x46286d[_0x338c('0x18')]['channelData']['CustomAction']=_0x971816[_0x338c('0x1b')];if(_0x971816[_0x338c('0x1c')]){_0x46286d[_0x338c('0x18')][_0x338c('0x15')]['CustomActionData']=_0x971816[_0x338c('0x1c')];}}logger[_0x338c('0x1d')](JSON[_0x338c('0x1e')](_0x46286d));return rp(_0x46286d);});};