Typical DDI trunking connection problems

Once you have your FreeSWITCH setup then adding new trunks should work fine but you can get some first-day-of-use problems that slow you down.As I find them I will update this post.

Calling PSTN number of DDI trunk, rings then silence.
This is probably due to the trunk on FreeSWITCH not having the  “Register” checkbox set (true). If using bluebox then in the Connectivity->Trunk Manager for the trunk check the Register checkbox. In XML this is in the conf/sip_profiles/ in your .XML file for the profile of the interface you need to verify that register is true,

       <gateway name="trunk_x">
        <param name="realm" value="sip.example.com"/>
        <param name="username" value="xxxxxxxx"/>
        <param name="password" value="xxxxxxx"/>
        <param name="register" value="true"/>
        <param name="extension" value="auto_to_user"/>
        <param name="auto_to_user" value="true"/>

Calling PSTN number of DDI trunk, rings then very quickly goes to disconnect.
This is due to the inbound ACL not being set to “Trunks (Auto)” on the Sip interface (NAT).


Always getting number unavailable with Cisco dial plan

Dial plans are fairly easy to read but there is one little gotcha if you enter in one of these incorrectly: you will always get number unavailable.

You need to make sure that the dial plan you have entered in is valid i.e. it uses the | pipebar for delimiters and has no spurious close brackets ‘)’

The web interlace of a Cisco IP phone does not validate your input.

FreeSWITCH show command syntax help missing show registrations

I was converting my Asterisk commands to the closest equivalent FreeSWITCH command so I could display the data in the FMS Pandora Console. Nothing fancy here – just totals of registrations and current call counts (and channels – a subtle difference as a channel is one leg of a call). I was after numbers of registrations but the FreeSWITCH command line interface (fs_cli) didn’t list this as an option when you did a help on the show command.

But it really does have a show registrations with a switch for the totals i.e. show registrations count only the module source code didn’t have this in its help text. I’ll log it as a trivial bug.

Here is my Pandora FMS pandora_agent.conf snippet,

module_name FSRegnsCount
module_type generic_data
module_exec  /usr/local/freeswitch/bin/fs_cli -x "show registrations count" | awk '{if (match($0,"total")) { printf("%d",$1);}}'
module_description FreeSWITCH registrations

I will be adding more of thee snippets of Pandora agent configs to a special page on our web site here – http://www.openmutual.org/resources/pandora-fms-agent/

The “show” command help syntax is just a #define in  /usr/local/src/freeswitch/src/mod/applications/mod_commands/mod_commands.c so easy to fix.

Ring then disconnect on registered VOIP SIP trunks

The setup is a (VOIP) SIP trunk provider in the UK connecting via the internet to a FreeSWITCH PBX with the Blue.box web interface that is attached to the Internet via a NAT routed ADSL last mile. The local IP telephones connect to the FreeSWITCH PBX and the different trunks from the UK (using 3 trunks for 3 different projects) should appear on one of three of the 5 extension lines on a Cisco SPA 525G.

The trunk to the UK was registered correctly as far as FreeSWITCH/Blue.box was concerned but when you called the UK phone number from the PSTN then it rang but then went to disconnect tone. What was expected was that the call would use the SIP trunk to connect via the FreeSWITCH to the IP phone on the client site and light up the correct extension.

The problem is that in Blue.box I had configured the trunk Bind to the Authenticated SIP interface and not the Authenticated SIP NAT interface. Changed it to the Authenticated SIP NAT interface and that worked. The Authenticated SIP NAT port has port 5070, auto-detect IP address via UPnP whereas the Authenticate SIP port I have is on the fixed local LAN private IP address used for local IP phones to proxy register against. These SIP interfaces are defined in blue.box under Connectivity -> SIP Interface and the trunk is defined under Connectivity -> Trunk manager.

You will see the FreeSWITCH console log has,

2011-12-25 12:29:06.274781 [WARNING] sofia_reg.c:1445
SIP auth challenge (INVITE) on sofia profile 'sipinterface_4'
for [44XXXXXXXX@sipprovider.example.com] from ip X.Y.Z.A

for each inbound call attempt. Bit of a first day of setup gotcha.


Using audacity to create auto attendant /IVR prompts (low cost)

If you are getting someone to say the script (or yourself !) in-house and want a low-cost recording solution without a professional sound recording setup then I use Audacity with an ordinary microphone from a VOIP headset and a few tweaks. Audacity is a good Open Source digital audio recorder and effects processor.

I use a piece of A4/Letter (80gsm) photocopy/LASER copier paper between your mouth and the microphone. This will de-pop your speech. It makes a dramatic difference. Just hold the paper from the bottom so you can still see over it to read the script on your computer screen but don’t have the paper touch the microphone or your mouth (lips, beard, moustache etc).

Open Audacity and set the project rate to 16000 Hz and the input as 1 (Mono) Input. The input is in the Device toolbar (See View->Toolbar -> Device toolbar to make sure it is displayed).

Have your script visible on the computer screen, the de-popper paper held in one hand between the microphone and your mouth and click the record button.

Wait a few seconds to get the background noise (i.e. allow the microphone to pick up the ambient noise because we need to remove this later) then speak your script at a normal pace. At the end leave a few seconds of silence and then click the stop button.

Now select the starting silence (not your words or any clicks from your mouse button at the very start) and click the option Effect->Noise removal and then click the option button in the noise removal Step 1 of “Get noise profile”. It remembers this so now select ALL the audio and then redo the Effect -> Noise removal and take the defaults and click OK.

If you listen it should now be dead silent between words and phrases that you say.

Now select the silence at the start and use the scissor tool to cut this. Select the end silence and use the scissor tool to cut that. Note that you might see a tiny click at the start and end which is the mouse click when you clicked the Record button. Cut this out as well.

That is about all you need to do. Save this as a Audacity PROJECT and then export it as a 16 bit PCM wav file. Upload this and see if it works for you. If the volume is too low then re-open the Audacity project and use the Effect->Amplify to adjust this and then re-save as a new WAV file.

Other tricks are to use Bass boost effect to give your voice some gravitas or to use pitch controls, though you do risk sounding artificial if you alter it too much.

No text-to-speech with Flite on Freeswitch/Blue.box IVR

If you have configured a feature code that uses text-to-speech e.g. a talking clock or if you are setting up an auto attendant (IVR) on a new Freeswitch+Blue.box system and you have selected the flite voice but when you connect to the auto attendant Assigned Number you get no message audio even though you have selected the Flite voice then you can test this problem very quickly.

Look at the freeswitch console log and you should see a error message,

2012-12-26 09:57:14.381330 [ERR] switch_core_speech.c:61 Invalid speech module [flite]!
2012-12-26 09:57:14.381330 [ERR] switch_ivr_play_say.c:2439 Invalid TTS module!

If you are not at the console and if you are testing an IVR then connect to the IVR from a phone and  hit one of the key mapping option numbers that you have configured for it to action and if this works (which they probably will) then your problem is that you have not enabled the mod_flite in Freeswitch source modules.conf or the module is not automatically loading.

This is easy to fix. Edit the /usr/local/src/freeswitch/modules.conf  and uncomment the line,


(also make sure that you have mod_cepstral commented out as you can’t use flite and cepstral at the same time. Cepstral is licensed, albeit not very expensive – about 30 dollars per voice – and you can test with their TTS voices though the TTS engine will periodically insert nag messages.)

Now do a make on Freeswitch. This will see that you have enabled the mod_flite and it will download the flite package from http://files.freeswitch.org/downloads/libs  (about 14 Megabytes).

Note that if you break the download then you must cd to /usr/local/src/freeswitch/libs and sudo rm -R flite-1.5.1-current*  or similar to clean up the broken download and then run make again.

After the make then do a make install.

Once that has done (or perhaps you had already had that uncommented) then you must make sure that the module is autoloaded. To check this go to the runtime program path which is usually /usr/local/freeswitch) e.g.

cd /usr/local/freeswitch/conf/autoload_configs

and edit the  modules.conf.xml and again uncomment the mod_flite line so it is  the only one uncommented,

  <!-- ASR /TTS -->
    <load module="mod_flite"/> <!-- -->
    <!-- <load module="mod_pocketsphinx"/> -->
    <!-- <load module="mod_cepstral"/> -->
    <!-- <load module="mod_tts_commandline"/> -->
    <!-- <load module="mod_rss"/> -->

now restart freeswitch. Your feature code text to speech will now work.

Truthfully though the Flite TTS is synthetic (e.g. the rms voice) and will never be as good as a human spoken voice but it does allow you to quickly setup what option codes to use and test your options before you get a human speaker to say a script.

If you are getting someone to say the script (or yourself !) in-house and want a low-cost recording solution without a professional sound recording setup then I use Audacity with an ordinary microphone (VOIP headset) and a sheet of copy paper as a de-popper. See my post here for details.