# # $Id: ser-isdngw.conf,v 1.2 2003/09/09 17:48:22 ullstar Exp $ # debug=1 # debug level (cmd line: -dddddddddd) fork=yes log_stderror=no # (cmd line: -E) check_via=yes # (cmd. line: -v) dns=0 # (cmd. line: -r) rev_dns=0 # (cmd. line: -R) port=5060 listen=192.168.0.1 alias=mydomain.com children=8 fifo="/tmp/ser2_fifo" # Add the name of your system here #listen=yourhostname # for more names add alias entries, all that might be used as domain in SIP URI #alias=yourhostname.yourdomain.com #alias=your.ip.addr.ess # ------------------ module loading ---------------------------------- loadmodule "/usr/local/lib/ser/modules/mysql.so" loadmodule "/usr/local/lib/ser/modules/sl.so" loadmodule "/usr/local/lib/ser/modules/tm.so" loadmodule "/usr/local/lib/ser/modules/maxfwd.so" loadmodule "/usr/local/lib/ser/modules/vm.so" # ----------------- setting module-specific parameters --------------- # You may want to define things like databases here. Please refer to # the extensive SER documentation for this purpose. Module parameters # are always described in the modules README files. # # For pure isdn gateway functionality only a database is needed, we use # a simple textfile for this purpose. Actually this is only neccessary until # the vm module is reworked. Simply copy the etc/db directory from the isdngw # directory somewhere and specify it in the following statement: modparam("voicemail", "db_url","sql://ser:heslo@localhost/ser") # ------------------------- request routing logic ------------------- # This section describes how SIP messages are handled. route{ # initial sanity checks -- messages with # max_forwars==0, or excessively long requests if (!mf_process_maxfwd_header("20")) { sl_send_reply("483","Too Many Hops"); break; }; if (msg:len >= 2960) { # messages > 2 * max. sized eth. datagrams sl_send_reply("513", "Message too large"); break; }; if (src_ip != 192.168.0.2) { # Drop request that are not coming from the main proxy sl_send_reply("403", "Forbidden"); break; }; # deal with my domain first if (uri == myself) { # ############################## # # isdngw specific configuration # # ############################## # if (t_newtran()) { if (method == "INVITE" || method == "BYE" || method == "CANCEL"){ # send a response right at the start to avoid retransmissions t_reply("100","Trying -- just wait a minute !"); # isdngw only gets activated on invite requests if (method == "INVITE") { # Usernames begining with vm+ are destined to voicemail if (uri =~ "^[a-zA-Z]+:vm\+.*") { # remove the vm+ prefix strip(3); if (!vm("/tmp/am_fifo", "voicemail")) { log("Could not contact voicemail\n"); t_reply("500", "Could not contact voicemail"); }; } else if (uri =~ "^[a-zA-Z]+:[0-9]+@.*") { # isdngw feels to be responsible for numeric userparts # all numbers followed by @ and anything after it match # this expression # for example: sip:555123123@yourdomain.com:5061 matches. # The vm command (from module vm) is used to contact the # media server and though it the isdngw. # /tmp/am_fifo is the fifo filename ued for communications, make # shure the permissions are correct and that the same fifo # filename is defined in sems.conf. if (!vm("/tmp/am_fifo", "isdngw")) { log("could not contact isdngw\n"); t_reply("500","could not contact isdngw"); }; # we dont feel responsible for sip addresses not starting with # a number, so send the right error code. } else { if (!vm("/tmp/am_fifo", "announcement")) { log("could not contact announcement\n"); t_reply("500", "could not contact announcement"); }; }; # stop routing here, the message is now processed by the media server break; }; # The following handles the call termination, we must pass these requests # to the media server as follows. Again make shure the fifo name and permissions # are set correctly (like im sems.conf). if ((method == "BYE") || (method == "CANCEL")) { if (!vm("/tmp/am_fifo","bye")) { log("could not contact the media server\n"); t_reply("500","could not contact the media server"); }; break; }; # other methods than INVITE, BYE and CANCEL are not handled by this SIP Server # so we sent an error message } else { log("ERROR: method not supported\n"); t_reply("500", "Sorry, method not supported"); }; } else { # for any reason the transaction could not be created, send error code log("could not create new transaction\n"); sl_send_reply("500","Could not create new transaction"); }; # not uri=myself, this SIP request is not directed to us, simply direct it to its # correct destination } else { sl_send_reply("403", "No relaying"); break; }; # end of routing. }