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.
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.
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.
Posted: Thu Jun 17, 2004 12:15 pm Post subject: [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?
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
Posted: Thu Jun 17, 2004 6:26 pm Post subject: [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
Quote:
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
Posted: Thu Jun 17, 2004 8:35 pm Post subject: [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.
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
>
Posted: Fri Jun 18, 2004 11:20 am Post subject: [Asterisk-bsd] FreeBSD and Music on Hold -- Possible Fix
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
Quote:
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
Quote:
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
Quote:
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
Quote:
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
Quote:
> > >
> > > 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
Posted: Fri Jun 18, 2004 10:54 pm Post subject: [Asterisk-bsd] FreeBSD and Music on Hold -- Possible Fix
Something must be wrong. Pseudofs is non-negative, which means you have a
zaptel device available for timing, had reading it should produce a delay.
In which case, you shouldn't need the usleep() there. So, if the usleep()
makes a difference, perhaps it does so because the device is not providing
the timing expected.
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
>
Posted: Sun Jun 20, 2004 10:19 am Post subject: [Asterisk-bsd] FreeBSD and Music on Hold -- Possible Fix
Ok,
Looking further into this it appears to be a threading problem. Once
this thread gets setup none of the other threads get a look in until
this thread is closed down. So for instance if you get a PSTN call in;
the zap thread does not get to run with the calling args until you start
to close down asterisk at which point the moh thread is closed.
Chris
On Thu, 2004-06-17 at 21:35, Dr. Rich Murphey wrote:
Quote:
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
Posted: Wed Jun 23, 2004 11:33 am Post subject: [Asterisk-bsd] FreeBSD and Music on Hold -- Possible Fix
Ok looking into it further there are two problems.
Firstly I am using asterisk-current with zaptel 0.4 on FREEBSD 5.2.1-p8 and
2 XEON processors.
First problem in monmp3thread
if (class->pseudofd > -1) {
/* Pause some amount of time */
res = read(class->pseudofd, buf, sizeof(buf));
Is happening too fast on my system I need to slow it down by adding
sleep(1). Is pseudo fully implemented in 0.4 of the zaptel driver?
Second problem.
There is a bug in that calling fork and then execv from within the
monmp3thread thread to start the mpg123 process puts all other threads in
blocking mode.
I have tried to replicate this in a simple threads prog and failed. So all I
can think is that the res_musiconhold shared library is picking up the non
threaded version of fork?
Chris
----- Original Message -----
From: "Chris Stenton" <jacs@gnome.co.uk>
To: <asterisk-bsd@lists.digium.com>
Sent: Sunday, June 20, 2004 11:19 AM
Subject: RE: [Asterisk-bsd] FreeBSD and Music on Hold -- Possible Fix
Quote:
Ok,
Looking further into this it appears to be a threading problem. Once
this thread gets setup none of the other threads get a look in until
this thread is closed down. So for instance if you get a PSTN call in;
the zap thread does not get to run with the calling args until you start
to close down asterisk at which point the moh thread is closed.
Chris
On Thu, 2004-06-17 at 21:35, Dr. Rich Murphey wrote:
> 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
Quote:
> 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
Quote:
> context. I'm not certain, but my understanding is that each line below
the
Quote:
> 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
Quote:
> 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
Quote:
> > > 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
Quote:
> > > >
> > > > 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-
Quote:
> > > > > > 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
Posted: Wed Jun 23, 2004 4:28 pm Post subject: [Asterisk-bsd] FreeBSD and Music on Hold -- Possible Fix
Quote:
admin@lists.digium.com] On Behalf Of Chris Stenton
Ok looking into it further there are two problems.
Firstly I am using asterisk-current with zaptel 0.4 on FREEBSD 5.2.1-p8
and
2 XEON processors.
First problem in monmp3thread
if (class->pseudofd > -1) {
/* Pause some amount of time */
res = read(class->pseudofd, buf, sizeof(buf));
Is happening too fast on my system I need to slow it down by adding
sleep(1). Is pseudo fully implemented in 0.4 of the zaptel driver?
Second problem.
There is a bug in that calling fork and then execv from within the
monmp3thread thread to start the mpg123 process puts all other threads in
blocking mode.
I have tried to replicate this in a simple threads prog and failed. So all
I
can think is that the res_musiconhold shared library is picking up the non
threaded version of fork?
Chris
Are you referring to non-blocking IO?
ldd asterisk
should show which library is being used.
The -pthread option to gcc causes it to link against libc_r rather than
libc, so as long as either -pthread or -lc_r are used when the asterisk
executable is linked, it should be using the thread safe version.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum