As stated in the first part of this two part "series" one of the drawbacks of the approach to run an ECR script for every outgoing calls is the special dialing prefix to use. This part describes how to circumvent this restriction. Note: If you haven't read part 1 I suggest that you read it before continuing with this one.
As stated in the first part of this two part "series" one of the drawbacks of the approach to run an ECR script for every outgoing calls is the special dialing prefix to use. This part describes how to circumvent this restriction. Note: If you haven't read part 1 I suggest that you read it before continuing with this one.
Starting with v6.0 SwyxWare has a very flexible number conversion mechanism. Each number you dial, receive from your peer or which you signal as own number is fed to a conversion algorithm. The way how numbers are converted is defined by profiles to configuration much easier. If you ever have configured a trunk or trunk group in SwyxWare you know these profiles:

There a number conversion profile called "Dial as a PBX user". On a trunk you can use that to connect a sub-PBX. But this profile is also used when you use a client like SwyxIt! or SwyxPhone. We now use that to tweak our own prefix in front of every dialed external number. All default profiles are defined in a file called numberformatprofiles.config located in the SwyxWare program folder. Each profile consists of two rule set, one for calls "into" SwyxServer and one for calls "out of" SwyxServer. Each rule set has one or more rules. Here's an example:
<sp:ReplacementItem Prefix="[type=unknown][plap][icp]* "ReplacementString="+*"/>
It defines that if there's a number of unknown type which starts with a public line access prefix and an international call prefix, both prefixes will be removed and a "+" sign will be added. Example. Your SwyxWare is in Germany and your user account is in a location configured with typical German dialing parameters (public access prefix 0, international call prefix 00 and long distance call prefix 0). You dial 0004923147770. If the above rule is used, it converts that to +4923147770. There are a lot more rules in the rule set. The rule with the longest match wins.
To enforce that all dialed external calls are routed to the same special SwyxWare user account, we have to edit the rule set. The above rule would be
<sp:ReplacementItem Prefix="[type=unknown][plap][icp]* "ReplacementString="999+*"/>
That rule now makes a 999+4923147770 from a 0004923147770. The ECR script of user 999 can retrieve the additional digits behind the 999 and do anything you want.
You have to change all rules of the rule set which apply to outgoing calls for this to work. Don't change numberformatprofiles.config directly. Use an additional file called customnumberformatprofiles.config to define a new profile, e.g. with name PBXUser2. To let SwyxServer use that profile set the following registry value:
| Location: | HKLM:\Software\Swyx\IpPbxSrv\CurrentVersion\Options |
| Type: | REG_SZ |
| Name: | PBXUserNumberFormatProfile |
| Value: | (The name of your new profile) |
SwyxIt! Mobile calls which are made by Mobile Extension Manager use a different profile called MEMUser. To instruct SwyxServer to use a different profile for these types of calls set registry value MEMUserNumberFormatProfile.
I've attached a sample customnumberformatprofiles.config to this blog post.
Now you have it. Every outgoing calls runs the ECR script of user 999. But there's a problem. When your script tries to deliver the call by calling the ConnectTo function with the additionally dialed digits, "+4923147770" in our example, the same number conversion is applied again and "999+49123147770" is called again. The script calls itself. That's not what we want. But the solution is easy. Just add one rule to the already changed ruleset:
<sp:ReplacementItem Prefix="998* "ReplacementString="*"/>
That rule removes 998 from the beginning of a number. The ECR script of user 999 now has to make sure to always use prefix "998" when calling the ConnectTo function. In our example the script uses 998+4923147770, the new rule removes the 998 and the correct number is fed into SwyxServers address resolution. The call is delivered.
What can you do with that? Here are some ideas:
- Enforce your own dialing permissions
- Do your own least cost routing by adding an appropriate call-by-call prefix
- Play an announcement to the caller before establishing the call.
You probably have other ideas. It would be great if you could leave a comment and telling me.
Last, but not least a warning: This is no official SwyxWare feature. It's not part of the product and therefore has not been tested by Swyx Quality assurance department. Nevertheless: Have fun and let me know if you're using it somewhere.
Attachment: CustomNumberformatProfiles.zip
[Edit 26.5.08: Use customnumberformatprofiles.config instead of changing numberformatprofiles.config]