Built motion from commit 8c034dcd.|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 _0x4483=['CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','exports','POST','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','project','body','ProjectName','ndagenerate_audio','channelData','AudioOutputSettings','custom_action','custom_action_data'];(function(_0x2ce6d5,_0x333e0c){var _0x32d272=function(_0x399f0b){while(--_0x399f0b){_0x2ce6d5['push'](_0x2ce6d5['shift']());}};_0x32d272(++_0x333e0c);}(_0x4483,0x1a3));var _0x3448=function(_0xe1a4cc,_0x52bd93){_0xe1a4cc=_0xe1a4cc-0x0;var _0x35e272=_0x4483[_0xe1a4cc];return _0x35e272;};'use strict';var rp=require(_0x3448('0x0'));var url=require(_0x3448('0x1'));var logger=require(_0x3448('0x2'))('agi');module[_0x3448('0x3')]=function(_0x1fe72d,_0x27ef60){var _0x3a7178={'method':_0x3448('0x4'),'uri':url['resolve'](_0x27ef60[_0x3448('0x5')],_0x3448('0x6')),'form':{'grant_type':_0x3448('0x7'),'username':_0x27ef60[_0x3448('0x8')],'password':_0x27ef60[_0x3448('0x7')]},'json':!![]};return rp(_0x3a7178)[_0x3448('0x9')](function(_0x3cc81d){var _0x34b926={'method':'POST','uri':url['resolve'](_0x27ef60[_0x3448('0xa')],_0x3448('0xb')),'body':{'type':_0x27ef60[_0x3448('0xc')]||_0x3448('0xd'),'channelId':_0x3448('0xe'),'conversation':{'id':_0x1fe72d[_0x3448('0xf')]},'from':{'id':_0x1fe72d[_0x3448('0x10')],'name':_0x1fe72d[_0x3448('0x11')]},'recipient':{'id':_0x1fe72d[_0x3448('0x12')],'name':_0x1fe72d[_0x3448('0x13')]},'text':_0x27ef60[_0x3448('0x14')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x3cc81d['access_token']},'json':!![]};if(_0x27ef60[_0x3448('0x15')]){_0x34b926[_0x3448('0x16')]['channelData'][_0x3448('0x17')]=_0x27ef60[_0x3448('0x15')];}if(_0x27ef60[_0x3448('0x18')]=='1'){_0x34b926['body'][_0x3448('0x19')][_0x3448('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x27ef60[_0x3448('0x1b')]){_0x34b926[_0x3448('0x16')][_0x3448('0x19')]['CustomAction']=_0x27ef60[_0x3448('0x1b')];if(_0x27ef60[_0x3448('0x1c')]){_0x34b926[_0x3448('0x16')][_0x3448('0x19')][_0x3448('0x1d')]=_0x27ef60[_0x3448('0x1c')];}}logger[_0x3448('0x1e')](JSON[_0x3448('0x1f')](_0x34b926));return rp(_0x34b926);});};