Many thanks Tzafrir - it works like a charm.

Best regards,
Ioan


On Sun, Dec 1, 2013 at 1:46 PM, Tzafrir Cohen <[email protected]>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:[email protected]
> +972-50-7952406           mailto:[email protected]
> 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
>
-- 
_____________________________________________________________________
-- 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

Reply via email to