# forwarding to Cisco phone
#
# $Id$
#


debug=9          # debug level (cmd line: -dddddddddd)
log_stderror=yes # (cmd line: -E)
check_via=yes     # (cmd. line: -v)
dns=on           # (cmd. line: -r)
rev_dns=yes      # (cmd. line: -R)
fork=yes
children=4
#fork=no          # (cmd. line: -D)
port=5080
#listen=127.0.0.1
listen=192.168.99.100
loop_checks=1
# for more info: sip_router -h

#modules
loadmodule "modules/print/print.so"
#loadmodule "modules/tm/tm.so"


route[0]{
	if ( t_lookup_request()) {
		if ( method=="ACK" )	{
			t_release();
#			forward(195.37.77.100, 5090 );
#			forward(195.37.78.146, 5060 );
# once it supports ACK too
#			t_forward(195.37.77.100, 5090 );
			t_forward("195.37.78.146", "5060" );
		} else {
			t_retransmit_reply();
		};
		t_unref();
	} else {
		if (method=="ACK") {
#			forward(195.37.77.100, 5090 );
			forward(195.37.78.146, 5060 );
		} else {
			t_add_transaction();
			if (method=="CANCEL") {
				t_send_reply( "200", "glad to cancel");
			} else {
				t_send_reply("100", "trying -- your call is important to us");
			};
#			t_forward("195.37.77.100", "5090" );
			t_forward("195.37.78.146", "5060" );
			break;
			t_unref();
		};
	};
		
}

#route[0] {
#	forward(195.37.78.146, 5060);
#	drop;
#}