Directory and pbdirectory, making the best of

(yup, another post, I’m preparing a deployment and there’s much to do!)

So, a dial-by-name directory, really useful. The default 411 feature code launches pbdirectory and with all the generosity in the world - it’s not very good.

The other application ‘directory’ much much better, but is accessible only as a destination from an IVR or similar. So I’ve disabled the 411 feature code, and added an entry to extensions_custom.conf to use that code to launch directory.

exten => _411,1,Goto(directory,1,1)

Great, now users can access it directly. It’s worth adding an entry into ‘custom extensions’ to allocate that number to prevent mistakes later on.

Ok, so, to the issues:
When adding each extension that is accessible via the directory, three options are given for speaking the name. The system will play the users own recorded name from the voicemail account (if they have one / recorded one), or it will speak it using TTS, or it will spell the name out.

Setting an extension to ‘greeting’ works great, but here’s the kicker, if there is no recorded name for that extension, the app proceeds to spell the name instead. Spelling the name is painful, it would be far better if it failed over to TTS instead. So that’s request one.

The second is the TTS used. Flite, I assume. Awful (but free and standard, so there’s that) I actually have a licence for Cepstral, and have used the TTS Engine module to point at it, but I can’t find a way to get directory to use it. I don’t mind using any TTS engine at all, just something better than flite!

So, 1) Could directory use TTS as it’s second choice instead of spelling, and 2) can it use a different TTS engine?

Ok, now that I’ve wrote all this, I’m going to dig into the code. I fully expect the PBX to shout at me for doing so, and I don’t yet know if the file is obfuscated, or for that matter, where the file is! Wish me luck!

Ok, first part was simple enough
contains the code to speak the selected name. There’s a switch statement at line 165 where the VM recording is the first case, and if there’s no file found, it falls through the the next one which is spelling. I’ve made that one the third case, and put a conditional break in the TTS case, so if that fails too, it will finally use per letter spelling.

The change didnt trigger an alert in the dashboard either, which is nice :slight_smile:

Changing the TTS engine looks harder, the flite engine is hard coded in, (and it does mention this in the comment in the code) so that explains why I was unable to get the GUI to change it!

I’ll dig around for a bit, but I’m not yet too familiar with the best practices for FreePBX code, coding standards, framework etc; so I’m sure my fix (if I find one) will not necessarily be the best way.
If anyone has already changed this on their systems, please, let me know! Save me from my own code!

This is because the file you edited is copied from:


The next time you apply config or reload FreePBX it will copy the file again and overwrite your changes. For the edits to stick, you will have to edit the source, and that will trigger an alert which you will have to dismiss periodically.

Thanks for that, Igaetz, that’d have been driving me mad in the morning when I’d be thinking “but… I’m /sure/ I saved the file…” haha!

I’ll make a ticket requesting that the sequence be changed around, it really does improve things for users that do not have voicemail.

I’m struggling with the Cepstral voice, asterisk is segfaulting as soon as it tries to use Swift, which makes testing kinda tough!

1 Like

Why put a custom context in to make 411 point at the directory? Just use the misc destinations module.

@addisonb I looked at the Misc Destinations and the Custom Destinations modules, it was not apparent how either should be used to perform this.
Would you care to offer the details?

Misc Applications.

The GUI way of doing this would be to use the Misc Application module under the Applications menu.

Add a description, give it a number to respond to and pick Directory from the dropdown list.
Simple. Don’t know how I missed it the first time!

So that’s accessing it sorted out. Now I just need to find out why the box segfaults with Swift. I can make it segfault in the directory with the change I made, so I’m fairly sure I can make the directory use Swift. It’s pretty much one line of code and a bit of glue-logic. I’ll submit a patch if I get it fully tested.

Beyond that, is there a reason that 411 does not use this better directory in the first place?