Gaoqiang Qian wrote:
Hello everyone,
I have setup the openser server with the very basic default
configuration. Now I have to configure my openser server to connect
with a xmpp envoironment on another host with a purpose of piloting
the SIP SIMPLE - XMPP IOP.
So does anyone here have successful experience of configure openser to
connect with XMPP on different hosts? Or could someone provide me some
instruction how to configure it.
I have not been able to make SIMPLE -> XMPP work. I have attached my
config below.
Also, what I do not understand is how the jabber server (jabberd2 in my
case) knows how to deal with the
sip_username<delim>openser_domain@xmpp_domain sitaution.
My jabber secret is the default secret.
Here is my config:
listen=udp:1.2.3.4:5060
mpath="/usr/local/lib/openser/modules"
children = 8
debug = 3
fork = yes
log_stderror = no
disable_tcp = no
log_facility = LOG_DAEMON
tcp_children = 4
mhomed = no
server_signature = yes
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", "db_url",
"mysql://user:pass@localhost/openser")
modparam("usrloc", "db_mode", 2)
loadmodule "mysql.so"
loadmodule "sl.so"
loadmodule "tm.so"
loadmodule "maxfwd.so"
loadmodule "textops.so"
loadmodule "registrar.so"
loadmodule "avpops.so"
loadmodule "pua.so"
modparam("pua", "db_url",
"mysql://user:pass@localhost/openser")
loadmodule "pua_mi.so"
loadmodule "pua_usrloc.so"
modparam("pua_usrloc", "default_domain",
"valid.domian.name")
loadmodule "rr.so"
modparam("rr", "enable_full_lr", 1)
loadmodule "mi_fifo.so"
modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo")
loadmodule "xmpp.so"
modparam("xmpp", "domain_separator", "*")
modparam("xmpp", "gateway_domain", "valid.domain.name")
modparam("xmpp", "xmpp_domain", "valid.domain.name")
modparam("xmpp", "xmpp_host", "valid.domain.name")
modparam("xmpp", "backend", "component")
loadmodule "pua_xmpp.so"
modparam("pua_xmpp", "server_address", "sip:1.2.3.4:5060")
loadmodule "xlog.so"
modparam("xlog", "buf_size", 4096)
modparam("xlog", "force_color", 0)
loadmodule "uri.so"
loadmodule "presence.so"
modparam("presence", "db_url",
"mysql://user:pass@localhost/openser")
modparam("presence", "max_expires", 60)
modparam("presence", "server_address", "sip:1.2.3.4:5060")
loadmodule "presence_xml.so"
modparam("presence_xml",
"db_url","mysql://user:pass@localhost/openser")
modparam("presence_xml", "force_active", 1)
#### Main Routing Block ####
route {
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
exit;
};
if (msg:len >= max_len) {
sl_send_reply("513", "Message too big");
exit;
};
if (has_totag()) {
if (loose_route()) {
route(1);
} else {
if (is_method("SUBSCRIBE") && $rd =
"1.2.3.4") {
# in-dialog subscribe requests
route(2);
exit;
}
if ( is_method("ACK") ) {
if ( t_check_trans() ) {
# non loose-route, but stateful
ACK; must be an ACK after a 487 or e.g. 404 from upstream server
t_relay();
exit;
} else {
# ACK without matching
transaction ... ignore and discard.\n");
exit;
}
}
sl_send_reply("404","Not here");
}
exit;
}
if (is_method("CANCEL")) {
if (t_check_trans())
t_relay();
exit;
}
t_check_trans();
# record routing
if (!is_method("REGISTER|MESSAGE"))
record_route();
if (!uri==myself)
route(1);
if(is_method("PUBLISH|SUBSCRIBE"))
route(2);
if (is_method("MESSAGE")) {
# THIS DOESN'T WORK EITHER :(
xlog("Processed MESSAGE method\n");
if (xmpp_send_message()) {
t_reply("200", "Accepted");
} else {
sl_send_reply("404", "Not found");
}
exit;
}
if (is_method("REGISTER")) {
sl_send_reply("100", "Trying");
#if (!www_authorize("", "subscriber")) {
# www_challenge("", "0");
# exit;
#};
if(!save("location")) {
xlog("L_ERR", "Saving contact failed - RURI=$ru
F=$fu T=$tu IP=$si ID=$ci\n");
sl_reply_error();
exit;
}
xlog("L_INFO", "Registration Successful - RURI=$ru
F=$fu\n");
exit;
};
if ($rU==NULL) {
# request with no Username in RURI
sl_send_reply("484","Address Incomplete");
exit;
}
if (is_method("INVITE")) {
xlog("L_INFO", "In invite\n");
if (!lookup("location")) {
xlog("L_ERR", "URI Unknown: $ru\n");
sl_send_reply("404", "Not Found");
exit;
}
}
route(1);
}
xlog("Unhandled message type: M=$rm RURI=$ru F=$fu T=$tu IP=$si
ID=$ci\n");
t_reply("503", "Service unavailable");
exit;
}
route[1] {
if (!t_relay()) {
sl_reply_error();
};
exit;
}
route[2] {
xlog("L_INFO", "Dealing with $rm F:$fu T:$tu\n");
sl_send_reply("100","trying");
if (!t_newtran()) {
sl_reply_error();
exit;
};
if(is_method("PUBLISH")) {
if($hdr(Sender)!= NULL) {
handle_publish("$hdr(Sender)");
} else {
handle_publish("");
}
t_release();
} else {
if(is_method("SUBSCRIBE")) {
handle_subscribe();
if (($hdr(Event)== "presence") && (uri =~
"^sip:.+@valid.domain.name")) {
xlog("L_INFO", "In subscribe,
winfo\n");
pua_xmpp_req_winfo("$ruri",
"$hdr(Expires)");
}
t_release();
}
}
exit;
}
onreply_route[1] {
exit;
}