Built motion from commit (unavailable).|2.4.17
[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 _0x6347=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SmsApplication,\x20%s,\x20%s','message','info'];(function(_0x253d2b,_0x49a0fb){var _0x3ce8bd=function(_0x3fcafe){while(--_0x3fcafe){_0x253d2b['push'](_0x253d2b['shift']());}};_0x3ce8bd(++_0x49a0fb);}(_0x6347,0x1c9));var _0x7634=function(_0x30a933,_0x14ff58){_0x30a933=_0x30a933-0x0;var _0x1ee97c=_0x6347[_0x30a933];return _0x1ee97c;};'use strict';var _=require(_0x7634('0x0'));var util=require(_0x7634('0x1'));var moment=require('moment');var BPromise=require(_0x7634('0x2'));var rs=require(_0x7634('0x3'));var fs=require('fs');var Redis=require(_0x7634('0x4'));var db=require(_0x7634('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7634('0x6'))('rpc');var config=require(_0x7634('0x7'));var jayson=require(_0x7634('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xa1f11a,_0x186db8,_0x33eb7e){return new BPromise(function(_0x453e4b,_0x37dc47){return client[_0x7634('0x9')](_0xa1f11a,_0x33eb7e)['then'](function(_0x3e8332){logger['info']('SmsApplication,\x20%s,\x20%s',_0x186db8,'request\x20sent');logger[_0x7634('0xa')](_0x7634('0xb'),_0x186db8,_0x7634('0xc'),JSON[_0x7634('0xd')](_0x3e8332));if(_0x3e8332[_0x7634('0xe')]){if(_0x3e8332['error']['code']===0x1f4){logger[_0x7634('0xe')](_0x7634('0xf'),_0x186db8,_0x3e8332[_0x7634('0xe')][_0x7634('0x10')]);return _0x37dc47(_0x3e8332[_0x7634('0xe')][_0x7634('0x10')]);}logger[_0x7634('0xe')](_0x7634('0xf'),_0x186db8,_0x3e8332['error'][_0x7634('0x10')]);return _0x453e4b(_0x3e8332[_0x7634('0xe')][_0x7634('0x10')]);}else{logger[_0x7634('0x11')]('SmsApplication,\x20%s,\x20%s',_0x186db8,_0x7634('0xc'));_0x453e4b(_0x3e8332['result'][_0x7634('0x10')]);}})[_0x7634('0x12')](function(_0x3b74da){logger[_0x7634('0xe')](_0x7634('0xf'),_0x186db8,_0x3b74da);_0x37dc47(_0x3b74da);});});}