1. AgentMonitorOutgoing - this application allows you to figure out the ID of the agent, who is making an outgoing call
NOTE: This application is valid for Asterisk version 1.0.9 and above.
List of the possible options
d - when this option is set, the application will return -1 if there is an error condition and there is no extension n+101 (where n is the priority of the current extension) c - when this option is set, the CDR will be changed. The source of the call will become Agent/agent_id. n - when this option is set, no warnings will be generated, in case there is no callerid or the agentid is unknown. It is useful, when you want have agent and non-agent calls in one context.
Purpose and usage
The purpose of this application is to allow you to reveal the Caller ID of the agent, who is making a call. The decision is based on the comparison between the Caller ID on the current interface and the global variable, set by the AgentCallbackLogin application, when the agent has been logged in.
To see how the application works we recommend to use our IAX softphone Idefisk. You can download it from here. Please also read our tutorial to learn how to configure it to work with Asterisk PBX.
Asterisk PBX configurations
NOTE: This is only an example of one of the uses of this application. Of course you can use it and for other things.
iax.conf and sip.conf Configurations
We need one registered user in the iax.conf file and also another one in the sip.conf file. This is because we are going to use the IAX2 and the SIP channels. If you want to use other protocol such as MGCP, you have to do the configurations below respectively in mgcp.conf.
So, we have registered the user user1 in the iax.conf file and the user operator in the sip.conf file.
Type=friend means that this user can make and receive calls. Host=dynamic means that the IP is not static but dynamic through a DHCP server. Allow=all means that the line which this user will use, could support all audio codecs. Context=test - this shows that this user is working with the extensions in this context of the configuration file extensions.conf.
In the sip.conf file you can see the following option: disallow=all. This means that the line will not support any codecs. However, below this option we have allow=ulaw, allow=alaw and allow=gsm. This means that the line will support these three codecs - ulaw, alaw and gsm. It is important to write the options exactly in this order. First you write the disallow=all option and then the allow options. Otherwise, if you write the disallow option after the allow options, no codecs will be supported by the line.
In this file you have to say which users or agents will participate in your queue. In other words, which users or agents will be responsible for the answering of an incoming call. More about the features of this configuration file, you can learn in our tutorial about the queues.conf file.
There are two possible ways to configure the settings in this file.
In our case we will use the so called "dynamic" way. For this configuration you will need the agents.conf file.
Below, in section agents.conf Configurations, we will show you the configurations in this configuration file and here, we will explain you the configurations in queues.conf file.
Since, we are using the "dynamic" way, we have to include the number of the agent, as it is written in the agents.conf file. In our example we have written the following: member => Agent/8888.
This means that we want the agent with number 8888, to answer the calls, incoming in the queue test. ringtype=all means that when a call is incoming in the queue and we have more than one agent logged in, the phones of all logged in agents will start ringing. The first agent, who picks up the phone, will answer the incoming call.
The method requires the usage of the AgentLogin or the AgentCallbackLogin application, in your dial plan.
This is necessary, because unlike the "static" method, here is not enough just to turn on your phone. The user has to log itself in the queue, manually. The advantage is that the user would be able to log in from any place and phone, which is connected with the Asterisk PBX. You can see a screenshot below.
As we have mentioned above, we have to use this configuration file, because we have decided to use the "dynamic" method. This is the file, where we create the agents. We use them to answer the calls, incoming in our queue.
The way of creating an agent is the following: agent => agentnumber,agentpassword,agentname. In our case we have written the following: agent => 8888,8888,operator. This means that we have registered an agent with number 8888, password 8888 and username operator. The context, where the agent is set, is called [agents]. The agent number will be used in the queues.conf file. Please, take a look at section queues.conf Configurations above, to learn how to do this.
The AgentMonitorOutgoing application requires the usage of the AgentCallbackLogin one. So, we have an extension 999 with this application.
In order to be logged in the queue, our agents have to dial this extension. Because we have only one agent(with number 8888), we will specify his/her number in the brackets, so the only thing he/she has to do is to enter the password and the extension on which he could be reached.
Extension 197 is required by the AgentCallbackLogin application. When an agent logs in, the system will ask him/her for an extension, on which he/she could be reached. So, 197 is our extension for the purpose. It contains the Dial application.
Thanks to it the agent will be connected with the user operator through the SIP channel. In other words the user operator will become an Agent 8888.
We have one extension with the number 198. It contains the Queue application. This is where the incoming calls will receive. They will be attached to the queue [test], created in the queues.conf file.
Finally, we have the extension 199, which contains the AgentMonitorOutgoing application. Always put this application before the Dial one. In our case the Dial application is with priority 2. Thanks to it the caller will be connected to the user user1 through the IAX channel. Of course, you can use it also with the Zap channel or any of the other ones. As argument in the brackets we have put the letter c, which means that we allow the change of the Caller ID option in the Call Detail Records(CDR).
So, when somebody dials extension 199, his/her Caller ID will be compared with the global variable set by the AgentCallbackLogin application.
If there is no Caller ID or Agent ID the system will try to execute the extension with n+101 priority(where [n] is for the priority of the current extension).
Below, we will show you two screenshots. On both of the pictures is the Master.csv file. This is the file where the Call Detail Records (CDR) are stored. The location of this file is /var/log/asterisk/cdr-csv/. The first picture is without the AgentMonitorOutgoing application. The second one is with included AgentMonitorOutgoing application. The Caller ID is the seventh option. Each option is surrounded by quotation marks and separated from the others by commas.