[SR-Users] Kamailio Crashes when dispatcher failover is being applied

2016-07-18 Thread TEG AMJG
Dear list

Im quite new to Kamailio and i found something while trying to see the
failover behaviour in Kamailio. I have a kamailio v4.3.5 load balancing two
Asterisk boxes.

This happens just when i stop one of the asterisk and make a call that is
being load balanced to the same asterisk box that i stopped before, when
trying to go to failure_route and dispatch it to the other box then
Kamailio just crashes. I have debug=4 in the config file and it really
doesnt say much about the error. This is the relative logging i could found:
































*Jul 18 16:30:13 kam2 /usr/sbin/kamailio[69548]: INFO: 

Re: [SR-Users] RTPProxy Issues

2016-07-18 Thread TEG AMJG
Hi again

Yes, i feel very dumb because i actually faced this problem in my testing
with SIPp and with Asterisk before and it was all about open file
description. I probably didnt think about it because I couldnt find
anything in the logs about it which it is quite weird, the only thing that
logs is the one mentioned before, I feel sorry for wasting your time but at
the same time i have to thanks to you guys for helped me out.

Best Regards.

Alejandro

2016-07-17 23:43 GMT-04:00 Maxim Sobolev <sobo...@sippysoft.com>:

> Yes, that's probably it. There should be also some error in the log that
> rtpproxy emits, so you might want to check that. I see people run into this
> from time to time, perhaps we need to check and put out a big warning in
> red if the OS limit appers to be too low?
>
> -Max
>
> On Sun, Jul 17, 2016 at 3:18 PM, Nathan Angelacos <nan...@nothome.org>
> wrote:
>
>> On 07/17/2016 05:49 PM, TEG AMJG wrote:
>>
>>> Dear list
>>>
>>> I am quite new to Kamailio and i have been able to solve some NAT
>>> Traversal issues with symmetric SIP+RTP putting kamailio+rtpproxy behind
>>> NAT, i am also load balancing some asterisk boxes for transcoding and some
>>> other services like voicemail. Also i am using SIPp for load testing
>>>
>>> Now the question is that, while everything is working great with NAT
>>> (even when i am using SIPp for testing with low load) when i am about to
>>> test it with more than 150 calls or something i am starting to get the
>>> following error:
>>>
>>> /kamailio[34549]: ERROR: rtpproxy [rtpproxy.c:2735]: force_rtp_proxy():
>>> incorrect port 0 in reply from rtp proxy/
>>>
>>
>>
>> A guess, but each call takes 4 file descriptors, so you might be running
>> into the normal os limit of 1024 open files per process.
>> Recent rtpproxy versions have the -L option to increase the limit. It
>> should be 4 times the number of concurrent calls you expect to handle.
>>
>> Again, just a guess.
>>
>>
>>
>> ___
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>> sr-users@lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>
>
>
>
>
>
> ___
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users@lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>


-- 
-
Saludos a todos
___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] RTPProxy Issues

2016-07-17 Thread TEG AMJG
Dear list

I am quite new to Kamailio and i have been able to solve some NAT Traversal
issues with symmetric SIP+RTP putting kamailio+rtpproxy behind NAT, i am
also load balancing some asterisk boxes for transcoding and some other
services like voicemail. Also i am using SIPp for load testing

Now the question is that, while everything is working great with NAT (even
when i am using SIPp for testing with low load) when i am about to test it
with more than 150 calls or something i am starting to get the following
error:

*kamailio[34549]: ERROR: rtpproxy [rtpproxy.c:2735]: force_rtp_proxy():
incorrect port 0 in reply from rtp proxy*

I have been trying to look at some SIP packets when the error starts and i
am not seeing anything out of the normal (while being quite difficult to
debug when having so many concurrent calls at SIP level)

My configuration doesnt have anything new, the only thing is that, because
Kamailio is behind NAT i used some ideas from some other users and debates
from this same mailing list:

*# 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;*

* if(!route(FROMASTERISK)){*
*force_send_socket(10.0.1.207);*
*rtpproxy_manage("rw","10.0.1.206");*
* }else{*
*force_send_socket(10.0.1.206);*
*rtpproxy_manage("rw","10.0.5.203");*
* }*

* if (is_request()) {*
*  if (!has_totag()) {*
*   add_rr_param(";nat=yes");*
*  }*
* }*
* if (is_reply()) {*
*  if(isbflagset(FLB_NATB)) {*
*fix_nated_contact();*
*  }*
*#!endif*
* return;*
*}*

This solution is based of someone's idea from this mailing list:
http://lists.sip-router.org/pipermail/sr-users/2013-January/076254.html

As you can see in my configuration, my "public network" is really private
network so i tweak the NATDETECT route to not include RFC1918 networks as
part of the detection

*# Caller NAT detection route*
*route[NATDETECT] {*
*#!ifdef WITH_NAT*

*if (nat_uac_test("1")) {*
*if (nat_uac_test("18")) {*
*force_rport();*
*if (is_method("REGISTER")) {*
*fix_nated_register();*
*} else {*
*fix_nated_contact();*
*}*
*setflag(FLT_NATS);*
*return;*
*}*
* }*
*#!endif*
* return;*
*}*

Also i would like to know how may i use RTPProxy logs?, i tried to
configure it like this:

/etc/rsyslog.conf

*# Kamailio logging*
*local0.*
 -/var/log/kamailio.log*

*#RTPProxy logging*
*local3.*
 /var/log/rtpproxy.log*

/etc/sysconfig/rtpproxy

*OPTIONS="-l 10.0.1.206 -A 10.0.5.203 -s udp:127.0.0.1:7722
 -r /var/lib/rtpproxy/sessions -d DBUG:LOG_LOCAL3 -m
35000 -M 55000 -F"*

I cannot see anyhing in the logs

Thank you very much

Alejandro
___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] [SR-USERS] Kamailio issues with Asterisk Voicemail

2016-07-04 Thread TEG AMJG
Dear list:

I am quite new to Kamailio and i am really struggling to get some answer to
some questions i have been trying to get answers by reading documentation
and other questions or solutions around internet.

Even though i am integrating Kamailio with two Asterisk boxes with the
module dispatcher, i didnt follow the quite popular guide of Asterisk
Kamailio Realtime Integration (
http://kb.asipto.com/asterisk:realtime:kamailio-4.0.x-asterisk-11.3.0-astdb).
The reason why i didnt is that it actually behaved weird since i wanted
Kamailio to be a stateful proxy and also wanted Kamailio to act as a
Registrar Server and Location Server using subscriber and location tables
of kamailio database, keeping both Asterisk strictly as Media Servers.

Also i have been able to solve some NAT Traversal issues using RTPProxy and
not using those Asterisk boxes with their nat or qualify parameters to
solve NAT issues. Most of my solution started following this guide (
http://saevolgo.blogspot.com/2013/08/rtpproxy-revisited-kamailio-40.html)
which let me handle registration and location with Kamailio and also
changed it putting kamailio behind NAT.

Now to the real question, is there anyway to include Asterisk voicemail
functionality with the solution I already mentioned? the question is
because, as I far as I know, Asterisk needs to associate mailboxes to its
users. So i believe that i have to practically change most of my solution
and find a way to make Kamailio register and locate users with the Realtime
integration of Asterisk and map the registration accordingly to the table
fields.

But it destroys most of my NAT and register solution since i also
configured one of the private IPs as a peer in Asterisk sort of like in
that guide

[Kamailio]

type=friend

host=192.168.1.244

port=5060

disallow=all

allow=gsm

allow=g729

allow=alaw

allow=ulaw

Sorry for making the question so long and to be quite ignorant with some of
the concepts involving Kamailio with Asterisk


Thanks


Alejandro
___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] dispatcher [dispatch.c:1416]: ds_load_remove(): cannot find load for (from asterisk call-id)

2016-04-04 Thread TEG AMJG
Hi again

There is something that i am starting to realize and i think is the source
of the problem. Since i am not sure, I think someone can clarify this to me.

As i said the problem rises when i do a 2 call leg conversation. In which,
since Asterisk is a B2BUA and creates another channel (which ends up being
another dialog), there is a point where Asterisk initiates the SIP flow.

Sip Client 1 ---> Kamailio --> Asterisk (dialog 1)
Asterisk -> Kamailio -> Sip Client 2 (dialog 2)

Now, since both Asterisk takes part of the destination addresses which the
dispatcher modules are managing at the moment, there is no way (from what i
know) that the ds_load_update() actually records that call load.

I am pretty sure that there is some way to manage this better, and since i
am new to Kamailio, I think you guys can help me out easily

Thank you very much for your time



2016-04-04 18:35 GMT-03:00 TEG AMJG <tega...@gmail.com>:

> Hi Alberto, thanks for your reply
>
> yeah, i am using ds_select_dst("0","10") in this case because i use
> setid=0 in the dispatcher table as you can see in this route block
>
> route[TOASTERISK] {
> #!ifdef WITH_LOADBALANCE
> xlog("L_INFO","UBICAR: Forwarding non-registrar requests to
> Asterisk \n");
>  if(!ds_select_dst("0", "10")) {
> sl_send_reply("500", "Service Unavailable");
> xlog("L_ERROR","UBICAR: No destinations available for $rd
> \n");
> exit;
> }
> xlog("L_ERROR","UBICAR: AVP $avp(dsdstid)\n");
> xlog("L_INFO","UBICAR: Dispatching to Asterisk Box $du\n");
> t_set_fr(0,1);
> t_on_failure("MANAGE_FAILURE");
> route(RELAY);
> exit;
> #!endif
> }
>
> Also both Asterisk are responding to ping probes done by Kamailio, they
> are actually responding 404 but are still kept alive thanks to this param:
>
> modparam("dispatcher", "ds_ping_reply_codes", "class=2;code=480;code=404")
>
> and the command kamctl dispatcher dump shows them with flags=AP
>
> URI:: sip:192.168.10.191:5060 flags=AP priority=0
> attrs=duid=PBX2;my=pbx2;maxload=200
> URI:: sip:192.168.10.190:5060 flags=AP priority=0
> attrs=duid=PBX1;my=pbx1;maxload=200
>
> Also, i would like to know if there is a way to print some kind of table
> to see how kamailio are keeping these call loads recorded. I have been
> looking for it but i cannot find any way of doing it
>
> Again, thank you very much for your reply
>
>
> 2016-04-04 14:23 GMT-03:00 Alberto Sagredo <alberto.sagr...@avanzada7.com>
> :
>
>> Hi
>>
>> Are you using ds_select_dst("1", "10"); somewhere ?
>>
>> You have to check Asterisk is responding to OPTIONS as dispatcher
>> considered UP when 200 OK from Asterisk or SIP Gateway is received.. and
>> not if not received.
>>
>> I have used dispatcher but not with 10 option on algo...
>>
>> BR
>>
>>
>>
>>
>> 2016-04-04 8:07 GMT+02:00 TEG AMJG <tega...@gmail.com>:
>>
>>> Hi
>>>
>>> I am new to Kamailio and i am just trying to setup a kamailio (v4.2.3)
>>> dispatcher to distribute calls to 2 asterisk using the call load
>>> distribution algorithm (alg 10). I started to test and see how all it is
>>> working and in the logs appears that the call load record it cannot be
>>> found.
>>>
>>> - ERROR: dispatcher [dispatch.c:1416]: ds_load_remove(): cannot find
>>> load for (call id generated by asterisk)
>>>
>>> I am getting this error  trying a 2 call leg conversation when asterisk
>>> is creating the BYE message destinated to the callee after receiving a BYE
>>> message from the caller, and the BYE message by Asterisk reach Kamailio to
>>> then apply the ds_load_update function
>>>
>>> From what i understand about ds_load_update it is that it sets the load
>>> to an specific destination if Kamailio receives a 2xx reply of an INVITE
>>> message, and removes it if Kamailio receives a BYE message based from the
>>> Call-id received in that message, where it is actually failing in my
>>> implementation at the moment
>>>
>>> Here are the blocks of code of the dispatcher parameters and where the
>>> function ds_load_update() is being used:
>>> #!ifdef WITH_LOADBALANCE
>>>
>>> #Parameters using Dispatcher from DB
>>> # --
>>> modparam

Re: [SR-Users] dispatcher [dispatch.c:1416]: ds_load_remove(): cannot find load for (from asterisk call-id)

2016-04-04 Thread TEG AMJG
Hi Alberto, thanks for your reply

yeah, i am using ds_select_dst("0","10") in this case because i use setid=0
in the dispatcher table as you can see in this route block

route[TOASTERISK] {
#!ifdef WITH_LOADBALANCE
xlog("L_INFO","UBICAR: Forwarding non-registrar requests to
Asterisk \n");
 if(!ds_select_dst("0", "10")) {
sl_send_reply("500", "Service Unavailable");
xlog("L_ERROR","UBICAR: No destinations available for $rd
\n");
exit;
}
xlog("L_ERROR","UBICAR: AVP $avp(dsdstid)\n");
xlog("L_INFO","UBICAR: Dispatching to Asterisk Box $du\n");
t_set_fr(0,1);
t_on_failure("MANAGE_FAILURE");
route(RELAY);
exit;
#!endif
}

Also both Asterisk are responding to ping probes done by Kamailio, they are
actually responding 404 but are still kept alive thanks to this param:

modparam("dispatcher", "ds_ping_reply_codes", "class=2;code=480;code=404")

and the command kamctl dispatcher dump shows them with flags=AP

URI:: sip:192.168.10.191:5060 flags=AP priority=0
attrs=duid=PBX2;my=pbx2;maxload=200
URI:: sip:192.168.10.190:5060 flags=AP priority=0
attrs=duid=PBX1;my=pbx1;maxload=200

Also, i would like to know if there is a way to print some kind of table to
see how kamailio are keeping these call loads recorded. I have been looking
for it but i cannot find any way of doing it

Again, thank you very much for your reply


2016-04-04 14:23 GMT-03:00 Alberto Sagredo <alberto.sagr...@avanzada7.com>:

> Hi
>
> Are you using ds_select_dst("1", "10"); somewhere ?
>
> You have to check Asterisk is responding to OPTIONS as dispatcher
> considered UP when 200 OK from Asterisk or SIP Gateway is received.. and
> not if not received.
>
> I have used dispatcher but not with 10 option on algo...
>
> BR
>
>
>
>
> 2016-04-04 8:07 GMT+02:00 TEG AMJG <tega...@gmail.com>:
>
>> Hi
>>
>> I am new to Kamailio and i am just trying to setup a kamailio (v4.2.3)
>> dispatcher to distribute calls to 2 asterisk using the call load
>> distribution algorithm (alg 10). I started to test and see how all it is
>> working and in the logs appears that the call load record it cannot be
>> found.
>>
>> - ERROR: dispatcher [dispatch.c:1416]: ds_load_remove(): cannot find load
>> for (call id generated by asterisk)
>>
>> I am getting this error  trying a 2 call leg conversation when asterisk
>> is creating the BYE message destinated to the callee after receiving a BYE
>> message from the caller, and the BYE message by Asterisk reach Kamailio to
>> then apply the ds_load_update function
>>
>> From what i understand about ds_load_update it is that it sets the load
>> to an specific destination if Kamailio receives a 2xx reply of an INVITE
>> message, and removes it if Kamailio receives a BYE message based from the
>> Call-id received in that message, where it is actually failing in my
>> implementation at the moment
>>
>> Here are the blocks of code of the dispatcher parameters and where the
>> function ds_load_update() is being used:
>> #!ifdef WITH_LOADBALANCE
>>
>> #Parameters using Dispatcher from DB
>> # --
>> modparam("dispatcher", "db_url", DBURL)
>> modparam("dispatcher", "table_name", "dispatcher")
>> # --
>>
>> #Enabling failover mechanism
>> # ---
>> modparam("dispatcher", "flags", 2)
>> # ---
>>
>> #Setting dispatcher parameters in AVP
>> # ---
>> modparam("dispatcher", "dst_avp", "$avp(AVP_DST)")
>> modparam("dispatcher", "grp_avp", "$avp(AVP_GRP)")
>> modparam("dispatcher", "cnt_avp", "$avp(AVP_CNT)")
>> modparam("dispatcher", "dstid_avp", "$avp(dsdstid)")
>> # ---
>>
>> #Setting dispatcher result in PV variables
>> # ---
>> modparam("dispatcher", "attrs_pvname", "$var(attrs)")
>> # ---
>>
>>
>> #Enabling dispatcher algorithm according to call loads
>> # ---
>> modparam("dispatcher", "ds_hash_size",8)
>> modparam("dispatcher", "ds_hash_expire", 3600)
>> modparam("dispatcher", "ds_hash_initexpire", 60)
>> # ---
>>
>> # Setting parameters for probing d

[SR-Users] dispatcher [dispatch.c:1416]: ds_load_remove(): cannot find load for (from asterisk call-id)

2016-04-04 Thread TEG AMJG
Hi

I am new to Kamailio and i am just trying to setup a kamailio (v4.2.3)
dispatcher to distribute calls to 2 asterisk using the call load
distribution algorithm (alg 10). I started to test and see how all it is
working and in the logs appears that the call load record it cannot be
found.

- ERROR: dispatcher [dispatch.c:1416]: ds_load_remove(): cannot find load
for (call id generated by asterisk)

I am getting this error  trying a 2 call leg conversation when asterisk is
creating the BYE message destinated to the callee after receiving a BYE
message from the caller, and the BYE message by Asterisk reach Kamailio to
then apply the ds_load_update function

>From what i understand about ds_load_update it is that it sets the load to
an specific destination if Kamailio receives a 2xx reply of an INVITE
message, and removes it if Kamailio receives a BYE message based from the
Call-id received in that message, where it is actually failing in my
implementation at the moment

Here are the blocks of code of the dispatcher parameters and where the
function ds_load_update() is being used:
#!ifdef WITH_LOADBALANCE

#Parameters using Dispatcher from DB
# --
modparam("dispatcher", "db_url", DBURL)
modparam("dispatcher", "table_name", "dispatcher")
# --

#Enabling failover mechanism
# ---
modparam("dispatcher", "flags", 2)
# ---

#Setting dispatcher parameters in AVP
# ---
modparam("dispatcher", "dst_avp", "$avp(AVP_DST)")
modparam("dispatcher", "grp_avp", "$avp(AVP_GRP)")
modparam("dispatcher", "cnt_avp", "$avp(AVP_CNT)")
modparam("dispatcher", "dstid_avp", "$avp(dsdstid)")
# ---

#Setting dispatcher result in PV variables
# ---
modparam("dispatcher", "attrs_pvname", "$var(attrs)")
# ---


#Enabling dispatcher algorithm according to call loads
# ---
modparam("dispatcher", "ds_hash_size",8)
modparam("dispatcher", "ds_hash_expire", 3600)
modparam("dispatcher", "ds_hash_initexpire", 60)
# ---

# Setting parameters for probing dispatcher destinations
# ---
modparam("dispatcher", "ds_ping_interval", 20)
modparam("dispatcher", "ds_ping_from", "sip:kamailio1@")
modparam("dispatcher", "ds_probing_mode", 1)
modparam("dispatcher", "ds_probing_threshhold", 2)
modparam("dispatcher", "ds_ping_reply_codes", "class=2;code=480;code=404")
# ---

...
route[WITHINDLG] {
 if (has_totag()) {
  # sequential request withing a dialog should
  # take the path determined by record-routing

#!ifdef WITH_LOADBALANCE
if(is_method("BYE|CANCEL")){
xlog("L_ERROR","UBICAR BYE ds_load_update  requesturi=$ru
from=$fu method=$rm callid=$ci to=$tu reply=$mt rrcode=$rr rcode=$rs\n");
ds_load_update();
}
#!endif
...
}

...

onreply_route[MANAGE_REPLY] {
#!ifdef WITH_LOADBALANCE
if(is_method("INVITE")) {
if(status=~"2[0-9][0-9]") {
xlog("L_ERROR","UBICAR setting ds_load_update
 requesturi=$ru from=$fu method=$rm callid=$ci to=$tu reply=$mt rrcode=$rr
rcode=$rs");
ds_load_update();
}else if(status=~"[3-7][0-9][0-9]") {
ds_load_unset();
}
}
#!endif

if(status=~"[12][0-9][0-9]"){
route(NATMANAGE);
 }
}


This is what i am getting from logs after the 2 call legs conversation
completes:

kam1 /usr/sbin/kamailio[4082]: ERROR: