Howto:Auto Call Back

From innovaphone wiki
Jump to navigation Jump to search

If you call an external number the far party will typically see your number in the display, for example on his mobile phone. Therefore if the external called party is busy or miss the call he can call you back. Even if the external party answer and talk with you he can call you back in a second moment. All that works fine, but there are scenarios where this features won’t work.

For example if you don’t have a direct inward dialing (DID) line a callback directly to your internal extension number is not possible. Same issue if your trunk lines are analog one. Some customers do not want display their internal DID number and prefer show and “publish” just the root number of the company. A callback would even fail if the call is done using a GSM gateway, the called party will see the number of the SIM card or “anonymous”, so no call back to the extension. A similar problem occurs if the Carrier allows just a 2 digit DID but there are some 3 digits internal numbers; they could not be called back. Or if the root Number is so long that from some country a call back is not possible because the provider limit the number of digits.

Many customer uses call forking and a routing of a incoming call to the mobile phone; the outgoing call to the mobile phone use ISDN or a GSM box. The GSM problem is the same as discuss before, but even using the ISDN is not a real solution, in some cases even a SIP trunk would not resolve the problem: remember that in many countries clip screening cannot be switched off in ISDN and in others it is generally forbidden. In all that cases the called user will see that “his” company calls or has called him, but a callback will just go to the operator, not to the far original caller.

In all this cases the called party sees no number, a partial number, the root company number or a GSM number and a call back will end to the operator.The operatori will be completely unaware was happened and not able to say who was the external caller. In case of partial DID the external user will recall the entire number: but just a few digits of the internal number will come to the PBX and after a timeout the call will be forwarded to the operator because the PBX detected a incomplete selection.

All that can be solved using this simple XML solution where an external caller will be automatically connected the external caller to the internal extension. This works because the XML “remember” the outgoing calls, and if a previously called number calls back, a second XML will connect automatically to the internal extension.

This was the description of the basic problem and solution, but how works that exactly?

Here is how.

Applies to

innovaphone PBX V9 or higher

The feature requires no special license, Voice Mail license, mobile extension or similar.

This feature works without reporting and Linux application on every gateway (compact flash required).

User interface

In outgoing dialing the user has nothing to observe, he just calls up to now the far external user. If that called user calls back he will hear a message like “if you receive a call from this number and you want to be connect with the user please press the hash key”. If the external caller presses the “#” he is automatically connected with the previous internal caller, if he presses any other key he will be forwards to the incoming Waiting queue, operator, user or whatever in your PBX is defined. If the caller dials nothing after a 4 second timeout he will again connected to the default incoming object. So the external caller can select if he really want to be connected to the previous caller or not.

Note: this selection feature can also be switched of; in this case the caller will be immediately connected to the previous caller, see setup.

Of course an external caller will hear this message just if he was previously called form the company, otherwise the call follows the usual path.

Once a call back is served to the internal user the item is cleared; therefore if the external caller calls again he will not be connected automatically anymore and no message will be played.

If more than one internal user calls the same external number and the external number calls back he will hear the message and connected to the first caller; if the external number calls back a second time it will be connected to the second user etc. until all calls are served.

On top after a day all external numbers called are deleted and a caller forwarded straight to the operator. This is done because a call back after a day probably should not be connected to the caller. This auto clearing function can be switched off editing the XML, see chapter switched and setup.

More information

The working principle is quite simple: if a user calls the trunk access code (typically the “0”) he will be connected to the outgoing XML, a dial tone is simulated and the digits of the selection are collected. Block dial or single digit dialing (overlapped) as well a mix of both (a first part of the number is dialed in block mode and then added some digit) is supported. As usual in block dial after a timeout the call is connected to the trunk line and the number dialed out. The first timeout (after accessing the “virtual xml trunk” hearing the dial ton) is set to 10 seconds, after dialing the first digits the end of dial timer is set to 4 seconds. Each timeout can be easily modified editing the xml. The end of dial can also be forced as usual pressing the “#”. After the xml detected end of dial a directory is created named with the dialed number and inside the directory stored the number of the internal user. This architecture is done because more than one internal user could call the same external number. If in this case the far party calls back more times, the call will be connected the first time to the first internal user, the second incoming call will be connected to the second internal user etc.

Example: Internal user “1234” calls the external number “00451234”, the first “0” calls the XML “AutoCBout.xml” and that XML will create in the subdirectory “AutoRC” a directory called “0451234” and store in a file named “1234”. If after that the user “6789” calls even the number “00451234” the XML will add in the directory “…\AutoCB\0451234\ “the file “6789”. The file length of that “number files” is zero. Now the number “0451234” calls back and that call will be forwarded to the incoming XML “AutoCBin.xml”. That XML controls if in the directory “AutoCB” there is a subdirectory called “0451234”. If not the call is forwarded to the default destination, even if the internal number file has another day timestamp than the actual day. If not the Track “if you receive a call from this…” is played. If the caller dials “#” the call is forwarded to the first entry (the oldest one). The entry “1234” is canceled; so the first recall deletes the file “1234”. If “0451234” calls again follows the same behavior but now the name of the internal caller (file found) is the “6789” one. Even that second entry “6789” is deleted and now, because the directory is empty, also the directory “0451234” is deleted.

Note: In a FAT32 file system the number of directories is limited to 65.000, therefore that is also the maximum number of “open” recall calls, limit never reached in real live.


Date control

If there should not be a control of the date (call backs older than one day are not taken) just open the XML “AutoCBin.xml” with an editor and delete the lines:


<store-getstat root="" name="NULL" out-mday="$Jetztday" />

<switch var="$Jetztday">

<case not-equal="$mday">

<store-rmdir root="AutoRC/" name="$cgpn"/>

<call name="DefTrans" />



Save the XML, that´s it.


The call back message is available in German, Italian and English. If you need other languages or you want a different message feel free to record one. The XML will play the file “Track100.g7xx” therefore you can also use for example the track recorder to do this.

If there is no file “Track100.g711a” the entire message block is skipped and the re-caller is connected immediately to the internal caller.

Default destination

Open the file “Default.txt” and write in the first line the number of your “normal” Waiting Queue (or operator). All, not automatically connected calls, will be transferred to this target.

Dial tone

As default the dial tone (after accessing the XML out) the TONE interface tone is played. As an option also announcement files (or “tone files”) can be played. To do this open the XML “AutoCBin.xml” with an editor and modify the lines in the examples:

Example silence instead of tone:

Change the line <pbx-prompt url=”TONE” sec=”4” repeat=”true” /> to <pbx-prompt url=”$cntrl” sec=”4” repeat=”true” /> , now silence is played after the access to the xml.

Example user tone:

Change the line <pbx-prompt url=”TONE” sec=”4” repeat=”true” /> to <pbx-prompt url=”$cntrl” sec=”4” repeat=”true” /> and the line <store-get root=”” name=”silence.$coder” out-url=”$ctrl” / > to <store-get root=”” name=”MySong.$coder” out-url=”$ctrl” / >. Now the files Mysong.g711, Mysong.729 etc. will be played. Of cause you have to copy those files in the directory where the XML is running.


Create a working directory on your PC and copy all the files of the solution is there. Then modify the xml and text files as described in the switches section. Now create a directory in the CF and copy all files of your working directory in. Create in the PBX two VM Objects and put in the Url the path to the relative XMLs.

Important: add the option &$_pbxfwd=true in both xml path

Example: If you create a directory “AutoCB” in the CF the URL should be similar to “$_pbxfwd=true” and the second one to “$_pbxfwd=true”

The “AutoCBout.xml” is the one to call in outgoing (form the PBX point of view) while the “AutoCbin.xml” is the target for incoming calls.

PBX Setup

The PBX configuration used to enable this service is slightly different from the usual one.

First we must create two Voicemail objects configured respectively with AutoCBin.xml and AutoCBout.xml script files and distinct prefixes/numbers . AutoCBout voicemail object will be configured with the prefix usually reserved for the TRUNK access e.g. “0”. AutoCBin voicemail object will be configured with a number/prefix of your choice, in this example “*9” is used.


We will also need two TRUNK objects: one will be used for incoming calls and will be configured without prefix; the other will be used for outgoing calls and will be using a prefix instead.


Additionally we will need two distinct GW interfaces in the Relay. One interfaces for incoming calls will register to the TRUNK object configured without prefix and another interface for outgoing calls that will register on the TRUNK object configured with a prefix.


A specific routing configuration is therefore required. Incoming calls will be routed toward the GW interface responsible for incoming calls while outgoing calls will originate from the GW interface responsible for outgoing calls and will exit to the PSTN through the desired interface (SIP, BRI, PRI…).


All incoming calls will be sent to the Voicemail object configured with AutoCBin.xml file and a “0” (prefix configured on the Voicemail object using AutoCBout.xml) will be added to the CGPN traversing this route.

Then we have to configure three .txt files: Default.txt, PrefixIN.txt, PrefixOUT.txt.

Default.txt will be configured with the number of an existing PBX object that you want to define as default destination in those cases where the caller doesn’t make a selection or dials a different DTMF tone.

PrefixIN.txt will be configured with the prefix used for AutoCBout voicemail object.

PrefixOUT.txt will be configured with the prefix used for the TRUNK object used for outgoing calls.

Known Problems

Please note that this feature will not work if mobility extension feature is on. Do not confuse forking (free and on board) with mobility extension (license required). Anyway remember that if forking is on and mobility extension is on this feature will not work, so switch on just forking if this feature is required.


  • Download the complete file package of scripts and files described in this article.