Built motion from commit (unavailable).|2.5.22
[motion2.git] / server / api / openchannelAccount / openchannelAccount.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 _0x392b=['rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','then','debug','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x57e8b9,_0x1087bc){var _0x1cf6d0=function(_0x528343){while(--_0x528343){_0x57e8b9['push'](_0x57e8b9['shift']());}};_0x1cf6d0(++_0x1087bc);}(_0x392b,0x18d));var _0xb392=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x392b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb392('0x0'));var util=require(_0xb392('0x1'));var moment=require(_0xb392('0x2'));var BPromise=require(_0xb392('0x3'));var rs=require(_0xb392('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb392('0x5'))['db'];var utils=require(_0xb392('0x6'));var logger=require(_0xb392('0x7'))(_0xb392('0x8'));var config=require(_0xb392('0x9'));var jayson=require(_0xb392('0xa'));var client=jayson[_0xb392('0xb')][_0xb392('0xc')]({'port':0x232a});config[_0xb392('0xd')]=_['defaults'](config[_0xb392('0xd')],{'host':_0xb392('0xe'),'port':0x18eb});var socket=require(_0xb392('0xf'))(new Redis(config[_0xb392('0xd')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x2b943e,_0x460a06,_0x557681){return new BPromise(function(_0x3d41b1,_0x4e94ca){return client[_0xb392('0x10')](_0x2b943e,_0x557681)[_0xb392('0x11')](function(_0x30af91){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x460a06,'request\x20sent');logger[_0xb392('0x12')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x460a06,'request\x20sent',JSON[_0xb392('0x13')](_0x30af91));if(_0x30af91[_0xb392('0x14')]){if(_0x30af91[_0xb392('0x14')][_0xb392('0x15')]===0x1f4){logger[_0xb392('0x14')](_0xb392('0x16'),_0x460a06,_0x30af91[_0xb392('0x14')]['message']);return _0x4e94ca(_0x30af91[_0xb392('0x14')][_0xb392('0x17')]);}logger[_0xb392('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x460a06,_0x30af91[_0xb392('0x14')][_0xb392('0x17')]);return _0x3d41b1(_0x30af91[_0xb392('0x14')]['message']);}else{logger['info'](_0xb392('0x16'),_0x460a06,_0xb392('0x18'));_0x3d41b1(_0x30af91[_0xb392('0x19')][_0xb392('0x17')]);}})[_0xb392('0x1a')](function(_0x33d605){logger[_0xb392('0x14')](_0xb392('0x16'),_0x460a06,_0x33d605);_0x4e94ca(_0x33d605);});});}