Built motion from commit f7863d46.|2.5.41
[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 _0x0ac0=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0ac0,0x130));var _0x00ac=function(_0x30faec,_0x18940b){_0x30faec=_0x30faec-0x0;var _0x29484f=_0x0ac0[_0x30faec];return _0x29484f;};'use strict';var _=require(_0x00ac('0x0'));var util=require(_0x00ac('0x1'));var moment=require(_0x00ac('0x2'));var BPromise=require('bluebird');var rs=require(_0x00ac('0x3'));var fs=require('fs');var Redis=require(_0x00ac('0x4'));var db=require(_0x00ac('0x5'))['db'];var utils=require(_0x00ac('0x6'));var logger=require(_0x00ac('0x7'))(_0x00ac('0x8'));var config=require(_0x00ac('0x9'));var jayson=require(_0x00ac('0xa'));var client=jayson['client'][_0x00ac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa2a17e,_0x3546f0,_0x282faa){return new BPromise(function(_0x4427de,_0x121a9e){return client[_0x00ac('0xc')](_0xa2a17e,_0x282faa)['then'](function(_0x48c47e){logger[_0x00ac('0xd')](_0x00ac('0xe'),_0x3546f0,_0x00ac('0xf'));logger[_0x00ac('0x10')](_0x00ac('0x11'),_0x3546f0,'request\x20sent',JSON[_0x00ac('0x12')](_0x48c47e));if(_0x48c47e['error']){if(_0x48c47e[_0x00ac('0x13')]['code']===0x1f4){logger[_0x00ac('0x13')](_0x00ac('0xe'),_0x3546f0,_0x48c47e[_0x00ac('0x13')][_0x00ac('0x14')]);return _0x121a9e(_0x48c47e['error']['message']);}logger[_0x00ac('0x13')]('SmsApplication,\x20%s,\x20%s',_0x3546f0,_0x48c47e['error'][_0x00ac('0x14')]);return _0x4427de(_0x48c47e[_0x00ac('0x13')]['message']);}else{logger[_0x00ac('0xd')]('SmsApplication,\x20%s,\x20%s',_0x3546f0,'request\x20sent');_0x4427de(_0x48c47e[_0x00ac('0x15')][_0x00ac('0x14')]);}})['catch'](function(_0x66e4ba){logger[_0x00ac('0x13')](_0x00ac('0xe'),_0x3546f0,_0x66e4ba);_0x121a9e(_0x66e4ba);});});}