diff --git a/dmrlink.py b/dmrlink.py index 00b6854..6467a02 100755 --- a/dmrlink.py +++ b/dmrlink.py @@ -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: diff --git a/ipsc/ipsc_mask.py b/ipsc/ipsc_mask.py index 431cf7d..6c160e6 100644 --- a/ipsc/ipsc_mask.py +++ b/ipsc/ipsc_mask.py @@ -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,11 +58,33 @@ 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) # Possible values: 0x00=TS1, 0x20=TS2, 0x40=TS1 End, 0x60=TS2 End # MASK VALUE: END_MSK = 0b01000000 -TS_CALL_MSK = 0b00100000 \ No newline at end of file +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. +# \ No newline at end of file