[asterisk-users] pipeast [was: Re: How to repeat pri show span and zap show channel commands]

Ioan Indreias indreias at gmail.com
Wed Dec 4 00:28:51 CST 2013


Many thanks Tzafrir - it works like a charm.

Best regards,
Ioan


On Sun, Dec 1, 2013 at 1:46 PM, Tzafrir Cohen <tzafrir.cohen at xorcom.com>wrote:

> Hi,
>
> Long ago, On Wed, Feb 21, 2007 at 09:32:26AM +0200, Tzafrir Cohen wrote:
> > On Wed, Feb 21, 2007 at 07:56:18AM +0100, Olivier wrote:
>
> [snip]
>
> > > Any better idea than running an dedicated shell script with a
> "asterisk -rx
> > > pri show span 1" line ?
> >
> > Here is my pipeast script:
> >
> > (while read line; do
> >   echo -n "$line"   # trim the ending newline
> >   sleep 0.001       # generate different write(2)-s
> > done) | socat - /var/run/asterisk/asterisk.ctl
> >
> > You can pipe whatever you want to that. e.g:
> >
> > while true; do
> >   echo pri show span 1
> >   sleep 30
> > done | pipeast
> >
> > Note: socat is available as a debian package:
> > http://packages.debian.org/socat .
>
> It has lately come to my attention that this method is broken (and has
> been, for quite some time. Sure enough. It does not use any published
> inteerface) and that there is actually some demand for using it.
>
> A version of pipeast that seems to work now is:
>
> #!/bin/sh
> while read line; do
>   echo "$line" | tr '\n' '\0'
>   sleep 0.001
> done | nc -U /var/run/asterisk/asterisk.ctl
>
>
> Notes:
> 1. nc, or at least openbsd-netcat, can use unix domain sockets (-U).
>    No need for socat.
>
> 2. that /var/run is slowly converting to /run , though the
>    compatibility link /var/run will likely stay for quite some time.
>
> 3. If this script breaks in the future, you get to keep both pieces.
>    But this is only guaranteed if it breaks to exactly two pieces.
>
> --
>                Tzafrir Cohen
> icq#16849755              jabber:tzafrir.cohen at xorcom.com
> +972-50-7952406           mailto:tzafrir.cohen at xorcom.com
> http://www.xorcom.com
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>                http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20131204/fcdc16d1/attachment.html>


More information about the asterisk-users mailing list