implement support for explicit source ID;

pull/39/head
Bryan Biedenkapp 3 years ago
parent 24ad09c5ee
commit c62d79e2be

@ -209,6 +209,8 @@ protocols:
noMessageAck: true noMessageAck: true
# Flag indicating that unit-to-unit availiability checks should be performed for a private call. # Flag indicating that unit-to-unit availiability checks should be performed for a private call.
unitToUnitAvailCheck: true unitToUnitAvailCheck: true
# Flag indicating explicit source ID support is enabled.
allowExplicitSourceId: true
# Flag indicating whether or not the host will respond to SNDCP data grant requests. # Flag indicating whether or not the host will respond to SNDCP data grant requests.
sndcpGrant: false sndcpGrant: false
# BER/Error threshold for silencing voice packets. (0 or 1233 disables) # BER/Error threshold for silencing voice packets. (0 or 1233 disables)

@ -708,6 +708,12 @@ void BaseNetwork::createP25_MessageHdr(uint8_t* data, uint8_t duid, const p25::l
data[15U] = control.getMFId(); // MFId data[15U] = control.getMFId(); // MFId
uint32_t netId = control.getSiteData().netId(); // Network ID
__SET_UINT16(netId, data, 16U);
uint16_t sysId = control.getSiteData().sysId(); // System ID
data[11U] = (sysId >> 8) & 0xFFU;
data[12U] = (sysId >> 0) & 0xFFU;
data[20U] = lsd.getLSD1(); // LSD 1 data[20U] = lsd.getLSD1(); // LSD 1
data[21U] = lsd.getLSD2(); // LSD 2 data[21U] = lsd.getLSD2(); // LSD 2

@ -369,6 +369,8 @@ void Control::setOptions(yaml::Node& conf, bool supervisor, const std::string cw
m_notifyCC = false; m_notifyCC = false;
} }
m_allowExplicitSourceId = p25Protocol["allowExplicitSourceId"].as<bool>(true);
if (printOptions) { if (printOptions) {
LogInfo(" Silence Threshold: %u (%.1f%%)", m_voice->m_silenceThreshold, float(m_voice->m_silenceThreshold) / 12.33F); LogInfo(" Silence Threshold: %u (%.1f%%)", m_voice->m_silenceThreshold, float(m_voice->m_silenceThreshold) / 12.33F);
@ -405,6 +407,7 @@ void Control::setOptions(yaml::Node& conf, bool supervisor, const std::string cw
LogInfo(" No Status ACK: %s", m_trunk->m_noStatusAck ? "yes" : "no"); LogInfo(" No Status ACK: %s", m_trunk->m_noStatusAck ? "yes" : "no");
LogInfo(" No Message ACK: %s", m_trunk->m_noMessageAck ? "yes" : "no"); LogInfo(" No Message ACK: %s", m_trunk->m_noMessageAck ? "yes" : "no");
LogInfo(" Unit-to-Unit Availability Check: %s", m_trunk->m_unitToUnitAvailCheck ? "yes" : "no"); LogInfo(" Unit-to-Unit Availability Check: %s", m_trunk->m_unitToUnitAvailCheck ? "yes" : "no");
LogInfo(" Explicit Source ID Support: %s", m_allowExplicitSourceId ? "yes" : "no");
if (!m_trunk->m_redundantGrant) { if (!m_trunk->m_redundantGrant) {
LogInfo(" Redundant Grant Transmit: yes"); LogInfo(" Redundant Grant Transmit: yes");
@ -1124,6 +1127,9 @@ void Control::processNetwork()
uint32_t srcId = __GET_UINT16(buffer, 5U); uint32_t srcId = __GET_UINT16(buffer, 5U);
uint32_t dstId = __GET_UINT16(buffer, 8U); uint32_t dstId = __GET_UINT16(buffer, 8U);
uint32_t netId = __GET_UINT16(buffer, 16U);
uint32_t sysId = (buffer[11U] << 8) | (buffer[12U] << 0);
uint8_t lsd1 = buffer[20U]; uint8_t lsd1 = buffer[20U];
uint8_t lsd2 = buffer[21U]; uint8_t lsd2 = buffer[21U];
@ -1172,6 +1178,9 @@ void Control::processNetwork()
control.setDstId(dstId); control.setDstId(dstId);
control.setMFId(MFId); control.setMFId(MFId);
control.setNetId(netId);
control.setSysId(sysId);
lsd.setLSD1(lsd1); lsd.setLSD1(lsd1);
lsd.setLSD2(lsd2); lsd.setLSD2(lsd2);

@ -174,6 +174,7 @@ namespace p25
bool m_controlOnly; bool m_controlOnly;
bool m_ackTSBKRequests; bool m_ackTSBKRequests;
bool m_disableNetworkHDU; bool m_disableNetworkHDU;
bool m_allowExplicitSourceId;
::lookups::IdenTableLookup* m_idenTable; ::lookups::IdenTableLookup* m_idenTable;
::lookups::RadioIdLookup* m_ridLookup; ::lookups::RadioIdLookup* m_ridLookup;

@ -55,6 +55,7 @@ using namespace p25::packet;
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
const uint32_t VOC_LDU1_COUNT = 3U; const uint32_t VOC_LDU1_COUNT = 3U;
const uint32_t ROAM_LDU1_COUNT = 1U;
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Public Class Members // Public Class Members
@ -77,6 +78,7 @@ void Voice::resetRF()
m_rfBits = 1U; m_rfBits = 1U;
m_rfUndecodableLC = 0U; m_rfUndecodableLC = 0U;
m_vocLDU1Count = 0U; m_vocLDU1Count = 0U;
m_roamLDU1Count = 0U;
} }
/// <summary> /// <summary>
@ -93,6 +95,7 @@ void Voice::resetNet()
m_netFrames = 0U; m_netFrames = 0U;
m_netLost = 0U; m_netLost = 0U;
m_vocLDU1Count = 0U; m_vocLDU1Count = 0U;
m_roamLDU1Count = 0U;
} }
/// <summary> /// <summary>
@ -477,6 +480,7 @@ bool Voice::process(uint8_t* data, uint32_t len)
m_rfBits = 1U; m_rfBits = 1U;
m_rfUndecodableLC = 0U; m_rfUndecodableLC = 0U;
m_vocLDU1Count = 0U; m_vocLDU1Count = 0U;
m_roamLDU1Count = 0U;
m_p25->m_rfTimeout.start(); m_p25->m_rfTimeout.start();
m_lastDUID = P25_DUID_HDU; m_lastDUID = P25_DUID_HDU;
@ -889,6 +893,11 @@ bool Voice::processNetwork(uint8_t* data, uint32_t len, lc::LC& control, data::L
m_dfsiLC.decodeLDU1(data + count, m_netLDU1 + 204U); m_dfsiLC.decodeLDU1(data + count, m_netLDU1 + 204U);
count += dfsi::P25_DFSI_LDU1_VOICE9_FRAME_LENGTH_BYTES; count += dfsi::P25_DFSI_LDU1_VOICE9_FRAME_LENGTH_BYTES;
// these aren't set by the DFSI decoder, so we'll manually
// reset them
m_dfsiLC.control()->setNetId(control.getNetId());
m_dfsiLC.control()->setSysId(control.getSysId());
m_netLastLDU1 = control; m_netLastLDU1 = control;
m_netLastFrameType = frameType; m_netLastFrameType = frameType;
@ -1063,6 +1072,7 @@ Voice::Voice(Control* p25, network::BaseNetwork* network, bool debug, bool verbo
m_lastRejectId(0U), m_lastRejectId(0U),
m_silenceThreshold(DEFAULT_SILENCE_THRESHOLD), m_silenceThreshold(DEFAULT_SILENCE_THRESHOLD),
m_vocLDU1Count(0U), m_vocLDU1Count(0U),
m_roamLDU1Count(0U),
m_verbose(verbose), m_verbose(verbose),
m_debug(debug) m_debug(debug)
{ {
@ -1374,6 +1384,7 @@ void Voice::writeNet_LDU1()
m_netFrames = 0U; m_netFrames = 0U;
m_netLost = 0U; m_netLost = 0U;
m_vocLDU1Count = 0U; m_vocLDU1Count = 0U;
m_roamLDU1Count = 0U;
if (!m_p25->m_disableNetworkHDU) { if (!m_p25->m_disableNetworkHDU) {
if (m_netLastFrameType != P25_FT_HDU_LATE_ENTRY) { if (m_netLastFrameType != P25_FT_HDU_LATE_ENTRY) {
@ -1414,6 +1425,41 @@ void Voice::writeNet_LDU1()
} }
} }
uint32_t netId = control.getNetId();
uint32_t sysId = control.getSysId();
// is the network peer a different WACN or system ID?
if (m_p25->m_control && m_p25->m_allowExplicitSourceId) {
if (netId == 0U) {
netId = lc::LC::getSiteData().netId();
}
if (sysId == 0U) {
sysId = lc::LC::getSiteData().sysId();
}
if (sysId != lc::LC::getSiteData().sysId()) {
// per TIA-102.AABD-D transmit EXPLICIT_SOURCE_ID every other frame (e.g. every other LDU1)
m_roamLDU1Count++;
if (m_roamLDU1Count > ROAM_LDU1_COUNT) {
m_roamLDU1Count = 0U;
m_netLC.setNetId(netId);
m_netLC.setSysId(sysId);
m_netLC.setLCO(LC_EXPLICIT_SOURCE_ID);
}
else {
// flag explicit block to follow in next LDU1
if (m_netLC.getLCO() == LC_GROUP) {
m_netLC.setExplicitId(true);
}
}
}
}
else {
netId = lc::LC::getSiteData().netId();
sysId = lc::LC::getSiteData().sysId();
}
// single-channel trunking or voice on control support? // single-channel trunking or voice on control support?
if (m_p25->m_control && m_p25->m_voiceOnControl) { if (m_p25->m_control && m_p25->m_voiceOnControl) {
// per TIA-102.AABD-B transmit RFSS_STS_BCAST every 3 superframes (e.g. every 3 LDU1s) // per TIA-102.AABD-B transmit RFSS_STS_BCAST every 3 superframes (e.g. every 3 LDU1s)
@ -1463,8 +1509,9 @@ void Voice::writeNet_LDU1()
m_p25->addFrame(buffer, P25_LDU_FRAME_LENGTH_BYTES + 2U, true); m_p25->addFrame(buffer, P25_LDU_FRAME_LENGTH_BYTES + 2U, true);
if (m_verbose) { if (m_verbose) {
LogMessage(LOG_NET, P25_LDU1_STR " audio, srcId = %u, dstId = %u, group = %u, emerg = %u, encrypt = %u, prio = %u", LogMessage(LOG_NET, P25_LDU1_STR " audio, srcId = %u, dstId = %u, group = %u, emerg = %u, encrypt = %u, prio = %u, sysId = $%03X, netId = $%05X",
m_netLC.getSrcId(), m_netLC.getDstId(), m_netLC.getGroup(), m_netLC.getEmergency(), m_netLC.getEncrypted(), m_netLC.getPriority()); m_netLC.getSrcId(), m_netLC.getDstId(), m_netLC.getGroup(), m_netLC.getEmergency(), m_netLC.getEncrypted(), m_netLC.getPriority(),
sysId, netId);
} }
::memset(m_netLDU1, 0x00U, 9U * 25U); ::memset(m_netLDU1, 0x00U, 9U * 25U);

@ -112,6 +112,7 @@ namespace p25
uint32_t m_silenceThreshold; uint32_t m_silenceThreshold;
uint8_t m_vocLDU1Count; uint8_t m_vocLDU1Count;
uint8_t m_roamLDU1Count;
bool m_verbose; bool m_verbose;
bool m_debug; bool m_debug;

Loading…
Cancel
Save

Powered by TurnKey Linux.