Hello everybody,
I'm trying writing an app for transmit an FSK message over the line.
I'm having troubles basically because I have no idea of how a voice frame
should be sent using asterisk's api.
If I use this piece of code toward a phone, I can indeed hear the FSK tone.
But if I send it to the receive function I already built, asterisk
complains "Dropping incompatible voice frame on SIP/pbx-0000002e of format
slin since our native format has changed to (ulaw)" several times and after
dies.
can someone please review my code?
ast_frame_t *fr;
res = ast_waitfor(chan, 1000); //wait for a frame:
fr = ast_read(chan); //I found noway to have an ast_frame but use
this function.
if (!fr) {
ast_log(LOG_WARNING, "Null frame == hangup() detected\n");
res = -1;
break;
}
samples = fsk_tx(caller_tx, caller_amp, BLOCK_LEN); //here I
build the fsk message using spandsp functions
fr->frametype = AST_FRAME_VOICE; //compiling
new frame
ast_format_set(&fr->subclass.format, AST_FORMAT_SLINEAR, 0); //compiling
new frame
fr->datalen = samples; //compiling
new frame
fr->samples = samples / 2; //compiling
new frame
fr->offset = AST_FRIENDLY_OFFSET; //compiling
new frame
fr->src = __PRETTY_FUNCTION__; //compiling
new frame
fr->data.ptr = &caller_amp; //compiling
new frame
if (ast_write(chan, fr) < 0) { //send frame
res = -1;
ast_frfree(fr);
break;
}
Alessandro Carminati
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-dev