Is there a way to Get queue member in dialplan?

Hello! I have next extensions for manage queue:

exten => 1111,1,Answer()
same => n,AddQueueMember(DevelopersAsterTest2,SIP/${CALLERID(num)},0,${CALLERID(num)},SIP/${CALLERID(num)})
same => n,Hangup()
exten => 1112,1,Answer()
same => n,RemoveQueueMember(DevelopersAsterTest2,SIP/${CALLERID(num)})
same => n,Hangup()

Now I have to ask you. Is there a way to combine this in one extension? Example scheme:

  1. answer
  2. if member already in queue…
    2.1) then remove him from queue…
    2.2) else add him to queue
  3. hangup

The AddQueueMember() application sets a channel variable named AQMSTATUS upon completion. The AQMSTATUS variable will be set to one of the following values:

If AQMSTATUS status is MEMBERALREADY then use RemoveQueueMember()


Thanks! That is what I need!