Revision: 595f811a6b4d
Author:   [email protected] <[email protected]>
Date:     Sun Aug 12 05:35:01 2012
Log:      Send back Delivery Report to ESME for failed MtSMS
http://code.google.com/p/smscgateway/source/detail?r=595f811a6b4d

Added:
 /test/bootstrap/src/main/config/data/Mtp3UserPart_m3ua.xml
 /test/bootstrap/src/main/config/data/SCTPManagement_sctp.xml
 /test/bootstrap/src/main/config/data/SccpStack_sccpresource.xml
 /test/bootstrap/src/main/config/data/SccpStack_sccprouter.xml
 /test/bootstrap/src/main/config/ss7-cli.bat
 /test/bootstrap/src/main/config/ss7-cli.sh
Deleted:
 /test/bootstrap/src/main/config/ss7-run.bat
 /test/bootstrap/src/main/config/ss7-run.sh
Modified:
 /.gitignore
/core/slee/services/mtsbb/src/main/java/org/mobicents/smsc/slee/services/mt/MtCommonSbb.java /core/slee/services/mtsbb/src/main/java/org/mobicents/smsc/slee/services/mt/MtSbb.java
 /core/slee/services/mtsbb/src/main/resources/META-INF/sbb-jar.xml
 /test/bootstrap/pom.xml
 /test/bootstrap/src/main/assembly/descriptor.xml
 /test/mapmodule/src/main/java/org/mobicents/smsc/ihub/MAPListener.java
 /test/mapmodule/src/main/java/org/mobicents/smsc/ihub/MAPSimulator.java

=======================================
--- /dev/null
+++ /test/bootstrap/src/main/config/data/Mtp3UserPart_m3ua.xml Sun Aug 12 05:35:01 2012
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<aspFactoryList>
+ <aspFactory name="ASP1" assocName="SCTPAssoc1" started="true" maxseqnumber="256"/>
+</aspFactoryList>
+<asList>
+ <as name="AS1" minAspActiveForLb="1" functionality="IPSP" exchangeType="SE" ipspType="SERVER">
+               <routingContext size="1">
+                       <rc value="100"/>
+               </routingContext>
+               <trafficMode mode="2"/>
+               <defTrafficMode mode="2"/>
+               <asps>
+                       <asp name="ASP1"/>
+               </asps>
+       </as>
+</asList>
+<route>
+       <key value="1:-1:-1"/>
+       <value value="AS1"/>
+</route>
=======================================
--- /dev/null
+++ /test/bootstrap/src/main/config/data/SCTPManagement_sctp.xml Sun Aug 12 05:35:01 2012
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<servers>
+ <server name="SCTPServer1" started="true" hostAddress="127.0.0.1" hostPort="2775" ipChannelType="0" extraHostAddresseSize="0">
+               <associations>
+                       <string value="SCTPAssoc1"/>
+               </associations>
+       </server>
+</servers>
+<associations>
+       <name value="SCTPAssoc1"/>
+ <association name="SCTPAssoc1" assoctype="SERVER" hostPort="0" peerAddress="127.0.0.1" peerPort="2776" serverName="SCTPServer1" ipChannelType="0" extraHostAddresseSize="0"/>
+</associations>
=======================================
--- /dev/null
+++ /test/bootstrap/src/main/config/data/SccpStack_sccpresource.xml Sun Aug 12 05:35:01 2012
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<remoteSsn>
+       <Key type="java.lang.Integer" value="1"/>
+ <Value type="org.mobicents.protocols.ss7.sccp.impl.RemoteSubSystem" remoteSpc="1" remoteSsn="8" remoteSsnFlag="0" markProhibitedWhenSpcResuming="false"/>
+</remoteSsn>
+<remoteSpc>
+       <Key type="java.lang.Integer" value="1"/>
+ <Value type="org.mobicents.protocols.ss7.sccp.impl.RemoteSignalingPointCode" remoteSpc="1" remoteSpcFlag="0" mask="0"/>
+</remoteSpc>
+<concernedSpc/>
=======================================
--- /dev/null
+++ /test/bootstrap/src/main/config/data/SccpStack_sccprouter.xml Sun Aug 12 05:35:01 2012
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<rule>
+       <Key type="java.lang.Integer" value="1"/>
+ <Value type="rule" ruleType="Solitary" loadSharingAlgo="Undefined" mask="K" paddress="1" saddress="-1"> + <pattern type="org.mobicents.protocols.ss7.sccp.parameter.SccpAddress" pc="0" ssn="8"> + <ai type="org.mobicents.protocols.ss7.indicator.AddressIndicator" ai="18"/> + <gt type="org.mobicents.protocols.ss7.sccp.parameter.GT0100" tt="0" es="2" np="1" nai="4" digits="923330053058"/>
+               </pattern>
+       </Value>
+       <Key type="java.lang.Integer" value="2"/>
+ <Value type="rule" ruleType="Solitary" loadSharingAlgo="Undefined" mask="K" paddress="2" saddress="-1"> + <pattern type="org.mobicents.protocols.ss7.sccp.parameter.SccpAddress" pc="0" ssn="0"> + <ai type="org.mobicents.protocols.ss7.indicator.AddressIndicator" ai="16"/> + <gt type="org.mobicents.protocols.ss7.sccp.parameter.GT0100" tt="0" es="1" np="1" nai="4" digits="*"/>
+               </pattern>
+       </Value>
+</rule>
+<primaryAddress>
+       <Key type="java.lang.Integer" value="1"/>
+ <Value type="org.mobicents.protocols.ss7.sccp.parameter.SccpAddress" pc="1" ssn="8"> + <ai type="org.mobicents.protocols.ss7.indicator.AddressIndicator" ai="19"/> + <gt type="org.mobicents.protocols.ss7.sccp.parameter.GT0100" tt="0" es="2" np="1" nai="4" digits="923330053058"/>
+       </Value>
+       <Key type="java.lang.Integer" value="2"/>
+ <Value type="org.mobicents.protocols.ss7.sccp.parameter.SccpAddress" pc="2" ssn="0"> + <ai type="org.mobicents.protocols.ss7.indicator.AddressIndicator" ai="17"/> + <gt type="org.mobicents.protocols.ss7.sccp.parameter.GT0100" tt="0" es="1" np="1" nai="4" digits="-"/>
+       </Value>
+</primaryAddress>
+<backupAddress/>
+<longMessageRule/>
+<sap>
+       <Key type="java.lang.Integer" value="1"/>
+ <Value type="org.mobicents.protocols.ss7.sccp.impl.router.Mtp3ServiceAccessPoint" mtp3Id="1" opc="2" ni="2">
+               <javolution.util.FastMap>
+                       <Key type="java.lang.Integer" value="1"/>
+ <Value type="org.mobicents.protocols.ss7.sccp.impl.router.Mtp3Destination" firstDpc="1" lastDpc="1" firstSls="0" lastSls="255" slsMask="255"/>
+               </javolution.util.FastMap>
+       </Value>
+</sap>
=======================================
--- /dev/null
+++ /test/bootstrap/src/main/config/ss7-cli.bat Sun Aug 12 05:35:01 2012
@@ -0,0 +1,145 @@
+@echo off
+rem -------------------------------------------------------------------------
+rem Mobicents SS7 CLI Bootstrap Script for Win32
+rem -------------------------------------------------------------------------
+
+rem $Id: run.bat,v 1.5 2010/12/13 10:15:40 abhayani Exp $
+
+@if not "%ECHO%" == ""  echo %ECHO%
+@if "%OS%" == "Windows_NT"  setlocal
+
+set DIRNAME=.\
+if "%OS%" == "Windows_NT" set DIRNAME=%~dp0%
+set PROGNAME=run.bat
+if "%OS%" == "Windows_NT" set PROGNAME=%~nx0%
+
+pushd %DIRNAME%..
+set SHELL_HOME=%CD%
+echo ========
+echo %SHELL_HOME%
+
+popd
+
+REM Add bin/native to the PATH if present
+if exist "%SHELL_HOME%\native" set PATH=%SHELL_HOME%\native;%PATH%
+if exist "%SHELL_HOME%\native" set JAVA_OPTS=%JAVA_OPTS% -Djava.library.path="%PATH%"
+
+REM Run section  - here we define node and default ip
+set IP=127.0.0.1
+
+rem Read all command line arguments
+
+REM
+REM The %ARGS% env variable commented out in favor of using %* to include
+REM all args in java command line. See bug #840239. [jpl]
+REM
+REM set ARGS=
+REM :loop
+REM if [%1] == [] goto endloop
+REM         set ARGS=%ARGS% %1
+REM         shift
+REM         goto loop
+REM :endloop
+
+
+set ARGS=""
+
+
+:loop
+ if [%1] == [] goto endloop
+         set ARGS=%ARGS% %1
+         shift
+         goto loop
+ :endloop
+
+
+rem Find run.jar, or we can't continue
+
+set RUNJAR=%SHELL_HOME%\bin\mobicents-ss7-shell.jar
+if exist "%RUNJAR%" goto FOUND_RUN_JAR
+echo Could not locate %RUNJAR%. Please check that you are in the
+echo bin directory when running this script.
+goto END
+
+:FOUND_RUN_JAR
+
+if not "%JAVA_HOME%" == "" goto ADD_TOOLS
+
+set JAVA=java
+
+echo JAVA_HOME is not set.  Unexpected results may occur.
+echo Set JAVA_HOME to the directory of your local JDK to avoid this message.
+goto SKIP_TOOLS
+
+:ADD_TOOLS
+
+set JAVA=%JAVA_HOME%\bin\java
+
+rem A full JDK with toos.jar is not required anymore since jboss web packages
+rem the eclipse jdt compiler and javassist has its own internal compiler.
+if not exist "%JAVA_HOME%\lib\tools.jar" goto SKIP_TOOLS
+
+rem If exists, point to the JDK javac compiler in case the user wants to
+rem later override the eclipse jdt compiler for compiling JSP pages.
+set JAVAC_JAR=%JAVA_HOME%\lib\tools.jar
+
+:SKIP_TOOLS
+
+rem If JBOSS_CLASSPATH or JAVAC_JAR is empty, don't include it, as this will
+rem result in including the local directory in the classpath, which makes
+rem error tracking harder.
+if not "%JAVAC_JAR%" == "" set RUNJAR=%JAVAC_JAR%;%RUNJAR%
+if "%SHELL_CLASSPATH%" == "" set RUN_CLASSPATH=%RUNJAR%
+if "%RUN_CLASSPATH%" == "" set RUN_CLASSPATH=%SHELL_CLASSPATH%;%RUNJAR%
+
+set SHELL_CLASSPATH=%RUN_CLASSPATH%
+
+rem Setup JBoss specific properties
+set JAVA_OPTS=%JAVA_OPTS% -Dprogram.name=%PROGNAME%
+
+rem Add -server to the JVM options, if supported
+"%JAVA%" -version 2>&1 | findstr /I hotspot > nul
+if not errorlevel == 1 (set JAVA_OPTS=%JAVA_OPTS% -server)
+
+rem JVM memory allocation pool parameters. Modify as appropriate.
+set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx512m
+
+rem profiler
+rem set JAVA_OPTS=%JAVA_OPTS% -agentpath:C:\Users\kulikov\.netbeans\6.1\lib\deployed\jdk15\windows\profilerinterface.dll=C:\Users\kulikov\.netbeans\6.1\lib,5140 +rem set JAVA_OPTS=%JAVA_OPTS% -agentpath:C:\Users\kulikov\.netbeans\6.1\lib\deployed\jdk16\windows\profilerinterface.dll=C:\Users\kulikov\.netbeans\6.1\lib,5140
+
+rem With Sun JVMs reduce the RMI GCs to once per hour
+set JAVA_OPTS=%JAVA_OPTS% -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
+
+rem JPDA options. Uncomment and modify as appropriate to enable remote debugging. +rem set JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y %JAVA_OPTS%
+
+rem Setup the java endorsed dirs
+set SHELL_ENDORSED_DIRS=%SHELL_HOME%\bin\lib
+
+
+echo ===============================================================================
+echo.
+echo   Mobicents SS7 Management Shell Bootstrap Environment
+echo.
+echo   SHELL_HOME: %SHELL_HOME%
+echo.
+echo   JAVA: %JAVA%
+echo.
+echo   JAVA_OPTS: %JAVA_OPTS%
+echo.
+echo   CLASSPATH: %SHELL_CLASSPATH%
+echo
+echo   SHELL_ENDORSED_DIRS: %SHELL_ENDORSED_DIRS%
+echo.
+echo ===============================================================================
+echo.
+
+:RESTART
+"%JAVA%" %JAVA_OPTS% -Djava.ext.dirs="%SHELL_ENDORSED_DIRS%" -classpath "%SHELL_CLASSPATH%" org.mobicents.ss7.management.console.Shell %*
+rem if ERRORLEVEL 10 goto RESTART
+
+:END
+if "%NOPAUSE%" == "" pause
+
+:END_NO_PAUSE
=======================================
--- /dev/null
+++ /test/bootstrap/src/main/config/ss7-cli.sh  Sun Aug 12 05:35:01 2012
@@ -0,0 +1,171 @@
+#!/bin/sh
+### ====================================================================== ### +## ##
+##  Mobicents SS7 CLI Bootstrap Script                                 ##
+## ## +### ====================================================================== ###
+
+### $Id: run.sh [email protected] $ ###
+
+DIRNAME=`dirname $0`
+PROGNAME=`basename $0`
+GREP="grep"
+
+# Use the maximum available, or set MAX_FD != -1 to use that
+MAX_FD="maximum"
+
+#
+# Helper to complain.
+#
+warn() {
+    echo "${PROGNAME}: $*"
+}
+
+#
+# Helper to puke.
+#
+die() {
+    warn $*
+    exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false;
+darwin=false;
+linux=false;
+case "`uname`" in
+    CYGWIN*)
+        cygwin=true
+        ;;
+
+    Darwin*)
+        darwin=true
+        ;;
+
+    Linux)
+        linux=true
+        ;;
+esac
+
+
+# Force IPv4 on Linux systems since IPv6 doesn't work correctly with jdk5 and lower
+if [ "$linux" = "true" ]; then
+   JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true"
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+    [ -n "$SHELL_HOME" ] &&
+        SHELL_HOME=`cygpath --unix "$SHELL_HOME"`
+    [ -n "$JAVA_HOME" ] &&
+        JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+    [ -n "$JAVAC_JAR" ] &&
+        JAVAC_JAR=`cygpath --unix "$JAVAC_JAR"`
+fi
+
+# Setup SHELL_HOME
+if [ "x$SHELL_HOME" = "x" ]; then
+    # get the full path (without any relative bits)
+    SHELL_HOME=`cd $DIRNAME/..; pwd`
+fi
+export SHELL_HOME
+
+# Increase the maximum file descriptors if we can
+if [ "$cygwin" = "false" ]; then
+    MAX_FD_LIMIT=`ulimit -H -n`
+    if [ $? -eq 0 ]; then
+       if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then
+           # use the system max
+           MAX_FD="$MAX_FD_LIMIT"
+       fi
+
+       ulimit -n $MAX_FD
+       if [ $? -ne 0 ]; then
+           warn "Could not set maximum file descriptor limit: $MAX_FD"
+       fi
+    else
+       warn "Could not query system maximum file descriptor limit: 
$MAX_FD_LIMIT"
+    fi
+fi
+
+# Setup the JVM
+if [ "x$JAVA" = "x" ]; then
+    if [ "x$JAVA_HOME" != "x" ]; then
+       JAVA="$JAVA_HOME/bin/java"
+    else
+       JAVA="java"
+    fi
+fi
+
+# Setup the classpath
+runjar="$SHELL_HOME/lib/mobicents-ss7-shell.jar"
+if [ ! -f "$runjar" ]; then
+    die "Missing required file: $runjar"
+fi
+
+SHELL_BOOT_CLASSPATH="$runjar"
+SHELL_CLASSPATH="$SHELL_HOME/lib/*"
+
+if [ "x$SHELL_CLASSPATH" = "x" ]; then
+    SHELL_CLASSPATH="$SHELL_BOOT_CLASSPATH"
+else
+    SHELL_CLASSPATH="$SHELL_CLASSPATH:$SHELL_BOOT_CLASSPATH"
+fi
+
+
+# If -server not set in JAVA_OPTS, set it, if supported
+SERVER_SET=`echo $JAVA_OPTS | $GREP "\-server"`
+if [ "x$SERVER_SET" = "x" ]; then
+
+    # Check for SUN(tm) JVM w/ HotSpot support
+    if [ "x$HAS_HOTSPOT" = "x" ]; then
+       HAS_HOTSPOT=`"$JAVA" -version 2>&1 | $GREP -i HotSpot`
+    fi
+
+    # Enable -server if we have Hotspot, unless we can't
+    if [ "x$HAS_HOTSPOT" != "x" ]; then
+       # MacOS does not support -server flag
+       if [ "$darwin" != "true" ]; then
+           JAVA_OPTS="-server $JAVA_OPTS"
+       fi
+     fi
+fi
+
+# Setup MMS specific properties
+JAVA_OPTS="-Dprogram.name=$PROGNAME $JAVA_OPTS"
+JAVA_OPTS="$JAVA_OPTS -Xms64m -Xmx64m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000" +#JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
+# Setup the java endorsed dirs
+SHELL_ENDORSED_DIRS="$SHELL_HOME/bin/lib"
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+    SHELL_HOME=`cygpath --path --windows "$SHELL_HOME"`
+    JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+    SHELL_CLASSPATH=`cygpath --path --windows "$SHELL_CLASSPATH"`
+    SHELL_ENDORSED_DIRS=`cygpath --path --windows "$SHELL_ENDORSED_DIRS"`
+fi
+
+# Display our environment
+#echo 
"========================================================================="
+#echo ""
+#echo "  Mobicents SS7 Management Shell Bootstrap Environment"
+#echo ""
+#echo "  SHELL_HOME: $SHELL_HOME"
+#echo ""
+#echo "  JAVA: $JAVA"
+#echo ""
+#echo "  JAVA_OPTS: $JAVA_OPTS"
+#echo ""
+#echo "  CLASSPATH: $SHELL_CLASSPATH"
+#echo ""
+#echo 
"========================================================================="
+#echo ""
+
+      "$JAVA" $JAVA_OPTS \
+         -Djava.ext.dirs="$SHELL_ENDORSED_DIRS" \
+         -classpath "$SHELL_CLASSPATH" \
+         org.mobicents.ss7.management.console.Shell "$@"
+      SHELL_STATUS=$?
+
+#java -Djava.ext.dirs=`pwd`/lib -Dmms.home=. -cp .:mms-standalone-2.0.0.BETA1-SNAPSHOT.jar org.mobicents.media.server.bootstrap.jmx.JMXMain
=======================================
--- /test/bootstrap/src/main/config/ss7-run.bat Thu Apr 26 01:25:46 2012
+++ /dev/null
@@ -1,145 +0,0 @@
-@echo off
-rem -------------------------------------------------------------------------
-rem Mobicents SS7 CLI Bootstrap Script for Win32
-rem -------------------------------------------------------------------------
-
-rem $Id: run.bat,v 1.5 2010/12/13 10:15:40 abhayani Exp $
-
-@if not "%ECHO%" == ""  echo %ECHO%
-@if "%OS%" == "Windows_NT"  setlocal
-
-set DIRNAME=.\
-if "%OS%" == "Windows_NT" set DIRNAME=%~dp0%
-set PROGNAME=run.bat
-if "%OS%" == "Windows_NT" set PROGNAME=%~nx0%
-
-pushd %DIRNAME%..
-set SHELL_HOME=%CD%
-echo ========
-echo %SHELL_HOME%
-
-popd
-
-REM Add bin/native to the PATH if present
-if exist "%SHELL_HOME%\native" set PATH=%SHELL_HOME%\native;%PATH%
-if exist "%SHELL_HOME%\native" set JAVA_OPTS=%JAVA_OPTS% -Djava.library.path="%PATH%"
-
-REM Run section  - here we define node and default ip
-set IP=127.0.0.1
-
-rem Read all command line arguments
-
-REM
-REM The %ARGS% env variable commented out in favor of using %* to include
-REM all args in java command line. See bug #840239. [jpl]
-REM
-REM set ARGS=
-REM :loop
-REM if [%1] == [] goto endloop
-REM         set ARGS=%ARGS% %1
-REM         shift
-REM         goto loop
-REM :endloop
-
-
-set ARGS=""
-
-
-:loop
- if [%1] == [] goto endloop
-         set ARGS=%ARGS% %1
-         shift
-         goto loop
- :endloop
-
-
-rem Find run.jar, or we can't continue
-
-set RUNJAR=%SHELL_HOME%\bin\mobicents-ss7-shell.jar
-if exist "%RUNJAR%" goto FOUND_RUN_JAR
-echo Could not locate %RUNJAR%. Please check that you are in the
-echo bin directory when running this script.
-goto END
-
-:FOUND_RUN_JAR
-
-if not "%JAVA_HOME%" == "" goto ADD_TOOLS
-
-set JAVA=java
-
-echo JAVA_HOME is not set.  Unexpected results may occur.
-echo Set JAVA_HOME to the directory of your local JDK to avoid this message.
-goto SKIP_TOOLS
-
-:ADD_TOOLS
-
-set JAVA=%JAVA_HOME%\bin\java
-
-rem A full JDK with toos.jar is not required anymore since jboss web packages
-rem the eclipse jdt compiler and javassist has its own internal compiler.
-if not exist "%JAVA_HOME%\lib\tools.jar" goto SKIP_TOOLS
-
-rem If exists, point to the JDK javac compiler in case the user wants to
-rem later override the eclipse jdt compiler for compiling JSP pages.
-set JAVAC_JAR=%JAVA_HOME%\lib\tools.jar
-
-:SKIP_TOOLS
-
-rem If JBOSS_CLASSPATH or JAVAC_JAR is empty, don't include it, as this will
-rem result in including the local directory in the classpath, which makes
-rem error tracking harder.
-if not "%JAVAC_JAR%" == "" set RUNJAR=%JAVAC_JAR%;%RUNJAR%
-if "%SHELL_CLASSPATH%" == "" set RUN_CLASSPATH=%RUNJAR%
-if "%RUN_CLASSPATH%" == "" set RUN_CLASSPATH=%SHELL_CLASSPATH%;%RUNJAR%
-
-set SHELL_CLASSPATH=%RUN_CLASSPATH%
-
-rem Setup JBoss specific properties
-set JAVA_OPTS=%JAVA_OPTS% -Dprogram.name=%PROGNAME%
-
-rem Add -server to the JVM options, if supported
-"%JAVA%" -version 2>&1 | findstr /I hotspot > nul
-if not errorlevel == 1 (set JAVA_OPTS=%JAVA_OPTS% -server)
-
-rem JVM memory allocation pool parameters. Modify as appropriate.
-set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx512m
-
-rem profiler
-rem set JAVA_OPTS=%JAVA_OPTS% -agentpath:C:\Users\kulikov\.netbeans\6.1\lib\deployed\jdk15\windows\profilerinterface.dll=C:\Users\kulikov\.netbeans\6.1\lib,5140 -rem set JAVA_OPTS=%JAVA_OPTS% -agentpath:C:\Users\kulikov\.netbeans\6.1\lib\deployed\jdk16\windows\profilerinterface.dll=C:\Users\kulikov\.netbeans\6.1\lib,5140
-
-rem With Sun JVMs reduce the RMI GCs to once per hour
-set JAVA_OPTS=%JAVA_OPTS% -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
-
-rem JPDA options. Uncomment and modify as appropriate to enable remote debugging. -rem set JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y %JAVA_OPTS%
-
-rem Setup the java endorsed dirs
-set SHELL_ENDORSED_DIRS=%SHELL_HOME%\bin\lib
-
-
-echo ===============================================================================
-echo.
-echo   Mobicents SS7 Management Shell Bootstrap Environment
-echo.
-echo   SHELL_HOME: %SHELL_HOME%
-echo.
-echo   JAVA: %JAVA%
-echo.
-echo   JAVA_OPTS: %JAVA_OPTS%
-echo.
-echo   CLASSPATH: %SHELL_CLASSPATH%
-echo
-echo   SHELL_ENDORSED_DIRS: %SHELL_ENDORSED_DIRS%
-echo.
-echo ===============================================================================
-echo.
-
-:RESTART
-"%JAVA%" %JAVA_OPTS% -Djava.ext.dirs="%SHELL_ENDORSED_DIRS%" -classpath "%SHELL_CLASSPATH%" org.mobicents.ss7.management.console.Shell %*
-rem if ERRORLEVEL 10 goto RESTART
-
-:END
-if "%NOPAUSE%" == "" pause
-
-:END_NO_PAUSE
=======================================
--- /test/bootstrap/src/main/config/ss7-run.sh  Thu Apr 26 01:25:46 2012
+++ /dev/null
@@ -1,170 +0,0 @@
-#!/bin/sh
-### ====================================================================== ### -## ##
-##  Mobicents SS7 CLI Bootstrap Script                                 ##
-## ## -### ====================================================================== ###
-
-### $Id: run.sh [email protected] $ ###
-
-DIRNAME=`dirname $0`
-PROGNAME=`basename $0`
-GREP="grep"
-
-# Use the maximum available, or set MAX_FD != -1 to use that
-MAX_FD="maximum"
-
-#
-# Helper to complain.
-#
-warn() {
-    echo "${PROGNAME}: $*"
-}
-
-#
-# Helper to puke.
-#
-die() {
-    warn $*
-    exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false;
-darwin=false;
-linux=false;
-case "`uname`" in
-    CYGWIN*)
-        cygwin=true
-        ;;
-
-    Darwin*)
-        darwin=true
-        ;;
-
-    Linux)
-        linux=true
-        ;;
-esac
-
-
-# Force IPv4 on Linux systems since IPv6 doesn't work correctly with jdk5 and lower
-if [ "$linux" = "true" ]; then
-   JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true"
-fi
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched
-if $cygwin ; then
-    [ -n "$SHELL_HOME" ] &&
-        SHELL_HOME=`cygpath --unix "$SHELL_HOME"`
-    [ -n "$JAVA_HOME" ] &&
-        JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-    [ -n "$JAVAC_JAR" ] &&
-        JAVAC_JAR=`cygpath --unix "$JAVAC_JAR"`
-fi
-
-# Setup SHELL_HOME
-if [ "x$SHELL_HOME" = "x" ]; then
-    # get the full path (without any relative bits)
-    SHELL_HOME=`cd $DIRNAME/..; pwd`
-fi
-export SHELL_HOME
-
-# Increase the maximum file descriptors if we can
-if [ "$cygwin" = "false" ]; then
-    MAX_FD_LIMIT=`ulimit -H -n`
-    if [ $? -eq 0 ]; then
-       if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then
-           # use the system max
-           MAX_FD="$MAX_FD_LIMIT"
-       fi
-
-       ulimit -n $MAX_FD
-       if [ $? -ne 0 ]; then
-           warn "Could not set maximum file descriptor limit: $MAX_FD"
-       fi
-    else
-       warn "Could not query system maximum file descriptor limit: 
$MAX_FD_LIMIT"
-    fi
-fi
-
-# Setup the JVM
-if [ "x$JAVA" = "x" ]; then
-    if [ "x$JAVA_HOME" != "x" ]; then
-       JAVA="$JAVA_HOME/bin/java"
-    else
-       JAVA="java"
-    fi
-fi
-
-# Setup the classpath
-runjar="$SHELL_HOME/bin/shell.jar"
-if [ ! -f "$runjar" ]; then
-    die "Missing required file: $runjar"
-fi
-
-SHELL_BOOT_CLASSPATH="$runjar"
-
-if [ "x$SHELL_CLASSPATH" = "x" ]; then
-    SHELL_CLASSPATH="$SHELL_BOOT_CLASSPATH"
-else
-    SHELL_CLASSPATH="$SHELL_CLASSPATH:$SHELL_BOOT_CLASSPATH"
-fi
-
-
-# If -server not set in JAVA_OPTS, set it, if supported
-SERVER_SET=`echo $JAVA_OPTS | $GREP "\-server"`
-if [ "x$SERVER_SET" = "x" ]; then
-
-    # Check for SUN(tm) JVM w/ HotSpot support
-    if [ "x$HAS_HOTSPOT" = "x" ]; then
-       HAS_HOTSPOT=`"$JAVA" -version 2>&1 | $GREP -i HotSpot`
-    fi
-
-    # Enable -server if we have Hotspot, unless we can't
-    if [ "x$HAS_HOTSPOT" != "x" ]; then
-       # MacOS does not support -server flag
-       if [ "$darwin" != "true" ]; then
-           JAVA_OPTS="-server $JAVA_OPTS"
-       fi
-     fi
-fi
-
-# Setup MMS specific properties
-JAVA_OPTS="-Dprogram.name=$PROGNAME $JAVA_OPTS"
-JAVA_OPTS="$JAVA_OPTS -Xms64m -Xmx64m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000" -#JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
-# Setup the java endorsed dirs
-SHELL_ENDORSED_DIRS="$SHELL_HOME/lib"
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin; then
-    SHELL_HOME=`cygpath --path --windows "$SHELL_HOME"`
-    JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
-    SHELL_CLASSPATH=`cygpath --path --windows "$SHELL_CLASSPATH"`
-    SHELL_ENDORSED_DIRS=`cygpath --path --windows "$SHELL_ENDORSED_DIRS"`
-fi
-
-# Display our environment
-echo 
"========================================================================="
-echo ""
-echo "  Mobicents SS7 Management Shell Bootstrap Environment"
-echo ""
-echo "  SHELL_HOME: $SHELL_HOME"
-echo ""
-echo "  JAVA: $JAVA"
-echo ""
-echo "  JAVA_OPTS: $JAVA_OPTS"
-echo ""
-echo "  CLASSPATH: $SHELL_CLASSPATH"
-echo ""
-echo 
"========================================================================="
-echo ""
-
-      "$JAVA" $JAVA_OPTS \
-         -Djava.ext.dirs="$SHELL_ENDORSED_DIRS" \
-         -classpath "$SHELL_CLASSPATH" \
-         org.mobicents.ss7.management.console.Shell "$@"
-      SHELL_STATUS=$?
-
-#java -Djava.ext.dirs=`pwd`/lib -Dmms.home=. -cp .:mms-standalone-2.0.0.BETA1-SNAPSHOT.jar org.mobicents.media.server.bootstrap.jmx.JMXMain
=======================================
--- /.gitignore Thu Jul 12 06:58:12 2012
+++ /.gitignore Sun Aug 12 05:35:01 2012
@@ -2,3 +2,4 @@
 /.classpath
 /.project
 target
+/Notes
=======================================
--- /core/slee/services/mtsbb/src/main/java/org/mobicents/smsc/slee/services/mt/MtCommonSbb.java Tue May 8 08:35:43 2012 +++ /core/slee/services/mtsbb/src/main/java/org/mobicents/smsc/slee/services/mt/MtCommonSbb.java Sun Aug 12 05:35:01 2012
@@ -3,6 +3,8 @@
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.net.URL;
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
 import java.util.Properties;

 import javax.naming.Context;
@@ -41,9 +43,34 @@
 import org.mobicents.slee.resource.map.events.InvokeTimeout;
 import org.mobicents.slee.resource.map.events.ProviderErrorComponent;
 import org.mobicents.slee.resource.map.events.RejectComponent;
+import org.mobicents.smsc.slee.services.smpp.server.events.SmsEvent;
+
+import com.cloudhopper.commons.charset.CharsetUtil;
+import com.cloudhopper.smpp.util.SmppUtil;

 public abstract class MtCommonSbb implements Sbb {

+       private static final byte ESME_DELIVERY_ACK = 0x08;
+
+       private static final String DELIVERY_ACK_ID = "id:";
+       private static final String DELIVERY_ACK_SUB = " sub:";
+       private static final String DELIVERY_ACK_DLVRD = " dlvrd:";
+       private static final String DELIVERY_ACK_SUBMIT_DATE = " submit date:";
+       private static final String DELIVERY_ACK_DONE_DATE = " done date:";
+       private static final String DELIVERY_ACK_STAT = " stat:";
+       private static final String DELIVERY_ACK_ERR = " err:";
+       private static final String DELIVERY_ACK_TEXT = " text:";
+
+       private static final String DELIVERY_ACK_STATE_DELIVERED = "DELIVRD";
+       private static final String DELIVERY_ACK_STATE_EXPIRED = "EXPIRED";
+       private static final String DELIVERY_ACK_STATE_DELETED = "DELETED";
+       private static final String DELIVERY_ACK_STATE_UNDELIVERABLE = 
"UNDELIV";
+       private static final String DELIVERY_ACK_STATE_ACCEPTED = "ACCEPTD";
+       private static final String DELIVERY_ACK_STATE_UNKNOWN = "UNKNOWN";
+       private static final String DELIVERY_ACK_STATE_REJECTED = "REJECTD";
+
+ private final SimpleDateFormat DELIVERY_ACK_DATE_FORMAT = new SimpleDateFormat("yyMMddHHmm");
+
        private static final String SMSC_PROPERTIES = "smsc.properties";
        private static final String SC_GT_KEY = "service.center.gt";
        private static final String SC_SSN_KEY = "service.center.ssn";
@@ -85,20 +112,44 @@

public void onErrorComponent(ErrorComponent event, ActivityContextInterface aci) {

-               if(this.logger.isInfoEnabled()){
+               if (this.logger.isInfoEnabled()) {
this.logger.info("Rx : onErrorComponent " + event + " Dialog=" + event.getMAPDialog());
                }
                // if (mapErrorMessage.isEmAbsentSubscriberSM()) {
// this.sendReportSMDeliveryStatusRequest(SMDeliveryOutcome.absentSubscriber);
                // }
+
+               SmsEvent original = this.getOriginalSmsEvent();
+
+               if (original != null) {
+                       if (original.getSystemId() != null) {
+                               this.sendFailureDeliverSmToEsms(original);
+                       }
+               }
        }

public void onProviderErrorComponent(ProviderErrorComponent event, ActivityContextInterface aci) {
                this.logger.severe("Rx :  onProviderErrorComponent" + event);
+
+               SmsEvent original = this.getOriginalSmsEvent();
+
+               if (original != null) {
+                       if (original.getSystemId() != null) {
+                               this.sendFailureDeliverSmToEsms(original);
+                       }
+               }
        }

public void onRejectComponent(RejectComponent event, ActivityContextInterface aci) {
                this.logger.severe("Rx :  onRejectComponent" + event);
+
+               SmsEvent original = this.getOriginalSmsEvent();
+
+               if (original != null) {
+                       if (original.getSystemId() != null) {
+                               this.sendFailureDeliverSmToEsms(original);
+                       }
+               }
        }

        /**
@@ -123,16 +174,40 @@
                }

                // TODO : Error condition. Take care
+
+               SmsEvent original = this.getOriginalSmsEvent();
+
+               if (original != null) {
+                       if (original.getSystemId() != null) {
+                               this.sendFailureDeliverSmToEsms(original);
+                       }
+               }
        }

public void onDialogUserAbort(DialogUserAbort evt, ActivityContextInterface aci) {
                this.logger.severe("Rx :  onDialogUserAbort=" + evt);

                // TODO : Error condition. Take care
+
+               SmsEvent original = this.getOriginalSmsEvent();
+
+               if (original != null) {
+                       if (original.getSystemId() != null) {
+                               this.sendFailureDeliverSmToEsms(original);
+                       }
+               }
        }

public void onDialogProviderAbort(DialogProviderAbort evt, ActivityContextInterface aci) {
                this.logger.severe("Rx :  onDialogProviderAbort=" + evt);
+
+               SmsEvent original = this.getOriginalSmsEvent();
+
+               if (original != null) {
+                       if (original.getSystemId() != null) {
+                               this.sendFailureDeliverSmToEsms(original);
+                       }
+               }
        }

        public void onDialogClose(DialogClose evt, ActivityContextInterface 
aci) {
@@ -156,13 +231,13 @@
                        this.logger.fine("Rx :  onDialogRequest" + evt);
                }
        }
-
+
public void onDialogRelease(DialogRelease evt, ActivityContextInterface aci) {
                if (logger.isInfoEnabled()) {
-                       //TODO : Should be fine
+                       // TODO : Should be fine
                        this.logger.info("Rx :  DialogRelease" + evt);
                }
-
+
MtActivityContextInterface mtSbbActivityContextInterface = this.asSbbActivityContextInterface(this
                                
.getNullActivityEventContext().getActivityContextInterface());
this.resumeNullActivityEventDelivery(mtSbbActivityContextInterface, this.getNullActivityEventContext());
@@ -272,14 +347,24 @@
        public void unsetSbbContext() {

        }
-
+
+       /**
+        * Fire SmsEvent
+        *
+        * @param event
+        * @param aci
+        * @param address
+        */
+ public abstract void fireSendDeliveryReportSms(SmsEvent event, ActivityContextInterface aci,
+                       javax.slee.Address address);
+
        /**
         * CMPs
         */
public abstract void setNullActivityEventContext(EventContext eventContext);

        public abstract EventContext getNullActivityEventContext();
-
+
        /**
         * Sbb ACI
         */
@@ -331,8 +416,127 @@
                        }
                }
                // Resume delivery for rest of the SMS's for this MSISDN
-               if(nullActivityEventContext.isSuspended()){
+               if (nullActivityEventContext.isSuspended()) {
                        nullActivityEventContext.resumeDelivery();
                }
        }
+
+       protected SmsEvent getOriginalSmsEvent() {
+ EventContext nullActivityEventContext = this.getNullActivityEventContext();
+               SmsEvent smsEvent = null;
+               try {
+                       smsEvent = (SmsEvent) 
nullActivityEventContext.getEvent();
+               } catch (Exception e) {
+                       this.logger.severe(
+ String.format("Exception while trying to retrieve SmsEvent from NullActivity EventContext"), e);
+               }
+
+               return smsEvent;
+       }
+
+       protected void sendFailureDeliverSmToEsms(SmsEvent original) {
+               // TODO check if SmppSession available for this SystemId, if 
not send to
+               // SnF module
+
+               byte registeredDelivery = original.getRegisteredDelivery();
+
+               // Send Delivery Receipt only if requested
+               if (SmppUtil.isSmscDeliveryReceiptRequested(registeredDelivery)
+ || SmppUtil.isSmscDeliveryReceiptOnFailureRequested(registeredDelivery)) {
+                       SmsEvent deliveryReport = new SmsEvent();
+                       deliveryReport.setSourceAddr(original.getDestAddr());
+                       
deliveryReport.setSourceAddrNpi(original.getDestAddrNpi());
+                       
deliveryReport.setSourceAddrTon(original.getDestAddrTon());
+
+                       deliveryReport.setDestAddr(original.getSourceAddr());
+                       
deliveryReport.setDestAddrNpi(original.getSourceAddrNpi());
+                       
deliveryReport.setDestAddrTon(original.getSourceAddrTon());
+
+                       // Setting SystemId as null, so RxSmppServerSbb 
actually tries to
+                       // find real SmppServerSession from Destination TON, 
NPI and address
+                       // range
+                       deliveryReport.setSystemId(null);
+
+                       deliveryReport.setSubmitDate(original.getSubmitDate());
+
+                       deliveryReport.setMessageId(original.getMessageId());
+
+                       // TODO : Set appropriate error code in err:
+                       StringBuffer sb = new StringBuffer();
+ sb.append(DELIVERY_ACK_ID).append(original.getMessageId()).append(DELIVERY_ACK_SUB).append("001") + .append(DELIVERY_ACK_DLVRD).append("001").append(DELIVERY_ACK_SUBMIT_DATE) + .append(DELIVERY_ACK_DATE_FORMAT.format(original.getSubmitDate())).append(DELIVERY_ACK_DONE_DATE) + .append(DELIVERY_ACK_DATE_FORMAT.format(new Timestamp(System.currentTimeMillis()))) + .append(DELIVERY_ACK_STAT).append(DELIVERY_ACK_STATE_UNDELIVERABLE).append(DELIVERY_ACK_ERR)
+                                       .append("001").append(DELIVERY_ACK_TEXT)
+                                       
.append(this.getFirst20CharOfSMS(original.getShortMessage()));
+
+ byte[] textBytes = CharsetUtil.encode(sb.toString(), CharsetUtil.CHARSET_GSM);
+
+                       deliveryReport.setShortMessage(textBytes);
+                       deliveryReport.setEsmClass(ESME_DELIVERY_ACK);
+
+ NullActivity nullActivity = this.sbbContext.getNullActivityFactory().createNullActivity();
+                       ActivityContextInterface nullActivityContextInterface = 
this.sbbContext
+ .getNullActivityContextInterfaceFactory().getActivityContextInterface(nullActivity);
+
+ this.fireSendDeliveryReportSms(deliveryReport, nullActivityContextInterface, null);
+               }
+       }
+
+       protected void sendSuccessDeliverSmToEsms(SmsEvent original) {
+               // TODO check if SmppSession available for this SystemId, if 
not send to
+               // SnF module
+
+               byte registeredDelivery = original.getRegisteredDelivery();
+
+               // Send Delivery Receipt only if requested
+               if 
(SmppUtil.isSmscDeliveryReceiptRequested(registeredDelivery)) {
+                       SmsEvent deliveryReport = new SmsEvent();
+                       deliveryReport.setSourceAddr(original.getDestAddr());
+                       
deliveryReport.setSourceAddrNpi(original.getDestAddrNpi());
+                       
deliveryReport.setSourceAddrTon(original.getDestAddrTon());
+
+                       deliveryReport.setDestAddr(original.getSourceAddr());
+                       
deliveryReport.setDestAddrNpi(original.getSourceAddrNpi());
+                       
deliveryReport.setDestAddrTon(original.getSourceAddrTon());
+
+                       // Setting SystemId as null, so RxSmppServerSbb 
actually tries to
+                       // find real SmppServerSession from Destination TON, 
NPI and address
+                       // range
+                       deliveryReport.setSystemId(null);
+
+                       deliveryReport.setSubmitDate(original.getSubmitDate());
+
+                       deliveryReport.setMessageId(original.getMessageId());
+
+                       StringBuffer sb = new StringBuffer();
+ sb.append(DELIVERY_ACK_ID).append(original.getMessageId()).append(DELIVERY_ACK_SUB).append("001") + .append(DELIVERY_ACK_DLVRD).append("001").append(DELIVERY_ACK_SUBMIT_DATE) + .append(DELIVERY_ACK_DATE_FORMAT.format(original.getSubmitDate())).append(DELIVERY_ACK_DONE_DATE) + .append(DELIVERY_ACK_DATE_FORMAT.format(new Timestamp(System.currentTimeMillis()))) + .append(DELIVERY_ACK_STAT).append(DELIVERY_ACK_STATE_DELIVERED).append(DELIVERY_ACK_ERR)
+                                       .append("000").append(DELIVERY_ACK_TEXT)
+                                       
.append(this.getFirst20CharOfSMS(original.getShortMessage()));
+
+ byte[] textBytes = CharsetUtil.encode(sb.toString(), CharsetUtil.CHARSET_GSM);
+
+                       deliveryReport.setShortMessage(textBytes);
+                       deliveryReport.setEsmClass(ESME_DELIVERY_ACK);
+
+ NullActivity nullActivity = this.sbbContext.getNullActivityFactory().createNullActivity();
+                       ActivityContextInterface nullActivityContextInterface = 
this.sbbContext
+ .getNullActivityContextInterfaceFactory().getActivityContextInterface(nullActivity);
+
+ this.fireSendDeliveryReportSms(deliveryReport, nullActivityContextInterface, null);
+               }
+       }
+
+       private String getFirst20CharOfSMS(byte[] rawSms) {
+               String first20CharOfSms = new String(rawSms);
+               if (first20CharOfSms.length() > 20) {
+                       first20CharOfSms = first20CharOfSms.substring(0, 20);
+               }
+               return first20CharOfSms;
+       }
 }
=======================================
--- /core/slee/services/mtsbb/src/main/java/org/mobicents/smsc/slee/services/mt/MtSbb.java Thu Jul 12 06:18:52 2012 +++ /core/slee/services/mtsbb/src/main/java/org/mobicents/smsc/slee/services/mt/MtSbb.java Sun Aug 12 05:35:01 2012
@@ -5,7 +5,6 @@

 import javax.slee.ActivityContextInterface;
 import javax.slee.EventContext;
-import javax.slee.nullactivity.NullActivity;

 import org.mobicents.protocols.ss7.indicator.NatureOfAddress;
 import org.mobicents.protocols.ss7.indicator.NumberingPlan;
@@ -38,34 +37,10 @@
 import org.mobicents.slee.resource.map.events.ErrorComponent;
 import org.mobicents.smsc.slee.services.smpp.server.events.SmsEvent;

-import com.cloudhopper.commons.charset.CharsetUtil;
-import com.cloudhopper.smpp.SmppConstants;
-
 public abstract class MtSbb extends MtCommonSbb {

        private static final String className = "MtSbb";

-       private static final byte ESME_DELIVERY_ACK = 0x08;
-
-       private static final String DELIVERY_ACK_ID = "id:";
-       private static final String DELIVERY_ACK_SUB = " sub:";
-       private static final String DELIVERY_ACK_DLVRD = " dlvrd:";
-       private static final String DELIVERY_ACK_SUBMIT_DATE = " submit date:";
-       private static final String DELIVERY_ACK_DONE_DATE = " done date:";
-       private static final String DELIVERY_ACK_STAT = " stat:";
-       private static final String DELIVERY_ACK_ERR = " err:";
-       private static final String DELIVERY_ACK_TEXT = " text:";
-
-       private static final String DELIVERY_ACK_STATE_DELIVERED = "DELIVRD";
-       private static final String DELIVERY_ACK_STATE_EXPIRED = "EXPIRED";
-       private static final String DELIVERY_ACK_STATE_DELETED = "DELETED";
-       private static final String DELIVERY_ACK_STATE_UNDELIVERABLE = 
"UNDELIV";
-       private static final String DELIVERY_ACK_STATE_ACCEPTED = "ACCEPTD";
-       private static final String DELIVERY_ACK_STATE_UNKNOWN = "UNKNOWN";
-       private static final String DELIVERY_ACK_STATE_REJECTED = "REJECTD";
-
- private final SimpleDateFormat DELIVERY_ACK_DATE_FORMAT = new SimpleDateFormat("yyMMddHHmm");
-
        private MAPApplicationContext mtFoSMSMAPApplicationContext = null;

        public MtSbb() {
@@ -136,25 +111,30 @@
                        this.logger.info("Received MT_FORWARD_SHORT_MESSAGE_RESPONSE 
= " + evt);
                }

- EventContext nullActivityEventContext = this.getNullActivityEventContext();
-               SmsEvent smsEvent = null;
-               try {
-                       smsEvent = (SmsEvent) 
nullActivityEventContext.getEvent();
-
-                       // TODO : check for ESME or Mt delivery Ack. Is this 
best way?
-                       if (smsEvent.getSystemId() != null) {
-                               handleDeliveryReportSms(smsEvent);
+               SmsEvent smsEvent = this.getOriginalSmsEvent();
+               if (smsEvent != null) {
+                       try {
+                               if (smsEvent.getSystemId() != null) {
+                                       sendSuccessDeliverSmToEsms(smsEvent);
+                               } else {
+                                       //TODO : This is destined for Mobile 
user, send SMS-STATUS-REPORT
+                               }
+                       } catch (Exception e) {
+                               this.logger.severe(
+ String.format("Exception while trying to send Delivery Report for SmsEvent=%s", smsEvent), e);
                        }
-               } catch (Exception e) {
-                       this.logger.severe(
- String.format("Exception while trying to send Delivery Report for SmsEvent=%s", smsEvent), e);
                }

-               aci.detach(this.sbbContext.getSbbLocalObject());
-
- MtActivityContextInterface mtSbbActivityContextInterface = this.asSbbActivityContextInterface(this
-                               
.getNullActivityEventContext().getActivityContextInterface());
- this.resumeNullActivityEventDelivery(mtSbbActivityContextInterface, this.getNullActivityEventContext());
+               // Amit (12 Aug 2012): this is also done in onDialogRelease why 
repeat
+               // here?
+
+               //aci.detach(this.sbbContext.getSbbLocalObject());
+
+               // MtActivityContextInterface mtSbbActivityContextInterface =
+               // this.asSbbActivityContextInterface(this
+               // 
.getNullActivityEventContext().getActivityContextInterface());
+               // 
this.resumeNullActivityEventDelivery(mtSbbActivityContextInterface,
+               // this.getNullActivityEventContext());
        }

        /**
@@ -225,16 +205,6 @@
                }

        }
-
-       /**
-        * Fire SmsEvent
-        *
-        * @param event
-        * @param aci
-        * @param address
-        */
- public abstract void fireSendDeliveryReportSms(SmsEvent event, ActivityContextInterface aci,
-                       javax.slee.Address address);

        /**
         * Private Methods
@@ -261,61 +231,5 @@
return new AddressFieldImpl(TypeOfNumber.getInstance(ton), NumberingPlanIdentification.getInstance(npi),
                                address);
        }
-
-       private void handleDeliveryReportSms(SmsEvent original) {
-               // TODO check if SmppSession available for this SystemId, if 
not send to
-               // SnF module
-
-               byte registeredDelivery = original.getRegisteredDelivery();
-
-               // Send Delivery Receipt only if requested
- if ((registeredDelivery & SmppConstants.REGISTERED_DELIVERY_SMSC_RECEIPT_MASK) == SmppConstants.REGISTERED_DELIVERY_SMSC_RECEIPT_REQUESTED) {
-                       SmsEvent deliveryReport = new SmsEvent();
-                       deliveryReport.setSourceAddr(original.getDestAddr());
-                       
deliveryReport.setSourceAddrNpi(original.getDestAddrNpi());
-                       
deliveryReport.setSourceAddrTon(original.getDestAddrTon());
-
-                       deliveryReport.setDestAddr(original.getSourceAddr());
-                       
deliveryReport.setDestAddrNpi(original.getSourceAddrNpi());
-                       
deliveryReport.setDestAddrTon(original.getSourceAddrTon());
-
-                       // Setting SystemId as null, so RxSmppServerSbb 
actually tries to
-                       // find real SmppServerSession from Destination TON, 
NPI and address
-                       // range
-                       deliveryReport.setSystemId(null);
-
-                       deliveryReport.setSubmitDate(original.getSubmitDate());
-
-                       deliveryReport.setMessageId(original.getMessageId());
-
-                       StringBuffer sb = new StringBuffer();
- sb.append(DELIVERY_ACK_ID).append(original.getMessageId()).append(DELIVERY_ACK_SUB).append("001") - .append(DELIVERY_ACK_DLVRD).append("001").append(DELIVERY_ACK_SUBMIT_DATE) - .append(DELIVERY_ACK_DATE_FORMAT.format(original.getSubmitDate())).append(DELIVERY_ACK_DONE_DATE) - .append(DELIVERY_ACK_DATE_FORMAT.format(new Timestamp(System.currentTimeMillis()))) - .append(DELIVERY_ACK_STAT).append(DELIVERY_ACK_STATE_DELIVERED).append(DELIVERY_ACK_ERR)
-                                       .append("000").append(DELIVERY_ACK_TEXT)
-                                       
.append(this.getFirst20CharOfSMS(original.getShortMessage()));
-
- byte[] textBytes = CharsetUtil.encode(sb.toString(), CharsetUtil.CHARSET_GSM);
-
-                       deliveryReport.setShortMessage(textBytes);
-                       deliveryReport.setEsmClass(ESME_DELIVERY_ACK);
-
- NullActivity nullActivity = this.sbbContext.getNullActivityFactory().createNullActivity();
-                       ActivityContextInterface nullActivityContextInterface = 
this.sbbContext
- .getNullActivityContextInterfaceFactory().getActivityContextInterface(nullActivity);
-
- this.fireSendDeliveryReportSms(deliveryReport, nullActivityContextInterface, null);
-               }
-       }
-
-       String getFirst20CharOfSMS(byte[] rawSms) {
-               String first20CharOfSms = new String(rawSms);
-               if (first20CharOfSms.length() > 20) {
-                       first20CharOfSms = first20CharOfSms.substring(0, 20);
-               }
-               return first20CharOfSms;
-       }

 }
=======================================
--- /core/slee/services/mtsbb/src/main/resources/META-INF/sbb-jar.xml Wed Jul 11 07:19:19 2012 +++ /core/slee/services/mtsbb/src/main/resources/META-INF/sbb-jar.xml Sun Aug 12 05:35:01 2012
@@ -38,6 +38,15 @@
                                </sbb-activity-context-interface-name>
                        </sbb-activity-context-interface>
                </sbb-classes>
+
+               <event event-direction="Fire">
+                       <event-name>SendDeliveryReportSms</event-name>
+                       <event-type-ref>
+ <event-type-name>org.mobicents.smsc.slee.services.smpp.server.events.DELIVER_SM</event-type-name>
+                               
<event-type-vendor>org.mobicents</event-type-vendor>
+                               <event-type-version>1.0</event-type-version>
+                       </event-type-ref>
+               </event>

                <event event-direction="Receive" initial-event="True">
                        <event-name>Sms</event-name>
=======================================
--- /test/bootstrap/pom.xml     Thu Apr 26 01:25:46 2012
+++ /test/bootstrap/pom.xml     Sun Aug 12 05:35:01 2012
@@ -24,7 +24,7 @@
                        <groupId>org.mobicents.smsc</groupId>
                        <artifactId>test-oam</artifactId>
                        <version>${pom.version}</version>
-               </dependency>
+               </dependency>

                <dependency>
                        <groupId>urbanophile</groupId>
@@ -56,6 +56,39 @@
                        <groupId>org.jboss.aop</groupId>
                        <artifactId>jboss-aop</artifactId>
                </dependency>
+
+               <!-- SS7 CLI -->
+
+               <!-- jreadline -->
+               <dependency>
+                       <groupId>org.jboss.jreadline</groupId>
+                       <artifactId>jreadline</artifactId>
+                       <version>0.17</version>
+                       <scope>runtime</scope>
+               </dependency>
+
+               <!-- M3UA CLI -->
+               <dependency>
+                       <groupId>org.mobicents.protocols.ss7.m3ua</groupId>
+                       <artifactId>m3ua-cli-sctp</artifactId>
+                       <version>${ss7.version}</version>
+                       <scope>runtime</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.mobicents.protocols.ss7.m3ua</groupId>
+                       <artifactId>m3ua-cli-m3ua</artifactId>
+                       <version>${ss7.version}</version>
+                       <scope>runtime</scope>
+               </dependency>
+
+               <!-- SCCP CLI -->
+               <dependency>
+                       <groupId>org.mobicents.protocols.ss7.sccp</groupId>
+                       <artifactId>sccp-cli</artifactId>
+                       <version>${ss7.version}</version>
+                       <scope>runtime</scope>
+               </dependency>
+
        </dependencies>

        <!-- -->
=======================================
--- /test/bootstrap/src/main/assembly/descriptor.xml Sat Jul 7 02:48:18 2012 +++ /test/bootstrap/src/main/assembly/descriptor.xml Sun Aug 12 05:35:01 2012
@@ -5,40 +5,54 @@
        </formats>
        <includeBaseDirectory>false</includeBaseDirectory>

+       <fileSets>
+               <fileSet>
+                       <directory>src/main/config/data</directory>
+                       <outputDirectory>data</outputDirectory>
+                       <includes>
+                               <include>*.xml</include>
+                       </includes>
+               </fileSet>
+       </fileSets>
+
        <files>
                <file>
                        <source>src/main/config/run.bat</source>
+                       <fileMode>0744</fileMode>
                        <destName>bin/run.bat</destName>
                </file>
                <file>
                        <source>src/main/config/run.sh</source>
+                       <fileMode>0744</fileMode>
                        <destName>bin/run.sh</destName>
                </file>
                <file>
-                       <source>src/main/config/ss7-run.bat</source>
-                       <destName>bin/ss7-run.bat</destName>
+                       <source>src/main/config/ss7-cli.bat</source>
+                       <fileMode>0744</fileMode>
+                       <destName>bin/ss7-cli.bat</destName>
                </file>
                <file>
-                       <source>src/main/config/ss7-run.sh</source>
-                       <destName>bin/ss7-run.sh</destName>
+                       <source>src/main/config/ss7-cli.sh</source>
+                       <fileMode>0744</fileMode>
+                       <destName>bin/ss7-cli.sh</destName>
                </file>
        </files>
        <dependencySets>
                <dependencySet>
-                       <outputDirectory>/bin</outputDirectory>
-                       
<outputFileNameMapping>${artifact.artifactId}.${artifact.extension}
+                       <outputDirectory>/lib</outputDirectory>
+                       <outputFileNameMapping>mobicents-ss7-shell.jar
                        </outputFileNameMapping>
-                       <unpack>false</unpack>
-                       <scope>runtime</scope>
                        <includes>
                                
<include>org.mobicents.protocols.ss7.management:shell</include>
                        </includes>
                </dependencySet>
-
                <dependencySet>
                        <outputDirectory>/lib</outputDirectory>
                        <unpack>false</unpack>
                        <scope>runtime</scope>
+                       <excludes>
+                               
<exclude>org.mobicents.protocols.ss7.management:shell</exclude>
+                       </excludes>
                        <includes>
                                <!-- SMSC libraris -->
                                
<include>org.mobicents.smsc:test-mapmodule</include>
@@ -86,8 +100,13 @@
<!-- <include>org.mobicents.protocols.ss7.hardware:mobicents-dahdi</include> -->
                                
<include>org.mobicents.protocols.ss7.hardware:mobicents-dialogic
                                </include>
-                               
<include>org.mobicents.protocols.ss7.congestion:congestion</include>
-
+                               
<include>org.mobicents.protocols.ss7.congestion:congestion
+                               </include>
+                               <!-- SS7 OAM Cli Libraries -->
+                               <include>org.jboss.jreadline:jreadline</include>
+                               
<include>org.mobicents.protocols.ss7.m3ua:m3ua-cli-sctp</include>
+                               
<include>org.mobicents.protocols.ss7.m3ua:m3ua-cli-m3ua</include>
+                               
<include>org.mobicents.protocols.ss7.sccp:sccp-cli</include>
                        </includes>
                </dependencySet>
        </dependencySets>
=======================================
--- /test/mapmodule/src/main/java/org/mobicents/smsc/ihub/MAPListener.java Tue May 8 08:35:43 2012 +++ /test/mapmodule/src/main/java/org/mobicents/smsc/ihub/MAPListener.java Sun Aug 12 05:35:01 2012
@@ -1,5 +1,7 @@
 package org.mobicents.smsc.ihub;

+import java.util.concurrent.atomic.AtomicLong;
+
 import org.apache.log4j.Logger;
 import org.mobicents.protocols.ss7.map.api.MAPDialog;
 import org.mobicents.protocols.ss7.map.api.MAPDialogListener;
@@ -12,6 +14,7 @@
 import org.mobicents.protocols.ss7.map.api.dialog.MAPRefuseReason;
 import org.mobicents.protocols.ss7.map.api.dialog.MAPUserAbortChoice;
 import org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessage;
+import org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessageFactory;
 import org.mobicents.protocols.ss7.map.api.primitives.AddressNature;
 import org.mobicents.protocols.ss7.map.api.primitives.AddressString;
 import org.mobicents.protocols.ss7.map.api.primitives.IMSI;
@@ -51,8 +54,14 @@

        private MAPSimulator iHubManagement = null;

+       private final AtomicLong mapMessagesReceivedCounter = new AtomicLong(0);
+       private long currentMapMessageCount = 0;
+
+       private final MAPErrorMessageFactory mAPErrorMessageFactory;
+
        protected MAPListener(MAPSimulator iHubManagement) {
                this.iHubManagement = iHubManagement;
+ this.mAPErrorMessageFactory = this.iHubManagement.getMapProvider().getMAPErrorMessageFactory();
        }

        /**
@@ -106,7 +115,7 @@
        @Override
public void onDialogRequest(MAPDialog arg0, AddressString arg1, AddressString arg2, MAPExtensionContainer arg3) {
                // TODO Auto-generated method stub
-
+ this.currentMapMessageCount = this.mapMessagesReceivedCounter.incrementAndGet();
        }

        @Override
@@ -201,9 +210,9 @@
                if (logger.isDebugEnabled()) {
                        logger.debug("Rx : 
MoForwardShortMessageRequestIndication=" + request);
                }
-
-               // Lets first close the Dialog
+
                MAPDialogSms dialog = request.getMAPDialog();
+
                try {
                        // TODO Should we add PENDING SMS TPDU here itself?
dialog.addMoForwardShortMessageResponse(request.getInvokeId(), null, null);
@@ -246,13 +255,30 @@
                        logger.info("Rx : onMtForwardShortMessageIndication=" + 
event);
                }

+               // Lets first close the Dialog
                MAPDialogSms mapDialogSms = event.getMAPDialog();
-               try {
- mapDialogSms.addMtForwardShortMessageResponse(event.getInvokeId(), null, null);
-                       mapDialogSms.close(false);
-               } catch (MAPException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
+
+               System.err.println("\n" + this.currentMapMessageCount + "\n");
+
+               if (this.currentMapMessageCount % 7 == 0) {
+                       // Send back AbsentSubscriber for every 7th MtSMS
+                       try {
+ MAPErrorMessage mapErrorMessage = mAPErrorMessageFactory.createMAPErrorMessageAbsentSubscriberSM(1,
+                                               null, null);
+                               
mapDialogSms.sendErrorComponent(event.getInvokeId(), mapErrorMessage);
+                               mapDialogSms.close(false);
+                       } catch (MAPException e) {
+ logger.error("Error while sending MAPErrorMessageAbsentSubscriberSM ", e);
+                       }
+               } else {
+
+                       try {
+ mapDialogSms.addMtForwardShortMessageResponse(event.getInvokeId(), null, null);
+                               mapDialogSms.close(false);
+                       } catch (MAPException e) {
+                               // TODO Auto-generated catch block
+                               e.printStackTrace();
+                       }
                }
        }

=======================================
--- /test/mapmodule/src/main/java/org/mobicents/smsc/ihub/MAPSimulator.java Thu Apr 26 01:25:46 2012 +++ /test/mapmodule/src/main/java/org/mobicents/smsc/ihub/MAPSimulator.java Sun Aug 12 05:35:01 2012
@@ -5,7 +5,7 @@
 import org.mobicents.protocols.ss7.sccp.impl.SccpStackImpl;

 public class MAPSimulator {
-
+
        // MAP
        private MAPStackImpl mapStack;
        private MAPProvider mapProvider;
@@ -57,5 +57,9 @@
        public void stop() {
                this.mapStack.stop();
        }
+
+       protected MAPProvider getMapProvider() {
+               return mapProvider;
+       }

 }

Reply via email to