You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sems/doc/Howtostart_simpleproxy.txt

116 lines
4.1 KiB

* [1]Main Page
* [2]Related Pages
* [3]Namespaces
* [4]Data Structures
* [5]Files
* [6]Directories
* [7]Examples
How to set up a simple proxy for trying out and using SEMS
Introduction
This text describes how one can set up a simple SIP proxy in order to
try out services in SEMS.
We will use the Kamailio 3.0 default proxy installation, and add a
route SERVICES which adds the application name, and forwards the call
to SEMS. The same configuration can be used with the original SER
(iptel.org/ser), sip-router (sip-router.org) or other SER derivatives,
like OpenSIPS (opensips.org).
Installing Kamailio
To install Kamailio 3.0, there is excellent documentation on the
[8]Kamailio website. In debain lenny, or for example in Ubuntu 9.10,
one can install Kamailio with
$ wget http://www.kamailio.org/pub/kamailio/latest/packages/debian-lenny/kam
ailio_3.0.1_i386.deb
$ dpkg -i kamailio_3.0.1_i386.deb
To activate kamailio, one needs to set RUN_KAMAILIO=yes in
/etc/default/kamailio.
Adding a service route
Kamailio processes all requests according to the logic that is set in
the route section of its configuration file, which is a very flexible
one. In order to have services executed when some special numebrs are
called (e.g. 200 and 300), we add another route to
/etc/kamailio/kamailio.cfg:
route[SERVICES] {
if ($rU=~"^200.*") {
remove_hf("P-App-Name");
append_hf("P-App-Name: echo\r\n");
$ru = "sip:" + $rU + "@" + "127.0.0.1:5070";
route(RELAY);
exit;
}
if ($rU=~"^300.*") {
remove_hf("P-App-Name");
append_hf("P-App-Name: conference\r\n");
$ru = "sip:" + $rU + "@" + "127.0.0.1:5070";
route(RELAY);
exit;
}
}
This route block can be added anywhere, for example at the end, or
between the PSTN and the SERVICES routes.
Then, in the main route section, which is the one marked with the
comment # main request routing logic, we call our SERVICES-route,
preferably before (or after) the PSTN route:
...
if ($rU==$null) {
# request with no Username in RURI
sl_send_reply("484","Address Incomplete");
exit;
}
route(SERVICES);
route(PSTN);
# apply DB based aliases (uncomment to enable)
##alias_db_lookup("dbaliases");
if (!lookup("location")) {
...
Now, if we register a phone to the server, and call the 200 or the 300
number, the INVITE gets sent to 127.0.0.1:5070, with the application
that is to be called, added as header to the INVITE.
Setting up SEMS to select the application
If we load several applications in SEMS, we can select which
application to execute by the P-App-Name header. In sems.conf we set
application= so that SEMS looks into the P-App-Name header to determine
which application to run:
application=$(apphdr)
load_plugin=wav;gsm;ilbc;speex;session_timer;conference;echo
sip_ip=127.0.0.1
sip_port=5070
media_ip=some.public.ip.here
Note:
in this simple case, we could also have set application= and
used regular expression mapping in app_mapping.conf
__________________________________________________________________
Generated on Thu Feb 3 02:29:25 2011 for SEMS by [9]doxygen 1.6.1
References
1. file://localhost/home/stefan/devel/sems/sems/doc/doxygen_doc/html/index.html
2. file://localhost/home/stefan/devel/sems/sems/doc/doxygen_doc/html/pages.html
3. file://localhost/home/stefan/devel/sems/sems/doc/doxygen_doc/html/namespaces.html
4. file://localhost/home/stefan/devel/sems/sems/doc/doxygen_doc/html/annotated.html
5. file://localhost/home/stefan/devel/sems/sems/doc/doxygen_doc/html/files.html
6. file://localhost/home/stefan/devel/sems/sems/doc/doxygen_doc/html/dirs.html
7. file://localhost/home/stefan/devel/sems/sems/doc/doxygen_doc/html/examples.html
8. http://www.kamailio.org/dokuwiki/doku.php#setup
9. http://www.doxygen.org/index.html