Begin AMBE Data Dump

This commit is contained in:
Cort Buffington 2015-03-24 11:06:42 -05:00
parent 5c27ce4d52
commit b9b21ebebf
3 changed files with 69 additions and 4 deletions

61
ambe_audio.py Executable file
View File

@ -0,0 +1,61 @@
#!/usr/bin/env python
#
# This work is licensed under the Creative Commons Attribution-ShareAlike
# 3.0 Unported License.To view a copy of this license, visit
# http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to
# Creative Commons, 444 Castro Street, Suite 900, Mountain View,
# California, 94041, USA.
# This is a sample applicaiton that dumps all raw AMBE+2 voice frame data
# It is useful for things like, decoding the audio stream with a DVSI dongle, etc.
from __future__ import print_function
from twisted.internet import reactor
from binascii import b2a_hex as h
import sys
import cPickle as pickle
from dmrlink import IPSC, NETWORK, networks, logger, int_id, hex_str_3
__author__ = 'Cortney T. Buffington, N0MJS'
__copyright__ = 'Copyright (c) 2015 Cortney T. Buffington, N0MJS and the K0USY Group'
__credits__ = 'Adam Fast, KC0YLK; Dave K; and he who wishes not to be named'
__license__ = 'Creative Commons Attribution-ShareAlike 3.0 Unported'
__maintainer__ = 'Cort Buffington, N0MJS'
__version__ = '0.1a'
__email__ = 'n0mjs@me.com'
__status__ = 'pre-alpha'
try:
from ipsc.ipsc_message_types import *
except ImportError:
sys.exit('IPSC message types file not found or invalid')
class ambeIPSC(IPSC):
def __init__(self, *args, **kwargs):
IPSC.__init__(self, *args, **kwargs)
self.CALL_DATA = []
#************************************************
# CALLBACK FUNCTIONS FOR USER PACKET TYPES
#************************************************
#
def group_voice(self, _network, _src_sub, _dst_sub, _ts, _end, _peerid, _data):
# THIS FUNCTION IS NOT COMPLETE!!!!
_payload_type = _data[30:31]
if _payload_type == BURST_DATA_TYPE['SLOT1_VOICE']:
print('SLOT 1 Voice Burst Data Recieved')
if _payload_type == BURST_DATA_TYPE['SLOT2_VOICE']:
print('SLOT 2 Voice Burst Data Recieved')
if __name__ == '__main__':
logger.info('DMRlink \'ambe_audio.py\' (c) 2015 N0MJS & the K0USY Group - SYSTEM STARTING...')
for ipsc_network in NETWORK:
if NETWORK[ipsc_network]['LOCAL']['ENABLED']:
networks[ipsc_network] = ambeIPSC(ipsc_network)
reactor.listenUDP(NETWORK[ipsc_network]['LOCAL']['PORT'], networks[ipsc_network], interface=NETWORK[ipsc_network]['LOCAL']['IP'])
reactor.run()

View File

@ -36,7 +36,7 @@ from twisted.internet import reactor
from twisted.internet import task from twisted.internet import task
__author__ = 'Cortney T. Buffington, N0MJS' __author__ = 'Cortney T. Buffington, N0MJS'
__copyright__ = 'Copyright (c) 2013, 2014 Cortney T. Buffington, N0MJS and the K0USY Group' __copyright__ = 'Copyright (c) 2013 - 2015 Cortney T. Buffington, N0MJS and the K0USY Group'
__credits__ = 'Adam Fast, KC0YLK, Dave K, and he who wishes not to be named' __credits__ = 'Adam Fast, KC0YLK, Dave K, and he who wishes not to be named'
__license__ = 'Creative Commons Attribution-ShareAlike 3.0 Unported' __license__ = 'Creative Commons Attribution-ShareAlike 3.0 Unported'
__version__ = '0.27b' __version__ = '0.27b'
@ -1126,7 +1126,7 @@ class IPSC(DatagramProtocol):
_ts = bool(_call_info & TS_CALL_MSK) _ts = bool(_call_info & TS_CALL_MSK)
_end = bool(_call_info & END_MSK) _end = bool(_call_info & END_MSK)
# Extract RTP header fields # Extract RTP Header Fields
''' '''
Coming soon kids!!! Coming soon kids!!!
Looks like version, padding, extention, CSIC, payload type and SSID never change. Looks like version, padding, extention, CSIC, payload type and SSID never change.
@ -1135,6 +1135,10 @@ class IPSC(DatagramProtocol):
_rtp_byte_2 = int_id(data[19:20]) _rtp_byte_2 = int_id(data[19:20])
_rtp_seq = int_id(data[20:22]) _rtp_seq = int_id(data[20:22])
_rtp_tmstmp = int_id(data[22:26]) _rtp_tmstmp = int_id(data[22:26])
_rtp_ssid = int_id(data[26:30])
# Extract RTP Payload Data Fields
_payload_type = int_id(data[30:31])
''' '''
# User Voice and Data Call Types: # User Voice and Data Call Types:
@ -1281,7 +1285,7 @@ class IPSC(DatagramProtocol):
#************************************************ #************************************************
if __name__ == '__main__': if __name__ == '__main__':
logger.info('DMRlink \'dmrlink.py\' (c) 2013, 2014 N0MJS & the K0USY Group - SYSTEM STARTING...') logger.info('DMRlink \'dmrlink.py\' (c) 2013 - 2015 N0MJS & the K0USY Group - SYSTEM STARTING...')
networks = {} networks = {}
for ipsc_network in NETWORK: for ipsc_network in NETWORK:

View File

@ -1,4 +1,4 @@
# Copyright (c) 2013, 2014 Cortney T. Buffington, N0MJS and the K0USY Group. n0mjs@me.com # Copyright (c) 2013 - 2015 Cortney T. Buffington, N0MJS and the K0USY Group. n0mjs@me.com
# #
# This work is licensed under the Creative Commons Attribution-ShareAlike # This work is licensed under the Creative Commons Attribution-ShareAlike
# 3.0 Unported License.To view a copy of this license, visit # 3.0 Unported License.To view a copy of this license, visit