basically, you will need to generate the SMS OTP on the server (could be 6 digits or 8 digits, depending on your needs, and use an SMS service provider to send the SMS to the provided mobile number.
once the registrant submits the SMS OTP, you will verify it against the SMS OTP stored inside the database.
for security reason, we usually store the hash of the SMS OTP instead of the SMS OTP itself. Otherwise, it can be encrypted and then decrypted later during the comparison.