From fd3ebc7ae3c83b9c4ca0d6b9dec135076daf7da4 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Tue, 7 Feb 2012 18:22:30 +0100 Subject: [PATCH] [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 --- libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c b/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c index dcba43512e..239ec400f7 100644 --- a/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c +++ b/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c @@ -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");