Built motion from commit 71df090e.|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 _0xab3a=['custom_action_data','info','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','dnid','extension','text','Bearer\x20','project','channelData','ndagenerate_audio','body','AudioOutputSettings','audio/wav','CustomAction','CustomActionData'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab3a,0x1d3));var _0xaab3=function(_0x4a6992,_0x15fed3){_0x4a6992=_0x4a6992-0x0;var _0x5cbaee=_0xab3a[_0x4a6992];return _0x5cbaee;};'use strict';var rp=require(_0xaab3('0x0'));var url=require(_0xaab3('0x1'));var logger=require(_0xaab3('0x2'))(_0xaab3('0x3'));module[_0xaab3('0x4')]=function(_0x19399d,_0x4065be){var _0x545929={'method':_0xaab3('0x5'),'uri':url[_0xaab3('0x6')](_0x4065be[_0xaab3('0x7')],_0xaab3('0x8')),'form':{'grant_type':_0xaab3('0x9'),'username':_0x4065be['username'],'password':_0x4065be['password']},'json':!![]};return rp(_0x545929)[_0xaab3('0xa')](function(_0x1fd19f){var _0x146453={'method':_0xaab3('0x5'),'uri':url[_0xaab3('0x6')](_0x4065be[_0xaab3('0xb')],_0xaab3('0xc')),'body':{'type':_0x4065be[_0xaab3('0xd')]||_0xaab3('0xe'),'channelId':_0xaab3('0xf'),'conversation':{'id':_0x19399d[_0xaab3('0x10')]},'from':{'id':_0x19399d['callerid'],'name':_0x19399d['calleridname']},'recipient':{'id':_0x19399d[_0xaab3('0x11')],'name':_0x19399d[_0xaab3('0x12')]},'text':_0x4065be[_0xaab3('0x13')],'channelData':{}},'headers':{'Authorization':_0xaab3('0x14')+_0x1fd19f['access_token']},'json':!![]};if(_0x4065be[_0xaab3('0x15')]){_0x146453['body'][_0xaab3('0x16')]['ProjectName']=_0x4065be[_0xaab3('0x15')];}if(_0x4065be[_0xaab3('0x17')]=='1'){_0x146453[_0xaab3('0x18')]['channelData'][_0xaab3('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xaab3('0x1a')};}if(_0x4065be['custom_action']){_0x146453[_0xaab3('0x18')][_0xaab3('0x16')][_0xaab3('0x1b')]=_0x4065be['custom_action'];if(_0x4065be['custom_action_data']){_0x146453['body']['channelData'][_0xaab3('0x1c')]=_0x4065be[_0xaab3('0x1d')];}}logger[_0xaab3('0x1e')](JSON['stringify'](_0x146453));return rp(_0x146453);});};