diff --git a/examples/cap-relay/du/pom.xml b/examples/cap-relay/du/pom.xml
new file mode 100644
index 000000000..28f8f1cfe
--- /dev/null
+++ b/examples/cap-relay/du/pom.xml
@@ -0,0 +1,67 @@
+
+ 4.0.0
+
+
+ restcomm-slee-example-cap-relay
+ org.mobicents.examples
+ 7.0.53
+
+
+ restcomm-slee-example-cap-relay-DU
+
+
+
+ restcomm-slee-example-cap-relay-sbb
+ org.mobicents.examples
+ ${pom.version}
+
+
+
+
+
+
+ org.mobicents.tools
+ maven-du-plugin
+
+
+
+ copy-dependencies
+ generate-descriptor
+ generate-ant-management-script
+
+
+
+
+
+ maven-antrun-plugin
+
+
+ deploy-DU
+ install
+
+ run
+
+
+
+
+
+
+
+
+ undeploy-DU
+ clean
+
+ run
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/cap-relay/du/src/main/resources/services/service.xml b/examples/cap-relay/du/src/main/resources/services/service.xml
new file mode 100644
index 000000000..0dd4f8690
--- /dev/null
+++ b/examples/cap-relay/du/src/main/resources/services/service.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+ CAP RELAY
+ org.mobicents
+ 1.0
+
+ CAP RELAY
+ org.mobicents
+ 1.0
+
+ 0
+
+
diff --git a/examples/cap-relay/pom.xml b/examples/cap-relay/pom.xml
new file mode 100644
index 000000000..a012fb3ba
--- /dev/null
+++ b/examples/cap-relay/pom.xml
@@ -0,0 +1,56 @@
+
+
+ 4.0.0
+ pom
+
+
+ org.mobicents.servers.jainslee.ss7
+ restcomm-slee-ss7
+ 7.0.53
+ ../..
+
+
+ restcomm-slee-example-cap-relay
+ org.mobicents.examples
+
+
+ sbb
+ du
+
+
+
+
+
+ maven-eclipse-plugin
+ org.mobicents.tools
+ false
+
+
+
+
+ xml-apis:xml-apis
+ jtidy:jtidy
+
+ true
+ slee-example-cap-relay
+
+
+
+
+
+
+
+ release
+
+ release
+
+
+
+ maven-release
+
+ release
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/cap-relay/release/build.xml b/examples/cap-relay/release/build.xml
new file mode 100644
index 000000000..b3f8097da
--- /dev/null
+++ b/examples/cap-relay/release/build.xml
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/cap-relay/release/pom.xml b/examples/cap-relay/release/pom.xml
new file mode 100644
index 000000000..196110ae0
--- /dev/null
+++ b/examples/cap-relay/release/pom.xml
@@ -0,0 +1,55 @@
+
+ 4.0.0
+
+ pom
+
+
+ restcomm-slee-example-cap-uas
+ org.mobicents.examples
+ 7.0.53
+
+
+ restcomm-slee-example-cap-uas-release
+
+
+
+ release
+
+
+
+ maven-antrun-plugin
+ false
+
+
+ install
+
+ run
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/cap-relay/sbb/pom.xml b/examples/cap-relay/sbb/pom.xml
new file mode 100644
index 000000000..108efa2fe
--- /dev/null
+++ b/examples/cap-relay/sbb/pom.xml
@@ -0,0 +1,32 @@
+
+
+ 4.0.0
+
+
+ restcomm-slee-example-cap-relay
+ org.mobicents.examples
+ 7.0.53
+
+
+ restcomm-slee-example-cap-relay-sbb
+
+
+
+ org.mobicents.resources
+ restcomm-slee-ra-cap-ratype
+ ${project.version}
+
+
+ org.mobicents.resources
+ restcomm-slee-ra-cap-ra
+ ${project.version}
+
+
+ org.mobicents.servers.jainslee.api
+ jain-slee-11-ext
+
+ ${restcomm.jain.slee.version}
+
+
+
+
\ No newline at end of file
diff --git a/examples/cap-relay/sbb/src/main/java/org/mobicents/slee/example/cap/CallLog.java b/examples/cap-relay/sbb/src/main/java/org/mobicents/slee/example/cap/CallLog.java
new file mode 100644
index 000000000..93d0f65a4
--- /dev/null
+++ b/examples/cap-relay/sbb/src/main/java/org/mobicents/slee/example/cap/CallLog.java
@@ -0,0 +1,74 @@
+/*
+ * TeleStax, Open Source Cloud Communications Copyright 2012.
+ * and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.mobicents.slee.example.cap;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.MDC;
+import org.mobicents.protocols.ss7.cap.api.CAPDialog;
+import org.mobicents.protocols.ss7.cap.api.CAPMessage;
+import org.mobicents.protocols.ss7.cap.api.service.circuitSwitchedCall.CAPDialogCircuitSwitchedCall;
+import org.mobicents.protocols.ss7.cap.api.service.circuitSwitchedCall.InitialDPRequest;
+import org.mobicents.protocols.ss7.sccp.parameter.SccpAddress;
+
+/**
+ * @author ProIDS sp. z o.o.
+ */
+public class CallLog {
+
+ private static Logger callLogger = Logger.getLogger("CALL_LOG");
+
+
+ public static void logCallStart() {
+ callLogger.info("--- CALL START --- ");
+ }
+
+ public static void logCallEnd() {
+ callLogger.info("--- CALL END --- ");
+ }
+
+ public static void logOutgoing(String message) {
+ callLogger.info("<-- " + message);
+ }
+
+ public static void logIncomming(String message) {
+ callLogger.info("--> " + message);
+ }
+
+ public static void logIDP(CAPDialogCircuitSwitchedCall capDialog, int serviceKey) {
+ callLogger.info(" cap.serviceKey=" + serviceKey);
+ callLogger.info(" sccp.localAddress=" + capDialog.getLocalAddress());
+ callLogger.info(" sccp.remoteAddress=" + capDialog.getRemoteAddress());
+ }
+
+ public static void logInternal(String message) {
+ callLogger.info(" o " + message);
+ }
+
+ public static void setMDC(CAPDialog capDialog) {
+ MDC.put("CallID", capDialog.getLocalDialogId());
+ }
+
+ public static void clearMDC() {
+ MDC.remove("CallID");
+ }
+}
diff --git a/examples/cap-relay/sbb/src/main/java/org/mobicents/slee/example/cap/CapRelayExampleSbb.java b/examples/cap-relay/sbb/src/main/java/org/mobicents/slee/example/cap/CapRelayExampleSbb.java
new file mode 100644
index 000000000..3206deb86
--- /dev/null
+++ b/examples/cap-relay/sbb/src/main/java/org/mobicents/slee/example/cap/CapRelayExampleSbb.java
@@ -0,0 +1,182 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.mobicents.slee.example.cap;
+
+import javax.slee.ActivityContextInterface;
+import javax.slee.RolledBackContext;
+import javax.slee.SbbContext;
+import javax.slee.facilities.TimerFacility;
+import javax.slee.facilities.TimerOptions;
+import javax.slee.facilities.TimerPreserveMissed;
+import javax.slee.facilities.Tracer;
+import javax.slee.resource.ResourceAdaptorTypeID;
+import javax.slee.serviceactivity.ServiceStartedEvent;
+
+import org.apache.log4j.Logger;
+import org.mobicents.protocols.ss7.cap.api.CAPParameterFactory;
+import org.mobicents.protocols.ss7.cap.api.CAPProvider;
+import org.mobicents.protocols.ss7.cap.api.errors.CAPErrorMessageFactory;
+import org.mobicents.protocols.ss7.cap.api.service.circuitSwitchedCall.*;
+import org.mobicents.slee.SbbContextExt;
+import org.mobicents.slee.resource.cap.CAPContextInterfaceFactory;
+import org.mobicents.slee.resource.cap.events.DialogRelease;
+
+/**
+ * @author ProIDS sp. z o.o.
+ */
+public abstract class CapRelayExampleSbb implements javax.slee.Sbb {
+
+ private static final ResourceAdaptorTypeID capRATypeID = new ResourceAdaptorTypeID("CAPResourceAdaptorType", "org.mobicents", "2.0");
+ private static final String capRALink = "CAPRA";
+ private CAPContextInterfaceFactory capActivityContextInterfaceFactory;
+ private CAPProvider capProvider;
+ private CAPParameterFactory capParameterFactory;
+ private CAPErrorMessageFactory capErrorMessageFactory;
+ private TimerFacility timerFacility;
+
+ private static TimerOptions timerOptions;
+ private static Tracer tracer;
+
+ private SbbContextExt sbbContext; // This SBB's SbbContext
+
+ private Logger logger = Logger.getLogger(CapRelayExampleSbb.class);
+
+ private final static int SERVICE_KEY_NOT_SERVED = 1;
+ private final static int SERVICE_KEY_RELAY = 5;
+
+ // SbbObject lifecycle methods
+
+ public void setSbbContext(SbbContext context) {
+ sbbContext = (SbbContextExt) context;
+ capActivityContextInterfaceFactory = (CAPContextInterfaceFactory) sbbContext.getActivityContextInterfaceFactory(capRATypeID);
+ capProvider = (CAPProvider) sbbContext.getResourceAdaptorInterface(capRATypeID, capRALink);
+ capParameterFactory = capProvider.getCAPParameterFactory();
+ capErrorMessageFactory = capProvider.getCAPErrorMessageFactory();
+ timerFacility = sbbContext.getTimerFacility();
+ }
+
+ public void unsetSbbContext() {
+ this.sbbContext = null;
+ }
+
+ public void sbbCreate() throws javax.slee.CreateException {
+ }
+
+ public void sbbPostCreate() throws javax.slee.CreateException {
+ }
+
+ public void sbbActivate() {
+ }
+
+ public void sbbPassivate() {
+ }
+
+ public void sbbRemove() {
+ }
+
+ public void sbbLoad() {
+ }
+
+ public void sbbStore() {
+ }
+
+ public void sbbExceptionThrown(Exception exception, Object event,
+ ActivityContextInterface activity) {
+ }
+
+ public void sbbRolledBack(RolledBackContext context) {
+ }
+
+ // some helper methods to deal with lazy init of static fields
+
+ private TimerOptions getTimerOptions() {
+ if (timerOptions == null) {
+ timerOptions = new TimerOptions();
+ timerOptions.setPreserveMissed(TimerPreserveMissed.ALL);
+ }
+ return timerOptions;
+ }
+
+ // event handlers, the service's logic
+
+ /**
+ * Event handler method for the event signaling the service activation.
+ *
+ * @param event
+ * @param aci
+ */
+ public void onServiceStartedEvent(ServiceStartedEvent event,
+ ActivityContextInterface aci) {
+ logger.info("Service activated, now run traffic generator.");
+ }
+
+ /**
+ * Event handler method for the InitialDP CAP message.
+ *
+ * @param event
+ * @param aci
+ */
+ public void onInitialDP(InitialDPRequest event, ActivityContextInterface aci) {
+ logger.info("IDP received (serviceKey="+event.getServiceKey()+")");
+ logger.trace(event);
+ CallLog.setMDC(event.getCAPDialog());
+ CallLog.logCallStart();
+ CallLog.logIncomming("IDP");
+ CallLog.logIDP(event.getCAPDialog(), event.getServiceKey());
+
+ try {
+ if (event.getServiceKey()== SERVICE_KEY_NOT_SERVED) {
+ logger.warn("IDP will be relayed to serviceKey=" + SERVICE_KEY_RELAY);
+ capProvider.relayCapMessage(SERVICE_KEY_RELAY, event);
+ CallLog.logOutgoing("IDP");
+ }
+ else if (event.getServiceKey()== SERVICE_KEY_RELAY) {
+ logger.warn("IDP dropped (for secure of loop in sccp routing)");
+ event.getCAPDialog().release();
+ }
+ else {
+ logger.warn("IDP dropped (unsupported serviceKey received)");
+ event.getCAPDialog().release();
+ }
+
+ } catch (Exception ex) {
+ logger.error("failure while processing InitialDP", ex);
+ }
+ finally {
+ CallLog.clearMDC();
+ }
+ }
+
+ public void onDialogRelease(DialogRelease event, ActivityContextInterface aci) {
+ try {
+ CallLog.setMDC(event.getCAPDialog());
+ logger.info("DialogRelease received");
+ logger.trace(event);
+ CallLog.logCallEnd();
+ } catch (Exception e) {
+ logger.trace("ignored failure on onDialogRelease: "+ e.getMessage());
+ } finally {
+ CallLog.clearMDC();
+ }
+ }
+}
diff --git a/examples/cap-relay/sbb/src/main/resources/META-INF/sbb-jar.xml b/examples/cap-relay/sbb/src/main/resources/META-INF/sbb-jar.xml
new file mode 100644
index 000000000..4b6d89eea
--- /dev/null
+++ b/examples/cap-relay/sbb/src/main/resources/META-INF/sbb-jar.xml
@@ -0,0 +1,63 @@
+
+
+
+
+ CAP RELAY
+ org.mobicents
+ 1.0
+
+
+
+ org.mobicents.slee.example.cap.CapRelayExampleSbb
+
+
+
+
+ ServiceStartedEvent
+
+
+ javax.slee.serviceactivity.ServiceStartedEvent
+
+ javax.slee
+ 1.1
+
+
+
+
+
+ InitialDP
+
+ ss7.cap.service.circuitSwitchedCall.INITIAL_DP_REQUEST
+ org.mobicents
+ 1.0
+
+
+
+
+
+
+
+ CAPResourceAdaptorType
+
+
+ org.mobicents
+
+
+ 2.0
+
+
+
+ slee/resources/cap/2.0/acifactory
+
+
+
+ slee/resources/cap/2.0/provider
+
+
+ CAPRA
+
+
+
+
+
diff --git a/examples/cap-relay/simulator/README.TXT b/examples/cap-relay/simulator/README.TXT
new file mode 100644
index 000000000..385d6aad3
--- /dev/null
+++ b/examples/cap-relay/simulator/README.TXT
@@ -0,0 +1,14 @@
+How to run test service:
+
+1. Deploy service and dependencies in Slee:
+a) CAP RA
+b) cap-relay application
+c) jss7 stack
+
+2. Restcomm jSS7 stack (SCCP rules) must be configured to preserve GT in message routed to local application
+
+3. Generate traffic . You can use any simulator, with can provide following CAP scenario
+send IDP
+receive IDP
+
+
diff --git a/pom.xml b/pom.xml
index 8027f0b51..e2ce7fc19 100755
--- a/pom.xml
+++ b/pom.xml
@@ -17,7 +17,11 @@
scm:git:https://github.com/Restcomm/jain-slee.ss7/
scm:git:https://github.com/Restcomm/jain-slee.ss7/
https://github.com/Restcomm/jain-slee.ss7/
-
+
+
+
+ 2.8.82
+
@@ -52,6 +56,7 @@
resources/cap
resources/tcap
resources/isup
+ examples/cap-relay
diff --git a/resources/cap/library/pom.xml b/resources/cap/library/pom.xml
index b3dc79946..b30b0b5b7 100644
--- a/resources/cap/library/pom.xml
+++ b/resources/cap/library/pom.xml
@@ -38,6 +38,16 @@
${ss7.version}
+
+ sccp-api
+ org.mobicents.protocols.ss7.sccp
+ ${ss7.version}
+
+
+ sccp-impl
+ org.mobicents.protocols.ss7.sccp
+ ${ss7.version}
+
tcap-api
diff --git a/resources/cap/ra/src/main/java/org/mobicents/slee/resource/cap/CAPResourceAdaptor.java b/resources/cap/ra/src/main/java/org/mobicents/slee/resource/cap/CAPResourceAdaptor.java
index e8d2faf91..39cf64867 100755
--- a/resources/cap/ra/src/main/java/org/mobicents/slee/resource/cap/CAPResourceAdaptor.java
+++ b/resources/cap/ra/src/main/java/org/mobicents/slee/resource/cap/CAPResourceAdaptor.java
@@ -48,7 +48,9 @@
import org.mobicents.protocols.ss7.cap.api.CAPDialog;
import org.mobicents.protocols.ss7.cap.api.CAPDialogListener;
+import org.mobicents.protocols.ss7.cap.api.CAPException;
import org.mobicents.protocols.ss7.cap.api.CAPMessage;
+import org.mobicents.protocols.ss7.cap.api.CAPOperationCode;
import org.mobicents.protocols.ss7.cap.api.CAPProvider;
import org.mobicents.protocols.ss7.cap.api.dialog.CAPDialogState;
import org.mobicents.protocols.ss7.cap.api.dialog.CAPGeneralAbortReason;
@@ -62,6 +64,7 @@
import org.mobicents.protocols.ss7.cap.api.service.circuitSwitchedCall.ApplyChargingRequest;
import org.mobicents.protocols.ss7.cap.api.service.circuitSwitchedCall.AssistRequestInstructionsRequest;
import org.mobicents.protocols.ss7.cap.api.service.circuitSwitchedCall.CAPDialogCircuitSwitchedCall;
+import org.mobicents.protocols.ss7.cap.api.service.circuitSwitchedCall.CAPServiceCircuitSwitchedCall;
import org.mobicents.protocols.ss7.cap.api.service.circuitSwitchedCall.CAPServiceCircuitSwitchedCallListener;
import org.mobicents.protocols.ss7.cap.api.service.circuitSwitchedCall.CallInformationReportRequest;
import org.mobicents.protocols.ss7.cap.api.service.circuitSwitchedCall.CallInformationRequestRequest;
@@ -123,6 +126,7 @@
import org.mobicents.protocols.ss7.cap.api.service.sms.ReleaseSMSRequest;
import org.mobicents.protocols.ss7.cap.api.service.sms.RequestReportSMSEventRequest;
import org.mobicents.protocols.ss7.cap.api.service.sms.ResetTimerSMSRequest;
+import org.mobicents.protocols.ss7.sccp.parameter.SccpAddress;
import org.mobicents.protocols.ss7.tcap.asn.comp.PAbortCauseType;
import org.mobicents.protocols.ss7.tcap.asn.comp.Problem;
import org.mobicents.slee.resource.cap.events.CAPEvent;
@@ -193,6 +197,7 @@
import org.mobicents.slee.resource.cap.service.gprs.wrappers.RequestReportGPRSEventRequestWrapper;
import org.mobicents.slee.resource.cap.service.gprs.wrappers.ResetTimerGPRSRequestWrapper;
import org.mobicents.slee.resource.cap.service.gprs.wrappers.SendChargingInformationGPRSRequestWrapper;
+import org.mobicents.slee.resource.cap.service.relay.RelayedCapMessage;
import org.mobicents.slee.resource.cap.service.sms.wrappers.CAPDialogSmsWrapper;
import org.mobicents.slee.resource.cap.service.sms.wrappers.ConnectSMSRequestWrapper;
import org.mobicents.slee.resource.cap.service.sms.wrappers.ContinueSMSRequestWrapper;
@@ -210,6 +215,7 @@
* @author amit bhayani
* @author baranowb
* @author sergey vetyutnev
+ * @author ProIDS sp. z o.o.
*
*/
public class CAPResourceAdaptor implements ResourceAdaptor, CAPDialogListener, CAPServiceCircuitSwitchedCallListener,
@@ -1205,4 +1211,66 @@ public void onContinueSMSRequest(ContinueSMSRequest ind) {
onEvent(event.getEventTypeName(), capDialogSmsWrapper, event);
}
+ public void relayCapMessage(int newServiceKey, SccpAddress origAddress, SccpAddress destAddress, CAPMessage capMessage) throws CAPException {
+ if (capMessage.getOperationCode() != CAPOperationCode.initialDP) {
+ String errMsg = "relayCapMessage can be used only on initialDP!";
+ tracer.severe(errMsg);
+ throw new CAPException(errMsg);
+ }
+ // terminate incoming CAP Dialog
+ capMessage.getCAPDialog().release();
+
+ // relay message
+ RelayedCapMessage relayedCapMessage = new RelayedCapMessage(newServiceKey, origAddress, destAddress, capMessage);
+ sendRelayedMessage(relayedCapMessage);
+ if (tracer.isFineEnabled()) {
+ tracer.fine("CAP Message relayed [tcap.localDialogId:" + capMessage.getCAPDialog().getLocalDialogId() + "] => " + relayedCapMessage);
+ }
+
+ }
+
+ private void sendRelayedMessage(RelayedCapMessage relayedCapMessage) throws CAPException{
+ CAPServiceCircuitSwitchedCall outCall = capProvider.getCAPServiceCircuitSwitchedCall();
+ CAPDialogCircuitSwitchedCall outDialog = outCall.createNewRelayedDialog(relayedCapMessage.getCapApplicationContext(),
+ relayedCapMessage.getRemoteAddress(),
+ relayedCapMessage.getLocalAddress(),
+ relayedCapMessage.getRemoteDialogId());
+ CAPMessage capMessage = relayedCapMessage.getCapMessage();
+ if (capMessage.getOperationCode() == CAPOperationCode.initialDP) {
+ InitialDPRequest idp = (InitialDPRequest) capMessage;
+ outDialog.addInitialDPRequest(relayedCapMessage.getNewServiceKey(),
+ idp.getCalledPartyNumber(),
+ idp.getCallingPartyNumber(),
+ idp.getCallingPartysCategory(),
+ idp.getCGEncountered(),
+ idp.getIPSSPCapabilities(),
+ idp.getLocationNumber(),
+ idp.getOriginalCalledPartyID(),
+ idp.getExtensions(),
+ idp.getHighLayerCompatibility(),
+ idp.getAdditionalCallingPartyNumber(),
+ idp.getBearerCapability(),
+ idp.getEventTypeBCSM(),
+ idp.getRedirectingPartyID(),
+ idp.getRedirectionInformation(),
+ idp.getCause(),
+ idp.getServiceInteractionIndicatorsTwo(),
+ idp.getCarrier(),
+ idp.getCugIndex(),
+ idp.getCugInterlock(),
+ idp.getCugOutgoingAccess(),
+ idp.getIMSI(),
+ idp.getSubscriberState(),
+ idp.getLocationInformation(),
+ idp.getExtBasicServiceCode(),
+ idp.getCallReferenceNumber(),
+ idp.getMscAddress(),
+ idp.getCalledPartyBCDNumber(),
+ idp.getTimeAndTimezone(),
+ idp.getCallForwardingSSPending(),
+ idp.getInitialDPArgExtension());
+ }
+ outDialog.send();
+ outDialog.release();
+ }
}
diff --git a/resources/cap/ra/src/main/java/org/mobicents/slee/resource/cap/service/circuitSwitchedCall/wrappers/CAPServiceCircuitSwitchedCallWrapper.java b/resources/cap/ra/src/main/java/org/mobicents/slee/resource/cap/service/circuitSwitchedCall/wrappers/CAPServiceCircuitSwitchedCallWrapper.java
index 3e92532ee..27c2bff2b 100644
--- a/resources/cap/ra/src/main/java/org/mobicents/slee/resource/cap/service/circuitSwitchedCall/wrappers/CAPServiceCircuitSwitchedCallWrapper.java
+++ b/resources/cap/ra/src/main/java/org/mobicents/slee/resource/cap/service/circuitSwitchedCall/wrappers/CAPServiceCircuitSwitchedCallWrapper.java
@@ -37,6 +37,7 @@
/**
*
* @author sergey vetyutnev
+ * @author ProIDS sp. z o.o.
*
*/
public class CAPServiceCircuitSwitchedCallWrapper implements CAPServiceCircuitSwitchedCall {
@@ -95,6 +96,23 @@ public CAPDialogCircuitSwitchedCall createNewDialog(CAPApplicationContext appCnt
return this.createNewDialog(appCntx, origAddress, destAddress, null);
}
+ @Override
+ public CAPDialogCircuitSwitchedCall createNewRelayedDialog(CAPApplicationContext appCntx, SccpAddress origAddress, SccpAddress destAddress, Long relayedLocalTrId) throws CAPException {
+ CAPDialogCircuitSwitchedCall capDialog = this.wrappedCircuitSwitchedCall.createNewRelayedDialog(appCntx, origAddress, destAddress, relayedLocalTrId);
+ CAPDialogActivityHandle activityHandle = new CAPDialogActivityHandle(capDialog.getLocalDialogId());
+
+ CAPDialogCircuitSwitchedCallWrapper dw = new CAPDialogCircuitSwitchedCallWrapper(capDialog, activityHandle, this.capProviderWrapper.getRa());
+ capDialog.setUserObject(dw);
+
+ try {
+ this.capProviderWrapper.getRa().startSuspendedActivity(dw);
+ } catch (Exception e) {
+ throw new CAPException(e);
+ }
+
+ return dw;
+ }
+
public void addCAPServiceListener(CAPServiceCircuitSwitchedCallListener capServiceListener) {
throw new UnsupportedOperationException();
}
diff --git a/resources/cap/ra/src/main/java/org/mobicents/slee/resource/cap/service/relay/RelayedCapMessage.java b/resources/cap/ra/src/main/java/org/mobicents/slee/resource/cap/service/relay/RelayedCapMessage.java
new file mode 100644
index 000000000..3aa4af3ba
--- /dev/null
+++ b/resources/cap/ra/src/main/java/org/mobicents/slee/resource/cap/service/relay/RelayedCapMessage.java
@@ -0,0 +1,106 @@
+/*
+ * TeleStax, Open Source Cloud Communications Copyright 2012.
+ * and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.mobicents.slee.resource.cap.service.relay;
+
+import org.mobicents.protocols.ss7.cap.api.CAPApplicationContext;
+import org.mobicents.protocols.ss7.cap.api.CAPException;
+import org.mobicents.protocols.ss7.cap.api.CAPMessage;
+import org.mobicents.protocols.ss7.indicator.RoutingIndicator;
+import org.mobicents.protocols.ss7.sccp.impl.parameter.SccpAddressImpl;
+import org.mobicents.protocols.ss7.sccp.parameter.SccpAddress;
+
+/**
+ * @author ProIDS sp. z o.o.
+ *
+ */
+public class RelayedCapMessage {
+
+ private int newServiceKey;
+ private CAPMessage capMessage;
+ private CAPApplicationContext capApplicationContext;
+ private SccpAddress remoteAddress;
+ private SccpAddress localAddress;
+ private long remoteDialogId;
+
+ public RelayedCapMessage(int newServiceKey, SccpAddress origAddress, SccpAddress destAddress, CAPMessage capMessage) throws CAPException {
+ this.newServiceKey = newServiceKey;
+ this.capMessage = capMessage;
+ this.capApplicationContext = capMessage.getCAPDialog().getApplicationContext();
+ if (destAddress!=null) {
+ this.remoteAddress = destAddress;
+ }
+ else {
+ this.remoteAddress = capMessage.getCAPDialog().getRemoteAddress();
+ }
+ if (origAddress!=null) {
+ this.localAddress = origAddress;
+ }
+ else {
+ this.localAddress = new SccpAddressImpl(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE,
+ capMessage.getCAPDialog().getLocalAddress().getGlobalTitle(),
+ 0,
+ capMessage.getCAPDialog().getLocalAddress().getSubsystemNumber()
+ );
+ }
+ this.remoteDialogId = capMessage.getCAPDialog().getRemoteDialogId();
+ this.sanityCheck();
+ }
+
+ public int getNewServiceKey() {
+ return newServiceKey;
+ }
+
+ public CAPMessage getCapMessage() {
+ return capMessage;
+ }
+
+ public SccpAddress getRemoteAddress() {
+ return remoteAddress;
+ }
+
+ public SccpAddress getLocalAddress() {
+ return localAddress;
+ }
+
+ public long getRemoteDialogId() {
+ return remoteDialogId;
+ }
+
+ public CAPApplicationContext getCapApplicationContext() {
+ return capApplicationContext;
+ }
+
+ @Override
+ public String toString() {
+ return "RelayedCapMessage{" +
+ "newServiceKey=" + newServiceKey +
+ ", sccp.remoteAddress.GT=" + remoteAddress.getGlobalTitle() +
+ ", sccp.localAddress.GT=" + localAddress.getGlobalTitle() +
+ ", tcap.remoteDialogId=" + remoteDialogId +
+ ", cap.invokeId=" + capMessage.getInvokeId() +
+ '}';
+ }
+
+ private void sanityCheck() throws CAPException{
+ // TODO
+ }
+}
diff --git a/resources/cap/ra/src/main/java/org/mobicents/slee/resource/cap/wrappers/CAPProviderWrapper.java b/resources/cap/ra/src/main/java/org/mobicents/slee/resource/cap/wrappers/CAPProviderWrapper.java
index bc8d0a8d8..07cf513fd 100644
--- a/resources/cap/ra/src/main/java/org/mobicents/slee/resource/cap/wrappers/CAPProviderWrapper.java
+++ b/resources/cap/ra/src/main/java/org/mobicents/slee/resource/cap/wrappers/CAPProviderWrapper.java
@@ -26,6 +26,8 @@
import org.mobicents.protocols.ss7.cap.api.CAPDialog;
import org.mobicents.protocols.ss7.cap.api.CAPDialogListener;
+import org.mobicents.protocols.ss7.cap.api.CAPException;
+import org.mobicents.protocols.ss7.cap.api.CAPMessage;
import org.mobicents.protocols.ss7.cap.api.CAPParameterFactory;
import org.mobicents.protocols.ss7.cap.api.CAPProvider;
import org.mobicents.protocols.ss7.cap.api.errors.CAPErrorMessageFactory;
@@ -36,6 +38,7 @@
import org.mobicents.protocols.ss7.isup.ISUPParameterFactory;
import org.mobicents.protocols.ss7.map.api.MAPParameterFactory;
import org.mobicents.protocols.ss7.sccp.NetworkIdState;
+import org.mobicents.protocols.ss7.sccp.parameter.SccpAddress;
import org.mobicents.slee.resource.cap.CAPDialogActivityHandle;
import org.mobicents.slee.resource.cap.CAPResourceAdaptor;
import org.mobicents.slee.resource.cap.service.circuitSwitchedCall.wrappers.CAPServiceCircuitSwitchedCallWrapper;
@@ -46,6 +49,7 @@
/**
*
* @author sergey vetyutnev
+ * @author ProIDS sp. z o.o.
*
*/
public class CAPProviderWrapper implements CAPProvider {
@@ -160,5 +164,13 @@ public void setWrappedProvider(CAPProvider wrappedProvider) {
public CAPResourceAdaptor getRa() {
return ra;
}
+
+ public void relayCapMessage(int newServiceKey, SccpAddress origAddress, SccpAddress destAddress, CAPMessage capMessage) throws CAPException {
+ this.getRa().relayCapMessage(newServiceKey, origAddress, destAddress, capMessage);
+ }
+
+ public void relayCapMessage(int newServiceKey, CAPMessage capMessage) throws CAPException {
+ this.getRa().relayCapMessage(newServiceKey, null, null, capMessage);
+ }
}