Custom dial plan for agents in Asterisk queue

Hi Guys,

Quick question.

Is it possible to use a custom dial plan for the agent in a queue.
I want to execute an AGI script just before the active caller in a queue is connected to the agent.

Thank you.

Wesley

I found the answer!
It seems to work fine now.

I found the following on this website
Hope it can help others.


The use of Local channels as queue members is a popular way of executing parts of the dial plan and performing checks prior to dialing the actual agent’s device. For example, it allows us to do things like start recording the call, set up channel variables, write to a log file, set a limit on the call length (e.g., if it is a paid service), or do any of the other things we might need to do once we know which location we’re going to call.

When using Local channels for queues, they are added just like any other channel. In the queues.conf file, adding a Local channel would look like this:

; queues.conf
[support](StandardQueue)
member => Local/SIP-0000FFFF0001@MemberConnector  ; pass the technology to dial over
                                                  ; and the device identifier,
                                                  ; separated by a hyphen. We'll
                                                  ; break it apart inside the 
                                                  ; MemberConnector context.

Notice how we passed the type of technology we want to call along with the device identifier to the MemberConnector context. We’ve simply used a hyphen (although we could have used nearly anything as a separator argument) as the field marker. We’ll use the CUT() function inside the MemberConnector context and assign the first field (SIP) to one channel variable and the second field (0000FFFF0001) to another channel variable, which will then be used to call the endpoint.

Passing information to be later “exploded” in the context used by the Local channel is a common and useful technique (kind of like the explode() function in PHP).

Of course, we’ll need the MemberConnector context to actually connect the caller to the agent:

[MemberConnector]
exten => _[A-Za-z0-9].,1,Verbose(2,Connecting ${CALLERID(all)} to Agent at ${EXTEN})

   ; filter out any bad characters, allowing alphanumeric characters and the hyphen
   same => n,Set(QueueMember=${FILTER(A-Za-z0-9\-,${EXTEN})

   ; assign the first field of QueueMember to Technology using the hyphen separator
   same => n,Set(Technology=${CUT(QueueMember,-,1)})

   ; assign the second field of QueueMember to Device using the hyphen separator
   same => n,Set(Device=${CUT(QueueMember,-,2)})

   ; dial the agent
   same => n,Dial(${Technology}/${Device})
   same => n,Hangup()

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