[Asterisk-bsd] FreeBSD and Music on Hold -- Possible Fix

Chris Stenton asterisk-bsd@lists.digium.com
Fri, 18 Jun 2004 12:20:16 +0100


Ok I've had part success in that if I change
if (class->pseudofd > -1) {
  /* Pause some amount of time */
                   res = read(class->pseudofd, buf, sizeof(buf));
to

if (class->pseudofd > -1) {
  /* Pause some amount of time */
                   usleep(1);
                   res = read(class->pseudofd, buf, sizeof(buf));


At least asterisk responds at the cli now. I think on a 2 processor machine
the above read took no time at all. What kind of delay should there be?
However even though asterisk now starts up cleanly and can register external
resouces. It does not respond to any connections sip/zap dialin etc. Looks
like the select routine is being blocked somehow. Who wrote the  FreeBSD MOH
routines?

Chris


----- Original Message ----- 
From: "Dr. Rich Murphey" <Rich@WhiteOakLabs.com>
To: <asterisk-bsd@lists.digium.com>
Sent: Thursday, June 17, 2004 9:35 PM
Subject: RE: [Asterisk-bsd] FreeBSD and Music on Hold -- Possible Fix


> I had seen intermittent occurrences of mpg123 hogging the cpu with
> concurrent absence of music on hold.  It would occur immediately upon
> starting asterisk about 1 out of 5 times.
>
> After the patch I haven't seen it happen again, and I can have several
lines
> on hold with music on hold and none are choppy.
>
> In your case, it appears that there are no music-on-hold 'classes' in the
> context.  I'm not certain, but my understanding is that each line below
the
> line '[classes]' in musiconhold.conf is a class:
>
> [classes]
> default => mp3:/var/lib/asterisk/mohmp3
>
> Where default would apply to every context except those that have
specified
> another music on hold class.
>
> Does that help?
>
> Cheers,
> Rich
>
>
> > -----Original Message-----
> > From: asterisk-bsd-admin@lists.digium.com [mailto:asterisk-bsd-
> > admin@lists.digium.com] On Behalf Of Chris Stenton
> > Sent: Thursday, June 17, 2004 1:26 PM
> > To: asterisk-bsd@lists.digium.com
> > Subject: Re: [Asterisk-bsd] FreeBSD and Music on Hold -- Possible Fix
> >
> > Rich,
> >
> > No there is very little additional CPU activity.
> > mpg123 process is there.
> > mpg123 runs fine standalone.
> >
> > I have not looked into the code in great detail but it seems like some
> > form
> > of select
> > or poll issue with asterisk waiting patiently for some MOH event to
> > happen.
> >
> > I take it that MOH works for you OK.
> >
> > Chris
> >
> > ----- Original Message -----
> > From: "Dr. Rich Murphey" <Rich@WhiteOakLabs.com>
> > To: <asterisk-bsd@lists.digium.com>
> > Sent: Thursday, June 17, 2004 1:15 PM
> > Subject: RE: [Asterisk-bsd] FreeBSD and Music on Hold -- Possible Fix
> >
> >
> > > Hmm.. Is asterisk consuming the CPU rather than mpg123?
> > >
> > > I see an asterisk thread in the same loop, but it's not consuming CPU
> > > inordinately because class->members is nonzero.  Is it finding .mp3
> > files
> > > in the directories specified in musiconhold.conf?
> > >
> > > Rich
> > >
> > >
> > > > -----Original Message-----
> > > > From: asterisk-bsd-admin@lists.digium.com [mailto:asterisk-bsd-
> > > > admin@lists.digium.com] On Behalf Of Chris Stenton
> > > > Sent: Thursday, June 17, 2004 5:00 AM
> > > > To: asterisk-bsd@lists.digium.com
> > > > Subject: RE: [Asterisk-bsd] FreeBSD and Music on Hold -- Possible
Fix
> > > >
> > > > Rich,
> > > >
> > > > that makes no difference.
> > > >
> > > > Sticking asterisk in the gdb I notice that it appears to be in
> > > > monmp3thread all the time.
> > > >
> > > >
> > > > In the loop
> > > >
> > > > for(;/* ever */;) {
> > > >
> > > > Its doing this
> > > > if (class->pseudofd > -1) {
> > > > /* Pause some amount of time */
> > > >                   res = read(class->pseudofd, buf, sizeof(buf));
> > > >
> > > > and then this
> > > >
> > > > if (!class->members)
> > > > continue;
> > > >
> > > >
> > > >
> > > > Chris
> > > >
> > > > On Thu, 2004-06-17 at 05:30, Dr. Rich Murphey wrote:
> > > > > It appears to be a bug in the FreeBSD mpg123 port.
> > > > >
> > > > > Try copying this patch to /usr/ports/audio/mpg123/files:
> > > > >
> > > > > http://www.whiteoaklabs.com/code/patch-mpg123.c
> > > > >
> > > > > and reinstall it, and see if that fixes it.
> > > > >
> > > > > mpg123 is going into an infinite loop in
> > > > > play_frame() when it sees an end of file
> > > > > while trying to read a command.  The patch
> > > > > breaks that loop upon an end of file.
> > > > >
> > > > > Cheers,
> > > > > Rich
> > > > >
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: asterisk-bsd-admin@lists.digium.com [mailto:asterisk-bsd-
> > > > > > admin@lists.digium.com] On Behalf Of Chris Stenton
> > > > > > Sent: Monday, June 14, 2004 12:02 PM
> > > > > > To: asterisk-bsd@lists.digium.com
> > > > > > Subject: [Asterisk-bsd] FreeBSD and Music on Hold
> > > > > >
> > > > > > I can't get Music on Hold to work  on FreeBSD/asterisk-current.
I
> > am
> > > > using
> > > > > > the mpg123 port and once MOH is enabled the loading of the
> > asterisk
> > > > > > console
> > > > > > goes incredibly slowly.
> > > > > >
> > > > > > _______________________________________________
> > > > > > Asterisk-BSD mailing list
> > > > > > Asterisk-BSD@lists.digium.com
> > > > > > http://lists.digium.com/mailman/listinfo/asterisk-bsd
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > _______________________________________________
> > > > > Asterisk-BSD mailing list
> > > > > Asterisk-BSD@lists.digium.com
> > > > > http://lists.digium.com/mailman/listinfo/asterisk-bsd
> > > >
> > > > _______________________________________________
> > > > Asterisk-BSD mailing list
> > > > Asterisk-BSD@lists.digium.com
> > > > http://lists.digium.com/mailman/listinfo/asterisk-bsd
> > >
> > >
> > >
> > > _______________________________________________
> > > Asterisk-BSD mailing list
> > > Asterisk-BSD@lists.digium.com
> > > http://lists.digium.com/mailman/listinfo/asterisk-bsd
> > >
> >
> > _______________________________________________
> > Asterisk-BSD mailing list
> > Asterisk-BSD@lists.digium.com
> > http://lists.digium.com/mailman/listinfo/asterisk-bsd
>
>
>
> _______________________________________________
> Asterisk-BSD mailing list
> Asterisk-BSD@lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-bsd
>