diff --git a/src/main/java/io/github/dsheirer/module/decode/p25/phase1/P25P1DecoderState.java b/src/main/java/io/github/dsheirer/module/decode/p25/phase1/P25P1DecoderState.java index f7a81b161..01709be6e 100644 --- a/src/main/java/io/github/dsheirer/module/decode/p25/phase1/P25P1DecoderState.java +++ b/src/main/java/io/github/dsheirer/module/decode/p25/phase1/P25P1DecoderState.java @@ -52,6 +52,7 @@ import io.github.dsheirer.module.decode.ip.mototrbo.ars.ARSPacket; import io.github.dsheirer.module.decode.ip.mototrbo.lrrp.LRRPPacket; import io.github.dsheirer.module.decode.ip.udp.UDPPacket; +import io.github.dsheirer.module.decode.p25.IServiceOptionsProvider; import io.github.dsheirer.module.decode.p25.P25DecodeEvent; import io.github.dsheirer.module.decode.p25.P25TrafficChannelManager; import io.github.dsheirer.module.decode.p25.identifier.channel.APCO25Channel; @@ -382,10 +383,34 @@ private void processLCChannelUser(LinkControlWord lcw, long timestamp) List updated = mPatchGroupManager.update(lcw.getIdentifiers(), timestamp); getIdentifierCollection().update(updated); DecodeEventType decodeEventType = getLCDecodeEventType(lcw); - ServiceOptions serviceOptions = lcw.isEncrypted() ? VoiceServiceOptions.createEncrypted() : - VoiceServiceOptions.createUnencrypted(); + + + ServiceOptions serviceOptions = null; + + if(lcw instanceof IServiceOptionsProvider sop) + { + serviceOptions = sop.getServiceOptions(); + } + else if(lcw.isEncrypted()) + { + serviceOptions = VoiceServiceOptions.createEncrypted(); + } + else + { + serviceOptions = VoiceServiceOptions.createUnencrypted(); + } + mTrafficChannelManager.processP1CurrentUser(getCurrentFrequency(), getCurrentChannel(), decodeEventType, serviceOptions, getIdentifierCollection(), timestamp, null ); + + if(serviceOptions.isEncrypted()) + { + broadcast(new DecoderStateEvent(this, Event.CONTINUATION, State.ENCRYPTED)); + } + else + { + broadcast(new DecoderStateEvent(this, Event.CONTINUATION, State.CALL)); + } } /** @@ -776,9 +801,16 @@ private void processHDU(IMessage message) DecodeEventType type = headerData.isEncryptedAudio() ? DecodeEventType.CALL_ENCRYPTED : DecodeEventType.CALL; mTrafficChannelManager.processP1CurrentUser(getCurrentFrequency(), getCurrentChannel(), type, serviceOptions, mic, message.getTimestamp(), details); - } - broadcast(new DecoderStateEvent(this, Event.START, State.CALL)); + if(headerData.isEncryptedAudio()) + { + broadcast(new DecoderStateEvent(this, Event.START, State.ENCRYPTED)); + } + else + { + broadcast(new DecoderStateEvent(this, Event.START, State.CALL)); + } + } } @@ -810,12 +842,14 @@ else if(message instanceof LDU2Message ldu2) getIdentifierCollection().update(esp.getIdentifiers()); mTrafficChannelManager.processP1CurrentUser(getCurrentFrequency(), esp.getEncryptionKey(), message.getTimestamp()); + broadcast(new DecoderStateEvent(this, Event.CONTINUATION, State.ENCRYPTED)); } else { getIdentifierCollection().remove(Form.ENCRYPTION_KEY); mTrafficChannelManager.processP1CurrentUser(getCurrentFrequency(), null, message.getTimestamp()); + broadcast(new DecoderStateEvent(this, Event.CONTINUATION, State.CALL)); } } else @@ -824,7 +858,6 @@ else if(message instanceof LDU2Message ldu2) } } - broadcast(new DecoderStateEvent(this, Event.CONTINUATION, State.CALL)); } /** diff --git a/src/main/java/io/github/dsheirer/module/decode/p25/reference/VoiceServiceOptions.java b/src/main/java/io/github/dsheirer/module/decode/p25/reference/VoiceServiceOptions.java index 74b2d79db..f7b1c6add 100644 --- a/src/main/java/io/github/dsheirer/module/decode/p25/reference/VoiceServiceOptions.java +++ b/src/main/java/io/github/dsheirer/module/decode/p25/reference/VoiceServiceOptions.java @@ -70,7 +70,7 @@ public String toString() */ public static VoiceServiceOptions createEncrypted() { - return new VoiceServiceOptions(ENCRYPTION_FLAG); + return new VoiceServiceOptions(ENCRYPTION_FLAG + 4); } /** @@ -78,6 +78,6 @@ public static VoiceServiceOptions createEncrypted() */ public static VoiceServiceOptions createUnencrypted() { - return new VoiceServiceOptions(0); + return new VoiceServiceOptions(4); } }