[ftmod_misdn] Handle MPH_INFORMATION_IND during channel activation.

Add MISDN_MSG_DATA() helper macro for easy access to mISDN message
payload.

Add forward declaration of misdn_handle_mph_information_ind() and use
it in misdn_activate_channel().

Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
This commit is contained in:
Stefan Knoblich 2012-02-07 18:22:30 +01:00
parent 9e0928a7ea
commit fd3ebc7ae3
1 changed files with 7 additions and 0 deletions

View File

@ -91,6 +91,7 @@ typedef enum {
#define MISDN_IS_RAW(x) (x & MISDN_CAPS_RAW)
#define MISDN_IS_HDLC(x) (x & MISDN_CAPS_HDLC)
#define MISDN_MSG_DATA(x) ((void *)((unsigned char *)(x) + MISDN_HEADER_LEN))
const static struct {
const int id;
@ -199,6 +200,7 @@ struct misdn_chan_private {
#define ftdm_span_io_private(x) ((x)->io_data)
static ftdm_status_t misdn_handle_incoming(ftdm_channel_t *ftdmchan, const char *rbuf, const int size);
static int misdn_handle_mph_information_ind(ftdm_channel_t *chan, const struct mISDNhead *hh, const void *data, const int data_len);
/***********************************************************************************
* mISDN interface functions
@ -461,6 +463,11 @@ static ftdm_status_t misdn_activate_channel(ftdm_channel_t *chan, int activate)
ftdm_log_chan(chan, FTDM_LOG_DEBUG, "mISDN got '%s' echo while waiting for %s confirmation (id: %#x)\n",
misdn_event2str(hh->prim), (activate) ? "activation" : "deactivation", hh->id);
break;
case MPH_INFORMATION_IND:
ftdm_log_chan(chan, FTDM_LOG_DEBUG, "mISDN ignoring event '%s (%#x)' while waiting for %s confirmation\n",
misdn_event2str(hh->prim), hh->prim, (activate) ? "activation" : "deactivation");
misdn_handle_mph_information_ind(chan, hh, MISDN_MSG_DATA(buf), retval - MISDN_HEADER_LEN);
break;
default: /* other messages, ignore */
ftdm_log_chan(chan, FTDM_LOG_DEBUG, "mISDN ignoring event '%s' while waiting for %s confirmation\n",
misdn_event2str(hh->prim), (activate) ? "activation" : "deactivation");