aa030ceef29aa6ed60b599e5840384bc7a8e746b
[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 _0xdb7e=['SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4d23b0,_0x395bc6){var _0x8dd2b9=function(_0x19a698){while(--_0x19a698){_0x4d23b0['push'](_0x4d23b0['shift']());}};_0x8dd2b9(++_0x395bc6);}(_0xdb7e,0x11a));var _0xedb7=function(_0x352cec,_0x361ca1){_0x352cec=_0x352cec-0x0;var _0xd52d14=_0xdb7e[_0x352cec];return _0xd52d14;};'use strict';var _=require(_0xedb7('0x0'));var util=require(_0xedb7('0x1'));var moment=require(_0xedb7('0x2'));var BPromise=require('bluebird');var rs=require(_0xedb7('0x3'));var fs=require('fs');var Redis=require(_0xedb7('0x4'));var db=require(_0xedb7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xedb7('0x6'))(_0xedb7('0x7'));var config=require(_0xedb7('0x8'));var jayson=require(_0xedb7('0x9'));var client=jayson[_0xedb7('0xa')][_0xedb7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x87bf4b,_0x20a7c7,_0x26774f){return new BPromise(function(_0x2ae0f7,_0x5a8650){return client[_0xedb7('0xc')](_0x87bf4b,_0x26774f)[_0xedb7('0xd')](function(_0x12c7ba){logger[_0xedb7('0xe')](_0xedb7('0xf'),_0x20a7c7,_0xedb7('0x10'));logger[_0xedb7('0x11')](_0xedb7('0x12'),_0x20a7c7,_0xedb7('0x10'),JSON[_0xedb7('0x13')](_0x12c7ba));if(_0x12c7ba[_0xedb7('0x14')]){if(_0x12c7ba[_0xedb7('0x14')][_0xedb7('0x15')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x20a7c7,_0x12c7ba[_0xedb7('0x14')][_0xedb7('0x16')]);return _0x5a8650(_0x12c7ba[_0xedb7('0x14')][_0xedb7('0x16')]);}logger[_0xedb7('0x14')](_0xedb7('0xf'),_0x20a7c7,_0x12c7ba[_0xedb7('0x14')][_0xedb7('0x16')]);return _0x2ae0f7(_0x12c7ba[_0xedb7('0x14')]['message']);}else{logger['info'](_0xedb7('0xf'),_0x20a7c7,_0xedb7('0x10'));_0x2ae0f7(_0x12c7ba[_0xedb7('0x17')]['message']);}})[_0xedb7('0x18')](function(_0x3ce7c5){logger[_0xedb7('0x14')](_0xedb7('0xf'),_0x20a7c7,_0x3ce7c5);_0x5a8650(_0x3ce7c5);});});}