Skip to main content

1require("msys.core");
2
3local mod = {};
4
5function mod:mms_log_bounce_outband(msg)
6  local status = msys.core.ec_message_context_get(msg, msys.core.ECMESS_CTX_MESS,
7    "MM7_Response_Status");
8  local local_msg_id = msys.core.ec_message_context_get(msg, msys.core.ECMESS_CTX_MESS,
9    "MM7_Original_Message_ID");
10  local remote_msg_id = msys.core.ec_message_context_get(msg, msys.core.ECMESS_CTX_MESS,
11    "MM7_Reponse_Message_ID");
12  print("sample_mm7_log_bounce_outband_hook status for message id " .. remote_msg_id .. "
13    (ec_message_id: " .. local_msg_id .. ") is: " .. status);
14end
15
16msys.registerModule("mm7_hooks_test", mod);

1#include "module.h"
2#include "modules/mobility/mms/hooks/mms_logging.h"
3#include "modules/mobility/mms/mm7.h"
4
5static void sample_mm7_log_bounce_outband_hook(void *closure, ec_message *m)
6{
7  const char* status = ec_message_context_get(m, ECMESS_CTX_MESS, "MM7_Response_Status);
8  const char* local_msg_id = ec_message_context_get(m, ECMESS_CTX_MESS,
9    "MM7_Original_Message_ID);
10  const char* remote_msg_id = ec_message_context_get(m, ECMESS_CTX_MESS,
11    "MM7_Response_Message_ID);
12  printf("sample_mm7_log_bounce_outband_hook status for message id %s (
13    ec_message_id: %s) is: %s\n", remote_msg_id, local_message_id, status);
14}
15
16static int init (generic_module_infrastructure *gself) {
17  /* register the hook during module initialization */
18  register_mms_log_bounce_outband_hook_first (sample_mm7_log_bounce_outband_hook, gself);
19  return 0;
20}
21
22EC_MODULE_EXPORT
23generic_module_infrastructure mm7_hook_test = {
24  {
25    EC_MODULE_INIT(EC_MODULE_TYPE_GENERIC, 0),
26    "mm7_hook_test.c",
27    "Sample MM7 Hook",
28    NULL,
29    NULL,
30    NULL,
31    init,
32    NULL,
33    NULL,
34    NULL,
35    NULL,
36    NULL
37  }
38};
Was this page helpful?