More Decoding

This commit is contained in:
Cort Buffington 2014-08-13 17:14:46 -05:00
parent ce29b8de2d
commit 8a378fe2c1
2 changed files with 47 additions and 6 deletions

View File

@ -949,6 +949,7 @@ class IPSC(DatagramProtocol):
def datagramReceived(self, data, (host, port)):
_packettype = data[0:1]
_peerid = data[1:5]
_ipsc_seq = data[5:6]
# AUTHENTICATE THE PACKET
if not self.validate_auth(self._local['AUTH_KEY'], data):
@ -966,12 +967,25 @@ class IPSC(DatagramProtocol):
# ORIGINATED BY SUBSCRIBER UNITS - a.k.a someone transmitted
if _packettype in USER_PACKETS:
# Extract commonly used items from the packet header
# Extract IPSC header not already extracted
_src_sub = data[6:9]
_dst_sub = data[9:12]
_call = int_id(data[17:18])
_ts = bool(_call & TS_CALL_MSK)
_end = bool(_call & END_MSK)
_call_type = data[12:13]
_unknown_1 = data[13:17]
_call_info = int_id(data[17:18])
_ts = bool(_call_info & TS_CALL_MSK)
_end = bool(_call_info & END_MSK)
# Extract RTP header fields
'''
Coming soon kids!!!
Looks like version, padding, extention, CSIC, payload type and SSID never change.
The things we might care about are below.
_rtp_byte_1 = int_id(data[18:19])
_rtp_byte_2 = int_id(data[19:20])
_rtp_seq = int_id(data[20:22])
_rtp_tmstmp = int_id(data[22:26])
'''
# User Voice and Data Call Types:
if _packettype == GROUP_VOICE:

View File

@ -6,6 +6,11 @@
# Creative Commons, 444 Castro Street, Suite 900, Mountain View,
# California, 94041, USA.
# MASKS FOR IPSC, RTP AND THE RTP PAYLOAD (DMR FRAME + FRIENDS) ARE LOCATED
# IN THIS FILE IN THIS ORDER: IPSC, RTP, PAYLOAD
# IPSC MASK VALUES
#
# LINKING STATUS:
# Byte 1 - BIT FLAGS:
# xx.. .... = Peer Operational (01 only known valid value)
@ -53,7 +58,6 @@ VOICE_CALL_MSK = 0b00000100
MSTR_PEER_MSK = 0b00000001
# TIMESLOT CALL & STATUS BYTE
# Byte 17 of Group and Private Voice/Data Packets
# ..x.. ....TS Value (0=TS1, 1=TS2)
# .x... ....TS In Progress/End (0=In Progress, 1=End)
@ -61,3 +65,26 @@ MSTR_PEER_MSK = 0b00000001
# MASK VALUE:
END_MSK = 0b01000000
TS_CALL_MSK = 0b00100000
# RTP MASK VALUES
# Bytes 1 and 2 of the RTP header are bit-fields, the rest
# are at least one byte long, and do not need masked
# Byte 1
RTP_VER_MSK = 0b11000000
RTP_PAD_MSK = 0b00100000
RTP_EXT_MSK = 0b00010000
RTP_CSIC_MSK = 0b00001111
# Byte 2
RTP_MRKR_MSK = 0b10000000
RTP_PAY_TYPE_MSK = 0b01111111
# RTP PAYLOAD (DMR FRAME + FRIENDS) MASK VALUES
# This one is tricky. The DMR Frame contents are here
# and re-ordered from their position in the original DMR
# frame format. There are also some other friends in here
# that Motorla added.
#