Class GroovyPhoneService
- Since:
- Intrexx 12.1.0.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add an SMS to the list of messages to be sent.void
addVoiceCall
(Map<String, Object> p_params) Add a voice call to the list of messages to be sent.static GroovyPhoneService
Create an instance of this API class.getRegionCode
(String p_strPhoneNumber) Derive the two-letter region code from the given phone number.normalizePhoneNumber
(Map<String, Object> p_params) Normalize a phone number to the E.164 format.void
send()
Synchronously send added SMS and voice messages.void
Asynchronously send added SMS and voice messages.synchronouslyMakeVoiceCall
(Map<String, Object> p_params) Make a synchronous voice call.synchronouslySendSms
(Map<String, Object> p_params) Send an SMS synchronously.
-
Method Details
-
createInstance
Create an instance of this API class.- Returns:
- A new instance of this class.
-
normalizePhoneNumber
public String normalizePhoneNumber(Map<String, Object> p_params) throws de.uplanet.lucy.util.phonenumber.PhoneNumberParseExceptionNormalize a phone number to the E.164 format.The default country must be specified if the input is not designated as an international telephone number by using the international prefix symbol ⟨+⟩.
Parameters:
number
: The phone number to be normalized.defaultCountry
(optional): The default two-letter upper-case country code (may benull
).
- Parameters:
p_params
- Named parameters (see above).- Throws:
de.uplanet.lucy.util.phonenumber.PhoneNumberParseException
- If the input could not be parsed as a complete international phone number.
-
getRegionCode
Derive the two-letter region code from the given phone number.- Parameters:
p_strPhoneNumber
- The phone number.- Returns:
- The two-letter region code derived from the phone number,
or
null
, if the given number does not provide this information.
-
addSms
Add an SMS to the list of messages to be sent. This operation takes part in the current transaction.The added SMS messages could be sent by calling
send()
orsendAsync()
.Parameters:
to
: The recipient or aCollection
of recipients (in a possibly provider specific format).text
: The text to send.apiKeyRef
(optional): The name of a credential store entry that contains an API key that may override an API key configured for the phone service.apiKey
(optional): An API key that may override an API key configured for the phone service. For security reasonsapiKeyRef
should be preferred overapiKey
.providerParameters
Additional optional named parameters (Map) passed to the phone service provider.
- Parameters:
p_params
- Named parameters (see above).
-
synchronouslySendSms
public String synchronouslySendSms(Map<String, Object> p_params) throws de.uplanet.lucy.server.phoneservice.PhoneServiceException, IOExceptionSend an SMS synchronously. This operation does not take part in the current transaction.Parameters:
to
: The recipient or aCollection
of recipients (in a possibly provider specific format).text
: The text to send.apiKeyRef
(optional): The name of a credential store entry that contains an API key that may override an API key configured for the phone service.apiKey
(optional): An API key that may override an API key configured for the phone service. For security reasonsapiKeyRef
should be preferred overapiKey
.providerParameters
Additional optional named parameters (Map) passed to the phone service provider.
Note: The structure of the returned message is specific for the provider and and may change in the future. It should only be used for debugging purposes.
- Parameters:
p_params
- Named parameters (see above).- Returns:
- A provider specific response, or
null
. - Throws:
de.uplanet.lucy.server.phoneservice.PhoneServiceException
IOException
-
addVoiceCall
Add a voice call to the list of messages to be sent. This operation takes part in the current transaction.The added voice calls could be sent by calling
send()
orsendAsync()
.Parameters:
to
: The recipient or aCollection
of recipients (in a possibly provider specific format).text
: The text to send.apiKeyRef
(optional): The name of a credential store entry that contains an API key that may override an API key configured for the phone service.apiKey
(optional): An API key that may override an API key configured for the phone service. For security reasonsapiKeyRef
should be preferred overapiKey
.providerParameters
Additional optional named parameters (Map) passed to the phone service provider.
- Parameters:
p_params
- Named parameters (see above).
-
synchronouslyMakeVoiceCall
public String synchronouslyMakeVoiceCall(Map<String, Object> p_params) throws de.uplanet.lucy.server.phoneservice.PhoneServiceException, IOExceptionMake a synchronous voice call. This operation takes not part in the current transaction.Parameters:
to
: The recipient or aCollection
of recipients (in a possibly provider specific format).text
: The text to send.apiKeyRef
(optional): The name of a credential store entry that contains an API key that may override an API key configured for the phone service.apiKey
(optional): An API key that may override an API key configured for the phone service. For security reasonsapiKeyRef
should be preferred overapiKey
.providerParameters
Additional optional named parameters (Map) passed to the phone service provider.
Note: The structure of the returned message is specific for the provider and and may change in the future. It should only be used for debugging purposes.
- Parameters:
p_params
- Named parameters (see above).- Returns:
- A provider specific response, or
null
. - Throws:
de.uplanet.lucy.server.phoneservice.PhoneServiceException
IOException
-
send
Synchronously send added SMS and voice messages.This operation takes part in the current transaction. The messages are being sent when the transaction is being committed.
Note that this operation blocks until the messages have been submitted to the provider. To avoid this you might want to consider using the
sendAsync()
method.- Throws:
Exception
- If an error occurs.
-
sendAsync
public void sendAsync()Asynchronously send added SMS and voice messages.This operation takes part in the current transaction. The messages are being sent in a concurrent thread when the transaction is being committed.
-