Inbound message handler

Inbound Message Handler handles the incoming message from gateway, then decodes and transforms the message information into BTT Channel Context which is shared within channel handler. It supports multiple Inbound Handler instances of same Handler class for different SMS gateways, and each Inbound Handler has independent configuration for different gateway species. Following is the Inbound Message Handler configuration:

Parameter names configuration:

Following is an example for Inbound Message Handler configuration in application/x-www-form-urlencoded type:

Example of HTTP content in application/www-form-urlencoded type:

http://yourserver:port/webPrjName/servletName?receiver=+8613980949473&sender=13651033060&msgid=111&msgdata=FT user01 payee01 399.99>

Example of Inbound Handler Configuration:

<com.ibm.btt.channel.sms.config.InboundHandlerConfiguration
id="formInbound" xmlHttp="false" encoding="utf-8"
presentationHandler="com.ibm.btt.test.ExtendPresentationHandler">
  <com.ibm.btt.channel.sms.config.ParameterNames
Injection="parameterNames" messageParamName="msgdata"
fromParamName="sender" messageIDParamName="msgid" toParamName="receiver"/>
  <ref Injection="smsCommands" refId="SMSCommandTable"/>
  <ref Injection="replyMsgOutboundHandler" refId=" formoutbound"/>
  <map Injection="selfDefineParameters">
    <entry key="messagetype" value="SMS:TEXT"></entry>
  </map>
</com.ibm.btt.channel.sms.config.InboundHandlerConfiguration>

Following is an example for Inbound Message Handler configuration in xml/text type:

Example of HTTP content in xml/text type:

<MORequest>
	<Servicio>20500.personal.ar</Servicio>
	<MSISDN>13901398888</MSISDN>
	<IdTransaccion>12345678</IdTransaccion>
	<Contenido>FT user01 payee01 344.5</Contenido>
	<HashCheck>xxxx….xxxx</HashCheck>
</MORequest>

Example of Inbound Handler Configuration:

<com.ibm.btt.channel.sms.config.InboundHandlerConfiguration
id="xmlInbound" xmlHttp="true"
presentationHandler="com.ibm.btt.test.MovilgatePresentationHandler">
  <com.ibm.btt.channel.sms.config.ParameterNames Injection="parameterNames" messageParamName="Contenido" 
fromParamName="MSISDN" messageIDParamName="IdTransaccion"/>	   <ref Injection="smsCommands" refId="SMSCommandTable"/>
  <ref Injection="replyMsgOutboundHandler" refId="xmlOutbound"/>		   
  <map Injection="selfDefineParameters">
    <entry key="Servicio"></entry>
    <entry key="HashCheck"></entry>		  	
</map>				 
</com.ibm.btt.channel.sms.config.InboundHandlerConfiguration>
Note: in the xml/text type, the value xmlHttp is set to true, and the value presentationHandler is set as the extension presentation handler implementation class. In this example, the implementation class is com.ibm.btt.test.MovilgatePresentationHandler, which is introduced in Presentation handler. Inbound Message Handler is implemented as a Servlet that will be called by SMS gateway when new message arrived.

The URL parameter of the Servlet is set in the SMS gateway configuration as shown in the following example:

http://yourserver:port/webPrjName/servletName?receiver=+8613980949473&sender=13651033060&msgid=111&msgdata=FT user01 payee1 399.99>
Note: the value of the field in parameterNames should be mapped correctly with the inbound servlet URL parameter name of the SMS gateway.

The Inbound Message Handler Servlet should be configured in file web.xml of the web project. The Inbound Handler configuration file is set as servlet init-param configFile, and the Id is set as servlet init-param inboundConfigID. For example:

<servlet>
  <servlet-name>FormInboundMessageHandler</servlet-name>
  <servlet-class>com.ibm.btt.channel.sms.inbound.BTTInboundMessageHandler</servlet-class>
    <init-param>
      <description> Configuration File path</description>
      <param-name>configFile</param-name>
      <param-value>jar:///com/ibm/btt/test/SMSHandlerConfig.xml</param-value>
    </init-param>
    <init-param>
      <description> ID of Inbound handler configuration defined config file </description>
      <param-name>inboundConfigID</param-name>
      <param-value>formInbound</param-value>
    </init-param>
</servlet><servlet-mapping>
  <servlet-name>FormInboundMessageHandler</servlet-name>
  <url-pattern>/FormInboundMessageHandler</url-pattern>
</servlet-mapping>