Agents to Queues

Hello people.

First I’m sorry for my English, I hope you understand.

I am new to the Asterisk world, I am using version 16 and I am finding it very difficult to set up queues composed of agents.

I’m trying to do this process through a dialplan, but after using the AgentLogin application the connection is stuck in the MOH. What am I doing wrong?

Below are my settings:

sip.conf

[general]
context=default
allowguest=no
allowtransfer=yes
bindport=5060
bindaddr=0.0.0.0
srvlookup=no
disallow=all
allow=alaw,ulaw
language=pt_BR
dtmfmode=rfc2833
compactheaders=yes
nat=no
canreinvite=no
rtcachefriends=yes

[1001]
context=test
username=1001
secret=
type=friend
host=dynamic
insecure=invite,port
qualify=yes

agents.conf

[general]

[100]
;ackcall=no
;acceptdtmf=##
autologoff=15
;wrapuptime=5000
musiconhold=default
recordagentcalls=yes
;custom_beep=beep
fullname=Agent 100

queue.conf

queue_template
musicclass=default
strategy=rrmemory
joinempty=yes
leavewhenempty=no
ringinuse=no

support
; Support queue

DIALPLAN

[test]
exten => *20,1,Answer
same => n,Read(agentid,agent-user,3,1,10)
same => n,Set(agentpwd={SEARCH_AGENT({agentid})})
same => n,AgentLogin({agentid}) same => n,AddQueueMember(support,Agent/{agentid})
same => n,Hangup

The full log may be helpful in identifying the issue

That’s where I’d start to identify error

image.png

The specific problem is that AgentLogin supervises the whole agent session, so the add member is never reached whilst the agent is logged in. Is there a valid reason for using dynamic queue members?

You also seem to have a security problem for SIP/1001, as there is no password protection. Even assuming secret= is redacted and you really have a secret, insecure=invite disables the check (insecure=port is unlikely to be needed, but is less of a security risk).

If you are using Agent channels, I believe you are using a version of Asterisk that is no longer supported. Also chan_sip only has community support, and is not supported by Sangoma.

Minor points: it is almost always better practice to use type=peer for everything. The only real exception is if two devices share an IP address; canreinvite was replaced by directmedia a very long time ago, although I think the deprecated name is still accepted; nat=no is almost never needed as the default is automatically use force rport and comedia, only if NAT processing is being used on addresses (nat= does not control the manipulation of addresses to counter NAT).

@david551, thank you very much for your suggestions for configuring SIP.

I clarify that my intention is to create an IVR with queues for the distribution of calls, where agents can connect through different extensions (not by specific extension) and can participate in one or more queues.

Could you tell me what is the best practice for building an IVR using Asterisk 16?

I found it strange that when using AgentLogin the connection is stuck in the MOH and even after adding it to the support queue, it does not receive calls.

Although omitted, I have a dial plan that directs to the support queue.

Here is the view of the queue and the logs:

CLI>queue show support
support has 0 calls (max unlimited) in ‘random’ strategy (0s holdtime, 0s talktime), W:0, C:0, A:3, SL:0.0%, SL2:0.0% within 0s
Members:
Agent/100 (ringinuse disabled) (dynamic) (Invalid) has taken no calls yet
No Callers

[Jun 10 11:18:30] VERBOSE[93440][C-0000001f] netsock2.c: Using SIP RTP CoS mark 5
[Jun 10 11:18:30] VERBOSE[93440][C-0000001f] res_rtp_asterisk.c: 0x7f4a94042670 – Strict RTP learning after remote address set to: 10.1.1.30:40046
[Jun 10 11:18:30] VERBOSE[115100][C-0000001f] pbx.c: Executing [*20@test:1] Answer(“SIP/1001-0000001d”, “”) in new stack
[Jun 10 11:18:30] VERBOSE[115100][C-0000001f] res_rtp_asterisk.c: 0x7f4a94042670 – Strict RTP switching to RTP target address 10.1.1.30:40046 as source
[Jun 10 11:18:30] VERBOSE[115100][C-0000001f] pbx.c: Executing [*20@test:2] Read(“SIP/1001-0000001d”, “agentid,agent-user,3,1,10”) in new stack
[Jun 10 11:18:30] VERBOSE[115100][C-0000001f] app_read.c: Accepting a maximum of 3 digits.
[Jun 10 11:18:30] VERBOSE[115100][C-0000001f] file.c: <SIP/1001-0000001d> Playing ‘agent-user.alaw’ (language ‘pt-br’)
[Jun 10 11:18:35] VERBOSE[115100][C-0000001f] res_rtp_asterisk.c: 0x7f4a94042670 – Strict RTP learning complete - Locking on source address 10.1.1.30:40046
[Jun 10 11:18:36] DTMF[115100][C-0000001f] channel.c: DTMF begin ‘1’ received on SIP/1001-0000001d
[Jun 10 11:18:36] DTMF[115100][C-0000001f] channel.c: DTMF begin ignored ‘1’ on SIP/1001-0000001d
[Jun 10 11:18:36] DTMF[115100][C-0000001f] channel.c: DTMF end ‘1’ received on SIP/1001-0000001d, duration 260 ms
[Jun 10 11:18:36] DTMF[115100][C-0000001f] channel.c: DTMF end passthrough ‘1’ on SIP/1001-0000001d
[Jun 10 11:18:36] DTMF[115100][C-0000001f] channel.c: DTMF begin ‘0’ received on SIP/1001-0000001d
[Jun 10 11:18:36] DTMF[115100][C-0000001f] channel.c: DTMF begin ignored ‘0’ on SIP/1001-0000001d
[Jun 10 11:18:37] DTMF[115100][C-0000001f] channel.c: DTMF end ‘0’ received on SIP/1001-0000001d, duration 260 ms
[Jun 10 11:18:37] DTMF[115100][C-0000001f] channel.c: DTMF end passthrough ‘0’ on SIP/1001-0000001d
[Jun 10 11:18:37] DTMF[115100][C-0000001f] channel.c: DTMF begin ‘0’ received on SIP/1001-0000001d
[Jun 10 11:18:37] DTMF[115100][C-0000001f] channel.c: DTMF begin ignored ‘0’ on SIP/1001-0000001d
[Jun 10 11:18:37] DTMF[115100][C-0000001f] channel.c: DTMF end ‘0’ received on SIP/1001-0000001d, duration 260 ms
[Jun 10 11:18:37] DTMF[115100][C-0000001f] channel.c: DTMF end passthrough ‘0’ on SIP/1001-0000001d
[Jun 10 11:18:37] VERBOSE[115100][C-0000001f] app_read.c: User entered ‘100’
[Jun 10 11:18:37] VERBOSE[115100][C-0000001f] pbx.c: Executing [*20@test:3] Set(“SIP/1001-0000001d”, “agentpwd={SEARCH_AGENT(100)}”) in new stack
[Jun 10 11:18:37] VERBOSE[115100][C-0000001f] pbx.c: Executing [*20@test:4] AddQueueMember(“SIP/1001-0000001d”, “support,Agent/100”) in new stack
[Jun 10 11:18:37] NOTICE[115100][C-0000001f] app_queue.c: Added interface ‘Agent/100’ to queue ‘support’
[Jun 10 11:18:37] VERBOSE[115100][C-0000001f] pbx.c: Executing [*20@test:5] AgentLogin(“SIP/1001-0000001d”, “100”) in new stack
[Jun 10 11:18:37] VERBOSE[115100][C-0000001f] file.c: <SIP/1001-0000001d> Playing ‘agent-loginok.alaw’ (language ‘pt-br’)
[Jun 10 11:18:39] VERBOSE[115100][C-0000001f] app_agent_pool.c: Agent ‘100’ logged in (format alaw/alaw)
[Jun 10 11:18:39] VERBOSE[115100][C-0000001f] bridge_channel.c: Channel SIP/1001-0000001d joined ‘holding_bridge’ agent_hold-bridge <0ae502fc-e80d-4109-9073-fa656f3339c5>
[Jun 10 11:18:39] VERBOSE[115100][C-0000001f] res_musiconhold.c: Started music on hold, class ‘default’, on channel ‘SIP/1001-0000001d’
[Jun 10 11:19:05] VERBOSE[115100][C-0000001f] res_musiconhold.c: Stopped music on hold on SIP/1001-0000001d
[Jun 10 11:19:05] VERBOSE[115100][C-0000001f] bridge_channel.c: Channel SIP/1001-0000001d left ‘holding_bridge’ agent_hold-bridge <0ae502fc-e80d-4109-9073-fa656f3339c5>
[Jun 10 11:19:05] VERBOSE[115100][C-0000001f] app_agent_pool.c: Agent ‘100’ logged out. Logged in for 28 seconds.
[Jun 10 11:19:05] VERBOSE[115100][C-0000001f] pbx.c: Spawn extension (test, *20, 5) exited non-zero on ‘SIP/1001-0000001d’

This is about queues, not iVRs.

They way I would do it is to have an agent for each human agent, permanently in the queue. However, I wouldn’t want to say whether that was or was not best practice.

I’ve already explained why you get MOH continuously; the member is not being added to the queue because dialplan is running AgentLogin until the agent hangs up (and when they hang up, the rest of dialplan is abandoned. As such, the add member never gets run.

The IVR is a future plan, at the moment I am trying to add the agent to the queue and make him receive calls after logging in.

It follows the changes I made to my dial plan and I still have the call stuck on MOH after AgentLogin.

[test]
exten => *20,1,Answer
same => n,Read(agentid,agent-user,3,1,10)
same => n,Set(agentpwd={SEARCH_AGENT({agentid})}) same => n,AddQueueMember(support,SIP/{CALLERID(NUM)}@agents,0,Agent/{agentid}) same => n,AgentLogin({agentid})
same => n,Hangup

exten => 500,1,Answer
same => n,Queue(support)

[agents]
exten => _X.,1,NoOp(DIAL FOR {EXTEN}) same => n,AgentRequest({EXTEN})
same => n,NoOp({AGENT_STATUS}) same => n,Dial({EXTEN})
same => n,Hangup

Also, note that, as I understand it, Agent/ channels don’t exist in Asterisk 16, although agents.conf and AgentLogin still exist. See https://blogs.asterisk.org/2016/02/10/converting-from-chan_agent-to-app_agent_pool/

Also, if you are using Asterisk 16, you should be using chan_pjsip, unless there is some specific reason not to do so.

Thank you one more time.

These versions of Asterisk left me very confused, I opted for version 16 because it is LTS and I didn’t know that chan_sip was obsolete.

I will try to migrate to chan_pjsip. However, what bothers me is that even with chan_pjsip AgentLogin () is used and it seems that this application is not working properly, as the connection is stuck in MOH and if I disconnect the connection, the agent disconnects.

It is working properly, and I have already explained how it works, twice.

More precisely, I’ve given one reason (it is long running) twice, and another (Agent’/ channels have been replaced by another construct) once.

I had already changed my dial plan to use AddQueueMember before AgentLogin.

I did another test by creating the agents as permanent members in queues.conf and in the dial plan I removed AddQueueMember.

If possible, I would like an example of a dial plan for agent login, because using AgentLogin the connection is stuck in MOH and when I finish the connection, the agent logs off.

exten => * 20,1, Answer
same => n, Read (agentid, agent-user, 3,1,10)
same => n, AgentLogin ($ {agentid})
same => n, Hangup

There is one on the page I already referenced: https://blogs.asterisk.org/2016/02/10/converting-from-chan_agent-to-app_agent_pool/

However, if you rely too much on copying examples, you will never understand how things work, which will mean you keep having to come back here.

Thank you for the patience.

I had already replicated the configuration at https://blogs.asterisk.org/2016/02/10/converting-from-chan_agent-to-app_agent_pool/ and the result was the same.

I think you will have to turn up the logging, until the reason for the hangup is logged.

thanks for the tip.

I already enabled the full log and did not find any problem.

I’m using Asterisk 16 and want to add agents dynamically to queues. I thought I could do this through a dial plan, combining the AgentLogin () and AddQueueMember () applications. It is possible?

I would like an example if possible.

Turn up the verbosity, turn on debugging, turn on sip channel debugging.

One thing I wondered: are you expecting the call to drop immediately after the login, and then to be called back. If so, that is not h ow AgentLogin works, and AgentCallBackLogin was retired because it was possible to adequately simulate it using local channels.

I’ve been assuming the hangup is unexpected, but if you are hanging up the phone deliberately, the above may apply.

In short, I want to add an agent dynamically to a queue. If so, is it necessary for the agent to login?

A call centre agent doesn’t have to be an Asterisk Agent. You can can add the PJSIP/ dial string directly as a member, and the the queue will attempt to ring that device each time it wants to offer a call.

The advantage of an Asterisk Agent is that you can force the agent to answer every call, and stop them from taking or making calls outside the queue system.

I would like to have control over the agent. So using Asterisk’s own agent would be best for me.

However, I am too ready to do this through the dial plan. If it is necessary to use AgentLogin, I return to the starting point of that topic.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.