Built motion from commit a61a4a20.|2.5.46
[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 _0x2ec8=['calleridname','extension','text','Bearer\x20','project','body','ProjectName','ndagenerate_audio','channelData','audio/wav','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','POST','ndauth_url','/token','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid'];(function(_0x13ce64,_0x3a358a){var _0x17820a=function(_0x5b963d){while(--_0x5b963d){_0x13ce64['push'](_0x13ce64['shift']());}};_0x17820a(++_0x3a358a);}(_0x2ec8,0x188));var _0x82ec=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2ec8[_0x3b380d];return _0x54502b;};'use strict';var rp=require(_0x82ec('0x0'));var url=require(_0x82ec('0x1'));var logger=require(_0x82ec('0x2'))(_0x82ec('0x3'));module['exports']=function(_0x21a9db,_0x491d7d){var _0x516fb5={'method':_0x82ec('0x4'),'uri':url['resolve'](_0x491d7d[_0x82ec('0x5')],_0x82ec('0x6')),'form':{'grant_type':'password','username':_0x491d7d['username'],'password':_0x491d7d['password']},'json':!![]};return rp(_0x516fb5)['then'](function(_0x3af0cf){var _0x3ceabc={'method':'POST','uri':url['resolve'](_0x491d7d[_0x82ec('0x7')],_0x82ec('0x8')),'body':{'type':_0x491d7d['ndaactivity_type']||_0x82ec('0x9'),'channelId':_0x82ec('0xa'),'conversation':{'id':_0x21a9db[_0x82ec('0xb')]},'from':{'id':_0x21a9db[_0x82ec('0xc')],'name':_0x21a9db[_0x82ec('0xd')]},'recipient':{'id':_0x21a9db['dnid'],'name':_0x21a9db[_0x82ec('0xe')]},'text':_0x491d7d[_0x82ec('0xf')],'channelData':{}},'headers':{'Authorization':_0x82ec('0x10')+_0x3af0cf['access_token']},'json':!![]};if(_0x491d7d[_0x82ec('0x11')]){_0x3ceabc[_0x82ec('0x12')]['channelData'][_0x82ec('0x13')]=_0x491d7d['project'];}if(_0x491d7d[_0x82ec('0x14')]=='1'){_0x3ceabc[_0x82ec('0x12')][_0x82ec('0x15')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x82ec('0x16')};}if(_0x491d7d['custom_action']){_0x3ceabc[_0x82ec('0x12')][_0x82ec('0x15')]['CustomAction']=_0x491d7d['custom_action'];if(_0x491d7d[_0x82ec('0x17')]){_0x3ceabc[_0x82ec('0x12')][_0x82ec('0x15')][_0x82ec('0x18')]=_0x491d7d[_0x82ec('0x17')];}}logger[_0x82ec('0x19')](JSON[_0x82ec('0x1a')](_0x3ceabc));return rp(_0x3ceabc);});};