Newer
Older
ast_channel_nativeformats_set(owner, p->reqcap);
Richard Mudgett
committed
/* Determine our read/write format and set it on each channel */
fmt = ast_format_cap_get_format(p->reqcap, 0);
if (!fmt) {
ast_channel_tech_pvt_set(owner, NULL);
ao2_ref(p, -1);
ast_channel_unlock(owner);
ast_channel_release(owner);
return NULL;
}
ast_channel_set_writeformat(owner, fmt);
ast_channel_set_rawwriteformat(owner, fmt);
ast_channel_set_readformat(owner, fmt);
ast_channel_set_rawreadformat(owner, fmt);
Richard Mudgett
committed
ast_set_flag(ast_channel_flags(owner), AST_FLAG_DISABLE_DEVSTATE_CACHE);
ast_jb_configure(owner, &p->jb_conf);
if (ast_channel_cc_params_init(owner, requestor
? ast_channel_get_cc_config_params((struct ast_channel *) requestor) : NULL)) {
ast_channel_tech_pvt_set(owner, NULL);
ast_channel_tech_pvt_set(owner, NULL);
Richard Mudgett
committed
ast_channel_release(owner);
return NULL;
}
p->owner = owner;
ast_channel_unlock(owner);
chan = ast_channel_alloc(1, semi2_state, NULL, NULL, NULL,
exten, context, &id2, owner, 0,
"%s/%s-%08x;2", tech->type, p->name, (unsigned)generated_seqno);
if (!chan) {
ast_log(LOG_WARNING, "Unable to allocate chan channel structure\n");
ast_channel_tech_pvt_set(owner, NULL);
ast_channel_tech_pvt_set(owner, NULL);
ast_channel_release(owner);
return NULL;
}
if (callid) {
ast_channel_callid_set(chan, callid);
}
ast_channel_tech_set(chan, tech);
ao2_ref(p, +1);
ast_channel_tech_pvt_set(chan, p);
ast_channel_nativeformats_set(chan, p->reqcap);
/* Format was already determined when setting up owner */
ast_channel_set_writeformat(chan, fmt);
ast_channel_set_rawwriteformat(chan, fmt);
ast_channel_set_readformat(chan, fmt);
ast_channel_set_rawreadformat(chan, fmt);
ast_set_flag(ast_channel_flags(chan), AST_FLAG_DISABLE_DEVSTATE_CACHE);
Richard Mudgett
committed
p->chan = chan;
Richard Mudgett
committed
return owner;
}