diff --git a/ambe_audio.py b/ambe_audio.py new file mode 100755 index 0000000..8afaa51 --- /dev/null +++ b/ambe_audio.py @@ -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() diff --git a/dmrlink.py b/dmrlink.py index 0770c32..0e88584 100755 --- a/dmrlink.py +++ b/dmrlink.py @@ -36,7 +36,7 @@ from twisted.internet import reactor from twisted.internet import task __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' __license__ = 'Creative Commons Attribution-ShareAlike 3.0 Unported' __version__ = '0.27b' @@ -1126,7 +1126,7 @@ class IPSC(DatagramProtocol): _ts = bool(_call_info & TS_CALL_MSK) _end = bool(_call_info & END_MSK) - # Extract RTP header fields + # Extract RTP Header Fields ''' Coming soon kids!!! 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_seq = int_id(data[20:22]) _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: @@ -1281,7 +1285,7 @@ class IPSC(DatagramProtocol): #************************************************ 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 = {} for ipsc_network in NETWORK: diff --git a/ipsc/ipsc_message_types.py b/ipsc/ipsc_message_types.py index 086a20a..18ba055 100644 --- a/ipsc/ipsc_message_types.py +++ b/ipsc/ipsc_message_types.py @@ -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 # 3.0 Unported License.To view a copy of this license, visit