efadbeb6b71d9277cdf2536c95f530fd49aab85e
[motion2.git] / server / services / ami / trigger / script / 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 _0xe096=['data2','Script','data3','exec','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','mustache'];(function(_0x457264,_0x410cbc){var _0x145375=function(_0x2015b8){while(--_0x2015b8){_0x457264['push'](_0x457264['shift']());}};_0x145375(++_0x410cbc);}(_0xe096,0x8a));var _0x6e09=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0xe096[_0x4ae829];return _0x256b31;};'use strict';var util=require(_0x6e09('0x0'));var sh=require('shelljs');var Mustache=require(_0x6e09('0x1'));var logger=require('../../../../config/logger')('trigger');exports['exec']=function(_0x417653,_0x3df3b5){var _0x3e5100=_0x417653[_0x6e09('0x2')]?_0x417653[_0x6e09('0x2')]:_0x6e09('0x3');var _0x1a0f23=_0x417653[_0x6e09('0x4')]?Mustache['render'](_0x417653[_0x6e09('0x4')],_0x3df3b5):_0x3df3b5;sh[_0x6e09('0x5')](_0x1a0f23,function(_0xaf09d3,_0x17d3ce,_0x291a07){if(_0xaf09d3!==0x0){logger[_0x6e09('0x6')](util['format'](_0x6e09('0x7'),_0x3e5100,_0x1a0f23,_0xaf09d3,_0x291a07));}else{logger['info'](util[_0x6e09('0x8')](_0x6e09('0x9'),_0x3e5100,_0x1a0f23,_0x17d3ce));}});};