Ok I guess I'll have to stick with the "old fashioned" answering machine until I have some time to mess around with the code.
What I envision to do is something like this:
; My master extension
exten => 100,1,Dial(SIP/101&SIP/102,120)
exten => 100,2,SetGlobalVar(CallInVoicemail=${CALLID}) ; Is there something like this
exten => 100,3,MonitorCustom("/usr/bin/mymixerscript")
exten => 100,4,VoiceMail(u100)
; Code for grabbing call in voicemail
exten => 199,1,GrabCall(${CALLINVOICEMAIL})
exten => 199,102,Playback(custom/no-call-in-voicemail)
So I'd need two "new" commands:
MonitorCustom - Like Monitor, but will pass to the program two file descriptors or unix sockets with the raw audio of the two sides of the call. A small standalone app would then mix the channels and play them via /dev/dsp or something.
GrabCall - Would behave a bit like Dial, but instead connect the caller to an existing call in the system by it's ID. Whatever application was currently using the call would get signalled that the user has hung up.
This is just brainstorming but I'm probably going to subscribe to the dev list to get some feedback.
Anyway thanks Phoneboy and Muppetmaster for the inspiration, I hope I can get this to work as soon as I have a bit of time to do some coding
Cheers,
Descore