Good evening!
I've been trying to install Kamailio on a Centos 6.5 cloud , I'm able
to compile and install everything, if I run : service kamailio start
it starts kamailio and if I run service kamailio status I tells me
that is running on PID... which is fine, however, if I tweak the
/usr/local/etc/kamailio/kamailio.conf according to the instructions on
http://kb.asipto.com/asterisk:realtime:kamailio-4.0.x-asterisk-11.3.0-astdb
, when I run service kamailio start It says "ok" , but when I run
service kamailio status I get " kamailio dead but subsys locked" , I
copied and pasted the settings on the web-site but they don't work, I
also tried used the original cfg file adding the "#!ifdef
WITH_ASTERISK" but It still doesn't work, I'm not an expert on Kamailio
I just want to use it as a register server behind Asterisk , perhaps if
you have a valid conf file that I could use as a template for kamailio
4.0.1 this is what I have :
#!KAMAILIO
#!define WITH_MYSQL
#!define WITH_AUTH
#!define WITH_USRLOCDB
#!define WITH_ASTERISK
#
# Kamailio (OpenSER) SIP Server v4.0 - default configuration script
# - web: http://www.kamailio.org
# - git: http://sip-router.org
#
# Direct your questions about this file to: <sr-users(a)lists.sip-router.org>
#
# Refer to the Core CookBook at http://www.kamailio.org/dokuwiki/doku.php
# for an explanation of possible statements, functions and parameters.
#
# Several features can be enabled using '#!define WITH_FEATURE' directives:
#
# *** To run in debug mode:
# - define WITH_DEBUG
#
# *** To enable mysql:
# - define WITH_MYSQL
#
# *** To enable authentication execute:
# - enable mysql
# - define WITH_AUTH
# - add users using 'kamctl'
#
# *** To enable IP authentication execute:
# - enable mysql
# - enable authentication
# - define WITH_IPAUTH
# - add IP addresses with group id '1' to 'address' table
#
# *** To enable persistent user location execute:
# - enable mysql
# - define WITH_USRLOCDB
#
# *** To enable presence server execute:
# - enable mysql
# - define WITH_PRESENCE
#
# *** To enable nat traversal execute:
# - define WITH_NAT
# - install RTPProxy: http://www.rtpproxy.org
# - start RTPProxy:
# rtpproxy -l _your_public_ip_ -s udp:localhost:7722
#
# *** To enable PSTN gateway routing execute:
# - define WITH_PSTN
# - set the value of pstn.gw_ip
# - check route[PSTN] for regexp routing condition
#
# *** To enable database aliases lookup execute:
# - enable mysql
# - define WITH_ALIASDB
#
# *** To enable speed dial lookup execute:
# - enable mysql
# - define WITH_SPEEDDIAL
#
# *** To enable multi-domain support execute:
# - enable mysql
# - define WITH_MULTIDOMAIN
#
# *** To enable TLS support execute:
# - adjust CFGDIR/tls.cfg as needed
# - define WITH_TLS
#
# *** To enable XMLRPC support execute:
# - define WITH_XMLRPC
# - adjust route[XMLRPC] for access policy
#
# *** To enable anti-flood detection execute:
# - adjust pike and htable=>ipban settings as needed (default is
# block if more than 16 requests in 2 seconds and ban for 300 seconds)
# - define WITH_ANTIFLOOD
#
# *** To block 3XX redirect replies execute:
# - define WITH_BLOCK3XX
#
# *** To enable VoiceMail routing execute:
# - define WITH_VOICEMAIL
# - set the value of voicemail.srv_ip
# - adjust the value of voicemail.srv_port
#
# *** To enhance accounting execute:
# - enable mysql
# - define WITH_ACCDB
# - add following columns to database
#!ifdef ACCDB_COMMENT
ALTER TABLE acc ADD COLUMN src_user VARCHAR(64) NOT NULL DEFAULT '';
ALTER TABLE acc ADD COLUMN src_domain VARCHAR(128) NOT NULL DEFAULT '';
ALTER TABLE acc ADD COLUMN src_ip varchar(64) NOT NULL default '';
ALTER TABLE acc ADD COLUMN dst_ouser VARCHAR(64) NOT NULL DEFAULT '';
ALTER TABLE acc ADD COLUMN dst_user VARCHAR(64) NOT NULL DEFAULT '';
ALTER TABLE acc ADD COLUMN dst_domain VARCHAR(128) NOT NULL DEFAULT '';
ALTER TABLE missed_calls ADD COLUMN src_user VARCHAR(64) NOT NULL
DEFAULT '';
ALTER TABLE missed_calls ADD COLUMN src_domain VARCHAR(128) NOT NULL
DEFAULT '';
ALTER TABLE missed_calls ADD COLUMN src_ip varchar(64) NOT NULL
default '';
ALTER TABLE missed_calls ADD COLUMN dst_ouser VARCHAR(64) NOT NULL
DEFAULT '';
ALTER TABLE missed_calls ADD COLUMN dst_user VARCHAR(64) NOT NULL
DEFAULT '';
ALTER TABLE missed_calls ADD COLUMN dst_domain VARCHAR(128) NOT NULL
DEFAULT '';
#!endif
####### Defined Values #########
# *** Value defines - IDs used later in config
#!ifdef WITH_MYSQL
# - database URL - used to connect to database server by modules such
# as: auth_db, acc, usrloc, a.s.o.
#!define DBURL "mysql://root:axn0505@200.98.201.4/kamailio"
#!ifdef WITH_ASTERISK
#!define DBASTURL "mysql://root:axn0505@80.241.222.146/asterisk"
#!endif
#!endif
#!ifdef WITH_MULTIDOMAIN
# - the value for 'use_domain' parameters
#!define MULTIDOMAIN 1
#!else
#!define MULTIDOMAIN 0
#!endif
# - flags
# FLT_ - per transaction (message) flags
# FLB_ - per branch flags
#!define FLT_ACC 1
#!define FLT_ACCMISSED 2
#!define FLT_ACCFAILED 3
#!define FLT_NATS 5
#!define FLB_NATB 6
#!define FLB_NATSIPPING 7
####### Global Parameters #########
#!ifdef WITH_DEBUG
debug=4
log_stderror=yes
#!else
debug=2
log_stderror=no
#!endif
memdbg=5
memlog=5
log_facility=LOG_LOCAL0
fork=yes
children=4
/* uncomment the next line to disable TCP (default on) */
#disable_tcp=yes
/* uncomment the next line to disable the auto discovery of local aliases
based on reverse DNS on IPs (default on) */
#auto_aliases=no
/* add local domain aliases */
#alias="sip.mydomain.com"
/* uncomment and configure the following line if you want Kamailio to
bind on a specific interface/port/proto (default bind on all
available) */
#listen=udp:10.0.0.10:5060
/* port to listen to
* - can be specified more than once if needed to listen on many ports */
port=5060
#!ifdef WITH_TLS
enable_tls=yes
#!endif
# life time of TCP connection when there is no traffic
# - a bit higher than registration expires to cope with UA behind NAT
tcp_connection_lifetime=3605
####### Custom Parameters #########
# These parameters can be modified runtime via RPC interface
# - see the documentation of 'cfg_rpc' module.
#
# Format: group.id = value 'desc' description
# Access: $sel(cfg_get.group.id) or @cfg_get.group.id
#
#!ifdef WITH_PSTN
# PSTN GW Routing
#
# - pstn.gw_ip: valid IP or hostname as string value, example:
# pstn.gw_ip = "10.0.0.101" desc "My PSTN GW Address"
#
# - by default is empty to avoid misrouting
pstn.gw_ip = "" desc "PSTN GW Address"
#!endif
#!ifdef WITH_VOICEMAIL
# VoiceMail Routing on offline, busy or no answer
#
# - by default Voicemail server IP is empty to avoid misrouting
voicemail.srv_ip = "" desc "VoiceMail IP Address"
voicemail.srv_port = "5060" desc "VoiceMail Port"
#!endif
#!ifdef WITH_ASTERISK
asterisk.bindip = "80.241.222.146" desc "Asterisk IP Address"
asterisk.bindport = "5060" desc "Asterisk Port"
kamailio.bindip = "200.98.201.4" desc "Kamailio IP Address"
kamailio.bindport = "5060" desc "Kamailio Port"
#!endif
####### Modules Section ########
# set paths to location of modules (to sources or installation folders)
#!ifdef WITH_SRCPATH
mpath="modules"
#!else
mpath="/usr/lib64/kamailio/modules/"
#!endif
#!ifdef WITH_MYSQL
loadmodule "db_mysql.so"
#!endif
loadmodule "mi_fifo.so"
loadmodule "kex.so"
loadmodule "tm.so"
loadmodule "tmx.so"
loadmodule "sl.so"
loadmodule "rr.so"
loadmodule "pv.so"
loadmodule "maxfwd.so"
loadmodule "usrloc.so"
loadmodule "registrar.so"
loadmodule "textops.so"
loadmodule "siputils.so"
loadmodule "xlog.so"
loadmodule "sanity.so"
loadmodule "ctl.so"
loadmodule "cfg_rpc.so"
loadmodule "mi_rpc.so"
loadmodule "acc.so"
#!ifdef WITH_AUTH
loadmodule "auth.so"
loadmodule "auth_db.so"
#!ifdef WITH_IPAUTH
loadmodule "permissions.so"
#!endif
#!endif
#!ifdef WITH_ALIASDB
loadmodule "alias_db.so"
#!endif
#!ifdef WITH_SPEEDDIAL
loadmodule "speeddial.so"
#!endif
#!ifdef WITH_MULTIDOMAIN
loadmodule "domain.so"
#!endif
#!ifdef WITH_PRESENCE
loadmodule "presence.so"
loadmodule "presence_xml.so"
#!endif
#!ifdef WITH_NAT
loadmodule "nathelper.so"
loadmodule "rtpproxy.so"
#!endif
#!ifdef WITH_TLS
loadmodule "tls.so"
#!endif
#!ifdef WITH_ANTIFLOOD
loadmodule "htable.so"
loadmodule "pike.so"
#!endif
#!ifdef WITH_XMLRPC
loadmodule "xmlrpc.so"
#!endif
#!ifdef WITH_DEBUG
loadmodule "debugger.so"
#!endif
#!ifdef WITH_ASTERISK
loadmodule "uac.so"
#!endif
# ----------------- setting module-specific parameters ---------------
# ----- mi_fifo params -----
modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
# ----- tm params -----
# auto-discard branches from previous serial forking leg
modparam("tm", "failure_reply_mode", 3)
# default retransmission timeout: 30sec
modparam("tm", "fr_timer", 30000)
# default invite retransmission timeout after 1xx: 120sec
modparam("tm", "fr_inv_timer", 120000)
# ----- rr params -----
# add value to ;lr param to cope with most of the UAs
modparam("rr", "enable_full_lr", 1)
# do not append from tag to the RR (no need for this script)
#!ifdef WITH_ASTERISK
modparam("rr", "append_fromtag", 1)
#!else
modparam("rr", "append_fromtag", 0)
#!endif
# ----- registrar params -----
modparam("registrar", "method_filtering", 1)
/* uncomment the next line to disable parallel forking via location */
# modparam("registrar", "append_branches", 0)
/* uncomment the next line not to allow more than 10 contacts per AOR */
#modparam("registrar", "max_contacts", 10)
# max value for expires of registrations
modparam("registrar", "max_expires", 3600)
# set it to 1 to enable GRUU
modparam("registrar", "gruu_enabled", 0)
# ----- acc params -----
/* what special events should be accounted ? */
modparam("acc", "early_media", 0)
modparam("acc", "report_ack", 0)
modparam("acc", "report_cancels", 0)
/* by default ww do not adjust the direct of the sequential requests.
if you enable this parameter, be sure the enable "append_fromtag"
in "rr" module */
modparam("acc", "detect_direction", 0)
/* account triggers (flags) */
modparam("acc", "log_flag", FLT_ACC)
modparam("acc", "log_missed_flag", FLT_ACCMISSED)
modparam("acc", "log_extra",
"src_user=$fU;src_domain=$fd;src_ip=$si;"
"dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
modparam("acc", "failed_transaction_flag", FLT_ACCFAILED)
/* enhanced DB accounting */
#!ifdef WITH_ACCDB
modparam("acc", "db_flag", FLT_ACC)
modparam("acc", "db_missed_flag", FLT_ACCMISSED)
modparam("acc", "db_url", DBURL)
modparam("acc", "db_extra",
"src_user=$fU;src_domain=$fd;src_ip=$si;"
"dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
#!endif
# ----- usrloc params -----
/* enable DB persistency for location entries */
#!ifdef WITH_USRLOCDB
modparam("usrloc", "db_url", DBURL)
modparam("usrloc", "db_mode", 2)
modparam("usrloc", "use_domain", MULTIDOMAIN)
#!endif
# ----- auth_db params -----
#!ifdef WITH_AUTH
modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "load_credentials", "")
#!ifdef WITH_ASTERISK
modparam("auth_db", "user_column", "name")
modparam("auth_db", "password_column", "sippasswd")
modparam("auth_db", "db_url", DBASTURL)
modparam("auth_db", "version_table", 0)
#!else
modparam("auth_db", "db_url", DBURL)
modparam("auth_db", "password_column", "password")
modparam("auth_db", "use_domain", MULTIDOMAIN)
#!endif
# ----- permissions params -----
#!ifdef WITH_IPAUTH
modparam("permissions", "db_url", DBURL)
modparam("permissions", "db_mode", 1)
#!endif
#!endif
# ----- alias_db params -----
#!ifdef WITH_ALIASDB
modparam("alias_db", "db_url", DBURL)
modparam("alias_db", "use_domain", MULTIDOMAIN)
#!endif
# ----- speedial params -----
#!ifdef WITH_SPEEDDIAL
modparam("speeddial", "db_url", DBURL)
modparam("speeddial", "use_domain", MULTIDOMAIN)
#!endif
# ----- domain params -----
#!ifdef WITH_MULTIDOMAIN
modparam("domain", "db_url", DBURL)
# register callback to match myself condition with domains list
modparam("domain", "register_myself", 1)
#!endif
#!ifdef WITH_PRESENCE
# ----- presence params -----
modparam("presence", "db_url", DBURL)
# ----- presence_xml params -----
modparam("presence_xml", "db_url", DBURL)
modparam("presence_xml", "force_active", 1)
#!endif
#!ifdef WITH_NAT
# ----- rtpproxy params -----
modparam("rtpproxy", "rtpproxy_sock", "udp:127.0.0.1:7722")
# ----- nathelper params -----
modparam("nathelper", "natping_interval", 30)
modparam("nathelper", "ping_nated_only", 1)
modparam("nathelper", "sipping_bflag", FLB_NATSIPPING)
modparam("nathelper", "sipping_from", "sip:pinger@kamailio.org")
# params needed for NAT traversal in other modules
modparam("nathelper|registrar", "received_avp", "$avp(RECEIVED)")
modparam("usrloc", "nat_bflag", FLB_NATB)
#!endif
#!ifdef WITH_TLS
# ----- tls params -----
modparam("tls", "config", "/usr/local/etc/kamailio/tls.cfg")
#!endif
#!ifdef WITH_ANTIFLOOD
# ----- pike params -----
modparam("pike", "sampling_time_unit", 2)
modparam("pike", "reqs_density_per_unit", 16)
modparam("pike", "remove_latency", 4)
# ----- htable params -----
# ip ban htable with autoexpire after 5 minutes
modparam("htable", "htable", "ipban=>size=8;autoexpire=300;")
#!endif
#!ifdef WITH_XMLRPC
# ----- xmlrpc params -----
modparam("xmlrpc", "route", "XMLRPC");
modparam("xmlrpc", "url_match", "^/RPC")
#!endif
#!ifdef WITH_DEBUG
# ----- debugger params -----
modparam("debugger", "cfgtrace", 1)
#!endif
####### Routing Logic ########
# Main SIP request routing logic
# - processing of any incoming SIP request starts with this route
# - note: this is the same as route { ... }
request_route {
# per request initial checks
route(REQINIT);
# NAT detection
route(NATDETECT);
# handle requests within SIP dialogs
route(WITHINDLG);
### only initial requests (no To tag)
# CANCEL processing
if (is_method("CANCEL"))
{
if (t_check_trans())
t_relay();
exit;
}
t_check_trans();
# authentication
route(AUTH);
# record routing for dialog forming requests (in case they are routed)
# - remove preloaded route headers
remove_hf("Route");
if (is_method("INVITE|SUBSCRIBE"))
record_route();
# account only INVITEs
if (is_method("INVITE"))
{
setflag(FLT_ACC); # do accounting
}
# dispatch requests to foreign domains
route(SIPOUT);
### requests for my local domains
# handle presence related requests
route(PRESENCE);
# handle registrations
route(REGISTRAR);
if ($rU==$null)
{
# request with no Username in RURI
sl_send_reply("484","Address Incomplete");
exit;
}
# dispatch destinations to PSTN
route(PSTN);
# user location service
route(LOCATION);
route(RELAY);
}
route[RELAY] {
# enable additional event routes for forwarded requests
# - serial forking, RTP relaying handling, a.s.o.
if (is_method("INVITE|SUBSCRIBE")) {
t_on_branch("MANAGE_BRANCH");
t_on_reply("MANAGE_REPLY");
}
if (is_method("INVITE")) {
t_on_failure("MANAGE_FAILURE");
}
if (!t_relay()) {
sl_reply_error();
}
exit;
}
# Per SIP request initial checks
route[REQINIT] {
#!ifdef WITH_ANTIFLOOD
# flood dection from same IP and traffic ban for a while
# be sure you exclude checking trusted peers, such as pstn gateways
# - local host excluded (e.g., loop to self)
if(src_ip!=myself)
{
if($sht(ipban=>$si)!=$null)
{
# ip is already blocked
xdbg("request from blocked IP - $rm from $fu (IP:$si:$sp)\n");
exit;
}
if (!pike_check_req())
{
xlog("L_ALERT","ALERT: pike blocking $rm from $fu
(IP:$si:$sp)\n");
$sht(ipban=>$si) = 1;
exit;
}
}
#!endif
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
exit;
}
if(!sanity_check("1511", "7"))
{
xlog("Malformed SIP message from $si:$sp\n");
exit;
}
}
# Handle requests within SIP dialogs
route[WITHINDLG] {
if (has_totag()) {
# sequential request withing a dialog should
# take the path determined by record-routing
if (loose_route()) {
if (is_method("BYE")) {
setflag(FLT_ACC); # do accounting ...
setflag(FLT_ACCFAILED); # ... even if the transaction fails
}
if ( is_method("ACK") ) {
# ACK is forwarded statelessy
route(NATMANAGE);
}
route(RELAY);
} else {
if (is_method("SUBSCRIBE") && uri == myself) {
# in-dialog subscribe requests
route(PRESENCE);
exit;
}
if ( is_method("ACK") ) {
if ( t_check_trans() ) {
# no 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
exit;
}
}
sl_send_reply("404","Not here");
}
exit;
}
}
# Handle SIP registrations
route[REGISTRAR] {
if (is_method("REGISTER"))
{
if(isflagset(FLT_NATS))
{
setbflag(FLB_NATB);
# uncomment next line to do SIP NAT pinging
## setbflag(FLB_NATSIPPING);
}
if (!save("location"))
sl_reply_error();
#!ifdef WITH_ASTERISK
route(REGFWD);
#!endif
exit;
}
}
# USER location service
route[LOCATION] {
#!ifdef WITH_SPEEDIAL
# search for short dialing - 2-digit extension
if($rU=~"^[0-9][0-9]$")
if(sd_lookup("speed_dial"))
route(SIPOUT);
#!endif
#!ifdef WITH_ALIASDB
# search in DB-based aliases
if(alias_db_lookup("dbaliases"))
route(SIPOUT);
#!endif
#!ifdef WITH_ASTERISK
if(is_method("INVITE") && (!route(FROMASTERISK))) {
# if new call from out there - send to Asterisk
# - non-INVITE request are routed directly by Kamailio
# - traffic from Asterisk is routed also directy by Kamailio
route(TOASTERISK);
exit;
}
#!endif
$avp(oexten) = $rU;
if (!lookup("location")) {
$var(rc) = $rc;
route(TOVOICEMAIL);
t_newtran();
switch ($var(rc)) {
case -1:
case -3:
send_reply("404", "Not Found");
exit;
case -2:
send_reply("405", "Method Not Allowed");
exit;
}
}
# when routing via usrloc, log the missed calls also
if (is_method("INVITE"))
{
setflag(FLT_ACCMISSED);
}
}
# Presence server route
route[PRESENCE] {
if(!is_method("PUBLISH|SUBSCRIBE"))
return;
#!ifdef WITH_PRESENCE
if (!t_newtran())
{
sl_reply_error();
exit;
};
if(is_method("PUBLISH"))
{
handle_publish();
t_release();
}
else
if( is_method("SUBSCRIBE"))
{
handle_subscribe();
t_release();
}
exit;
#!endif
# if presence enabled, this part will not be executed
if (is_method("PUBLISH") || $rU==$null)
{
sl_send_reply("404", "Not here");
exit;
}
return;
}
# Authentication route
route[AUTH] {
#!ifdef WITH_AUTH
#!ifdef WITH_ASTERISK
# do not auth traffic from Asterisk - trusted!
if(route(FROMASTERISK))
return;
#!endif
#!ifdef WITH_IPAUTH
if((!is_method("REGISTER")) && allow_source_address())
{
# source IP allowed
return;
}
#!endif
if (is_method("REGISTER") || from_uri==myself)
{
# authenticate requests
#!ifdef WITH_ASTERISK
if (!auth_check("$fd", "sipusers", "1")) {
#!else
if (!auth_check("$fd", "subscriber", "1")) {
#!endif
auth_challenge("$fd", "0");
exit;
}
# user authenticated - remove auth header
if(!is_method("REGISTER|PUBLISH"))
consume_credentials();
}
# if caller is not local subscriber, then check if it calls
# a local destination, otherwise deny, not an open relay here
if (from_uri!=myself && uri!=myself)
{
sl_send_reply("403","Not relaying");
exit;
}
#!endif
return;
}
# Caller NAT detection route
route[NATDETECT] {
#!ifdef WITH_NAT
force_rport();
if (nat_uac_test("19")) {
if (is_method("REGISTER")) {
fix_nated_register();
} else {
fix_nated_contact();
}
setflag(FLT_NATS);
}
#!endif
return;
}
# RTPProxy control
route[NATMANAGE] {
#!ifdef WITH_NAT
if (is_request()) {
if(has_totag()) {
if(check_route_param("nat=yes")) {
setbflag(FLB_NATB);
}
}
}
if (!(isflagset(FLT_NATS) || isbflagset(FLB_NATB)))
return;
rtpproxy_manage();
if (is_request()) {
if (!has_totag()) {
add_rr_param(";nat=yes");
}
}
if (is_reply()) {
if(isbflagset(FLB_NATB)) {
fix_nated_contact();
}
}
#!endif
return;
}
# Routing to foreign domains
route[SIPOUT] {
if (!uri==myself)
{
append_hf("P-hint: outbound\r\n");
route(RELAY);
}
}
# PSTN GW routing
route[PSTN] {
#!ifdef WITH_PSTN
# check if PSTN GW IP is defined
if (strempty($sel(cfg_get.pstn.gw_ip))) {
xlog("SCRIPT: PSTN rotuing enabled but pstn.gw_ip not defined\n");
return;
}
# route to PSTN dialed numbers starting with '+' or '00'
# (international format)
# - update the condition to match your dialing rules for PSTN routing
if(!($rU=~"^(\+|00)[1-9][0-9]{3,20}$"))
return;
# only local users allowed to call
if(from_uri!=myself) {
sl_send_reply("403", "Not Allowed");
exit;
}
$ru = "sip:" + $rU + "@" + $sel(cfg_get.pstn.gw_ip);
route(RELAY);
exit;
#!endif
return;
}
# XMLRPC routing
#!ifdef WITH_XMLRPC
route[XMLRPC] {
# allow XMLRPC from localhost
if ((method=="POST" || method=="GET")
&& (src_ip==127.0.0.1)) {
# close connection only for xmlrpclib user agents (there is a bug in
# xmlrpclib: it waits for EOF before interpreting the response).
if ($hdr(User-Agent) =~ "xmlrpclib")
set_reply_close();
set_reply_no_connect();
dispatch_rpc();
exit;
}
send_reply("403", "Forbidden");
exit;
}
#!endif
# route to voicemail server
route[TOVOICEMAIL] {
#!ifdef WITH_VOICEMAIL
if(!is_method("INVITE"))
return;
# check if VoiceMail server IP is defined
if (strempty($sel(cfg_get.voicemail.srv_ip))) {
xlog("SCRIPT: VoiceMail rotuing enabled but IP not defined\n");
return;
}
if($avp(oexten)==$null)
return;
$ru = "sip:" + $avp(oexten) + "@" + $sel(cfg_get.voicemail.srv_ip)
+ ":" + $sel(cfg_get.voicemail.srv_port);
route(RELAY);
exit;
#!endif
return;
}
# manage outgoing branches
branch_route[MANAGE_BRANCH] {
xdbg("new branch [$T_branch_idx] to $ru\n");
route(NATMANAGE);
}
# manage incoming replies
onreply_route[MANAGE_REPLY] {
xdbg("incoming reply\n");
if(status=~"[12][0-9][0-9]")
route(NATMANAGE);
}
# manage failure routing cases
failure_route[MANAGE_FAILURE] {
route(NATMANAGE);
if (t_is_canceled()) {
exit;
}
#!ifdef WITH_BLOCK3XX
# block call redirect based on 3xx replies.
if (t_check_status("3[0-9][0-9]")) {
t_reply("404","Not found");
exit;
}
#!endif
#!ifdef WITH_VOICEMAIL
# serial forking
# - route to voicemail on busy or no answer (timeout)
if (t_check_status("486|408")) {
route(TOVOICEMAIL);
exit;
}
#!endif
}
#!ifdef WITH_ASTERISK
# Test if coming from Asterisk
route[FROMASTERISK] {
if($si==$sel(cfg_get.asterisk.bindip)
&& $sp==$sel(cfg_get.asterisk.bindport))
return 1;
return -1;
}
# Send to Asterisk
route[TOASTERISK] {
$du = "sip:" + $sel(cfg_get.asterisk.bindip) + ":"
+ $sel(cfg_get.asterisk.bindport);
route(RELAY);
exit;
}
# Forward REGISTER to Asterisk
route[REGFWD] {
if(!is_method("REGISTER"))
{
return;
}
$var(rip) = $sel(cfg_get.asterisk.bindip);
$uac_req(method)="REGISTER";
$uac_req(ruri)="sip:" + $var(rip) + ":" +
$sel(cfg_get.asterisk.bindport);
$uac_req(furi)="sip:" + $au + "@" + $var(rip);
$uac_req(turi)="sip:" + $au + "@" + $var(rip);
$uac_req(hdrs)="Contact: <sip:" + $au + "@"
+ $sel(cfg_get.kamailio.bindip)
+ ":" + $sel(cfg_get.kamailio.bindport) + ">\r\n";
if($sel(contact.expires) != $null)
$uac_req(hdrs)= $uac_req(hdrs) + "Expires: " +
$sel(contact.expires) + "\r\n";
else
$uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $hdr(Expires) +
"\r\n";
uac_req_send();
}
#!endif
--
*Giuliano Bellini*
*Logikanet Webmaster*
*Logikanet.com* | webmaster(a)logikanet.com | +55 (41) 3012-0232 /direct/
| +1 206-279-5207 /direct/
www.logikanet.com <http://www.logikanet.com> |
Hello,
We updated this morning Kamailio in 4.1.4 with your patch.
Kamailio crashed again this afternoon.
here an extract from /var/log/messages :
Jun 25 13:49:01 /usr/local/sbin/kamailio[20259]: WARNING: <script>:
time=[Wed Jun 25 13:49:01 2014] call
id=[f4653f6fe909d3118f86009033290024(a)A.B.C.D] call seq=[929405] contact
header=[<sip:0987654321@A.B.C.D:2057;transport=UDP>] from
uri=[sip:0123456789@domain;user=phone] from tag=[16632949] request's
method=[INVITE] request's uri=[sip:0123456789@domain;user=phone] to
uri=[sip:0123456789@domain;user=phone] to tag=[<null>] sip message
id=[46275] process id=[20259] ip source=[A.B.C.D] flags=[2]
ua=[(innovaphone IP6010/9.00 hotfix24 [9.061271/9061271/300])], INVITE from
'untrusted' host
Jun 25 13:49:01 /usr/local/sbin/kamailio[20259]: WARNING: <script>:
time=[Wed Jun 25 13:49:01 2014] call
id=[f4653f6fe909d3118f86009033290024(a)A.B.C.D] call seq=[929405] contact
header=[<sip:0987654321@A.B.C.D:2057;transport=UDP>] from
uri=[sip:0123456789@domain;user=phone] from tag=[16632949] request's
method=[INVITE] request's uri=[sip:0123456789@domain;user=phone] to
uri=[sip:0123456789@domain;user=phone] to tag=[<null>] sip message
id=[46275] process id=[20259] ip source=[A.B.C.D] flags=[2], INVITE from an
authorized SIP trunk
Jun 25 13:49:01 /usr/local/sbin/kamailio[20259]: WARNING: <script>:
time=[Wed Jun 25 13:49:01 2014] call
id=[f4653f6fe909d3118f86009033290024(a)A.B.C.D] call seq=[929405] contact
header=[<sip:0987654321@A.B.C.D:2057;transport=UDP>] from
uri=[sip:0123456789@domain;user=phone] from tag=[16632949] request's
method=[INVITE] request's uri=[sip:0123456789@domain;user=phone] to
uri=[sip:0123456789@domain;user=phone] to tag=[<null>] sip message
id=[46275] process id=[20259] ip source=[A.B.C.D] flags=[2], INVITE from an
authorized SDA for current SIP trunk
Jun 25 13:49:01 /usr/local/sbin/kamailio[20259]: INFO: carrierroute
[cr_func.c:710]: cr_do_route(): uri 0123456789 was rewritten to
sip:0123456789@GW, carrier 1, domain 1
Jun 25 13:49:02 /usr/local/sbin/kamailio[20259]: : <core>
[mem/q_malloc.c:140]: qm_debug_frag(): BUG: qm_*: fragm. 0x7f12803cb450
(address 0x7f12803cb480) beginning overwritten(abcdefed)!
And this is the btfull :
#0 0x0000003d6f6328a5 in raise () from /lib64/libc.so.6
No symbol table info available.
#1 0x0000003d6f634085 in abort () from /lib64/libc.so.6
No symbol table info available.
#2 0x0000000000546d3c in qm_debug_frag (qm=0x7f1280275010,
f=0x7f12803cb450) at mem/q_malloc.c:142
#3 0x0000000000548b26 in qm_free (qm=0x7f1280275010, p=0x7f12803cb480,
file=0x6276a0 "<core>: parser/parse_ppi_pai.c", func=0x627a00
"free_pai_ppi_body", line=102) at mem/q_malloc.c:464
#4 0x000000000056e5e6 in free_pai_ppi_body (pid_b=0x7f12803cb480) at
parser/parse_ppi_pai.c:102
#5 0x000000000054fee0 in clean_hdr_field (hf=0x7f1274c3c238) at
parser/hf.c:126
#6 0x00007f127cb6dde6 in acc_onreply (t=0x7f1274c157f0,
req=0x7f1274c3ac08, reply=0x7f12804a6d70, code=200) at acc_logic.c:501
#7 0x00007f127cb6e30a in tmcb_func (t=0x7f1274c157f0, type=512,
ps=0x7fff0b015580) at acc_logic.c:573
#8 0x00007f127ed68478 in run_trans_callbacks_internal
(cb_lst=0x7f1274c15860, type=512, trans=0x7f1274c157f0,
params=0x7fff0b015580) at t_hooks.c:290
#9 0x00007f127ed6868a in run_trans_callbacks_with_buf (type=512,
rbuf=0x7f1274c158b0, req=0x7f1274c3ac08, repl=0x7f12804a6d70, flags=200) at
t_hooks.c:336
#10 0x00007f127ed9ac06 in relay_reply (t=0x7f1274c157f0,
p_msg=0x7f12804a6d70, branch=0, msg_status=200, cancel_data=0x7fff0b0158e0,
do_put_on_wait=1) at t_reply.c:2001
#11 0x00007f127ed9d0b7 in reply_received (p_msg=0x7f12804a6d70) at
t_reply.c:2499
#12 0x000000000045d837 in do_forward_reply (msg=0x7f12804a6d70, mode=0) at
forward.c:777
#13 0x000000000045e0f8 in forward_reply (msg=0x7f12804a6d70) at
forward.c:860
#14 0x00000000004a58e7 in receive_msg (buf=0x924600 "SIP/2.0 200 OK\r\nVia:
SIP/2.0/UDP
A.B.C.D;branch=z9hG4bK512b.82b197888826f6b60c0c63b79801294d.0;received=A.B.C.D\r\nVia:
SIP/2.0/UDP A.B.C.D:2057;branch=z9hG4bK-129F259C;rport=2057\r\nCall-ID:
cb0"...,
len=1124, rcv_info=0x7fff0b015c60) at receive.c:273
#15 0x000000000053c9a8 in udp_rcv_loop () at udp_server.c:536
#16 0x000000000046d42b in main_loop () at main.c:1617
#17 0x0000000000470533 in main (argc=7, argv=0x7fff0b015f98) at main.c:2545
It seems to be the same problem but in a different source. Can you help me?
Regards,
Igor.
2014-06-12 17:46 GMT+02:00 Igor Potjevlesch <igor.potjevlesch(a)gmail.com>:
> Hello,
>
> we didn't set the early media parameter . its '0' by default, isn't it?
>
> regards,
>
> Igor
>
>
>
>
> 2014-06-12 17:03 GMT+02:00 Daniel-Constantin Mierla <miconda(a)gmail.com>:
>
> Hello,
>>
>> if you get a record for 180 response, then you have also the early_media
>> parameter set for acc module, isn't it?
>>
>> In the morning I pushed a patch that should fix this issue. Use latest
>> release 4.1.4 and see if works fine. Report the results to know that it is
>> gone or not.
>>
>> Cheers,
>> Daniel
>>
>>
>> On 12/06/14 16:55, Igor Potjevlesch wrote:
>>
>> Hello,
>>
>> We don't use $ai in xlog nor in other process. only in ACC.
>>
>> parameters for ACC are :
>> modparam("acc", "db_flag", FLT_ACC)
>> modparam("acc", "db_missed_flag", 3)
>> modparam("acc", "db_url", DBURLWO)
>> modparam("acc", "db_extra",
>> "src_user=$fU;username=$Au;src_domain=$fd;src_ip=$si;src_pai=$ai;"
>> "dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
>>
>> For the 3781-4b1-572014182635-OGNAJ-1-A.B.C.D there is a code 180
>> ringing in the INVITE in ACC table.
>>
>> regards,
>>
>> Igor
>>
>>
>> 2014-06-11 23:01 GMT+02:00 Daniel-Constantin Mierla <miconda(a)gmail.com>:
>>
>>> Few more things...
>>>
>>> Are you recording 1xx events? Can you check to see if there is another
>>> record in acc table for the same call? You can search by call-id
>>> 3781-4b1-572014182635-OGNAJ-1-A.B.C.D
>>>
>>> Eventually, send also the parameters you set for acc module.
>>>
>>> Cheers,
>>> Daniel
>>>
>>>
>>> On 11/06/14 19:25, Daniel-Constantin Mierla wrote:
>>>
>>> Hello,
>>>
>>> so you don't print $ai in xlog() statements nor use it in any
>>> assignments or other functions besides acc parameter?
>>>
>>> Cheers,
>>> Daniel
>>>
>>> On 11/06/14 19:19, Igor Potjevlesch wrote:
>>>
>>> Hello,
>>>
>>> We do not access to the P-asserted-identity in our configuration but
>>> we added the field PAI in the db base ACC ( for INVITE, ACK and BYE) .
>>> I dont know if it's in request_route, failure_route or branch_route .
>>>
>>> This is the print :
>>>
>>> (gdb) p mem_block
>>> $3 = (struct qm_block *) 0x7f6a6bef1010
>>> (gdb) p shm_block
>>> $4 = (struct qm_block *) 0x7f6a5666a000
>>>
>>> Regards,
>>>
>>> Igor
>>>
>>>
>>> 2014-06-11 18:02 GMT+02:00 Daniel-Constantin Mierla <miconda(a)gmail.com>:
>>>
>>>> Hello,
>>>>
>>>> cloning to shm for tm seems ok. Can you tell where you access
>>>> P-Asserted-Identity header, via variables? Does it happen in request_route,
>>>> failure_route or branch_route?
>>>>
>>>> Can you print from gdb, any frame:
>>>>
>>>> p mem_block
>>>> p shm_block
>>>>
>>>> I want to see if parsed filed point to shm or pkg memory.
>>>>
>>>> Cheers,
>>>> Daniel
>>>>
>>>>
>>>> On 11/06/14 17:37, Daniel-Constantin Mierla wrote:
>>>>
>>>> Hello,
>>>>
>>>> at least I narrowed it down a bit. It is empty also in the clone stored
>>>> in transaction, so it happens either during cloning or before. I will have
>>>> to check these parts.
>>>>
>>>> Cheers,
>>>> Daniel
>>>>
>>>> On 11/06/14 17:00, Igor Potjevlesch wrote:
>>>>
>>>> Hello,
>>>>
>>>> This is the result, always for frame 5 :
>>>>
>>>> (gdb) p *t->uas.request->pai
>>>> $1 = {type = HDR_PAI_T, name = {
>>>> s = 0x7f6a60cd34b8 "P-Asserted-Identity: \"0987654321\"
>>>> <sip:0987654321@A.B.C.D>\r\nContact: <sip:0987654321@A.B.C.D:5060>\r\nAllow:
>>>> INVITE, BYE, REGISTER, ACK, OPTIONS, CANCEL, SUBSCRIBE, NOTIFY, INFO,
>>>> REFER, UPD"..., len = 19}, body = {
>>>> s = 0x7f6a60cd34cd "\"0987654321\"<sip:0987654321@A.B.C.D>\r\nContact:
>>>> <sip:0987654321@A.B.C.D:5060>\r\nAllow: INVITE, BYE, REGISTER, ACK,
>>>> OPTIONS, CANCEL, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE\r\nSupported:
>>>> path,"..., len = 43}, len = 66, parsed = 0x7f6a6d81da88, next =
>>>> 0x7f6a60cd3f10}
>>>>
>>>> (gdb) p *((p_id_body_t*)(t->uas.request->pai->parsed))
>>>> $2 = {id = 0x0, num_ids = 0, next = 0x0}
>>>>
>>>> *Did *you find one thing in common between the 2 occurrences? Do you
>>>> have any ideas about what is the cause of this pai reset?
>>>>
>>>> Regards,
>>>>
>>>> Igor
>>>>
>>>>
>>>>
>>>>
>>>> 2014-06-11 16:09 GMT+02:00 Daniel-Constantin Mierla <miconda(a)gmail.com>
>>>> :
>>>>
>>>>> Hello,
>>>>>
>>>>> in the same frame 5, can yo get:
>>>>>
>>>>> p *t->uas.request->pai
>>>>> p *((p_id_body_t*)(t->uas.request->pai->parsed))
>>>>>
>>>>> Cheers,
>>>>> Daniel
>>>>>
>>>>>
>>>>> On 10/06/14 18:35, Igor Potjevlesch wrote:
>>>>>
>>>>> Hello,
>>>>>
>>>>> Here is the results :
>>>>>
>>>>> (gdb) frame 5
>>>>> #5 0x00007f6a687e9b43 in acc_onreply (t=0x7f6a60d16ff8,
>>>>> req=0x7f6a60cd2c10, reply=0x7f6a6c119aa8, code=200) at acc_logic.c:471
>>>>> 471 acc_db_request(req);
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>>>>>
>>>>>
>>>>
>>>> --
>>>> Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>>>>
>>>>
>>>> --
>>>> Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>>>>
>>>>
>>>
>>> --
>>> Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>>>
>>>
>>> --
>>> Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>>>
>>>
>>
>> --
>> Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>>
>>
>
Hello. We use 2 kamailio behind load balanser that have domain name of our
system .
uac settings like this:
modparam("uac","restore_mode","none")
modparam("uac","reg_db_url", DBURL)
modparam("uac", "reg_db_table", "uacreg")
modparam("uac", "reg_timer_interval", 20)
modparam("uac", "reg_retry_interval", 10)
modparam("uac", "reg_contact_addr", "sip.service.com:5068")
modparam("uac","auth_realm_avp","$avp(s:realm)")
modparam("uac","auth_username_avp","$avp(s:uname)")
modparam("uac","auth_password_avp","$avp(s:passwd)")
We have a trouble with registering trunks at porvider. When UAC try to
register trunk We see fails like this:
tm [ut.h:272]: uri2dst2(): ERROR: uri2dst: bad_uri: sip.service.com
ERROR: tm [uac.c:266]: t_uac_prepare(): t_uac: no socket found
ERROR: uac [uac_reg.c:746]: uac_reg_update(): failed to send request for
[TRUNKNAME]
What we try:
advertised_address=sip.service.comalias=sip.service.comalias=kam2.service.com
alias=Kam1.extern.ip.addr
alias=Kam2.extern.ip.addr
alias=load.balanser.ext.ipaddr
These settings not resolved our issue.
We have another trouble and think that it depended issues:
We can call to external numbers through trunks, but call very slow. (10-15
seconds), and some operators (LIKE AT&T dropped our calls to voicemail
systems and somethink like that)
Our question is how to successfully register providers at UAC with this
scheme. thanks for advices.
Hi!
It seems that uac_replace_from does restore the original URI only if the
>From URI is changed. Only changing the Display-name, eg:
uac_replace_from("$avp(pad)","");
does not add the RR-cookie, thus the original will not be restored (e.g.
on responses).
Is this on purpose or a bug?
regards
Klaus
PS: The workaround is: uac_replace_from("$avp(pad)","$fu");
Hi .
I have installed Kamailio 4.1.6 and basic registration and proxy server
functionalities are working fine.
Now I want to simulate a Unconditional call forwarding scenario with
181-Call is being forwarded is reported to originator from server.
Thanks
Hi
I am using kamailio with rtp proxy module. I have 2 questions /issues .
1. When caller or callee ends the call the other end call is not
disocnnecting .
UA is pjsip based and behind NAT router. Present call flow is
pjsipUA (LAN_ip)----->Router (Publicip)-------->Kamailio_with_RTP
proxy----> ThridParty SIP Server
UA local ip : 192.168.2.11
UA public IP : 89.78.92.23
Kamailio Public ip: 94.50.203.32
Third party Sip server : 76.42.89.25
Here When I disconnect call from either side , it is not disconnecting
other side .
2. My second requirement is , how can I define port of third party server .
for example if have 3 or 4 sip servers with different sip registration
ports other tahn 5060
How can I route registration requests coming from UAs to different ports of
third party servers.
Please bear my ignorance I am new to kamailio .Hope some experts will help
me here .
Attached kamailio config and SIP trace taken from kamailio server
Thank you
Hi,
I am trying to use the carrierfailureroute table functionality via the cr_next_domain carrierroute function. I am getting the message: "failed to find command cr_next_domain" when I try to start Kamailio
I am compiling Kamailio from latest 4.1.6 source, using:
make include_modules"db_mysql carrierroute" cfg
make group_include="db mysql standard" all
make install
I have installed libconfuse-devel and the tm module is loaded.
Would welcome any helpful suggestions.
Thanks,
Mark Hall
---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com
I'm trying to use dlg_set_timeout_by_profile and it doesn't do nothing on
Kamailio 4.1.5
If i try to use the dlg_set_timeout, it also doesn't work, but it gives the
following error
CRITICAL: dialog [dlg_timer.c:205]: update_dlg_timer(): Trying to update a
bogus dlg tl=0x7f9825ac6880 tl->next=(nil) tl->prev=(nil)
ERROR: dialog [dlg_hash.c:1094]: update_dlg_timeout(): failed to update
dialog lifetime
If i set the timeout with the $avp, it only works before dlg_manage(), but
also with a Warning
WARNING: dialog [dlg_handlers.c:1245]: dlg_onroute(): inconsitent dlg timer
data on dlg 0x7f9da0dc7f08 [4066:9857] with clid
'bba73ace3ee94b95bf5b1782406047bd' and tags
'6460df6b8b3947ba96b1cf65330bf524' 'm2pmrUpHN06Fc'
The dialog module configurations are:
modparam("dialog", "db_url", DBURL)
modparam("dialog", "dlg_flag", FLT_DLG)
modparam("dialog", "db_mode", 0)
modparam("dialog", "enable_stats", 1)
modparam("dialog", "dlg_match_mode", 1)
modparam("dialog", "profiles_with_value", "user ; domain ; permissions")
modparam("dialog", "profiles_no_value", "inbound ; outbound ; all")
modparam("dialog", "send_bye", 1)
modparam("dialog", "default_timeout", 21600)
modparam("dialog", "ka_timer", 0)
modparam("dialog", "ka_interval", 0)
modparam("dialog", "timeout_avp", "$avp(dlgtimeout)")
I'm very interested to use dlg_set_timeout_by_profile, any idea about what
is wrong with that ?
Regards,
*José Ferreira | Technical Manager*
M. +351 91 775 7166 | jferreira(a)wavecom.pt
Wavecom, Soluções Rádio, SA
Cacia Park | Rua do Progresso, Lote 15
3800-639 AVEIRO | Portugal
T. +351 234 919 190 | F. +351 234 919 191
*www.wavecom.pt <http://www.wavecom.pt/>*
[image: WavecomSignature]
Hello. we use UAC module for trunk registration at kamailio.
We have successfull routing and calling through our trunks to many
providers and have just one problem with AT&T endpoints. When callee at
AT&T endpoint hook call (I see OK from provider as response to our INVITE
from AT&T endpoint) and then kamailio sends CANCEL to endpoint, but then
kam sends ACK to OK... So after this strange scenario I successfully hear
invite to leave voice mail to AT&T endpoint...
What I saw:
I look at codecs- at OK i See ulaw codec, so at my INVITE ulaw presents too.
With other providers calls succesfully established.
Does Anyone have an experiense with calling to AT&T from Kamailio.
P.S. calls through our trunk to AT&T from asterisk establishes succesfully
too.
Hi guys,
I've tried with success to implement serial forking based on q value (i've followed documentation) with the istruction:
append_branch("sip:b@example.com", "0.5");
Now my questions are:
is it possible to import URI from db? is it possible to import q value from db too?
I would like to change the q value based, for example, on "night & day"; so it would be nice if I can store it on DB and then load it dinamically when i need.For the first question I think that it's possible with dbaliases for example...but I don't know how get a q value for each contact :)
Marino