RestComm / ussdgateway

RestComm USSD Gateway
http://www.restcomm.com/
GNU Affero General Public License v3.0
88 stars 102 forks source link

Save UnstructuredSSResponse strings into CDR #76

Closed abdulazizali77 closed 6 years ago

abdulazizali77 commented 6 years ago

Allow persisting of ussd response strings into CDR. Introduce a configuration flag to turn this on and off

vetss commented 6 years ago

Hello @abdulazizali77

thanks for your PR. Please check my comments in https://github.com/RestComm/ussdgateway/pull/77 .

vetss commented 6 years ago

Fixed by:

https://github.com/RestComm/ussdgateway/commit/cbdb16dd6ef89ff2cc1229cb47318674b96bfeea https://github.com/RestComm/ussdgateway/commit/fc7d1df060da25c04d60fe23550cce8055874261

vetss commented 6 years ago

Hello @abdulazizali77

here are comments for issues #72 and #76

1) I tested your commits and added them into master branch

2) I had to add a commit https://github.com/RestComm/ussdgateway/commit/fc7d1df060da25c04d60fe23550cce8055874261 to make your fix workable: a) It will raise Exception when no responses from user Caused by: java.lang.NullPointerException at org.mobicents.ussdgateway.slee.cdr.plain.CDRGeneratorSbb.toString(CDRGeneratorSbb.java:344) at org.mobicents.ussdgateway.slee.cdr.plain.CDRGeneratorSbb.createRecord(CDRGeneratorSbb.java:93) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.mobicents.slee.container.deployment.interceptors.SbbLocalObjectInterceptor.invokeAndReturnObject(SbbLocalObjectInterceptor.java:95) ... 15 more

b) not processing of a first message - "null" will be writtent into a CDR like "null," c) only PULL request was covered for user response logging

I suppose you have not made tests on a live USSD server (with simulators or/and RC server for traffic generating) for all possible cases (PULL/PUSH and with/without mobile user responses). This step is mandatory to be sure the update works as expected. Please do such testing for further updates. Please ask me if you need info how to configure servers for testing.

3) for database structure update: better to make database updates together for both fields (because we are providing a cu,ulative update for it and it is not possible that only one field was added into a customer side). It is for future, we can leave as it is now.

4) I tested only plain text CDRs. Please make testing of database CDR types. We can close issues only we make it. We need to test how databse fields are filled. It is reasonable to test also database structure update.

abdulazizali77 commented 6 years ago

thanks @vetss I will follow up on the testing for CDR

abdulazizali77 commented 6 years ago

Push cases

mysql> select SERVICE_CODE,USSD_STRING,DIALOG_DURATION,TYPE,ISDN_DIGITS,STATUS from USSD_GW_CDRS WHERE TYPE='PUSH'\G;
*************************** 1. row ***************************
   SERVICE_CODE: The information you requested is 1234567890
    USSD_STRING: NULL
DIALOG_DURATION: 86
           TYPE: PUSH
    ISDN_DIGITS: 111111
         STATUS: SUCCESS
*************************** 2. row ***************************
   SERVICE_CODE: Please press
1 For option1
2 For option2
    USSD_STRING: NULL
DIALOG_DURATION: 60066
           TYPE: PUSH
    ISDN_DIGITS: 111111
         STATUS: FAILED_DIALOG_TIMEOUT
*************************** 3. row ***************************
   SERVICE_CODE: The information you requested is 1234567890
    USSD_STRING: NULL
DIALOG_DURATION: 101
           TYPE: PUSH
    ISDN_DIGITS: 11111
         STATUS: SUCCESS
*************************** 4. row ***************************
   SERVICE_CODE: Please press
1 For option1
2 For option2
    USSD_STRING: NULL
DIALOG_DURATION: 60043
           TYPE: PUSH
    ISDN_DIGITS: 111112
         STATUS: FAILED_DIALOG_TIMEOUT
*************************** 5. row ***************************
   SERVICE_CODE: Please press
1 For option1
2 For option2
    USSD_STRING: 2
DIALOG_DURATION: 18769
           TYPE: PUSH
    ISDN_DIGITS: 1234
         STATUS: FAILED_DIALOG_USER_ABORT
*************************** 6. row ***************************
   SERVICE_CODE: Please press
1 For option1
2 For option2
    USSD_STRING: 1
DIALOG_DURATION: 34543
           TYPE: PUSH
    ISDN_DIGITS: 222222
         STATUS: FAILED_APP_TIMEOUT
6 rows in set (0.00 sec)

Pull cases

mysql> select SERVICE_CODE,USSD_STRING,DIALOG_DURATION,TYPE,ISDN_DIGITS,STATUS from USSD_GW_CDRS WHERE TYPE='PULL'\G;
*************************** 1. row ***************************
   SERVICE_CODE: *519#
    USSD_STRING: 2
DIALOG_DURATION: 2395
           TYPE: PULL
    ISDN_DIGITS: NULL
         STATUS: SUCCESS
*************************** 2. row ***************************
   SERVICE_CODE: *519#
    USSD_STRING: 1
DIALOG_DURATION: 3231
           TYPE: PULL
    ISDN_DIGITS: NULL
         STATUS: SUCCESS
*************************** 3. row ***************************
   SERVICE_CODE: *519#
    USSD_STRING: NULL
DIALOG_DURATION: 25057
           TYPE: PULL
    ISDN_DIGITS: NULL
         STATUS: FAILED_INVOKE_TIMEOUT
*************************** 4. row ***************************
   SERVICE_CODE: *519#
    USSD_STRING: 3
DIALOG_DURATION: 3532
           TYPE: PULL
    ISDN_DIGITS: NULL
         STATUS: SUCCESS
*************************** 5. row ***************************
   SERVICE_CODE: *666#
    USSD_STRING: 1,1,0,1,1,0,2
DIALOG_DURATION: 25195
           TYPE: PULL
    ISDN_DIGITS: NULL
         STATUS: SUCCESS
5 rows in set (0.00 sec)
abdulazizali77 commented 6 years ago

PUSH and PULL test with Plain text cdr.log

abdulazizali77 commented 6 years ago

@vetss Sergey, local testing is done, but we have to apply a small fix to jdbc.task.CDRCreateTask https://github.com/RestComm/ussdgateway/pull/81

vetss commented 6 years ago

Fixed by:

https://github.com/RestComm/ussdgateway/commit/cbdb16dd6ef89ff2cc1229cb47318674b96bfeea https://github.com/RestComm/ussdgateway/commit/1fc3caf8d398d91fc7d0d5e76ed6259dcf922175