Dial Through FreePBX with Vicidial

From ViciWiki
Jump to: navigation, search

The method is to First use the FreePBX system to create the SIP/IAX2 contexts which link the FreePBX server to the Carriers. Hopefully you have that done ...

Part way done.

Now we need to connect the Vicidial System to the FreePBX system. This same method (trunk) can be used, or it can be an "Extension". Either way, the FreePBX system will create the sip.conf/iax.conf entries (in sub-files, of course, "included" into the masters).

Now we have a connection to each, and authentication is managed by FreePBX. We need to "connect" them without going through FreePBX:

Then the trick is to create a "dialplan" that will allow direct access to these contexts without the rest. Oddly enough, your example for this is already in Vicidial. But since vicidial is already handling the call, the agi script (ending in "call_log") is unnecessary (not to mention the fact that this particular script does not reside on the FreePBX server anyway!). So that line may be omitted. Then comes the "dial" command along with an optional "global variable". If you replace the global variable with what it is meant to generate, you'll end up with something like this:


Remove "TRUNKX" or "DIAL7TRUNK" or whatever your Global variable is from the Dial command, and replace it with the PROTOCOL/carriername. Ordinarily, the carriername is the [context] inside the protocol's ".conf" entry. Some will use a username or device ID instead, whatever ended up inside the [brackets] is what you want after SIP/ (but without the brackets there ...). So it could also be IAX2/devicename or SIP/userid.

So you would place a "custom" dialplan in the FreePBX server's extensions.conf file (directly, if you like). And it would need to be in a special [context] in that file, so you can send calls there by the name of that context (no interference with other FreePBX fuctions or macros or contexts). Of course, you could name it something like [vicidialpassthrough] to be explicit and help out the next geek to read the file. Just stay out of the _additional files, as those are overwritten randomly. _custom is viable, but be sure it is one that is active (included in the base extensions.conf at some point).

Now we have Link to Vicidial, Link to Carrier, Way for Vicidial to Get to Carrier from dialplan ... but how do you convince the calls coming from Vicidial to land in that special extensions.conf context you created? By modifying the "Extension" or "Trunk" entry in FreePBX to include a "context=vicidialpassthrough" entry. If there was already a "context=" value, change it.

So the way it works in the end: Call is generated from Vicidial which is registered to (or using IP auth to connect to) FreePBX. Upon arrival, the authentication method involved resolves to the SIP account which has "context=vicidialpassthrough", so the call is sent to Extensions.conf in that context. The dialplan you created in that context is then asked by Vicidial to call the number vicidial is trying to reach (watch your dialplan here, does it still have the 9? Or perhaps at least the 1? Or is it now down to just the 10 digit US number? whichever it is, there must be a matching _91NXXNXXXXX dialplan waiting!). Upon matching a dialplan in that context, the lines will be executed one at a time. Ordinarily there is NOT an "answer", but there IS a "dial" and a "hangup". So we get to "Dial", and the dial command will contain the SIP or IAX protocol, followed by the context within that protocol to dial through. This completely skips the entire FreePBX dialplan and jumps to that protocol and out of the box.

The only manual entry: the single context added to extensions.conf (or extensions_custom.conf). Some will even use the FreePBX interface to do this, I forget how because I never do, I just type it in.

The only "modifications" to the already running system: context=vicidialpassthrough (or whatever you named your context in Extensions.conf).

Hopefully this will give you both an understanding and precise enough instructions to get you through (not step by step instructions, but those could certainly follow if it still doesn't "click").