From a3395724994136468b6273ead7f32677cfb0ad74 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 7 Jul 2026 10:53:06 +0200 Subject: [PATCH 1/3] fix(sip): Handle direct incoming calls as phone participants Signed-off-by: Joas Schilling --- lib/Controller/RoomController.php | 10 +++++++++- lib/Service/ParticipantService.php | 6 +++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php index 5df098257d7..4edb2d92623 100644 --- a/lib/Controller/RoomController.php +++ b/lib/Controller/RoomController.php @@ -2507,6 +2507,7 @@ public function directDialIn(string $phoneNumber, string $caller): DataResponse $caller = trim($caller); // TODO: Use later and get name from addressbook? $cleanedCaller = $this->phoneNumberUtil->convertToStandardFormat($caller); + $inBoundPhoneNumber = $this->phoneNumberUtil->convertToStandardFormat($caller); $user = $this->userManager->get($entity->getActorId()); try { $room = $this->roomService->createConversation( @@ -2522,7 +2523,14 @@ public function directDialIn(string $phoneNumber, string $caller): DataResponse return new DataResponse(null, Http::STATUS_INTERNAL_SERVER_ERROR); } - $participant = $this->participantService->joinRoomAsNewGuest($this->roomService, $room, '', true, displayName: $caller); + $participant = $this->participantService->joinRoomAsNewGuest( + $this->roomService, + $room, + '', + true, + displayName: $caller, + phoneNumber: $inBoundPhoneNumber, + ); return new DataResponse($this->formatRoom($room, $participant)); } diff --git a/lib/Service/ParticipantService.php b/lib/Service/ParticipantService.php index c9a2af4f728..6efa7cbb81d 100644 --- a/lib/Service/ParticipantService.php +++ b/lib/Service/ParticipantService.php @@ -498,7 +498,7 @@ public function joinRoomAsFederatedUser(Room $room, string $actorType, string $a * @throws InvalidPasswordException * @throws UnauthorizedException */ - public function joinRoomAsNewGuest(RoomService $roomService, Room $room, string $password, bool $passedPasswordProtection = false, ?Participant $previousParticipant = null, ?string $displayName = null): Participant { + public function joinRoomAsNewGuest(RoomService $roomService, Room $room, string $password, bool $passedPasswordProtection = false, ?Participant $previousParticipant = null, ?string $displayName = null, ?string $phoneNumber = null): Participant { $event = new BeforeGuestJoinedRoomEvent($room, $password, $passedPasswordProtection); $this->dispatcher->dispatchTyped($event); @@ -531,6 +531,10 @@ public function joinRoomAsNewGuest(RoomService $roomService, Room $room, string if ($displayName !== null && $displayName !== '') { $attendee->setDisplayName($displayName); } + if ($phoneNumber !== null && $phoneNumber !== '') { + $attendee->setPhoneNumber($phoneNumber); + $attendee->setActorType(Attendee::ACTOR_PHONES); + } $this->attendeeMapper->insert($attendee); From 547c17a4039bd3bd9972cc60885dada18b9f0afd Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 9 Jul 2026 10:11:45 +0200 Subject: [PATCH 2/3] fix(sip): Allow adding phone numbers with leading + Signed-off-by: Joas Schilling --- lib/Service/PhoneNumberValidation.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/Service/PhoneNumberValidation.php b/lib/Service/PhoneNumberValidation.php index c1ce47af600..2f44cbe83d7 100644 --- a/lib/Service/PhoneNumberValidation.php +++ b/lib/Service/PhoneNumberValidation.php @@ -23,9 +23,7 @@ public function __construct( * Validate input as a phone number * * - Local number: allow - * - International number - * a. If valid, strip + and allow - * b. If invalid, throw + * - International number: If invalid, throw * @throws \InvalidArgumentException When the number is invalid */ public function validateNumber(string $phoneNumber): string { @@ -46,10 +44,6 @@ public function validateNumber(string $phoneNumber): string { throw new \InvalidArgumentException(); } - if (str_starts_with($standardPhoneNumber, '+')) { - return substr($standardPhoneNumber, 1); - } - - throw new \InvalidArgumentException(); + return $standardPhoneNumber; } } From f8369ff4aa4f88adf3f59daebe6f1dfa25fb7e08 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 9 Jul 2026 10:22:02 +0200 Subject: [PATCH 3/3] fix(sip): Disable setupcheck complaining about leading + Signed-off-by: Joas Schilling --- lib/SetupCheck/SIPConfiguration.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/SetupCheck/SIPConfiguration.php b/lib/SetupCheck/SIPConfiguration.php index 6a0611f88e4..c29b433a77e 100644 --- a/lib/SetupCheck/SIPConfiguration.php +++ b/lib/SetupCheck/SIPConfiguration.php @@ -48,9 +48,11 @@ public function run(): SetupResult { $query->select('phone_number') ->from('talk_phone_numbers') ->where($query->expr()->like('phone_number', $query->createNamedParameter( - $this->connection->escapeLikeParameter('+') . '%' - ))) - ->orWhere($query->expr()->like('phone_number', $query->createNamedParameter( + // TODO: Temporary disabled while we migrate to leading `+` for international numbers + // TODO: Either to be deleted later or should complain for numbers without it + // $this->connection->escapeLikeParameter('+') . '%' + // ))) + // ->orWhere($query->expr()->like('phone_number', $query->createNamedParameter( $this->connection->escapeLikeParameter('0') . '%' )));