17.2.1.15. SMS Provider

The following SMS providers are known to privacyIDEA:

SMSProvider is the base class for submitting SMS. It provides 3 different implementations:

  • HTTP: submitting SMS via an HTTP gateway of an SMS provider

  • SMTP: submitting SMS via an SMTP gateway of an SMS provider

  • Sipgate: submitting SMS via Sipgate service

17.2.1.15.7. Base Class

class privacyidea.lib.smsprovider.SMSProvider.ISMSProvider(db_smsprovider_object=None, smsgateway=None)[source]

The SMS provider interface.

Providers that accept structured push payloads set supports_push_messages to True. Individual gateways require ALLOW_PUSH=yes unless the provider enables PUSH by default.

Create a new SMS Provider object fom a DB SMS provider object

Parameters:
  • db_smsprovider_object – The database object

  • smsgateway – The SMS gateway object from the database table SMS gateway. The options can be accessed via self.smsgateway.option_dict

Returns:

An SMS provider object

static allow_push_parameter()[source]
classmethod allows_push_messages(smsgateway)[source]
check_configuration()[source]

This method checks the sanity of the configuration of this provider. If there is a configuration error, than an exception is raised. :return:

load_config(config_dict)[source]

Load the configuration dictionary

Parameters:

config_dict (dict) – The configuration of the SMS provider

Returns:

None

classmethod parameters()[source]

Return a dictionary, that describes the parameters and options for the SMS provider. Parameters are required keys to values with defined keys, while options can be any combination.

Each option is the key to another dict, that describes this option, if it is required, a description and which values it can take. The values are optional.

Additional options can not be named in advance. E.g. some provider specific HTTP parameters of HTTP gateways are options. The HTTP parameter for the SMS text could be “text” at one provider and “sms” at another one.

The options can be fixed values or also take the tags {otp}, {user}, {phone}.

Returns:

dict

push_messages_enabled_by_default = False
regexp_description = l'Regular expression to modify the phone number to make it compatible with the provider. For example to remove pluses and slashes enter something like '/[\+/]//'.'
submit_message(phone, message)[source]

Sends the SMS. It should return a bool indicating if the SMS was sent successfully.

In case of SMS send fail, an Exception should be raised. :return: Success :rtype: bool

supports_push_messages = False