add call timer

This commit is contained in:
Cort Buffington 2016-09-10 16:34:50 -05:00
parent c33ba91f4f
commit 74eb8edb5f
1 changed files with 5 additions and 4 deletions

View File

@ -176,6 +176,7 @@ class bridgeIPSC(IPSC):
}
self.last_seq_id = '\x00'
self.call_start = 0
# Setup the backup/polite bridging maintenance loop (based on keep-alive timer)
@ -335,16 +336,16 @@ class bridgeIPSC(IPSC):
if _burst_data_type == BURST_DATA_TYPE['VOICE_HEAD']:
if self.last_seq_id != _seq_id:
self.last_seq_id = _seq_id
call_start = time()
self.call_start = time()
logger.info('(%s) GROUP VOICE START: PEER: %s, SUB: %s, TS: %s, TGID: %s', _network, int_id(_peerid), int_id(_src_sub), _ts+1, int_id(_dst_group))
# Action happens on un-key
if _burst_data_type == BURST_DATA_TYPE['VOICE_TERM']:
if self.last_seq_id == _seq_id:
call_duration = time() - call_start
logger.info('(%s) GROUP VOICE END: PEER: %s, SUB: %s, TS: %s, TGID: %s Duration: %ss', _network, int_id(_peerid), int_id(_src_sub), _ts+1, int_id(_dst_group), call_duration)
self.call_duration = time() - self.call_start
logger.info('(%s) GROUP VOICE END: PEER: %s, SUB: %s, TS: %s, TGID: %s Duration: %ss', _network, int_id(_peerid), int_id(_src_sub), _ts+1, int_id(_dst_group), self.call_duration)
else:
logger.warning('(%s) GROUP VOICE END WITHOUT MATCHING START: PEER: %s, SUB: %s, TS: %s, TGID: %s', _network, int_id(_peerid), int_id(_src_sub), _ts+1, int_id(_dst_group))
logger.warning('(%s) GROUP VOICE END WITHOUT MATCHING START: PEER: %s, SUB: %s, TS: %s, TGID: %s', _network, int_id(_peerid), int_id(_src_sub), _ts+1, int_id(_dst_group),)
# Iterate the rules dictionary
for rule in RULES[_network]['GROUP_VOICE']: