Built motion from commit (unavailable).|2.5.11
[motion2.git] / server / api / smsApplication / smsApplication.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 _0xc4f5=['debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x31acd6,_0x22452d){var _0x50178d=function(_0x67c148){while(--_0x67c148){_0x31acd6['push'](_0x31acd6['shift']());}};_0x50178d(++_0x22452d);}(_0xc4f5,0xa5));var _0x5c4f=function(_0x583125,_0x34c12b){_0x583125=_0x583125-0x0;var _0x118c4d=_0xc4f5[_0x583125];return _0x118c4d;};'use strict';var _=require('lodash');var util=require(_0x5c4f('0x0'));var moment=require(_0x5c4f('0x1'));var BPromise=require(_0x5c4f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c4f('0x3'));var db=require(_0x5c4f('0x4'))['db'];var utils=require(_0x5c4f('0x5'));var logger=require(_0x5c4f('0x6'))(_0x5c4f('0x7'));var config=require('../../config/environment');var jayson=require(_0x5c4f('0x8'));var client=jayson[_0x5c4f('0x9')][_0x5c4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x123651,_0x51be50,_0x48f095){return new BPromise(function(_0x1ec0c8,_0x4a7bd4){return client[_0x5c4f('0xb')](_0x123651,_0x48f095)['then'](function(_0x381d46){logger[_0x5c4f('0xc')](_0x5c4f('0xd'),_0x51be50,_0x5c4f('0xe'));logger[_0x5c4f('0xf')](_0x5c4f('0x10'),_0x51be50,_0x5c4f('0xe'),JSON['stringify'](_0x381d46));if(_0x381d46[_0x5c4f('0x11')]){if(_0x381d46[_0x5c4f('0x11')]['code']===0x1f4){logger[_0x5c4f('0x11')](_0x5c4f('0xd'),_0x51be50,_0x381d46[_0x5c4f('0x11')][_0x5c4f('0x12')]);return _0x4a7bd4(_0x381d46[_0x5c4f('0x11')]['message']);}logger['error'](_0x5c4f('0xd'),_0x51be50,_0x381d46[_0x5c4f('0x11')][_0x5c4f('0x12')]);return _0x1ec0c8(_0x381d46[_0x5c4f('0x11')][_0x5c4f('0x12')]);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x51be50,_0x5c4f('0xe'));_0x1ec0c8(_0x381d46['result']['message']);}})[_0x5c4f('0x13')](function(_0x5154eb){logger[_0x5c4f('0x11')](_0x5c4f('0xd'),_0x51be50,_0x5154eb);_0x4a7bd4(_0x5154eb);});});}