Howto:Pin-code for trunk access

From innovaphone-wiki

Jump to: navigation, search

There are scenarios where user should access only to external numbers dialing as a prefix a valid pin-code.

On top the pin-code should appear also in the CDR record to allow a pin-code based billing (and not on telephone number base). The pin-code should be modified and maintained by the customer (user) without modify anything in the PBX and without using the web interface.

Of course you can realize in principle this feature using the PBX map object, but in this case the customer must modify the PBX setup and the result is even a very confused PBX listing especially if there are many pin-codes (for example if a customer requires 400 codes with 8 digit each, the result is a endless long PBX table).

Using instead a XML the pin-codes can be stored in a directory of the compact flash; the customer must just handle files on a mapped directory, an operation very familiar to everyone.

The article Howto:Voicemail Scripting And Projektcode, PIN, Auth Code describe a similar scenario but using and external server. In contrast this solution is much simpler and does all in the box. Different is also the behavior; in this case the pin-code is necessary for each call (and there is not a generally log in/log out of a set).


Applies To

This information applies to

• innovaphone PBX: V7 or higher

More Information

If a caller calls the xml he will hear the prompt “please dial your pin-code”. Now he can enter a valid pin code followed immediately by the required external number. It is also possible dial the entire number in one block or dial a part of the number in block mode and the rest of the number immediately after. This could be usefully if for example a customer configures a direct dial key with the access number of the XML and also the pin-code on it. So after pressing the “project” key it is possible to dial immediately the external number.

If an invalid pin-code is dialed the customer hears the voice prompt “the pin-code is invalid”.

Typically a user has just to dial the XML number followed by the pin-code and then the external number (so without for example the “0” for the line).

End of dial is forced if for 4 seconds no digit is dialed or if “#” is dialed (the “#” will not be dialed out anyway).

The pin-codes located in a directory of the compact flash and can be modified easily because they are simple empty text-files. The name of the file is the pin-code, so the file “123456.txt” means that “123456” is a valid pin-code. The content of the file is not controlled and so the file could be also empty (0 bytes file size).


Create a folder on the compact flash (for example “AC”) and a sub-folder named “accesscodes” (this name is mandatory, in this folder will be all the pin-codes). So your CF will be contain something like "//xx.yy.zz.dd/DRIVE/CF0/AC/accesscodes"

Unzipped now the content of the package provided in the Download section and copy it in the directory “AC” of the CF (“AC” or whatever you named, do not copy in the subdirectory “accesscodes”).

Edit now the following text files, please note that there are jet values in to give you an idea of the format.

AC digits.txt: insert number of digits of your PIN-Code (the “length” of the pin-codes, if for example your pin-code is “12345” enter “5” in the file)

ACline.txt: insert a prefix for the trunk line (or better the gatway).

Now you have to copy the voice-prompts. In the directory you will find files starting with “DE_....” and “IT_...” containing the German and Italian prompts. Rename the files in the language you like cutting the “DE_” or “IT_”. The result will be files named “PIN_ungultig.g711a”, “PIN_ungultig.g729”, “Please_enter_your_pin.g711” and “Please_enter_your_pin.g729”.

If you need any other language copy the prompts form the voicemail or produce them by yourself. If the files are missing the xml is anyway working, you just will not hear the relative prompts.

After that create the pin-codes = text files (empty or with text) in the subdirectory “accesscodes”, the name of the file is the code. So a file named “12345678.txt” means that the code “12345678” exists.


You have to create a Voicemail Object in your PBX. Your Script url will be similar to


Please note that this object will not require any license.

Before proceeding to configure routes you have to understand how the XML works.

Let’s assume as example that you XML has the number “9”, and you have a pin-code “1234” and you must call the external number “888”. So you have to dial “9”+”1234”+”888”. So your dialed number will be “91234888”. The xml gets the call and check first of all the pin code. Note that if the file “accesscodes/1234.txt” is found the call will be transfer to the number “1234888”! So the call is done to the number of the code and the external number.

What happened now depend on your PBX configuration. If for example all your pin-codes start with “3” you can make an abject or a route “3”. Better is to use a prefix and give the user the possibility to have the pin-codes he like to use. So if you have defined in the file “ACline.txt” a prefix this will be inserted automatically.

If for example you put in the file “ACline.txt” the number “3” the dialed number in our example will be “31234888” (remember: the user dial 9+1234+888, the result will be “3”+1234”+”888”).

You can now for example define a trunk object “3” and then in the routing cut of the 4 digits of the PIN or working with the “external” object and trunk 5 digits. The point is that in the CDR record you will see a called number “31234888” and if you filter the calls searching only the one beginning with “31234” you will have the calls from the pin-code “1234” (professional products like Samwin are able also to cut the “3” and similar).

It is also important to set the trunk object number as a NotOK destination under PBX-Config-Filter. Put it in a filter valid for all users. Ex the Normal filter. Then it is impossible for users to call the PIN-trunk direct and fake a pin code to get an external line.


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

Related Articles

Howto:Voicemail Scripting And Projektcode, PIN, Auth Code

Howto:DID on mapped numbers / Hide Pin Code

Personal tools