Trigger email on queue entry

Hi all,

We’ve got a custom contact management system which we trigger all external communication into for tracking purposes, for some time all inbound calls have landed on a voicemail extension which then emails in, and we call the client back. Obviously this isn’t ideal from a service point of view, so I’ve now configured a queue with a break out to voicemail so clients get the choice between waiting or letting us call them back. This all works fine, but what I’d like to do is have Asterisk/FreePBX email into our system when a new caller first enters the queue, this way the basic task creation is done for the agent when the call comes through, but for some reason I can’t get it to work at all.

System info:
Asterisk (Ver. 11.9.0)

Current flow (in testing mode):
Caller dials in, type 127 to reach the extension setup, this extension forwards straight to queue group 900. Queue 900 then has 4 agents in with a ringall strategy, breaks out to an IVR which leads to voicemail box 199. This all works perfectly well.

I’ve tried using extensions_override_freepbx.conf to remake the [from-did-direct] content containing exten=>127 from the additional.conf, it seems it’s completely ignored.

So I’ve tried temporarily hacking it straight into extensions_additional.conf (I know this will be overwritten but I’m just testing) so it now looks like this, but no entry in the asterisk log for the email attempt:

exten => 127,1,Set(__RINGTIMER=${IF($[${DB(AMPUSER/127/ringtimer)} > 0]?${DB(AMPUSER/127/ringtimer)}:${RINGTIMER_DEFAULT})})
exten => 127,1,TrySystem(echo “Call from ${CALLERID(name)} at ${CALLERID(number)} received ${STRFTIME(${EPOCH},%l:%M:%S %p %Z on %A %B %e)}” | mail [email protected])
exten => 127,n,Macro(exten-vm,novm,127,1,1,1)
exten => 127,n(dest),Set(__PICKUPMARK=)
exten => 127,n,GotoIf($["${DIALSTATUS}"=“NOANSWER”]?ext-queues,900,1)
exten => 127,n,GotoIf($["${DIALSTATUS}"=“BUSY”]?ext-queues,900,1)
exten => 127,n,GotoIf($["${DIALSTATUS}"=“CHANUNAVAIL”]?ext-queues,900,1)
exten => 127,n,Goto(${IVR_CONTEXT},return,1)
exten => 127,hint,SIP/127,CustomPresence:127

Presumably I’m doing this in the wrong place, but I can’t find another entry for extension 127 to modify. Additionally, I can’t find documentation which specifies how to use System or TrySystem from the queues config files. Could someone point me in the right direction?

Many Thanks


1 Like

You have 2 priority 1’s in that context

Might I suggest not doing it this way as it could break things on updates…

In extensions_custom.conf

exten => 227,1,TrySystem(echo “Call from ${CALLERID(name)} at ${CALLERID(number)} received ${STRFTIME(${EPOCH},%l:%M:%S %p %Z on %A %B %e)}” | mail [email protected])
exten => 227,n,Dial(LOCAL/[email protected])

Then create a “Misc Destination” and for the dial put 227.

You can change 227 above to whatever makes sense to you.

Thanks for spotting the two priority 1’s, changing that fixed it and got the email triggering in which was ideal. Thanks James, yes I’m hoping to move it from extensions_additional.conf once I’d figured out the syntax. I’m not familiar with misc destinations, if I add the destination I can’t dial it from the IVR for testing, should I set extension 127 to forward to 227 and then change the Dail(LOCAL) string to hit the queue (900 in this case)? Sorry for the extra questions, just getting to grips with the flow here.

Thanks :slight_smile: