In this chapter we will provide an overview of some added value services implemented using web interface. Serweb, the web interface for SIP Express Router described in Chapter 4, will be used as an example implementation of web-based added value services for SIP
Integration of SIP services with web interface is the most common scenario. Web interface is often used for provisioning of SIP products and for implementation of advanced services and web browser are available in vast majority of existing operating systems.
Click-to-Dial, in other words, it a method of establishing a call between participants using web interface. It greatly simplifies dialing in that callers do not have to dial lengthy addresses and they keep their phonebooks separately from SIP phones. In its simplest form a user has a web page where he can enter SIP addresses of two users and SIP user agents of those two users get connected. We will focus on REFER-based click-to-dial.
REFER based click-to-dial scenario is based on the paradigm of intelligent end devices and dumb network. One of involved SIP user agent is asked to connect to the other and report to the server when it is done.
Drawback of this approach is that one of involved SIP user agents must support REFER SIP method which has been standardized recently, see RFC3515. Big advantage that balances the previous drawback is that it is extremely easy to implement REFER based click to dial in the server.
Call-flow for REFER based click-to-dial is depicted on Figure 6.1.
First the SIP server sends an INVITE to one of the phones because phones usually do not accept REFER without prior invitation. The invite contains 0.0.0.0 as IP address in SDP because there is no remote phone (the message is sent by user agent within the SIP server which doesn't deal with media).
After that the server sends a REFER method which will ask the phone to send INVITE somewhere else. URI of the callee is passed to the phone in Refer-To header field of the REFER method.
The phone sends a NOTIFY method back to the server once the connection is established.
The click-to-dial feature allows creation of many advanced features, like phone-book in which you can click on an entry and your phone and phone of the person represented by the entry get connected. You can implement list of missed call in exactly the same way, clicking on an entry in the list will connect your phone with that person, and many others possible scenarios.
It is also possible to display presence of SIP users in a webpage (for example in a phone-book). Displaying on-line status of subscribers allows callers to determine availability and willingness to have a conversation conveniently. The status may be shown for example in caller's phonebook or on callee's homepage. Linking on-line users to click-to-dial application greatly integrates telephony with web and introduced convenience to users.
When a SIP phone registers, the SIP server records this information into a database. The web server can then access the database to see if a user is online or offline.
Go to iptel.org, create a new account and insert some entries into your phone-book to see how does it work.
Missed calls is a feature that allows users to display the list of call attempts that were made during the period when he was not online (registered in SIP). The list can be presented on a web page.
Recording missed calls has a lot of common with accounting. Servers doing accounting log some information when a call is successfully established and torn down. When a caller gets a negative final response to his call or doesn't receive any reply at all (timeout), then the server also records this event with a flag telling that it was a missed call. This information can be later used to compile the list of missed calls.
Serweb is a web frontend for for SIP Express Router, see Section 4.6.2 for more details. Serweb creates a user interface for users of the proxy server, where they can manage their account, change their configuration and do many advanced things.
Serweb is a set of php scripts. To run it you will need apache web server with php and mysql support. Because SIP Express Router and serweb talk together using FIFO interface, the SIP proxy and the web server must be running on the same machine.
Get serweb from http://developer.berlios.de/projects/serweb and untar the archive, it is recommended not to untar it to the document root of your web server. Alternatively you can get serweb using CVS:
lexport CVSROOT=:pserver:anonymous:@cvs.berlios.de:/cvsroot/serweb cvs login cvs co iptel
All the configuration of serweb is in config.php file in html subdirectory. You will need to configure the following:
It is necessary to create some aliases in the configuration file of apache web server:
Alias /iptel_img "/var/www/iptel/html/img" Alias /iptel_styles "/var/www/iptel/html/styles" Alias /user "/var/www/iptel/html/user_interface" Alias /admin "/var/www/iptel/html/admin"
Do not forget to update the directory path according to your real settings and make sure that you have register_globals and short_open_tag set to On in your php.ini file.
To login into serweb open http://<your_server>/user in your web browser. You will be prompted for username and password. The username and password is same as the one you are using in your SIP user agent to register at the server.
The “My Account” tab, see Figure 6.2 allows users to change their preferences and modified registered contacts. They can also see aliases they created and permissions for calling to PSTN.
Users can also create their own phone book, see Figure 6.3. In the phonebook you can see presence status of each user. If the user is currently registered then you will see “on line” in the status column. If he is not registered then you will see “offline” and if the user doesn't belong to administrative domain of the server then you will see “non-local”.
Clicking on the address of a user will establish a phone call between your and his phone, provided that your phone supports REFER, as described in Section 6.2.1.
Missed calls plane, see Figure 6.4, allows users' to see their missed calls. Again, clicking on an entry will connect you with that user and status describes presence of the user as described in the previous section.
When anyone sends a SIMPLE message to a user that is currently not online, the server will store the message and send it later when the recipient becomes online. In plane “message store”, see Figure 6.5 you can see all messages that are stored for you.
Message store has been implemented as a separate module for SIP Express Router. To use the module, you will need to load the module:
loadmodule "/usr/local/lib/ser/modules/msilo.so"
Configure address of the server (it will be used when sending stored messages) and URL of the database:
modparam("msilo", "registrar", "sip:registrar@<your_domain>")
modparam("msilo", "db_url", "sql://ser:passwd@dbhost/ser")
Then, when the server receives a MESSAGE requests and it can't deliver it because the recipient is offline, it will save the message:
if (!lookup("location")) {
if (method == "MESSAGE") {
if (!t_newtran()) {
sl_reply_error();
break;
};
if (m_store("0")) {
t_reply("202", "Accepted for Later Delivery");
break;
};
t_reply("503", "Service Unavailable");
break;
};
};
When lookup of recipient's location fails (the recipient is not registered), we create a new transaction (needed for msilo module), save the message using m_store command, and reply with “202 accepted”
Each time we call save("location") we have to check if the previously available user is registered again and if so then send stored messages. The following example shows how to do that:
if (!save("location")) {
sl_reply_error();
};
m_dump();
Command m_dump checks if the registering user has any stored messages and sends them if so.