DHIS2 (2.22) not identifying user from SMS phone number

Hey devs,

We’re currently working on an SMS submission method for our mobile app for our data gathering.

Unfortunately it seems as though DHIS2 (v2.22) doesn’t recognise the user’s number upon the initial receipt of SMS. However, when looking at the ‘Received SMSs’ log and running a ‘Re-import’ the SMS is then imported successfully.

I have a feeling it may be related to the international ‘+’ code at the front of the phone number. Symptoms as follows:

  • Our SMS gateway will always send a ‘+’ at the front of the number (I’ve tried removing the ‘+’ with a manual submission as well, with no better results).

  • If the user’s phone number in DHIS2 has a ‘+’ in front, the ‘Received SMS’ page will correctly list the user’s username in the sender column but when attempting a ‘Re-import’ it fails to find the associated user.

  • If the user’s phone number in DHIS2 does NOT have a ‘+’ in front, the ‘Received SMS’ page will list the sender as ‘unknown’ but the SMS is imported successfully for that user.

  • In both cases, the SMS command initially fails with a ‘No user found’ message.

On another note, it looks like the ‘Received SMS’ link on the main page of the ‘Mobile Configuration’ page is broken, but the one in the sidebar seems to work.

Logs below:

  • INFO 2016-10-04 10:12:41,428 Received SMS: idsr Zye0,4,ZyC5,0,Zyjp,4,ZyCi,1,Epe0,5,EpC5,0,Epjp,0,EpCi,0,iHe0,5,iHC5,5,iHjp,0,iHCi,0,drDA,SMS,BpDA,true,FHe0,4,FHC5,4 (SmsConsumerThread.java [taskScheduler-8])

  • WARN 2016-10-04 10:12:41,448 Cannot get users with disjoint roles as user does not have any user roles (DefaultUserService.java [taskScheduler-8])

  • ERROR 2016-10-04 10:12:41,449 org.hisp.dhis.sms.parse.SMSParserException: No user found for that phone number (SmsConsumerThread.java [taskScheduler-8])

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)

at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)

at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)

at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

org.hisp.dhis.sms.parse.SMSParserException: No user found for that phone number

at org.hisp.dhis.sms.listener.DataValueSMSListener.receive(DataValueSMSListener.java:143)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)

at com.sun.proxy.$Proxy102.receive(Unknown Source)

at org.hisp.dhis.sms.SmsConsumerThread.spawnSmsConsumer(SmsConsumerThread.java:69)

at org.hisp.dhis.sms.SmsPublisher$1.run(SmsPublisher.java:61)

at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at java.lang.Thread.run(Thread.java:745)