Helloe eveyone, I am new to Asterisk, trying to learn now.
I have an Asterisk server running on VMware Workstation and softphones running on another PC, tablets. I can make calls between SIP devices. I create a queue and I can add/remove agents manually from CLI.
So things are working well so far. I am trying to make it easy so agents can login/out from their phone. I use the lines below:
Now the agent from SIP/2000 can dial 8101 to login; however when he dial 8101 again he still hears the message “Agent logged in”. It does not log off the agent as expected. At the server CLI, I see the message " Unable to add interface ‘SIP/2000’ to queue ‘myqueue’: Already there"
Your dialplan, every time the user dial 8101 asterisk will execute the priority 1, so the devuce reach again the line exten => 8101,1,Answer and then jump to the next.
You set the priority 103 which is wrong. So you have 2 options:
-Add another exten like 8102 to logout the user like:
exten => 8102,1,RemoveQueueMember(myqueue)
-Or add a flag, logic, whatever to evaluate the status of the agent in the queue if exist logout if not login.