Table of Contents

Control SMPP responses

By default, the InetLab SMPP-server dispatches SubmitSmResp commands automatically one by one after each evClientSubmitSm event handled. You may want to override this flow in order to process, save or prepare responses in a more controllable way. For example, you may like saving data to SQL in bulk instead of single “per message” transactions. Also, you may like to control the moment when responses are sent to the client.

Automatic response sending can be prevented in an event handler by changing Response field to null:

private static void onSubmitSm(object sender, SmppServerClient client, SubmitSm submitSm)
{
    SubmitSmResp generatedResp = submitSm.Response;

    //preventing response automated return
    submitSm.Response = null;

    //custom routine for the response
    Task handleTask = HandleRequestAsync(submitSm);
}

private static async Task HandleRequestAsync(SubmitSm submitSm)
{
    //Generating and sending response manually
    SmppServerClient client = submitSm.Client as SmppServerClient;
    var response = new SubmitSmResp(submitSm);
    await client.SendResponseAsync(response);
}

In the example above, we prevent auto-response by setting submitSm.Response field to null. Then we call a method and supply it with SubmitSm data. The method generates and submits a response to the client.