HOW TO SETTING QUEUE ASTERISK


extensions.conf

;01 => INB
exten => 01,1,GoSub(queue-status,${EXTEN},1(INBOUND))
;02 => OUTB
exten => 02,1,GoSub(queue-status,${EXTEN},1(OUTBOUND))

;03 => BREAK

exten => 03,1,GoSub(queue-status,${EXTEN},1(PAUSED))

;04 => LOGOUT
exten => 04,1,GoSub(queue-status,${EXTEN},1(LOGOUT))
[queue-status]
exten => _X.,1,Set(FIRST_STATUS=${ARG1})
exten => _X.,n,Set(CH=SIP/${CHANNEL(peername)})
exten => _X.,n,MYSQL(Connect connid localhost myuserdb mypass queue)
exten => _X.,n,MYSQL(Query resultid ${connid} select status from t_queue where channel=’${CH}’)
exten => _X.,n,MYSQL(Fetch foundrow ${resultid} status)
exten => _X.,n,MYSQL(clear ${resultid})
exten => _X.,n,MYSQL(Disconnect ${connid})
exten => _X.,n,NoOp(RETURN_PROVIDER: ${status})
exten => _X.,n,GotoIf($[ “${status}” = “” ]?queue-add,${EXTEN},1:queue-${FIRST_STATUS},${EXTEN},1)

[queue-add]
exten => _X.,1,SET(CH=SIP/${CHANNEL(peername)})
exten => _X.,n,MYSQL(Connect connid localhost myuserdb mypass queue)
exten => _X.,n,MYSQL(Query resultid ${connid} insert into t_queue(channel,status) values (‘${CH}’,’${FIRST_STATUS}’))
exten => _X.,n,MYSQL(Disconnect ${connid})
exten => _X.,n,AddQueueMember(sales,${CH})
exten => _X.,n,Playback(beep)
exten => _X.,n,Hangup()

[queue-INBOUND]
exten => _X.,1,SET(CH=SIP/${CHANNEL(peername)})
exten => _X.,n,MYSQL(Connect connid localhost myuserdb mypass queue)
exten => _X.,n,MYSQL(Query resultid ${connid} update t_queue set channel=’${CH}’,status=’INBOUND’ where channel=’${CH}’)
exten => _X.,n,MYSQL(Disconnect ${connid})
exten => _X.,n,AddQueueMember(sales,${CH})
exten => _X.,n,Playback(beep)
exten => _X.,n,Hangup()

[queue-OUTBOUND]
exten => _X.,1,SET(CH=SIP/${CHANNEL(peername)})
exten => _X.,n,MYSQL(Connect connid localhost myuserdb mypass queue)
exten => _X.,n,MYSQL(Query resultid ${connid} update t_queue set status=’OUTBOUND’ where channel=’${CH}’)
exten => _X.,n,MYSQL(Disconnect ${connid})
exten => _X.,n,RemoveQueueMember(sales,${CH})
exten => _X.,n,Playback(beep)
exten => _X.,n,Hangup()

[queue-PAUSED]
exten => _X.,1,SET(CH=SIP/${CHANNEL(peername)})
exten => _X.,n,MYSQL(Connect connid localhost myuserdb mypass queue)
exten => _X.,n,MYSQL(Query resultid ${connid} update t_queue set status=’PAUSED’ where channel=’${CH}’)
exten => _X.,n,MYSQL(Disconnect ${connid})
exten => _X.,n,RemoveQueueMember(sales,${CH})
exten => _X.,n,Playback(beep)
exten => _X.,n,Hangup()

[queue-LOGOUT]
exten => _X.,1,SET(CH=SIP/${CHANNEL(peername)})
exten => _X.,n,MYSQL(Connect connid localhost myuserdb mypass queue)
exten => _X.,n,MYSQL(Query resultid ${connid} update t_queue set status=’LOGOUT’ where channel=’${CH}’)
exten => _X.,n,MYSQL(Disconnect ${connid})
exten => _X.,n,RemoveQueueMember(sales,${CH})
exten => _X.,n,Playback(beep)
exten => _X.,n,Hangup()

queues.conf

[queue_template](!)
musicclass=default ; play [default] music
strategy=fewestcalls ; use the Round Robin Memory strategy
joinempty=yes ; join the queue when no members available
leavewhenempty=no ; don’t leave the queue no members available
ringinuse=no ; don’t ring members when already InUse

[sales](queue_template)
; Sales queue

[support](queue_template)
; Support queue

DB

t_queue CREATE TABLE `t_queue` (
`channel` varchar(10) DEFAULT NULL,
`status` char(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

shisdew

Listens until think alike

moses.spaceku@yahoo.com / voip ipbx

Hosted PBX, IP-PBX SOHO/ CALL CENTER, VOICE GATEWAY, VOICE CARD, COST EFECTIVE SOLUTIONS (LCR), GSM/CDMA GATEWAY

%d bloggers like this: