Aditi16 / jss7

Automatically exported from code.google.com/p/jss7
0 stars 0 forks source link

SRI-SM Response parsing error #336

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Subscriber must be in roaming.
2. Prepare and send SRI-SM

What is the expected output? What do you see instead?
Expected output: parsed response for SRI-SM request
Instead: Exception thrown by the org.mobicents.protocols.ss7.map.MAPStackImpl.
Here is the full exception trace:

ERROR org.mobicents.protocols.ss7.map.MAPStackImpl-ScpMapStack  - 
MAPParsingComponentException when parsing components: MistypedParameter - Error 
when decoding LocationInfoWithLMSI: additionalNumber: double element or element 
is not primitive
org.mobicents.protocols.ss7.map.api.MAPParsingComponentException: Error when 
decoding LocationInfoWithLMSI: additionalNumber: double element or element is 
not primitive
        at org.mobicents.protocols.ss7.map.service.sms.LocationInfoWithLMSIImpl._decode(LocationInfoWithLMSIImpl.java:195)
        at org.mobicents.protocols.ss7.map.service.sms.LocationInfoWithLMSIImpl.decodeAll(LocationInfoWithLMSIImpl.java:106)
        at org.mobicents.protocols.ss7.map.service.sms.SendRoutingInfoForSMResponseImpl._decode(SendRoutingInfoForSMResponseImpl.java:165)
        at org.mobicents.protocols.ss7.map.service.sms.SendRoutingInfoForSMResponseImpl.decodeData(SendRoutingInfoForSMResponseImpl.java:122)
        at org.mobicents.protocols.ss7.map.service.sms.MAPServiceSmsImpl.sendRoutingInfoForSMResponse(MAPServiceSmsImpl.java:483)
        at org.mobicents.protocols.ss7.map.service.sms.MAPServiceSmsImpl.processComponent(MAPServiceSmsImpl.java:224)
        at org.mobicents.protocols.ss7.map.MAPProviderImpl.doProcessComponent(MAPProviderImpl.java:1600)
        at org.mobicents.protocols.ss7.map.MAPProviderImpl.processComponents(MAPProviderImpl.java:1470)
        at org.mobicents.protocols.ss7.map.MAPProviderImpl.onTCEnd(MAPProviderImpl.java:1099)
        at org.mobicents.protocols.ss7.tcap.TCAPProviderImpl.deliver(TCAPProviderImpl.java:347)
        at org.mobicents.protocols.ss7.tcap.DialogImpl.processEnd(DialogImpl.java:1656)
        at org.mobicents.protocols.ss7.tcap.TCAPProviderImpl.onMessage(TCAPProviderImpl.java:737)
        at org.mobicents.protocols.ss7.sccp.impl.SccpRoutingControl.route(SccpRoutingControl.java:558)
        at org.mobicents.protocols.ss7.sccp.impl.SccpRoutingControl.translationFunction(SccpRoutingControl.java:462)
        at org.mobicents.protocols.ss7.sccp.impl.SccpRoutingControl.routeMssgFromMtp(SccpRoutingControl.java:172)
        at org.mobicents.protocols.ss7.sccp.impl.SccpStackImpl.onMtp3TransferMessage(SccpStackImpl.java:868)
        at org.mobicents.protocols.ss7.mtp.Mtp3UserPartBaseImpl$MsgTransferDeliveryHandler.run(Mtp3UserPartBaseImpl.java:256)
        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)

What version of the product are you using? On what operating system?

jSS7 2.1.0.FINAL on Ubuntu 12.04.4 LTS

Please provide any additional information below.

For the subscribers who are in the home network - no exception is thrown. I 
normally receive response for SRI-SM request.

Original issue reported on code.google.com by asimil...@gmail.com on 24 Dec 2014 at 7:31

GoogleCodeExporter commented 9 years ago
Update:

Exception is thorwn, because additionalNumber is not primitive. It contains an 
sgsn-number. Here is part of the tcp dump:

locationInfoWithLMSI
                    networkNode-Number: 917373499921f0
                        1... .... = Extension: No Extension
                        .001 .... = Nature of number: International Number (0x01)
                        .... 0001 = Number plan: ISDN/Telephony Numbering (Rec ITU-T E.164) (0x01)
                        Address digits: 37379499120
                        Country Code: 373 Moldova (Republic of) (length 3)
                    additional-Number: sgsn-Number (1)
                        sgsn-Number: 917373499950f0
                            1... .... = Extension: No Extension
                            .001 .... = Nature of number: International Number (0x01)
                            .... 0001 = Number plan: ISDN/Telephony Numbering (Rec ITU-T E.164) (0x01)
                            Address digits: 37379499050
                            Country Code: 373 Moldova (Republic of) (length 3)

As you can see additional-Number is constructed - not primitive.

I'll change in LocationInfoWithLMSIImpl.java:
                        case _TAG_AdditionalNumber:
                            if (!ais.isTagPrimitive() || this.additionalNumber != null){
                                throw new MAPParsingComponentException(
                                        "Error when decoding LocationInfoWithLMSI: additionalNumber: double element or element is not primitive",
                                        MAPParsingComponentExceptionReason.MistypedParameter);
                            }
to:
                        case _TAG_AdditionalNumber:
                            if (ais.isTagPrimitive() || this.additionalNumber != null){
                                throw new MAPParsingComponentException(
                                        "Error when decoding LocationInfoWithLMSI: additionalNumber: double element or element is not primitive",
                                        MAPParsingComponentExceptionReason.MistypedParameter);
                            }
and will perform tests.

Original comment by asimil...@gmail.com on 17 Jan 2015 at 9:38

GoogleCodeExporter commented 9 years ago
Tests are OK, but additional number is not decoded correctly:
additionalNumberType=msc, 
additionalNumber=ISDNAddressString[AddressNature=unknown, NumberingPlan=ISDN, 
Address=701937379499050

must be
additionalNumberType=sgsn, 
additionalNumber=ISDNAddressString[AddressNature=international_number, 
NumberingPlan=ISDN, Address=37379499050

Reason:
additionalNumber in LocationInfoWithLMSIImpl.java is defined as 
ISDNAddressString, but I think it must be ArrayList<ISDNAddressString>.

Solution:
To create new interface, for example:

public interface AdditionalNumber extends Serializable {

    ArrayList<ISDNAddressString> getAdditionalNumber ();

    void setAdditionalNumber (ArrayList<ISDNAddressString> numbersList);
}

and implement it.

Original comment by asimil...@gmail.com on 17 Jan 2015 at 10:16

GoogleCodeExporter commented 9 years ago
Here is the solution:

AdditionalNumber is already implemented in 
org.mobicents.protocols.ss7.map.api.service.lsm

Changes LocationInfoWithLMSIImpl.java:

1. Commented private AdditionalNumberType additionalNumberType;
2. Changed type of the additionalNumber to 
org.mobicents.protocols.ss7.map.api.service.lsm.AdditionalNumber;
3. Changed constructor of the LocationInfoWithLMSIImpl.java
3. Changed decoding/encoding algorithms.
4. Changed all dependencies.

Recompiled JSS7
Performed tests. All OK

additionalNumber=AdditionalNumber 
[sgsn-Number=ISDNAddressString[AddressNature=international_number, 
NumberingPlan=ISDN, Address=37379499050]]]] - decoded correctly

Original comment by asimil...@gmail.com on 17 Jan 2015 at 12:58

Attachments:

GoogleCodeExporter commented 9 years ago
I think the code should be:

I think the code 
- for decoding LocationInfoWithLMSIImpl._decode(...):

                    case _TAG_AdditionalNumber:
                        if (ais.isTagPrimitive() || this.additionalNumber != null)
                            throw new MAPParsingComponentException("Error when decoding " + _PrimitiveName
                                    + ": additionalNumber: double element or element is primitive", MAPParsingComponentExceptionReason.MistypedParameter);
                        AsnInputStream ais2 = ais.readSequenceStream();
                        ais2.readTag();
                        this.additionalNumber = new AdditionalNumberImpl();
                        ((AdditionalNumberImpl) this.additionalNumber).decodeAll(ais2);
                        break;

- for encoding:
encodeData(...):

            if (this.additionalNumber != null) {
                asnOs.writeTag(Tag.CLASS_CONTEXT_SPECIFIC, false, _TAG_AdditionalNumber);
                int pos = asnOs.StartContentDefiniteLength();
                ((AdditionalNumberImpl) this.additionalNumber).encodeAll(asnOs);
                asnOs.FinalizeContent(pos);
            }

Original comment by serg.vet...@gmail.com on 22 Jan 2015 at 3:18

GoogleCodeExporter commented 9 years ago
Hi Sergey,

Applied your recommendation. Compiled jss7 source. Performed test. Everything 
is OK.

Original comment by asimil...@gmail.com on 12 Feb 2015 at 7:42