diff --git a/chan_capi.h b/chan_capi.h index 1e15ce1..1a7d5ee 100644 --- a/chan_capi.h +++ b/chan_capi.h @@ -564,7 +564,7 @@ struct capi_pvt { #endif /* Connection between two conference rooms. NULL PLCI */ struct capi_pvt *bridgePeer; - + /*! Next channel in list */ struct capi_pvt *next; }; diff --git a/chan_capi_chat.c b/chan_capi_chat.c index 1ba8eef..1a7b5c5 100644 --- a/chan_capi_chat.c +++ b/chan_capi_chat.c @@ -1337,16 +1337,19 @@ pbx_capi_create_conference_bridge(const char* mainName, (mainController == 0) || (additionalController == 0)) return NULL; - pbx_capi_nulliflist_lock(); for (i = 0, error = 0; (error == 0) && (i < sizeof(name)/sizeof(name[0])); i++) { capi_ifc[i] = capi_mknullif(NULL, controller[i]); error |= (capi_ifc[i] == NULL); } if (error == 0) { + cc_mutex_lock(&capi_ifc[0]->lock); capi_ifc[0]->bridgePeer = capi_ifc[1]; + cc_mutex_unlock(&capi_ifc[0]->lock); + + cc_mutex_lock(&capi_ifc[1]->lock); capi_ifc[1]->bridgePeer = capi_ifc[0]; + cc_mutex_unlock(&capi_ifc[1]->lock); } - pbx_capi_nulliflist_unlock(); for (i = 0; (error == 0) && (i < sizeof(name)/sizeof(name[0])); i++) { room[i] = add_chat_member(name[i], capi_ifc[i], RoomMemberOperator); diff --git a/chan_capi_utils.c b/chan_capi_utils.c index 82460e3..526ac87 100644 --- a/chan_capi_utils.c +++ b/chan_capi_utils.c @@ -244,12 +244,24 @@ struct capi_pvt *capi_mknullif(struct ast_channel *c, unsigned long long control } #endif - capi_sendf(NULL, 0, CAPI_CONNECT_REQ, controller, tmp->MessageNumber, + if (c == NULL) { + cc_mutex_lock(&tmp->lock); + } + capi_sendf((c != NULL) ? NULL : tmp, c == NULL, CAPI_CONNECT_REQ, controller, tmp->MessageNumber, "w()()()()(www()()()())()()()((wwbbb)()()())", 0, 1,1,0, 3,0,0,0,0); - - cc_verbose(3, 1, VERBOSE_PREFIX_4 "%s: created null-interface on controller %d.\n", - tmp->vname, tmp->controller); + if (c == NULL) { + cc_mutex_unlock(&tmp->lock); + if (tmp->PLCI == 0) { + cc_log(LOG_WARNING, "%s: failed to create\n", tmp->vname); + capi_remove_nullif(tmp); + tmp = NULL; + } + } + if (tmp != NULL) { + cc_verbose(3, 1, VERBOSE_PREFIX_4 "%s: created null-interface on controller %d.\n", + tmp->vname, tmp->controller); + } return tmp; } diff --git a/divastreaming/chan_capi_divastreaming_utils.c b/divastreaming/chan_capi_divastreaming_utils.c index d55252c..878f6ef 100644 --- a/divastreaming/chan_capi_divastreaming_utils.c +++ b/divastreaming/chan_capi_divastreaming_utils.c @@ -91,6 +91,8 @@ static int divaStreamingMessageRx (void* user_context, dword message, dword leng 8U << 8 | DIVA_STREAM_MESSAGE_TX_IDI_REQUEST, b3buf, b3len); bridgePeer->diva_stream_entry->diva_stream->flush_stream(bridgePeer->diva_stream_entry->diva_stream); + } else { + DBG_ERR(("DROP BRIDGE PACKET")) } } else { capidev_handle_data_b3_indication_vector (pE->i, vind, vind_nr);