[Asterisk-bsd] FXS dialtone interruptions at 1-second intervals
Staffan Ulfberg
staffanu+freebsd at multivac.fatburen.org
Wed Mar 30 16:46:55 CST 2005
Kim Culhan <w8hdkim at yahoo.com> writes:
> > - Added the INTR_FAST flag to the bus_setup_intr() call in
> > wcfxs.c (zaptel). (Might not be the best/final solution,
> > but it works for me.)
>
> Could you supply a diff after adding the INTR_FAST flag?
Sure, this is against the svn repository:
Index: trunk/wcfxs/wcfxs.c
===================================================================
--- trunk/wcfxs/wcfxs.c (revision 1043)
+++ trunk/wcfxs/wcfxs.c (working copy)
@@ -2455,7 +2455,7 @@
/* Now we should set up the interrupt handler */
- error = bus_setup_intr(dev, sc->wc_irq, INTR_TYPE_MISC,
+ error = bus_setup_intr(dev, sc->wc_irq, INTR_TYPE_MISC | INTR_FAST,
(void (*)(void *))wcfxs_interrupt, sc, &(sc->irq_handler));
if (error) {
printf("Couldn't set up irq\n");
BTW, I also had to apply the following patch in order to make the svn
sources compile:
Index: trunk/wcfxs/wcfxs.c
===================================================================
--- trunk/wcfxs/wcfxs.c (revision 1043)
+++ trunk/wcfxs/wcfxs.c (working copy)
@@ -1090,6 +1090,7 @@
}
/* Proslic max allowed loop current, reg 71 LOOP_I_LIMIT */
/* If out of range, just set it to the default value */
+ {
int lim;
lim = (loopcurrent - 20) / 3;
if ( loopcurrent > 41 ) {
@@ -1100,6 +1103,7 @@
else if (debug)
printf("Loop current set to %dmA!\n",(lim*3)+20);
wcfxs_setreg(sc, card, LOOP_I_LIMIT, lim);
+ }
Can anyone comment on how anyone is able to compile the latest cource
without this?
> > - Started Asterisk on rtprio 0. If you do this, you should
> > probably also modify the source so that Astrisk lowers its priority
> > to normal after forking. There are unfinished patches for this on
> > bugs.digium.com.
>
> Tried to find this on the bugs site and ran out of time, would you
> have a pointer to where this is on the site?
http://bugs.digium.com/bug_view_page.php?bug_id=0003203
If you apply my FreeBSD patch (available on the web page above), you
probably also want this patch to res_agi.c to restore priority to
normal after forking an agi script:
--- res_agi.c.orig Sat Mar 26 15:47:45 2005
+++ res_agi.c Fri Mar 25 22:36:44 2005
@@ -52,6 +52,8 @@
#include <asterisk/astmm.h>
#endif
+#include <sys/rtprio.h>
+
#define MAX_ARGS 128
#define MAX_COMMANDS 128
@@ -258,6 +260,14 @@
return -1;
}
if (!pid) {
+ struct rtprio rtp;
+ rtp.type = RTP_PRIO_NORMAL;
+ rtp.prio = 0;
+ if (rtprio(RTP_SET, 0, &rtp) == -1) {
+ ast_log(LOG_WARNING, "Unable to set normal priority\n");
+ return -1;
+ }
+
/* Redirect stdin and out, provide enhanced audio channel if desired */
dup2(fromast[0], STDIN_FILENO);
dup2(toast[1], STDOUT_FILENO);
Notice that bug 3203 contains patches for restoring priority to normal
after many other forks as well (but the patches available there do not
work on FreeBSD). Since I use Asterisk mostly for agi scripting, this
was what I needed.
Staffan
More information about the Asterisk-BSD
mailing list