Built motion from commit 0415ced0.|2.6.28
[motion2.git] / server / services / xdr / calls.controller.js
index 03b5ed6..202041e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3afb=['context','channel','now','DOCUMENTATION','error','newstate','isNil','channelstate','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','variable','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','xmd-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','set','startsWith','toLowerCase','cdr','appdata','split','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','calleridnum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x3afb,0xc1));var _0xb3af=function(_0x3bb5b4,_0x128455){_0x3bb5b4=_0x3bb5b4-0x0;var _0x586c60=_0x3afb[_0x3bb5b4];return _0x586c60;};'use strict';var _=require(_0xb3af('0x0'));var util=require(_0xb3af('0x1'));var utils=require(_0xb3af('0x2'));var dispositions=[_0xb3af('0x3'),_0xb3af('0x4'),_0xb3af('0x4'),_0xb3af('0x3'),_0xb3af('0x3'),'NO\x20ANSWER',_0xb3af('0x5'),'BUSY',_0xb3af('0x4'),_0xb3af('0x4'),'FAILED'];var channels={};function writeDB(_0x347e55){utils['info'](util[_0xb3af('0x6')](_0xb3af('0x7'),_0x347e55[_0xb3af('0x8')],_0x347e55['channel'],_0x347e55[_0xb3af('0x9')],_0x347e55[_0xb3af('0xa')],_0x347e55[_0xb3af('0xb')],_0x347e55[_0xb3af('0xc')],_0x347e55['connectedlinenum'],_0x347e55[_0xb3af('0xd')]));if(_0x347e55[_0xb3af('0xe')]){utils[_0xb3af('0xf')](_0x347e55[_0xb3af('0xe')])[_0xb3af('0x10')](function(_0x2263d4){if(_0x2263d4){_0x347e55['UserId']=_0x2263d4['id'];}utils[_0xb3af('0x11')](_0xb3af('0x12'),_0x347e55);});}else{utils['request'](_0xb3af('0x12'),_0x347e55);}if(channels[_0x347e55[_0xb3af('0x8')]]){delete channels[_0x347e55[_0xb3af('0x8')]];}}exports[_0xb3af('0x13')]=function(_0x43bea4){try{utils[_0xb3af('0x14')](util['format'](_0xb3af('0x15'),_0x43bea4['uniqueid']),_0x43bea4);if(_0x43bea4[_0xb3af('0x8')]==_0x43bea4['linkedid']&&_0x43bea4['channel']!='OutgoingSpoolFailed'){utils[_0xb3af('0x16')](util[_0xb3af('0x6')](_0xb3af('0x17'),_0x43bea4['uniqueid'],_0x43bea4['context'],_0x43bea4[_0xb3af('0x18')]));channels[_0x43bea4[_0xb3af('0x8')]]={'uniqueid':_0x43bea4[_0xb3af('0x8')],'accountcode':_0x43bea4['accountcode'],'source':_0x43bea4['calleridnum'],'destination':_0x43bea4[_0xb3af('0x18')],'destinationcontext':_0x43bea4[_0xb3af('0x19')],'channel':_0x43bea4[_0xb3af('0x1a')],'starttime':utils[_0xb3af('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xb3af('0x3'),'amaflags':_0xb3af('0x1c')};}}catch(_0x5149e2){utils[_0xb3af('0x1d')](util[_0xb3af('0x6')]('[%s][calls][newchannel]',_0x43bea4[_0xb3af('0x8')]),_0x5149e2);}};exports[_0xb3af('0x1e')]=function(_0x476803){try{utils[_0xb3af('0x14')](util['format']('[%s][calls][newstate]',_0x476803[_0xb3af('0x8')]),_0x476803);if(!_[_0xb3af('0x1f')](channels[_0x476803['uniqueid']])&&_0x476803[_0xb3af('0x20')]==0x6){utils[_0xb3af('0x16')](util[_0xb3af('0x6')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x476803['uniqueid'],_0x476803[_0xb3af('0x19')],_0x476803[_0xb3af('0x1a')]));if(_['isNil'](channels[_0x476803[_0xb3af('0x8')]][_0xb3af('0x21')])){channels[_0x476803[_0xb3af('0x8')]]['systemanswertime']=utils['now']();}}else if(!_['isNil'](channels[_0x476803[_0xb3af('0x22')]])&&_0x476803[_0xb3af('0x20')]==0x6&&_0x476803[_0xb3af('0x19')]!=_0xb3af('0x23')){utils[_0xb3af('0x16')](util[_0xb3af('0x6')](_0xb3af('0x24'),_0x476803[_0xb3af('0x8')],_0x476803['linkedid'],_0x476803[_0xb3af('0x19')],_0x476803[_0xb3af('0x1a')]));channels[_0x476803[_0xb3af('0x22')]][_0xb3af('0xe')]=_0x476803['accountcode'];channels[_0x476803[_0xb3af('0x22')]][_0xb3af('0x25')]=_0x476803[_0xb3af('0x1a')];if(_[_0xb3af('0x1f')](channels[_0x476803[_0xb3af('0x22')]][_0xb3af('0x26')])){channels[_0x476803[_0xb3af('0x22')]][_0xb3af('0x26')]=utils[_0xb3af('0x1b')]();}channels[_0x476803[_0xb3af('0x22')]]['disposition']=dispositions[_['toNumber'](_0x476803[_0xb3af('0x20')])]||_0xb3af('0x5');}}catch(_0x15f15d){utils[_0xb3af('0x1d')](util['format']('[%s][calls][newstate]',_0x476803[_0xb3af('0x8')]),_0x15f15d);}};exports[_0xb3af('0x27')]=function(_0x35fd0c){try{if(!_[_0xb3af('0x1f')](channels[_0x35fd0c[_0xb3af('0x8')]])){utils[_0xb3af('0x14')](util[_0xb3af('0x6')](_0xb3af('0x28'),_0x35fd0c[_0xb3af('0x8')]),_0x35fd0c);if(_['isNil'](channels[_0x35fd0c[_0xb3af('0x8')]][_0xb3af('0x29')])){channels[_0x35fd0c[_0xb3af('0x8')]][_0xb3af('0x29')]=_0x35fd0c[_0xb3af('0x2a')]+'\x20<'+_0x35fd0c['calleridnum']+'>';}utils['info'](util[_0xb3af('0x6')](_0xb3af('0x2b'),_0x35fd0c[_0xb3af('0x8')],channels[_0x35fd0c[_0xb3af('0x8')]][_0xb3af('0x29')],_0x35fd0c['cause-txt']));channels[_0x35fd0c['uniqueid']][_0xb3af('0x2c')]=utils['now']();channels[_0x35fd0c[_0xb3af('0x8')]][_0xb3af('0x2d')]=utils[_0xb3af('0x2e')](channels[_0x35fd0c[_0xb3af('0x8')]][_0xb3af('0x2c')],channels[_0x35fd0c[_0xb3af('0x8')]][_0xb3af('0x2f')]);channels[_0x35fd0c['uniqueid']][_0xb3af('0x30')]=channels[_0x35fd0c[_0xb3af('0x8')]][_0xb3af('0x26')]?utils[_0xb3af('0x2e')](channels[_0x35fd0c[_0xb3af('0x8')]]['endtime'],channels[_0x35fd0c[_0xb3af('0x8')]]['answertime']):0x0;writeDB(channels[_0x35fd0c[_0xb3af('0x8')]]);}}catch(_0x575598){utils[_0xb3af('0x1d')](util[_0xb3af('0x6')](_0xb3af('0x28'),_0x35fd0c[_0xb3af('0x8')]),_0x575598);}};exports[_0xb3af('0x31')]=function(_0x118e9a){try{if(!_['isNil'](channels[_0x118e9a[_0xb3af('0x32')]])){utils[_0xb3af('0x14')](util[_0xb3af('0x6')]('[%s][calls][attendedtransfer]',_0x118e9a['origtransfereruniqueid']),_0x118e9a);if(channels[_0x118e9a[_0xb3af('0x32')]][_0xb3af('0x1a')]==_0x118e9a['transfereechannel']){utils[_0xb3af('0x16')](util[_0xb3af('0x6')](_0xb3af('0x33'),_0x118e9a[_0xb3af('0x34')],_0x118e9a[_0xb3af('0x32')],_0x118e9a[_0xb3af('0x35')]));channels[_0x118e9a[_0xb3af('0x32')]][_0xb3af('0x25')]=_0x118e9a['secondtransfererchannel'];channels[_0x118e9a[_0xb3af('0x32')]][_0xb3af('0x36')]=_0xb3af('0x37');}else if(channels[_0x118e9a['localtwolinkedid']]['channel']=_0x118e9a[_0xb3af('0x38')]){utils['info'](util[_0xb3af('0x6')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x118e9a[_0xb3af('0x34')],_0x118e9a[_0xb3af('0x32')],_0x118e9a[_0xb3af('0x39')]));channels[_0x118e9a[_0xb3af('0x32')]][_0xb3af('0x25')]=_0x118e9a[_0xb3af('0x39')];channels[_0x118e9a[_0xb3af('0x32')]]['userfield']=_0xb3af('0x37');}}}catch(_0x202aca){utils[_0xb3af('0x1d')](util[_0xb3af('0x6')]('[%s][calls][attendedtransfer]',_0x118e9a[_0xb3af('0x34')]),_0x202aca);}};exports[_0xb3af('0x3a')]=function(_0xc1d35a){try{if(!_[_0xb3af('0x1f')](channels[_0xc1d35a[_0xb3af('0x8')]])){utils[_0xb3af('0x14')](util[_0xb3af('0x6')](_0xb3af('0x3b'),_0xc1d35a[_0xb3af('0x8')]),_0xc1d35a);channels[_0xc1d35a[_0xb3af('0x8')]][_0xb3af('0x3c')]=utils[_0xb3af('0x1b')]();utils['info'](util[_0xb3af('0x6')](_0xb3af('0x3d'),_0xc1d35a[_0xb3af('0x8')],channels[_0xc1d35a[_0xb3af('0x8')]]['musiconholdstartAt']));}}catch(_0x4389b5){utils[_0xb3af('0x1d')](util[_0xb3af('0x6')](_0xb3af('0x3b'),_0xc1d35a[_0xb3af('0x8')]),_0x4389b5);}};exports[_0xb3af('0x3e')]=function(_0x4465e2){try{if(!_[_0xb3af('0x1f')](channels[_0x4465e2[_0xb3af('0x8')]])){utils[_0xb3af('0x14')](util[_0xb3af('0x6')](_0xb3af('0x3f'),_0x4465e2[_0xb3af('0x8')]),_0x4465e2);if(!_[_0xb3af('0x1f')](channels[_0x4465e2[_0xb3af('0x8')]][_0xb3af('0x3c')])){channels[_0x4465e2[_0xb3af('0x8')]][_0xb3af('0x40')]+=utils[_0xb3af('0x2e')](utils[_0xb3af('0x1b')](),channels[_0x4465e2['uniqueid']][_0xb3af('0x3c')]);utils[_0xb3af('0x16')](util[_0xb3af('0x6')](_0xb3af('0x41'),_0x4465e2[_0xb3af('0x8')],channels[_0x4465e2[_0xb3af('0x8')]][_0xb3af('0x40')]));delete channels[_0x4465e2['uniqueid']][_0xb3af('0x3c')];}}}catch(_0x4fcc06){utils[_0xb3af('0x1d')](util[_0xb3af('0x6')]('[%s][calls][musiconholdstop]',_0x4465e2[_0xb3af('0x8')]),_0x4fcc06);}};exports[_0xb3af('0x42')]=function(_0x5b9441){try{if(!_[_0xb3af('0x1f')](channels[_0x5b9441['uniqueid']])){utils[_0xb3af('0x14')](util[_0xb3af('0x6')](_0xb3af('0x43'),_0x5b9441['uniqueid']),_0x5b9441);if(!_['isNil'](_0x5b9441['variable'][_0xb3af('0x44')])){utils[_0xb3af('0x16')](util['format'](_0xb3af('0x45'),_0x5b9441[_0xb3af('0x8')],_0x5b9441['value']));channels[_0x5b9441[_0xb3af('0x8')]][_0xb3af('0x46')]=_0x5b9441[_0xb3af('0x47')];}if(!_[_0xb3af('0x1f')](_0x5b9441[_0xb3af('0x48')][_0xb3af('0x49')])){utils[_0xb3af('0x16')](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x5b9441[_0xb3af('0x8')],_0x5b9441[_0xb3af('0x47')]));channels[_0x5b9441['uniqueid']][_0xb3af('0x4a')]=_0x5b9441[_0xb3af('0x47')];channels[_0x5b9441[_0xb3af('0x8')]][_0xb3af('0x29')]='\x22'+_0x5b9441[_0xb3af('0x47')]+_0xb3af('0x4b')+_0x5b9441['value']+'>';}if(!_[_0xb3af('0x1f')](_0x5b9441['variable'][_0xb3af('0x4c')])||!_['isNil'](_0x5b9441[_0xb3af('0x48')][_0xb3af('0x4d')])){utils['info'](util[_0xb3af('0x6')](_0xb3af('0x4e'),_0x5b9441[_0xb3af('0x8')],!_[_0xb3af('0x1f')](_0x5b9441[_0xb3af('0x48')][_0xb3af('0x4c')])?'xmd-callerid-preview':_0xb3af('0x4d'),_0x5b9441[_0xb3af('0x47')]));channels[_0x5b9441[_0xb3af('0x8')]][_0xb3af('0x29')]=_0x5b9441[_0xb3af('0x47')];}if(!_['isNil'](_0x5b9441[_0xb3af('0x48')]['xmd-queue'])||!_['isNil'](_0x5b9441[_0xb3af('0x48')][_0xb3af('0x4f')])){utils[_0xb3af('0x16')](util[_0xb3af('0x6')](_0xb3af('0x4e'),_0x5b9441[_0xb3af('0x8')],!_[_0xb3af('0x1f')](_0x5b9441['variable'][_0xb3af('0x50')])?_0xb3af('0x50'):_0xb3af('0x4f'),_0x5b9441[_0xb3af('0x47')]));channels[_0x5b9441[_0xb3af('0x8')]][_0xb3af('0x51')]=_0xb3af('0x52');channels[_0x5b9441[_0xb3af('0x8')]][_0xb3af('0x53')]=_0x5b9441[_0xb3af('0x47')];channels[_0x5b9441[_0xb3af('0x8')]][_0xb3af('0x9')]=!![];}if(!_[_0xb3af('0x1f')](_0x5b9441['variable'][_0xb3af('0x54')])){utils['info'](util[_0xb3af('0x6')](_0xb3af('0x55'),_0x5b9441[_0xb3af('0x8')],_0x5b9441[_0xb3af('0x47')]));channels[_0x5b9441[_0xb3af('0x8')]]['ContactId']=_0x5b9441[_0xb3af('0x47')];}if(!_[_0xb3af('0x1f')](_0x5b9441[_0xb3af('0x48')][_0xb3af('0x56')])){utils[_0xb3af('0x16')](util[_0xb3af('0x6')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x5b9441['uniqueid'],_0x5b9441['value']));channels[_0x5b9441[_0xb3af('0x8')]][_0xb3af('0x57')]=_0x5b9441[_0xb3af('0x47')];}if(!_['isNil'](_0x5b9441['variable'][_0xb3af('0x58')])){utils[_0xb3af('0x16')](util[_0xb3af('0x6')](_0xb3af('0x59'),_0x5b9441[_0xb3af('0x8')],_0x5b9441[_0xb3af('0x47')]));channels[_0x5b9441[_0xb3af('0x8')]][_0xb3af('0x5a')]=_0x5b9441[_0xb3af('0x47')];}if(!_[_0xb3af('0x1f')](_0x5b9441[_0xb3af('0x48')][_0xb3af('0x5b')])){utils[_0xb3af('0x16')](util[_0xb3af('0x6')](_0xb3af('0x5c'),_0x5b9441[_0xb3af('0x8')],_0x5b9441[_0xb3af('0x47')]));channels[_0x5b9441[_0xb3af('0x8')]][_0xb3af('0x5b')]=_0x5b9441['value'];}}}catch(_0xec9089){utils[_0xb3af('0x1d')](util[_0xb3af('0x6')](_0xb3af('0x43'),_0x5b9441[_0xb3af('0x8')]),_0xec9089);}};exports[_0xb3af('0x5d')]=function(_0x14348c){try{if(!_[_0xb3af('0x1f')](channels[_0x14348c[_0xb3af('0x8')]])){utils[_0xb3af('0x14')](util['format'](_0xb3af('0x5e'),_0x14348c['uniqueid']),_0x14348c);utils['info'](util[_0xb3af('0x6')](_0xb3af('0x5f'),_0x14348c[_0xb3af('0x8')],_0x14348c[_0xb3af('0x60')],_0x14348c['appdata']));if(_0x14348c[_0xb3af('0x60')]['toLowerCase']()==_0xb3af('0x61')&&_[_0xb3af('0x62')](_0x14348c['appdata'][_0xb3af('0x63')](),_0xb3af('0x64'))){var _0x3595dc=_0x14348c[_0xb3af('0x65')][_0xb3af('0x66')]('=');var _0x3b401b=_0x3595dc[0x0][_0xb3af('0x67')](_0x3595dc[0x0][_0xb3af('0x68')]('(')+0x1,_0x3595dc[0x0]['lastIndexOf'](')'));var _0x6ce7ce=_0x3595dc[0x1];channels[_0x14348c[_0xb3af('0x8')]][_0x3b401b]=_0x6ce7ce;}if(!_[_0xb3af('0x69')]([_0xb3af('0x27'),_0xb3af('0x6a'),_0xb3af('0x6b'),_0xb3af('0x61'),_0xb3af('0x6c')],_0x14348c[_0xb3af('0x60')]['toLowerCase']())){channels[_0x14348c[_0xb3af('0x8')]][_0xb3af('0x51')]=_0x14348c[_0xb3af('0x60')];channels[_0x14348c['uniqueid']][_0xb3af('0x53')]=_0x14348c[_0xb3af('0x65')];}}}catch(_0x2253b1){utils['error'](util['format'](_0xb3af('0x5e'),_0x14348c[_0xb3af('0x8')]),_0x2253b1);}};
\ No newline at end of file
+var _0x4f5b=['transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','ANSWERED','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','diffTime','endtime','starttime','billableseconds','error','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','transfertargetchannel','origtransfererchannel','_attended','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','xmd-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','set','startsWith','toLowerCase','cdr','split','lastIndexOf','includes','noop','execif','gotoif','lodash','util','NO\x20ANSWER','FAILED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','CreateVoiceCallReport','request','debug','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','DOCUMENTATION','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid'];(function(_0x4e74e3,_0x44eeef){var _0x2241fe=function(_0xde1930){while(--_0xde1930){_0x4e74e3['push'](_0x4e74e3['shift']());}};_0x2241fe(++_0x44eeef);}(_0x4f5b,0xb5));var _0xb4f5=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4f5b[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xb4f5('0x0'));var util=require(_0xb4f5('0x1'));var utils=require('./utils');var dispositions=[_0xb4f5('0x2'),_0xb4f5('0x3'),_0xb4f5('0x3'),'NO\x20ANSWER',_0xb4f5('0x2'),_0xb4f5('0x2'),'ANSWERED',_0xb4f5('0x4'),_0xb4f5('0x3'),_0xb4f5('0x3'),_0xb4f5('0x3')];var channels={};function writeDB(_0x2080ab){utils[_0xb4f5('0x5')](util[_0xb4f5('0x6')](_0xb4f5('0x7'),_0x2080ab[_0xb4f5('0x8')],_0x2080ab[_0xb4f5('0x9')],_0x2080ab['queue'],_0x2080ab[_0xb4f5('0xa')],_0x2080ab['interface'],_0x2080ab[_0xb4f5('0xb')],_0x2080ab[_0xb4f5('0xc')],_0x2080ab[_0xb4f5('0xd')]));if(_0x2080ab[_0xb4f5('0xe')]){utils[_0xb4f5('0xf')](_0x2080ab[_0xb4f5('0xe')])['then'](function(_0x498702){if(_0x498702){_0x2080ab[_0xb4f5('0x10')]=_0x498702['id'];}utils['request'](_0xb4f5('0x11'),_0x2080ab);});}else{utils[_0xb4f5('0x12')](_0xb4f5('0x11'),_0x2080ab);}if(channels[_0x2080ab[_0xb4f5('0x8')]]){delete channels[_0x2080ab[_0xb4f5('0x8')]];}}exports['newchannel']=function(_0xf53b32){try{utils[_0xb4f5('0x13')](util[_0xb4f5('0x6')](_0xb4f5('0x14'),_0xf53b32[_0xb4f5('0x8')]),_0xf53b32);if(_0xf53b32['uniqueid']==_0xf53b32['linkedid']&&_0xf53b32[_0xb4f5('0x9')]!=_0xb4f5('0x15')){utils['info'](util['format'](_0xb4f5('0x16'),_0xf53b32['uniqueid'],_0xf53b32['context'],_0xf53b32['exten']));channels[_0xf53b32[_0xb4f5('0x8')]]={'uniqueid':_0xf53b32[_0xb4f5('0x8')],'accountcode':_0xf53b32[_0xb4f5('0xe')],'source':_0xf53b32[_0xb4f5('0xb')],'destination':_0xf53b32[_0xb4f5('0x17')],'destinationcontext':_0xf53b32[_0xb4f5('0x18')],'channel':_0xf53b32[_0xb4f5('0x9')],'starttime':utils[_0xb4f5('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xb4f5('0x2'),'amaflags':_0xb4f5('0x1a')};}}catch(_0x1c83e4){utils['error'](util[_0xb4f5('0x6')]('[%s][calls][newchannel]',_0xf53b32[_0xb4f5('0x8')]),_0x1c83e4);}};exports['newstate']=function(_0x4e4ab1){try{utils[_0xb4f5('0x13')](util[_0xb4f5('0x6')](_0xb4f5('0x1b'),_0x4e4ab1[_0xb4f5('0x8')]),_0x4e4ab1);if(!_[_0xb4f5('0x1c')](channels[_0x4e4ab1[_0xb4f5('0x8')]])&&_0x4e4ab1[_0xb4f5('0x1d')]==0x6){utils[_0xb4f5('0x5')](util[_0xb4f5('0x6')](_0xb4f5('0x1e'),_0x4e4ab1[_0xb4f5('0x8')],_0x4e4ab1[_0xb4f5('0x18')],_0x4e4ab1[_0xb4f5('0x9')]));if(_[_0xb4f5('0x1c')](channels[_0x4e4ab1[_0xb4f5('0x8')]][_0xb4f5('0x1f')])){channels[_0x4e4ab1[_0xb4f5('0x8')]][_0xb4f5('0x1f')]=utils[_0xb4f5('0x19')]();}}else if(!_[_0xb4f5('0x1c')](channels[_0x4e4ab1[_0xb4f5('0x20')]])&&_0x4e4ab1[_0xb4f5('0x1d')]==0x6&&_0x4e4ab1[_0xb4f5('0x18')]!=_0xb4f5('0x21')){utils[_0xb4f5('0x5')](util[_0xb4f5('0x6')](_0xb4f5('0x22'),_0x4e4ab1['uniqueid'],_0x4e4ab1[_0xb4f5('0x20')],_0x4e4ab1['context'],_0x4e4ab1[_0xb4f5('0x9')]));channels[_0x4e4ab1[_0xb4f5('0x20')]]['accountcode']=_0x4e4ab1['accountcode'];channels[_0x4e4ab1['linkedid']][_0xb4f5('0x23')]=_0x4e4ab1[_0xb4f5('0x9')];if(_[_0xb4f5('0x1c')](channels[_0x4e4ab1[_0xb4f5('0x20')]][_0xb4f5('0x24')])){channels[_0x4e4ab1['linkedid']][_0xb4f5('0x24')]=utils[_0xb4f5('0x19')]();}channels[_0x4e4ab1[_0xb4f5('0x20')]][_0xb4f5('0x25')]=dispositions[_[_0xb4f5('0x26')](_0x4e4ab1[_0xb4f5('0x1d')])]||_0xb4f5('0x27');}}catch(_0x25d535){utils['error'](util[_0xb4f5('0x6')](_0xb4f5('0x1b'),_0x4e4ab1[_0xb4f5('0x8')]),_0x25d535);}};exports[_0xb4f5('0x28')]=function(_0x46f62c){try{if(!_['isNil'](channels[_0x46f62c[_0xb4f5('0x8')]])){utils[_0xb4f5('0x13')](util[_0xb4f5('0x6')](_0xb4f5('0x29'),_0x46f62c['uniqueid']),_0x46f62c);if(_[_0xb4f5('0x1c')](channels[_0x46f62c[_0xb4f5('0x8')]][_0xb4f5('0x2a')])){channels[_0x46f62c[_0xb4f5('0x8')]][_0xb4f5('0x2a')]=_0x46f62c[_0xb4f5('0x2b')]+'\x20<'+_0x46f62c[_0xb4f5('0xb')]+'>';}utils[_0xb4f5('0x5')](util[_0xb4f5('0x6')](_0xb4f5('0x2c'),_0x46f62c[_0xb4f5('0x8')],channels[_0x46f62c[_0xb4f5('0x8')]]['callerid'],_0x46f62c['cause-txt']));channels[_0x46f62c['uniqueid']]['endtime']=utils['now']();channels[_0x46f62c['uniqueid']]['duration']=utils[_0xb4f5('0x2d')](channels[_0x46f62c[_0xb4f5('0x8')]][_0xb4f5('0x2e')],channels[_0x46f62c[_0xb4f5('0x8')]][_0xb4f5('0x2f')]);channels[_0x46f62c['uniqueid']][_0xb4f5('0x30')]=channels[_0x46f62c[_0xb4f5('0x8')]]['answertime']?utils[_0xb4f5('0x2d')](channels[_0x46f62c[_0xb4f5('0x8')]][_0xb4f5('0x2e')],channels[_0x46f62c[_0xb4f5('0x8')]][_0xb4f5('0x24')]):0x0;writeDB(channels[_0x46f62c['uniqueid']]);}}catch(_0x43fe21){utils[_0xb4f5('0x31')](util[_0xb4f5('0x6')]('[%s][calls][hangup]',_0x46f62c[_0xb4f5('0x8')]),_0x43fe21);}};exports[_0xb4f5('0x32')]=function(_0x1a4756){try{if(!_[_0xb4f5('0x1c')](channels[_0x1a4756[_0xb4f5('0x33')]])){utils[_0xb4f5('0x13')](util[_0xb4f5('0x6')](_0xb4f5('0x34'),_0x1a4756[_0xb4f5('0x35')]),_0x1a4756);if(channels[_0x1a4756[_0xb4f5('0x33')]]['channel']==_0x1a4756[_0xb4f5('0x36')]){utils['info'](util['format'](_0xb4f5('0x37'),_0x1a4756[_0xb4f5('0x35')],_0x1a4756[_0xb4f5('0x33')],_0x1a4756[_0xb4f5('0x38')]));channels[_0x1a4756['localtwolinkedid']]['destinationchannel']=_0x1a4756['secondtransfererchannel'];channels[_0x1a4756[_0xb4f5('0x33')]][_0xb4f5('0x39')]='_attended';}else if(channels[_0x1a4756['localtwolinkedid']][_0xb4f5('0x9')]=_0x1a4756[_0xb4f5('0x3a')]){utils[_0xb4f5('0x5')](util[_0xb4f5('0x6')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x1a4756[_0xb4f5('0x35')],_0x1a4756[_0xb4f5('0x33')],_0x1a4756[_0xb4f5('0x3b')]));channels[_0x1a4756[_0xb4f5('0x33')]][_0xb4f5('0x23')]=_0x1a4756[_0xb4f5('0x3b')];channels[_0x1a4756[_0xb4f5('0x33')]]['userfield']=_0xb4f5('0x3c');}}}catch(_0x3c47f7){utils[_0xb4f5('0x31')](util[_0xb4f5('0x6')](_0xb4f5('0x34'),_0x1a4756[_0xb4f5('0x35')]),_0x3c47f7);}};exports['musiconholdstart']=function(_0x380ecb){try{if(!_[_0xb4f5('0x1c')](channels[_0x380ecb[_0xb4f5('0x8')]])){utils[_0xb4f5('0x13')](util[_0xb4f5('0x6')](_0xb4f5('0x3d'),_0x380ecb[_0xb4f5('0x8')]),_0x380ecb);channels[_0x380ecb[_0xb4f5('0x8')]][_0xb4f5('0x3e')]=utils['now']();utils[_0xb4f5('0x5')](util[_0xb4f5('0x6')](_0xb4f5('0x3f'),_0x380ecb[_0xb4f5('0x8')],channels[_0x380ecb['uniqueid']][_0xb4f5('0x3e')]));}}catch(_0x52b6d9){utils['error'](util[_0xb4f5('0x6')]('[%s][calls][musiconholdstart]',_0x380ecb[_0xb4f5('0x8')]),_0x52b6d9);}};exports['musiconholdstop']=function(_0x9e8618){try{if(!_['isNil'](channels[_0x9e8618['uniqueid']])){utils['debug'](util['format'](_0xb4f5('0x40'),_0x9e8618[_0xb4f5('0x8')]),_0x9e8618);if(!_[_0xb4f5('0x1c')](channels[_0x9e8618['uniqueid']][_0xb4f5('0x3e')])){channels[_0x9e8618[_0xb4f5('0x8')]]['mohtime']+=utils[_0xb4f5('0x2d')](utils['now'](),channels[_0x9e8618[_0xb4f5('0x8')]][_0xb4f5('0x3e')]);utils[_0xb4f5('0x5')](util[_0xb4f5('0x6')](_0xb4f5('0x41'),_0x9e8618['uniqueid'],channels[_0x9e8618[_0xb4f5('0x8')]][_0xb4f5('0x42')]));delete channels[_0x9e8618[_0xb4f5('0x8')]][_0xb4f5('0x3e')];}}}catch(_0x22771d){utils['error'](util[_0xb4f5('0x6')](_0xb4f5('0x40'),_0x9e8618[_0xb4f5('0x8')]),_0x22771d);}};exports[_0xb4f5('0x43')]=function(_0x5e0575){try{if(!_[_0xb4f5('0x1c')](channels[_0x5e0575[_0xb4f5('0x8')]])){utils[_0xb4f5('0x13')](util['format'](_0xb4f5('0x44'),_0x5e0575['uniqueid']),_0x5e0575);if(!_[_0xb4f5('0x1c')](_0x5e0575[_0xb4f5('0x45')][_0xb4f5('0x46')])){utils['info'](util['format'](_0xb4f5('0x47'),_0x5e0575['uniqueid'],_0x5e0575[_0xb4f5('0x48')]));channels[_0x5e0575[_0xb4f5('0x8')]][_0xb4f5('0x49')]=_0x5e0575[_0xb4f5('0x48')];}if(!_[_0xb4f5('0x1c')](_0x5e0575['variable'][_0xb4f5('0x4a')])){utils['info'](util[_0xb4f5('0x6')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x5e0575[_0xb4f5('0x8')],_0x5e0575['value']));channels[_0x5e0575[_0xb4f5('0x8')]][_0xb4f5('0x4b')]=_0x5e0575[_0xb4f5('0x48')];channels[_0x5e0575['uniqueid']][_0xb4f5('0x2a')]='\x22'+_0x5e0575[_0xb4f5('0x48')]+_0xb4f5('0x4c')+_0x5e0575['value']+'>';}if(!_['isNil'](_0x5e0575[_0xb4f5('0x45')][_0xb4f5('0x4d')])||!_[_0xb4f5('0x1c')](_0x5e0575[_0xb4f5('0x45')][_0xb4f5('0x4e')])){utils[_0xb4f5('0x5')](util['format'](_0xb4f5('0x4f'),_0x5e0575[_0xb4f5('0x8')],!_[_0xb4f5('0x1c')](_0x5e0575[_0xb4f5('0x45')]['xmd-callerid-preview'])?_0xb4f5('0x4d'):_0xb4f5('0x4e'),_0x5e0575[_0xb4f5('0x48')]));channels[_0x5e0575['uniqueid']][_0xb4f5('0x2a')]=_0x5e0575[_0xb4f5('0x48')];}if(!_[_0xb4f5('0x1c')](_0x5e0575[_0xb4f5('0x45')]['xmd-queue'])||!_['isNil'](_0x5e0575[_0xb4f5('0x45')][_0xb4f5('0x50')])){utils['info'](util[_0xb4f5('0x6')](_0xb4f5('0x4f'),_0x5e0575[_0xb4f5('0x8')],!_['isNil'](_0x5e0575[_0xb4f5('0x45')][_0xb4f5('0x51')])?_0xb4f5('0x51'):_0xb4f5('0x50'),_0x5e0575[_0xb4f5('0x48')]));channels[_0x5e0575[_0xb4f5('0x8')]][_0xb4f5('0x52')]=_0xb4f5('0x53');channels[_0x5e0575['uniqueid']][_0xb4f5('0x54')]=_0x5e0575[_0xb4f5('0x48')];channels[_0x5e0575['uniqueid']]['queue']=!![];}if(!_[_0xb4f5('0x1c')](_0x5e0575['variable'][_0xb4f5('0x55')])){utils['info'](util[_0xb4f5('0x6')](_0xb4f5('0x56'),_0x5e0575['uniqueid'],_0x5e0575[_0xb4f5('0x48')]));channels[_0x5e0575[_0xb4f5('0x8')]][_0xb4f5('0x57')]=_0x5e0575['value'];}if(!_['isNil'](_0x5e0575['variable']['xmd-cdrtype'])){utils[_0xb4f5('0x5')](util[_0xb4f5('0x6')](_0xb4f5('0x58'),_0x5e0575[_0xb4f5('0x8')],_0x5e0575[_0xb4f5('0x48')]));channels[_0x5e0575[_0xb4f5('0x8')]][_0xb4f5('0x59')]=_0x5e0575[_0xb4f5('0x48')];}if(!_[_0xb4f5('0x1c')](_0x5e0575[_0xb4f5('0x45')]['outboundrouteid'])){utils[_0xb4f5('0x5')](util[_0xb4f5('0x6')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x5e0575[_0xb4f5('0x8')],_0x5e0575['value']));channels[_0x5e0575[_0xb4f5('0x8')]]['routeid']=_0x5e0575[_0xb4f5('0x48')];}if(!_[_0xb4f5('0x1c')](_0x5e0575[_0xb4f5('0x45')]['sipcallid'])){utils[_0xb4f5('0x5')](util[_0xb4f5('0x6')](_0xb4f5('0x5a'),_0x5e0575['uniqueid'],_0x5e0575[_0xb4f5('0x48')]));channels[_0x5e0575[_0xb4f5('0x8')]][_0xb4f5('0x5b')]=_0x5e0575[_0xb4f5('0x48')];}}}catch(_0x4e7f96){utils[_0xb4f5('0x31')](util[_0xb4f5('0x6')]('[%s][calls][varset]',_0x5e0575[_0xb4f5('0x8')]),_0x4e7f96);}};exports[_0xb4f5('0x5c')]=function(_0x574473){try{if(!_['isNil'](channels[_0x574473[_0xb4f5('0x8')]])){utils[_0xb4f5('0x13')](util[_0xb4f5('0x6')](_0xb4f5('0x5d'),_0x574473[_0xb4f5('0x8')]),_0x574473);utils[_0xb4f5('0x5')](util[_0xb4f5('0x6')](_0xb4f5('0x5e'),_0x574473[_0xb4f5('0x8')],_0x574473['application'],_0x574473[_0xb4f5('0x5f')]));if(_0x574473[_0xb4f5('0x60')]['toLowerCase']()==_0xb4f5('0x61')&&_[_0xb4f5('0x62')](_0x574473[_0xb4f5('0x5f')][_0xb4f5('0x63')](),_0xb4f5('0x64'))){var _0x1318d4=_0x574473[_0xb4f5('0x5f')][_0xb4f5('0x65')]('=');var _0x506e83=_0x1318d4[0x0]['substring'](_0x1318d4[0x0][_0xb4f5('0x66')]('(')+0x1,_0x1318d4[0x0][_0xb4f5('0x66')](')'));var _0x1ed7e5=_0x1318d4[0x1];channels[_0x574473['uniqueid']][_0x506e83]=_0x1ed7e5;}if(!_[_0xb4f5('0x67')]([_0xb4f5('0x28'),_0xb4f5('0x68'),_0xb4f5('0x69'),_0xb4f5('0x61'),_0xb4f5('0x6a')],_0x574473[_0xb4f5('0x60')][_0xb4f5('0x63')]())){channels[_0x574473[_0xb4f5('0x8')]][_0xb4f5('0x52')]=_0x574473['application'];channels[_0x574473[_0xb4f5('0x8')]][_0xb4f5('0x54')]=_0x574473[_0xb4f5('0x5f')];}}}catch(_0x5da937){utils['error'](util[_0xb4f5('0x6')](_0xb4f5('0x5d'),_0x574473[_0xb4f5('0x8')]),_0x5da937);}};
\ No newline at end of file