Built motion from commit (unavailable).|2.0.82
[motion2.git] / server / api / voicePrefix / voicePrefix.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 _0x6da2=['request\x20sent','debug','stringify','error','message','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','socket.io-emitter','localhost','register','request','then','info','VoicePrefix,\x20%s,\x20%s'];(function(_0x3dd0cb,_0x2e82af){var _0x192adc=function(_0xdb644d){while(--_0xdb644d){_0x3dd0cb['push'](_0x3dd0cb['shift']());}};_0x192adc(++_0x2e82af);}(_0x6da2,0x195));var _0x26da=function(_0x392e1d,_0x125aed){_0x392e1d=_0x392e1d-0x0;var _0x486d9b=_0x6da2[_0x392e1d];return _0x486d9b;};'use strict';var _=require(_0x26da('0x0'));var util=require('util');var moment=require(_0x26da('0x1'));var BPromise=require(_0x26da('0x2'));var rs=require(_0x26da('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x26da('0x4'));var logger=require(_0x26da('0x5'))(_0x26da('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x26da('0x7')]['http']({'port':0x232a});var socket=require(_0x26da('0x8'))({'host':_0x26da('0x9'),'port':0x18eb});require('./voicePrefix.socket')[_0x26da('0xa')](socket);function respondWithRpcPromise(_0xc697c,_0x4c710a,_0x4b6a0c){return new BPromise(function(_0x3857f2,_0x538f38){return client[_0x26da('0xb')](_0xc697c,_0x4b6a0c)[_0x26da('0xc')](function(_0x52adce){logger[_0x26da('0xd')](_0x26da('0xe'),_0x4c710a,_0x26da('0xf'));logger[_0x26da('0x10')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x4c710a,_0x26da('0xf'),JSON[_0x26da('0x11')](_0x52adce));if(_0x52adce[_0x26da('0x12')]){if(_0x52adce['error']['code']===0x1f4){logger[_0x26da('0x12')](_0x26da('0xe'),_0x4c710a,_0x52adce[_0x26da('0x12')][_0x26da('0x13')]);return _0x538f38(_0x52adce[_0x26da('0x12')][_0x26da('0x13')]);}logger[_0x26da('0x12')](_0x26da('0xe'),_0x4c710a,_0x52adce['error']['message']);return _0x3857f2(_0x52adce[_0x26da('0x12')][_0x26da('0x13')]);}else{logger[_0x26da('0xd')](_0x26da('0xe'),_0x4c710a,_0x26da('0xf'));_0x3857f2(_0x52adce['result'][_0x26da('0x13')]);}})['catch'](function(_0x3a1bbb){logger[_0x26da('0x12')](_0x26da('0xe'),_0x4c710a,_0x3a1bbb);_0x538f38(_0x3a1bbb);});});}