59
59
import io .github .dsheirer .module .decode .p25 .phase2 .enumeration .ScrambleParameters ;
60
60
import io .github .dsheirer .module .decode .p25 .phase2 .message .mac .MacOpcode ;
61
61
import io .github .dsheirer .module .decode .p25 .reference .ServiceOptions ;
62
+ import io .github .dsheirer .module .decode .p25 .reference .VoiceServiceOptions ;
62
63
import io .github .dsheirer .module .decode .traffic .TrafficChannelManager ;
63
64
import io .github .dsheirer .sample .Listener ;
64
65
import io .github .dsheirer .source .config .SourceConfigTuner ;
@@ -729,27 +730,36 @@ public void processP1TrafficCallStart(long frequency, Identifier<?> talkgroup, I
729
730
{
730
731
P25TrafficChannelEventTracker tracker = getTracker (frequency , P25P1Message .TIMESLOT_1 );
731
732
732
- if (tracker != null )
733
+ //If the tracker is already started, it was for another call. Close it and recreate the event.
734
+ if (tracker != null && tracker .isStarted ())
733
735
{
734
736
removeTracker (frequency , P25P1Message .TIMESLOT_1 );
737
+ tracker = null ;
735
738
}
736
739
737
- DecodeEventType decodeEventType = getDecodeEventType (talkgroup , eki );
738
-
739
- MutableIdentifierCollection mic = new MutableIdentifierCollection ();
740
- mic .update (talkgroup );
741
- mic .update (radio );
742
- mic .update (eki );
743
-
744
- //Create a new event for the current call.
745
- P25ChannelGrantEvent callEvent = P25ChannelGrantEvent .builder (decodeEventType , timestamp , serviceOptions )
746
- .channelDescriptor (channelDescriptor )
747
- .details ("PHASE 1 CALL " + (serviceOptions != null ? serviceOptions : "" ))
748
- .identifiers (mic )
749
- .build ();
740
+ if (tracker != null )
741
+ {
742
+ tracker .addIdentifierIfMissing (talkgroup );
743
+ }
744
+ else
745
+ {
746
+ DecodeEventType decodeEventType = getDecodeEventType (talkgroup , eki );
747
+ MutableIdentifierCollection mic = new MutableIdentifierCollection ();
748
+ mic .update (talkgroup );
749
+ mic .update (radio );
750
+ mic .update (eki );
751
+
752
+ //Create a new event for the current call.
753
+ P25ChannelGrantEvent callEvent = P25ChannelGrantEvent .builder (decodeEventType , timestamp , serviceOptions )
754
+ .channelDescriptor (channelDescriptor )
755
+ .details ("PHASE 1 CALL " + (serviceOptions != null ? serviceOptions : "" ))
756
+ .identifiers (mic )
757
+ .build ();
758
+
759
+ tracker = new P25TrafficChannelEventTracker (callEvent );
760
+ addTracker (tracker , frequency , P25P1Message .TIMESLOT_1 );
761
+ }
750
762
751
- tracker = new P25TrafficChannelEventTracker (callEvent );
752
- addTracker (tracker , frequency , P25P1Message .TIMESLOT_1 );
753
763
broadcast (tracker );
754
764
}
755
765
finally
@@ -838,19 +848,22 @@ public void processP1TrafficCurrentUser(long frequency, Identifier identifier, l
838
848
* This is used primarily to add encryption, GPS, talker alias, etc. but can be used for any identifier update.
839
849
*
840
850
* @param frequency for the call event
841
- * @param identifier to update within the event.
851
+ * @param identifiers to update within the event.
842
852
* @param timestamp for the update
843
853
*/
844
- public void processP1TrafficCurrentUserIdentifiers (long frequency , List <Identifier > identifiers , long timestamp , String context )
854
+ public void processP1TrafficLDU1 (long frequency , List <Identifier > identifiers , long timestamp , String context )
845
855
{
846
856
mLock .lock ();
847
857
848
858
try
849
859
{
860
+ IChannelDescriptor channelDescriptor = null ;
861
+
850
862
P25TrafficChannelEventTracker tracker = getTracker (frequency , P25P1Message .TIMESLOT_1 );
851
863
852
864
if (tracker != null && tracker .isComplete ())
853
865
{
866
+ channelDescriptor = tracker .getEvent ().getChannelDescriptor ();;
854
867
removeTracker (frequency , P25P1Message .TIMESLOT_1 );
855
868
tracker = null ;
856
869
}
@@ -871,6 +884,29 @@ public void processP1TrafficCurrentUserIdentifiers(long frequency, List<Identifi
871
884
tracker .updateDurationTraffic (timestamp );
872
885
broadcast (tracker );
873
886
}
887
+ else
888
+ {
889
+ MutableIdentifierCollection mic = new MutableIdentifierCollection (identifiers );
890
+ Identifier talkgroup = mic .getToIdentifier ();
891
+ Identifier encryption = mic .getEncryptionIdentifier ();
892
+
893
+ if (talkgroup != null && encryption instanceof EncryptionKeyIdentifier eki )
894
+ {
895
+ DecodeEventType decodeEventType = getDecodeEventType (talkgroup , eki );
896
+ //Create a new event for the current call.
897
+ ServiceOptions serviceOptions = (eki .isEncrypted () ? VoiceServiceOptions .createEncrypted () :
898
+ VoiceServiceOptions .createUnencrypted ());
899
+ P25ChannelGrantEvent callEvent = P25ChannelGrantEvent .builder (decodeEventType , timestamp , serviceOptions )
900
+ .channelDescriptor (channelDescriptor )
901
+ .details ("PHASE 1 CALL " + (eki .isEncrypted () ? eki .toString () : "" ))
902
+ .identifiers (mic )
903
+ .build ();
904
+
905
+ tracker = new P25TrafficChannelEventTracker (callEvent );
906
+ addTracker (tracker , frequency , P25P1Message .TIMESLOT_1 );
907
+ broadcast (tracker );
908
+ }
909
+ }
874
910
}
875
911
finally
876
912
{
0 commit comments