Built motion from commit (unavailable).|2.5.24
[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 _0xfc76=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x31c0e5,_0x472b48){var _0x16dce4=function(_0x3fe675){while(--_0x3fe675){_0x31c0e5['push'](_0x31c0e5['shift']());}};_0x16dce4(++_0x472b48);}(_0xfc76,0xb5));var _0x6fc7=function(_0xbf924e,_0xdc5d35){_0xbf924e=_0xbf924e-0x0;var _0xabcb7a=_0xfc76[_0xbf924e];return _0xabcb7a;};'use strict';var _=require('lodash');var util=require(_0x6fc7('0x0'));var moment=require(_0x6fc7('0x1'));var BPromise=require(_0x6fc7('0x2'));var rs=require(_0x6fc7('0x3'));var fs=require('fs');var Redis=require(_0x6fc7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6fc7('0x5'));var logger=require(_0x6fc7('0x6'))('rpc');var config=require(_0x6fc7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6fc7('0x8')][_0x6fc7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x385a5a,_0x4da7c3,_0x21a64d){return new BPromise(function(_0x407b0a,_0x347c00){return client[_0x6fc7('0xa')](_0x385a5a,_0x21a64d)[_0x6fc7('0xb')](function(_0x23d12f){logger['info'](_0x6fc7('0xc'),_0x4da7c3,_0x6fc7('0xd'));logger[_0x6fc7('0xe')](_0x6fc7('0xf'),_0x4da7c3,_0x6fc7('0xd'),JSON[_0x6fc7('0x10')](_0x23d12f));if(_0x23d12f['error']){if(_0x23d12f[_0x6fc7('0x11')][_0x6fc7('0x12')]===0x1f4){logger['error'](_0x6fc7('0xc'),_0x4da7c3,_0x23d12f[_0x6fc7('0x11')]['message']);return _0x347c00(_0x23d12f[_0x6fc7('0x11')][_0x6fc7('0x13')]);}logger['error'](_0x6fc7('0xc'),_0x4da7c3,_0x23d12f[_0x6fc7('0x11')][_0x6fc7('0x13')]);return _0x407b0a(_0x23d12f['error']['message']);}else{logger[_0x6fc7('0x14')](_0x6fc7('0xc'),_0x4da7c3,'request\x20sent');_0x407b0a(_0x23d12f[_0x6fc7('0x15')][_0x6fc7('0x13')]);}})[_0x6fc7('0x16')](function(_0x41269a){logger['error'](_0x6fc7('0xc'),_0x4da7c3,_0x41269a);_0x347c00(_0x41269a);});});}