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

Carlos G Mendioroz tron at acm.org
Wed Sep 19 04:58:55 CDT 2007


Atis Lezdins @ 19/09/2007 06:53 -0300 dixit:
> On Wednesday 19 September 2007 12:11:19 Carlos G Mendioroz wrote:
>> Atis Lezdins @ 19/09/2007 06:05 -0300 dixit:
>>> On Wednesday 19 September 2007 11:43:39 Carlos G Mendioroz wrote:
>>>> 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
>>> Shouldn't wrapuptime be used in this case?
>>>
>>> Regards,
>>> Atis
>> This is happening at login time. wrapuptime gets used after the agent
>> handles a call. I do have wrapuptime set BTW.
>>
>> wrapuptime uses lastcall as reference, which is a Queue var.
>> Login is an Agent process. I still do not understand the whole thing
>> though...
> 
> Ok, my mistake. AgentCallbackLoging really doesn't add to queue. So, your 
> agent is already in queue, when you do AgentCallbackLogin? Or how otherwise 
> would you get call from queue? I'm not sure for static members, i'm using  
> QueueAdd after AgentCallbacklogin.
> 
> Regards, Atis
> 

Yup, agents are statically assigned to queues.
So on login, they go from "unavailable" to "not in use".
And when this happens while calls are in queue... somehow sometimes the
login gets aborted, so to say.

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



More information about the asterisk-users mailing list