Howto:IIS Active Server Page (.ASP) Sample Code for dynamic Announcements in V5

From innovaphone wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

V6 firmware features various mechanisms to implement dynamic announcements. V5 does not. However, using a web scripting language, this can easily be implemented. Here is how.

This solution will certainly work on V6 too. As there are better mechanisms avalailable, this is not recommended though.

The V5 PBX “Waiting queue” object features a powerful mechanism for providing customized announcements, based on HTTP file retrieval. Using standard web server scripting, dynamic announcement can be implemented, e.g. to vary announcements depending on the time of day.

Applies To

This information applies to

  • All IP PBX platforms

V5 firmware



More Information

Details

The PBX allows you to provide your own announcements for waiting queue objects. One particular convenient mechanism for providing your own announcement files is to put it on a web server in the intranet and to have the PBX retrieve the announcement is via the HTTP interface (see the PBX Administrator Manual for more details on how to configure announcements for a waiting queue object).

Sometimes however, announcements shall vary depending on certain external factors. For example, the switchboard announcement could be different during office hours (“you will be connected soon”) and during the rest of the time (“you are calling outside office hours”).

While there is no direct mechanism to implement this with the PBX (yet), it is fairly simple to do it using standard web scripting tools.

In this article, a solution based on Microsoft™’s ASP scripting is show. However, once you’ve got the idea, it should be easy enough to do it in PHP or anything similar.

System Requirements

For this sample to work, you will need an IIS with .ASP support enabled.

Installation

Save the attached zip file to your web servers publishing directory and unzip it. It will create a folder called “announcement”.

Open your IIS management console and create an ASP application on that path (script access is sufficient). Make sure that this application is accessible to unauthenticated HTTP clients (since the PBX will do an unauthenticated access).

Underneath the announce directory, create the following directories: music, music/inService, music/outOfService.

Copy your announcement file for business hours (see the document “How to use the Pseudo User Waiting.doc” on how to create announcement files) into the music/inService folder. Copy the announcement file for non-business hours into the music/outOfService folder. Make sure that both files have the same file name, so you end up with something like music/inService/hello.g729 and music/outOfService/hello.g729.

Open a web browser and go to http://host/announce/announce.asp?action=show.

You should see a page like

Wochentag: 5
Zeit       17:51
 
Aktueller Ansagestatus: outOfService
 
Dienst ist zeitgesteuert
 
Ordner für Ansagen: C:\Inetpub\wwwroot\announce\music\outOfService

Zeitsteuerung an/abstellen

If the current time is between 09:00am and 05:30pm, then you should see inService. If not, you should see outOfService.

Configuration

In the PBX, you first need an path to the http interface. Create a user object called http (long and short name), do not assign a number to it. Tick the gateway checkmark.

In the Gateway/Config area, create a GWxx (say GW12). Set it to register at gatekeeper as gateway, define 127.0.0.1 as ip address and add an alias with H323-id http. When activated, you should see the user http registered in the PBX.

Now add a route from GW12 to HTTP with an empty map.

In the PBX, configure your waiting queue object (second page) for 1st Announce, select Name and put http into the field next to Name. Configure http://w.x.y.z/announce/announce.asp?name=hello.g729&coder=g729 as URL (please note that you need to use the raw IP address of your server here, no FQDN).

Now take a phone, call the number of your waiting queue user and once the announcement is triggered, you should hear the right announcement, depending on the time of day and day of the week.

What is considered office hours is hard coded into announce.asp. You will easily figure out how to change this.

Please note that in V6, you would configure the HTTP URL directly into waiting queue object with no need to create the http object nor the GWxx and the corresponding routes. Then again, in V6 you would use the boolean object anyway.

Known Problems

This is not intended as production code. Look at is as sample code to bring you the idea.

Sample Code

ASP sample code

Related Articles

Boolean Object