Below is my current code and my calls are just getting 100 trying -- your
call is important to us even between to locally registered extension. Any
guidance as to how to simplify troubleshooting this routing?
####### Routing Logic ########
# Main SIP request routing logic
# - processing of any incoming SIP request starts with this route
route {
# per request initial checks
route(REQINIT);
# NAT detection
route(NAT);
# 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;
}
#!ifdef WITH_FREESWITCH
# save callee ID
$avp(callee) = $rU;
route(FSDISPATCH);
#!endif
# user location service
route(LOCATION);
route(RELAY);
}
route[RELAY] {
#!ifdef WITH_NAT
if (check_route_param("nat=yes")) {
setbflag(FLB_NATB);
}
if (isflagset(FLT_NATS) || isbflagset(FLB_NATB)) {
route(RTPPROXY);
}
#!endif
#!ifdef WITH_CFGSAMPLES
/* example how to enable some additional event routes */
if (is_method("INVITE")) {
#t_on_branch("BRANCH_ONE");
t_on_reply("REPLY_ONE");
t_on_failure("FAIL_ONE");
}
#!endif
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
}
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();
exit;
}
}
# USER location service
route[LOCATION] {
#!ifdef WITH_ALIASDB
# search in DB-based aliases
alias_db_lookup("dbaliases");
#!endif
if (!lookup("location")) {
switch ($rc) {
case -1:
case -3:
t_newtran();
t_reply("404", "Not Found");
exit;
case -2:
sl_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
if (is_method("REGISTER"))
{
# authenticate the REGISTER requests (uncomment to enable
auth)
if (!www_authorize("$td", "subscriber"))
{
www_challenge("$td", "0");
exit;
}
if ($au!=$tU)
{
sl_send_reply("403","Forbidden auth ID");
exit;
}
} else {
#!ifdef WITH_FREESWITCH
if(route(FSINBOUND))
return;
#!endif
#!ifdef WITH_IPAUTH
if(allow_source_address())
{
# source IP allowed
return;
}
#!endif
# authenticate if from local subscriber
if (from_uri==myself)
{
if (!proxy_authorize("$fd", "subscriber")) {
proxy_challenge("$fd", "0");
exit;
}
if (is_method("PUBLISH"))
{
if ($au!=$tU) {
sl_send_reply("403","Forbidden auth
ID");
exit;
}
} else {
if ($au!=$fU) {
sl_send_reply("403","Forbidden auth
ID");
exit;
}
}
consume_credentials();
# caller authenticated
} else {
# caller is not local subscriber, then check if it
calls
# a local destination, otherwise deny, not an open
relay here
if (!uri==myself)
{
sl_send_reply("403","Not relaying");
exit;
}
}
}
#!endif
return;
}
# Caller NAT detection route
route[NAT] {
#!ifdef WITH_NAT
force_rport();
if (nat_uac_test("19")) {
if (method=="REGISTER") {
fix_nated_register();
} else {
fix_nated_contact();
}
setflag(FLT_NATS);
}
#!endif
return;
}
# RTPProxy control
route[RTPPROXY] {
#!ifdef WITH_NAT
if (is_method("BYE")) {
unforce_rtp_proxy();
} else if (is_method("INVITE")){
force_rtp_proxy();
}
if (!has_totag()) add_rr_param(";nat=yes");
#!endif
return;
}
# Routing to foreign domains
route[SIPOUT] {
if (!uri==myself)
{
append_hf("P-hint: outbound\r\n");
route(RELAY);
}
}
#!ifdef WITH_FREESWITCH
# FreeSWITCH routing blocks
route[FSINBOUND] {
if($si== $sel(cfg_get.freeswitch.bindip)
&& $sp==$sel(cfg_get.freeswitch.bindport))
return 1;
return -1;
}
route[FSDISPATCH] {
if(!is_method("INVITE"))
return;
if(route(FSINBOUND))
return;
# dial number selection
switch($rU) {
case /"^41$":
# 41 - voicebox menu
# allow only authenticated users
if($au==$null)
{
sl_send_reply("403", "Not allowed");
exit;
}
$rU = "vm-" + $au;
break;
case /"^441[0-9][0-9]$":
# starting with 44 folowed by 1XY - direct call to
voice box
strip(2);
route(FSVBOX);
break;
case /"^433[01][0-9][0-9]$":
# starting with 433 folowed by (0|1)XY - conference
strip(2);
break;
case /"^45[0-9]+$":
strip(2);
break;
default:
# offline - send to voicebox
if (!registered("location"))
{
route(FSVBOX);
exit;
}
# online - do bridging
prefix("kb-");
if(is_method("INVITE"))
{
# in case of failure - re-route to
FreeSWITCH VoiceMail
t_on_failure("FAIL_FSVBOX");
}
}
route(FSRELAY);
exit;
}
route[FSVBOX] {
if(!($rU=~"^1[0-9][0-9]+$"))
return;
prefix("vb-");
route(FSRELAY);
}
# Send to FreeSWITCH
route[FSRELAY] {
$du = "sip:" + $sel(cfg_get.freeswitch.bindip) + ":"
+ $sel(cfg_get.freeswitch.bindport);
if($var(newbranch)==1)
{
append_branch();
$var(newbranch) = 0;
}
route(RELAY);
exit;
}
#!endif
#!ifdef WITH_FREESWITCH
failure_route[FAIL_FSVBOX] {
#!ifdef WITH_NAT
if (is_method("INVITE")
&& (isbflagset(FLB_NATB) || isflagset(FLT_NATS))) {
unforce_rtp_proxy();
}
#!endif
if (t_is_canceled()) {
exit;
}
if (t_check_status("486|408")) {
# re-route to FreeSWITCH VoiceMail
$rU = $avp(callee);
$var(newbranch) = 1;
route(FSVBOX);
}
}
#!endif
# sample config file for dispatcher module
#!ifdef WITH_DISPATCHER
modparam("dispatcher", "db_url", "mysql://openser:password@localhost
/openser")
route{
if ( !mf_process_maxfwd_header("10") )
{
sl_send_reply("483","To Many Hops");
drop();
};
ds_select_dst("1", "0");
forward();
# t_relay();
}
#!endif
On 11/23/2010 06:41 PM, Jijo wrote:
> Yes it work with many UDP children.
There were some concurrency issues with the Postgres module a while
back, discovered after the 3.1.0 release. I remember something about it
because we are extremely heavy users of the Postgres module as well.
Unfortunately, I can't find the thread.
Try the latest git master HEAD:
git clone git://git.sip-router.org/sip-router
cd sip-router
make FLAVOUR=kamailio cfg
make all
And see if it changes.
--
Alex Balashov - Principal
Evariste Systems LLC
1170 Peachtree Street NE
12th Floor, Suite 1200
Atlanta, GA 30309
Tel: +1-678-954-0670
Fax: +1-404-961-1892
Web: http://www.evaristesys.com/
Hello.
I have Siremis 2.0 installed from scratch, but I’m unable to logging. This
is the error that I’m getting from the logs :
'01/05/2011','12:41:36','ERR','DATAOBJ','Query Error: SQLSTATE[42S02]: Base
table or view not found: 1146 Table 'siremis.contact' doesn't exist','n/a'
I was checking the SIREMIS db and I can’t found the table “contact”.
Is this a bug?.. can someone help me?
Thanks
Regards,
* *
*Ricardo Martinez.-*
Hello,
for those interested in learning how to write C code for Kamailio & SER,
the next development training class takes place in Barcelona, Spain,
during February 10-11, 2011. You can find more details at:
http://asipto.com/u/r
Number of seats is limited, the acceptance policy is first come first
served.
Cheers,
Daniel
--
Daniel-Constantin Mierla
Kamailio (OpenSER) Advanced Training
Jan 24-26, 2011, Irvine, CA, USA
http://www.asipto.com
Hi!
I just found out that my ENUM config didn't worked any more - and it
worked for sure some time ago.
Were there any recent changes, e.g. from 3.0 to 3.1?
I used
if enum_query("e164.arpa.","+sip+voice:sip") {
which should accept normal E2U+sip and E2U+voice:sip NAPTRs. But it
doesn't work with kamailio 3.1.0.
But enum_query("e164.arpa.") works.
thanks
klaus
Thanks Alex,
it looks like we'll have to move to mysql in that case (we are much more
experienced in postgres). Is this feature expected to be added for
db_postgres?
Regards
Javi
>
> Message: 6
> Date: Tue, 04 Jan 2011 11:54:20 -0500
> From: Alex Balashov <abalashov(a)evaristesys.com>
> Subject: Re: [SR-Users] Reconnection to db
> To: sr-users(a)lists.sip-router.org
> Message-ID: <4D2350BC.8080207(a)evaristesys.com>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> On 01/04/2011 09:46 AM, Javier Gallart wrote:
> > Hi list
> >
> > we have been testing the mtree module. We do periodical reloads of the
> > mtree table with the "mi mt_reload" command through xmlrpc. It works
> > fine except when the db is restarted. If we manually restart the db and
> > then try the mt_reload commands we get this error:
> > Jan 4 09:13:17 server /usr/local/kamailio-3.1.1/sbin/kamailio[28534]:
> > ERROR: db_postgres [km_dbase.c:152]: 0xa6a490 PQsendQuery Error: server
> > closed the connection unexpectedly#012#011This probably means the server
> > terminated abnormally#012#011before or while processing the request.#012
> > Query: select partition,prefix,route from trees order by partition
> > Jan 4 09:13:17 server /usr/local/kamailio-3.1.1/sbin/kamailio[28534]:
> > ERROR: <core> [db_query.c:101]: error while submitting query
> > Jan 4 09:13:17 server /usr/local/kamailio-3.1.1/sbin/kamailio[28534]:
> > ERROR: mtree [mtree_mod.c:622]: Error while querying db
> > Jan 4 09:13:17 server /usr/local/kamailio-3.1.1/sbin/kamailio[28534]:
> > ERROR: mtree [mtree_mod.c:738]: cannot re-load info from database
> >
> > Is there a way to reconnect to the db before sending that command?
>
> Failure to automatically reconnect to Postgres is one of the
> distinguishing features of db_postgres in contrast to db_mysql for the
> moment.
>
> --
> Alex Balashov - Principal
> Evariste Systems LLC
> 260 Peachtree Street NW
> Suite 2200
> Atlanta, GA 30303
> Tel: +1-678-954-0670
> Fax: +1-404-961-1892
> Web: http://www.evaristesys.com/
>
>
>
> ------------------------------
>
> _______________________________________________
> sr-users mailing list
> sr-users(a)lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>
> End of sr-users Digest, Vol 68, Issue 7
> ***************************************
>
Guys,
I am not sure in which world to expect to get an answer to this so I
am sending this to both SIPP and SR-User mailing lists.
I am trying to get an SIPP end-point to register with a kamailio proxy.
I do this by sending the REGISTER from the SIPP
end-point, which is successfully responded to by kamailio with a 200 OK.
No problems there.
The problem is then with sending an INVITE from kamailio to the SIPP
instance. This is where the problems arise.
1) If I include the expected INVITE in the same xml scenario file as the
REGISTER/200, then SIPP will complain about the INVITE
as it will have a different Call-ID from the REGISTER method. I have a
hunt around the forums and this was acknowledged as an issue
but as far as I can see this has not been fixed/implemented. The
following link will take you to a proposed fix for this issue.
http://sipp.sourceforge.net/wiki/index.php/Patches#Pre.2FPost_scenarios
Does anyone know what the current state of play is for this proposed
patch or if there is another way to get around this issue?
2) I tried to REGISTER the SIPP endpoint in a single xml scenario file
with kamailio. This works as per usual. I then killed
the SIPP instance and ran a new SIPP script listening on the same port
before trying to send the INVITE to it. I expected this to work
as the SIPP scenarios (both sending REGISTER and expecting INVITE)
listened on the same port. However, the INVITE was not
received by the SIPP endpoint. Can anyone think of a reason for this?
If any further info is required then please let me know. I have spent
quite a bit of time on this and its an itch that needs scratched.
Thanks in advance,
Steve.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Stephen McVarnock,
AePONA Ltd,
Interpoint Building,
20-24 York Street,
Belfast BT15 1AQ
Tel: +44 (0)28 9026 9114
Fax: +44 (0)28 9026 9111
http://www.aepona.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I was trying to use fax with kamailio / asterisk setup and sipce if
possible. In asterisk we had to enable udptl for faxing to work. But i
couldnot figure out where to start with for faxing in kamailio /asterisk
or sipce. Could someone guide me to the right direction please ?
Thank you
Amit