Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve UCI or move to direct APIs to send SMS #5

Open
aakashyadav-kgp opened this issue Jan 17, 2023 · 4 comments
Open

Resolve UCI or move to direct APIs to send SMS #5

aakashyadav-kgp opened this issue Jan 17, 2023 · 4 comments
Assignees

Comments

@aakashyadav-kgp
Copy link

aakashyadav-kgp commented Jan 17, 2023

Description: We use CDAC in himachal pradesh to send SMS. But recently we have not been able to send SMS via UCI. We have verified that the UCI-ODK-adapter is working properly. Chakshu said the CDAC API is not working that's why the issue. I tried to use the CDAC API directly via postman but got error 416.

Image

API collection: Link

Now we want to update the key and test again using the Postman API to see if we need to fix something on UCI or CDAC integration end.

CDAC integration doc: https://mgov.gov.in/SMSServices

Acceptance criteria:

  1. We want to receive 9/10 SMS to 4-5 different numbers. This can be tested by adding students in a school and triggering SMS via e-Samwad app to their parents.
@tushar5526
Copy link
Contributor

image

key has to be generated from the function provided in https://mgov.gov.in/SMSServices and the value in key was actually secureKey.

Following is the hashGenerator function used.


public class App {

  public static String hashGenerator(
    String userName,
    String senderId,
    String content,
    String secureKey
  ) {
    // TODO Auto-generated method stub
    StringBuffer finalString = new StringBuffer();
    finalString
      .append(userName.trim())
      .append(senderId.trim())
      .append(content.trim())
      .append(secureKey.trim());
    // logger.info("Parameters for SHA-512 : "+finalString);
    String hashGen = finalString.toString();
    StringBuffer sb = null;
    MessageDigest md;
    try {
      md = MessageDigest.getInstance("SHA-512");
      md.update(hashGen.getBytes());
      byte byteData[] = md.digest();
      //convert the byte to hex format method 1
      sb = new StringBuffer();
      for (int i = 0; i < byteData.length; i++) {
        sb.append(
          Integer.toString((byteData[i] & 0xff) + 0x100, 16).substring(1)
        );
      }
    } catch (NoSuchAlgorithmException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    return sb.toString();
  }

  public static void main(String[] args) {
    System.out.println("Hello World!");
    System.out.println(
      hashGenerator(
        "hpgovt-hpssa",
        "HPGOVT",
        "Test 2",
        "5e92f23b-0d09-46ef-a428-dcd7cae79169"
      )
    );
  }
}

@choxx
Copy link
Contributor

choxx commented Jan 20, 2023

@aakashyadav-kgp to get back after checking logs from portal.

@tushar5526
Copy link
Contributor

tushar5526 commented Jan 23, 2023

@aakashyadav-kgp will check on whether to use UCI or directly send messages through CDAC.
https://github.com/Samarth-HP/CDAC-Service

@karntrehan
Copy link

Talk to @suresh about moving to CDAC services directly and the future implementations. Needs to be picked up soon. @aakashyadav-kgp to create ticket for the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants