[asterisk-users] AgentCalbackLogin not loging in race condition ?

Carlos G Mendioroz tron at acm.org
Wed Sep 19 03:43:39 CDT 2007


Previous mail did not go through. Following up...

Carlos G Mendioroz @ 16/09/2007 13:27 -0300 dixit:
> Hi,
> I'm seeing a problem using AgentCallbackLogin (Asterisk 1.2.16) where
> a call in queue while an agent is logging in results in the agent
> getting the call without properly being logged in.
> 
> This seems to be a race, although I've not (yet) pinpointed the code at
> fault. And I'm not able to reproduce it 100% of the time.
> 
> The perceived anomaly is that teh agent is logged of w/o request, but
> it seems it never got logged in.
> 
> This only happens when logging in with calls already in queue.
> Any hints ?
> I'm going to make AgentCallbackLogin set the initial state to wrap to
> see if that patches the problem by the time being.
> 
> Any hints are welcome.

I did not find a way to go wrap on login, cause the logic is distributed
between Queue and Agent, but I did find this comment at chan_agent.c:

	/* Ensure we can't be gotten until we're done */
	gettimeofday(&p->lastdisc, NULL);
	p->lastdisc.tv_sec++;

It seems that the time it takes for the "login ok" message is more than
one second, and is creating the trouble window. I changed that to allow
10 seconds of unavailability and the problem seems to be gone.

-Carlos
-- 
Carlos G Mendioroz  <tron at acm.org>



More information about the asterisk-users mailing list