Hi All,
 
I am trying to setup an OpenSER server with support for registration, messaging & presence however I am having a problem with the presence server.
 
I have had presence working correctly before, however for some reason it is no longer working. I have spent about two days trying everything!
 
I would really appreciate some advice with this. I have included my config below.
 
Thank you in advance,
 
Ross
 
------------------------------------------------------------------------------
listen = udp:my.ip.address:5060
mpath = "/usr/local/lib64/openser/modules"
children = 8
debug = 3
fork = yes
disable_tcp = no
#log_facility = LOG_DAEMON
log_facility = LOG_LOCAL0
log_stderror = yes
tcp_children = 4
mhomed = no
server_signature = yes
#sock_group = "openser"
#sock_mode = 0600
#sock_user = "openser"
#unix_sock = "/tmp/openser.sock"
#unix_sock_children = 1
#reply_to_via = no
#sip_warning = no
#check_via = no
#dns = no
#rev_dns = no
#disable_core_dump = no
#dns_try_ipv6 = yes
#dns_use_search_list = yes
loadmodule "usrloc.so"
modparam("usrloc", "user_column", "username")
modparam("usrloc", "domain_column", "domain")
modparam("usrloc", "contact_column", "contact")
modparam("usrloc", "expires_column", "expires")
modparam("usrloc", "q_column", "q")
modparam("usrloc", "callid_column", "callid")
modparam("usrloc", "cseq_column", "cseq")
modparam("usrloc", "methods_column", "methods")
modparam("usrloc", "flags_column", "flags")
modparam("usrloc", "user_agent_column", "user_agent")
modparam("usrloc", "received_column", "received")
modparam("usrloc", "socket_column", "socket")
modparam("usrloc", "use_domain", 0)
modparam("usrloc", "desc_time_order", 0)
modparam("usrloc", "timer_interval", 60)
modparam("usrloc", "db_url", "mysql://username:password@localhost/openser")
modparam("usrloc", "db_mode", 1)
modparam("usrloc", "matching_mode", 0)
modparam("usrloc", "cseq_delay", 20)
modparam("usrloc", "nat_bflag", 6)
loadmodule "registrar.so"
modparam("registrar", "default_expires", 3600)
modparam("registrar", "min_expires", 60)
modparam("registrar", "max_expires", 0)
modparam("registrar", "default_q", 0)
modparam("registrar", "append_branches", 1)
modparam("registrar", "case_sensitive", 0)
modparam("registrar", "received_param", "received")
modparam("registrar", "max_contacts", 0)
modparam("registrar", "retry_after", 0)
modparam("registrar", "method_filtering", 0)
modparam("registrar", "path_mode", 2)
modparam("registrar", "path_use_received", 0)
modparam("registrar", "received_avp", "$avp(i:801)")
loadmodule "rr.so"
modparam("rr", "enable_full_lr", 1)
modparam("rr", "append_fromtag", 1)
modparam("rr", "enable_double_rr", 1)
modparam("rr", "add_username", 0)
loadmodule "tm.so"
modparam("tm", "fr_timer", 30)
modparam("tm", "fr_inv_timer", 120)
modparam("tm", "wt_timer", 5)
modparam("tm", "delete_timer", 2)
modparam("tm", "noisy_ctimer", 0)
modparam("tm", "ruri_matching", 1)
modparam("tm", "via1_matching", 1)
modparam("tm", "unix_tx_timeout", 2)
modparam("tm", "restart_fr_on_each_reply", 1)
modparam("tm", "pass_provisional_replies", 0)
 
 
loadmodule "xlog.so"
modparam("xlog", "buf_size", 4096)
modparam("xlog", "force_color", 1)
loadmodule "mi_fifo.so"
modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo")
#modparam("mi_fif0", "fifo_name", "FIFO")
modparam("mi_fifo", "fifo_mode", 0660)
#modparam("mi_fifo", "fifo_group", "openser")
#modparam("mi_fifo", "fifo_user", "openser")
modparam("mi_fifo", "reply_dir", "/tmp/")
modparam("mi_fifo", "reply_indent", "\t")
loadmodule "domain.so"
modparam("domain", "db_url", "mysql://username:password@localhost/openser")
modparam("domain", "db_mode", 1)
modparam("domain", "domain_table", "domain")
modparam("domain", "domain_col", "domain")
loadmodule "nathelper.so"
modparam("nathelper", "natping_interval", 0)
modparam("nathelper", "ping_nated_only", 1)
modparam("nathelper", "rtpproxy_sock", "")
modparam("nathelper", "rtpproxy_disable_tout", 60)
modparam("nathelper", "rtpproxy_tout", 1)
modparam("nathelper", "rtpproxy_retr", 5)
modparam("nathelper", "sipping_method", "OPTIONS")
modparam("nathelper", "received_avp", "$avp(i:801)")
loadmodule "textops.so"
loadmodule "mediaproxy.so"
#modparam("mediaproxy", "mediaproxy_socket", "/var/run/proxydispatcher.sock")
modparam("mediaproxy", "mediaproxy_socket", "/var/run/mediaproxy.sock")
modparam("mediaproxy", "sip_asymmetrics", "/etc/openser/sip-asymmetric-clients")
modparam("mediaproxy", "rtp_asymmetrics", "/etc/openser/rtp-asymmetric-clients")
modparam("mediaproxy", "natping_interval", 60)
loadmodule "uri.so"
loadmodule "sl.so"
modparam("sl", "enable_stats", 1)
loadmodule "maxfwd.so"
modparam("maxfwd", "max_limit", 256)
loadmodule "mysql.so"
modparam("mysql", "ping_interval", 300)
modparam("mysql", "auto_reconnect", 1)
loadmodule "auth.so"
modparam("auth", "nonce_expire", 300)
modparam("auth", "rpid_suffix", ";party=calling;id-type=subscriber;screen=yes")
modparam("auth", "rpid_avp", "$avp(s:rpid)")
loadmodule "auth_db.so"
modparam("auth_db", "db_url", "mysql://username:password@localhost/openser")
modparam("auth_db", "user_column", "username")
modparam("auth_db", "domain_column", "domain")
modparam("auth_db", "password_column", "password")
#modparam("auth_db", "password_column_2", "ha1b")
modparam("auth_db", "calculate_ha1", 1)
modparam("auth_db", "use_domain", 0)
modparam("auth_db", "load_credentials", "$avp(s:caller_uuid)=id")
loadmodule "uri_db.so"
modparam("uri_db", "db_url", "mysql://username:password@localhost/openser")
modparam("uri_db", "uri_table", "uri")
modparam("uri_db", "uri_user_column", "username")
modparam("uri_db", "uri_domain_column", "domain")
modparam("uri_db", "uri_uriuser_column", "uri_user")
modparam("uri_db", "subscriber_table", "subscriber")
modparam("uri_db", "subscriber_user_column", "username")
modparam("uri_db", "subscriber_domain_column", "domain")
modparam("uri_db", "use_uri_table", 0)
modparam("uri_db", "use_domain", 0)
loadmodule "avpops.so"
modparam("avpops", "db_url", "mysql://username:password@localhost/openser")
modparam("avpops", "avp_table", "usr_preferences")
modparam("avpops", "use_domain", 0)
modparam("avpops", "uuid_column", "id")
modparam("avpops", "username_column", "username")
modparam("avpops", "domain_column", "domain")
modparam("avpops", "attribute_column", "attribute")
modparam("avpops", "value_column", "value")
modparam("avpops", "type_column", "type")
loadmodule "enum.so"
modparam("enum", "domain_suffix", "e164.org.")
loadmodule "permissions.so"
#modparam("permissions", "default_allow_file", "permissions.allow")
#modparam("permissions", "default_deny_file", "permissions.deny")
#modparam("permissions", "check_all_branches", 1)
#modparam("permissions", "allow_suffix", ".allow")
#modparam("permissions", "deny_suffix", ".deny")
modparam("permissions", "db_url", "mysql://username:password@localhost/openser")
modparam("permissions", "db_mode", 1)
modparam("permissions", "trusted_table", "trusted")
modparam("permissions", "source_col", "src_ip")
modparam("permissions", "proto_col", "proto")
modparam("permissions", "from_col", "from_pattern")
modparam("permissions", "tag_col", "tag")
modparam("permissions", "peer_tag_avp", "$avp(i:707)")
loadmodule "lcr.so"
modparam("lcr", "db_url", "mysql://username:password@localhost/openser")
modparam("lcr", "gw_table", "gw")
modparam("lcr", "gw_name_column", "gw_name")
modparam("lcr", "ip_addr_column", "ip_addr")
modparam("lcr", "port_column", "port")
modparam("lcr", "uri_scheme_column", "uri_scheme")
modparam("lcr", "transport_column", "transport")
modparam("lcr", "grp_id_column", "grp_id")
modparam("lcr", "lcr_table", "lcr")
modparam("lcr", "strip_column", "strip")
modparam("lcr", "prefix_column", "prefix")
modparam("lcr", "from_uri_column", "from_uri")
modparam("lcr", "priority_column", "priority")
modparam("lcr", "gw_uri_avp", "$avp(i:709)")
modparam("lcr", "ruri_user_avp", "$avp(i:500)")
modparam("lcr", "contact_avp", "$avp(i:711)")
modparam("lcr|tm", "fr_inv_timer_avp", "$avp(i:704)")
modparam("lcr", "fr_inv_timer", 90)
modparam("lcr", "fr_inv_timer_next", 30)
modparam("lcr", "rpid_avp", "$avp(i:302)")
modparam("lcr", "dm_flag", 25)
 
 
loadmodule "alias_db.so"
modparam("alias_db", "db_url", "mysql://username:password@localhost/openser")
modparam("alias_db", "user_column", "username")
modparam("alias_db", "domain_column", "domain")
modparam("alias_db", "alias_user_column", "alias_username")
modparam("alias_db", "alias_domain_column", "alias_domain")
modparam("alias_db", "use_domain", 0)
 
# ----- presence params -----
loadmodule "presence.so"
loadmodule "presence_xml.so"
loadmodule "presence_mwi.so"
loadmodule "pua.so"
loadmodule "pua_mi.so"
loadmodule "pua_usrloc.so"
modparam("presence|presence_xml", "db_url","mysql://username:password@localhost/openser")
modparam("presence_xml", "force_active", 1)
modparam("presence", "server_address", "sip:my.ip.address:5060")
modparam("presence", "presentity_table", "presentity")
modparam("presence", "active_watchers_table", "active_watchers")
modparam("presence", "watchers_table", "watchers")
modparam("presence", "clean_period", 100)
modparam("presence", "max_expires", 3600)
modparam("presence", "fallback2db", 1)
modparam("presence_xml", "xcap_table", "xcap")
modparam("presence_xml", "pidf_manipulation", 1)
modparam("presence_xml", "integrated_xcap_server", 1)
modparam("pua_usrloc", "default_domain", "my.domain.com")
modparam("presence", "to_tag_pref", 'pres')
 
 
########################################################################
# Request route 'main'
########################################################################
route[0]
{
xlog("L_INFO", "New request - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
force_rport();
if(msg:len > max_len)
{

xlog("L_INFO", "Message too big - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
sl_send_reply("513", "Message Too Big");
exit;
}
if (!mf_process_maxfwd_header("10"))
{

xlog("L_INFO", "Too many hops - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
sl_send_reply("483", "Too Many Hops");
exit;
}
if(!is_method("REGISTER|MESSAGE"))
{
if(nat_uac_test("19"))
{
record_route(";nat=yes");
}
else
{
record_route();
}
}

if(is_method("CANCEL") || is_method("BYE"))
{
end_media_session();
}
if(loose_route())
{
if(!has_totag())
{

xlog("L_INFO", "Initial loose-routing rejected - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
sl_send_reply("403", "Initial Loose-Routing Rejected");
exit;
}
if(nat_uac_test("19") || search("^Route:.*;nat=yes"))
{
fix_nated_contact();
setbflag(6);
}
route(7);
}
if(is_method("REGISTER"))
{
route(6);
}
if(is_method("INVITE"))
{
route(8);
}
if(is_method("PUBLISH|SUBSCRIBE"))
{
route(17);
}
if(is_method("CANCEL") || is_method("ACK"))
{
route(14);
}

############################
# MESSAGES #
############################
if(is_method("MESSAGE"))
{
route(18);
}
route(15);
}
########################################################################
# Request route 'clear-usr-preferences-caller'
########################################################################
route[1]
{
xlog("L_INFO", "Clear caller preferences - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
}
########################################################################
# Request route 'clear-usr-preferences-callee'
########################################################################
route[2]
{
xlog("L_INFO", "Clear callee preferences - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
}
########################################################################
# Request route 'usr-preferences-caller'
########################################################################
route[3]
{
route(1);
xlog("L_INFO", "Load caller preferences for uuid '$avp(s:caller_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
# load caller avps
avp_db_load("$avp(s:caller_uuid)", "*");

}
########################################################################
# Request route 'usr-preferences-callee'
########################################################################
route[4]
{
xlog("L_INFO", "Load callee preferences for uuid '$avp(s:callee_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
# load callee avps
avp_db_load("$avp(s:callee_uuid)", "*");

}
########################################################################
# Request route 'stop-media-proxy'
########################################################################
route[5]
{
if(isflagset(22))
{
end_media_session();
}

}
########################################################################
# Request route 'base-route-register'
########################################################################
route[6]
{
sl_send_reply("100", "Trying");
if(!www_authorize("", "subscriber"))
{

xlog("L_INFO", "Register authentication failed - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
www_challenge("", "0");
exit;
}
if(!check_to())
{

xlog("L_INFO", "Spoofed To-URI detected - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
sl_send_reply("403", "Spoofed To-URI Detected");
exit;
}
consume_credentials();
if(!search("^Contact:[ ]*\*") && nat_uac_test("19"))
{
fix_nated_register();
setbflag(6);
}
if(!save("location"))
{

xlog("L_ERR", "Saving contact failed - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
sl_reply_error();
exit;
}

xlog("L_INFO", "Registration successful - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
exit;

}
########################################################################
# Request route 'base-outbound'
########################################################################
route[7]
{
xlog("L_INFO", "ROUTE 7 RUN - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
if(isbflagset(6))
{
if(!isflagset(22) && !search("^Content-Length:[ ]*0"))
{
setflag(22);
use_media_proxy();
}

t_on_reply("2");
}
else
{

t_on_reply("1");
}
if(!isflagset(21))
{

t_on_failure("2");
}
if(isflagset(29))
{
append_branch();
}
if(is_present_hf("Proxy-Authorization"))
{
consume_credentials();
}

xlog("L_INFO", "Request leaving server, D-URI='$du' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
# no 100 (we already sent it) and no DNS blacklisting
if(!t_relay("0x05"))
{
sl_reply_error();
if(is_method("INVITE") && isbflagset(6))
{
end_media_session();
}
}
exit;

}
########################################################################
# Request route 'base-route-invite'
########################################################################
route[8]
{
sl_send_reply("100", "Trying");
if(from_gw())
{
$avp(s:caller_uuid) = "0";

xlog("L_INFO", "Call from PSTN' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
setflag(23);
}
else
{
if(allow_trusted())
{
if(is_avp_set("$avp(s:peer_uuid)/s"))
{
# use tag-column from trusted-table as uuid for this caller
avp_copy("$avp(s:peer_uuid)", "$avp(s:caller_uuid)/d");
}
else
{
# if no uuid is set, use "0" as default uuid
$avp(s:caller_uuid) = "0";
}

xlog("L_INFO", "Call from trusted peer with uuid '$avp(s:caller_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
if(!is_domain_local("$rd"))
{

xlog("L_INFO", "Rejecting peering attempt with non-local request domain - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
sl_send_reply("403", "Relaying Denied");
exit;
}
setflag(23);
}
else
{
# if(!proxy_authorize("", "subscriber"))
# {
#
# xlog("L_INFO", "Proxy authentication failed - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
# proxy_challenge("", "0");
# exit;
# }
# if(!check_from())
# {
#
# xlog("L_INFO", "Spoofed From-URI detected - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
# sl_send_reply("403", "Spoofed From-URI Detected");
# exit;
# }
}
}

if(nat_uac_test("19"))
{
fix_nated_contact();
setbflag(6);
}

route(9);
}
########################################################################
# Request route 'invite-find-callee'
########################################################################
route[9]
{
if(alias_db_lookup("dbaliases"))
{

xlog("L_INFO", "Callee was aliased - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
}

route(2);
if(!is_domain_local("$rd"))
{
setflag(20);
$avp(s:callee_uuid) = "0";

route(11);
}
avp_delete("$avp(s:callee_uuid)");
avp_db_query("select id from subscriber where username = '$rU'", "$avp(s:callee_uuid)");
if(is_avp_set("$avp(s:callee_uuid)"))
{

xlog("L_INFO", "Callee is local, uuid='$avp(s:callee_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
route(10);
}
else
{
$avp(s:callee_uuid) = "0";

xlog("L_INFO", "Callee is not local - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
route(11);
}
exit;

}
########################################################################
# Request route 'invite-to-internal'
########################################################################
route[10]
{
route(4);
if(!lookup("location"))
{

xlog("L_INFO", "Local user offline - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
sl_send_reply("404", "User Offline");
}
else
{

xlog("L_INFO", "Local user online - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
route(7);
}
exit;

}
########################################################################
# Request route 'invite-to-external'
########################################################################
route[11]
{
if(isflagset(20))
{

xlog("L_INFO", "Call to foreign domain - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
route(7);
exit;
}

route(13);
if(!isflagset(23))
{
# don't allow calls relaying from PSTN to PSTN, if not explicitely forwarded
if(uri =~ "^sip:[0-9]+@")
{
# only route numeric users to PSTN
if(!load_gws())
{

xlog("L_ERR", "Error loading PSTN gateways - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
sl_send_reply("503", "PSTN Termination Currently Unavailable");
exit;
}
if(!next_gw())
{

xlog("L_ERR", "No PSTN gateways available - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
sl_send_reply("503", "PSTN Termination Currently Unavailable");
exit;
}
setflag(21);

t_on_failure("1");
route(7);
}
}

xlog("L_INFO", "Call to unknown user - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
sl_send_reply("404", "User Not Found");
exit;

}
########################################################################
# Request route 'normalize-e164'
########################################################################
route[12]
{
# European numbering plans look like this:
# CC = country code (i.e. 43 for Austria)
# NDC = national destination code (i.e. 1 for Vienna)
# SN = subscriber number (i.e. 4001234)
#
# CC + NDC + SN, i.e. 4314001234
#
# Within the same CC+NDC, it can be omitted, so if
# +4314001234 wants to call +4315002345, one can dial
# just 5002345.
#
# Within the same CC, CC can be ommitted and a "0" is prefixed
# to NDC, so if +4314001234 wants to call +4326003456,
# one can dial 026003456.
#
# For international calls, either "00" or + is prefixed, like
# +49123456780 or 0049123456789.
#
avp_delete("$avp(s:orig_callee_user)/g");
$avp(s:orig_callee_user) = $rU;
if(uri =~ "^sip:(\+[1-9])?[0-9]+@")
{
# looks like a PSTN number
if(uri =~ "^sip:0[1-9][0-9]+@")
{
# we have format 0+NDC+SN
strip(1);
prefix("+44");
}
else if(uri =~ "^sip:00[1-9]+@")
{
# we have format 00 + CC + NDC + SN
strip(2);
prefix("+");
}
else if(!uri =~ "^sip:\+[1-9][0-9]+@")
{
# unknown format, maybe NDC wasn't added before?

xlog("L_INFO", "Not normalized callee '$avp(s:orig_callee_user)' to E.164 format - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
return(-1);
}
# else we have "+" + CC + NDC + SN

xlog("L_INFO", "Normalized callee '$avp(s:orig_callee_user)' to E.164 format '$rU' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
return(1);
}
else
{

xlog("L_INFO", "Not normalized callee '$avp(s:orig_callee_user)' to E.164 format - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
return(-1);
}

}
########################################################################
# Request route 'lookup-enum'
########################################################################
route[13]
{
route(12);
if($rc == 1)
{
if(enum_query("e164.org."))
{
# TODO: do GW fallback (load gws, set failure-route)?

xlog("L_INFO", "ENUM query succeeded - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
route(7);
exit;
}
else
{

xlog("L_INFO", "ENUM query failed - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
# ENUM query failed, revert $rU
avp_pushto("$ru/username", "$avp(s:orig_callee_user)");
}
}

}
########################################################################
# Request route 'base-route-local'
########################################################################
route[14]
{
t_on_reply("1");
if(t_check_trans())
{

xlog("L_INFO", "Request leaving server - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
if(!t_relay())
{
sl_reply_error();
}
}
else
{

xlog("L_INFO", "Dropping mis-routed request - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
}
exit;

}
########################################################################
# Request route 'base-route-generic'
########################################################################
route[15]
{
xlog("L_INFO", "Method not supported - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
sl_send_reply("501", "Method Not Supported Here");
exit;

}
########################################################################
# Request route 'base-filter-failover'
########################################################################
route[16]
{
if(!t_check_status("408|500|503"))
{

xlog("L_INFO", "No failover routing needed for this response code - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
route(5);
exit;
}

}
#########################################################################
# Presence
#########################################################################
route[17]
{
# if(nat_uac_test("19") || search("^Route:.*;nat=yes"))
# {
# fix_nated_contact();
# setbflag(6);
# }
 
if (!t_newtran())
{
sl_reply_error();
exit;
};
#if(is_method("PUBLISH"))
#{
# xlog("L_INFO", "PUBLISH - Process Publish Request - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
# handle_publish();
# t_release();
#}
if(is_method("PUBLISH"))
{
if($hdr(Sender)!= NULL)
handle_publish("$hdr(Sender)");
else
handle_publish();
t_release();
}
if(is_method("SUBSCRIBE"))
{
handle_subscribe();
xlog("L_INFO", "SUBSCRIBE - Process Subscribe Request - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
t_release();
}
exit;
}
########################################################################
# SEND MESSAGES
########################################################################
route[18]
{
if (!lookup("location"))
{
switch ($retcode)
{
case -1:
case -3:
t_newtran();
t_reply("404", "Not Found");
exit;
case -2:
sl_send_reply("405", "Method Not Allowed");
exit;
}
}
if (!t_relay()) {
sl_reply_error();
};
exit;
}
########################################################################
# Reply route 'base-standard-reply'
########################################################################
onreply_route[1]
{
xlog("L_INFO", "Reply - S=$rs D=$rr F=$fu T=$tu IP=$si ID=$ci\n");
exit;

}
########################################################################
# Reply route 'base-nat-reply'
########################################################################
onreply_route[2]
{
xlog("L_INFO", "NAT-Reply - S=$rs D=$rr F=$fu T=$tu IP=$si ID=$ci\n");
if(nat_uac_test("1"))
{
fix_nated_contact();
}
if(isbflagset(6) && status=~"(180)|(183)|2[0-9][0-9]")
{
if(!search("^Content-Length:[ ]*0"))
{
use_media_proxy();
}
}
exit;

}
########################################################################
# Failure route 'pstn-failover'
########################################################################
failure_route[1]
{
xlog("L_INFO", "Failure route for PSTN entered - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
route(16);
if(!next_gw())
{

xlog("L_ERR", "Failed to select next PSTN gateway - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
route(5);
exit;
}

t_on_failure("1");
route(7);
}
########################################################################
# Failure route 'base-standard-failure'
########################################################################
failure_route[2]
{
route(16);
route(5);
}


Think you know your TV, music and film? Try Search Charades!