From fa4d1ef6ac0557cdd3a9a0ebf84cb3c7c9cb9aac Mon Sep 17 00:00:00 2001 From: MelwareDE Date: Mon, 23 Aug 2010 15:21:52 +0000 Subject: [PATCH] Add Diva streaming for resource PLCI --- chan_capi_utils.c | 12 +++++++++++ divastreaming/chan_capi_divastreaming_utils.c | 21 +++++++++++++++++-- divastreaming/chan_capi_divastreaming_utils.h | 2 +- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/chan_capi_utils.c b/chan_capi_utils.c index 4aa611f..3031ee4 100644 --- a/chan_capi_utils.c +++ b/chan_capi_utils.c @@ -331,6 +331,18 @@ struct capi_pvt *capi_mkresourceif(struct ast_channel *c, unsigned long long con data_ifc->MessageNumber = get_capi_MessageNumber(); cc_mutex_lock(&data_ifc->lock); + +#ifdef DIVA_STREAMING + data_ifc->diva_stream_entry = 0; + if (data_plci_ifc == 0) { + capi_DivaStreamingStreamNotUsed(data_ifc, 1, data_ifc->MessageNumber); + } else { + if (pbx_capi_streaming_supported (data_ifc) != 0) { + capi_DivaStreamingOn(data_ifc, 1, data_ifc->MessageNumber); + } + } +#endif + capi_sendf(data_ifc, 1, CAPI_MANUFACTURER_REQ, diff --git a/divastreaming/chan_capi_divastreaming_utils.c b/divastreaming/chan_capi_divastreaming_utils.c index f9949df..6fe15a9 100644 --- a/divastreaming/chan_capi_divastreaming_utils.c +++ b/divastreaming/chan_capi_divastreaming_utils.c @@ -247,12 +247,29 @@ void capi_DivaStreamingRemoveInfo(struct capi_pvt *i) "dws", _DI_MANU_ID, _DI_STREAM_CTRL, description); } -void capi_DivaStreamingStreamNotUsed (struct capi_pvt *i) +/*! + * \brief Send empty stream to inform no Diva streaming is used for this PLCI + */ +void capi_DivaStreamingStreamNotUsed(struct capi_pvt *i, byte streamCommand, _cword messageNumber) { byte description[] = { 0x04, 0x00, 0x02, 0x00, 0x00 }; + unsigned int effectivePLCI; MESSAGE_EXCHANGE_ERROR error; - error = capi_sendf (NULL, 0, CAPI_MANUFACTURER_REQ, i->PLCI, get_capi_MessageNumber(), + description[1] = streamCommand; + + if (streamCommand == 0) { + messageNumber = get_capi_MessageNumber(); + effectivePLCI = i->PLCI; + } else { + /* + PLCI still not assigned. Send to controller and tag with message number + where command receives effective + */ + effectivePLCI = i->controller; + } + + error = capi_sendf (NULL, 0, CAPI_MANUFACTURER_REQ, effectivePLCI, messageNumber, "dws", _DI_MANU_ID, _DI_STREAM_CTRL, description); } diff --git a/divastreaming/chan_capi_divastreaming_utils.h b/divastreaming/chan_capi_divastreaming_utils.h index 357d03f..6a36476 100644 --- a/divastreaming/chan_capi_divastreaming_utils.h +++ b/divastreaming/chan_capi_divastreaming_utils.h @@ -3,7 +3,7 @@ extern int capi_DivaStreamingSupported(unsigned controller); extern void capi_DivaStreamingOn(struct capi_pvt *i, unsigned char streamCommand, _cword messageNumber); -extern void capi_DivaStreamingStreamNotUsed (struct capi_pvt *i); +extern void capi_DivaStreamingStreamNotUsed(struct capi_pvt *i, byte streamCommand, _cword messageNumber); extern void capi_DivaStreamingRemoveInfo(struct capi_pvt *i); extern void capi_DivaStreamingRemove(struct capi_pvt *i); extern void divaStreamingWakeup(void);