<div dir="ltr">Hello everybody,<br><br>I'm trying writing an app for transmit an FSK message over the line.<br>I'm having troubles basically because I have no idea of how a voice frame should be sent using asterisk's api.<br>
<br>If I use this piece of code toward a phone, I can indeed hear the FSK tone.<br>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.<br>
<br>can someone please review my code?<br><br>ast_frame_t *fr;<br><br>res = ast_waitfor(chan, 1000); //wait for a frame: <br>fr = ast_read(chan);           //I found noway to have an ast_frame but use this function.<br>if (!fr) {<br>
          ast_log(LOG_WARNING, "Null frame == hangup() detected\n");<br>          res = -1;<br>          break;<br>         }<br>samples = fsk_tx(caller_tx, caller_amp, BLOCK_LEN);           //here I build the fsk message using spandsp functions<br>
fr->frametype = AST_FRAME_VOICE;                              //compiling new frame   <br>ast_format_set(&fr->subclass.format, AST_FORMAT_SLINEAR, 0);  //compiling new frame   <br>fr->datalen = samples;                                        //compiling new frame   <br>
fr->samples = samples / 2;                                    //compiling new frame   <br>fr->offset = AST_FRIENDLY_OFFSET;                             //compiling new frame   <br>fr->src = __PRETTY_FUNCTION__;                                //compiling new frame   <br>
fr->data.ptr = &caller_amp;                                   //compiling new frame   <br>if (ast_write(chan, fr) < 0) {                                //send frame<br>                              res = -1;<br>
                              ast_frfree(fr);<br>                              break;<br>                             }<br>    <br clear="all"><div><div dir="ltr">Alessandro Carminati<br><br><div style="display:inline"></div>
</div></div>
</div>