Adventures with FreeSWITCH and FusionPBX part drei

So, DISA, direct inward system access. Plenty of documentation, sort of, on the ‘net about how to get FreeSWITCH to do it via editing XML. However, if you’re using FusionPBX, then you’re actually writing to a Postgres database, which is compiled to XML on the fly (I think) when FreeSWITCH does something that would access the XML file.

Step 1 – Enable DISA in the Dialplan Manager

By default, it looks like the DISA option is disabled. Makes sense, it’s a security hole with a well known/documented/discoverable PIN. Load the Dialplan Manager in FusionPBX, find the “disa” entry, click on it, set the enabled flag to True, and change the PIN.

Step 2 – Set up a Destination

Open the Destinations menu under Dialplan, and add a new destination. Pick your inbound DID (direct inward dial) number – my Sipura devices send International Call Prefix formatted numbers as their identifier. Other providers may send shorter numbers or other identifiers. If all else fails, run fs_cli, then call your inbound trunk number and see what shows up in the logs. The type for the Destination is Inbound, and the action is irrelevant right now, so just route it to an extension. For whatever reason, I can’t get the DISA option to show up in the Actions menu, I only get things like Record and Hangup.

Step 3 – Edit the Inbound Route

Creating a Destination of type Inbound generates a shiny new inbound route. Edit it. My settings have a name like “<Provider> DISA”, public context, continue is false, order is 100, enabled is True. In the table below, there should be a condition for destination_number matching your DID, two actions to set values, and then a transfer action. That transfer action needs to have data of “*3472 XML <your context>“; <your context> is probably the same as your domain, but it might not be. If you already had a transfer to an extension number like 6001, just change the 6001 to *3472.

Step 4 – Test

Bring up fs_cli, and call your DID. FreeSWITCH should show a codec negotiation, some permission checks, and then a transfer line to *3472. A fair bit more spew, then a line about the channel being answered, and then lines about WAV files being played. Type in your PIN when asked, then #, then a phone number to call, then # again, and you should get an outbound call.

If you get errors about WAV files not being found, try setting default_dialect to “en” in the Advanced > Variables editor.

Step 5 – Teach your mobile phone to automate this PIN thing

Open your contacts editor on your mobile phone. Give the person a new phone number, where the first part is your shiny new DID -> DISA number, then a “;” (referred to as Wait on iPhones), then the PIN, then a “#”, then a “;”, then their actual number, then a “#”. Something like

0044nxnxnxnxnxnx;12345#;001515xxxnnnn#

Of course, you’re probably better off using E.164 format instead of International Call Prefix. You might need to use the Translate module in this case, to rewrite numbers that your SIP trunk can handle.

Still don’t have the GSM module, but I have a local VoIP number from my ISP that I’ve got rigged as a DID -> DISA, so that’ll do for now.