HBLink-org / hblink3

HBlink for Python3
GNU General Public License v3.0
65 stars 69 forks source link

Talker Alias causes an Exception #8

Open marrold opened 3 years ago

marrold commented 3 years ago

Hi,

I am using hblink in a bridged configuration and have noticed DMRA frames cause an exception in the logs:

Unhandled Error
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/twisted/python/log.py", line 86, in callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
  File "/usr/local/lib/python3.7/dist-packages/twisted/python/context.py", line 122, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/usr/local/lib/python3.7/dist-packages/twisted/python/context.py", line 85, in callWithContext
    return func(*args,**kw)
  File "/usr/local/lib/python3.7/dist-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
    why = selectable.doRead()
--- <exception caught here> ---
  File "/usr/local/lib/python3.7/dist-packages/twisted/internet/udp.py", line 249, in doRead
    self.protocol.datagramReceived(data, addr)
  File "/opt/hblink3/hblink.py", line 532, in master_datagramReceived
    logger.info('(%s) Recieved DMR Talker Alias from peer %s, subscriber %s', self._system, self._peers[_peer_id]['CALLSIGN'], int_id(_rf_src))
builtins.UnboundLocalError: local variable '_rf_src' referenced before assignment

Looking at the code, _rf_src is indeed referenced before assignment. A quick fix would be to just pass DMRA frames but it would be nice to extract the info I guess.

Thanks Matthew 2E0SIP

randybuildsthings commented 3 years ago

It's a testament to how rare DMRA frames are that this has only just come up now. This has been in the code base for a little while, and I would imagine there are lots of people using this.

Most Talker Alias info is embedded inside of DMRD frames, so I'll have to go back and look at MMDVMHost to see how these frames are structured.

randybuildsthings commented 3 years ago

I've spent some time in the last week helping Jonathan with researching a few issues having to do with talker alias. I've also read over the ETSI spec regarding those particular data blocks. I'll have something to offer here in the weeks to come, perhaps before the end of March.

randybuildsthings commented 3 years ago

It's a testament to how rare DMRA frames are that this has only just come up now. This has been in the code base for a little while, and I would imagine there are lots of people using this.

Most Talker Alias info is embedded inside of DMRD frames, so I'll have to go back and look at MMDVMHost to see how these frames are structured.

Also, this isn't correct. DMRD really only contains the actual data from the DMR packet itself. link control and call setup info (where talker alias lives) is handled entirely using DMRA frames on Homebrew.

I do wish there was a written definition for the protocol that wasn't way out of date.