use of org.motechproject.mots.domain.IvrConfig in project mots by motech-implementations.
the class IvrService method sendModuleAssignedMessage.
private void sendModuleAssignedMessage(String subscriberId) throws IvrException {
IvrConfig ivrConfig = ivrConfigService.getConfig();
String messageId = ivrConfig.getModuleAssignedMessageId();
String sendSmsIfVoiceFails = boolToIntAsString(ivrConfig.getSendSmsIfVoiceFails());
String detectVoiceMailAction = boolToIntAsString(ivrConfig.getDetectVoicemailAction());
String retryAttemptsShort = Integer.toString(ivrConfig.getRetryAttemptsShort());
String retryDelayShort = Integer.toString(ivrConfig.getRetryDelayShort());
String retryAttemptsLong = Integer.toString(ivrConfig.getRetryAttemptsLong());
String retryDelayLong = Integer.toString(ivrConfig.getRetryDelayLong());
MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
params.add(SEND_TO_SUBSCRIBERS, subscriberId);
params.add(MESSAGE_ID, messageId);
params.add(SEND_SMS_IF_VOICE_FAILS, sendSmsIfVoiceFails);
params.add(DETECT_VOICEMAIL_ACTION, detectVoiceMailAction);
params.add(RETRY_ATTEMPTS_SHORT, retryAttemptsShort);
params.add(RETRY_DELAY_SHORT, retryDelayShort);
params.add(RETRY_ATTEMPTS_LONG, retryAttemptsLong);
params.add(RETRY_DELAY_LONG, retryDelayLong);
sendVotoRequest(getAbsoluteUrl(SEND_MESSAGE_URL), params, new ParameterizedTypeReference<VotoResponseDto<String>>() {
}, HttpMethod.POST);
}
use of org.motechproject.mots.domain.IvrConfig in project mots by motech-implementations.
the class IvrService method saveCallDetailRecord.
/**
* Save IVR Call Detail Record.
* @param callDetailRecord callDetailRecord to be saved
* @param configName name of the IVR config
*/
public void saveCallDetailRecord(CallDetailRecord callDetailRecord, String configName) throws IvrException {
IvrConfig ivrConfig = ivrConfigService.getConfig();
setConfigFields(callDetailRecord, ivrConfig, configName);
callDetailRecordRepository.save(callDetailRecord);
CallStatus callStatus = callDetailRecord.getCallStatus();
boolean callInterrupted = CallStatus.FINISHED_INCOMPLETE.equals(callStatus);
if (CallStatus.FINISHED_COMPLETE.equals(callStatus) || callInterrupted) {
VotoCallLogDto votoCallLogDto = getVotoCallLog(callDetailRecord);
moduleProgressService.updateModuleProgress(votoCallLogDto, callInterrupted);
}
}
use of org.motechproject.mots.domain.IvrConfig in project mots by motech-implementations.
the class IvrService method prepareBasicSubscriberParamsToSend.
private MultiValueMap<String, String> prepareBasicSubscriberParamsToSend(String phoneNumber, String name, Language preferredLanguage) {
IvrConfig ivrConfig = ivrConfigService.getConfig();
String preferredLanguageString = ivrConfig.getIvrLanguagesIds().get(preferredLanguage);
MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
params.add(PHONE, phoneNumber);
params.add(PREFERRED_LANGUAGE, preferredLanguageString);
if (StringUtils.isNotBlank(name)) {
params.add(NAME_PROPERTY, name);
}
return params;
}
Aggregations