Hi All,
I’m trying to get FreePBX to automatically hang up the call when it detects a 400hz tone of any duration (preferably 2 seconds) from a pstn trunk
I’m new to using asterisk dialplans and contexts, however…
I’ve created two new contexts in the extensions custom config file.
One which is [hangup-400] and the other is [hangup-c].
The first one includes the from-ptsn (include =>…) and also sets TONE_DETECT(400,2000,h(hangup-c,s,1)).
[hangup-c] simply has
exten => s,1,Hangup()
Strangely this only works if the tone is playing before the phone on the internal side is answered. Afterwards, it is hit and miss and 99% of the time fails.
Interestingly, I added a log verbose to the [hangup-c] context but it isnt appearing in the log file. I assume this is never being reached but for some reason the call is still ending if the tone is played before the call is answered. I tried it again having removed the TONE_DETECT, and this doesn’t happen at all then, proving it’s not a fluke.
As a newbie, Im very confused as to the use of ‘s’ in passing the extension to “TONE_DETECT”. Is this just equivalent of “same”? Otherwise how do you pass in the current extension as a parameter?
I also suspect what might be happening is that the TONE_DETECT function is stoppping/no longer being called due to the effect of the contexts that are generated by FreePBX or that the channel is changing and therefore the function is no longer detecting anything after the call has been transferred through the inbound route. I did try and do this internally and not through an inbound route (direct internal call) by calling these custom contexts before the from-internal context but this also has the same effect.
I would greatly appreciate any advice.
Best Regards
Luke