NOW WORKING!
This module records transmissions on an identified TGID and immediately plays them back on the same IPSC, TS and TGID.
This commit is contained in:
parent
3e8177f80b
commit
c3a33c7c85
21
playback.py
21
playback.py
@ -10,13 +10,11 @@
|
|||||||
|
|
||||||
# This is a sample application that "records" and replays transmissions for testing.
|
# This is a sample application that "records" and replays transmissions for testing.
|
||||||
|
|
||||||
# THIS MODULE DOES NOT YET WORK!!!!!
|
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
from binascii import b2a_hex as h
|
from binascii import b2a_hex as h
|
||||||
|
|
||||||
import time
|
import sys, time
|
||||||
from dmrlink import IPSC, UnauthIPSC, NETWORK, networks, logger, dmr_nat, int_id, send_to_ipsc
|
from dmrlink import IPSC, UnauthIPSC, NETWORK, networks, logger, dmr_nat, int_id, send_to_ipsc
|
||||||
|
|
||||||
__author__ = 'Cortney T. Buffington, N0MJS'
|
__author__ = 'Cortney T. Buffington, N0MJS'
|
||||||
@ -28,6 +26,9 @@ __maintainer__ = 'Cort Buffington, N0MJS'
|
|||||||
__email__ = 'n0mjs@me.com'
|
__email__ = 'n0mjs@me.com'
|
||||||
__status__ = 'pre-alpha'
|
__status__ = 'pre-alpha'
|
||||||
|
|
||||||
|
# TGID to listen for and repeat on
|
||||||
|
TGID = '\x00\x00\x0A'
|
||||||
|
|
||||||
class playbackIPSC(IPSC):
|
class playbackIPSC(IPSC):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
@ -39,22 +40,24 @@ class playbackIPSC(IPSC):
|
|||||||
#************************************************
|
#************************************************
|
||||||
|
|
||||||
def group_voice(self, _network, _src_sub, _dst_sub, _ts, _end, _peerid, _data):
|
def group_voice(self, _network, _src_sub, _dst_sub, _ts, _end, _peerid, _data):
|
||||||
#_log = logger.debug
|
if TGID == _dst_sub:
|
||||||
if not _end:
|
if not _end:
|
||||||
|
if not self.CALL_DATA:
|
||||||
|
logger.info('(%s) Receiving transmission to be played back from subscriber: %s', _network, int_id(_src_sub))
|
||||||
_tmp_data = _data
|
_tmp_data = _data
|
||||||
#_tmp_data = dmr_nat(_data, _src_sub, NETWORK[_network]['LOCAL']['RADIO_ID'])
|
#_tmp_data = dmr_nat(_data, _src_sub, NETWORK[_network]['LOCAL']['RADIO_ID'])
|
||||||
self.CALL_DATA.append(_tmp_data)
|
self.CALL_DATA.append(_tmp_data)
|
||||||
if _end:
|
if _end:
|
||||||
self.CALL_DATA.append(_data)
|
self.CALL_DATA.append(_data)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
print()
|
logger.info('(%s) Playing back transmission from subscriber: %s', _network, int_id(_src_sub))
|
||||||
print('Repeating Group Voice Call ', h(_src_sub), ' ', h(_dst_sub) ,' ', h(_peerid), ' ', h(NETWORK[_network]['LOCAL']['RADIO_ID']))
|
|
||||||
for i in self.CALL_DATA:
|
for i in self.CALL_DATA:
|
||||||
_tmp_data = self.hashed_packet(NETWORK[_network]['LOCAL']['AUTH_KEY'], i)
|
_tmp_data = i
|
||||||
|
_tmp_data = _tmp_data.replace(_peerid, NETWORK[_network]['LOCAL']['RADIO_ID'])
|
||||||
|
_tmp_data = self.hashed_packet(NETWORK[_network]['LOCAL']['AUTH_KEY'], _tmp_data)
|
||||||
# Send the packet to all peers in the target IPSC
|
# Send the packet to all peers in the target IPSC
|
||||||
send_to_ipsc(_network, _tmp_data)
|
send_to_ipsc(_network, _tmp_data)
|
||||||
print(_network, ' ', h(_tmp_data))
|
time.sleep(0.06)
|
||||||
time.sleep(0.05)
|
|
||||||
self.CALL_DATA = []
|
self.CALL_DATA = []
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user