[sr-dev] [SR-Users] kamailio is returning 500

chanea chanea at gmail.com
Wed Feb 27 16:30:27 CET 2013


Hi Carsten,

Thanks for reply.   No idea how this happen but after increase the shared
memory used to run Kamailio , this 500 issue is gone now.

BTW,   REGISTER being routed seems wrong in my config file , therefore
after load balancing ,  client cannot reach each other by MESSAGE.

Client --- > Kamailio LB --->Sip01
                                \ ---->Sip02

Any idea??


Best Regards,

chanea

On Tue, Feb 26, 2013 at 10:39 PM, Carsten Bock <carsten at ng-voice.com> wrote:

> Hi,
>
> i see no point in your config, where the 500 should come from. It must
> come from the servers you are loadbalancing for.
>
> Kind regards,
> Carsten
>
> 2013/2/26 chanea <chanea at gmail.com>:
> > Hi Carsten,
> >
> > Thanks again for your kind reply.
> > I am quite newbie to kamailio,  and I dont see why the load balancer is
> > replying "500".
> >
> > It will be great appreciated if you can point out what i am doing wrong
> in
> > my config file as below.
> > Actually, there is another issue for the setting below is that it cannot
> > load balancing the "REGISTER" correctly.
> >
> > best regards,
> >
> > chanea
> >
> > ==============================================================
> >
> > ####### Global Parameters #########
> > #!define WITH_NAT
> >
> >
> >
> > # - 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 #########
> >
> > debug=-3
> > log_stderror=no
> >
> > memdbg=5
> > memlog=5
> >
> > log_facility=LOG_LOCAL0
> >
> > fork=yes
> > children=8
> >
> > disable_tcp=yes
> >
> > auto_aliases=no
> >
> > port=5060
> >
> >
> > sip_warning=no
> >
> > ####### Modules Section ########
> >
> > # set paths to location of modules
> > #!ifdef LOCAL_TEST_RUN
> > mpath="modules_k:modules"
> > #!else
> >
> mpath="/usr/local/lib64/kamailio/modules_k/:/usr/local/lib64/kamailio/modules/"
> > #!endif
> > loadmodule "db_mysql.so"
> > loadmodule "mi_fifo.so"
> > loadmodule "kex.so"
> > loadmodule "tm.so"
> > loadmodule "tmx.so"
> > loadmodule "sl.so"
> > loadmodule "rr.so"
> > loadmodule "usrloc.so"
> > loadmodule "pv.so"
> > loadmodule "maxfwd.so"
> > loadmodule "textops.so"
> > loadmodule "siputils.so"
> > loadmodule "xlog.so"
> > loadmodule "sanity.so"
> > loadmodule "ctl.so"
> > loadmodule "mi_rpc.so"
> > loadmodule "acc.so"
> > loadmodule "dispatcher.so"
> >
> > #!ifdef WITH_NAT
> > loadmodule "nathelper.so"
> > loadmodule "rtpproxy.so"
> > #!endif
> >
> >
> > # ----- mi_fifo params -----
> > modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
> >
> >
> > # ----- 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)
> > modparam("rr", "append_fromtag", 0)
> >
> >
> > # ----- acc params -----
> > modparam("acc", "log_flag", 1)
> > modparam("acc", "failed_transaction_flag", 3)
> > modparam("acc", "log_extra",
> >
> "src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd;src_ip=$si")
> >
> > # ----- tm params -----
> > modparam("tm", "fr_timer", 10000)
> > modparam("tm", "fr_inv_timer", 40000)
> >
> >
> > #!ifdef WITH_NAT
> > # ----- rtpproxy params -----
> > #modparam("rtpproxy", "rtpproxy_sock", "udp:127.0.0.1:7722")
> > modparam("rtpproxy", "rtpproxy_sock", "udp:{myipaddr}:22222")
> > # ----- nathelper params -----
> > modparam("nathelper", "natping_interval", 600)
> > modparam("nathelper", "ping_nated_only", 1)
> > modparam("nathelper", "sipping_bflag", FLB_NATSIPPING)
> > modparam("nathelper", "sipping_from", "sip:pinger@{myipaddr}")
> >
> > # params needed for NAT traversal in other modules
> > modparam("nathelper|registrar", "received_avp", "$avp(RECEIVED)")
> > modparam("usrloc", "nat_bflag", FLB_NATB)
> > #!endif
> >
> >
> > # ----- dispatcher params -----
> > modparam("dispatcher", "db_url",
> > "mysql://{mydbsetting}")
> > modparam("dispatcher", "table_name", "dispatcher")
> > modparam("dispatcher", "flags", 2)
> > modparam("dispatcher", "dst_avp", "$avp(AVP_DST)")
> > modparam("dispatcher", "grp_avp", "$avp(AVP_GRP)")
> > modparam("dispatcher", "cnt_avp", "$avp(AVP_CNT)")
> >
> > ####### Routing Logic ########
> >
> >
> > # main request routing logic
> >
> > 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();
> >
> > # 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(1); # do accounting
> > }
> >
> > # dispatch destinations
> > route(DISPATCH);
> >
> > 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
> > if (!t_relay()) {
> > sl_reply_error();
> > }
> > exit;
> > }
> >
> >
> > # Per SIP request initial checks
> > route[REQINIT] {
> > 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;
> > }
> > }
> >
> > # Caller NAT detection route
> > route[NAT] {
> > #!ifdef WITH_NAT
> > force_rport();
> > if (nat_uac_test("19")) {
> > #xlog("L_INFO","ALERT: ua is behind NAT (ru:$ru)(IP:$si:$sp)\n");
> >
> > 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;
> > }
> >
> >
> >
> > # 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(1); # do accounting ...
> > setflag(3); # ... even if the transaction fails
> > }
> > route(RELAY);
> > } else {
> > if ( is_method("ACK") ) {
> > if ( t_check_trans() ) {
> > # non loose-route, but stateful ACK;
> > # must be 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;
> > }
> > }
> >
> > # Dispatch requests
> > route[DISPATCH] {
> > # round robin dispatching on gateways group '1'
> > if(!ds_select_dst("1", "0"))
> > {
> > send_reply("404", "No destination");
> > exit;
> > }
> > xlog("L_INFO", "--- SCRIPT: going to <$ru> via <$du>\n");
> > t_on_failure("RTF_DISPATCH");
> > return;
> > }
> >
> > # Sample failure route
> > failure_route[RTF_DISPATCH] {
> > if (t_is_canceled()) {
> > exit;
> > }
> > # next DST - only for 500 or local timeout
> > if (t_check_status("500")
> > or (t_branch_timeout() and !t_branch_replied()))
> > {
> > if(ds_next_dst())
> > {
> > t_on_failure("RTF_DISPATCH");
> > route(RELAY);
> > exit;
> > }
> > }
> > }
> > =================================================================
> >
> >
> >
> > On Tue, Feb 26, 2013 at 8:32 PM, Carsten Bock <carsten at ng-voice.com>
> wrote:
> >>
> >> Hi,
> >>
> >> the dispatcher module doesn't create "500 Internal Server Error"
> replies.
> >> There must be another source for your error; most likely not the
> >> Kamailio Loadbalancer.
> >>
> >> Kind regards,
> >> Carsten
> >>
> >> 2013/2/26 chanea <chanea at gmail.com>:
> >> > Hi Carsten,
> >> >
> >> > Thanks for your quick reply.
> >> > The "500" is generated by the Kamailio server which is used as Load
> >> > balancer
> >> > ( using dispatcher module).
> >> >
> >> > I dont see any 500 number in my kamailio.cfg in the load balancer
> >> > kamailio.
> >> > Should I go deep into the dispatcher module itself?
> >> >
> >> >
> >> > Unluckily I cannot check the reason by checking the syslog since this
> >> > only
> >> > happen when thousands of request come in at the same time.
> >> >
> >> > chanea
> >> >
> >> >
> >> >
> >> > On Tue, Feb 26, 2013 at 7:24 PM, Carsten Bock <carsten at ng-voice.com>
> >> > wrote:
> >> >>
> >> >> Hi,
> >> >>
> >> >> can you see, why the Kamailio is returning a "500 Server internal
> >> >> error"? This response must be either created by some module or by
> some
> >> >> upstream server (e.g. in case of loadbalancing).
> >> >> Kamailio itself would not create such response, you should (if at
> all)
> >> >> find the answer in the logs...
> >> >>
> >> >> Kind regards,
> >> >> Carsten
> >> >>
> >> >> 2013/2/26 chanea <chanea at gmail.com>:
> >> >> > Dear all
> >> >> >
> >> >> > While lots of request come to my Kamailio 3.1.x in the same time ,
> >> >> > server
> >> >> > is returning "500, Server Internal Error" to some of the request.
> >> >> >
> >> >> > What should i do if i want to reduce the number of "500" response?
> >> >> >
> >> >> >
> >> >> >
> >> >> > chanea
> >> >> >
> >> >> > _______________________________________________
> >> >> > sr-dev mailing list
> >> >> > sr-dev at lists.sip-router.org
> >> >> > http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> Carsten Bock
> >> >> CEO (Geschäftsführer)
> >> >>
> >> >> =============================================================
> >> >> Visit us on the Kamailio World 2013, 16./17. April 2013
> >> >> => http://conference.kamailio.com/k01/
> See
> >> >> you there!
> >> >> =============================================================
> >> >>
> >> >> ng-voice GmbH
> >> >> Schomburgstr. 80
> >> >> D-22767 Hamburg / Germany
> >> >>
> >> >> http://www.ng-voice.com
> >> >> mailto:carsten at ng-voice.com
> >> >>
> >> >> Office +49 40 34927219
> >> >> Fax +49 40 34927220
> >> >>
> >> >> Sitz der Gesellschaft: Hamburg
> >> >> Registergericht: Amtsgericht Hamburg, HRB 120189
> >> >> Geschäftsführer: Carsten Bock
> >> >> Ust-ID: DE279344284
> >> >>
> >> >> Hier finden Sie unsere handelsrechtlichen Pflichtangaben:
> >> >> http://www.ng-voice.com/imprint/
> >> >>
> >> >> _______________________________________________
> >> >> sr-dev mailing list
> >> >> sr-dev at lists.sip-router.org
> >> >> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
> >> >
> >> >
> >> >
> >> > _______________________________________________
> >> > sr-dev mailing list
> >> > sr-dev at lists.sip-router.org
> >> > http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
> >> >
> >>
> >>
> >>
> >> --
> >> Carsten Bock
> >> CEO (Geschäftsführer)
> >>
> >> =============================================================
> >> Visit us on the Kamailio World 2013, 16./17. April 2013
> >> => http://conference.kamailio.com/k01/                             See
> >> you there!
> >> =============================================================
> >>
> >> ng-voice GmbH
> >> Schomburgstr. 80
> >> D-22767 Hamburg / Germany
> >>
> >> http://www.ng-voice.com
> >> mailto:carsten at ng-voice.com
> >>
> >> Office +49 40 34927219
> >> Fax +49 40 34927220
> >>
> >> Sitz der Gesellschaft: Hamburg
> >> Registergericht: Amtsgericht Hamburg, HRB 120189
> >> Geschäftsführer: Carsten Bock
> >> Ust-ID: DE279344284
> >>
> >> Hier finden Sie unsere handelsrechtlichen Pflichtangaben:
> >> http://www.ng-voice.com/imprint/
> >>
> >> _______________________________________________
> >> sr-dev mailing list
> >> sr-dev at lists.sip-router.org
> >> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
> >
> >
> >
> > _______________________________________________
> > sr-dev mailing list
> > sr-dev at lists.sip-router.org
> > http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
> >
>
>
>
> --
> Carsten Bock
> CEO (Geschäftsführer)
>
> =============================================================
> Visit us on the Kamailio World 2013, 16./17. April 2013
> => http://conference.kamailio.com/k01/                             See
> you there!
> =============================================================
>
> ng-voice GmbH
> Schomburgstr. 80
> D-22767 Hamburg / Germany
>
> http://www.ng-voice.com
> mailto:carsten at ng-voice.com
>
> Office +49 40 34927219
> Fax +49 40 34927220
>
> Sitz der Gesellschaft: Hamburg
> Registergericht: Amtsgericht Hamburg, HRB 120189
> Geschäftsführer: Carsten Bock
> Ust-ID: DE279344284
>
> Hier finden Sie unsere handelsrechtlichen Pflichtangaben:
> http://www.ng-voice.com/imprint/
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20130228/5e25c0d9/attachment-0001.htm>


More information about the sr-dev mailing list