diff --git a/bundles/org.openhab.binding.smsmodem/src/main/java/org/openhab/binding/smsmodem/internal/SMSConversationDiscoveryService.java b/bundles/org.openhab.binding.smsmodem/src/main/java/org/openhab/binding/smsmodem/internal/SMSConversationDiscoveryService.java index 254b69ee964f5..6b8b9db33e038 100644 --- a/bundles/org.openhab.binding.smsmodem/src/main/java/org/openhab/binding/smsmodem/internal/SMSConversationDiscoveryService.java +++ b/bundles/org.openhab.binding.smsmodem/src/main/java/org/openhab/binding/smsmodem/internal/SMSConversationDiscoveryService.java @@ -54,12 +54,13 @@ protected void startScan() { } } - public void buildDiscovery(String msisdn) { + public void buildDiscovery(String sender) { + String senderSanitized = sender.replaceAll("[^a-zA-Z0-9+]", "_"); ThingUID thingUID = SMSModemHandlerFactory - .getSMSConversationUID(SMSModemBindingConstants.SMSCONVERSATION_THING_TYPE, msisdn, bridgeUid); + .getSMSConversationUID(SMSModemBindingConstants.SMSCONVERSATION_THING_TYPE, senderSanitized, bridgeUid); DiscoveryResult result = DiscoveryResultBuilder.create(thingUID) - .withProperty(SMSModemBindingConstants.SMSCONVERSATION_PARAMETER_RECIPIENT, msisdn) - .withLabel("Conversation with " + msisdn).withBridge(bridgeUid) + .withProperty(SMSModemBindingConstants.SMSCONVERSATION_PARAMETER_RECIPIENT, senderSanitized) + .withLabel("Conversation with " + sender).withBridge(bridgeUid) .withThingType(SMSModemBindingConstants.SMSCONVERSATION_THING_TYPE) .withRepresentationProperty(SMSModemBindingConstants.SMSCONVERSATION_PARAMETER_RECIPIENT).build(); thingDiscovered(result);