Revision: 55ce860795d4
Author:   [email protected] <[email protected]>
Date:     Sun Jun 17 02:00:59 2012
Log:      Fixed bugs
http://code.google.com/p/jss7/source/detail?r=55ce860795d4&repo=examples

Modified:
 /ussd/pom.xml
/ussd/src/main/java/org/mobicents/jss7/standalone/example/ussd/SctpClient.java /ussd/src/main/java/org/mobicents/jss7/standalone/example/ussd/SctpServer.java

=======================================
--- /ussd/pom.xml       Fri Jun 15 09:44:29 2012
+++ /ussd/pom.xml       Sun Jun 17 02:00:59 2012
@@ -35,7 +35,7 @@
                <commons.version>1.0.0.CR1</commons.version>
        </properties>

-       <!-- declare our babies -->
+       <!-- declare dependencies -->
        <dependencies>
                <!-- ASN -->
                <dependency>
=======================================
--- /ussd/src/main/java/org/mobicents/jss7/standalone/example/ussd/SctpClient.java Fri Jun 15 09:44:29 2012 +++ /ussd/src/main/java/org/mobicents/jss7/standalone/example/ussd/SctpClient.java Sun Jun 17 02:00:59 2012
@@ -112,7 +112,7 @@
                this.sctpManagement.setSingleThread(true);
                this.sctpManagement.setConnectDelay(10000);
                this.sctpManagement.start();
-               this.sctpManagement.removeAllResourses();
+               this.sctpManagement.removeAllResourses();

                // 1. Create SCTP Association
sctpManagement.addAssociation(CLIENT_IP, CLIENT_PORT, SERVER_IP, SERVER_PORT, CLIENT_ASSOCIATION_NAME,
@@ -125,7 +125,7 @@
                this.clientM3UAMgmt = new M3UAManagement("Client");
                this.clientM3UAMgmt.setTransportManagement(this.sctpManagement);
                this.clientM3UAMgmt.start();
-               //this.clientM3UAMgmt.removeAllResourses();
+               // this.clientM3UAMgmt.removeAllResourses();

                // m3ua as create rc <rc> <ras-name>
                RoutingContext rc = factory.createRoutingContext(new long[] { 
100l });
@@ -410,8 +410,8 @@
         */
public void onProcessUnstructuredSSResponse(ProcessUnstructuredSSResponse procUnstrResInd) {
                if (logger.isDebugEnabled()) {
- logger.debug(String.format("Rx ProcessUnstructuredSSResponseIndication. USSD String=%s",
-                                       procUnstrResInd.getUSSDString()));
+ logger.debug(String.format("Rx ProcessUnstructuredSSResponseIndication. USSD String=%s", procUnstrResInd
+                                       .getUSSDString().getString()));
                }
        }

@@ -456,9 +456,28 @@
         */
        public void onUnstructuredSSRequest(UnstructuredSSRequest unstrReqInd) {
                if (logger.isDebugEnabled()) {
- logger.debug(String.format("Rx UnstructuredSSRequestIndication. USSD String=%s ",
-                                       unstrReqInd.getUSSDString()));
-               }
+ logger.debug(String.format("Rx UnstructuredSSRequestIndication. USSD String=%s ", unstrReqInd
+                                       .getUSSDString().getString()));
+               }
+
+               MAPDialogSupplementary mapDialog = unstrReqInd.getMAPDialog();
+
+               try {
+                       byte ussdDataCodingScheme = 0x0f;
+
+ USSDString ussdString = this.mapProvider.getMAPParameterFactory().createUSSDString("1", null);
+
+ AddressString msisdn = this.mapProvider.getMAPParameterFactory().createAddressString( + AddressNature.international_number, NumberingPlan.ISDN, "31628838002");
+
+ mapDialog.addUnstructuredSSResponse(unstrReqInd.getInvokeId(), ussdDataCodingScheme, ussdString);
+                       mapDialog.send();
+
+               } catch (MAPException e) {
+ logger.error(String.format("Error while sending UnstructuredSSResponse for Dialog=%d",
+                                       mapDialog.getDialogId()));
+               }
+
        }

        /*
@@ -550,10 +569,10 @@

                try {
                        client.initializeStack(ipChannelType);
-
-                       //Lets pause for 20 seconds so stacks are initialized 
properly
+
+                       // Lets pause for 20 seconds so stacks are initialized 
properly
                        Thread.sleep(20000);
-
+
                        client.initiateUSSD();

                } catch (Exception e) {
=======================================
--- /ussd/src/main/java/org/mobicents/jss7/standalone/example/ussd/SctpServer.java Fri Jun 15 09:44:29 2012 +++ /ussd/src/main/java/org/mobicents/jss7/standalone/example/ussd/SctpServer.java Sun Jun 17 02:00:59 2012
@@ -166,6 +166,8 @@

                // 7. Start ASP
                serverM3UAMgmt.startAsp("RASP1");
+
+               logger.debug("[[[[[[[[[[    Started SctpServer       
]]]]]]]]]]");
        }

        /*
@@ -347,8 +349,8 @@
         */
public void onProcessUnstructuredSSRequest(ProcessUnstructuredSSRequest procUnstrReqInd) {
                if (logger.isDebugEnabled()) {
- logger.debug(String.format("onProcessUnstructuredSSRequestIndication for DialogId=%d", procUnstrReqInd
-                                       .getMAPDialog().getDialogId()));
+ logger.debug(String.format("onProcessUnstructuredSSRequestIndication for DialogId=%d. Ussd String=%s", + procUnstrReqInd.getMAPDialog().getDialogId(), procUnstrReqInd.getUSSDString().getString()));
                }
                try {
                        long invokeId = procUnstrReqInd.getInvokeId();
@@ -440,8 +442,8 @@
         */
        public void onUnstructuredSSResponse(UnstructuredSSResponse 
unstrResInd) {
                if (logger.isDebugEnabled()) {
- logger.debug(String.format("onUnstructuredSSResponseIndication for DialogId=%d", unstrResInd.getMAPDialog()
-                                       .getDialogId()));
+ logger.debug(String.format("onUnstructuredSSResponseIndication for DialogId=%d Ussd String=%s", unstrResInd + .getMAPDialog().getDialogId(), unstrResInd.getUSSDString().getString()));
                }
                try {
USSDString ussdStrObj = this.mapProvider.getMAPParameterFactory().createUSSDString("Your balance is 500");
@@ -527,7 +529,7 @@
        public static void main(String[] args) {
                System.out.println("*************************************");
                System.out.println("***          SctpServer           ***");
-               System.out.println("*************************************");
+               System.out.println("*************************************");
                IpChannelType ipChannelType = IpChannelType.SCTP;
                if (args.length >= 1 && args[0].toLowerCase().equals("tcp"))
                        ipChannelType = IpChannelType.TCP;

Reply via email to