diff --git a/chan_capi.c b/chan_capi.c index 381f85e..6617a90 100644 --- a/chan_capi.c +++ b/chan_capi.c @@ -1572,7 +1572,7 @@ static int pbx_capi_call(struct ast_channel *c, char *idest, int timeout) #ifdef DIVA_STREAMING i->diva_stream_entry = 0; - if (capi_controllers[i->controller]->divaStreaming != 0) { + if (pbx_capi_streaming_supported (i) != 0) { capi_DivaStreamingOn(i, 1, i->MessageNumber); } #endif @@ -5026,7 +5026,7 @@ static void capidev_handle_connect_indication(_cmsg *CMSG, unsigned int PLCI, un #ifdef DIVA_STREAMING i->diva_stream_entry = 0; - if (capi_controllers[i->controller]->divaStreaming != 0) { + if (pbx_capi_streaming_supported (i) != 0) { capi_DivaStreamingOn(i, 0, 0); } #endif @@ -8724,3 +8724,10 @@ char *key() return ASTERISK_GPL_KEY; } #endif /* CC_AST_HAS_VERSION_1_4 */ + +#ifdef DIVA_STREAMING +int pbx_capi_streaming_supported (struct capi_pvt *i) +{ + return (i != 0 && i->controller <= CAPI_MAX_CONTROLLERS && capi_controllers[i->controller]->divaStreaming != 0); +} +#endif diff --git a/chan_capi.h b/chan_capi.h index e610132..3baba08 100644 --- a/chan_capi.h +++ b/chan_capi.h @@ -729,6 +729,10 @@ struct _diva_streaming_vector; void capidev_handle_data_b3_indication_vector (struct capi_pvt *i, struct _diva_streaming_vector* vind, int vind_nr); +/*! + * \brief Return true if Diva streaming supported by CAPI controller + */ +int pbx_capi_streaming_supported (struct capi_pvt *i); #endif /* DIVA specific MANUFACTURER definitions */ diff --git a/chan_capi_utils.c b/chan_capi_utils.c index eeb46c3..4aa611f 100644 --- a/chan_capi_utils.c +++ b/chan_capi_utils.c @@ -228,6 +228,13 @@ struct capi_pvt *capi_mknullif(struct ast_channel *c, unsigned long long control tmp->state = CAPI_STATE_CONNECTPENDING; tmp->MessageNumber = get_capi_MessageNumber(); +#ifdef DIVA_STREAMING + tmp->diva_stream_entry = 0; + if (pbx_capi_streaming_supported (tmp) != 0) { + capi_DivaStreamingOn(tmp, 1, tmp->MessageNumber); + } +#endif + capi_sendf(NULL, 0, CAPI_CONNECT_REQ, controller, tmp->MessageNumber, "w()()()()(www()()()())()()()((wwbbb)()()())", 0, 1,1,0, 3,0,0,0,0);