Hi,
I try to upgrade a proprietary channel from asterisk-11.6-cert11 to asterisk 13.13-cert1.
There are only a few changes in the code and it compiles, but the channel does not work properly.
Basically, I create a asterisk channel and then call ast_pbx_start()
with the newly created channel.
With the working code (Asterisk 11), I see a log message after calling ast_pbx_start()
:
-- Executing [5113@incoming-foo:1] Answer("foo/ip/00000202-0767ed85", "") in new stack
I do not see this log message with the upgraded code.
Therefore, I guess something is wrong in creating/configuring the channel.
Here is the changed code:
// Create channel
- chan = ast_channel_alloc(1, state, 0, 0, 0, 0, 0, 0, 0, "foo/%s-%08lx", pvt->id, ast_random());
+ chan = ast_channel_alloc(1, state, NULL, NULL, NULL, NULL, NULL, NULL, NULL, AST_AMA_NONE, "foo/%s-%08lx", pvt->id, ast_random());
if (chan) {
pvt->playSoundSpool.len = 0;
ast_channel_tech_set(chan, &foo_tech);
// Set formats for new channels.
- struct ast_format fmtAsteriskCodec;
- ast_format_set(&fmtAsteriskCodec, pvt->asteriskCodec, 0);
- ast_format_cap_add(ast_channel_nativeformats(chan), &fmtAsteriskCodec);
- ast_format_copy(ast_channel_readformat(chan), &fmtAsteriskCodec);
- ast_format_copy(ast_channel_rawreadformat(chan), &fmtAsteriskCodec);
- ast_format_copy(ast_channel_writeformat(chan), &fmtAsteriskCodec);
- ast_format_copy(ast_channel_rawwriteformat(chan), &fmtAsteriskCodec);
+ ast_format_cap_append(ast_channel_nativeformats(chan), ast_format_opus, 0);
+ ast_channel_set_readformat(chan, pvt->format);
+ ast_channel_set_rawreadformat(chan, pvt->format);
+ ast_channel_set_writeformat(chan, pvt->format);
+ ast_channel_set_rawwriteformat(chan, pvt->format);
ast_channel_tech_pvt_set(chan, pvt);
struct ast_readq_list *readqlist = ast_channel_readq(chan);
Note that pvt->asteriskCodec
corresponds to AST_FORMAT_OPUS
(which was patched for asterisk-11.06-cert11). I use ast_format_opus
with Asterisk 13.
Any ideas what could be wrong?
Thanks,
Geri