Use Diva resources for IP endpoints

This commit is contained in:
MelwareDE 2010-09-18 23:07:38 +00:00
parent 1d1fca7181
commit f9f8279d8c
4 changed files with 25 additions and 8 deletions

View File

@ -219,7 +219,6 @@ static int pbx_capi_indicate(struct ast_channel *c, int condition, const void *d
static int pbx_capi_indicate(struct ast_channel *c, int condition);
#endif
static struct capi_pvt* get_active_plci (struct ast_channel *c);
static _cstruct diva_get_b1_conf (struct capi_pvt *i);
static void clear_channel_fax_loop (struct ast_channel *c, struct capi_pvt *i);
static struct ast_channel* capidev_acquire_locks_from_thread_context (struct capi_pvt *i);
static void pbx_capi_add_diva_protocol_independent_extension (struct capi_pvt *i, unsigned char *facilityarray, struct ast_channel *c, const char* variable);
@ -1646,7 +1645,7 @@ static int pbx_capi_call(struct ast_channel *c, char *idest, int timeout)
return 0;
}
static _cstruct diva_get_b1_conf (struct capi_pvt *i) {
_cstruct diva_get_b1_conf (struct capi_pvt *i) {
_cstruct b1conf = b_protocol_table[i->bproto].b1configuration;
if (i->bproto == CC_BPROTO_VOCODER) {
@ -9020,3 +9019,9 @@ static void pbx_capi_add_diva_protocol_independent_extension (struct capi_pvt *i
return;
}
int pbx_capi_get_controller_codecs (int controller) {
return (capi_controllers[controller]->rtpcodec);
}

View File

@ -726,6 +726,11 @@ extern char chatinfo_usage[];
typedef int (*pbx_capi_command_proc_t)(struct ast_channel *, char *);
pbx_capi_command_proc_t pbx_capi_lockup_command_by_name(const char* name);
/*!
* \brief returns list of supported by this controller RTP codecs
*/
int pbx_capi_get_controller_codecs (int controller);
_cstruct diva_get_b1_conf (struct capi_pvt *i);
#ifdef DIVA_STREAMING
struct _diva_streaming_vector;

View File

@ -446,9 +446,10 @@ static void chat_handle_events(struct ast_channel *c, struct capi_pvt *i,
waitfd = i->readerfd;
if (i->channeltype == CAPI_CHANNELTYPE_NULL) {
int fmt = (i->bproto == CC_BPROTO_VOCODER) ? i->codec : capi_capability;
nfds = 1;
ast_set_read_format(chan, capi_capability);
ast_set_write_format(chan, capi_capability);
ast_set_read_format(chan, fmt);
ast_set_write_format(chan, fmt);
}
if ((flags & CHAT_FLAG_MOH) && ((room->active < 2) || (voice_message != NULL))) {

View File

@ -248,6 +248,7 @@ struct capi_pvt *capi_mknullif(struct ast_channel *c, unsigned long long control
struct capi_pvt *capi_mkresourceif(struct ast_channel *c, unsigned long long controllermask, struct capi_pvt *data_plci_ifc) {
struct capi_pvt *data_ifc /*, *line_ifc */;
unsigned int controller = 1;
int fmt = 0;
if (data_plci_ifc == 0) {
int contrcount;
@ -269,6 +270,9 @@ struct capi_pvt *capi_mkresourceif(struct ast_channel *c, unsigned long long con
}
} else {
controller = data_plci_ifc->controller;
fmt = pbx_capi_get_controller_codecs (controller) & c->nativeformats;
if (fmt != 0)
fmt = ast_best_codec(fmt);
}
data_ifc = ast_malloc(sizeof(struct capi_pvt));
@ -298,7 +302,8 @@ struct capi_pvt *capi_mkresourceif(struct ast_channel *c, unsigned long long con
data_ifc->ecTail = EC_DEFAULT_TAIL;
data_ifc->isdnmode = CAPI_ISDNMODE_MSN;
data_ifc->ecSelector = FACILITYSELECTOR_ECHO_CANCEL;
data_ifc->capability = capi_capability;
data_ifc->capability = (fmt != 0 && data_plci_ifc != 0) ? fmt : capi_capability;
data_ifc->codec = (fmt != 0 && data_plci_ifc != 0) ? fmt : data_ifc->codec;
data_ifc->rxgain = 1.0;
data_ifc->txgain = 1.0;
@ -314,7 +319,7 @@ struct capi_pvt *capi_mkresourceif(struct ast_channel *c, unsigned long long con
data_ifc->writerfd = -1;
}
data_ifc->bproto = CC_BPROTO_TRANSPARENT;
data_ifc->bproto = (fmt != 0 && data_plci_ifc != 0) ? CC_BPROTO_VOCODER : CC_BPROTO_TRANSPARENT;
data_ifc->doB3 = CAPI_B3_DONT;
data_ifc->smoother = ast_smoother_new(CAPI_MAX_B3_BLOCK_SIZE);
data_ifc->isdnstate |= CAPI_ISDN_STATE_PBX;
@ -348,13 +353,14 @@ struct capi_pvt *capi_mkresourceif(struct ast_channel *c, unsigned long long con
CAPI_MANUFACTURER_REQ,
controller,
data_ifc->MessageNumber,
"dw(wbb(www()()()()))",
"dw(wbb(wwws()()()))",
_DI_MANU_ID,
_DI_ASSIGN_PLCI,
(data_plci_ifc == 0) ? 4 : 5, /* data */
(data_plci_ifc == 0) ? 0 : (unsigned char)(data_plci_ifc->PLCI >> 8), /* bchannel */
1, /* connect */
1, 1, 0);
(data_ifc->bproto == CC_BPROTO_VOCODER) ? 0x1f : 1, 1, 0,
diva_get_b1_conf(data_ifc));
cc_mutex_unlock(&data_ifc->lock);
if (data_plci_ifc != 0) {