[asterisk-dev] SLINEAR_FORMAT returning 16khz frames not 8khz

Ryan Conrad rconrad54 at gmail.com
Tue Aug 13 11:02:08 CDT 2013


Sorry for being a little ambiguous.  I am looking at this function:

static int console_write(struct ast_channel *chan, struct ast_frame *f)
{
struct console_pvt *pvt = ast_channel_tech_pvt(chan);

Pa_WriteStream(pvt->stream, f->data.ptr, f->samples);

return 0;
}

However, I dont use PortAudio, instead I have my own stream that instead
will send throught a socket the raw buffer of the frame.  I just need to be
able to get the raw voice buffer off of the phone every 10ms doing 8khz raw
PCM data (SLINEAR).  That is all I am trying to get from the console_write.
 Is there a better way to get that voice data coming from the endpoint
device?

Basically, I have a SIP configured phone and my custom driver, so when
console_write gets hit, I should be taking the SIP phone's voice frames and
then I want to send those on their way with my stream to a totally separate
device.

-Ryan


On Tue, Aug 13, 2013 at 11:44 AM, Russell Bryant
<russell at russellbryant.net>wrote:

> On Tue, Aug 13, 2013 at 9:51 AM, Ryan Conrad <rconrad54 at gmail.com> wrote:
>
>> I am not sure if this is a bug or not, but in chan_console, the function
>> console_write returns frames with 320 samples instead of 160 eventhough the
>> channels writeformat, readformat, rawwriteformat, and rawreadformat are all
>> set to SLINEAR and not SLINEAR16.
>>
>
> console_write doesn't return frames, but I'm assuming you're just talking
> about the audio frames that get queued up to be read from the channel.
>
>
>> Please help, what else should I set to have console_write be correct?  Or
>> is this truly a bug?
>>
>
> I don't know what all you've changed to try to make it do what you want,
> but it's more than just setting those fields on the ast_channel.
>
> You would need to change this so that portaudio gets set up correctly:
>
>
> https://github.com/russellb/asterisk/blob/685ab908534cd2f6f7e25b117974a82fe1a5229a/channels/chan_console.c#L86
>
>
> Also look for everywhere you see AST_FORMAT_SLINEAR16.  The function
> reading audio from portaudio and queueing it up on the channel is:
>
>
> https://github.com/russellb/asterisk/blob/685ab908534cd2f6f7e25b117974a82fe1a5229a/channels/chan_console.c#L277
>
> --
> _____________________________________________________________________
> -- 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130813/f039e1f0/attachment.htm>


More information about the asterisk-dev mailing list