SmppServerRa - ActivityIsEndingException

53 views
Skip to first unread message

Armache Antoni

unread,
Mar 10, 2020, 5:22:04 AM3/10/20
to mobicents-public
Dear All,

I trust this message finds you well and safe, for the past few days i tried to solve this issues but i am still receiving ActivityIsEndingException when firing the method
sendResponsePdu(esme, PduRequest, PduResponse).

Mainly i am forwarding an sms from Esme1 to Esme2.

////////////////////////////////////////////////////////////////////////////////////////////////////////

I tried to change my code and use this example where by they making use of (Asynchronous method)


and the output was something like this:

public void onSUBMIT_SM(com.cloudhopper.smpp.pdu.SubmitSm event,
            ActivityContextInterface aci/* , EventContext eventContext */) {

            EsmeManagement esmeManagement = EsmeManagement.getInstance();
            Esme esmeGo= esmeManagement.getEsmeByClusterName("simu");
         
            this.smppLevelSession = esmeGo.getSmppSession();
                   
            WindowFuture<Integer, PduRequest, PduResponse> future1 = this.smppLevelSession
                    .sendRequestPdu(event, 10000, true);
            // while (!future1.isDone()) {}
            if (!future1.await()) {
                log.error("Failed to receive enquire_link_resp within specified time");
            } else if (future1.isSuccess()) {
                SubmitSmResp resp = (SubmitSmResp) future1.getResponse();
                this.smppServerSessions.sendResponsePdu(inEsme, event, resp);
            } else {
                log.error("Failed to properly receive resp: " + future1.getCause());
            }
           
}

With this code everything is working perfectly i am able to receive SubmitSm from Esme1 and forward to Esme2, and i am able to receive SubmitSmResponse from Esme2 and forward it to Esme1.
 
/////////////////////////////////////////////////////////////////////////////////////////////////////

But my supervisor told me this is not efficient because it is BLOCKING the messages and it contains timer to handle responses, which is not good. He told me to revert back to the old code and sort it out.......

/////////////////////////////////////////////////////////////////////////////////////////////////////

This is the old code which is throwing error : ActivityIsEndingException

public void onSUBMIT_SM(com.cloudhopper.smpp.pdu.SubmitSm event,
            ActivityContextInterface aci/* , EventContext eventContext */) {

        // Incoming Esme
        SmppTransaction smppServerTransaction = (SmppTransaction) aci.getActivity();
        Esme inEsme = smppServerTransaction.getEsme();
        ObjectEsme objectEsme = new ObjectEsme(inEsme);

        //CMP Fields for Esme
        this.setObjEsme(objectEsme);

       //CMP Fields for SubmitSm
        ObjectSubmitSm objectSubmitSm = new ObjectSubmitSm(event);
        this.setObjSubmit(objectSubmitSm);

        // Response Block
        SubmitSmResp submitRes = event.createResponse();

        // Outgoing Esme
        EsmeManagement esmeManagement = EsmeManagement.getInstance();
        Esme outEsme = esmeManagement.getEsmeByClusterName("simu");
           
        if (outEsme == null || outEsme.isClosed() || !outEsme.isBound()) {

                        log.info(" Message will not be forwaded: ESMEisFAILURE: " + outEsme);
                        submitRes.setMessageId(Byte.toString(event.getDefaultMsgId()));
                        submitRes.setCommandStatus(SmppConstants.STATUS_SUBMITFAIL);
                        this.smppServerSessions.sendResponsePdu(inEsme, event, submitRes);
                        return;
        }

        log.info(" Message will be forwaded: successfully");
        SmppTransaction submitTxn = this.smppServerSessions.sendRequestPdu(outEsme, event,
        outEsme.getWindowWaitTimeout());
      
        // attach to the new activity so we get the response from event [SubmitSMResp]
        ActivityContextInterface newaci = this.smppServerTransactionACIFactory
        .getActivityContextInterface(submitTxn);
        newaci.attach(this.sbbContext.getSbbLocalObject());   
           
}


public void onSUBMIT_SM_RESP(com.cloudhopper.smpp.pdu.SubmitSmResp event,
            ActivityContextInterface aci/* , EventContext eventContext */) {

        // When i execute this code jainslee is throwing an error saying Activity already Ended on Outgoing dialog!       
        this.smppServerSessions.sendResponsePdu(this.getObjEsme().getEsme(), this.getObjSubmit().getSbmt(), event);
           
           

/////////////////////////////////////////////////////////////////////////////////////////////////////

Does anyone have a hint on how to approach this problem ?


SuccessTrace.pcap
ErrorSlee.jpg

Armache Antoni

unread,
Mar 10, 2020, 11:15:49 AM3/10/20
to mobicents-public
I have Finalllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllly


Fix this MOFFO :))))))))))))))


I changed the code on submit response and used SmppTransaction from SubmitSm and this.SmppSession.

///////////////////////////////////////////
NEW CODE

public void onSUBMIT_SM_RESP(com.cloudhopper.smpp.pdu.SubmitSmResp event,
            ActivityContextInterface aci/* , EventContext eventContext */) {

        try {

            log.info("------------- Received on Submit SM RESP ------------------- Trans: "+ this.getObjTrans().getSmppTransaction().toString());

            Esme inEsme = this.getObjTrans().getSmppTransaction().getEsme();
            this.smppLevelSession = inEsme.getSmppSession();
            this.smppLevelSession.sendResponsePdu(event);
                   
            log.info("--------------- Forward on Submit SM RESP ------------------- ");

         }

//////////////////////////////////////////

Ibrahima Gaye

unread,
Mar 10, 2020, 12:54:18 PM3/10/20
to mobicent...@googlegroups.com
Well done !
you are JSLEE Black Belt :D

thanks for sharing back.
regards
Ibrahima GAYE



--
You received this message because you are subscribed to the Google Groups "mobicents-public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mobicents-publ...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mobicents-public/48fe01c6-9922-40a1-9eb5-845e25ac6149%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages