Built motion from commit ce9a7520.|2.5.39
[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 _0xa0a3=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','util','moment','randomstring','ioredis'];(function(_0x126c69,_0x7fc83a){var _0x588f87=function(_0x2c1bc0){while(--_0x2c1bc0){_0x126c69['push'](_0x126c69['shift']());}};_0x588f87(++_0x7fc83a);}(_0xa0a3,0x1e0));var _0x3a0a=function(_0x344071,_0x30e01d){_0x344071=_0x344071-0x0;var _0x977c20=_0xa0a3[_0x344071];return _0x977c20;};'use strict';var _=require('lodash');var util=require(_0x3a0a('0x0'));var moment=require(_0x3a0a('0x1'));var BPromise=require('bluebird');var rs=require(_0x3a0a('0x2'));var fs=require('fs');var Redis=require(_0x3a0a('0x3'));var db=require(_0x3a0a('0x4'))['db'];var utils=require(_0x3a0a('0x5'));var logger=require(_0x3a0a('0x6'))(_0x3a0a('0x7'));var config=require(_0x3a0a('0x8'));var jayson=require(_0x3a0a('0x9'));var client=jayson[_0x3a0a('0xa')][_0x3a0a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4719d,_0x451873,_0x1766c1){return new BPromise(function(_0x5d98d3,_0x56ee1b){return client[_0x3a0a('0xc')](_0x4719d,_0x1766c1)[_0x3a0a('0xd')](function(_0x29207e){logger[_0x3a0a('0xe')](_0x3a0a('0xf'),_0x451873,_0x3a0a('0x10'));logger[_0x3a0a('0x11')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x451873,'request\x20sent',JSON[_0x3a0a('0x12')](_0x29207e));if(_0x29207e[_0x3a0a('0x13')]){if(_0x29207e['error']['code']===0x1f4){logger[_0x3a0a('0x13')](_0x3a0a('0xf'),_0x451873,_0x29207e['error'][_0x3a0a('0x14')]);return _0x56ee1b(_0x29207e[_0x3a0a('0x13')][_0x3a0a('0x14')]);}logger[_0x3a0a('0x13')](_0x3a0a('0xf'),_0x451873,_0x29207e[_0x3a0a('0x13')][_0x3a0a('0x14')]);return _0x5d98d3(_0x29207e[_0x3a0a('0x13')][_0x3a0a('0x14')]);}else{logger[_0x3a0a('0xe')](_0x3a0a('0xf'),_0x451873,_0x3a0a('0x10'));_0x5d98d3(_0x29207e[_0x3a0a('0x15')][_0x3a0a('0x14')]);}})['catch'](function(_0x41a6b0){logger['error'](_0x3a0a('0xf'),_0x451873,_0x41a6b0);_0x56ee1b(_0x41a6b0);});});}