add destination ID to ICC messages;

pull/86/head
Bryan Biedenkapp 1 year ago
parent 86119c2171
commit 10f3f35131

@ -2253,20 +2253,23 @@ void FNENetwork::writePeerList(uint32_t peerId)
/* Helper to send a In-Call Control command to the specified peer. */ /* Helper to send a In-Call Control command to the specified peer. */
bool FNENetwork::writePeerICC(uint32_t peerId, NET_SUBFUNC::ENUM subFunc, NET_ICC::ENUM command, uint8_t slotNo) bool FNENetwork::writePeerICC(uint32_t peerId, NET_SUBFUNC::ENUM subFunc, NET_ICC::ENUM command, uint32_t dstId, uint8_t slotNo)
{ {
assert(peerId > 0); assert(peerId > 0);
if (!m_enableInCallCtrl) if (!m_enableInCallCtrl)
return false; return false;
if (dstId == 0U)
return false;
uint8_t buffer[DATA_PACKET_LENGTH]; uint8_t buffer[DATA_PACKET_LENGTH];
::memset(buffer, 0x00U, DATA_PACKET_LENGTH); ::memset(buffer, 0x00U, DATA_PACKET_LENGTH);
__SET_UINT32(peerId, buffer, 6U); // Peer ID __SET_UINT32(peerId, buffer, 6U); // Peer ID
buffer[10U] = (uint8_t)command; // In-Call Control Command buffer[10U] = (uint8_t)command; // In-Call Control Command
buffer[11U] = slotNo; __SET_UINT16(dstId, buffer, 11U); // Destination ID
buffer[14U] = slotNo; // DMR Slot No
return writePeer(peerId, { NET_FUNC::INCALL_CTRL, subFunc }, buffer, 12U, RTP_END_OF_CALL_SEQ, false, true); return writePeer(peerId, { NET_FUNC::INCALL_CTRL, subFunc }, buffer, 15U, RTP_END_OF_CALL_SEQ, false, true);
} }
/* Helper to send a data message to the specified peer. */ /* Helper to send a data message to the specified peer. */

@ -573,10 +573,11 @@ namespace network
* @param peerId Peer ID. * @param peerId Peer ID.
* @param subFunc Network Sub-Function. * @param subFunc Network Sub-Function.
* @param command In-Call Control Command. * @param command In-Call Control Command.
* @param dstId Destination ID.
* @param slotNo DMR slot. * @param slotNo DMR slot.
*/ */
bool writePeerICC(uint32_t peerId, NET_SUBFUNC::ENUM subFunc = NET_SUBFUNC::PROTOCOL_SUBFUNC_DMR, bool writePeerICC(uint32_t peerId, NET_SUBFUNC::ENUM subFunc = NET_SUBFUNC::PROTOCOL_SUBFUNC_DMR,
NET_ICC::ENUM command = NET_ICC::NOP, uint8_t slotNo = 0U); NET_ICC::ENUM command = NET_ICC::NOP, uint32_t dstId = 0U, uint8_t slotNo = 0U);
/** /**
* @brief Helper to send a data message to the specified peer. * @brief Helper to send a data message to the specified peer.

@ -790,7 +790,7 @@ bool TagDMRData::validate(uint32_t peerId, data::NetData& data, uint32_t streamI
.request(m_network->m_influxServer); .request(m_network->m_influxServer);
} }
m_network->writePeerICC(peerId, NET_SUBFUNC::PROTOCOL_SUBFUNC_DMR, NET_ICC::REJECT_TRAFFIC, data.getSlotNo()); m_network->writePeerICC(peerId, NET_SUBFUNC::PROTOCOL_SUBFUNC_DMR, NET_ICC::REJECT_TRAFFIC, data.getDstId(), data.getSlotNo());
return false; return false;
} }
@ -810,7 +810,7 @@ bool TagDMRData::validate(uint32_t peerId, data::NetData& data, uint32_t streamI
.request(m_network->m_influxServer); .request(m_network->m_influxServer);
} }
m_network->writePeerICC(peerId, NET_SUBFUNC::PROTOCOL_SUBFUNC_DMR, NET_ICC::REJECT_TRAFFIC, data.getSlotNo()); m_network->writePeerICC(peerId, NET_SUBFUNC::PROTOCOL_SUBFUNC_DMR, NET_ICC::REJECT_TRAFFIC, data.getDstId(), data.getSlotNo());
return false; return false;
} }
@ -829,7 +829,7 @@ bool TagDMRData::validate(uint32_t peerId, data::NetData& data, uint32_t streamI
.request(m_network->m_influxServer); .request(m_network->m_influxServer);
} }
m_network->writePeerICC(peerId, NET_SUBFUNC::PROTOCOL_SUBFUNC_DMR, NET_ICC::REJECT_TRAFFIC, data.getSlotNo()); m_network->writePeerICC(peerId, NET_SUBFUNC::PROTOCOL_SUBFUNC_DMR, NET_ICC::REJECT_TRAFFIC, data.getDstId(), data.getSlotNo());
return false; return false;
} }
} }

@ -552,7 +552,7 @@ bool TagNXDNData::validate(uint32_t peerId, lc::RTCH& lc, uint8_t messageType, u
.request(m_network->m_influxServer); .request(m_network->m_influxServer);
} }
m_network->writePeerICC(peerId, NET_SUBFUNC::PROTOCOL_SUBFUNC_NXDN, NET_ICC::REJECT_TRAFFIC); m_network->writePeerICC(peerId, NET_SUBFUNC::PROTOCOL_SUBFUNC_NXDN, NET_ICC::REJECT_TRAFFIC, lc.getDstId());
return false; return false;
} }
} }
@ -580,6 +580,7 @@ bool TagNXDNData::validate(uint32_t peerId, lc::RTCH& lc, uint8_t messageType, u
.request(m_network->m_influxServer); .request(m_network->m_influxServer);
} }
m_network->writePeerICC(peerId, NET_SUBFUNC::PROTOCOL_SUBFUNC_NXDN, NET_ICC::REJECT_TRAFFIC, lc.getDstId());
return false; return false;
} }
} }
@ -604,7 +605,7 @@ bool TagNXDNData::validate(uint32_t peerId, lc::RTCH& lc, uint8_t messageType, u
.request(m_network->m_influxServer); .request(m_network->m_influxServer);
} }
m_network->writePeerICC(peerId, NET_SUBFUNC::PROTOCOL_SUBFUNC_NXDN, NET_ICC::REJECT_TRAFFIC); m_network->writePeerICC(peerId, NET_SUBFUNC::PROTOCOL_SUBFUNC_NXDN, NET_ICC::REJECT_TRAFFIC, lc.getDstId());
return false; return false;
} }
@ -622,7 +623,7 @@ bool TagNXDNData::validate(uint32_t peerId, lc::RTCH& lc, uint8_t messageType, u
.request(m_network->m_influxServer); .request(m_network->m_influxServer);
} }
m_network->writePeerICC(peerId, NET_SUBFUNC::PROTOCOL_SUBFUNC_NXDN, NET_ICC::REJECT_TRAFFIC); m_network->writePeerICC(peerId, NET_SUBFUNC::PROTOCOL_SUBFUNC_NXDN, NET_ICC::REJECT_TRAFFIC, lc.getDstId());
return false; return false;
} }

@ -1034,7 +1034,7 @@ bool TagP25Data::validate(uint32_t peerId, lc::LC& control, DUID::E duid, const
.request(m_network->m_influxServer); .request(m_network->m_influxServer);
} }
m_network->writePeerICC(peerId, NET_SUBFUNC::PROTOCOL_SUBFUNC_P25, NET_ICC::REJECT_TRAFFIC); m_network->writePeerICC(peerId, NET_SUBFUNC::PROTOCOL_SUBFUNC_P25, NET_ICC::REJECT_TRAFFIC, control.getDstId());
return false; return false;
} }
} }
@ -1066,6 +1066,7 @@ bool TagP25Data::validate(uint32_t peerId, lc::LC& control, DUID::E duid, const
.request(m_network->m_influxServer); .request(m_network->m_influxServer);
} }
m_network->writePeerICC(peerId, NET_SUBFUNC::PROTOCOL_SUBFUNC_P25, NET_ICC::REJECT_TRAFFIC, control.getDstId());
return false; return false;
} }
} }
@ -1114,7 +1115,7 @@ bool TagP25Data::validate(uint32_t peerId, lc::LC& control, DUID::E duid, const
.request(m_network->m_influxServer); .request(m_network->m_influxServer);
} }
m_network->writePeerICC(peerId, NET_SUBFUNC::PROTOCOL_SUBFUNC_P25, NET_ICC::REJECT_TRAFFIC); m_network->writePeerICC(peerId, NET_SUBFUNC::PROTOCOL_SUBFUNC_P25, NET_ICC::REJECT_TRAFFIC, control.getDstId());
return false; return false;
} }
@ -1132,7 +1133,7 @@ bool TagP25Data::validate(uint32_t peerId, lc::LC& control, DUID::E duid, const
.request(m_network->m_influxServer); .request(m_network->m_influxServer);
} }
m_network->writePeerICC(peerId, NET_SUBFUNC::PROTOCOL_SUBFUNC_P25, NET_ICC::REJECT_TRAFFIC); m_network->writePeerICC(peerId, NET_SUBFUNC::PROTOCOL_SUBFUNC_P25, NET_ICC::REJECT_TRAFFIC, control.getDstId());
return false; return false;
} }

@ -178,7 +178,7 @@ void Control::setOptions(yaml::Node& conf, bool supervisor, ::lookups::VoiceChDa
// set the In-Call Control function callback // set the In-Call Control function callback
if (m_network != nullptr) { if (m_network != nullptr) {
m_network->setDMRICCCallback([=](network::NET_ICC::ENUM command, uint8_t slotNo) { processInCallCtrl(command, slotNo); }); m_network->setDMRICCCallback([=](network::NET_ICC::ENUM command, uint32_t dstId, uint8_t slotNo) { processInCallCtrl(command, dstId, slotNo); });
} }
if (printOptions) { if (printOptions) {
@ -745,13 +745,13 @@ void Control::processNetwork()
/* Helper to process an In-Call Control message. */ /* Helper to process an In-Call Control message. */
void Control::processInCallCtrl(network::NET_ICC::ENUM command, uint8_t slotNo) void Control::processInCallCtrl(network::NET_ICC::ENUM command, uint32_t dstId, uint8_t slotNo)
{ {
switch (slotNo) { switch (slotNo) {
case 1U: case 1U:
return m_slot1->processInCallCtrl(command); return m_slot1->processInCallCtrl(command, dstId);
case 2U: case 2U:
return m_slot2->processInCallCtrl(command); return m_slot2->processInCallCtrl(command, dstId);
default: default:
LogError(LOG_DMR, "DMR, invalid slot, slotNo = %u", slotNo); LogError(LOG_DMR, "DMR, invalid slot, slotNo = %u", slotNo);
break; break;

@ -334,9 +334,10 @@ namespace dmr
/** /**
* @brief Helper to process an In-Call Control message. * @brief Helper to process an In-Call Control message.
* @param command In-Call Control Command. * @param command In-Call Control Command.
* @param dstId Destination ID.
* @param slotNo DMR slot. * @param slotNo DMR slot.
*/ */
void processInCallCtrl(network::NET_ICC::ENUM command, uint8_t slotNo); void processInCallCtrl(network::NET_ICC::ENUM command, uint32_t dstId, uint8_t slotNo);
}; };
} // namespace dmr } // namespace dmr

@ -455,17 +455,19 @@ void Slot::processNetwork(const data::NetData& dmrData)
/* Helper to process an In-Call Control message. */ /* Helper to process an In-Call Control message. */
void Slot::processInCallCtrl(network::NET_ICC::ENUM command) void Slot::processInCallCtrl(network::NET_ICC::ENUM command, uint32_t dstId)
{ {
switch (command) { switch (command) {
case network::NET_ICC::REJECT_TRAFFIC: case network::NET_ICC::REJECT_TRAFFIC:
{ {
processFrameLoss(); if (m_rfState == RS_RF_AUDIO && m_rfLC->getDstId() == dstId) {
processFrameLoss();
m_rfLastDstId = 0U; m_rfLastDstId = 0U;
m_rfLastSrcId = 0U; m_rfLastSrcId = 0U;
m_rfTGHang.stop(); m_rfTGHang.stop();
m_rfState = RS_RF_REJECTED; m_rfState = RS_RF_REJECTED;
}
} }
break; break;

@ -161,8 +161,9 @@ namespace dmr
/** /**
* @brief Helper to process an In-Call Control message. * @brief Helper to process an In-Call Control message.
* @param command In-Call Control Command. * @param command In-Call Control Command.
* @param dstId Destination ID.
*/ */
void processInCallCtrl(network::NET_ICC::ENUM command); void processInCallCtrl(network::NET_ICC::ENUM command, uint32_t dstId);
/** @} */ /** @} */
/** @name Data Clocking */ /** @name Data Clocking */

@ -494,28 +494,31 @@ void Network::clock(uint32_t ms)
if (fneHeader.getSubFunction() == NET_SUBFUNC::PROTOCOL_SUBFUNC_DMR) { // DMR In-Call Control if (fneHeader.getSubFunction() == NET_SUBFUNC::PROTOCOL_SUBFUNC_DMR) { // DMR In-Call Control
if (m_enabled && m_dmrEnabled) { if (m_enabled && m_dmrEnabled) {
NET_ICC::ENUM command = (NET_ICC::ENUM)buffer[10U]; NET_ICC::ENUM command = (NET_ICC::ENUM)buffer[10U];
uint8_t slot = buffer[11U]; uint32_t dstId = __GET_UINT16(buffer, 11U);
uint8_t slot = buffer[14U];
if (m_dmrInCallCallback != nullptr) { if (m_dmrInCallCallback != nullptr) {
m_dmrInCallCallback(command, slot); m_dmrInCallCallback(command, dstId, slot);
} }
} }
} }
else if (fneHeader.getSubFunction() == NET_SUBFUNC::PROTOCOL_SUBFUNC_P25) { // P25 In-Call Control else if (fneHeader.getSubFunction() == NET_SUBFUNC::PROTOCOL_SUBFUNC_P25) { // P25 In-Call Control
if (m_enabled && m_p25Enabled) { if (m_enabled && m_p25Enabled) {
NET_ICC::ENUM command = (NET_ICC::ENUM)buffer[10U]; NET_ICC::ENUM command = (NET_ICC::ENUM)buffer[10U];
uint32_t dstId = __GET_UINT16(buffer, 11U);
if (m_p25InCallCallback != nullptr) { if (m_p25InCallCallback != nullptr) {
m_p25InCallCallback(command); m_p25InCallCallback(command, dstId);
} }
} }
} }
else if (fneHeader.getSubFunction() == NET_SUBFUNC::PROTOCOL_SUBFUNC_NXDN) { // NXDN In-Call Control else if (fneHeader.getSubFunction() == NET_SUBFUNC::PROTOCOL_SUBFUNC_NXDN) { // NXDN In-Call Control
if (m_enabled && m_nxdnEnabled) { if (m_enabled && m_nxdnEnabled) {
NET_ICC::ENUM command = (NET_ICC::ENUM)buffer[10U]; NET_ICC::ENUM command = (NET_ICC::ENUM)buffer[10U];
uint32_t dstId = __GET_UINT16(buffer, 11U);
if (m_nxdnInCallCallback != nullptr) { if (m_nxdnInCallCallback != nullptr) {
m_nxdnInCallCallback(command); m_nxdnInCallCallback(command, dstId);
} }
} }
} }

@ -157,17 +157,17 @@ namespace network
* @brief Helper to set the DMR In-Call Control callback. * @brief Helper to set the DMR In-Call Control callback.
* @param callback * @param callback
*/ */
void setDMRICCCallback(std::function<void(NET_ICC::ENUM, uint8_t)>&& callback) { m_dmrInCallCallback = callback; } void setDMRICCCallback(std::function<void(NET_ICC::ENUM, uint32_t, uint8_t)>&& callback) { m_dmrInCallCallback = callback; }
/** /**
* @brief Helper to set the P25 In-Call Control callback. * @brief Helper to set the P25 In-Call Control callback.
* @param callback * @param callback
*/ */
void setP25ICCCallback(std::function<void(NET_ICC::ENUM)>&& callback) { m_p25InCallCallback = callback; } void setP25ICCCallback(std::function<void(NET_ICC::ENUM, uint32_t)>&& callback) { m_p25InCallCallback = callback; }
/** /**
* @brief Helper to set the NXDN In-Call Control callback. * @brief Helper to set the NXDN In-Call Control callback.
* @param callback * @param callback
*/ */
void setNXDNICCCallback(std::function<void(NET_ICC::ENUM)>&& callback) { m_nxdnInCallCallback = callback; } void setNXDNICCCallback(std::function<void(NET_ICC::ENUM, uint32_t)>&& callback) { m_nxdnInCallCallback = callback; }
public: public:
/** /**
@ -230,9 +230,9 @@ namespace network
bool m_promiscuousPeer; bool m_promiscuousPeer;
std::function<void(NET_ICC::ENUM command, uint8_t slotNo)> m_dmrInCallCallback; std::function<void(NET_ICC::ENUM command, uint32_t dstId, uint8_t slotNo)> m_dmrInCallCallback;
std::function<void(NET_ICC::ENUM command)> m_p25InCallCallback; std::function<void(NET_ICC::ENUM command, uint32_t dstId)> m_p25InCallCallback;
std::function<void(NET_ICC::ENUM command)> m_nxdnInCallCallback; std::function<void(NET_ICC::ENUM command, uint32_t dstId)> m_nxdnInCallCallback;
/** /**
* @brief User overrideable handler that allows user code to process network packets not handled by this class. * @brief User overrideable handler that allows user code to process network packets not handled by this class.

@ -298,7 +298,7 @@ void Control::setOptions(yaml::Node& conf, bool supervisor, const std::string cw
// set the In-Call Control function callback // set the In-Call Control function callback
if (m_network != nullptr) { if (m_network != nullptr) {
m_network->setNXDNICCCallback([=](network::NET_ICC::ENUM command) { processInCallCtrl(command); }); m_network->setNXDNICCCallback([=](network::NET_ICC::ENUM command, uint32_t dstId) { processInCallCtrl(command, dstId); });
} }
if (printOptions) { if (printOptions) {
@ -1039,17 +1039,19 @@ void Control::processFrameLoss()
/* Helper to process an In-Call Control message. */ /* Helper to process an In-Call Control message. */
void Control::processInCallCtrl(network::NET_ICC::ENUM command) void Control::processInCallCtrl(network::NET_ICC::ENUM command, uint32_t dstId)
{ {
switch (command) { switch (command) {
case network::NET_ICC::REJECT_TRAFFIC: case network::NET_ICC::REJECT_TRAFFIC:
{ {
processFrameLoss(); if (m_rfState == RS_RF_AUDIO && m_rfLC.getDstId() == dstId) {
processFrameLoss();
m_rfLastDstId = 0U; m_rfLastDstId = 0U;
m_rfLastSrcId = 0U; m_rfLastSrcId = 0U;
m_rfTGHang.stop(); m_rfTGHang.stop();
m_rfState = RS_RF_REJECTED; m_rfState = RS_RF_REJECTED;
}
} }
break; break;

@ -365,8 +365,9 @@ namespace nxdn
/** /**
* @brief Helper to process an In-Call Control message. * @brief Helper to process an In-Call Control message.
* @param command In-Call Control Command. * @param command In-Call Control Command.
* @param dstId Destination ID.
*/ */
void processInCallCtrl(network::NET_ICC::ENUM command); void processInCallCtrl(network::NET_ICC::ENUM command, uint32_t dstId);
/** /**
* @brief Helper to send a REST API request to the CC to release a channel grant at the end of a call. * @brief Helper to send a REST API request to the CC to release a channel grant at the end of a call.

@ -441,7 +441,7 @@ void Control::setOptions(yaml::Node& conf, bool supervisor, const std::string cw
// set the In-Call Control function callback // set the In-Call Control function callback
if (m_network != nullptr) { if (m_network != nullptr) {
m_network->setP25ICCCallback([=](network::NET_ICC::ENUM command) { processInCallCtrl(command); }); m_network->setP25ICCCallback([=](network::NET_ICC::ENUM command, uint32_t dstId) { processInCallCtrl(command, dstId); });
} }
if (printOptions) { if (printOptions) {
@ -1541,17 +1541,19 @@ void Control::processFrameLoss()
/* Helper to process an In-Call Control message. */ /* Helper to process an In-Call Control message. */
void Control::processInCallCtrl(network::NET_ICC::ENUM command) void Control::processInCallCtrl(network::NET_ICC::ENUM command, uint32_t dstId)
{ {
switch (command) { switch (command) {
case network::NET_ICC::REJECT_TRAFFIC: case network::NET_ICC::REJECT_TRAFFIC:
{ {
processFrameLoss(); if (m_rfState == RS_RF_AUDIO && m_voice->m_rfLC.getDstId() == dstId) {
processFrameLoss();
m_rfLastDstId = 0U; m_rfLastDstId = 0U;
m_rfLastSrcId = 0U; m_rfLastSrcId = 0U;
m_rfTGHang.stop(); m_rfTGHang.stop();
m_rfState = RS_RF_REJECTED; m_rfState = RS_RF_REJECTED;
}
} }
break; break;

@ -401,8 +401,9 @@ namespace p25
/** /**
* @brief Helper to process an In-Call Control message. * @brief Helper to process an In-Call Control message.
* @param command In-Call Control Command. * @param command In-Call Control Command.
* @param dstId Destination ID.
*/ */
void processInCallCtrl(network::NET_ICC::ENUM command); void processInCallCtrl(network::NET_ICC::ENUM command, uint32_t dstId);
/** /**
* @brief Helper to send a REST API request to the CC to release a channel grant at the end of a call. * @brief Helper to send a REST API request to the CC to release a channel grant at the end of a call.

Loading…
Cancel
Save

Powered by TurnKey Linux.