Skip to content

Commit

Permalink
Extra fixes for issues RestComm#72, RestComm#76
Browse files Browse the repository at this point in the history
  • Loading branch information
vetss committed Sep 28, 2017
1 parent cbdb16d commit fc7d1df
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ public abstract class ChildSbb extends USSDBaseSbb implements ChildInterface, Ch

protected static final UssdPropertiesManagement ussdPropertiesManagement = UssdPropertiesManagement.getInstance();

private static final String USSD_STRING_SEPARATOR = ",";

public ChildSbb(String loggerName) {
super(loggerName);
}
Expand Down Expand Up @@ -216,7 +214,11 @@ public void onUnstructuredSSResponse(UnstructuredSSResponse evt, ActivityContext

if(state.isInitialized()){
String ussdString = evt.getUSSDString().getString(null);
state.setUssdString(state.getUssdString()+USSD_STRING_SEPARATOR+ussdString);
if (state.getUssdString() == null) {
state.setUssdString(ussdString);
} else {
state.setUssdString(state.getUssdString() + USSDCDRState.USSD_STRING_SEPARATOR + ussdString);
}
}

this.sendUssdData(dialog);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
*/
public class USSDCDRState implements Serializable {

public static final String USSD_STRING_SEPARATOR = ",";

// TODO: AddressString and IMSI hashCode + equals
protected boolean initiated;
protected boolean generated;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ protected String toString(USSDCDRState state) {
}
//_COLUMN_USSD_STRING
String ussdString = state.getUssdString();
if(!ussdString.isEmpty()){
if (ussdString != null && !ussdString.isEmpty()) {
sb.append(sb.append(ussdString).append(SEPARATOR));
}else{
sb.append(SEPARATOR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,22 @@ public void onUnstructuredSSResponse(UnstructuredSSResponse event, ActivityConte
super.ussdStatAggregator.updateMessagesRecieved();
super.ussdStatAggregator.updateMessagesAll();

ChargeInterface cdrInterface = this.getCDRChargeInterface();
USSDCDRState state = cdrInterface.getState();

try {
if (state.isInitialized()) {
String ussdString = event.getUSSDString().getString(null);
if (state.getUssdString() == null) {
state.setUssdString(ussdString);
} else {
state.setUssdString(state.getUssdString() + USSDCDRState.USSD_STRING_SEPARATOR + ussdString);
}
}
} catch (Exception e) {
logger.warning("Exception when setting of UssdString CDR parameter in HttpServerSbb" + e.getMessage(), e);
}

this.processReceivedMAPEvent((MAPEvent) event);

this.setTimer(aci);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,22 @@ public void onUnstructuredSSResponse(UnstructuredSSResponse event, ActivityConte
super.ussdStatAggregator.updateMessagesRecieved();
super.ussdStatAggregator.updateMessagesAll();

ChargeInterface cdrInterface = this.getCDRChargeInterface();
USSDCDRState state = cdrInterface.getState();

try {
if (state.isInitialized()) {
String ussdString = event.getUSSDString().getString(null);
if (state.getUssdString() == null) {
state.setUssdString(ussdString);
} else {
state.setUssdString(state.getUssdString() + USSDCDRState.USSD_STRING_SEPARATOR + ussdString);
}
}
} catch (Exception e) {
logger.warning("Exception when setting of UssdString CDR parameter in HttpServerSbb" + e.getMessage(), e);
}

try {
SipUssdMessage simMsg = new SipUssdMessage(event.getDataCodingScheme(), event.getUSSDString());
simMsg.setAnyExt(new AnyExt(MAPMessageType.unstructuredSSRequest_Response));
Expand Down

0 comments on commit fc7d1df

Please sign in to comment.