$gateway, 'id' => $providerMessageId, 'try' => 0 ], self::DELAYS[0], 40 ); } /** * One check. * * @param array $payload Job payload. * * @internal Hooked to the check job. */ public function run( array $payload ): void { $driver = DriverRegistry::get( DriverRegistry::CHANNEL_SMS, (string) ( $payload['gateway'] ?? '' ) ); $id = (string) ( $payload['id'] ?? '' ); $try = (int) ( $payload['try'] ?? 0 ); if ( ! $driver instanceof ReportingDriver || '' === $id ) { return; } $listed = $driver->blacklisted( $id ); if ( null === $listed ) { $next = $try + 1; // Still not final after a day: the operator never answered, and there is // nothing more to learn. if ( isset( self::DELAYS[ $next ] ) ) { Queue::push( Hooks::BLACKLIST_CHECK, [ 'gateway' => $payload['gateway'], 'id' => $id, 'try' => $next ], self::DELAYS[ $next ], 40 ); } return; } // A number already on the list stays as it is: the insert ignores repeats. foreach ( $listed as $phone ) { Optouts::add( $phone, 'provider' ); } } }