<div dir="ltr">Many thanks Tzafrir - it works like a charm.<div><br></div><div>Best regards,</div><div>Ioan</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Dec 1, 2013 at 1:46 PM, Tzafrir Cohen <span dir="ltr"><<a href="mailto:tzafrir.cohen@xorcom.com" target="_blank">tzafrir.cohen@xorcom.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Long ago, On Wed, Feb 21, 2007 at 09:32:26AM +0200, Tzafrir Cohen wrote:<br>
> On Wed, Feb 21, 2007 at 07:56:18AM +0100, Olivier wrote:<br>
<br>
[snip]<br>
<br>
> > Any better idea than running an dedicated shell script with a "asterisk -rx<br>
> > pri show span 1" line ?<br>
><br>
> Here is my pipeast script:<br>
><br>
> (while read line; do<br>
>   echo -n "$line"   # trim the ending newline<br>
>   sleep 0.001       # generate different write(2)-s<br>
> done) | socat - /var/run/asterisk/asterisk.ctl<br>
><br>
> You can pipe whatever you want to that. e.g:<br>
><br>
> while true; do<br>
>   echo pri show span 1<br>
>   sleep 30<br>
> done | pipeast<br>
><br>
> Note: socat is available as a debian package:<br>
> <a href="http://packages.debian.org/socat" target="_blank">http://packages.debian.org/socat</a> .<br>
<br>
It has lately come to my attention that this method is broken (and has<br>
been, for quite some time. Sure enough. It does not use any published<br>
inteerface) and that there is actually some demand for using it.<br>
<br>
A version of pipeast that seems to work now is:<br>
<br>
#!/bin/sh<br>
while read line; do<br>
  echo "$line" | tr '\n' '\0'<br>
  sleep 0.001<br>
done | nc -U /var/run/asterisk/asterisk.ctl<br>
<br>
<br>
Notes:<br>
1. nc, or at least openbsd-netcat, can use unix domain sockets (-U).<br>
   No need for socat.<br>
<br>
2. that /var/run is slowly converting to /run , though the<br>
   compatibility link /var/run will likely stay for quite some time.<br>
<br>
3. If this script breaks in the future, you get to keep both pieces.<br>
   But this is only guaranteed if it breaks to exactly two pieces.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
               Tzafrir Cohen<br>
icq#16849755              <a href="mailto:jabber%3Atzafrir.cohen@xorcom.com">jabber:tzafrir.cohen@xorcom.com</a><br>
<a href="tel:%2B972-50-7952406" value="+972507952406">+972-50-7952406</a>           mailto:<a href="mailto:tzafrir.cohen@xorcom.com">tzafrir.cohen@xorcom.com</a><br>
<a href="http://www.xorcom.com" target="_blank">http://www.xorcom.com</a><br>
<br>
--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
               <a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
   <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br>
</font></span></blockquote></div><br></div>