Skip to main content

Developing Applications for the SMPP ESME

Last updated March 2020

This section describes the details for implementing SMPP hooks. The SMPP hooks for an MO message are invoked in the following order:

  1. SMPP MO PDU Evaluation Hook (for normal MO only)

  2. SMPP Delivery Report Evaluation Hook (for delivery reports only)

  3. SMPP MO Conversion Hook

  4. SMPP Received Message Validation Hook (validate_data_spool_each_rcpt())

The SMPP hooks for an MT message are invoked in the following order:

  1. SMPP MT Conversion Hook

  2. SMPP MT PDU Evaluation Hook (for submission only)

  3. SMPP Submit Response Hook (a chance to access both the submit resp and original ec_message)

**SMPP Hook Points. ** The SMPP hook points are as follows

SMPP Logging Hook Points

Mobile Momentum utilizes the extensible logging infrastructure provided by core Momentum ( to provide customer flexibility to implement their own logging system for mobile messages. As with other Momentum modules such as SMTP, MM7, the following logger hooks are available for logging SMPP messages at different phases:

All SMPP logger hooks have a reference to an smpp_conn structure and an ec_message as input. Hooks can access any data structures and context variables stored in the smpp_conn and ec_message for their logging purpose.

The smpp_conn structure is defined below:

typedef struct _smpp_conn {
  message_id id;
  struct smpp_state * state;
  Event * fd_event;
  Event * enquire_link_timer;
  Event * death;
  connection_handle * ec_connh;
  int bind_retries;
  char *error;
  struct timeval create_time;
  char peer_interface_version;
  char outbind_password[SMPP_MAX_PASSWORD_LEN+1];
  char peer_system_id[SMPP_MAX_SYSTEM_ID_LEN+1];
  char domain_name[MAXDOMAINNAME+1];

  /* inbound state */
  unsigned int in_pending_len;
  string * in_pending_buf;
  event_io_state in_io_state;
  ec_hash_table sar_states; //tbd: note this will not handle 
  // incoming segments across connections
  ec_hash_table batch_ec_messages;
  unsigned int consecutive_error_count;
  unsigned long mo_conversions;

  /* outbound state */
  unsigned long out_seqnum;
  event_io_state out_io_state;
  ec_hash_table requests_awaiting_response;
  ec_hash_table pending_ec_messages;
  ec_double_list mt_messages_to_send;
  ec_double_list pdus_delayed;
  ec_atomic_t refs;
  unsigned long mt_conversions;
  ec_message *mt_message_in_progress;

  /* time to allow sending again */
  struct timeval throttled_timeout_time; /* set this param when receive SMPP_ESME_RTHROTTLED */
} smpp_conn;

The following ec_message context variables are significant to SMPP and available to hooks with ec_message input:

Context Key NameCorresponding configuration optionDescription
SMS_Data_CodingSMPP_SMS_Data_Codingdata coding for SMS MT
SMS_Destination_FlagSMPP_Destination_Flagthe destination address type to be used in SUBMIT_MULTI: 1 for SME address; 2 for distribution list name.
SMS_Destination_Address destination_addr in SMS MT
SMS_Destination_NPISMPP_Destination_Numbering_Plandst_addr_npi in SMS MT
SMS_Destination_TONSMPP_Destination_Type_Of_Numberdst_addr_ton in SMS MT
SMS_Source_Address source_addr in SMS MT
SMS_Source_NPISMPP_ESME_Numbering_Plansrc_addr_npi in SMS MT
SMS_Source_TONSMPP_ESME_Type_Of_Numbersrc_addr_ton in SMS MT
SMS_Registered_DeliverySMPP_Registered_DeliveryThis value will be set to the registered_delivery parameter in SMS MT to request an SMSC delivery receipt and/or SME originated acknowledgement.
MO_Email_From_Address a source email address to be used during SMS-to-email translation
MO_Email_To_Address a destination email address to be used during SMS-to-email translation
MO_Email_Subject email subject to be used during SMS-to-email translation
MO_Email_Data_Coding email data coding during SMS-to-email conversion
SMS_Text SMS text message after email-to-SMS conversion
MO_Email_Text email text after SMS-to-email conversion
#total_segs total SMS segments after email-to-SMS conversion
#dr_latency latency (time difference between a MT submission and reception of corresponding delivery receipt) in seconds
#mess_stat string description of message_state in delivery receipt
#mess_id message_id in delivery receipt
#mess_type string description of ems_class in delivery receipt
customer TLV name value will be used to set the customer defined optional TLV

The following table relates the context key name to the "#define" name:

Context Key Name"#define" name
customer TLV name 
Was this page helpful?