[asterisk-dev] Implementation using libpri and socketpair()

Paulo Garcia paulo.astdev at gmail.com
Wed Feb 7 17:13:03 MST 2007


Paul

thanks for your answer!

Is this behavior expected in any kind of pipes (pipe(), socketpair(), etc) ?


I´m just starting to understand isdn and I think that do what you said isn´t
so hard, after all.

Regards

Paulo

On 2/7/07, Paul Cadach <paul at odt.east.telecom.kz> wrote:
>
>  This is expected pipe behavior (to split/concatenate writes following its
> internal rules).
>
> As a workaround, you can perform quick lookup through message to calculate
> its real size (especially if you have Q.921 headers).
>
>
> WBR,
> Paul.
>
> ----- Original Message -----
> *From:* Paulo Garcia <paulo.astdev at gmail.com>
> *To:* Asterisk Developers Mailing List <asterisk-dev at lists.digium.com>
> *Sent:* Wednesday, February 07, 2007 10:30 AM
> *Subject:* [asterisk-dev] Implementation using libpri and socketpair()
>
> Hi,
>
> in my own channel, I'm implementing ISDN support using Libpri. The
> implementation is completely independent from zaptel then I'm trying to do
> all communications between my hardware and libpri using socketpair function.
>
>
> The idea is to create a socketpair, passing fd[0] to pri_new function and
> writing to fd[1] to pass data to libpri. So far so good...
>
> To receive data from libpri, I have a thread checking for all file
> descriptors fd[1] using select() function and when I receive something, I
> pass it to my card. This approach also works well but sometimes I receive
> two messages (from libpri) in only one read() call. I think this is because
> of libpri writes two messages so fast then when the read is called, there
> are already two messages in socket buffer...
>
> How can I avoid this behavior? Maybe using another way different of
> socketpair ? This communication will be used only inside the same process,
> between different threads.
>
> Any path or idea will be appreciated.
>
>
> Regards
>
>
> Paulo Garcia
>
> ------------------------------
>
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-dev
>
>
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.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/20070207/9dadd451/attachment.htm


More information about the asterisk-dev mailing list