public MAPApplicationContextVersion getCurVersion() { if (curVersion == null) return MAPApplicationContextVersion.version3; else { switch (curVersion.getVersion()) { case 1: if (++upVersionTested > mapV1RetestUpCount) { upVersionTested = 0; return MAPApplicationContextVersion.version3; } else return curVersion; case 2: if (++upVersionTested > mapV2RetestUpCount) { upVersionTested = 0; return MAPApplicationContextVersion.version3; } else return curVersion; } return curVersion; } }
private MAPApplicationContext(MAPApplicationContextName contextName, MAPApplicationContextVersion contextVersion) { this.contextName = contextName; this.contextVersion = contextVersion; this.res[6] = this.contextName.getApplicationContextCode(); this.res[7] = this.contextVersion.getVersion(); }
public static MAPApplicationContext getInstance(MAPApplicationContextName contextName, MAPApplicationContextVersion contextVersion) { if (MAPApplicationContext.availableApplicationContextVersion(contextName, contextVersion.getVersion())) return getMAPApplicationContext(contextName, contextVersion); else return null; }
private MAPApplicationContext getSRIMAPApplicationContext(MAPApplicationContextVersion applicationContextVersion) { MAPApplicationContext mapApplicationContext = MAPApplicationContext.getInstance( MAPApplicationContextName.shortMsgGatewayContext, applicationContextVersion); this.setSriMapVersion(applicationContextVersion.getVersion()); return mapApplicationContext; }
@Override public void onDialogRequestEricsson(MAPDialog mapDialog, AddressString destReference, AddressString origReference, AddressString eriImsi, AddressString eriVlrNo) { DialogImplWrapper di = (DialogImplWrapper) ((MAPDialogImpl) mapDialog).getTcapDialog(); if (mapDialog.getApplicationContext() != null) { di.setAcnValue(mapDialog.getApplicationContext().getApplicationContextName().getApplicationContextCode()); di.setAcnVersion(mapDialog.getApplicationContext().getApplicationContextVersion().getVersion()); } }
public ServingCheckData isServingService(MAPApplicationContext dialogApplicationContext) { MAPApplicationContextName ctx = dialogApplicationContext.getApplicationContextName(); int vers = dialogApplicationContext.getApplicationContextVersion().getVersion(); switch (ctx) { case gprsLocationInfoRetrievalContext: if (vers >= 3 && vers <= 4) { return new ServingCheckDataImpl(ServingCheckResult.AC_Serving); } else if (vers > 4) { long[] altOid = dialogApplicationContext.getOID(); altOid[7] = 2; ApplicationContextName alt = TcapFactory.createApplicationContextName(altOid); return new ServingCheckDataImpl(ServingCheckResult.AC_VersionIncorrect, alt); } else { return new ServingCheckDataImpl(ServingCheckResult.AC_VersionIncorrect); } } return new ServingCheckDataImpl(ServingCheckResult.AC_NotServing); }
public ServingCheckData isServingService(MAPApplicationContext dialogApplicationContext) { int vers = dialogApplicationContext.getApplicationContextVersion().getVersion(); switch (dialogApplicationContext.getApplicationContextName()) { case locationSvcEnquiryContext: case locationSvcGatewayContext: if (vers == 3) { return new ServingCheckDataImpl(ServingCheckResult.AC_Serving); } else if (vers > 3) { long[] altOid = dialogApplicationContext.getOID(); altOid[7] = 3; ApplicationContextName alt = TcapFactory.createApplicationContextName(altOid); return new ServingCheckDataImpl(ServingCheckResult.AC_VersionIncorrect, alt); } else { return new ServingCheckDataImpl(ServingCheckResult.AC_VersionIncorrect); } } return new ServingCheckDataImpl(ServingCheckResult.AC_NotServing); }
@Override public void onDialogRequest(MAPDialog mapDialog, AddressString destReference, AddressString origReference, MAPExtensionContainer extensionContainer) { if (((MAPDialogImpl) mapDialog).getTcapDialog() instanceof DialogImplWrapper) { DialogImplWrapper di = (DialogImplWrapper) ((MAPDialogImpl) mapDialog).getTcapDialog(); if (mapDialog.getApplicationContext() != null) { di.setAcnValue(mapDialog.getApplicationContext().getApplicationContextName().getApplicationContextCode()); di.setAcnVersion(mapDialog.getApplicationContext().getApplicationContextVersion().getVersion()); } } }
private void resetRequest(Parameter parameter, MAPDialogMobilityImpl mapDialogImpl, Long invokeId) throws MAPParsingComponentException { if (parameter == null) throw new MAPParsingComponentException("Error while decoding resetRequest: Parameter is mandatory but not found", MAPParsingComponentExceptionReason.MistypedParameter); if (parameter.getTag() != Tag.SEQUENCE || parameter.getTagClass() != Tag.CLASS_UNIVERSAL || parameter.isPrimitive()) throw new MAPParsingComponentException("Error while decoding resetRequest: Bad tag or tagClass or parameter is primitive, received tag=" + parameter.getTag(), MAPParsingComponentExceptionReason.MistypedParameter); long version = mapDialogImpl.getApplicationContext().getApplicationContextVersion().getVersion(); ResetRequestImpl ind = new ResetRequestImpl(version); byte[] buf = parameter.getData(); AsnInputStream ais = new AsnInputStream(buf); ind.decodeData(ais, buf.length); ind.setInvokeId(invokeId); ind.setMAPDialog(mapDialogImpl); for (MAPServiceListener serLis : this.serviceListeners) { try { serLis.onMAPMessage(ind); ((MAPServiceMobilityListener) serLis).onResetRequest(ind); } catch (Exception e) { loger.error("Error processing resetRequest: " + e.getMessage(), e); } } }
private void processInsertSubscriberDataResponse(Parameter parameter, MAPDialogMobilityImpl mapDialogImpl, Long invokeId, boolean returnResultNotLast) throws MAPParsingComponentException { long version = mapDialogImpl.getApplicationContext().getApplicationContextVersion().getVersion(); InsertSubscriberDataResponseImpl ind = new InsertSubscriberDataResponseImpl(version); if (parameter != null) { if (parameter.getTag() != Tag.SEQUENCE || parameter.getTagClass() != Tag.CLASS_UNIVERSAL || parameter.isPrimitive()) throw new MAPParsingComponentException( "Error while decoding InsertSubscriberDataResponse: Bad tag or tagClass or parameter is primitive, received tag=" + parameter.getTag(), MAPParsingComponentExceptionReason.MistypedParameter); byte[] buf = parameter.getData(); AsnInputStream ais = new AsnInputStream(buf); ind.decodeData(ais, buf.length); } ind.setInvokeId(invokeId); ind.setMAPDialog(mapDialogImpl); ind.setReturnResultNotLast(returnResultNotLast); for (MAPServiceListener serLis : this.serviceListeners) { try { serLis.onMAPMessage(ind); ((MAPServiceMobilityListener) serLis).onInsertSubscriberDataResponse(ind); } catch (Exception e) { loger.error("Error processing processInsertSubscriberDataResponse: " + e.getMessage(), e); } } }
private void processInsertSubscriberDataRequest(Parameter parameter, MAPDialogMobilityImpl mapDialogImpl, Long invokeId) throws MAPParsingComponentException { if (parameter == null) throw new MAPParsingComponentException( "Error while decoding InsertSubscriberDataRequest: Parameter is mandatory but not found", MAPParsingComponentExceptionReason.MistypedParameter); long version = mapDialogImpl.getApplicationContext().getApplicationContextVersion().getVersion(); if (parameter.getTag() != Tag.SEQUENCE || parameter.getTagClass() != Tag.CLASS_UNIVERSAL || parameter.isPrimitive()) throw new MAPParsingComponentException( "Error while decoding InsertSubscriberDataRequest: Bad tag or tagClass or parameter is primitive, received tag=" + parameter.getTag(), MAPParsingComponentExceptionReason.MistypedParameter); byte[] buf = parameter.getData(); AsnInputStream ais = new AsnInputStream(buf); InsertSubscriberDataRequestImpl ind = new InsertSubscriberDataRequestImpl(version); ind.decodeData(ais, buf.length); ind.setInvokeId(invokeId); ind.setMAPDialog(mapDialogImpl); for (MAPServiceListener serLis : this.serviceListeners) { try { serLis.onMAPMessage(ind); ((MAPServiceMobilityListener) serLis).onInsertSubscriberDataRequest(ind); } catch (Exception e) { loger.error("Error processing processInsertSubscriberDataRequest: " + e.getMessage(), e); } } }
private void reportSMDeliveryStatusRequest(Parameter parameter, MAPDialogSmsImpl mapDialogImpl, Long invokeId) throws MAPParsingComponentException { if (parameter == null) throw new MAPParsingComponentException( "Error while decoding sendRoutingInfoForSMRequest: Parameter is mandatory but not found", MAPParsingComponentExceptionReason.MistypedParameter); if (parameter.getTag() != Tag.SEQUENCE || parameter.getTagClass() != Tag.CLASS_UNIVERSAL || parameter.isPrimitive()) throw new MAPParsingComponentException( "Error while decoding sendRoutingInfoForSMRequest: Bad tag or tagClass or parameter is primitive, received tag=" + parameter.getTag(), MAPParsingComponentExceptionReason.MistypedParameter); byte[] buf = parameter.getData(); AsnInputStream ais = new AsnInputStream(buf); ReportSMDeliveryStatusRequestImpl ind = new ReportSMDeliveryStatusRequestImpl(mapDialogImpl.getApplicationContext() .getApplicationContextVersion().getVersion()); ind.decodeData(ais, buf.length); ind.setInvokeId(invokeId); ind.setMAPDialog(mapDialogImpl); for (MAPServiceListener serLis : this.serviceListeners) { try { serLis.onMAPMessage(ind); ((MAPServiceSmsListener) serLis).onReportSMDeliveryStatusRequest(ind); } catch (Exception e) { loger.error("Error processing onReportSMDeliveryStatusIndication: " + e.getMessage(), e); } } }
private void cancelLocationResponse(Parameter parameter, MAPDialogMobilityImpl mapDialogImpl, Long invokeId, boolean returnResultNotLast) throws MAPParsingComponentException { long version = mapDialogImpl.getApplicationContext().getApplicationContextVersion().getVersion(); CancelLocationResponseImpl ind = new CancelLocationResponseImpl(); if (parameter != null) { if (parameter.getTag() != Tag.SEQUENCE || parameter.getTagClass() != Tag.CLASS_UNIVERSAL || parameter.isPrimitive()) throw new MAPParsingComponentException( "Error while decoding cancelLocationResponse V2_3: Bad tag or tagClass or parameter is primitive, received tag=" + parameter.getTag(), MAPParsingComponentExceptionReason.MistypedParameter); byte[] buf = parameter.getData(); AsnInputStream ais = new AsnInputStream(buf); ind.decodeData(ais, buf.length); } ind.setInvokeId(invokeId); ind.setMAPDialog(mapDialogImpl); ind.setReturnResultNotLast(returnResultNotLast); for (MAPServiceListener serLis : this.serviceListeners) { try { serLis.onMAPMessage(ind); ((MAPServiceMobilityListener) serLis).onCancelLocationResponse(ind); } catch (Exception e) { loger.error("Error processing cancelLocationResponse: " + e.getMessage(), e); } } }
private void sendRoutingInformationRequest(Parameter parameter, MAPDialogCallHandlingImpl mapDialogImpl, Long invokeId) throws MAPParsingComponentException { long version = mapDialogImpl.getApplicationContext().getApplicationContextVersion().getVersion(); SendRoutingInformationRequestImpl ind = new SendRoutingInformationRequestImpl(version); if (parameter == null) throw new MAPParsingComponentException( "Error while decoding SendRoutingInformationRequestIndication: Parameter is mandatory but not found", MAPParsingComponentExceptionReason.MistypedParameter); // No matter what MAP version V1,V2,V3: tag=Tag.SEQUENCE and tagClass=Tag.CLASS_UNIVERSAL if (parameter.getTag() != Tag.SEQUENCE || parameter.getTagClass() != Tag.CLASS_UNIVERSAL || parameter.isPrimitive()) throw new MAPParsingComponentException( "Error while decoding SendRoutingInformationRequestIndication: Bad tag or tagClass or parameter is primitive, received tag=" + parameter.getTag(), MAPParsingComponentExceptionReason.MistypedParameter); byte[] buf = parameter.getData(); AsnInputStream ais = new AsnInputStream(buf); ind.decodeData(ais, buf.length); ind.setInvokeId(invokeId); ind.setMAPDialog(mapDialogImpl); for (MAPServiceListener serLis : this.serviceListeners) { try { serLis.onMAPMessage(ind); ((MAPServiceCallHandlingListener) serLis).onSendRoutingInformationRequest(ind); } catch (Exception e) { loger.error("Error processing SendRoutingInformationRequestIndication: " + e.getMessage(), e); } } }
private void updateLocationRequest(Parameter parameter, MAPDialogMobilityImpl mapDialogImpl, Long invokeId) throws MAPParsingComponentException { long version = mapDialogImpl.getApplicationContext().getApplicationContextVersion().getVersion(); if (parameter == null) throw new MAPParsingComponentException( "Error while decoding updateLocationRequest: Parameter is mandatory but not found", MAPParsingComponentExceptionReason.MistypedParameter); if (parameter.getTag() != Tag.SEQUENCE || parameter.getTagClass() != Tag.CLASS_UNIVERSAL || parameter.isPrimitive()) throw new MAPParsingComponentException( "Error while decoding updateLocationRequest: Bad tag or tagClass or parameter is primitive, received tag=" + parameter.getTag(), MAPParsingComponentExceptionReason.MistypedParameter); byte[] buf = parameter.getData(); AsnInputStream ais = new AsnInputStream(buf); UpdateLocationRequestImpl ind = new UpdateLocationRequestImpl(version); ind.decodeData(ais, buf.length); ind.setInvokeId(invokeId); ind.setMAPDialog(mapDialogImpl); for (MAPServiceListener serLis : this.serviceListeners) { try { serLis.onMAPMessage(ind); ((MAPServiceMobilityListener) serLis).onUpdateLocationRequest(ind); } catch (Exception e) { loger.error("Error processing updateLocationRequest: " + e.getMessage(), e); } } }
@Override public ServingCheckData isServingService(MAPApplicationContext dialogApplicationContext) { MAPApplicationContextName ctx = dialogApplicationContext.getApplicationContextName(); int vers = dialogApplicationContext.getApplicationContextVersion().getVersion(); switch (ctx) { case locationInfoRetrievalContext: if (vers >= 1 && vers <= 3) { return new ServingCheckDataImpl(ServingCheckResult.AC_Serving); } else { return new ServingCheckDataImpl(ServingCheckResult.AC_VersionIncorrect); } case roamingNumberEnquiryContext: if (vers >= 1 && vers <= 3) { return new ServingCheckDataImpl(ServingCheckResult.AC_Serving); } else { return new ServingCheckDataImpl(ServingCheckResult.AC_VersionIncorrect); } case ServiceTerminationContext: if (vers == 3) { return new ServingCheckDataImpl(ServingCheckResult.AC_Serving); } else { return new ServingCheckDataImpl(ServingCheckResult.AC_VersionIncorrect); } } return new ServingCheckDataImpl(ServingCheckResult.AC_NotServing); }
private void updateGprsLocationResponse(Parameter parameter, MAPDialogMobilityImpl mapDialogImpl, Long invokeId, boolean returnResultNotLast) throws MAPParsingComponentException { long version = mapDialogImpl.getApplicationContext().getApplicationContextVersion().getVersion(); UpdateGprsLocationResponseImpl ind = new UpdateGprsLocationResponseImpl(); if (parameter == null) throw new MAPParsingComponentException( "Error while decoding updateGprsLocationResponse: Parameter is mandatory but not found", MAPParsingComponentExceptionReason.MistypedParameter); if (parameter.getTag() != Tag.SEQUENCE || parameter.getTagClass() != Tag.CLASS_UNIVERSAL || parameter.isPrimitive()) throw new MAPParsingComponentException( "Error while decoding updateGprsLocationResponse V3: Bad tag or tagClass or parameter is primitive, received tag=" + parameter.getTag(), MAPParsingComponentExceptionReason.MistypedParameter); byte[] buf = parameter.getData(); AsnInputStream ais = new AsnInputStream(buf); ind.decodeData(ais, buf.length); ind.setInvokeId(invokeId); ind.setMAPDialog(mapDialogImpl); ind.setReturnResultNotLast(returnResultNotLast); for (MAPServiceListener serLis : this.serviceListeners) { try { serLis.onMAPMessage(ind); ((MAPServiceMobilityListener) serLis).onUpdateGprsLocationResponse(ind); } catch (Exception e) { loger.error("Error processing UpdateGprsLocationResponse: " + e.getMessage(), e); } } }
/** * Received response for SRI sent earlier * * @param evt * @param aci */ public void onSendRoutingInfoForSMResponse(SendRoutingInfoForSMResponse evt, ActivityContextInterface aci) { if (this.logger.isFineEnabled()) { this.logger.fine("\nHome routing: HrSriClientSbb: Received SEND_ROUTING_INFO_FOR_SM_RESPONSE = " + evt + " Dialog=" + evt.getMAPDialog()); } if (evt.getMAPDialog().getApplicationContext().getApplicationContextVersion() == MAPApplicationContextVersion.version1 && evt.getMwdSet() != null && evt.getMwdSet()) { MWStatus mwStatus = evt.getMAPDialog().getService().getMAPProvider().getMAPParameterFactory() .createMWStatus(false, true, false, false); CorrelationIdValue correlationIdValue = this.getCorrelationIdValue(); if (correlationIdValue != null) { correlationIdValue.setMwStatus(mwStatus); correlationIdValue.setSriMapVersion(evt.getMAPDialog().getApplicationContext().getApplicationContextVersion().getVersion()); this.setCorrelationIdValue(correlationIdValue); } } this.setSendRoutingInfoForSMResponse(evt); }
@Override public void addReadyForSMResponse(long invokeId, MAPExtensionContainer extensionContainer) throws MAPException { if ((this.appCntx.getApplicationContextName() != MAPApplicationContextName.mwdMngtContext) || (this.appCntx.getApplicationContextVersion() != MAPApplicationContextVersion.version2 && this.appCntx.getApplicationContextVersion() != MAPApplicationContextVersion.version3)) throw new MAPException("Bad application context name for addReadyForSMRequest: must be mwdMngtContext_V2 or V3"); ReturnResultLast resultLast = this.mapProviderImpl.getTCAPProvider().getComponentPrimitiveFactory() .createTCResultLastRequest(); resultLast.setInvokeId(invokeId); // Operation Code OperationCode oc = this.mapProviderImpl.getTCAPProvider().getComponentPrimitiveFactory().createOperationCode(); oc.setLocalOperationCode((long) MAPOperationCode.readyForSM); resultLast.setOperationCode(oc); if (this.appCntx.getApplicationContextVersion().getVersion() >= 3 || extensionContainer != null) { ReadyForSMResponseImpl req = new ReadyForSMResponseImpl(extensionContainer); AsnOutputStream aos = new AsnOutputStream(); req.encodeData(aos); Parameter p = this.mapProviderImpl.getTCAPProvider().getComponentPrimitiveFactory().createParameter(); p.setTagClass(req.getTagClass()); p.setPrimitive(req.getIsPrimitive()); p.setTag(req.getTag()); p.setData(aos.toByteArray()); resultLast.setParameter(p); } this.sendReturnResultLastComponent(resultLast); }
@Override public void addPurgeMSResponse(long invokeId, boolean freezeTMSI, boolean freezePTMSI, MAPExtensionContainer extensionContainer, boolean freezeMTMSI) throws MAPException { if ((this.appCntx.getApplicationContextName() != MAPApplicationContextName.msPurgingContext) || ((this.appCntx.getApplicationContextVersion() != MAPApplicationContextVersion.version3) && (this.appCntx.getApplicationContextVersion() != MAPApplicationContextVersion.version2))) throw new MAPException("Bad application context name for PurgeMSResponse: must be msPurgingContext_V3 OR msPurgingContext_V2"); ReturnResultLast resultLast = this.mapProviderImpl.getTCAPProvider().getComponentPrimitiveFactory() .createTCResultLastRequest(); resultLast.setInvokeId(invokeId); // Operation Code OperationCode oc = this.mapProviderImpl.getTCAPProvider().getComponentPrimitiveFactory().createOperationCode(); oc.setLocalOperationCode((long) MAPOperationCode.purgeMS); resultLast.setOperationCode(oc); PurgeMSResponseImpl resp = new PurgeMSResponseImpl(freezeTMSI, freezePTMSI, extensionContainer, freezeMTMSI); if (this.appCntx.getApplicationContextVersion().getVersion() >= 3 && (freezeTMSI || freezePTMSI || extensionContainer != null || freezeMTMSI)) { AsnOutputStream aos = new AsnOutputStream(); resp.encodeData(aos); Parameter p = this.mapProviderImpl.getTCAPProvider().getComponentPrimitiveFactory().createParameter(); p.setTagClass(resp.getTagClass()); p.setPrimitive(resp.getIsPrimitive()); p.setTag(resp.getTag()); p.setData(aos.toByteArray()); resultLast.setParameter(p); } this.sendReturnResultLastComponent(resultLast); }