255baa9ee2a4354de785a9842e941e1fa6c5a037
[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 _0x85f8=['jayson/promise','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x85f8,0xd7));var _0x885f=function(_0x22d92f,_0x476749){_0x22d92f=_0x22d92f-0x0;var _0x46962a=_0x85f8[_0x22d92f];return _0x46962a;};'use strict';var _=require(_0x885f('0x0'));var util=require(_0x885f('0x1'));var moment=require(_0x885f('0x2'));var BPromise=require(_0x885f('0x3'));var rs=require(_0x885f('0x4'));var fs=require('fs');var Redis=require(_0x885f('0x5'));var db=require(_0x885f('0x6'))['db'];var utils=require(_0x885f('0x7'));var logger=require('../../config/logger')(_0x885f('0x8'));var config=require(_0x885f('0x9'));var jayson=require(_0x885f('0xa'));var client=jayson['client'][_0x885f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x270c84,_0x38da33,_0xc3ac){return new BPromise(function(_0x35e2be,_0x188593){return client[_0x885f('0xc')](_0x270c84,_0xc3ac)[_0x885f('0xd')](function(_0xece628){logger[_0x885f('0xe')](_0x885f('0xf'),_0x38da33,_0x885f('0x10'));logger[_0x885f('0x11')](_0x885f('0x12'),_0x38da33,'request\x20sent',JSON[_0x885f('0x13')](_0xece628));if(_0xece628[_0x885f('0x14')]){if(_0xece628[_0x885f('0x14')][_0x885f('0x15')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x38da33,_0xece628['error'][_0x885f('0x16')]);return _0x188593(_0xece628[_0x885f('0x14')][_0x885f('0x16')]);}logger['error'](_0x885f('0xf'),_0x38da33,_0xece628[_0x885f('0x14')][_0x885f('0x16')]);return _0x35e2be(_0xece628[_0x885f('0x14')][_0x885f('0x16')]);}else{logger[_0x885f('0xe')](_0x885f('0xf'),_0x38da33,'request\x20sent');_0x35e2be(_0xece628[_0x885f('0x17')][_0x885f('0x16')]);}})[_0x885f('0x18')](function(_0x3b05a3){logger[_0x885f('0x14')](_0x885f('0xf'),_0x38da33,_0x3b05a3);_0x188593(_0x3b05a3);});});}