87196aea73ede4f88f7fe9962c98718d6c86b73c
[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 _0x269f=['request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SmsApplication,\x20%s,\x20%s'];(function(_0x28669c,_0x1f62c4){var _0x4a3af6=function(_0x3e25d5){while(--_0x3e25d5){_0x28669c['push'](_0x28669c['shift']());}};_0x4a3af6(++_0x1f62c4);}(_0x269f,0xee));var _0xf269=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x269f[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xf269('0x0'));var util=require(_0xf269('0x1'));var moment=require(_0xf269('0x2'));var BPromise=require('bluebird');var rs=require(_0xf269('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf269('0x4'))['db'];var utils=require(_0xf269('0x5'));var logger=require(_0xf269('0x6'))(_0xf269('0x7'));var config=require(_0xf269('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf269('0x9')][_0xf269('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36d30c,_0x48058a,_0x3ffba3){return new BPromise(function(_0x43c60c,_0x3ef428){return client['request'](_0x36d30c,_0x3ffba3)[_0xf269('0xb')](function(_0x31be8e){logger[_0xf269('0xc')](_0xf269('0xd'),_0x48058a,_0xf269('0xe'));logger[_0xf269('0xf')](_0xf269('0x10'),_0x48058a,_0xf269('0xe'),JSON['stringify'](_0x31be8e));if(_0x31be8e['error']){if(_0x31be8e['error']['code']===0x1f4){logger['error'](_0xf269('0xd'),_0x48058a,_0x31be8e[_0xf269('0x11')][_0xf269('0x12')]);return _0x3ef428(_0x31be8e[_0xf269('0x11')][_0xf269('0x12')]);}logger[_0xf269('0x11')](_0xf269('0xd'),_0x48058a,_0x31be8e[_0xf269('0x11')][_0xf269('0x12')]);return _0x43c60c(_0x31be8e[_0xf269('0x11')][_0xf269('0x12')]);}else{logger[_0xf269('0xc')](_0xf269('0xd'),_0x48058a,_0xf269('0xe'));_0x43c60c(_0x31be8e[_0xf269('0x13')][_0xf269('0x12')]);}})[_0xf269('0x14')](function(_0x2ab68c){logger[_0xf269('0x11')](_0xf269('0xd'),_0x48058a,_0x2ab68c);_0x3ef428(_0x2ab68c);});});}