Your Ad Here
 
Questions ? info@easylivecd.com

EasyLiveCD.com
FonoSIP.com
LiveCD VoIP Server
Linux LiveCD VoIP Server new
Buy with Google Checkout
Buy with PayPal
Snapshots
Advanced Modules
Network Diagram
AZ Termination
Admin Book
Order now
Contact
info@wifi.com.ar
Supported Phones
SIPphones
Nokia Symbian OS
Video Tutorials
Documentation
Index
QuickStart
Admin Guide
B2BUA
Changelog
FAQ
Admin Book
Sip Phones
Subscribe to new releases
News
VoIP
Linux forums
Tutorials new
WiFi.com.ar


Languages
English Site
Google Translations
German
Italian
Spanish
French
Chineese Simplified

Write to us info@wifi.com.ar

Indice de la Documentación

Linux LiveCD VoIP Server
http://www.wifi.com.ar/english/voip.html




Multiple AZ Termination Provider
with Automatic Backup Routes



# -- tm params --
# set time for which ser will be waiting for a final response;
# fr_inv_timer sets value for INVITE transactions, fr_timer
# for all others
modparam("tm", "fr_inv_timer", 15 )
modparam("tm", "fr_timer", 10 )


       # send out 00 prefix to pstn gateway
        if (uri=~"^sip:00[0-9].*@.*") {
               if (!is_user_in("From", "ld")) {
                       sl_send_reply("403", "Payment required");
                       break;
                };
                setflag(1);

                append_branch("sip:backup@66.199.250.114:5060");
                t_on_failure("1");

                rewritehostport("66.199.250.106:5060");
                t_relay();

                break;
		}


failure_route[1] {

        revert_uri();
        rewritehostport("66.199.250.114:5060");
        append_branch();
        t_on_failure("2");
        t_relay_to_udp("66.199.250.114", "5060");
}

failure_route[2] {
        # try out the last resort destination

        revert_uri();
        rewritehostport("193.110.69.3:5060");
        append_branch();
        t_relay_to_udp("193.110.69.3", "5060");
}




Full example ser.cfg
--------------------



#
# $Id: ser.cfg,v 1.21.4.1 2003/11/10 15:35:15 andrei Exp $
#
# simple quick-start config script
#

# ----------- global configuration parameters ------------------------

#debug=3         # debug level (cmd line: -dddddddddd)
#debug=1
#fork=yes
#log_stderror=no	# (cmd line: -E)

/* Uncomment these lines to enter debugging mode 
debug=7
fork=no
log_stderror=yes
*/

#debug=3
check_via=no	# (cmd. line: -v)
dns=no           # (cmd. line: -r)
rev_dns=no      # (cmd. line: -R)
#port=5060
#children=4
fifo="/tmp/ser_fifo"

listen=193.110.69.4
#listen=200.68.120.81
#alias="brujula4.brujula.net"
alias="ser.easy-sip.net"
alias="193.110.69.4"


# blind test ?
#syn_branch=no

# ------------------ module loading ----------------------------------

# Uncomment this if you want to use SQL database
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/rr.so"
loadmodule "/usr/local/lib/ser/modules/maxfwd.so"
loadmodule "/usr/local/lib/ser/modules/usrloc.so"
loadmodule "/usr/local/lib/ser/modules/registrar.so"
loadmodule "/usr/local/lib/ser/modules/acc.so"
loadmodule "/usr/local/lib/ser/modules/msilo.so"
loadmodule "/usr/local/lib/ser/modules/domain.so"
loadmodule "/usr/local/lib/ser/modules/nathelper.so"
loadmodule "/usr/local/lib/ser/modules/group.so"

# Uncomment this if you want digest authentication
# mysql.so must be loaded !
loadmodule "/usr/local/lib/ser/modules/auth.so"
loadmodule "/usr/local/lib/ser/modules/auth_db.so"

# answering machine
loadmodule "/usr/local/lib/ser/modules/vm.so"


# ----------------- setting module-specific parameters ---------------

# -- tm params --
# set time for which ser will be waiting for a final response;
# fr_inv_timer sets value for INVITE transactions, fr_timer
# for all others
modparam("tm", "fr_inv_timer", 15 )
modparam("tm", "fr_timer", 10 )

# --domain module--
modparam("usrloc", "db_url", "mysql://ser:heslo@localhost/ser")
modparam("domain", "db_mode", 1)
modparam("domain", "domain_table", "domain")
modparam("domain", "domain_col", "domain")

# --vm params--
modparam("voicemail", "db_url", "mysql://ser:heslo@localhost/ser")

# --msilo params--
#modparam("msilo", "registrar", "sip:registrar@ser.easy-sip.net)
#modparam("msilo", "db_url", "mysql://ser:heslo@localhost/ser")

# --group authorization
modparam("group", "db_url", "mysql://ser:heslo@localhost/ser")
modparam("group", "table", "grp")
modparam("group", "user_column", "username")
modparam("group", "group_column", "grp")

# --acc params--
modparam("acc", "log_level", 1)
modparam("acc", "log_flag", 1)
modparam("acc", "log_missed_flag", 2)
modparam("acc", "log_fmt", "fimos")
modparam("acc", "db_url", "mysql://ser:heslo@localhost/ser")
modparam("acc", "db_missed_flag", 2)
modparam("acc", "db_flag", 1)

# -- 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)



# -- tm params --
# set time for which ser will be waiting for a final response;
# fr_inv_timer sets value for INVITE transactions, fr_timer
# for all others
modparam("tm", "fr_inv_timer", 30 )
modparam("tm", "fr_timer", 3 )


# -------------------------  request routing logic -------------------

# main routing logic

route{


        # labeled all transaction for accounting
#        setflag(1);

        if(method=="INVITE" || method=="BYE")
                setflag(1);

	# initial sanity checks -- messages with
	# max_forwards==0, or excessively long requests
	if (!mf_process_maxfwd_header("10")) {
		sl_send_reply("483","Too Many Hops");
		break;
	};
	if ( msg:len > max_len ) {
		sl_send_reply("513", "Message too big");
		break;
	};

	# we record-route all messages -- to make sure that
	# subsequent messages will go through our proxy; that's
	# particularly good if upstream and downstream entities
	# use different transport protocol
	record_route();	
	# loose-route processing
	if (loose_route()) {
		t_relay();
		break;
	};



        # Make MSN Messenger happy...
#        if (method=="REGISTER") {
#                  log(1,"Register message\n");
#                  save("location");
#                  sl_send_reply("200","ok");
#                  break;
#       	};


        # rewrite voip.brujula.net to brujula4.brujula.net alias
#         if (uri=~"^sip:.*@ser.easy-sip.net") {
#                rewritehostport("ser.easy-sip.net:5060");
#        };

        # rewrite sip.brujula.net to voip.brujula.net alias
#         if (uri=~"^sip:.*@sip.easy-sip.net") {
#                rewritehostport("ser.easy-sip.net:5060");
#        };


        # wholesale service for 213.8.172.220
	# used only ip authentication, can be asterisk, multi port gateways
	# other ser proxys, etc

        if (uri=~"^sip:00[0-9]*@193.110.69.4" && src_ip==213.8.172.220) {
                setflag(1);
                rewritehostport("66.199.250.106:5060");
	        append_branch("sip:backup@66.199.250.114:5060");
        	t_on_failure("1");
                if (!t_relay()) {
                        sl_reply_error();
                };
                break;
        };



  	# send out 393 prefix to FWD
  	if (uri=~"^sip:393[0-9]*@.*") {
    		strip (3);
    		rewritehostport("fwd.pulver.com:5060");
                if (!t_relay()) {
                        sl_reply_error();
                };
    		break;
  	};


        # send out 411 to FWD (1 800 555 TELL)
        if (uri=~"^sip:411@.*") {
                rewritehostport("fwd.pulver.com:5060");
        	if (!t_relay()) {
                	sl_reply_error();
		};	
	#definitely needed !     
	break;
	};



# sems echo test, conference bridge configuration


if( uri =~ "sip:511.*@.*" | uri =~ "sip:613@.*" | uri =~ "sip:958.*@.*") {

if(method=="ACK" || method=="INVITE" || method=="BYE"){
        if(t_newtran()){
                t_reply("100","Trying -- just wait a minute !");

                        if(method=="INVITE"){
                                log(1,"**************** vm start - begin *********\n");
 

				if( uri =~ "sip:511.*@.*" ) {
                                if(!vm("/tmp/am_fifo","conference")){
                                   log("could not contact the conference machine\n");
                                   t_reply("500","could not contact the conference machine");
                                };
				}	

                                if( uri =~ "sip:613@.*" ) {
                                if(!vm("/tmp/am_fifo","echo")){
                                   log("could not contact the echo machine\n");
                                   t_reply("500","could not contact the echo machine");
                                };
                                }  


				if( uri =~ "sip:958.*@.*" ) {
                                if(!vm("/tmp/am_fifo","number_reader")){
                                   log("could not contact the number reader machine\n");
                                   t_reply("500","could not contact the number reader");
                                };
                                }


                   	log(1,"**************** vm start - end ******************\n");
			break;
                        };


                        if(method=="BYE"){
                                log(1,"**************** vm end - begin ******************\n");
                                if(!vm("/tmp/am_fifo","bye")){
                                        log("could vm end to sems \n");
                                        t_reply("500","could not contact sems");
                                };
                                log(1,"**************** vm end - end ******************\n");
                                break;
                         };
                }
                else {
                        log("could not create new transaction\n");
                        sl_send_reply("500","could not create new transaction");
                };
};
}






	# if the request is for other domain use UsrLoc
	# (in case, it does not work, use the following command
	# with proper names and addresses in it)

	if (uri==myself | uri=~"^sip:.*@ser.easy-sip.net" 
		| uri=~"^sip:.*@193.110.69.6" ) {

      		if (method=="REGISTER") {

                        # Uncomment this if you want to use digest authentication
                        if (!www_authorize("", "subscriber")) {
                                www_challenge("", "0");
                                break;
                        };
                        save("aliases");
                        save("location");
#                        break;

                };




		# native SIP destinations are handled using our USRLOC DB

		if (!lookup("location") && 
		( uri=~"^sip:8.*@ser.easy-sip.net" | uri=~"^sip:8.*@ser.easy-sip.net" )
		) {

#		if (!lookup("location")) {

          		# Voicemail specific configuration - begin

          		if(method=="ACK" || method=="INVITE" || method=="BYE"){

              		setflag(2);
              		if(t_newtran()){

                 		t_reply("100","Trying -- just wait a minute !");

                     		if(method=="INVITE"){
                          		log(1,"**************** vm start - begin ******************\n");
                                 	if(!vm("/tmp/am_fifo","voicemail")){
                                   	log("could not contact the answer machine\n");
                                   	t_reply("500","could not contact the answer machine");
                                };
                             	log(1,"**************** vm start - end ******************\n");
                                break;
                     	};

                        if(method=="BYE"){
                          	log(1,"**************** vm end - begin ******************\n");
                                if(!vm("/tmp/am_fifo","bye")){
                                  	log("could not contact the answer machine\n");
                                       	t_reply("500","could not contact the answer machine");
                                };
                            	log(1,"**************** vm end - end ******************\n");
                             	break;
                         };
          	}
                else {
                	log("could not create new transaction\n");
                       	sl_send_reply("500","could not create new transaction");
                };


	        /* Not found*/
#        	sl_send_reply("404","Not Found");
		break;
                };
	        # Voicemail specific configuration - end
	break;
	};

	# location==true, 
	# ser.easy-sip.net or fonosip.com registered user

        # send out 1800 18XX prefix to 216.234.116.184 (FWD asterisk gw)
        if (uri=~"^sip:18[0-9]*@.*") {
		setflag(1);
                rewritehostport("216.234.116.184:5060");
                if (!t_relay()) {
                        sl_reply_error();
                };
                break;
        };

       # send out 00 prefix to pstn gateway
        if (uri=~"^sip:00[0-9].*@.*") {
               if (!is_user_in("From", "ld")) {
                       sl_send_reply("403", "Payment required");
                       break;
                };
		setflag(1);

		append_branch("sip:backup@66.199.250.114:5060");
        	t_on_failure("1");

                rewritehostport("66.199.250.106:5060");
		t_relay();

#                if (!t_relay()) {
#                        sl_reply_error();
#                };
                break;
        };                            


	# end of if uri=myself
	};


	# if not local
	# just say 404 not found ...

#	if (uri!=~"^sip:8.*@.*brujula.net") {
#		sl_send_reply( "404" , "Not Found" );
#          	break;
#	}


        # forward to current uri now; use stateful forwarding; that
        # works reliably even if we forward from TCP to UDP

	if(method=="INVITE" || method=="BYE" || method=="ACK" )
		setflag(1);

	if (!t_relay()) {
		sl_reply_error();
	};

}

failure_route[1] {

        revert_uri();
        rewritehostport("66.199.250.114:5060");
        append_branch();
	t_on_failure("2");
        t_relay_to_udp("66.199.250.114", "5060");
#        t_relay();

}

failure_route[2] {
        # try out the last resort destination

        revert_uri();
        rewritehostport("193.110.69.3:5060");
        append_branch();
        t_relay_to_udp("193.110.69.3", "5060");
#        t_relay();

}


Indice de la Documentación




Products and Services Linux LiveCD Router (Free Download) | Download | Router PRO | Hotspot Server | Media Player | Samba File Server | VoIP Server | IP Camera Server | CDRouter Admin Manual | VoIP Server Book | Printed Book Format | Online Documentation |
Noticias Noticias WIFI News | Linux Router | VoIP | Hotspot new | Linux and WIFI Forums | ba.net



Contact us info@easylivecd.com
© EasyLiveCD.com, FonoSIP.com, WiFi.com.ar, BA.NET
>