RestComm / jss7

RestComm Java SS7 Stack and Services
http://www.restcomm.com/
GNU Affero General Public License v3.0
178 stars 218 forks source link

RSP is not prohibited by default #215

Closed hamsterksu closed 7 years ago

hamsterksu commented 7 years ago

Hi everyone,

seems i have found an issue in jss7.

SCCP RSP is not prohibited by default. it means when ussd server starts and STP is not available 'prohibit' flag will not be changed It happens because state changed event will not be handled. i suppose it will not be fired too, i see error in log only java.net.ConnectException: Connection refused as a result SCCP will try to use inactive remote scp.

but everything will be ok if STP connection state will be changed while ussd server is running. it will handle state changed event and SCCP disables(prohibits) RSP. ​ it's very easy to reproduce. configure ussd as AS in CLIENT MODE and run it. i will see that RSP is not prohibited but there are not ACTIVE routes on m3ua level.

After that start and stop ss7 simulator(SGW server). ussd server will update 'prohibit' flag of RSP.

so i think default state of all RSP should be 'prohibited'

Thanks,

hamsterksu commented 7 years ago

i think both boolean variables should be true by default

protected boolean remoteSpcProhibited;
protected boolean remoteSccpProhibited;

https://github.com/RestComm/jss7/blob/71f24a37a2e313524084149696a1efd791b07cba/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/RemoteSignalingPointCodeImpl.java#L51

deruelle commented 7 years ago

@vetss can you review this one ?

hamsterksu commented 7 years ago

i have modified my local version of ussd with the following fix and it works now.

protected boolean remoteSpcProhibited = true;
protected boolean remoteSccpProhibited = true;
abhayani commented 7 years ago

@hamsterksu @vetss May be there should be configurable parameter that lets is "true" or "false" by default. Like how we do as of today for SSN parameter.

hamsterksu commented 7 years ago

@abhayani what is a reason to leave it as is? i think RSP should be disable until mtp layer will not change state. I have missed something?

hamsterksu commented 7 years ago

@abhayani do you want to add flag like this?

private boolean markProhibitedWhenSpcResuming;

https://github.com/RestComm/jss7/blob/71f24a37a2e313524084149696a1efd791b07cba/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/RemoteSubSystemImpl.java#L46

vetss commented 7 years ago

Hello @hamsterksu

sorry for delayed response.

Unfortunately this problem is more complicated that you have described and this is definitely needed to be solved. We have open issues for it planned for release 8.1: m3ua: https://github.com/RestComm/jss7/issues/64 dialogic: https://github.com/RestComm/jss7/issues/87

The problem is that current implementation does not check initial channel state settings and any value of remoteSpcProhibited / remoteSccpProhibited (true / false) may be wrong in a general case.

May I ask you to check info in provided issues ? Your comments may be valuable.

vetss commented 7 years ago

one question: "configure ussd as AS in CLIENT MODE and run it." - you mean to run a server like USSD GW without an active m3ua/MTP connection, correct ?

hamsterksu commented 7 years ago

@vetss

this config can be used to reproduce issue

sctp association create test_assoc CLIENT 10.0.0.106 2905 0.0.0.0 8012

m3ua asp create test_asp test_assoc

m3ua as create test_as AS mode SE rc 1
m3ua as add test_as test_asp

m3ua route add test_as 1 2 -1
m3ua route add test_as 2 1 -1

m3ua asp start test_asp

sccp set sccpprotocolversion ANSI

sccp sap create 1 1 2 1

sccp dest create 1 1 2 1 0 255 255

sccp rsp create 1 1 0 0
vetss commented 7 years ago

Hello @hamsterksu

as an intermediate solution (till https://github.com/RestComm/jss7/issues/64 is fixed) we can suggest to introduce a configurable SCCP stack level option with getter / setter so we will be able to set it in jboss-mbeans.xml to true or false (default is false for backup compatibility). like this: boolean SccpStack.remoteSpcInitiallyProhibited

And then RemoteSignalingPointCodeImpl will take this value as a default.

hamsterksu commented 7 years ago

@vetss @deruelle I will implement this configuration option.

vetss commented 7 years ago

Hello @hamsterksu

I have added your commit and added my little needed updates. Thank you for your work.

The issues is fixed by: https://github.com/RestComm/jss7/commit/0ba1d42b99badde56ffc1688f65e4ad8b5d6043f https://github.com/RestComm/jss7/commit/385ad34367ab5c398e6f3394cc82e1b9e694728d

PS: please do not provide code refactoring for that issue that you are not covering or at least in the single commit of the provided fix.