Media Format Rewrite Asterisk 15



when i setup config of module asterisk in my code lock this :

RAII_VAR(struct ast_format_cap *, cap, ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT), ao2_cleanup);
if (!cap) {
return NULL;
ast_format_cap_append(cap, ast_format_slin, 0);
conf->chan = ast_request(“DAHDI”, cap, NULL, chan, “pseudo”,NULL);

if (conf->chan) {
ast_channel_set_writeformat(conf->chan, ast_format_slin);
ast_channel_set_readformat(conf->chan, ast_format_slin);
conf->fd = ast_channel_fd(conf->chan,0);

c = ast_waitfor_nandfds(&chan, 1, &fd, nfds, NULL, &outfd, &ms);
f = ast_read©;
if ((f->frametype == AST_FRAME_VOICE) && (ast_format_cmp(f->subclass.format, ast_format_slin) == AST_FORMAT_CMP_EQUAL)) {

but why f->subclass.format return ast_format_ulaw i want ast_format_slin



This discourse is where users generally hang out, not developers. The asterisk-dev mailing list would be the better place[1].



In the old times media formats were represented using a bit field it ok for me

conf->chan = ast_request(“DAHDI”, AST_FORMAT_SLINEAR, chan, “pseudo”, NULL);

if (conf->chan) {
ast_set_read_format(conf->chan, AST_FORMAT_SLINEAR);
ast_set_write_format(conf->chan, AST_FORMAT_SLINEAR);
conf->fd = conf->chan->fds[0];


can u help me please


I have given you the location where developers talk, that would be the place to use. Otherwise you’d have to dig deeper to understand why it is doing what it is doing - but such stuff like that is used throughout the code base so it is working for other things it seems.


Also the media rewrite happened as of Asterisk 13, so that code has been around for quite… awhile…


yes my function module since version Asterisk 1.8
but I try to migrate to Asterisk 15 and everything is ok I still have the media part


Your are devloper asterisk have you any idea …?


If I had any immediate idea or suggestion I’d have stated it. As it is there’s nothing in the information you’ve provided that would explain why it is doing what it is doing. Have you done any further debugging? Have you turned on core debug (core set debug 9 and debug to console in logger.conf) and looked to see if anything is out of place? Have you looked at the channel using “core show channel” to see the formats? Have you examined the formats on the channel in code?

You ultimately just have to isolate it further, and noone else can do that for you.


thanks Jcolp

how post it in

juste send in mail