Built motion from commit (unavailable).|2.4.18
[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 _0x676d=['POST','password','username','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','dnid','extension','access_token','body','channelData','ProjectName','project','ndagenerate_audio','AudioOutputSettings','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','../../../../../config/logger','agi','exports'];(function(_0x1c4ff8,_0x28faf8){var _0xe7bae7=function(_0x5a45f9){while(--_0x5a45f9){_0x1c4ff8['push'](_0x1c4ff8['shift']());}};_0xe7bae7(++_0x28faf8);}(_0x676d,0x97));var _0xd676=function(_0x58e3ae,_0x2a8941){_0x58e3ae=_0x58e3ae-0x0;var _0x2f93b4=_0x676d[_0x58e3ae];return _0x2f93b4;};'use strict';var rp=require(_0xd676('0x0'));var url=require('url');var logger=require(_0xd676('0x1'))(_0xd676('0x2'));module[_0xd676('0x3')]=function(_0x3cc0e2,_0x5d604a){var _0x2ef0e1={'method':_0xd676('0x4'),'uri':url['resolve'](_0x5d604a['ndauth_url'],'/token'),'form':{'grant_type':_0xd676('0x5'),'username':_0x5d604a[_0xd676('0x6')],'password':_0x5d604a['password']},'json':!![]};return rp(_0x2ef0e1)[_0xd676('0x7')](function(_0x249519){var _0x2df0d6={'method':_0xd676('0x4'),'uri':url[_0xd676('0x8')](_0x5d604a[_0xd676('0x9')],_0xd676('0xa')),'body':{'type':_0x5d604a[_0xd676('0xb')]||_0xd676('0xc'),'channelId':_0xd676('0xd'),'conversation':{'id':_0x3cc0e2[_0xd676('0xe')]},'from':{'id':_0x3cc0e2[_0xd676('0xf')],'name':_0x3cc0e2['calleridname']},'recipient':{'id':_0x3cc0e2[_0xd676('0x10')],'name':_0x3cc0e2[_0xd676('0x11')]},'text':_0x5d604a['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x249519[_0xd676('0x12')]},'json':!![]};if(_0x5d604a['project']){_0x2df0d6[_0xd676('0x13')][_0xd676('0x14')][_0xd676('0x15')]=_0x5d604a[_0xd676('0x16')];}if(_0x5d604a[_0xd676('0x17')]=='1'){_0x2df0d6[_0xd676('0x13')][_0xd676('0x14')][_0xd676('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x5d604a[_0xd676('0x19')]){_0x2df0d6[_0xd676('0x13')]['channelData'][_0xd676('0x1a')]=_0x5d604a['custom_action'];if(_0x5d604a[_0xd676('0x1b')]){_0x2df0d6[_0xd676('0x13')]['channelData'][_0xd676('0x1c')]=_0x5d604a[_0xd676('0x1b')];}}logger[_0xd676('0x1d')](JSON[_0xd676('0x1e')](_0x2df0d6));return rp(_0x2df0d6);});};