Re: [OpenSIPS-Users] Managing Concurrent Calls

2015-09-04 Thread Schneur Rosenberg
No, I created 2 tables, one has a record for each device and to what
account code they belong to, 2nd table lists every account code and how
many simultaneous calls they can make, then I just run a query to get
account code and maximum concurrent calls allowed for the account code  the
query obviously is a perfect candidate for memcaching because the info
rarely changes so I run cache_fetch before running the query.

This allows me to limit the channels on an account and not just on a single
device, for a virtual PRI setting.

Here is the simple query "select dev.username, ent.chLimit from
custom_deviceToEnterprise as dev, custom_enterpriseConcurrent as ent where
dev.username='$fU' and dev.enterprise=ent.enterprise;"

1st table

CREATE TABLE `custom_deviceToEnterprise` (

  `id` bigint(20) NOT NULL AUTO_INCREMENT,

  `username` varchar(50) NOT NULL,

  `enterprise` varchar(50) NOT NULL,

  PRIMARY KEY (`id`)

)

2nd table

CREATE TABLE `custom_enterpriseConcurrent` (

  `id` bigint(20) NOT NULL AUTO_INCREMENT,

  `enterprise` varchar(25) NOT NULL,

  `chLimit` varchar(5) NOT NULL,

  PRIMARY KEY (`id`)

)

▶ Show quoted text
On Sep 4, 2015 6:42 AM, "Bogdan-Andrei Iancu"  wrote:

> Hi Schneur,
>
> Do you originally load the limit from the subscriber table ?
>
> Best regards,
>
> Bogdan-Andrei Iancu
> OpenSIPS Founder and Developerhttp://www.opensips-solutions.com
>
> On 04.09.2015 12:36, Schneur Rosenberg wrote:
>
> I limit mine on account and I used memcache to store the limits because
> its not something that changes on a constant basis, so it only does a db
> query maximum once a hour per device.
> On Sep 4, 2015 4:52 AM, "Bogdan-Andrei Iancu"  wrote:
>
>> Hi Terrance,
>>
>> That check is not expensive as it is done in memory cache (the "address"
>> table is cached at startup).
>>
>> Regards,
>>
>> Bogdan-Andrei Iancu
>> OpenSIPS Founder and Developer
>> http://www.opensips-solutions.com
>>
>> On 03.09.2015 21:42, Terrance Devor wrote:
>>
>>> Lovely!
>>>
>>> For those that need to limit concurrent call on OpenSIPS, here is the
>>> solution:
>>>
>>> route[limit] {
>>> set_dlg_profile("ip","$si");
>>> get_profile_size("ip","$si","$var(calls)");
>>> check_address("0","$si","$sp","$proto","$avp(ctx)");
>>> xlog("$avp(ctx)\n");
>>> xlog("L_INFO","Customer IP $si has $var(calls) concurrent calls,
>>> and limit is 12\n");
>>>
>>> if($var(calls)>$avp(ctx)) {
>>> xlog("Customer IP $si exceeded number of calls
>>> $var(calls)/12\n");
>>> send_reply("486", "Busy here, channel limit exceeded.");
>>> exit;
>>> }
>>> }
>>>
>>> Bogdan, how expensive is
>>> `check_address("0","$si","$sp","$proto","$avp(ctx)")`?
>>>
>>> Terrance
>>>
>>>
>>
>> ___
>> Users mailing list
>> Users@lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>
>
> ___
> Users mailing 
> listUsers@lists.opensips.orghttp://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Measuring opensips performance

2015-09-04 Thread Ryan Mitchell
The performance of OpenSIPs core processing is very fast, even on older
hardware, and will extremely likely not be your bottleneck.

But in almost every project, there are databases to interact with, and
business logic to implement, and there are a number of ways to cause
bottlenecks with bad setups (e.g. slow connected service causing OpenSIPs
processes to block).

On Thu, Sep 3, 2015 at 11:32 AM, surya  wrote:

> We want to gather some performance metrics of opensips presence server but
> not able to start.
>
> Actually, I have never done performance testing. We want to get some
> metrics
> like CPU and RAM usage for opensips presence server we are using.
>
> I know there are some profiling tools present and I have used one too.
> Valgrind. But, I do not understand ho to use them with this. Also, I see
> that profilers do provide information about the time consumed by certain
> code blocks but we just need overall resource usage.
>
> I know this is a general question but I have tried to find answers but to
> no
> help. I would really appreciate any help.
>
> Thanks
>
>
>
> --
> View this message in context:
> http://opensips-open-sip-server.1449251.n2.nabble.com/Measuring-opensips-performance-tp7598849.html
> Sent from the OpenSIPS - Users mailing list archive at Nabble.com.
>
> ___
> Users mailing list
> Users@lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>



-- 
Ryan Mitchell 
Telecom Logic, LLC
+15035934551
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] core generated by opensips

2015-09-04 Thread Vlad Paiu

Hello,

As per our meeting today, please enable memory debugging on your server, 
and let me know when another crash happens, so I can take a look at the 
newly generated core file.


Regards,

Vlad Paiu
OpenSIPS Developer
http://www.opensips-solutions.com

On 03.09.2015 17:02, Vlad Paiu wrote:

Hello,

Can you replicate the crash on demand, or does it happen randomly ?
Would you be able to provide access to a server containing the core 
file and the OpenSIPS binary, in order to speed-up the debugging 
process ( avoid the ping pong on the mailing list ) ?


Regards,
Vlad Paiu
OpenSIPS Developer
http://www.opensips-solutions.com  
On 02.09.2015 18:47, Gupta, Rahul wrote:


Hi Bogdan, any update on this ?

*From:*Gupta, Rahul
*Sent:* Monday, August 31, 2015 4:42 PM
*To:* 'Bogdan-Andrei Iancu'; OpenSIPS users mailling list
*Subject:* RE: [OpenSIPS-Users] core generated by opensips

Hi Bogdan, following is the info you requested.

#0 0x7f2095572e2c in vfprintf () from /lib64/libc.so.6

#1 0x7f209560fed0 in __vsyslog_chk () from /lib64/libc.so.6

#2 0x7f2095610100 in syslog () from /lib64/libc.so.6

#3 0x004c4202 in tcp_read_req (con=0x7f2081a933c0, 
bytes_read=0x7ffc6bc97f0c) at tcp_read.c:597


#4 0x004c5908 in handle_io (fm=, idx=-1, 
event_type=) at tcp_read.c:1033


#5 0x004c8083 in io_wait_loop_epoll (unix_sock=optimized out>) at io_wait.h:845


#6 tcp_receive_loop (unix_sock=) at tcp_read.c:1141

#7 0x004b12e9 in tcp_init_children (chd_rank=out>, startup_done=0x0) at tcp_main.c:2389


#8 0x0043aebf in main_loop (argc=, 
argv=) at main.c:1011


#9 main (argc=, argv=) at 
main.c:1612


(gdb) f 3

#3 0x004c4202 in tcp_read_req (con=0x7f2081a933c0, 
bytes_read=0x7ffc6bc97f0c) at tcp_read.c:597


597 tcp_read.c: No such file or directory.

in tcp_read.c

(gdb) p con->con_req

$1 = (struct tcp_req *) 0x7f20931a97e0

(gdb) p ¤t_req

$2 = (struct tcp_req *) 0x82d720

(gdb) p req

$3 = (struct tcp_req *) 0x7f20931a97e0

(gdb) p *con

$4 = {s = 30, fd = 21, write_lock = 0, id = 19, rcv = {src_ip = {af = 
2, len = 4, u = {addrl = {2621885450, 0}, addr32 = {2621885450, 0, 0, 
0}, addr16 = {52234, 40006, 0, 0, 0, 0, 0, 0},


addr = "\n\314F\234", '\000' }}, dst_ip = 
{af = 2, len = 4, u = {addrl = {2588331018, 0}, addr32 = {2588331018, 
0, 0, 0}, addr16 = {52234, 39494, 0, 0, 0, 0, 0, 0},


addr = "\n\314F\232", '\000' }}, src_port = 
5060, dst_port = 5070, proto = 2, proto_reserved1 = 19, 
proto_reserved2 = 0, src_su = {s = {sa_family = 2,


sa_data = "\023\304\n\314F\234\000\000\000\000\000\000\000"}, 
sin = {sin_family = 2, sin_port = 50195, sin_addr = {s_addr = 
2621885450}, sin_zero = "\000\000\000\000\000\000\000"}},


bind_address = 0x7f2093171398}, refcnt = 2, type = PROTO_TCP, 
flags = 2, state = S_CONN_CONNECT, extra_data = 0x0, timeout = 50039, 
lifetime = 0, id_hash = 19, id_next = 0x0, id_prev = 0x0, c_next = 0x0,


  c_prev = 0x0, con_aliases = {{parent = 0x7f2081a933c0, next = 0x0, 
prev = 0x0, port = 5060, hash = 974}, {parent = 0x0, next = 0x0, prev 
= 0x0, port = 0, hash = 0}, {parent = 0x0, next = 0x0, prev = 0x0,


  port = 0, hash = 0}, {parent = 0x0, next = 0x0, prev = 0x0, 
port = 0, hash = 0}}, aliases = 1, con_req = 0x7f20931a97e0, 
msg_attempts = 1, async_chunks = 0x7f2081a93530, async_chunks_no = 0,


  oldest_chunk = 0}

(gdb)

*From:*Bogdan-Andrei Iancu [mailto:bog...@opensips.org]
*Sent:* Monday, August 31, 2015 4:39 PM
*To:* Gupta, Rahul; OpenSIPS users mailling list
*Subject:* Re: [OpenSIPS-Users] core generated by opensips

And printing :
*con

Thanks,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 31.08.2015 22:50, Gupta, Rahul wrote:

Hi Bogdan, following is the info you requested. This is not the
first tcp read, this server is been running for a while and
taking calls.

(gdb) bt

#0 0x7f2095572e2c in vfprintf () from /lib64/libc.so.6

#1 0x7f209560fed0 in __vsyslog_chk () from /lib64/libc.so.6

#2 0x7f2095610100 in syslog () from /lib64/libc.so.6

#3 0x004c4202 in tcp_read_req (con=0x7f2081a933c0,
bytes_read=0x7ffc6bc97f0c) at tcp_read.c:597

#4 0x004c5908 in handle_io (fm=,
idx=-1, event_type=) at tcp_read.c:1033

#5 0x004c8083 in io_wait_loop_epoll (unix_sock=) at io_wait.h:845

#6 tcp_receive_loop (unix_sock=) at
tcp_read.c:1141

#7 0x004b12e9 in tcp_init_children (chd_rank=, startup_done=0x0) at tcp_main.c:2389

#8 0x0043aebf in main_loop (argc=,
argv=) at main.c:1011

#9 main (argc=, argv=)
at main.c:1612

(gdb) f 3

#3 0x004c4202 in tcp_read_req (con=0x7f2081a933c0,
bytes_read=0x7ffc6bc97f0c) at tcp_read.c:597

597 tcp_read.c: No such file or directory.

in tcp_read.c

(gdb) p con->con_req

$1 = (struct tcp_req *) 0x7f20931a97e0

(gdb) p ¤t_req

$2 = (struct tcp_req *) 

Re: [OpenSIPS-Users] TLS discrepancy between 1.7.1 and 1.11.5

2015-09-04 Thread Bogdan-Andrei Iancu

Hi Matt,

You mean the force_send_socket() you do for the initial INVITE ? or ?

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 03.09.2015 17:19, Matt Hamilton wrote:



Hi Bogdan,

This issue is seems to be related to force_send_socket which behaves 
differently in 1.11 vs 1.7.  To make it work, I had to explicitly 
specify the port and and the proto (for force_send_socket) based on 
"transport=tls" statement and the direction of the traffic.


Matt



*From:* Bogdan-Andrei Iancu 
*Sent:* Monday, August 31, 2015 4:19 PM
*To:* OpenSIPS users mailling list; Matt Hamilton
*Subject:* Re: [OpenSIPS-Users] TLS discrepancy between 1.7.1 and 1.11.5
Hi Matt,

Indeed, the SIP messages do look ok.

Could you post the OpenSIPS logs (in debug 4) for processing the 
NOTIFY request ?


Regards,
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com
On 31.08.2015 20:07, Matt Hamilton wrote:


Hi Bogdan,


Pastebin link is http://pastebin.com/tM7zqTKX


I included both 1.7.1 and 1.11 captures. I don't see a difference 
between them other than 1.11 sending the NOTIFY to UAC unencrypted.


Btw, INVITEs seems to be behaving the same way as NOTIFY (don't have 
a capture for those - I assume the issue is the same).



Btw, TLS works fine between Opensips 1.11 and the phone (OK messages, 
etc. are encrypted).



Thanks,

Matt




Opensips TLS - Pastebin.com
Read more... 



*From:* Bogdan-Andrei Iancu 
*Sent:* Monday, August 31, 2015 5:21 AM
*To:* OpenSIPS users mailling list; mistral9...@hotmail.com
*Subject:* Re: [OpenSIPS-Users] TLS discrepancy between 1.7.1 and 1.11.5
Hi Matt,

Can you post of pastebin (or similar) the SIP capture showing the 
incoming NOTIFY (via UDP) from Asterisk and the outgoing NOTIFY 
(supposedly via TLS) to UAC ?
Also the SUBSCRIBE request going from OpenSIPS to Asterisk will help 
alot.


Regards,
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com
On 30.08.2015 18:22, Matt Hamilton wrote:




We use Opensips (with TLS) as a dispatcher to multiple Asterisk 
servers.  Currently we are in the process of upgrading from 1.7.1 to 
1.11.5, and we ran into a discrepancy between 1.7.1 and 1.11.5 
regarding SIP NOTIFY messages.



Here is the flow (both ways):

UAC(TLS) -> Opensips   (UDP)->   Asterisk
Asterisk  (UDP) -> Opensips (TLS)->UAC


In 1.7.1,  all messages between Opensips and UAC were encrypted - 
didn't matter if it was originated at UAC or Asterisk.


In 1.11.5, the SIP NOTIFY messages coming from Asterisk are sent to 
UAC unencrypted (and not accepted by UAC). Here is the request that 
Opensips receives and sends to the UAC in plaintext:


Request-Line: NOTIFY sip:101@1.2.3.4:5075;transport=tls;nat=yes SIP/2.0

Anything we can do to have that leg encrypted as well?

Thanks,
Matt



___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users




___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users




___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


[OpenSIPS-Users] Memory leak fifo process

2015-09-04 Thread Federico Edorna
Hi Team, I've found an issue when I reload regular expresion file for
opensips 1.11.5.

After executing a few "opensipsctl fifo regex_reload", the fifo process
runs out of pkmem. This is a small loop where I do a regex_reload and then
I print the pkmem for MI FIFO processs:

root@toro:~# sudo -u gc /home/gc/local/opensips/sbin/opensipsctl fifo ps |
grep "ID=4 "
Process::  ID=4 PID=11040 Type=MI FIFO
root@toro:~# while [ 1 -eq 1 ] ; do sudo -u gc
/home/gc/local/opensips/sbin/opensipsctl fifo regex_reload; sudo -u gc
/home/gc/local/opensips/sbin/opensipsctl fifo get_statistics pkmem: |grep
"pkmem:4-free_size::"  ; done
pkmem:4-free_size:: 3353184
pkmem:4-free_size:: 3353184
pkmem:4-free_size:: 3353184
pkmem:4-free_size:: 3353184
pkmem:4-free_size:: 3353184
pkmem:4-free_size:: 3353184
pkmem:4-free_size:: 3353184
pkmem:4-free_size:: 3353184
pkmem:4-free_size:: 3353184
pkmem:4-free_size:: 3353184
pkmem:4-free_size:: 3353184
pkmem:4-free_size:: 3353184
pkmem:4-free_size:: 3353184
pkmem:4-free_size:: 3353184
pkmem:4-free_size:: 1466776
pkmem:4-free_size:: 1466776
pkmem:4-free_size:: 1466776
pkmem:4-free_size:: 1466776
pkmem:4-free_size:: 1466776
pkmem:4-free_size:: 1466776
pkmem:4-free_size:: 1466776
pkmem:4-free_size:: 1466776
pkmem:4-free_size:: 1466776
pkmem:4-free_size:: 1466776
pkmem:4-free_size:: 140696
500 Server Internal Error
pkmem:4-free_size:: 140696
500 Server Internal Error
pkmem:4-free_size:: 140696
500 Server Internal Error
pkmem:4-free_size:: 140696
500 Server Internal Error
^C
root@toro:~#

For the following regex_reload commands the error in the syslog file is
this :

2015-09-04T11:56:05.645485-03:00 toro
/home/gc/local/opensips/sbin/opensips[11040]: ERROR:regex:load_pcres: no
more memory for patterns[11]
2015-09-04T11:56:05.645567-03:00 toro
/home/gc/local/opensips/sbin/opensips[11040]: ERROR:regex:mi_pcres_reload:
failed to reload pcres

The only way to recover from this is to restart opensips.

I've pasted the syslog (compiled with DBG_QM_MALLOC option) when the
command is succesfull: http://pastebin.com/VnMZrYrh


I tyied to increase the pkmem for the process, but sooner or later the
error came up

Thanks in advance!
Federico
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Managing Concurrent Calls

2015-09-04 Thread Terrance Devor
Thanks guys!

Schneur we do cache a number of checks address included however, since it's
cached to begin with, I would question needing to "cache the cache"?
If it was reading from dialog or subscriber that would be a different.

T
​
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Managing Concurrent Calls

2015-09-04 Thread Bogdan-Andrei Iancu

Hi Schneur,

Do you originally load the limit from the subscriber table ?

Best regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 04.09.2015 12:36, Schneur Rosenberg wrote:


I limit mine on account and I used memcache to store the limits 
because its not something that changes on a constant basis, so it only 
does a db query maximum once a hour per device.


On Sep 4, 2015 4:52 AM, "Bogdan-Andrei Iancu" > wrote:


Hi Terrance,

That check is not expensive as it is done in memory cache (the
"address" table is cached at startup).

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 03.09.2015 21:42, Terrance Devor wrote:

Lovely!

For those that need to limit concurrent call on OpenSIPS, here
is the solution:

route[limit] {
set_dlg_profile("ip","$si");
get_profile_size("ip","$si","$var(calls)");
check_address("0","$si","$sp","$proto","$avp(ctx)");
xlog("$avp(ctx)\n");
xlog("L_INFO","Customer IP $si has $var(calls)
concurrent calls, and limit is 12\n");

if($var(calls)>$avp(ctx)) {
xlog("Customer IP $si exceeded number of calls
$var(calls)/12\n");
send_reply("486", "Busy here, channel limit
exceeded.");
exit;
}
}

Bogdan, how expensive is
`check_address("0","$si","$sp","$proto","$avp(ctx)")`?

Terrance



___
Users mailing list
Users@lists.opensips.org 
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Managing Concurrent Calls

2015-09-04 Thread Schneur Rosenberg
I limit mine on account and I used memcache to store the limits because its
not something that changes on a constant basis, so it only does a db query
maximum once a hour per device.
On Sep 4, 2015 4:52 AM, "Bogdan-Andrei Iancu"  wrote:

> Hi Terrance,
>
> That check is not expensive as it is done in memory cache (the "address"
> table is cached at startup).
>
> Regards,
>
> Bogdan-Andrei Iancu
> OpenSIPS Founder and Developer
> http://www.opensips-solutions.com
>
> On 03.09.2015 21:42, Terrance Devor wrote:
>
>> Lovely!
>>
>> For those that need to limit concurrent call on OpenSIPS, here is the
>> solution:
>>
>> route[limit] {
>> set_dlg_profile("ip","$si");
>> get_profile_size("ip","$si","$var(calls)");
>> check_address("0","$si","$sp","$proto","$avp(ctx)");
>> xlog("$avp(ctx)\n");
>> xlog("L_INFO","Customer IP $si has $var(calls) concurrent calls,
>> and limit is 12\n");
>>
>> if($var(calls)>$avp(ctx)) {
>> xlog("Customer IP $si exceeded number of calls
>> $var(calls)/12\n");
>> send_reply("486", "Busy here, channel limit exceeded.");
>> exit;
>> }
>> }
>>
>> Bogdan, how expensive is
>> `check_address("0","$si","$sp","$proto","$avp(ctx)")`?
>>
>> Terrance
>>
>>
>
> ___
> Users mailing list
> Users@lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Managing Concurrent Calls

2015-09-04 Thread Bogdan-Andrei Iancu

Hi Terrance,

That check is not expensive as it is done in memory cache (the "address" 
table is cached at startup).


Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 03.09.2015 21:42, Terrance Devor wrote:

Lovely!

For those that need to limit concurrent call on OpenSIPS, here is the 
solution:


route[limit] {
set_dlg_profile("ip","$si");
get_profile_size("ip","$si","$var(calls)");
check_address("0","$si","$sp","$proto","$avp(ctx)");
xlog("$avp(ctx)\n");
xlog("L_INFO","Customer IP $si has $var(calls) concurrent 
calls, and limit is 12\n");


if($var(calls)>$avp(ctx)) {
xlog("Customer IP $si exceeded number of calls 
$var(calls)/12\n");

send_reply("486", "Busy here, channel limit exceeded.");
exit;
}
}

Bogdan, how expensive is 
`check_address("0","$si","$sp","$proto","$avp(ctx)")`?


Terrance




___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users