linotp.provider.voiceprovider.custom_voice_provider module

  • implementation of the KeyIdentity VoiceProvider

class linotp.provider.voiceprovider.custom_voice_provider.CustomVoiceProvider

Bases: ConfigParsingMixin, TwillioMixin

Send a Voice notification through the Custom Voice Provider to the Voice Challenge Service. The CustomVoiceProvider allows to define all required config definitions directly and expects the following parameter:

{ “server_url”: “https://vcs.*/v1/twilio/call” “access_certificate”: “/etc/linotp/voice-license.pem”, “server_certificate”: “/etc/linotp/keyidentity-voice-ca-bundle.crt” ‘callerNumber’: ‘+4989231234567’ }

Part of the config definition is as well the Voice Delivery Service configuration definition, whereby currently the twilio definition is the only supported one:

‘twilio’: {

‘accountSid’: ‘ACf9095f540f0b090edbd239b99230a8ee’, ‘authToken’: ‘8f36aab7ca485b432500ce49c15280c5’ ‘voice’: ‘alice’, }

loadConfig(configDict)

Loads the configuration for this Voice notification provider

Parameters

configDict – A dictionary that contains all configuration entries you defined (e.g. in a linotp.cfg file)

{
“server_url”:

the voice provider target url,

“access_certificate”:

the client certificate

“server_certificate”:

server verification certificate

“proxy”: ‘

the proxy url

“timeout”:

the http timeout value

“twillioConfig”: {
“accountSid”:

the account identifier

“authToken”:

the authentication token

“voice”:

reader’s voice - default is ‘alice’

“callerNumber”:

the number of the originator

}

}

submitVoiceMessage(calleeNumber, messageTemplate, otp, locale)

Sends out the voice notification message.

{
‘call’:
{

‘calleeNumber’: ‘+4917012345678’, ‘messageTemplate’: ‘Hi! Your otp is {otp}’ ‘otp’: ‘98018932’ ‘locale’: ‘en’,

}

}

the other information is joined in the lower level of the http call

Parameters
  • calleeNumber – the destination phone number

  • messageTemplate – the message text containing the placeholder for the otp

  • otp – the otp

  • locale – the language of the voice reader

Returns

A tuple of success and result message

test_connection()

to test the connection, we just call the same endpoint without arguments (empty document), which will raise an error 400