final String ussdMessageType = req.getHeader(MchoiceUssdMessage.USSD_MESSAGE_TYPE);
final Gson gson = new Gson();
final ServletInputStream inputStream = req.getInputStream();
if (MchoiceUssdMessage.USSD_MESSAGE.equals(ussdMessageType)) {
final UssdAtRequestMessage atRequestMessage = gson.fromJson(readBody(inputStream), UssdAtRequestMessage.class);
atRequestMessage.setShortcode(req.getHeader("X-Requested-Shortcode"));
atRequestMessage.setVersion(req.getHeader(MchoiceUssdMessage.REQUEST_VERSION));
atRequestMessage.setConversationId(req.getHeader(MchoiceUssdMessage.CONVERSATION));
onMessage(atRequestMessage);
} else if (MchoiceUssdMessage.USSD_TERMINATE_MESSAGE.equals(ussdMessageType)) {
final UssdTerminateMessage message = gson.fromJson(readBody(inputStream), UssdTerminateMessage.class);
message.setVersion(req.getHeader(MchoiceUssdMessage.REQUEST_VERSION));
message.setConversationId(req.getHeader(MchoiceUssdMessage.CONVERSATION));