885e97eadf40a93e12bcfedd2dd1ac6f4204b878
[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 _0x1d48=['format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','exec','data2','render','data3','error'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x1d48,0x6c));var _0x81d4=function(_0x98f873,_0x14c70d){_0x98f873=_0x98f873-0x0;var _0x52365d=_0x1d48[_0x98f873];return _0x52365d;};'use strict';var util=require(_0x81d4('0x0'));var sh=require(_0x81d4('0x1'));var Mustache=require(_0x81d4('0x2'));var logger=require(_0x81d4('0x3'))('trigger');exports[_0x81d4('0x4')]=function(_0x32a97b,_0x54227d){var _0x409a00=_0x32a97b['data2']?_0x32a97b[_0x81d4('0x5')]:'Script';var _0x31997b=_0x32a97b['data3']?Mustache[_0x81d4('0x6')](_0x32a97b[_0x81d4('0x7')],_0x54227d):_0x54227d;sh['exec'](_0x31997b,function(_0x5e4330,_0x13ac55,_0x3c6920){if(_0x5e4330!==0x0){logger[_0x81d4('0x8')](util[_0x81d4('0x9')](_0x81d4('0xa'),_0x409a00,_0x31997b,_0x5e4330,_0x3c6920));}else{logger[_0x81d4('0xb')](util[_0x81d4('0x9')](_0x81d4('0xc'),_0x409a00,_0x31997b,_0x13ac55));}});};