Using the standard vm-macro... this monitors whether the call is internal (of course we want to keep an eye on our agents and make sure they aren't avoiding calls by staying on the phone with one another)... inbound (i.e. when someone calls in and enters an agents direct extension)... or a transfer from another extension. Just a matter of setting up the appropriate queues in QM (much like you'd setup an outbound queue), calling the macro in your extensions and adding a few lines to your vmail macro and changing queueDial.agi slightly.
example :
extensions ---
exten => 2000,1,Macro(voicemail|SIP/2000|2000|{vmail_group_name}|inbound or internal --depending on where the call originates)
exten => s,1,NoOp
exten => s,n,Set(context="${ARG4}")
exten => s,n,GotoIf($["${context}" = "internal"]?5:4) <--- does the context argument = internal? yes? move forward determine if it is a transfer and then reset the arg4... no? move to the next.
exten => s,n,GotoIf($["${context}" = "inbound"]?7:
<--- does the context argument = inbound? yes? move forward and reset the arg4... no? move to the hangup.
exten => s,n,GoToIf($[${LEN(${CALLERID(num)})} > 5]?6:7) <--- in my case the internal extensions are 4 digits long...so I look to see if the callerID is longer than that -- if it is not proceed to set the context as transfer...
exten => s,n,Set(context="transfer")
exten => s,n,Set(ARG4="")
exten => s,n,Set(agent="${CALLERID(num)}")
exten => s,n,DeadAgi(dial.agi|${ARG1}|${ARG1}|${context}|${agent})
exten => s,n,GoTo(s-${DIALSTATUS},1)
exten => s,n,HangUp()
make sure your altered queueDial.agi (saved as dial.agi) looks like this starting at line 34.
# Entering the program
logit(0, "QueueDial ---- " . $ARGV[0] . "- " . $ARGV[1] ."----" . (scalar localtime) );
my $NUMBER = $ARGV[3];
my $CHANNEL = $ARGV[3];
my $QUEUE = $ARGV[2];
my $AGENT = $ARGV[0];
maybe a bit sloppy... but it works.