[Asterisk-Dev] Asterisk Manager Interface losing events
C. Maj
cmaj-SPAM at freedomcorpse.com
Sun May 8 09:18:13 MST 2005
On Sat, 7 May 2005, Geoff Nordli waxed:
> I am building application that sits on the management interface tracking all
> the events.
>
> Occasionally an event is misses which causes the application to get out of
> sync with what is happening on the Asterisk side.
>
> I had a discussion with Nicolás Gudiño and apparently he has noticed the
> same thing with the FOP.
What's his solution ? Just curious.
> Has anyone else experienced problems with the management missing events? If
Yes, but not all events; I've only noticed this problem with
CDR events. Using just both the manager and PostgreSQL CDR
engines, my counts are always different after a short while.
Although I thought it was just a problem with the CDR
manager backend. My workaround was simply to stop relying
on the CDR manager events 100%.
> so is there any way we can ensure an application receives the event when it
> is connected?
I think re-writing the manager event system to use more
threads would help alleviate this problem. Then you could
keep the lock on needed items. Case in point from
channel.c around line 850:
ast_mutex_unlock(&chan->lock);
manager_event(EVENT_FLAG_CALL, "Hangup",-
"Channel: %s\r\n"
"Uniqueid: %s\r\n"
"Cause: %d\r\n",
chan->name, chan->uniqueid, chan->hangupcause);
Now, I haven't followed thru this all the way, but if you
remove that channel lock, what happens if something else
grabs it and changes the data before you call manager_event ?
If there was a separate thread queuing up manager events,
then you could post them to the AMI and _then_ release the
lock afterwards.
I would have suggested spawning a new thread for every
single event, but I tried that with the CDRs in a recent
patch and Kevin pointed out how wasteful that is on
non-linux systems. Although, I've since revised that patch
to do things in batch mode, and I think the same could be
done for the manager events, too.
--Chris
--
Chris Maj, Rochester
cmaj_at_freedomcorpse_dot_com
Pronunciation Guide: Maj == May
More information about the asterisk-dev
mailing list