[OpenSIPS-Users] Paid Consultation Request
Geoffrey Mina
geoffreymina at gmail.com
Wed Feb 11 23:07:21 CET 2009
Thanks for your clarification. I do see where you are coming from.
Here is my config with some better comments. I have also attached the
file in case the email client mangles the formatting.
thanks,
Geoff
#
# OpenSIPS configuration
# by Geoff Mina
#
# Please refer to reference http://www.opensips.org/dokuwiki/doku.php
# for a full description of all modules and functions
#
#
###### Global Parameters #####
debug=1
log_stderror=no
log_facility=LOG_LOCAL0
fork=yes
children=16
disable_tcp=yes
listen=eth0:5060
listen=eth1:5060
port=5060
server_header="Server: G-Tel SIP Gateway"
#fork=no
#log_stderror=yes
##### Module Loading and Param Setting #####
mpath="/usr/local/lib64/opensips/modules/"
loadmodule "sl.so"
loadmodule "db_mysql.so"
loadmodule "maxfwd.so"
loadmodule "uri.so"
loadmodule "textops.so"
## Enable FIFO ##
loadmodule "mi_fifo.so"
modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
## Enable TM ##
loadmodule "tm.so"
modparam("tm","fr_timer",10)
modparam("tm","fr_inv_timer",30)
## Enable RR ##
loadmodule "rr.so"
modparam("rr", "enable_full_lr",0)
modparam("rr", "append_fromtag",1)
modparam("rr", "enable_double_rr",1)
modparam("rr", "add_username",0)
## Enable Logging ##
loadmodule "xlog.so"
modparam("xlog", "buf_size",4096)
modparam("xlog", "force_color",0)
## Enable SipTrace module for debugging SIP transactions ##
loadmodule "siptrace.so"
modparam("siptrace","db_url","mysql://[removed]:[removed]@localhost/opensips")
modparam("siptrace","table","sip_trace")
modparam("siptrace","trace_on",0)
modparam("siptrace","trace_flag",13)
## Enable Dispatcher module ##
loadmodule "dispatcher.so"
modparam("dispatcher","flags",2)
modparam("dispatcher","dst_avp","$avp(i:271)")
modparam("dispatcher","grp_avp","$avp(i:272)")
modparam("dispatcher","cnt_avp","$avp(i:273)")
modparam("dispatcher","ds_ping_method","OPTIONS")
modparam("dispatcher","ds_ping_from","sip:monitoring@[removed].com")
modparam("dispatcher","ds_ping_interval",30)
modparam("dispatcher","ds_probing_mode",1)
modparam("dispatcher", "ds_probing_threshhold", 2)
###########################################################################
## Request route 'main'
###########################################################################
route{
##
## Start with some simple logging and sip tracing
## For the time being we are going to sip trace everything
## just to make sure all packets are flowing properly
##
xlog("L_INFO", "New request - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
setflag(13);
sip_trace();
##
## Initial sanity check to ensure the message isn't too big
##
if(msg:len > max_len){
xlog("L_INFO", "Message too big\n");
t_reply("513", "Message Too Big");
exit;
}
##
## Ensure we aren't in a tight loop for some reason
## this number could probably be lower.
##
if (!mf_process_maxfwd_header("70")){
xlog("L_INFO", "Too many hops\n");
t_reply("483", "Too Many Hops");
exit;
}
##
## If this is anything other than a REGISTER method
## we want to insert the Record-Route header so the
## return path flows back through the gateway system
##
if(!is_method("REGISTER")){
xlog("L_INFO", "Recording Route info\n");
record_route();
}
if(is_method("INVITE")){
##
## If the method is an INVITE we are going to enter the
## route[1] method which is responsible for invoking the
## dispatcher and relaying the request to the end point
##
xlog("L_INFO", "Method is an INVITE, fetching next from dispatcher\n");
route(1);
}else if(is_method("OPTIONS")){
##
## If the method is an OPTIONS we are simply going to respond
## with a 200 OK. The internal monitoring platform (nagios) will be
## monitoring the health of the gateway via the check_sip plugin
##
xlog("L_INFO", "Method is an OPTIONS, probably just monitoring\n");
sl_send_reply("200","OK");
}else if(loose_route()){
##
## If we are in-dialog loose_route() should return true and we should
## end up here. I am not sure the subsequent check of has_totag() is
## necessary, but I could be wrong.
##
xlog("L_INFO", "Loose route has returned true, attempting routing.\n");
if(!has_totag()){
xlog("L_INFO", "Initial loose-route rejected\n");
t_reply("403","Initial Loose-Routing Rejected.");
exit;
}
route(2);
}else{
##
## In theory we shouldn't get here as anything that isn't an INVITE
## or an OPTIONS should be routed via the loose_route condition.
## I suppose there may be a timing issue where we need to account for a
## CANCEL request and forward it along.
##
if(is_method("CANCEL") || is_method("ACK")){
xlog("L_INFO", "We have an ACK or CANCEL");
route(3);
}
}
}
########################################################################
## Handles relay of INVITE messages
## with round-robin load balancing
##
## We select the next from the dispatcher
## using simple round-robin algorithm.
########################################################################
route[1]{
ds_select_domain("1","4");
t_on_reply("1");
t_on_failure("1");
t_relay();
}
########################################################################
## Handles relay of all non INVITE messages
##
## All messages which were routed via the loose_route
## condition will end up here. If there is a message that fails
## to t_rely there probably isn't much we can do other than
## return an error.
########################################################################
route[2]{
xlog("L_INFO", "Setting up reply handler and relaying request\n");
t_on_reply("1");
if(!t_relay()){
sl_reply_error();
}
}
########################################################################
## Handles relay of CANCEL or ACK messages
########################################################################
route[3]{
t_on_reply("1");
if(t_check_trans()){
if(!t_relay()){
xlog("L_INFO","Error relaying message route[3]\n");
sl_reply_error();
}
}else{
xlog("L_INFO","Dropping mis-routed request from route[3]\n");
}
exit;
}
#######################################################################
## Simply logs responses
#######################################################################
onreply_route[1]{
xlog("L_INFO", "Reply - S=$rs D=$rr F=$fu T=$tu IP=$si ID=$ci\n");
exit;
}
#######################################################################
## Handles failure of INVITE forwarding
#######################################################################
failure_route[1]{
xlog("L_INFO","Failure route, trying again\n");
if(t_check_status("408")){
xlog("L_INFO","Got a 408 Timeout, flagging dest as invalid\n");
ds_mark_dst();
route(1);
}else{
if(t_was_cancelled()){
xlog("L_INFO","Recieved a 4XX error for a cancelled transaction");
exit;
}else if(!t_relay()){
xlog("L_INFO","Error relaying error message");
exit;
}
}
}
On Wed, Feb 11, 2009 at 4:43 PM, Iñaki Baz Castillo <ibc at aliax.net> wrote:
> El Miércoles, 11 de Febrero de 2009, Geoffrey Mina escribió:
>> It's nice to see there are actually some folks out there who can
>> (almost) see where I am coming from. The general response of the
>> community is quite surprising. I was expecting much different
>> responses based on the level of support specific questions receive
>> when submitted.
>>
>> My system is working 100% error free in the 'lab' environment, so
>> hopefully you are correct in your assumption that I have achieved
>> success.
>>
>> I have heard everyone LOUD and CLEAR. Unless it's broken or not
>> working as expected... don't come here looking for advice and
>> mentoring!
>
> Please paste your configuration (better if you attach it as text file) and
> make a description of what it's supposed to do. Detail also in which points
> you could have some doubt.
>
> You didn't understand us (better if I speak just about me). I'm ready to help
> if I read a good and detailed description. What I don't like is the way you
> initiated your request, very honest, but unfeasible in fact (IMHO).
>
> So please, let's help you in a more feasible way :)
>
>
>
> --
> Iñaki Baz Castillo
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
-------------- next part --------------
#
# OpenSIPS configuration
# by Geoff Mina
#
# Please refer to reference http://www.opensips.org/dokuwiki/doku.php
# for a full description of all modules and functions
#
#
###### Global Parameters #####
debug=1
log_stderror=no
log_facility=LOG_LOCAL0
fork=yes
children=16
disable_tcp=yes
listen=eth0:5060
listen=eth1:5060
port=5060
server_header="Server: G-Tel SIP Gateway"
#fork=no
#log_stderror=yes
##### Module Loading and Param Setting #####
mpath="/usr/local/lib64/opensips/modules/"
loadmodule "sl.so"
loadmodule "db_mysql.so"
loadmodule "maxfwd.so"
loadmodule "uri.so"
loadmodule "textops.so"
## Enable FIFO ##
loadmodule "mi_fifo.so"
modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
## Enable TM ##
loadmodule "tm.so"
modparam("tm","fr_timer",10)
modparam("tm","fr_inv_timer",30)
## Enable RR ##
loadmodule "rr.so"
modparam("rr", "enable_full_lr",0)
modparam("rr", "append_fromtag",1)
modparam("rr", "enable_double_rr",1)
modparam("rr", "add_username",0)
## Enable Logging ##
loadmodule "xlog.so"
modparam("xlog", "buf_size",4096)
modparam("xlog", "force_color",0)
## Enable SipTrace module for debugging SIP transactions ##
loadmodule "siptrace.so"
modparam("siptrace","db_url","mysql://[removed]:[removed]@localhost/opensips")
modparam("siptrace","table","sip_trace")
modparam("siptrace","trace_on",0)
modparam("siptrace","trace_flag",13)
## Enable Dispatcher module ##
loadmodule "dispatcher.so"
modparam("dispatcher","flags",2)
modparam("dispatcher","dst_avp","$avp(i:271)")
modparam("dispatcher","grp_avp","$avp(i:272)")
modparam("dispatcher","cnt_avp","$avp(i:273)")
modparam("dispatcher","ds_ping_method","OPTIONS")
modparam("dispatcher","ds_ping_from","sip:monitoring@[removed].com")
modparam("dispatcher","ds_ping_interval",30)
modparam("dispatcher","ds_probing_mode",1)
modparam("dispatcher", "ds_probing_threshhold", 2)
###########################################################################
## Request route 'main'
###########################################################################
route{
##
## Start with some simple logging and sip tracing
## For the time being we are going to sip trace everything
## just to make sure all packets are flowing properly
##
xlog("L_INFO", "New request - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
setflag(13);
sip_trace();
##
## Initial sanity check to ensure the message isn't too big
##
if(msg:len > max_len){
xlog("L_INFO", "Message too big\n");
t_reply("513", "Message Too Big");
exit;
}
##
## Ensure we aren't in a tight loop for some reason
## this number could probably be lower.
##
if (!mf_process_maxfwd_header("70")){
xlog("L_INFO", "Too many hops\n");
t_reply("483", "Too Many Hops");
exit;
}
##
## If this is anything other than a REGISTER method
## we want to insert the Record-Route header so the
## return path flows back through the gateway system
##
if(!is_method("REGISTER")){
xlog("L_INFO", "Recording Route info\n");
record_route();
}
if(is_method("INVITE")){
##
## If the method is an INVITE we are going to enter the
## route[1] method which is responsible for invoking the
## dispatcher and relaying the request to the end point
##
xlog("L_INFO", "Method is an INVITE, fetching next from dispatcher\n");
route(1);
}else if(is_method("OPTIONS")){
##
## If the method is an OPTIONS we are simply going to respond
## with a 200 OK. The internal monitoring platform (nagios) will be
## monitoring the health of the gateway via the check_sip plugin
##
xlog("L_INFO", "Method is an OPTIONS, probably just monitoring\n");
sl_send_reply("200","OK");
}else if(loose_route()){
##
## If we are in-dialog loose_route() should return true and we should
## end up here. I am not sure the subsequent check of has_totag() is
## necessary, but I could be wrong.
##
xlog("L_INFO", "Loose route has returned true, attempting routing.\n");
if(!has_totag()){
xlog("L_INFO", "Initial loose-route rejected\n");
t_reply("403","Initial Loose-Routing Rejected.");
exit;
}
route(2);
}else{
##
## In theory we shouldn't get here as anything that isn't an INVITE
## or an OPTIONS should be routed via the loose_route condition.
## I suppose there may be a timing issue where we need to account for a
## CANCEL request and forward it along.
##
if(is_method("CANCEL") || is_method("ACK")){
xlog("L_INFO", "We have an ACK or CANCEL");
route(3);
}
}
}
########################################################################
## Handles relay of INVITE messages
## with round-robin load balancing
##
## We select the next from the dispatcher
## using simple round-robin algorithm.
########################################################################
route[1]{
ds_select_domain("1","4");
t_on_reply("1");
t_on_failure("1");
t_relay();
}
########################################################################
## Handles relay of all non INVITE messages
##
## All messages which were routed via the loose_route
## condition will end up here. If there is a message that fails
## to t_rely there probably isn't much we can do other than
## return an error.
########################################################################
route[2]{
xlog("L_INFO", "Setting up reply handler and relaying request\n");
t_on_reply("1");
if(!t_relay()){
sl_reply_error();
}
}
########################################################################
## Handles relay of CANCEL or ACK messages
########################################################################
route[3]{
t_on_reply("1");
if(t_check_trans()){
if(!t_relay()){
xlog("L_INFO","Error relaying message route[3]\n");
sl_reply_error();
}
}else{
xlog("L_INFO","Dropping mis-routed request from route[3]\n");
}
exit;
}
#######################################################################
## Simply logs responses
#######################################################################
onreply_route[1]{
xlog("L_INFO", "Reply - S=$rs D=$rr F=$fu T=$tu IP=$si ID=$ci\n");
exit;
}
#######################################################################
## Handles failure of INVITE forwarding
#######################################################################
failure_route[1]{
xlog("L_INFO","Failure route, trying again\n");
if(t_check_status("408")){
xlog("L_INFO","Got a 408 Timeout, flagging dest as invalid\n");
ds_mark_dst();
route(1);
}else{
if(t_was_cancelled()){
xlog("L_INFO","Recieved a 4XX error for a cancelled transaction");
exit;
}else if(!t_relay()){
xlog("L_INFO","Error relaying error message");
exit;
}
}
}
More information about the Users
mailing list