<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
On 03.09.2009 12:00 Uhr, Rajesh wrote:
<br>
Yes i did cretae.. i completed authentication and presence module
successfully.. iam caught up with this.. am posting my cfg file below.
kindly correct me if iam wrong.
<br>
<br>
<br>
**************************************************************************************************************************************************
<br>
####### Global Parameters #########
<br>
<br>
debug=3
<br>
log_stderror=yes
<br>
log_facility=LOG_LOCAL0
<br>
<br>
##fork changed to NO manually from yes
<br>
fork=yes
<br>
#fork=yes
<br>
children=4
<br>
<br>
/* uncomment the following lines to enable debugging */
<br>
#debug=6
<br>
#fork=no
<br>
#log_stderror=yes
<br>
<br>
/* uncomment the next line to disable TCP (default on) */
<br>
#disable_tcp=yes
<br>
<br>
/* uncomment the next line to enable the auto temporary blacklisting of
<br>
not available destinations (default disabled) */
<br>
#disable_dns_blacklist=no
<br>
<br>
/* uncomment the next line to enable IPv6 lookup after IPv4 dns
<br>
lookup failures (default disabled) */
<br>
#dns_try_ipv6=yes
<br>
<br>
/* uncomment the next line to disable the auto discovery of local
aliases
<br>
based on revers DNS on IPs (default on) */
<br>
#auto_aliases=no
<br>
<br>
/* uncomment the following lines to enable TLS support (default off)
*/
<br>
#disable_tls = no
<br>
#listen = tls:your_IP:5061
<br>
#tls_verify_server = 1
<br>
#tls_verify_client = 1
<br>
#tls_require_client_certificate = 0
<br>
#tls_method = TLSv1
<br>
#tls_certificate = "/usr/local//etc/kamailio/tls/user/user-cert.pem"
<br>
#tls_private_key = "/usr/local//etc/kamailio/tls/user/user-privkey.pem"
<br>
#tls_ca_list = "/usr/local//etc/kamailio/tls/user/user-calist.pem"
<br>
<br>
<br>
port = 5067
<br>
/* uncomment and configure the following line if you want Kamailio to
<br>
bind on a specific interface/port/proto (default bind on all
available) */
<br>
#listen=udp:192.168.1.2:5060
<br>
<br>
<br>
####### Modules Section ########
<br>
<br>
#set module path
<br>
mpath="<i class="moz-txt-slash"><span class="moz-txt-tag">/</span>usr/local//lib/kamailio/modules<span
class="moz-txt-tag">/</span></i>"
<br>
<br>
/* uncomment next line for MySQL DB support */
<br>
loadmodule "db_mysql.so"
<br>
loadmodule "mi_fifo.so"
<br>
loadmodule "sl.so"
<br>
loadmodule "tm.so"
<br>
loadmodule "rr.so"
<br>
loadmodule "pv.so"
<br>
loadmodule "textops.so"
<br>
loadmodule "usrloc.so"
<br>
loadmodule "maxfwd.so"
<br>
loadmodule "imc.so"
<br>
loadmodule "uri_db.so"
<br>
loadmodule "siputils.so"
<br>
loadmodule "xlog.so"
<br>
loadmodule "acc.so"
<br>
loadmodule "registrar.so"
<br>
loadmodule "auth.so"
<br>
loadmodule "auth_db.so"
<br>
<br>
loadmodule "alias_db.so"
<br>
loadmodule "domain.so"
<br>
loadmodule "presence.so"
<br>
loadmodule "presence_xml.so"
<br>
<br>
#n#loadmodule "nathelper.so"
<br>
<br>
<br>
##insert function tested here
<br>
<br>
# ----------------- setting module-specific parameters ---------------
<br>
<br>
<br>
# ----- mi_fifo params -----
<br>
modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo")
<br>
<br>
<br>
<br>
<br>
# ----- rr params -----
<br>
# add value to ;lr param to cope with most of the UAs
<br>
modparam("rr", "enable_full_lr", 1)
<br>
# do not append from tag to the RR (no need for this script)
<br>
modparam("rr", "append_fromtag", 0)
<br>
<br>
<br>
# ----- rr params -----
<br>
modparam("registrar", "method_filtering", 1)
<br>
/* uncomment the next line to disable parallel forking via location */
<br>
# modparam("registrar", "append_branches", 0)
<br>
/* uncomment the next line not to allow more than 10 contacts per AOR
*/
<br>
#modparam("registrar", "max_contacts", 10)
<br>
<br>
<br>
# ----- uri_db params -----
<br>
/* by default we disable the DB support in the module as we do not need
it
<br>
in this configuration */
<br>
modparam("uri_db", "use_uri_table", 0)
<br>
modparam("uri_db", "db_url", "")
<br>
<br>
<br>
# ----- acc params -----
<br>
/* what sepcial events should be accounted ? */
<br>
modparam("acc", "early_media", 1)
<br>
modparam("acc", "report_ack", 1)
<br>
modparam("acc", "report_cancels", 1)
<br>
/* by default ww do not adjust the direct of the sequential requests.
<br>
if you enable this parameter, be sure the enable "append_fromtag"
<br>
in "rr" module */
<br>
modparam("acc", "detect_direction", 0)
<br>
/* account triggers (flags) */
<br>
modparam("acc", "failed_transaction_flag", 3)
<br>
modparam("acc", "log_flag", 1)
<br>
modparam("acc", "log_missed_flag", 2)
<br>
modparam("acc", "log_extra",
"src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
<br>
/* uncomment the following lines to enable DB accounting also */
<br>
modparam("acc", "db_flag", 1)
<br>
modparam("acc", "db_missed_flag", 2)
<br>
modparam("domain", "db_url",
"mysql://openser:openserrw@localhost/openser")
<br>
modparam("acc","db_extra","src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
<br>
<br>
<br>
# ----- usrloc params -----
<br>
modparam("usrloc", "db_mode", 2)
<br>
modparam("usrloc", "db_url",
"mysql://openser:openserrw@localhost/openser")
<br>
<br>
# ----- auth_db params -----
<br>
/* uncomment the following lines if you want to enable the DB based
<br>
authentication */
<br>
modparam("auth_db", "calculate_ha1", yes)
<br>
modparam("auth_db", "password_column", "password")
<br>
modparam("auth_db",
"db_url","mysql://openser:openserrw@localhost/openser")
<br>
modparam("auth_db", "load_credentials", "")
<br>
<br>
###registrar params added for imc
<br>
# -- registrar params --
<br>
modparam("registrar", "default_expires", 120)
<br>
# -- registrar params --
<br>
modparam("usrloc", "db_mode", 0)
<br>
<br>
# -- imc params --
<br>
modparam("imc", "imc_cmd_start_char", "#")
<br>
modparam("imc|usrloc", "db_url", <a class="moz-txt-link-rfc2396E"
href="mailto:mysql://openser:openserrw@192.168.64.75/openser">"mysql://openser:openserrw@192.168.64.75/openser"</a>)
<br>
##the following three lines were added seperately for imc
<br>
modparam("imc", "rooms_table","imc_rooms")
<br>
modparam("imc", "rooms_table","imc_members")
<br>
modparam("imc", "hash_size", 8)
<br>
<br>
<br>
# -- tm params --
<br>
modparam("tm", "fr_timer", 10 )
<br>
modparam("tm", "fr_inv_timer", 15 )
<br>
modparam("tm", "wt_timer", 10 )
<br>
<br>
<br>
<br>
# ----- alias_db params -----
<br>
/* uncomment the following lines if you want to enable the DB based
<br>
aliases */
<br>
modparam("alias_db",
"db_url","mysql://openser:openserrw@localhost/openser")
<br>
<br>
<br>
# ----- domain params -----
<br>
/* uncomment the following lines to enable multi-domain detection
support */
<br>
modparam("domain", "db_url",
"mysql://openser:openserrw@localhost/openser")
<br>
modparam("domain", "db_mode", 1) # Use caching
<br>
<br>
<br>
# ----- multi-module params -----
<br>
/* uncomment the following line if you want to enable multi-domain
support
<br>
in the modules (dafault off) */
<br>
modparam("alias_db|auth_db|usrloc|uri_db", "use_domain", 1)
<br>
<br>
<br>
# ----- presence params -----
<br>
/* uncomment the following lines if you want to enable presence */
<br>
modparam("presence|presence_xml", "db_url",
"mysql://openser:openserrw@localhost/openser")
<br>
modparam("presence_xml", "force_active", 1)
<br>
modparam("presence", "server_address", <a class="moz-txt-link-rfc2396E"
href="sip:192.168.64.75:5060">"sip:192.168.64.75:5060"</a>)
<br>
<br>
# -- nathelper
<br>
#n#modparam("nathelper", "rtpproxy_sock", "udp:127.0.0.1:7722")
<br>
#n#modparam("nathelper", "natping_interval", 30)
<br>
#n#modparam("nathelper", "ping_nated_only", 1)
<br>
#n#modparam("nathelper", "sipping_bflag", 7)
<br>
#n#modparam("nathelper", "sipping_from", <a
class="moz-txt-link-rfc2396E" href="sip:pinger@kamailio.org">"sip:pinger@kamailio.org"</a>)
<br>
#n#modparam("registrar|nathelper", "received_avp", "$avp(i:80)")
<br>
#n#modparam("usrloc", "nat_bflag", 6)
<br>
<br>
####### Routing Logic ########
<br>
<br>
<br>
<br>
<br>
<br>
# main request routing logic
<br>
<br>
<br>
route{
<br>
insert_hf("To-username: test");
<br>
<br>
if (!mf_process_maxfwd_header("10"))
<br>
{
<br>
sl_send_reply("483","Too Many Hops");
<br>
exit;
<br>
}
<br>
########The following set of lines were added for implementing imc
<br>
<br>
# registrations -
<br>
<br>
##the following line has been added for creating chat rooms
<br>
##insert_hf (#create chat-000)
<br>
if(is_method("REGISTER")) {
<br>
save("location");
<br>
exit;
<br>
}
<br>
##if(uri=~<a class="moz-txt-link-rfc2396E" href="sip:q*@">"sip:q*@"</a>)
<br>
## if(uri=~<a class="moz-txt-link-rfc2396E"
href="sip:chat0000@192.168.64.75">"sip:chat0000@192.168.64.75"</a>)
<br>
<br>
##the below line has been edited by Rajesh.
<br>
if(uri=~<a class="moz-txt-link-rfc2396E"
href="sip:chat0000@192.168.64.75">"sip:chat0000@192.168.64.75"</a>)
<br>
{
<br>
# IMC - message
<br>
#imc xdbg("script: message from [$fu ] r-uri [$ru ] msg
[$rb]\n");
<br>
##the above two lines are edited for imc by Rajesh.
<br>
xdbg("script: message from [$fu ] chatroom000 [$ru ] msg
[$rb]\n");
<br>
if(is_method("MESSAGE"))
<br>
{
<br>
log("MESSAGE received -> processing with imc\n");
<br>
sl_send_reply("200", "ok");
<br>
imc_manager(); exit;
<br>
} else {
<br>
sl_send_reply("404", "not found");
<br>
exit;
<br>
};
<br>
} else {
<br>
xdbg("script: message not for room, from [$fu ] r-uri [$ru]
msg
<br>
[$rb]\n");
<br>
if(!lookup("location"))
<br>
{
<br>
sl_send_reply("404", "not found");
<br>
exit;
<br>
}
<br>
t_relay();
<br>
#sl_send_reply("200", "ok");
<br>
exit();
<br>
};
<br>
#######The above lines were added for implementing imc
<br>
#insert function tested below
<br>
insert_hf("Test1");
<br>
<br>
# NAT detection
<br>
route(4);
<br>
<br>
if (has_totag()) {
<br>
# sequential request withing a dialog should
<br>
# take the path determined by record-routing
<br>
if (loose_route()) {
<br>
if (is_method("BYE")) {
<br>
setflag(1); # do accounting ...
<br>
setflag(3); # ... even if the transaction fails
<br>
}
<br>
route(1);
<br>
} else {
<br>
if (is_method("SUBSCRIBE") && uri == myself) {
<br>
# in-dialog subscribe requests
<br>
route(2);
<br>
exit;
<br>
}
<br>
if ( is_method("ACK") ) {
<br>
## insert functioin tested below
<br>
insert_hf("Test_in_ACK");
<br>
if ( t_check_trans() ) {
<br>
# non loose-route, but stateful ACK; must be an ACK
after a 487 or e.g. 404 from upstream server
<br>
t_relay();
<br>
exit;
<br>
} else {
<br>
# ACK without matching transaction ... ignore and
discard.\n");
<br>
exit;
<br>
}
<br>
}
<br>
sl_send_reply("404","Not here");
<br>
}
<br>
exit;
<br>
}
<br>
<br>
#initial requests
<br>
<br>
<br>
# CANCEL processing
<br>
if (is_method("CANCEL"))
<br>
{
<br>
if (t_check_trans())
<br>
t_relay();
<br>
exit;
<br>
}
<br>
<br>
t_check_trans();
<br>
<br>
# authentication
<br>
route(3);
<br>
<br>
# record routing
<br>
if (!is_method("REGISTER|MESSAGE"))
<br>
record_route();
<br>
<br>
# account only INVITEs
<br>
if (is_method("INVITE")) {
<br>
#insert_hf("To-username: test");
<br>
<br>
<br>
setflag(1); # do accounting
<br>
}
<br>
if (!uri==myself)
<br>
/* replace with following line if multi-domain support is used */
<br>
##if (!is_uri_host_local())
<br>
{
<br>
append_hf("P-hint: outbound\r\n");
<br>
# if you have some interdomain connections via TLS
<br>
##if($rd=="tls_domain1.net") {
<br>
## t_relay("tls:domain1.net");
<br>
## exit;
<br>
##} else if($rd=="tls_domain2.net") {
<br>
## t_relay("tls:domain2.net");
<br>
## exit;
<br>
##}
<br>
route(1);
<br>
}
<br>
<br>
# requests for my domain
<br>
<br>
insert_hf ("Test2");
<br>
if( is_method("PUBLISH|SUBSCRIBE"))
<br>
route(2);
<br>
<br>
if (is_method("REGISTER"))
<br>
{
<br>
if (!save("location"))
<br>
sl_reply_error();
<br>
<br>
exit;
<br>
}
<br>
<br>
if ($rU==NULL) {
<br>
# request with no Username in RURI
<br>
sl_send_reply("484","Address Incomplete");
<br>
exit;
<br>
}
<br>
<br>
# apply DB based aliases (uncomment to enable)
<br>
##alias_db_lookup("dbaliases");
<br>
<br>
if (!lookup("location")) {
<br>
switch ($retcode) {
<br>
case -1:
<br>
case -3:
<br>
t_newtran();
<br>
t_reply("404", "Not Found");
<br>
exit;
<br>
case -2:
<br>
sl_send_reply("405", "Method Not Allowed");
<br>
exit;
<br>
}
<br>
}
<br>
<br>
# when routing via usrloc, log the missed calls also
<br>
setflag(2);
<br>
<br>
route(1);
<br>
}
<br>
##insert function added below
<br>
##insert_hf ("Test4");
<br>
route[1] {
<br>
##insert function added below
<br>
insert_hf ("Test5");
<br>
#n# if (check_route_param("nat=yes")) {
<br>
#n# setbflag(6);
<br>
#n# }
<br>
#n# if (isflagset(5) || isbflagset(6)) {
<br>
#n# route(5);
<br>
#n# }
<br>
<br>
/* example how to enable some additional event routes */
<br>
if (is_method("INVITE")) {
<br>
insert_hf ("Test5");
<br>
##tried insert function here.
<br>
#t_on_branch("1");
<br>
##tried here
<br>
insert_hf("To-username: test");
<br>
<br>
t_on_reply("1");
<br>
t_on_failure("1");
<br>
}
<br>
<br>
if (!t_relay()) {
<br>
sl_reply_error();
<br>
}
<br>
exit;
<br>
}
<br>
<br>
<br>
# Presence route
<br>
/* uncomment the whole following route for enabling presence server */
<br>
route[2]
<br>
{
<br>
##tried here for insert function.
<br>
#insert_hf("Test_Presence");
<br>
<br>
#p# if (!t_newtran())
<br>
#p# {
<br>
#p# sl_reply_error();
<br>
#p# exit;
<br>
#p# };
<br>
#p#
<br>
#p# if(is_method("PUBLISH"))
<br>
#p# {
<br>
#p# handle_publish();
<br>
#p# t_release();
<br>
#p# }
<br>
#p# else
<br>
#p# if( is_method("SUBSCRIBE"))
<br>
#p# {
<br>
#p# handle_subscribe();
<br>
#p# t_release();
<br>
#p# }
<br>
#p# exit;
<br>
# if presence enabled, this part will not be executed
<br>
if (is_method("PUBLISH") || $rU==null)
<br>
{
<br>
sl_send_reply("404", "Not here");
<br>
exit;
<br>
}
<br>
return;
<br>
}
<br>
<br>
# Authentication route
<br>
/* uncomment the whole following route for enabling authentication */
<br>
route[3] {
<br>
if (is_method("REGISTER"))
<br>
{
<br>
# authenticate the REGISTER requests (uncomment to enable auth)
<br>
if (!www_authorize("192.168.64.75", "subscriber"))
<br>
{
<br>
www_challenge("192.168.64.75", "0");
<br>
exit;
<br>
}
<br>
###the following lines are uncommented
<br>
if ($au!=$tU)
<br>
{
<br>
sl_send_reply("403","Forbidden auth ID");
<br>
exit;
<br>
}
<br>
}
<br>
else
<br>
{
<br>
# authenticate if from local subscriber (uncomment to enable
auth)
<br>
if (from_uri==myself)
<br>
{
<br>
if (!proxy_authorize("", "subscriber")) {
<br>
proxy_challenge("", "0");
<br>
exit;
<br>
}
<br>
if (is_method("PUBLISH"))
<br>
{
<br>
if ($au!=$tU) {
<br>
sl_send_reply("403","Forbidden auth ID");
<br>
exit;
<br>
}
<br>
} else {
<br>
if ($au!=$fU) {
<br>
sl_send_reply("403","Forbidden auth ID");
<br>
exit;
<br>
}
<br>
}
<br>
<br>
consume_credentials();
<br>
# caller authenticated
<br>
}
<br>
}
<br>
return;
<br>
}
<br>
<br>
# Caller NAT detection route
<br>
/* uncomment the whole following route for enabling Caller NAT
Detection */
<br>
route[4]{
<br>
#n# force_rport();
<br>
#n# if (nat_uac_test("19")) {
<br>
#n# if (method=="REGISTER") {
<br>
#n# fix_nated_register();
<br>
#n# } else {
<br>
#n# fix_nated_contact();
<br>
#n# }
<br>
#n# setflag(5);
<br>
#n# }
<br>
return;
<br>
}
<br>
<br>
# RTPProxy control
<br>
/* uncomment the whole following route for enabling RTPProxy Control */
<br>
route[5] {
<br>
#n# if (is_method("BYE")) {
<br>
#n# unforce_rtp_proxy();
<br>
#n# } else if (is_method("INVITE")){
<br>
#n# force_rtp_proxy();
<br>
#n# }
<br>
#n# if (!has_totag()) add_rr_param(";nat=yes");
<br>
return;
<br>
}
<br>
<br>
branch_route[1] {
<br>
xdbg("new branch at $ru\n");
<br>
}
<br>
<br>
<br>
onreply_route[1] {
<br>
xdbg("incoming reply\n");
<br>
<br>
#n# if ((isflagset(5) || isbflagset(6)) &&
status=~"(183)|(2[0-9][0-9])") {
<br>
#n# force_rtp_proxy();
<br>
#n# }
<br>
#n# if (isbflagset(6)) {
<br>
#n# fix_nated_contact();
<br>
#n# }
<br>
}
<br>
<br>
<br>
failure_route[1] {
<br>
#n# if (is_method("INVITE)
<br>
#n# && (isbflagset(6) || isflagset(5))) {
<br>
#n# unforce_rtp_proxy();
<br>
#n# }
<br>
<br>
if (t_was_cancelled()) {
<br>
exit;
<br>
}
<br>
<br>
# uncomment the following lines if you want to block client
<br>
# redirect based on 3xx replies.
<br>
##if (t_check_status("3[0-9][0-9]")) {
<br>
##t_reply("404","Not found");
<br>
## exit;
<br>
##}
<br>
<br>
# uncomment the following lines if you want to redirect the failed
<br>
# calls to a different new destination
<br>
##if (t_check_status("486|408")) {
<br>
## sethostport("192.168.2.100:5060");
<br>
## append_branch();
<br>
## # do not set the missed call flag again
<br>
## t_relay();
<br>
##}
<br>
}
<br>
<br>
<br>
<br>
**************************************************************************************************************************************************
<br>
<br>
<br>
Daniel-Constantin Mierla wrote:
<br>
Hello,
<br>
<br>
have you created the db tables: kamdbctl create?
<br>
<br>
Cheers,
<br>
Daniel
<br>
<br>
On 03.09.2009 11:44 Uhr, Rajesh wrote:
<br>
Dear Team,
<br>
Iam configuring imc for kamailio-1.5 and while iam
trying to load the module, i get the following error .Kindly guide me
with a solution
<br>
<br>
<br>
ERROR:db_mysql:db_mysql_submit_query: driver error on query: Unknown
column 'name' in 'field list'
<br>
Sep 3 12:24:20 [18583] ERROR:core:db_do_query: error while submitting
query
<br>
Sep 3 12:24:20 [18583] ERROR:imc:add_from_db: failed to querry table
<br>
Sep 3 12:24:20 [18583] ERROR:imc:mod_init: failed to get information
from db
<br>
Sep 3 12:24:20 [18583] ERROR:core:init_mod: failed to initialize
module imc
<br>
Sep 3 12:24:20 [18583] ERROR:core:main: error while initializing
modules
<br>
-- <br>
</body>
</html>