FW: [Users] OpenSER config help to talk to PSTN..
Bogdan-Andrei Iancu
bogdan at voice-system.ro
Tue Oct 17 18:45:23 CEST 2006
Hi Nick,
it's because of the forward function which changed its prototype;
instead of
forward(uri:host, uri:port);
use
forward();
see
http://openser.org/dokuwiki/doku.php/openser_v1.1.0_core_cookbook?#forward_destination
regards,
bogdan
Nick De Cristofaro wrote:
> below is my config file i modified it a bit.. still pretty basic.
> trying to get basic connectivity to a PSTN gateway. I modified an
> example file.
>
> errors I get are:
>
> bash-3.00# openser -c
> 0(6841) parse error (98,21-28): parse error
> 0(6841) parse error (98,29-30): bad arguments
> 0(6841) parse error (121,33-36): parse error
> 0(6841) parse error (121,51-52): bad forwardargument
> 0(6841) parse error (139,55-56): unknown command, missing loadmodule?
>
> 0(6841) parse error (145,55-56): unknown command, missing loadmodule?
>
> 0(6841) parse error (151,55-56): unknown command, missing loadmodule?
>
> 0(6841) parse error (163,10-11): parse error
> 0(6841) parse error (163,10-11):
> ERROR: bad config file (9 errors)
>
>
> #
> # $Id: openser.cfg,v 1.6.2.1 2006/07/17 15:51:03 klaus_darilion Exp $
> #
> # simple quick-start config script
> #
>
> # ----------- global configuration parameters ------------------------
>
> debug=3 # debug level (cmd line: -dddddddddd)
> fork=yes
> log_stderror=no # (cmd line: -E)
> alias=ip
> /* Uncomment these lines to enter debugging mode
> fork=no
> log_stderror=yes
> */
>
> check_via=no # (cmd. line: -v)
> dns=no # (cmd. line: -r)
> rev_dns=no # (cmd. line: -R)
> port=5060
> children=4
> fifo="/tmp/openser_fifo"
>
> #
> # uncomment the following lines for TLS support
> #disable_tls = 0
> #listen = tls:your_IP:5061
> #tls_verify_server = 1
> #tls_verify_client = 1
> #tls_require_client_certificate = 0
> #tls_method = TLSv1
> #tls_certificate = "/usr/local/etc/openser/tls/user/user-cert.pem"
> #tls_private_key = "/usr/local/etc/openser/tls/user/user-privkey.pem"
> #tls_ca_list = "/usr/local/etc/openser/tls/user/user-calist.pem"
>
> # ------------------ module loading ----------------------------------
>
> # Uncomment this if you want to use SQL database
> loadmodule "/usr/local/lib/openser/modules/mysql.so"
>
> loadmodule "/usr/local/lib/openser/modules/sl.so"
> loadmodule "/usr/local/lib/openser/modules/tm.so"
> loadmodule "/usr/local/lib/openser/modules/rr.so"
> loadmodule "/usr/local/lib/openser/modules/maxfwd.so"
> loadmodule "/usr/local/lib/openser/modules/usrloc.so"
> loadmodule "/usr/local/lib/openser/modules/registrar.so"
> loadmodule "/usr/local/lib/openser/modules/textops.so"
>
> # Uncomment this if you want digest authentication
> # mysql.so must be loaded !
> #loadmodule "/usr/local/lib/openser/modules/auth.so"
> #loadmodule "/usr/local/lib/openser/modules/auth_db.so"
>
> # ------------------ logs -------------------------------------------
>
> log_facility=LOG_LOCAL7
> #Add the xlog module:
> loadmodule "/usr/local/lib/openser/modules/xlog.so"
>
> # ----------------- setting module-specific parameters ---------------
>
> # -- usrloc params --
>
> modparam("usrloc", "db_mode", 0)
>
> # Uncomment this if you want to use SQL database
> # for persistent storage and comment the previous line
> #modparam("usrloc", "db_mode", 2)
>
> # -- auth params --
> # Uncomment if you are using auth module
> #
> #modparam("auth_db", "calculate_ha1", yes)
> #
> # If you set "calculate_ha1" parameter to yes (which true in this config),
> # uncomment also the following parameter)
> #
> #modparam("auth_db", "password_column", "password")
>
> # -- rr params --
> # add value to ;lr param to make some broken UAs happy
> modparam("rr", "enable_full_lr", 1)
>
> # ------------------------- request routing logic -------------------
> # main routing logic
>
> route{
>
> /* ********* ROUTINE CHECKS ********************************** */
>
> # filter too old messages
> if (!mf_process_maxfwd_header("10")) {
> log("LOG: Too many hops\n");
> sl_send_reply("483","Too Many Hops");
> return;
> };
> if (len_gt( max_len )) {
> sl_send_reply("513", "Wow -- Message too large");
> return;
> };
>
> /* ********* RR ********************************** */
>
> /* grant Route routing if route headers present */
> if (loose_route()) { t_relay(); return; };
>
> /* record-route INVITEs -- all subsequent requests must visit
> us */
> if (method=="INVITE") {
> record_route();
> };
>
> # now check if it really is a PSTN destination which should be
> handled
> # by our gateway; if not, and the request is an invitation,
> drop it --
> # we cannot terminate it in PSTN; relay non-INVITE requests --
> it may
> # be for example BYEs sent by gateway to call originator
> if (!uri=~"sip:\+?[0-9]+ at .*") {
> if (method=="INVITE") {
> sl_send_reply("403", "Call cannot be served
> here");
> } else {
> forward(uri:host, uri:port);
> };
> return;
> };
>
> # account completed transactions via syslog
> setflag(1);
>
> # authorize only for INVITEs -- RR/Contact may result
> in weird
> # things showing up in d-uri that would return our
> logic; our
> # major concern is INVITE which causes PSTN costs
>
> if (method=="INVITE") {
>
> # does the authenticated user have a
> permission for local
> # calls (destinations beginning with a single
> zero)?
> # (i.e., is he in the "local" group?)
> if (uri=~"sip:0[1-9][0-9]+ at .*") {
> if (!is_user_in("credentials", "local")) {
> sl_send_reply("403", "No
> permission for local calls");
> return;
> };
> # the same for long-distance (destinations
> begin with two zeros")
> } else if (uri=~"sip:00[1-9][0-9]+ at .*") {
> if (!is_user_in("credentials", "ld")) {
> sl_send_reply("403", " no
> permission for LD ");
> return;
> };
> # the same for international calls (three zeros)
> } else if (uri=~"sip:000[1-9][0-9]+ at .*") {
> if (!is_user_in("credentials", "int")) {
> sl_send_reply("403",
> "International permissions needed");
> return;
> };
> # everything else ( e.g., interplanetary
> calls) is denied
> } else {
> sl_send_reply("403", "Forbidden");
> return;
> };
>
> }; # INVITE to authorized PSTN
>
> }; # authorized PSTN
>
> # if you have passed through all the checks, let your call go
> to GW!
>
> rewritehostport("ip:5060");
>
> # forward the request now
> if (!t_relay()) {
> sl_reply_error();
> return;
> };
>
> }
> bash-3.00#
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Users mailing list
>Users at openser.org
>http://openser.org/cgi-bin/mailman/listinfo/users
>
>
More information about the sr-users
mailing list