<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>Hi All,<BR>
<BR>
I am using OpenSER as a NAT proxy for asterisk and would like to use it to deliver SIP 'MESSAGES' between clients.<BR>
<BR>
At the moment I have the following configuration however messages are not being sent to the other clients. Instead they are being passed to asterisk.<BR>
<BR>
I would be very grateful if anyone could point me in the right direction.<BR>
<BR>
Ross<BR>
<BR>
---------- Config --------------<BR>
<SPAN lang=EN> <BR>
debug=5 # debug level (cmd line: -dddddddddd)<BR>
fork=yes<BR>
log_stderror=yes # (cmd line: -E)<BR>
#/* Uncomment these lines to enter debugging mode <BR>
#fork=no<BR>
#log_stderror=yes<BR>
#*/<BR>
check_via=yes # (cmd. line: -v)<BR>
dns=no # (cmd. line: -r)<BR>
rev_dns=no # (cmd. line: -R)<BR>
port=5065<BR>
children=4<BR>
# --- module loading<BR>
mpath="/usr/local/lib64/openser/modules/"<BR>
loadmodule "mysql.so"<BR>
loadmodule "sl.so"<BR>
loadmodule "tm.so"<BR>
loadmodule "rr.so"<BR>
loadmodule "maxfwd.so"<BR>
loadmodule "usrloc.so"<BR>
loadmodule "registrar.so"<BR>
loadmodule "textops.so"<BR>
loadmodule "nathelper.so"<BR>
loadmodule "auth.so"<BR>
loadmodule "auth_db.so"<BR>
loadmodule "mi_fifo.so"<BR>
# --- setting module parameters<BR>
# -- mi_fifo params --<BR>
modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo")<BR>
modparam("usrloc|auth_db","db_url","<MYSQL CONNECTION STRING>")<BR>
# -- usrloc params --<BR>
modparam("usrloc", "db_mode", 2)<BR>
modparam("usrloc", "nat_bflag", 6)<BR>
# -- registrar params --<BR>
modparam("registrar|nathelper", "received_avp", "$avp(i:42)")<BR>
# -- auth params --<BR>
modparam("auth_db", "calculate_ha1", yes)<BR>
modparam("auth_db", "password_column", "password")<BR>
# -- rr params --<BR>
modparam("rr", "enable_full_lr", 1)<BR>
# -- nathelper params ---<BR>
modparam("nathelper", "rtpproxy_sock", "udp:127.0.0.1:7890")<BR>
modparam("nathelper", "natping_interval", 30)<BR>
modparam("nathelper", "ping_nated_only", 1)<BR>
modparam("nathelper", "sipping_bflag", 7)<BR>
modparam("nathelper", "sipping_from", "sip:<ADDRESS>")<BR>
# --- main routing logic<BR>
route{<BR>
if (!mf_process_maxfwd_header("10")) {<BR>
sl_send_reply("483","Too Many Hops");<BR>
exit;<BR>
};<BR>
if (msg:len >= 2048 ) {<BR>
sl_send_reply("513", "Message too big");<BR>
exit;<BR>
};<BR>
# NAT detection<BR>
route(2);<BR>
if (!method=="REGISTER")<BR>
{<BR>
record_route();<BR>
}<BR>
if (loose_route()) {<BR>
append_hf("P-hint: rr-enforced\r\n"); <BR>
route(1);<BR>
};<BR>
if (!uri==myself) {<BR>
append_hf("P-hint: outbound\r\n"); <BR>
route(1);<BR>
};<BR>
if (uri==myself) {<BR>
if (method=="REGISTER") {<BR>
if (!www_authorize("", "subscriber")) {<BR>
www_challenge("", "0");<BR>
exit;<BR>
};<BR>
<BR>
if (isflagset(5)) {<BR>
# set branch flag -- when someone will call this user<BR>
# the INVITE will have branch flag 6 set after lookup("location")<BR>
setbflag(6);<BR>
# if you want OPTIONS natpings uncomment next<BR>
# setbflag(7);<BR>
};<BR>
save("location");<BR>
exit;<BR>
};<BR>
if (!lookup("location")) {<BR>
sl_send_reply("404", "Not Found");<BR>
exit;<BR>
};<BR>
append_hf("P-hint: usrloc applied\r\n"); <BR>
};<BR>
<BR>
if(method=="MESSAGE")<BR>
{<BR>
if (!lookup("location"))<BR>
{<BR>
sl_send_reply("404", "User Offline");<BR>
exit;<BR>
}<BR>
route(4);<BR>
}<BR>
<BR>
if (method=="REGISTER")<BR>
{<BR>
save("location");<BR>
}<BR>
<BR>
route(1);<BR>
}<BR>
<BR>
route[1] {<BR>
if (subst_uri('/(sip:.*);nat=yes/\1/')){<BR>
setbflag(6);<BR>
};<BR>
if (isflagset(5)||isbflagset(6)) {<BR>
route(3);<BR>
}<BR>
if (!t_relay()) {<BR>
sl_reply_error();<BR>
};<BR>
exit;<BR>
}<BR>
route[2]{<BR>
force_rport();<BR>
if (nat_uac_test("19")) {<BR>
if (method=="REGISTER") {<BR>
fix_nated_register();<BR>
} else {<BR>
fix_nated_contact();<BR>
};<BR>
setflag(5);<BR>
};<BR>
}<BR>
<BR>
route[3] {<BR>
if (is_method("BYE")) <BR>
{<BR>
unforce_rtp_proxy();<BR>
} <BR>
else if (is_method("INVITE"))<BR>
{<BR>
force_rtp_proxy();<BR>
t_on_failure("2");<BR>
};<BR>
if (isflagset(5))<BR>
{<BR>
search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes');<BR>
}<BR>
t_on_reply("1");<BR>
}<BR>
route[4]<BR>
{<BR>
if (!t_relay()) <BR>
{<BR>
sl_reply_error();<BR>
};<BR>
exit;<BR>
}<BR>
<BR>
<BR>
failure_route[2] {<BR>
if (isbflagset(6) || isflagset(5)) <BR>
{<BR>
unforce_rtp_proxy();<BR>
}<BR>
}<BR>
onreply_route[1] <BR>
{<BR>
if ((isflagset(5) || isbflagset(6)) && status=~"(183)|(2[0-9][0-9])" && is_method("INVITE")) <BR>
{<BR>
force_rtp_proxy();<BR>
}<BR>
search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes');<BR>
if (isbflagset(6)) {<BR>
fix_nated_contact();<BR>
}<BR>
exit;<BR>
}<BR>
<BR>
<BR></SPAN>
<BR>
---------- End Config --------------<BR><br /><hr />Messenger's gone Mobile! <a href='http://clk.atdmt.com/UKM/go/msnnkmgl0010000001ukm/direct/01/' target='_new'>Get it now!</a></body>
</html>