1,客户端查入一条新记录,状态为"NEW",包括CallerId,ORIGINATE/REDIRECT指令
1. First, the GUI client application inserts a record into the table as a NEW action and includes a unique callerID for REDIRECT and ORIGINATE commands(the
callerID field is how the listener will update the record in the DB) INSERT INTO vicidial_manager values('','','2004-01-30
17:22:53','NEW','N','10.10.11.12','','Originate','DL40130172253cc160','Channel: local/8600011@demo','Context: default','Exten: 917274515135','Priority:
1','Callerid: DL40130172253cc160','','','','','');
2,后台常驻程序,如果队列中有数据,将从队列中选中一条,同时生成一个子进程来处理这条数据,更新为"SENT",
2. Second, there is a constantly running application on the Asterisk box that selects queues from the database to be processed, and launches a new child
script to send the action to the database, then marks the action as SENT.
3,每个子进程登录进入Asterisk,运行这个命令,并且停留10秒,然后退出;
3. Third, each child process logs into the manager interface and sends the action immediately, then stays open for 10 seconds to not cause any problems,
clears it's buffer and then logs out and exits.
4,后台常驻监听程序从AMI接口,处理Asterisk的输出.当"Newstate Ringing"事件出现时,后台发出一条更新语句, 根据通道的CallerId,Uniqueid条件,这条数据的状态更新为"UPDATED"
4. Fourth, the listener app is constantly connected on the Asterisk box to the manager interface and parses all output from the manager interface. Every time a
"Newstate Ringing" event is seen an update statement is sent to the DB based upon the callerid of the call filling in the channel that the call is on and the
uniqueID of the call and sets the record to "UPDATED"
5, 后台常驻监听程序同时处理,当"Hangup"事件出现时,后台发出一条更新语句,状态为"DEAD"
5. Fifth, the listener also listens for "Hangup" events and sends an update to the DB with a "DEAD" status keyed by the call's uniqueID.