Built motion from commit ff78e754.|2.6.29
[motion2.git] / server / services / xdr / calls.controller.js
index 9d453d5..c23ed16 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xde30=['[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]','application','appdata','startsWith','toLowerCase','cdr','substring','lastIndexOf','includes','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','BUSY','info','format','uniqueid','channel','queue','membername','interface','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','toNumber','ANSWERED','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','destination','\x22\x20<','xmd-callerid','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','type','outboundrouteid'];(function(_0xd6d4fb,_0x3f0a0e){var _0x37650c=function(_0x20d46b){while(--_0x20d46b){_0xd6d4fb['push'](_0xd6d4fb['shift']());}};_0x37650c(++_0x3f0a0e);}(_0xde30,0xe4));var _0x0de3=function(_0x59a1a7,_0x2432be){_0x59a1a7=_0x59a1a7-0x0;var _0x502d1c=_0xde30[_0x59a1a7];return _0x502d1c;};'use strict';var _=require(_0x0de3('0x0'));var util=require(_0x0de3('0x1'));var utils=require(_0x0de3('0x2'));var dispositions=[_0x0de3('0x3'),_0x0de3('0x4'),_0x0de3('0x4'),_0x0de3('0x3'),_0x0de3('0x3'),'NO\x20ANSWER','ANSWERED',_0x0de3('0x5'),_0x0de3('0x4'),_0x0de3('0x4'),_0x0de3('0x4')];var channels={};function writeDB(_0x51b8f4){utils[_0x0de3('0x6')](util[_0x0de3('0x7')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x51b8f4[_0x0de3('0x8')],_0x51b8f4[_0x0de3('0x9')],_0x51b8f4[_0x0de3('0xa')],_0x51b8f4[_0x0de3('0xb')],_0x51b8f4[_0x0de3('0xc')],_0x51b8f4['calleridnum'],_0x51b8f4[_0x0de3('0xd')],_0x51b8f4[_0x0de3('0xe')]));if(_0x51b8f4[_0x0de3('0xf')]){utils[_0x0de3('0x10')](_0x51b8f4['accountcode'])[_0x0de3('0x11')](function(_0x2b44fa){if(_0x2b44fa){_0x51b8f4['UserId']=_0x2b44fa['id'];}utils[_0x0de3('0x12')](_0x0de3('0x13'),_0x51b8f4);});}else{utils[_0x0de3('0x12')](_0x0de3('0x13'),_0x51b8f4);}if(channels[_0x51b8f4[_0x0de3('0x8')]]){delete channels[_0x51b8f4[_0x0de3('0x8')]];}}exports[_0x0de3('0x14')]=function(_0x41bae6){try{utils[_0x0de3('0x15')](util['format'](_0x0de3('0x16'),_0x41bae6['uniqueid']),_0x41bae6);if(_0x41bae6[_0x0de3('0x8')]==_0x41bae6[_0x0de3('0x17')]&&_0x41bae6['channel']!='OutgoingSpoolFailed'){utils['info'](util['format'](_0x0de3('0x18'),_0x41bae6[_0x0de3('0x8')],_0x41bae6[_0x0de3('0x19')],_0x41bae6[_0x0de3('0x1a')]));channels[_0x41bae6[_0x0de3('0x8')]]={'uniqueid':_0x41bae6['uniqueid'],'accountcode':_0x41bae6[_0x0de3('0xf')],'source':_0x41bae6[_0x0de3('0x1b')],'destination':_0x41bae6[_0x0de3('0x1a')],'destinationcontext':_0x41bae6[_0x0de3('0x19')],'channel':_0x41bae6[_0x0de3('0x9')],'starttime':utils[_0x0de3('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x0de3('0x3'),'amaflags':_0x0de3('0x1d')};}}catch(_0x122942){utils[_0x0de3('0x1e')](util[_0x0de3('0x7')](_0x0de3('0x16'),_0x41bae6[_0x0de3('0x8')]),_0x122942);}};exports[_0x0de3('0x1f')]=function(_0xb84148){try{utils[_0x0de3('0x15')](util[_0x0de3('0x7')](_0x0de3('0x20'),_0xb84148[_0x0de3('0x8')]),_0xb84148);if(!_['isNil'](channels[_0xb84148[_0x0de3('0x8')]])&&_0xb84148[_0x0de3('0x21')]==0x6){utils[_0x0de3('0x6')](util['format'](_0x0de3('0x22'),_0xb84148[_0x0de3('0x8')],_0xb84148[_0x0de3('0x19')],_0xb84148[_0x0de3('0x9')]));if(_[_0x0de3('0x23')](channels[_0xb84148[_0x0de3('0x8')]][_0x0de3('0x24')])){channels[_0xb84148[_0x0de3('0x8')]][_0x0de3('0x24')]=utils[_0x0de3('0x1c')]();}}else if(!_[_0x0de3('0x23')](channels[_0xb84148[_0x0de3('0x17')]])&&_0xb84148['channelstate']==0x6&&_0xb84148[_0x0de3('0x19')]!=_0x0de3('0x25')){utils[_0x0de3('0x6')](util['format'](_0x0de3('0x26'),_0xb84148[_0x0de3('0x8')],_0xb84148[_0x0de3('0x17')],_0xb84148[_0x0de3('0x19')],_0xb84148[_0x0de3('0x9')]));channels[_0xb84148[_0x0de3('0x17')]][_0x0de3('0xf')]=_0xb84148[_0x0de3('0xf')];channels[_0xb84148['linkedid']]['destinationchannel']=_0xb84148['channel'];if(_[_0x0de3('0x23')](channels[_0xb84148[_0x0de3('0x17')]]['answertime'])){channels[_0xb84148['linkedid']][_0x0de3('0x27')]=utils[_0x0de3('0x1c')]();}channels[_0xb84148[_0x0de3('0x17')]]['disposition']=dispositions[_[_0x0de3('0x28')](_0xb84148['channelstate'])]||_0x0de3('0x29');}}catch(_0xfe9804){utils[_0x0de3('0x1e')](util[_0x0de3('0x7')](_0x0de3('0x20'),_0xb84148[_0x0de3('0x8')]),_0xfe9804);}};exports[_0x0de3('0x2a')]=function(_0x4ce866){try{if(!_[_0x0de3('0x23')](channels[_0x4ce866[_0x0de3('0x8')]])){utils['debug'](util[_0x0de3('0x7')](_0x0de3('0x2b'),_0x4ce866['uniqueid']),_0x4ce866);if(_[_0x0de3('0x23')](channels[_0x4ce866['uniqueid']][_0x0de3('0x2c')])){channels[_0x4ce866[_0x0de3('0x8')]]['callerid']=_0x4ce866[_0x0de3('0x2d')]+'\x20<'+_0x4ce866[_0x0de3('0x1b')]+'>';}utils['info'](util[_0x0de3('0x7')](_0x0de3('0x2e'),_0x4ce866[_0x0de3('0x8')],channels[_0x4ce866[_0x0de3('0x8')]][_0x0de3('0x2c')],_0x4ce866[_0x0de3('0x2f')]));channels[_0x4ce866[_0x0de3('0x8')]][_0x0de3('0x30')]=utils['now']();channels[_0x4ce866[_0x0de3('0x8')]][_0x0de3('0x31')]=utils[_0x0de3('0x32')](channels[_0x4ce866[_0x0de3('0x8')]][_0x0de3('0x30')],channels[_0x4ce866[_0x0de3('0x8')]][_0x0de3('0x33')]);channels[_0x4ce866[_0x0de3('0x8')]][_0x0de3('0x34')]=channels[_0x4ce866[_0x0de3('0x8')]][_0x0de3('0x27')]?utils[_0x0de3('0x32')](channels[_0x4ce866['uniqueid']][_0x0de3('0x30')],channels[_0x4ce866[_0x0de3('0x8')]]['answertime']):0x0;writeDB(channels[_0x4ce866[_0x0de3('0x8')]]);}}catch(_0x30b3b7){utils[_0x0de3('0x1e')](util[_0x0de3('0x7')](_0x0de3('0x2b'),_0x4ce866[_0x0de3('0x8')]),_0x30b3b7);}};exports[_0x0de3('0x35')]=function(_0x1c7306){try{if(!_[_0x0de3('0x23')](channels[_0x1c7306[_0x0de3('0x36')]])){utils[_0x0de3('0x15')](util[_0x0de3('0x7')](_0x0de3('0x37'),_0x1c7306[_0x0de3('0x38')]),_0x1c7306);if(channels[_0x1c7306[_0x0de3('0x36')]]['channel']==_0x1c7306[_0x0de3('0x39')]){utils[_0x0de3('0x6')](util[_0x0de3('0x7')](_0x0de3('0x3a'),_0x1c7306[_0x0de3('0x38')],_0x1c7306['localtwolinkedid'],_0x1c7306[_0x0de3('0x3b')]));channels[_0x1c7306[_0x0de3('0x36')]][_0x0de3('0x3c')]=_0x1c7306[_0x0de3('0x3b')];channels[_0x1c7306[_0x0de3('0x36')]][_0x0de3('0x3d')]=_0x0de3('0x3e');}else if(channels[_0x1c7306[_0x0de3('0x36')]][_0x0de3('0x9')]=_0x1c7306[_0x0de3('0x3f')]){utils['info'](util['format'](_0x0de3('0x3a'),_0x1c7306['origtransfereruniqueid'],_0x1c7306[_0x0de3('0x36')],_0x1c7306['origtransfererchannel']));channels[_0x1c7306[_0x0de3('0x36')]][_0x0de3('0x3c')]=_0x1c7306['origtransfererchannel'];channels[_0x1c7306[_0x0de3('0x36')]][_0x0de3('0x3d')]=_0x0de3('0x3e');}}}catch(_0x389e5f){utils[_0x0de3('0x1e')](util[_0x0de3('0x7')]('[%s][calls][attendedtransfer]',_0x1c7306[_0x0de3('0x38')]),_0x389e5f);}};exports['musiconholdstart']=function(_0x5abaf4){try{if(!_[_0x0de3('0x23')](channels[_0x5abaf4[_0x0de3('0x8')]])){utils[_0x0de3('0x15')](util[_0x0de3('0x7')](_0x0de3('0x40'),_0x5abaf4['uniqueid']),_0x5abaf4);channels[_0x5abaf4[_0x0de3('0x8')]][_0x0de3('0x41')]=utils['now']();utils['info'](util[_0x0de3('0x7')](_0x0de3('0x42'),_0x5abaf4['uniqueid'],channels[_0x5abaf4[_0x0de3('0x8')]][_0x0de3('0x41')]));}}catch(_0x54a9c5){utils[_0x0de3('0x1e')](util[_0x0de3('0x7')](_0x0de3('0x40'),_0x5abaf4[_0x0de3('0x8')]),_0x54a9c5);}};exports['musiconholdstop']=function(_0x303fab){try{if(!_[_0x0de3('0x23')](channels[_0x303fab['uniqueid']])){utils['debug'](util['format'](_0x0de3('0x43'),_0x303fab['uniqueid']),_0x303fab);if(!_[_0x0de3('0x23')](channels[_0x303fab['uniqueid']][_0x0de3('0x41')])){channels[_0x303fab[_0x0de3('0x8')]][_0x0de3('0x44')]+=utils[_0x0de3('0x32')](utils[_0x0de3('0x1c')](),channels[_0x303fab['uniqueid']]['musiconholdstartAt']);utils[_0x0de3('0x6')](util[_0x0de3('0x7')](_0x0de3('0x45'),_0x303fab['uniqueid'],channels[_0x303fab[_0x0de3('0x8')]][_0x0de3('0x44')]));delete channels[_0x303fab[_0x0de3('0x8')]][_0x0de3('0x41')];}}}catch(_0x3909a8){utils[_0x0de3('0x1e')](util[_0x0de3('0x7')](_0x0de3('0x43'),_0x303fab[_0x0de3('0x8')]),_0x3909a8);}};exports[_0x0de3('0x46')]=function(_0x567b88){try{if(!_[_0x0de3('0x23')](channels[_0x567b88[_0x0de3('0x8')]])){utils[_0x0de3('0x15')](util[_0x0de3('0x7')]('[%s][calls][varset]',_0x567b88[_0x0de3('0x8')]),_0x567b88);if(!_[_0x0de3('0x23')](_0x567b88[_0x0de3('0x47')][_0x0de3('0x48')])){utils[_0x0de3('0x6')](util['format'](_0x0de3('0x49'),_0x567b88[_0x0de3('0x8')],_0x567b88[_0x0de3('0x4a')]));channels[_0x567b88[_0x0de3('0x8')]]['source']=_0x567b88[_0x0de3('0x4a')];}if(!_[_0x0de3('0x23')](_0x567b88[_0x0de3('0x47')][_0x0de3('0x4b')])){utils[_0x0de3('0x6')](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x567b88[_0x0de3('0x8')],_0x567b88[_0x0de3('0x4a')]));channels[_0x567b88[_0x0de3('0x8')]][_0x0de3('0x4c')]=_0x567b88['value'];channels[_0x567b88['uniqueid']][_0x0de3('0x2c')]='\x22'+_0x567b88[_0x0de3('0x4a')]+_0x0de3('0x4d')+_0x567b88[_0x0de3('0x4a')]+'>';}if(!_[_0x0de3('0x23')](_0x567b88[_0x0de3('0x47')]['xmd-callerid-preview'])||!_[_0x0de3('0x23')](_0x567b88[_0x0de3('0x47')][_0x0de3('0x4e')])){utils[_0x0de3('0x6')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x567b88[_0x0de3('0x8')],!_[_0x0de3('0x23')](_0x567b88[_0x0de3('0x47')][_0x0de3('0x4f')])?_0x0de3('0x4f'):_0x0de3('0x4e'),_0x567b88[_0x0de3('0x4a')]));channels[_0x567b88['uniqueid']][_0x0de3('0x2c')]=_0x567b88['value'];}if(!_[_0x0de3('0x23')](_0x567b88[_0x0de3('0x47')][_0x0de3('0x50')])||!_[_0x0de3('0x23')](_0x567b88[_0x0de3('0x47')][_0x0de3('0x51')])){utils[_0x0de3('0x6')](util[_0x0de3('0x7')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x567b88['uniqueid'],!_[_0x0de3('0x23')](_0x567b88['variable'][_0x0de3('0x50')])?_0x0de3('0x50'):_0x0de3('0x51'),_0x567b88[_0x0de3('0x4a')]));channels[_0x567b88[_0x0de3('0x8')]][_0x0de3('0x52')]=_0x0de3('0x53');channels[_0x567b88['uniqueid']][_0x0de3('0x54')]=_0x567b88[_0x0de3('0x4a')];channels[_0x567b88[_0x0de3('0x8')]]['queue']=!![];}if(!_['isNil'](_0x567b88[_0x0de3('0x47')][_0x0de3('0x55')])){utils[_0x0de3('0x6')](util[_0x0de3('0x7')](_0x0de3('0x56'),_0x567b88[_0x0de3('0x8')],_0x567b88[_0x0de3('0x4a')]));channels[_0x567b88[_0x0de3('0x8')]]['ContactId']=_0x567b88[_0x0de3('0x4a')];}if(!_[_0x0de3('0x23')](_0x567b88[_0x0de3('0x47')][_0x0de3('0x57')])){utils[_0x0de3('0x6')](util[_0x0de3('0x7')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x567b88['uniqueid'],_0x567b88['value']));channels[_0x567b88[_0x0de3('0x8')]][_0x0de3('0x58')]=_0x567b88[_0x0de3('0x4a')];}if(!_[_0x0de3('0x23')](_0x567b88[_0x0de3('0x47')][_0x0de3('0x59')])){utils[_0x0de3('0x6')](util['format'](_0x0de3('0x5a'),_0x567b88[_0x0de3('0x8')],_0x567b88['value']));channels[_0x567b88[_0x0de3('0x8')]][_0x0de3('0x5b')]=_0x567b88[_0x0de3('0x4a')];}if(!_[_0x0de3('0x23')](_0x567b88[_0x0de3('0x47')][_0x0de3('0x5c')])){utils[_0x0de3('0x6')](util[_0x0de3('0x7')](_0x0de3('0x5d'),_0x567b88[_0x0de3('0x8')],_0x567b88[_0x0de3('0x4a')]));channels[_0x567b88[_0x0de3('0x8')]][_0x0de3('0x5c')]=_0x567b88[_0x0de3('0x4a')];}}}catch(_0x1951b6){utils['error'](util[_0x0de3('0x7')](_0x0de3('0x5e'),_0x567b88[_0x0de3('0x8')]),_0x1951b6);}};exports[_0x0de3('0x5f')]=function(_0x53558b){try{if(!_[_0x0de3('0x23')](channels[_0x53558b['uniqueid']])){utils[_0x0de3('0x15')](util[_0x0de3('0x7')](_0x0de3('0x60'),_0x53558b['uniqueid']),_0x53558b);utils[_0x0de3('0x6')](util[_0x0de3('0x7')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x53558b[_0x0de3('0x8')],_0x53558b[_0x0de3('0x61')],_0x53558b[_0x0de3('0x62')]));if(_0x53558b[_0x0de3('0x61')]['toLowerCase']()=='set'&&_[_0x0de3('0x63')](_0x53558b[_0x0de3('0x62')][_0x0de3('0x64')](),_0x0de3('0x65'))){var _0xf5f8a0=_0x53558b[_0x0de3('0x62')]['split']('=');var _0x4d7e8c=_0xf5f8a0[0x0][_0x0de3('0x66')](_0xf5f8a0[0x0][_0x0de3('0x67')]('(')+0x1,_0xf5f8a0[0x0][_0x0de3('0x67')](')'));var _0x25b650=_0xf5f8a0[0x1];channels[_0x53558b[_0x0de3('0x8')]][_0x4d7e8c]=_0x25b650;}if(!_[_0x0de3('0x68')]([_0x0de3('0x2a'),'noop','execif','set',_0x0de3('0x69')],_0x53558b[_0x0de3('0x61')][_0x0de3('0x64')]())){channels[_0x53558b['uniqueid']][_0x0de3('0x52')]=_0x53558b['application'];channels[_0x53558b['uniqueid']][_0x0de3('0x54')]=_0x53558b[_0x0de3('0x62')];}}}catch(_0x413328){utils[_0x0de3('0x1e')](util[_0x0de3('0x7')](_0x0de3('0x60'),_0x53558b[_0x0de3('0x8')]),_0x413328);}};
\ No newline at end of file
+var _0x3e79=['gotoif','lastdata','lodash','util','./utils','NO\x20ANSWER','FAILED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','linkedid','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','debug','[%s][calls][newstate]','isNil','channelstate','systemanswertime','transfer','destinationchannel','answertime','disposition','ANSWERED','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','xmd-contactid','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][newexten]','application','set','startsWith','appdata','toLowerCase','cdr','split','substring','lastIndexOf','includes','noop','execif'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3e79,0xd4));var _0x93e7=function(_0x56188d,_0x514566){_0x56188d=_0x56188d-0x0;var _0x6004b1=_0x3e79[_0x56188d];return _0x6004b1;};'use strict';var _=require(_0x93e7('0x0'));var util=require(_0x93e7('0x1'));var utils=require(_0x93e7('0x2'));var dispositions=[_0x93e7('0x3'),_0x93e7('0x4'),_0x93e7('0x4'),_0x93e7('0x3'),_0x93e7('0x3'),'NO\x20ANSWER','ANSWERED',_0x93e7('0x5'),_0x93e7('0x4'),'FAILED',_0x93e7('0x4')];var channels={};function writeDB(_0x5e7fc5){utils[_0x93e7('0x6')](util[_0x93e7('0x7')](_0x93e7('0x8'),_0x5e7fc5[_0x93e7('0x9')],_0x5e7fc5['channel'],_0x5e7fc5[_0x93e7('0xa')],_0x5e7fc5['membername'],_0x5e7fc5[_0x93e7('0xb')],_0x5e7fc5[_0x93e7('0xc')],_0x5e7fc5[_0x93e7('0xd')],_0x5e7fc5[_0x93e7('0xe')]));if(_0x5e7fc5[_0x93e7('0xf')]){utils[_0x93e7('0x10')](_0x5e7fc5[_0x93e7('0xf')])[_0x93e7('0x11')](function(_0x4052f8){if(_0x4052f8){_0x5e7fc5[_0x93e7('0x12')]=_0x4052f8['id'];}utils[_0x93e7('0x13')](_0x93e7('0x14'),_0x5e7fc5);});}else{utils['request'](_0x93e7('0x14'),_0x5e7fc5);}if(channels[_0x5e7fc5[_0x93e7('0x9')]]){delete channels[_0x5e7fc5[_0x93e7('0x9')]];}}exports[_0x93e7('0x15')]=function(_0x3e65c4){try{utils['debug'](util[_0x93e7('0x7')]('[%s][calls][newchannel]',_0x3e65c4[_0x93e7('0x9')]),_0x3e65c4);if(_0x3e65c4[_0x93e7('0x9')]==_0x3e65c4[_0x93e7('0x16')]&&_0x3e65c4[_0x93e7('0x17')]!=_0x93e7('0x18')){utils[_0x93e7('0x6')](util[_0x93e7('0x7')](_0x93e7('0x19'),_0x3e65c4['uniqueid'],_0x3e65c4[_0x93e7('0x1a')],_0x3e65c4[_0x93e7('0x1b')]));channels[_0x3e65c4[_0x93e7('0x9')]]={'uniqueid':_0x3e65c4[_0x93e7('0x9')],'accountcode':_0x3e65c4[_0x93e7('0xf')],'source':_0x3e65c4['calleridnum'],'destination':_0x3e65c4[_0x93e7('0x1b')],'destinationcontext':_0x3e65c4[_0x93e7('0x1a')],'channel':_0x3e65c4[_0x93e7('0x17')],'starttime':utils[_0x93e7('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x93e7('0x1d')};}}catch(_0x23e95f){utils[_0x93e7('0x1e')](util['format']('[%s][calls][newchannel]',_0x3e65c4[_0x93e7('0x9')]),_0x23e95f);}};exports['newstate']=function(_0x1aef5c){try{utils[_0x93e7('0x1f')](util['format'](_0x93e7('0x20'),_0x1aef5c['uniqueid']),_0x1aef5c);if(!_[_0x93e7('0x21')](channels[_0x1aef5c[_0x93e7('0x9')]])&&_0x1aef5c[_0x93e7('0x22')]==0x6){utils[_0x93e7('0x6')](util[_0x93e7('0x7')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x1aef5c[_0x93e7('0x9')],_0x1aef5c[_0x93e7('0x1a')],_0x1aef5c[_0x93e7('0x17')]));if(_[_0x93e7('0x21')](channels[_0x1aef5c['uniqueid']]['systemanswertime'])){channels[_0x1aef5c[_0x93e7('0x9')]][_0x93e7('0x23')]=utils['now']();}}else if(!_[_0x93e7('0x21')](channels[_0x1aef5c[_0x93e7('0x16')]])&&_0x1aef5c['channelstate']==0x6&&_0x1aef5c[_0x93e7('0x1a')]!=_0x93e7('0x24')){utils[_0x93e7('0x6')](util[_0x93e7('0x7')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x1aef5c[_0x93e7('0x9')],_0x1aef5c[_0x93e7('0x16')],_0x1aef5c['context'],_0x1aef5c[_0x93e7('0x17')]));channels[_0x1aef5c[_0x93e7('0x16')]][_0x93e7('0xf')]=_0x1aef5c[_0x93e7('0xf')];channels[_0x1aef5c[_0x93e7('0x16')]][_0x93e7('0x25')]=_0x1aef5c[_0x93e7('0x17')];if(_[_0x93e7('0x21')](channels[_0x1aef5c[_0x93e7('0x16')]][_0x93e7('0x26')])){channels[_0x1aef5c[_0x93e7('0x16')]][_0x93e7('0x26')]=utils['now']();}channels[_0x1aef5c['linkedid']][_0x93e7('0x27')]=dispositions[_['toNumber'](_0x1aef5c[_0x93e7('0x22')])]||_0x93e7('0x28');}}catch(_0x26773a){utils[_0x93e7('0x1e')](util['format']('[%s][calls][newstate]',_0x1aef5c[_0x93e7('0x9')]),_0x26773a);}};exports[_0x93e7('0x29')]=function(_0x2c5cf0){try{if(!_['isNil'](channels[_0x2c5cf0[_0x93e7('0x9')]])){utils[_0x93e7('0x1f')](util[_0x93e7('0x7')](_0x93e7('0x2a'),_0x2c5cf0[_0x93e7('0x9')]),_0x2c5cf0);if(_['isNil'](channels[_0x2c5cf0['uniqueid']][_0x93e7('0x2b')])){channels[_0x2c5cf0[_0x93e7('0x9')]][_0x93e7('0x2b')]=_0x2c5cf0[_0x93e7('0x2c')]+'\x20<'+_0x2c5cf0[_0x93e7('0xc')]+'>';}utils[_0x93e7('0x6')](util[_0x93e7('0x7')](_0x93e7('0x2d'),_0x2c5cf0[_0x93e7('0x9')],channels[_0x2c5cf0['uniqueid']][_0x93e7('0x2b')],_0x2c5cf0[_0x93e7('0x2e')]));channels[_0x2c5cf0[_0x93e7('0x9')]][_0x93e7('0x2f')]=utils[_0x93e7('0x1c')]();channels[_0x2c5cf0['uniqueid']][_0x93e7('0x30')]=utils[_0x93e7('0x31')](channels[_0x2c5cf0[_0x93e7('0x9')]][_0x93e7('0x2f')],channels[_0x2c5cf0['uniqueid']][_0x93e7('0x32')]);channels[_0x2c5cf0[_0x93e7('0x9')]][_0x93e7('0x33')]=channels[_0x2c5cf0[_0x93e7('0x9')]][_0x93e7('0x26')]?utils['diffTime'](channels[_0x2c5cf0[_0x93e7('0x9')]][_0x93e7('0x2f')],channels[_0x2c5cf0[_0x93e7('0x9')]]['answertime']):0x0;writeDB(channels[_0x2c5cf0[_0x93e7('0x9')]]);}}catch(_0x3968ca){utils[_0x93e7('0x1e')](util[_0x93e7('0x7')]('[%s][calls][hangup]',_0x2c5cf0[_0x93e7('0x9')]),_0x3968ca);}};exports[_0x93e7('0x34')]=function(_0x65f7fa){try{if(!_[_0x93e7('0x21')](channels[_0x65f7fa['localtwolinkedid']])){utils['debug'](util[_0x93e7('0x7')](_0x93e7('0x35'),_0x65f7fa[_0x93e7('0x36')]),_0x65f7fa);if(channels[_0x65f7fa[_0x93e7('0x37')]][_0x93e7('0x17')]==_0x65f7fa['transfereechannel']){utils[_0x93e7('0x6')](util[_0x93e7('0x7')](_0x93e7('0x38'),_0x65f7fa[_0x93e7('0x36')],_0x65f7fa['localtwolinkedid'],_0x65f7fa[_0x93e7('0x39')]));channels[_0x65f7fa[_0x93e7('0x37')]][_0x93e7('0x25')]=_0x65f7fa[_0x93e7('0x39')];channels[_0x65f7fa['localtwolinkedid']][_0x93e7('0x3a')]=_0x93e7('0x3b');}else if(channels[_0x65f7fa[_0x93e7('0x37')]]['channel']=_0x65f7fa[_0x93e7('0x3c')]){utils['info'](util[_0x93e7('0x7')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x65f7fa[_0x93e7('0x36')],_0x65f7fa['localtwolinkedid'],_0x65f7fa[_0x93e7('0x3d')]));channels[_0x65f7fa[_0x93e7('0x37')]]['destinationchannel']=_0x65f7fa['origtransfererchannel'];channels[_0x65f7fa[_0x93e7('0x37')]][_0x93e7('0x3a')]=_0x93e7('0x3b');}}}catch(_0x241fb9){utils[_0x93e7('0x1e')](util['format'](_0x93e7('0x35'),_0x65f7fa[_0x93e7('0x36')]),_0x241fb9);}};exports[_0x93e7('0x3e')]=function(_0x358b08){try{if(!_['isNil'](channels[_0x358b08[_0x93e7('0x9')]])){utils['debug'](util[_0x93e7('0x7')](_0x93e7('0x3f'),_0x358b08[_0x93e7('0x9')]),_0x358b08);channels[_0x358b08[_0x93e7('0x9')]]['musiconholdstartAt']=utils['now']();utils[_0x93e7('0x6')](util[_0x93e7('0x7')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x358b08[_0x93e7('0x9')],channels[_0x358b08[_0x93e7('0x9')]][_0x93e7('0x40')]));}}catch(_0x1c01b5){utils['error'](util[_0x93e7('0x7')](_0x93e7('0x3f'),_0x358b08[_0x93e7('0x9')]),_0x1c01b5);}};exports[_0x93e7('0x41')]=function(_0x2e54cd){try{if(!_[_0x93e7('0x21')](channels[_0x2e54cd[_0x93e7('0x9')]])){utils['debug'](util['format'](_0x93e7('0x42'),_0x2e54cd[_0x93e7('0x9')]),_0x2e54cd);if(!_[_0x93e7('0x21')](channels[_0x2e54cd[_0x93e7('0x9')]][_0x93e7('0x40')])){channels[_0x2e54cd[_0x93e7('0x9')]]['mohtime']+=utils[_0x93e7('0x31')](utils[_0x93e7('0x1c')](),channels[_0x2e54cd[_0x93e7('0x9')]][_0x93e7('0x40')]);utils[_0x93e7('0x6')](util[_0x93e7('0x7')](_0x93e7('0x43'),_0x2e54cd['uniqueid'],channels[_0x2e54cd[_0x93e7('0x9')]][_0x93e7('0x44')]));delete channels[_0x2e54cd['uniqueid']][_0x93e7('0x40')];}}}catch(_0x29505d){utils[_0x93e7('0x1e')](util['format'](_0x93e7('0x42'),_0x2e54cd['uniqueid']),_0x29505d);}};exports[_0x93e7('0x45')]=function(_0x21024){try{if(!_['isNil'](channels[_0x21024[_0x93e7('0x9')]])){utils[_0x93e7('0x1f')](util['format'](_0x93e7('0x46'),_0x21024[_0x93e7('0x9')]),_0x21024);if(!_[_0x93e7('0x21')](_0x21024[_0x93e7('0x47')]['xmd-originatecalleridnum'])){utils[_0x93e7('0x6')](util[_0x93e7('0x7')](_0x93e7('0x48'),_0x21024['uniqueid'],_0x21024[_0x93e7('0x49')]));channels[_0x21024['uniqueid']]['source']=_0x21024[_0x93e7('0x49')];}if(!_[_0x93e7('0x21')](_0x21024[_0x93e7('0x47')][_0x93e7('0x4a')])){utils[_0x93e7('0x6')](util[_0x93e7('0x7')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x21024[_0x93e7('0x9')],_0x21024[_0x93e7('0x49')]));channels[_0x21024['uniqueid']][_0x93e7('0x4b')]=_0x21024[_0x93e7('0x49')];channels[_0x21024[_0x93e7('0x9')]][_0x93e7('0x2b')]='\x22'+_0x21024[_0x93e7('0x49')]+_0x93e7('0x4c')+_0x21024[_0x93e7('0x49')]+'>';}if(!_[_0x93e7('0x21')](_0x21024[_0x93e7('0x47')][_0x93e7('0x4d')])||!_[_0x93e7('0x21')](_0x21024[_0x93e7('0x47')][_0x93e7('0x4e')])){utils[_0x93e7('0x6')](util[_0x93e7('0x7')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x21024[_0x93e7('0x9')],!_[_0x93e7('0x21')](_0x21024[_0x93e7('0x47')][_0x93e7('0x4d')])?_0x93e7('0x4d'):'xmd-callerid',_0x21024[_0x93e7('0x49')]));channels[_0x21024[_0x93e7('0x9')]][_0x93e7('0x2b')]=_0x21024[_0x93e7('0x49')];}if(!_[_0x93e7('0x21')](_0x21024[_0x93e7('0x47')][_0x93e7('0x4f')])||!_[_0x93e7('0x21')](_0x21024[_0x93e7('0x47')][_0x93e7('0x50')])){utils[_0x93e7('0x6')](util[_0x93e7('0x7')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x21024[_0x93e7('0x9')],!_[_0x93e7('0x21')](_0x21024['variable']['xmd-queue'])?_0x93e7('0x4f'):_0x93e7('0x50'),_0x21024[_0x93e7('0x49')]));channels[_0x21024[_0x93e7('0x9')]][_0x93e7('0x51')]='Queue';channels[_0x21024[_0x93e7('0x9')]]['lastdata']=_0x21024['value'];channels[_0x21024[_0x93e7('0x9')]][_0x93e7('0xa')]=!![];}if(!_[_0x93e7('0x21')](_0x21024[_0x93e7('0x47')][_0x93e7('0x52')])){utils[_0x93e7('0x6')](util['format']('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x21024[_0x93e7('0x9')],_0x21024['value']));channels[_0x21024['uniqueid']][_0x93e7('0x53')]=_0x21024[_0x93e7('0x49')];}if(!_[_0x93e7('0x21')](_0x21024[_0x93e7('0x47')][_0x93e7('0x54')])){utils[_0x93e7('0x6')](util['format'](_0x93e7('0x55'),_0x21024[_0x93e7('0x9')],_0x21024[_0x93e7('0x49')]));channels[_0x21024[_0x93e7('0x9')]]['type']=_0x21024[_0x93e7('0x49')];}if(!_[_0x93e7('0x21')](_0x21024[_0x93e7('0x47')][_0x93e7('0x56')])){utils['info'](util[_0x93e7('0x7')](_0x93e7('0x57'),_0x21024[_0x93e7('0x9')],_0x21024['value']));channels[_0x21024[_0x93e7('0x9')]]['routeid']=_0x21024[_0x93e7('0x49')];}if(!_[_0x93e7('0x21')](_0x21024[_0x93e7('0x47')]['sipcallid'])){utils[_0x93e7('0x6')](util['format'](_0x93e7('0x58'),_0x21024[_0x93e7('0x9')],_0x21024['value']));channels[_0x21024['uniqueid']][_0x93e7('0x59')]=_0x21024[_0x93e7('0x49')];}}}catch(_0x10a1b7){utils[_0x93e7('0x1e')](util['format'](_0x93e7('0x46'),_0x21024[_0x93e7('0x9')]),_0x10a1b7);}};exports['newexten']=function(_0x17662e){try{if(!_['isNil'](channels[_0x17662e['uniqueid']])){utils['debug'](util['format'](_0x93e7('0x5a'),_0x17662e[_0x93e7('0x9')]),_0x17662e);utils[_0x93e7('0x6')](util[_0x93e7('0x7')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x17662e[_0x93e7('0x9')],_0x17662e[_0x93e7('0x5b')],_0x17662e['appdata']));if(_0x17662e[_0x93e7('0x5b')]['toLowerCase']()==_0x93e7('0x5c')&&_[_0x93e7('0x5d')](_0x17662e[_0x93e7('0x5e')][_0x93e7('0x5f')](),_0x93e7('0x60'))){var _0x19f8f5=_0x17662e[_0x93e7('0x5e')][_0x93e7('0x61')]('=');var _0x5df19b=_0x19f8f5[0x0][_0x93e7('0x62')](_0x19f8f5[0x0][_0x93e7('0x63')]('(')+0x1,_0x19f8f5[0x0][_0x93e7('0x63')](')'));var _0x5a2bd9=_0x19f8f5[0x1];channels[_0x17662e['uniqueid']][_0x5df19b]=_0x5a2bd9;}if(!_[_0x93e7('0x64')]([_0x93e7('0x29'),_0x93e7('0x65'),_0x93e7('0x66'),_0x93e7('0x5c'),_0x93e7('0x67')],_0x17662e['application'][_0x93e7('0x5f')]())){channels[_0x17662e['uniqueid']][_0x93e7('0x51')]=_0x17662e[_0x93e7('0x5b')];channels[_0x17662e[_0x93e7('0x9')]][_0x93e7('0x68')]=_0x17662e[_0x93e7('0x5e')];}}}catch(_0x4a29c0){utils['error'](util[_0x93e7('0x7')]('[%s][calls][newexten]',_0x17662e['uniqueid']),_0x4a29c0);}};
\ No newline at end of file