Built motion from commit (unavailable).|2.5.4
[motion2.git] / server / api / cannedAnswer / cannedAnswer.rpc.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 _0xf17a=['info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xf17a,0xe5));var _0xaf17=function(_0x1f59b1,_0x1711ec){_0x1f59b1=_0x1f59b1-0x0;var _0x571da6=_0xf17a[_0x1f59b1];return _0x571da6;};'use strict';var _=require(_0xaf17('0x0'));var util=require('util');var moment=require(_0xaf17('0x1'));var BPromise=require(_0xaf17('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaf17('0x3'));var db=require(_0xaf17('0x4'))['db'];var utils=require(_0xaf17('0x5'));var logger=require(_0xaf17('0x6'))(_0xaf17('0x7'));var config=require(_0xaf17('0x8'));var jayson=require(_0xaf17('0x9'));var client=jayson['client'][_0xaf17('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4653ab,_0x5cd94b,_0x188ae2){return new BPromise(function(_0x450f78,_0x3f1d78){return client[_0xaf17('0xb')](_0x4653ab,_0x188ae2)[_0xaf17('0xc')](function(_0x8e2df6){logger[_0xaf17('0xd')](_0xaf17('0xe'),_0x5cd94b,_0xaf17('0xf'));logger[_0xaf17('0x10')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x5cd94b,_0xaf17('0xf'),JSON[_0xaf17('0x11')](_0x8e2df6));if(_0x8e2df6[_0xaf17('0x12')]){if(_0x8e2df6[_0xaf17('0x12')][_0xaf17('0x13')]===0x1f4){logger[_0xaf17('0x12')](_0xaf17('0xe'),_0x5cd94b,_0x8e2df6[_0xaf17('0x12')][_0xaf17('0x14')]);return _0x3f1d78(_0x8e2df6[_0xaf17('0x12')][_0xaf17('0x14')]);}logger[_0xaf17('0x12')]('CannedAnswer,\x20%s,\x20%s',_0x5cd94b,_0x8e2df6[_0xaf17('0x12')][_0xaf17('0x14')]);return _0x450f78(_0x8e2df6[_0xaf17('0x12')][_0xaf17('0x14')]);}else{logger[_0xaf17('0xd')](_0xaf17('0xe'),_0x5cd94b,_0xaf17('0xf'));_0x450f78(_0x8e2df6['result'][_0xaf17('0x14')]);}})[_0xaf17('0x15')](function(_0x3a1eb3){logger[_0xaf17('0x12')]('CannedAnswer,\x20%s,\x20%s',_0x5cd94b,_0x3a1eb3);_0x3f1d78(_0x3a1eb3);});});}