Built motion from commit (unavailable).|2.5.14
[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 _0xbfe8=['stringify','error','message','result','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s'];(function(_0x584985,_0x31a01f){var _0x123c16=function(_0x54ae33){while(--_0x54ae33){_0x584985['push'](_0x584985['shift']());}};_0x123c16(++_0x31a01f);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x580d3a,_0x529919){_0x580d3a=_0x580d3a-0x0;var _0x2484d8=_0xbfe8[_0x580d3a];return _0x2484d8;};'use strict';var _=require('lodash');var util=require(_0x8bfe('0x0'));var moment=require('moment');var BPromise=require(_0x8bfe('0x1'));var rs=require(_0x8bfe('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8bfe('0x3'));var logger=require(_0x8bfe('0x4'))('rpc');var config=require(_0x8bfe('0x5'));var jayson=require(_0x8bfe('0x6'));var client=jayson[_0x8bfe('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29bb94,_0x1b7dbd,_0x3e3075){return new BPromise(function(_0x4602fc,_0x5d4e54){return client[_0x8bfe('0x8')](_0x29bb94,_0x3e3075)[_0x8bfe('0x9')](function(_0x147c65){logger[_0x8bfe('0xa')](_0x8bfe('0xb'),_0x1b7dbd,_0x8bfe('0xc'));logger[_0x8bfe('0xd')](_0x8bfe('0xe'),_0x1b7dbd,_0x8bfe('0xc'),JSON[_0x8bfe('0xf')](_0x147c65));if(_0x147c65['error']){if(_0x147c65[_0x8bfe('0x10')]['code']===0x1f4){logger[_0x8bfe('0x10')](_0x8bfe('0xb'),_0x1b7dbd,_0x147c65[_0x8bfe('0x10')]['message']);return _0x5d4e54(_0x147c65['error'][_0x8bfe('0x11')]);}logger[_0x8bfe('0x10')](_0x8bfe('0xb'),_0x1b7dbd,_0x147c65[_0x8bfe('0x10')][_0x8bfe('0x11')]);return _0x4602fc(_0x147c65['error'][_0x8bfe('0x11')]);}else{logger[_0x8bfe('0xa')]('SmsApplication,\x20%s,\x20%s',_0x1b7dbd,_0x8bfe('0xc'));_0x4602fc(_0x147c65[_0x8bfe('0x12')][_0x8bfe('0x11')]);}})['catch'](function(_0x4efb72){logger[_0x8bfe('0x10')]('SmsApplication,\x20%s,\x20%s',_0x1b7dbd,_0x4efb72);_0x5d4e54(_0x4efb72);});});}