Built motion from commit c738b9ac.|2.6.25
[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 _0x8d53=['calleridname','dnid','Bearer\x20','access_token','body','ProjectName','project','ndagenerate_audio','channelData','AudioOutputSettings','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','agi','exports','POST','resolve','ndauth_url','password','username','ndassistant_url','ndaactivity_type','message','uniqueid','callerid'];(function(_0x4ab2a8,_0xe36a6e){var _0x1537e2=function(_0x2fc2cb){while(--_0x2fc2cb){_0x4ab2a8['push'](_0x4ab2a8['shift']());}};_0x1537e2(++_0xe36a6e);}(_0x8d53,0x1c2));var _0x38d5=function(_0x56d20e,_0x217c31){_0x56d20e=_0x56d20e-0x0;var _0x18b27a=_0x8d53[_0x56d20e];return _0x18b27a;};'use strict';var rp=require(_0x38d5('0x0'));var url=require(_0x38d5('0x1'));var logger=require('../../../../../config/logger')(_0x38d5('0x2'));module[_0x38d5('0x3')]=function(_0x108137,_0x453bf8){var _0x3a7660={'method':_0x38d5('0x4'),'uri':url[_0x38d5('0x5')](_0x453bf8[_0x38d5('0x6')],'/token'),'form':{'grant_type':_0x38d5('0x7'),'username':_0x453bf8[_0x38d5('0x8')],'password':_0x453bf8[_0x38d5('0x7')]},'json':!![]};return rp(_0x3a7660)['then'](function(_0x5ebf9a){var _0x284f7b={'method':_0x38d5('0x4'),'uri':url[_0x38d5('0x5')](_0x453bf8[_0x38d5('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x453bf8[_0x38d5('0xa')]||_0x38d5('0xb'),'channelId':'Nda','conversation':{'id':_0x108137[_0x38d5('0xc')]},'from':{'id':_0x108137[_0x38d5('0xd')],'name':_0x108137[_0x38d5('0xe')]},'recipient':{'id':_0x108137[_0x38d5('0xf')],'name':_0x108137['extension']},'text':_0x453bf8['text'],'channelData':{}},'headers':{'Authorization':_0x38d5('0x10')+_0x5ebf9a[_0x38d5('0x11')]},'json':!![]};if(_0x453bf8['project']){_0x284f7b[_0x38d5('0x12')]['channelData'][_0x38d5('0x13')]=_0x453bf8[_0x38d5('0x14')];}if(_0x453bf8[_0x38d5('0x15')]=='1'){_0x284f7b[_0x38d5('0x12')][_0x38d5('0x16')][_0x38d5('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x453bf8[_0x38d5('0x18')]){_0x284f7b['body'][_0x38d5('0x16')]['CustomAction']=_0x453bf8[_0x38d5('0x18')];if(_0x453bf8[_0x38d5('0x19')]){_0x284f7b[_0x38d5('0x12')]['channelData'][_0x38d5('0x1a')]=_0x453bf8[_0x38d5('0x19')];}}logger[_0x38d5('0x1b')](JSON[_0x38d5('0x1c')](_0x284f7b));return rp(_0x284f7b);});};