Built motion from commit da617fac.|2.6.6
[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 _0xac31=['error','format','info','util','../../../../config/logger','data2','Script','data3','exec'];(function(_0x380b8f,_0x32271d){var _0x646c69=function(_0x57c77f){while(--_0x57c77f){_0x380b8f['push'](_0x380b8f['shift']());}};_0x646c69(++_0x32271d);}(_0xac31,0x16b));var _0x1ac3=function(_0x179b96,_0x74bb85){_0x179b96=_0x179b96-0x0;var _0x52f631=_0xac31[_0x179b96];return _0x52f631;};'use strict';var util=require(_0x1ac3('0x0'));var sh=require('shelljs');var Mustache=require('mustache');var logger=require(_0x1ac3('0x1'))('trigger');exports['exec']=function(_0x213d21,_0x23f139){var _0x56098c=_0x213d21[_0x1ac3('0x2')]?_0x213d21[_0x1ac3('0x2')]:_0x1ac3('0x3');var _0x21e16b=_0x213d21['data3']?Mustache['render'](_0x213d21[_0x1ac3('0x4')],_0x23f139):_0x23f139;sh[_0x1ac3('0x5')](_0x21e16b,function(_0x2b71ce,_0x55298d,_0x30f94a){if(_0x2b71ce!==0x0){logger[_0x1ac3('0x6')](util[_0x1ac3('0x7')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x56098c,_0x21e16b,_0x2b71ce,_0x30f94a));}else{logger[_0x1ac3('0x8')](util[_0x1ac3('0x7')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x56098c,_0x21e16b,_0x55298d));}});};