well, I am lost, but not yet drunk.
In fact :
I Ihave a kamailio used to receive calls from an IP with no identification.
I detect the IP, query the DB to know who have to be billed.
Then I use uac_replace_from and also uac_auth to have the caller
authorisation on the main server.
No problems to setup the call.
the only problem is the hangup when the callee send a BYE, the BYE is
never forwarded to the caller...
Here is my cfg
# ------------------ module loading ----------------------------------
mpath="/usr/local/lib/kamailio/modules/"
loadmodule "avpops.so"
loadmodule "textops.so"
loadmodule "siputils.so"
loadmodule "xlog.so"
loadmodule "sl.so"
loadmodule "pv.so"
loadmodule "rr.so"
modparam("rr", "enable_full_lr", 1)
loadmodule "tm.so"
loadmodule "uac.so"
modparam("uac","credential","username:domain:password")
modparam("uac", "auth_username_avp", "$avp(i:1)")
modparam("uac", "auth_password_avp", "$avp(i:2)")
modparam("uac","auth_realm_avp","$avp(i:3)")
modparam("uac","from_restore_mode","auto")
modparam("uac","rr_store_param","my_param")
modparam("uac","from_passwd","") # for testing
purpose
loadmodule "db_mysql.so"
modparam("avpops","db_url","mysql://openser:openserrw@sql.XXX.be/openser")
modparam("avpops","avp_table","preferences")
modparam("avpops","attribute_column","pref_name")
modparam("avpops","value_column","pref_value")
modparam("avpops","uuid_column","pref_id")
# ----------------- setting module-specific parameters ---------------
# -- tm params --
# set time for which ser will be waiting for a final response;
# fr_inv_timer sets value for INVITE transactions, fr_timer
# for all others
#modparam("tm", "fr_inv_timer", 15 )
#modparam("tm", "fr_timer", 10 )
# ------------------------- request routing logic -------------------
# main routing logic
route{
# for testing purposes, simply okay all REGISTERs
if (method=="REGISTER")
{
log("REGISTER");
sl_send_reply("200", "ok");
exit;
};
if (is_method("INVITE"))
{
record_route();
uac_replace_from("sip:997321073@xxxxxx.be");
rewritehost("xxxxxx.be");
}
if (has_totag()) {
if (loose_route()) {
if (is_method("BYE")) {
xlog("L_NOTICE", "------------------> LOOSE
route");
t_relay();
if (!t_relay()) {
sl_reply_error();
}
exit;
}
}
}
t_on_failure("1");
t_relay();
}
failure_route[1]
{
if (t_check_status("407"))
{
avp_db_query("SELECT username, password, 'finalcut.be' FROM
subscriber WHERE username = 'zzzzzzzz'",
"$avp(i:1);$avp(i:2);$avp(i:3)");
uac_auth();
append_branch();
t_relay();
}
}