<div>Hi Carsten,</div><div><br></div><div>Thanks for reply. No idea how this happen but after increase the shared memory used to run Kamailio , this 500 issue is gone now. </div><div><br></div><div>BTW, REGISTER being routed seems wrong in my config file , therefore after load balancing , client cannot reach each other by MESSAGE.</div>
<div><br></div><div>Client --- > Kamailio LB --->Sip01</div><div> \ ---->Sip02</div><div><br></div>Any idea??<div><div><br></div><div><br></div><div>Best Regards,</div><div><br></div>
<div>chanea<br><br><div class="gmail_quote">On Tue, Feb 26, 2013 at 10:39 PM, Carsten Bock <span dir="ltr"><<a href="mailto:carsten@ng-voice.com" target="_blank">carsten@ng-voice.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
i see no point in your config, where the 500 should come from. It must<br>
come from the servers you are loadbalancing for.<br>
<div><div class="h5"><br>
Kind regards,<br>
Carsten<br>
<br>
2013/2/26 chanea <<a href="mailto:chanea@gmail.com">chanea@gmail.com</a>>:<br>
> Hi Carsten,<br>
><br>
> Thanks again for your kind reply.<br>
> I am quite newbie to kamailio, and I dont see why the load balancer is<br>
> replying "500".<br>
><br>
> It will be great appreciated if you can point out what i am doing wrong in<br>
> my config file as below.<br>
> Actually, there is another issue for the setting below is that it cannot<br>
> load balancing the "REGISTER" correctly.<br>
><br>
> best regards,<br>
><br>
> chanea<br>
><br>
> ==============================================================<br>
><br>
> ####### Global Parameters #########<br>
> #!define WITH_NAT<br>
><br>
><br>
><br>
> # - flags<br>
> # FLT_ - per transaction (message) flags<br>
> # FLB_ - per branch flags<br>
> #!define FLT_ACC 1<br>
> #!define FLT_ACCMISSED 2<br>
> #!define FLT_ACCFAILED 3<br>
> #!define FLT_NATS 5<br>
><br>
> #!define FLB_NATB 6<br>
> #!define FLB_NATSIPPING 7<br>
><br>
> ####### Global Parameters #########<br>
><br>
> debug=-3<br>
> log_stderror=no<br>
><br>
> memdbg=5<br>
> memlog=5<br>
><br>
> log_facility=LOG_LOCAL0<br>
><br>
> fork=yes<br>
> children=8<br>
><br>
> disable_tcp=yes<br>
><br>
> auto_aliases=no<br>
><br>
> port=5060<br>
><br>
><br>
> sip_warning=no<br>
><br>
> ####### Modules Section ########<br>
><br>
> # set paths to location of modules<br>
> #!ifdef LOCAL_TEST_RUN<br>
> mpath="modules_k:modules"<br>
> #!else<br>
> mpath="/usr/local/lib64/kamailio/modules_k/:/usr/local/lib64/kamailio/modules/"<br>
> #!endif<br>
> loadmodule "db_mysql.so"<br>
> loadmodule "mi_fifo.so"<br>
> loadmodule "kex.so"<br>
> loadmodule "tm.so"<br>
> loadmodule "tmx.so"<br>
> loadmodule "sl.so"<br>
> loadmodule "rr.so"<br>
> loadmodule "usrloc.so"<br>
> loadmodule "pv.so"<br>
> loadmodule "maxfwd.so"<br>
> loadmodule "textops.so"<br>
> loadmodule "siputils.so"<br>
> loadmodule "xlog.so"<br>
> loadmodule "sanity.so"<br>
> loadmodule "ctl.so"<br>
> loadmodule "mi_rpc.so"<br>
> loadmodule "acc.so"<br>
> loadmodule "dispatcher.so"<br>
><br>
> #!ifdef WITH_NAT<br>
> loadmodule "nathelper.so"<br>
> loadmodule "rtpproxy.so"<br>
> #!endif<br>
><br>
><br>
> # ----- mi_fifo params -----<br>
> modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")<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>
> # ----- acc params -----<br>
> modparam("acc", "log_flag", 1)<br>
> modparam("acc", "failed_transaction_flag", 3)<br>
> modparam("acc", "log_extra",<br>
> "src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd;src_ip=$si")<br>
><br>
> # ----- tm params -----<br>
> modparam("tm", "fr_timer", 10000)<br>
> modparam("tm", "fr_inv_timer", 40000)<br>
><br>
><br>
> #!ifdef WITH_NAT<br>
> # ----- rtpproxy params -----<br>
> #modparam("rtpproxy", "rtpproxy_sock", "udp:<a href="http://127.0.0.1:7722" target="_blank">127.0.0.1:7722</a>")<br>
> modparam("rtpproxy", "rtpproxy_sock", "udp:{myipaddr}:22222")<br>
> # ----- nathelper params -----<br>
> modparam("nathelper", "natping_interval", 600)<br>
> modparam("nathelper", "ping_nated_only", 1)<br>
> modparam("nathelper", "sipping_bflag", FLB_NATSIPPING)<br>
> modparam("nathelper", "sipping_from", "sip:pinger@{myipaddr}")<br>
><br>
> # params needed for NAT traversal in other modules<br>
> modparam("nathelper|registrar", "received_avp", "$avp(RECEIVED)")<br>
> modparam("usrloc", "nat_bflag", FLB_NATB)<br>
> #!endif<br>
><br>
><br>
> # ----- dispatcher params -----<br>
> modparam("dispatcher", "db_url",<br>
> "mysql://{mydbsetting}")<br>
> modparam("dispatcher", "table_name", "dispatcher")<br>
> modparam("dispatcher", "flags", 2)<br>
> modparam("dispatcher", "dst_avp", "$avp(AVP_DST)")<br>
> modparam("dispatcher", "grp_avp", "$avp(AVP_GRP)")<br>
> modparam("dispatcher", "cnt_avp", "$avp(AVP_CNT)")<br>
><br>
> ####### Routing Logic ########<br>
><br>
><br>
> # main request routing logic<br>
><br>
> route {<br>
><br>
> # per request initial checks<br>
> route(REQINIT);<br>
><br>
> # NAT detection<br>
> route(NAT);<br>
><br>
> # handle requests within SIP dialogs<br>
> route(WITHINDLG);<br>
><br>
> ### only initial requests (no To tag)<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>
> # record routing for dialog forming requests (in case they are routed)<br>
> # - remove preloaded route headers<br>
> remove_hf("Route");<br>
> if (is_method("INVITE|SUBSCRIBE"))<br>
> record_route();<br>
><br>
> # account only INVITEs<br>
> if (is_method("INVITE"))<br>
> {<br>
> setflag(1); # do accounting<br>
> }<br>
><br>
> # dispatch destinations<br>
> route(DISPATCH);<br>
><br>
> route(RELAY);<br>
> }<br>
><br>
><br>
> route[RELAY] {<br>
> #!ifdef WITH_NAT<br>
> if (check_route_param("nat=yes")) {<br>
> setbflag(FLB_NATB);<br>
> }<br>
> if (isflagset(FLT_NATS) || isbflagset(FLB_NATB)) {<br>
> route(RTPPROXY);<br>
> }<br>
> #!endif<br>
> if (!t_relay()) {<br>
> sl_reply_error();<br>
> }<br>
> exit;<br>
> }<br>
><br>
><br>
> # Per SIP request initial checks<br>
> route[REQINIT] {<br>
> if (!mf_process_maxfwd_header("10")) {<br>
> sl_send_reply("483","Too Many Hops");<br>
> exit;<br>
> }<br>
><br>
> if(!sanity_check("1511", "7"))<br>
> {<br>
> xlog("Malformed SIP message from $si:$sp\n");<br>
> exit;<br>
> }<br>
> }<br>
><br>
> # Caller NAT detection route<br>
> route[NAT] {<br>
> #!ifdef WITH_NAT<br>
> force_rport();<br>
> if (nat_uac_test("19")) {<br>
> #xlog("L_INFO","ALERT: ua is behind NAT (ru:$ru)(IP:$si:$sp)\n");<br>
><br>
> if (method=="REGISTER") {<br>
> fix_nated_register();<br>
> } else {<br>
> fix_nated_contact();<br>
> }<br>
> setflag(FLT_NATS);<br>
> }<br>
> #!endif<br>
> return;<br>
> }<br>
><br>
> # RTPProxy control<br>
> route[RTPPROXY] {<br>
> #!ifdef WITH_NAT<br>
> if (is_method("BYE")) {<br>
> unforce_rtp_proxy();<br>
> } else if (is_method("INVITE")){<br>
> force_rtp_proxy();<br>
> }<br>
> if (!has_totag()) add_rr_param(";nat=yes");<br>
> #!endif<br>
> return;<br>
> }<br>
><br>
><br>
><br>
> # Handle requests within SIP dialogs<br>
> route[WITHINDLG] {<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(RELAY);<br>
> } else {<br>
> if ( is_method("ACK") ) {<br>
> if ( t_check_trans() ) {<br>
> # non loose-route, but stateful ACK;<br>
> # must be 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.<br>
> exit;<br>
> }<br>
> }<br>
> sl_send_reply("404","Not here");<br>
> }<br>
> exit;<br>
> }<br>
> }<br>
><br>
> # Dispatch requests<br>
> route[DISPATCH] {<br>
> # round robin dispatching on gateways group '1'<br>
> if(!ds_select_dst("1", "0"))<br>
> {<br>
> send_reply("404", "No destination");<br>
> exit;<br>
> }<br>
> xlog("L_INFO", "--- SCRIPT: going to <$ru> via <$du>\n");<br>
> t_on_failure("RTF_DISPATCH");<br>
> return;<br>
> }<br>
><br>
> # Sample failure route<br>
> failure_route[RTF_DISPATCH] {<br>
> if (t_is_canceled()) {<br>
> exit;<br>
> }<br>
> # next DST - only for 500 or local timeout<br>
> if (t_check_status("500")<br>
> or (t_branch_timeout() and !t_branch_replied()))<br>
> {<br>
> if(ds_next_dst())<br>
> {<br>
> t_on_failure("RTF_DISPATCH");<br>
> route(RELAY);<br>
> exit;<br>
> }<br>
> }<br>
> }<br>
> =================================================================<br>
><br>
><br>
><br>
> On Tue, Feb 26, 2013 at 8:32 PM, Carsten Bock <<a href="mailto:carsten@ng-voice.com">carsten@ng-voice.com</a>> wrote:<br>
>><br>
>> Hi,<br>
>><br>
>> the dispatcher module doesn't create "500 Internal Server Error" replies.<br>
>> There must be another source for your error; most likely not the<br>
>> Kamailio Loadbalancer.<br>
>><br>
>> Kind regards,<br>
>> Carsten<br>
>><br>
>> 2013/2/26 chanea <<a href="mailto:chanea@gmail.com">chanea@gmail.com</a>>:<br>
>> > Hi Carsten,<br>
>> ><br>
>> > Thanks for your quick reply.<br>
>> > The "500" is generated by the Kamailio server which is used as Load<br>
>> > balancer<br>
>> > ( using dispatcher module).<br>
>> ><br>
>> > I dont see any 500 number in my kamailio.cfg in the load balancer<br>
>> > kamailio.<br>
>> > Should I go deep into the dispatcher module itself?<br>
>> ><br>
>> ><br>
>> > Unluckily I cannot check the reason by checking the syslog since this<br>
>> > only<br>
>> > happen when thousands of request come in at the same time.<br>
>> ><br>
>> > chanea<br>
>> ><br>
>> ><br>
>> ><br>
>> > On Tue, Feb 26, 2013 at 7:24 PM, Carsten Bock <<a href="mailto:carsten@ng-voice.com">carsten@ng-voice.com</a>><br>
>> > wrote:<br>
>> >><br>
>> >> Hi,<br>
>> >><br>
>> >> can you see, why the Kamailio is returning a "500 Server internal<br>
>> >> error"? This response must be either created by some module or by some<br>
>> >> upstream server (e.g. in case of loadbalancing).<br>
>> >> Kamailio itself would not create such response, you should (if at all)<br>
>> >> find the answer in the logs...<br>
>> >><br>
>> >> Kind regards,<br>
>> >> Carsten<br>
>> >><br>
>> >> 2013/2/26 chanea <<a href="mailto:chanea@gmail.com">chanea@gmail.com</a>>:<br>
>> >> > Dear all<br>
>> >> ><br>
>> >> > While lots of request come to my Kamailio 3.1.x in the same time ,<br>
>> >> > server<br>
>> >> > is returning "500, Server Internal Error" to some of the request.<br>
>> >> ><br>
>> >> > What should i do if i want to reduce the number of "500" response?<br>
>> >> ><br>
>> >> ><br>
>> >> ><br>
>> >> > chanea<br>
>> >> ><br>
>> >> > _______________________________________________<br>
>> >> > sr-dev mailing list<br>
>> >> > <a href="mailto:sr-dev@lists.sip-router.org">sr-dev@lists.sip-router.org</a><br>
>> >> > <a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a><br>
>> >> ><br>
>> >><br>
>> >><br>
>> >><br>
>> >> --<br>
>> >> Carsten Bock<br>
>> >> CEO (Geschäftsführer)<br>
>> >><br>
>> >> =============================================================<br>
>> >> Visit us on the Kamailio World 2013, 16./17. April 2013<br>
>> >> => <a href="http://conference.kamailio.com/k01/" target="_blank">http://conference.kamailio.com/k01/</a> See<br>
>> >> you there!<br>
>> >> =============================================================<br>
>> >><br>
>> >> ng-voice GmbH<br>
>> >> Schomburgstr. 80<br>
>> >> D-22767 Hamburg / Germany<br>
>> >><br>
>> >> <a href="http://www.ng-voice.com" target="_blank">http://www.ng-voice.com</a><br>
>> >> mailto:<a href="mailto:carsten@ng-voice.com">carsten@ng-voice.com</a><br>
>> >><br>
>> >> Office <a href="tel:%2B49%2040%2034927219" value="+494034927219">+49 40 34927219</a><br>
>> >> Fax <a href="tel:%2B49%2040%2034927220" value="+494034927220">+49 40 34927220</a><br>
>> >><br>
>> >> Sitz der Gesellschaft: Hamburg<br>
>> >> Registergericht: Amtsgericht Hamburg, HRB 120189<br>
>> >> Geschäftsführer: Carsten Bock<br>
>> >> Ust-ID: DE279344284<br>
>> >><br>
>> >> Hier finden Sie unsere handelsrechtlichen Pflichtangaben:<br>
>> >> <a href="http://www.ng-voice.com/imprint/" target="_blank">http://www.ng-voice.com/imprint/</a><br>
>> >><br>
>> >> _______________________________________________<br>
>> >> sr-dev mailing list<br>
>> >> <a href="mailto:sr-dev@lists.sip-router.org">sr-dev@lists.sip-router.org</a><br>
>> >> <a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a><br>
>> ><br>
>> ><br>
>> ><br>
>> > _______________________________________________<br>
>> > sr-dev mailing list<br>
>> > <a href="mailto:sr-dev@lists.sip-router.org">sr-dev@lists.sip-router.org</a><br>
>> > <a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a><br>
>> ><br>
>><br>
>><br>
>><br>
>> --<br>
>> Carsten Bock<br>
>> CEO (Geschäftsführer)<br>
>><br>
>> =============================================================<br>
>> Visit us on the Kamailio World 2013, 16./17. April 2013<br>
>> => <a href="http://conference.kamailio.com/k01/" target="_blank">http://conference.kamailio.com/k01/</a> See<br>
>> you there!<br>
>> =============================================================<br>
>><br>
>> ng-voice GmbH<br>
>> Schomburgstr. 80<br>
>> D-22767 Hamburg / Germany<br>
>><br>
>> <a href="http://www.ng-voice.com" target="_blank">http://www.ng-voice.com</a><br>
>> mailto:<a href="mailto:carsten@ng-voice.com">carsten@ng-voice.com</a><br>
>><br>
>> Office <a href="tel:%2B49%2040%2034927219" value="+494034927219">+49 40 34927219</a><br>
>> Fax <a href="tel:%2B49%2040%2034927220" value="+494034927220">+49 40 34927220</a><br>
>><br>
>> Sitz der Gesellschaft: Hamburg<br>
>> Registergericht: Amtsgericht Hamburg, HRB 120189<br>
>> Geschäftsführer: Carsten Bock<br>
>> Ust-ID: DE279344284<br>
>><br>
>> Hier finden Sie unsere handelsrechtlichen Pflichtangaben:<br>
>> <a href="http://www.ng-voice.com/imprint/" target="_blank">http://www.ng-voice.com/imprint/</a><br>
>><br>
>> _______________________________________________<br>
>> sr-dev mailing list<br>
>> <a href="mailto:sr-dev@lists.sip-router.org">sr-dev@lists.sip-router.org</a><br>
>> <a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a><br>
><br>
><br>
><br>
> _______________________________________________<br>
> sr-dev mailing list<br>
> <a href="mailto:sr-dev@lists.sip-router.org">sr-dev@lists.sip-router.org</a><br>
> <a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a><br>
><br>
<br>
<br>
<br>
--<br>
Carsten Bock<br>
CEO (Geschäftsführer)<br>
<br>
=============================================================<br>
Visit us on the Kamailio World 2013, 16./17. April 2013<br>
=> <a href="http://conference.kamailio.com/k01/" target="_blank">http://conference.kamailio.com/k01/</a> See<br>
you there!<br>
=============================================================<br>
<br>
ng-voice GmbH<br>
Schomburgstr. 80<br>
D-22767 Hamburg / Germany<br>
<br>
<a href="http://www.ng-voice.com" target="_blank">http://www.ng-voice.com</a><br>
mailto:<a href="mailto:carsten@ng-voice.com">carsten@ng-voice.com</a><br>
<br>
Office <a href="tel:%2B49%2040%2034927219" value="+494034927219">+49 40 34927219</a><br>
Fax <a href="tel:%2B49%2040%2034927220" value="+494034927220">+49 40 34927220</a><br>
<br>
Sitz der Gesellschaft: Hamburg<br>
Registergericht: Amtsgericht Hamburg, HRB 120189<br>
Geschäftsführer: Carsten Bock<br>
Ust-ID: DE279344284<br>
<br>
Hier finden Sie unsere handelsrechtlichen Pflichtangaben:<br>
<a href="http://www.ng-voice.com/imprint/" target="_blank">http://www.ng-voice.com/imprint/</a><br>
<br>
_______________________________________________<br>
</div></div>SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote></div><br></div></div>