Built motion from commit (unavailable).|2.5.14
[motion2.git] / server / services / xdr / dials.controller.js
index b815063..eef4b86 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x672e=['toLowerCase','cdr(routeid)','appdata','split','error','stack','varset','isNil','variable','outboundrouteid','value','dialbegin','assign','lastevent','called','dialstatus','now','connect','hangup','complete','diffTime','starttime','holdtime','answertime','endtime','billableseconds','lodash','./utils','info','format','uniqueid','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','application'];(function(_0x2158a8,_0x335f85){var _0x4b1071=function(_0x2b9124){while(--_0x2b9124){_0x2158a8['push'](_0x2158a8['shift']());}};_0x4b1071(++_0x335f85);}(_0x672e,0x1e2));var _0xe672=function(_0x142b55,_0x2cc75f){_0x142b55=_0x142b55-0x0;var _0x4ea8b7=_0x672e[_0x142b55];return _0x4ea8b7;};'use strict';var _=require(_0xe672('0x0'));var util=require('util');var utils=require(_0xe672('0x1'));var dials={};function writeDB(_0x40389b){utils[_0xe672('0x2')](util[_0xe672('0x3')]('DIAL|%s|%s|%s|%s|%s|%s',_0x40389b[_0xe672('0x4')],_0x40389b['channel'],_0x40389b[_0xe672('0x5')],_0x40389b[_0xe672('0x6')],_0x40389b[_0xe672('0x7')],_0x40389b['dialstatus']));utils[_0xe672('0x8')](_0xe672('0x9'),_0x40389b);delete dials[_0x40389b[_0xe672('0x4')]];}exports[_0xe672('0xa')]=function(_0x2e4b64){try{if(_0x2e4b64[_0xe672('0xb')][_0xe672('0xc')]()=='set'&&_['startsWith'](_0x2e4b64['appdata'][_0xe672('0xc')](),_0xe672('0xd'))){var _0x5ceb7d=_0x2e4b64[_0xe672('0xe')][_0xe672('0xf')]('=');dials[_0x2e4b64['uniqueid']]={'routeId':_0x5ceb7d[0x1]};}}catch(_0x37885e){utils[_0xe672('0x10')](_0x37885e[_0xe672('0x11')]);}};exports[_0xe672('0x12')]=function(_0x3a8c92){try{if(!_[_0xe672('0x13')](_0x3a8c92[_0xe672('0x14')][_0xe672('0x15')])){dials[_0x3a8c92[_0xe672('0x4')]]={'routeId':_0x3a8c92[_0xe672('0x16')]};}}catch(_0x10918c){utils[_0xe672('0x10')](_0x10918c['stack']);}};exports[_0xe672('0x17')]=function(_0x2dea2f){try{if(!_['isNil'](dials[_0x2dea2f[_0xe672('0x4')]])){dials[_0x2dea2f['uniqueid']]=_[_0xe672('0x18')](dials[_0x2dea2f[_0xe672('0x4')]],_0x2dea2f);dials[_0x2dea2f[_0xe672('0x4')]]['starttime']=utils['now']();dials[_0x2dea2f['uniqueid']][_0xe672('0x19')]=_0xe672('0x1a');}}catch(_0x537533){utils[_0xe672('0x10')](_0x537533[_0xe672('0x11')]);}};exports['dialend']=function(_0x23628e){try{if(!_[_0xe672('0x13')](dials[_0x23628e[_0xe672('0x4')]])){dials[_0x23628e['uniqueid']]['dialstatus']=_0x23628e[_0xe672('0x1b')];if(_0x23628e[_0xe672('0x1b')]=='ANSWER'){dials[_0x23628e[_0xe672('0x4')]]=_[_0xe672('0x18')](dials[_0x23628e[_0xe672('0x4')]],_0x23628e);dials[_0x23628e['uniqueid']]['answertime']=utils[_0xe672('0x1c')]();dials[_0x23628e[_0xe672('0x4')]]['lastevent']=_0xe672('0x1d');}}}catch(_0x3a16a7){utils[_0xe672('0x10')](_0x3a16a7['stack']);}};exports[_0xe672('0x1e')]=function(_0x526fb3){try{if(!_[_0xe672('0x13')](dials[_0x526fb3[_0xe672('0x4')]])){dials[_0x526fb3[_0xe672('0x4')]]=_[_0xe672('0x18')](dials[_0x526fb3[_0xe672('0x4')]],{'endtime':utils[_0xe672('0x1c')](),'lastevent':_0xe672('0x1f')});dials[_0x526fb3[_0xe672('0x4')]]['duration']=utils[_0xe672('0x20')](dials[_0x526fb3[_0xe672('0x4')]]['endtime'],dials[_0x526fb3[_0xe672('0x4')]][_0xe672('0x21')]);dials[_0x526fb3['uniqueid']][_0xe672('0x22')]=utils[_0xe672('0x20')](dials[_0x526fb3['uniqueid']][_0xe672('0x23')]||dials[_0x526fb3[_0xe672('0x4')]][_0xe672('0x24')],dials[_0x526fb3[_0xe672('0x4')]]['starttime']);dials[_0x526fb3['uniqueid']][_0xe672('0x25')]=dials[_0x526fb3['uniqueid']][_0xe672('0x23')]?utils[_0xe672('0x20')](dials[_0x526fb3['uniqueid']][_0xe672('0x24')],dials[_0x526fb3['uniqueid']][_0xe672('0x23')]):0x0;writeDB(dials[_0x526fb3[_0xe672('0x4')]]);}}catch(_0x43d04c){utils[_0xe672('0x10')](_0x43d04c[_0xe672('0x11')]);}};
\ No newline at end of file
+var _0x3a8f=['dialbegin','isNil','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','[%s][dials][dialend]','dialstatus','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','duration','diffTime','endtime','[%s][dials][hangup]','lodash','util','info','format','uniqueid','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','error','varset','debug','[%s][dials][varset]','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value'];(function(_0x3ca34b,_0x14c706){var _0x149003=function(_0xa67827){while(--_0xa67827){_0x3ca34b['push'](_0x3ca34b['shift']());}};_0x149003(++_0x14c706);}(_0x3a8f,0x99));var _0xf3a8=function(_0xd65643,_0x2b8337){_0xd65643=_0xd65643-0x0;var _0x19dc56=_0x3a8f[_0xd65643];return _0x19dc56;};'use strict';var _=require(_0xf3a8('0x0'));var util=require(_0xf3a8('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x52371d){utils[_0xf3a8('0x2')](util[_0xf3a8('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x52371d[_0xf3a8('0x4')],_0x52371d['channel'],_0x52371d[_0xf3a8('0x5')],_0x52371d[_0xf3a8('0x6')],_0x52371d[_0xf3a8('0x7')],_0x52371d['dialstatus']));utils[_0xf3a8('0x8')](_0xf3a8('0x9'),_0x52371d);delete dials[_0x52371d['uniqueid']];}exports[_0xf3a8('0xa')]=function(_0x40e634){try{utils['debug'](util[_0xf3a8('0x3')](_0xf3a8('0xb'),_0x40e634[_0xf3a8('0x4')]),_0x40e634);utils[_0xf3a8('0x2')](util[_0xf3a8('0x3')](_0xf3a8('0xc'),_0x40e634[_0xf3a8('0x4')],_0x40e634[_0xf3a8('0xd')],_0x40e634['appdata']));if(_0x40e634[_0xf3a8('0xd')][_0xf3a8('0xe')]()=='set'&&_[_0xf3a8('0xf')](_0x40e634[_0xf3a8('0x10')][_0xf3a8('0xe')](),'cdr(routeid)')){var _0x1b05f3=_0x40e634['appdata']['split']('=');dials[_0x40e634[_0xf3a8('0x4')]]={'routeId':_0x1b05f3[0x1]};}}catch(_0x5d9077){utils[_0xf3a8('0x11')](util[_0xf3a8('0x3')]('[%s][dials][newexten]',_0x40e634[_0xf3a8('0x4')]),_0x5d9077);}};exports[_0xf3a8('0x12')]=function(_0xb24381){try{utils[_0xf3a8('0x13')](util[_0xf3a8('0x3')](_0xf3a8('0x14'),_0xb24381[_0xf3a8('0x4')]),_0xb24381);if(!_['isNil'](_0xb24381['variable']['outboundrouteid'])){utils[_0xf3a8('0x2')](util[_0xf3a8('0x3')](_0xf3a8('0x15'),_0xb24381[_0xf3a8('0x4')],_0xb24381[_0xf3a8('0x16')]));dials[_0xb24381[_0xf3a8('0x4')]]={'routeId':_0xb24381[_0xf3a8('0x16')]};}}catch(_0x337d42){utils[_0xf3a8('0x11')](util[_0xf3a8('0x3')](_0xf3a8('0x14'),_0xb24381[_0xf3a8('0x4')]),_0x337d42);}};exports[_0xf3a8('0x17')]=function(_0x9902bd){try{if(!_[_0xf3a8('0x18')](dials[_0x9902bd['uniqueid']])){utils['debug'](util[_0xf3a8('0x3')]('[%s][dials][dialbegin]',_0x9902bd[_0xf3a8('0x4')]),_0x9902bd);dials[_0x9902bd[_0xf3a8('0x4')]]=_[_0xf3a8('0x19')](dials[_0x9902bd[_0xf3a8('0x4')]],_0x9902bd);dials[_0x9902bd[_0xf3a8('0x4')]][_0xf3a8('0x1a')]=utils[_0xf3a8('0x1b')]();dials[_0x9902bd['uniqueid']][_0xf3a8('0x1c')]=_0xf3a8('0x1d');utils[_0xf3a8('0x2')](util[_0xf3a8('0x3')](_0xf3a8('0x1e'),_0x9902bd[_0xf3a8('0x4')],dials[_0x9902bd[_0xf3a8('0x4')]][_0xf3a8('0x1a')]));}}catch(_0x55019f){utils[_0xf3a8('0x11')](util['format'](_0xf3a8('0x1f'),_0x9902bd[_0xf3a8('0x4')]),_0x55019f);}};exports['dialend']=function(_0x18b105){try{if(!_['isNil'](dials[_0x18b105['uniqueid']])){utils[_0xf3a8('0x13')](util[_0xf3a8('0x3')](_0xf3a8('0x20'),_0x18b105[_0xf3a8('0x4')]),_0x18b105);dials[_0x18b105[_0xf3a8('0x4')]][_0xf3a8('0x21')]=_0x18b105[_0xf3a8('0x21')];if(_0x18b105['dialstatus']==_0xf3a8('0x22')){dials[_0x18b105[_0xf3a8('0x4')]]=_[_0xf3a8('0x19')](dials[_0x18b105[_0xf3a8('0x4')]],_0x18b105);dials[_0x18b105['uniqueid']][_0xf3a8('0x23')]=utils[_0xf3a8('0x1b')]();dials[_0x18b105[_0xf3a8('0x4')]][_0xf3a8('0x1c')]=_0xf3a8('0x24');utils[_0xf3a8('0x2')](util[_0xf3a8('0x3')](_0xf3a8('0x25'),_0x18b105[_0xf3a8('0x4')],_0x18b105[_0xf3a8('0x21')],dials[_0x18b105[_0xf3a8('0x4')]][_0xf3a8('0x23')]));}else{utils[_0xf3a8('0x2')](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x18b105[_0xf3a8('0x4')],_0x18b105['dialstatus']));}}}catch(_0x4db5b3){utils[_0xf3a8('0x11')](util[_0xf3a8('0x3')]('[%s][dials][dialend]',_0x18b105[_0xf3a8('0x4')]),_0x4db5b3);}};exports['hangup']=function(_0x12bed5){try{if(!_[_0xf3a8('0x18')](dials[_0x12bed5[_0xf3a8('0x4')]])){utils[_0xf3a8('0x13')](util[_0xf3a8('0x3')]('[%s][dials][hangup]',_0x12bed5[_0xf3a8('0x4')]),_0x12bed5);utils['info'](util[_0xf3a8('0x3')](_0xf3a8('0x26'),_0x12bed5[_0xf3a8('0x4')],_0x12bed5[_0xf3a8('0x6')],_0x12bed5[_0xf3a8('0x27')],_0x12bed5['cause-txt']));dials[_0x12bed5['uniqueid']]=_[_0xf3a8('0x19')](dials[_0x12bed5[_0xf3a8('0x4')]],{'endtime':utils[_0xf3a8('0x1b')](),'lastevent':'complete'});dials[_0x12bed5['uniqueid']][_0xf3a8('0x28')]=utils[_0xf3a8('0x29')](dials[_0x12bed5['uniqueid']][_0xf3a8('0x2a')],dials[_0x12bed5[_0xf3a8('0x4')]][_0xf3a8('0x1a')]);dials[_0x12bed5['uniqueid']]['holdtime']=utils['diffTime'](dials[_0x12bed5[_0xf3a8('0x4')]][_0xf3a8('0x23')]||dials[_0x12bed5[_0xf3a8('0x4')]]['endtime'],dials[_0x12bed5[_0xf3a8('0x4')]]['starttime']);dials[_0x12bed5['uniqueid']]['billableseconds']=dials[_0x12bed5[_0xf3a8('0x4')]]['answertime']?utils[_0xf3a8('0x29')](dials[_0x12bed5[_0xf3a8('0x4')]][_0xf3a8('0x2a')],dials[_0x12bed5[_0xf3a8('0x4')]]['answertime']):0x0;writeDB(dials[_0x12bed5[_0xf3a8('0x4')]]);}}catch(_0x59355d){utils[_0xf3a8('0x11')](util[_0xf3a8('0x3')](_0xf3a8('0x2b'),_0x12bed5['uniqueid']),_0x59355d);}};
\ No newline at end of file