| 31 | }; |
| 32 | |
| 33 | int |
| 34 | msg_callback_add(struct sip_msg *msg, cb_type_t cb_type, cb_func_t cb_func, void *cb_arg) |
| 35 | { |
| 36 | struct msg_callback *msg_cb; |
| 37 | |
| 38 | switch (cb_type) { |
| 39 | case REQ_PRE_FORWARD: |
| 40 | if (msg->first_line.type == SIP_REQUEST) |
| 41 | break; |
| 42 | LM_ERR("programmatic error - REQ_PRE_FORWARD can only be registered on requests!"); |
| 43 | return (-1); |
| 44 | |
| 45 | default: |
| 46 | break; |
| 47 | } |
| 48 | |
| 49 | msg_cb = pkg_malloc(sizeof(*msg_cb)); |
| 50 | if (msg_cb == NULL) { |
| 51 | LM_ERR("can't allocate memory\n"); |
| 52 | return (-1); |
| 53 | } |
| 54 | msg_cb->cb_type = cb_type; |
| 55 | msg_cb->cb_func = cb_func; |
| 56 | msg_cb->cb_arg = cb_arg; |
| 57 | msg_cb->next = msg->msg_cb; |
| 58 | msg->msg_cb = msg_cb; |
| 59 | return 0; |
| 60 | } |
| 61 | |
| 62 | void |
| 63 | msg_callback_process(struct sip_msg *msg, cb_type_t cb_type, void *core_arg) |
no outgoing calls
no test coverage detected