Class IvrService


  • @Service
    public class IvrService
    extends java.lang.Object
    This class is responsible for making requests to IVR system (e.g. managing subscribers, getting call statuses, retrieving informations about phone interactions ).
    • Constructor Summary

      Constructors 
      Constructor Description
      IvrService()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addSubscribersToGroup​(java.lang.String groupId, java.util.List<java.lang.String> subscriberIds)
      Add Subscribers to group.
      void addSubscriberToGroups​(java.lang.String subscriberId, java.util.List<java.lang.String> groupsIds)
      Add Subscriber to groups.
      void changeSubscriberGroup​(java.lang.String subscriberId, java.lang.String oldGroupId, java.lang.String newGroupId)  
      java.lang.String createGroup​(java.lang.String groupName)  
      java.lang.String createSubscriber​(java.lang.String phoneNumber, java.lang.String name, java.lang.String districtIvrId)
      Create IVR Subscriber with given phone number.
      void manuallySendVotoCallLog​(VotoCallLogDto votoCallLogDto)
      Manually send Voto call log to Mots, this should be used only when call log is incorrect and must be manually changed before it can be successfully processed in Mots.
      void removeSubscriberFromGroups​(java.lang.String subscriberId, java.util.List<java.lang.String> groupsIds)
      Remove Subscriber from groups.
      void saveCallDetailRecordAndUpdateModuleProgress​(CallDetailRecord callDetailRecord, java.lang.String configName)
      Save IVR Call Detail Record and update module progress.
      void sendModuleAssignedMessage​(java.util.Set<java.lang.String> subscriberIds)
      Send module assignment message to a list of subscribers.]
      void updateSubscriber​(java.lang.String ivrId, java.lang.String phoneNumber, java.lang.String name)
      Update existing IVR subscriber.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IvrService

        public IvrService()
    • Method Detail

      • createSubscriber

        public java.lang.String createSubscriber​(java.lang.String phoneNumber,
                                                 java.lang.String name,
                                                 java.lang.String districtIvrId)
                                          throws IvrException
        Create IVR Subscriber with given phone number.
        Parameters:
        phoneNumber - CHW phone number
        name - CHW name
        districtIvrId - IVR group id
        Returns:
        ivr id of created subscriber
        Throws:
        IvrException - in case of any error
      • updateSubscriber

        public void updateSubscriber​(java.lang.String ivrId,
                                     java.lang.String phoneNumber,
                                     java.lang.String name)
                              throws IvrException
        Update existing IVR subscriber.
        Parameters:
        ivrId - id of existing IVR subscriber
        phoneNumber - new CHW phone number
        name - new CHW name
        Throws:
        IvrException - if there is an error while creating a subscriber or sending request to IVR service
      • createGroup

        public java.lang.String createGroup​(java.lang.String groupName)
                                     throws IvrException
        Throws:
        IvrException
      • changeSubscriberGroup

        public void changeSubscriberGroup​(java.lang.String subscriberId,
                                          java.lang.String oldGroupId,
                                          java.lang.String newGroupId)
                                   throws IvrException
        Throws:
        IvrException
      • addSubscribersToGroup

        public void addSubscribersToGroup​(java.lang.String groupId,
                                          java.util.List<java.lang.String> subscriberIds)
                                   throws IvrException
        Add Subscribers to group.
        Parameters:
        groupId - id of group to add subscriber
        subscriberIds - set of subscribers ids
        Throws:
        IvrException - if there is an error while sending request to IVR service
      • addSubscriberToGroups

        public void addSubscriberToGroups​(java.lang.String subscriberId,
                                          java.util.List<java.lang.String> groupsIds)
                                   throws IvrException
        Add Subscriber to groups.
        Parameters:
        subscriberId - subscriber id
        groupsIds - ids of groups to add subscriber
        Throws:
        IvrException - if there is an error while sending request to IVR service
      • removeSubscriberFromGroups

        public void removeSubscriberFromGroups​(java.lang.String subscriberId,
                                               java.util.List<java.lang.String> groupsIds)
                                        throws IvrException
        Remove Subscriber from groups.
        Parameters:
        subscriberId - subscriber id
        groupsIds - ids of groups to remove subscriber
        Throws:
        IvrException - if there is an error while sending request to IVR service
      • saveCallDetailRecordAndUpdateModuleProgress

        public void saveCallDetailRecordAndUpdateModuleProgress​(CallDetailRecord callDetailRecord,
                                                                java.lang.String configName)
        Save IVR Call Detail Record and update module progress.
        Parameters:
        callDetailRecord - callDetailRecord to be saved
        configName - name of the IVR config
      • manuallySendVotoCallLog

        @PreAuthorize("hasRole(\'ROLE_ADMIN\')")
        public void manuallySendVotoCallLog​(VotoCallLogDto votoCallLogDto)
        Manually send Voto call log to Mots, this should be used only when call log is incorrect and must be manually changed before it can be successfully processed in Mots.
        Parameters:
        votoCallLogDto - it contains information about module progress (which trees were listened by user and what answers were chosen)
        Throws:
        java.lang.IllegalArgumentException - if unexpected call status is in a response.
      • sendModuleAssignedMessage

        public void sendModuleAssignedMessage​(java.util.Set<java.lang.String> subscriberIds)
                                       throws IvrException
        Send module assignment message to a list of subscribers.]
        Parameters:
        subscriberIds - a list of subscribers
        Throws:
        IvrException - if there is an error while sending IVR notification