Re: [SR-Users] SIP over WebSockets

2017-05-02 Thread Nicolas Pace
On Tue, 2017-05-02 at 22:00 +0500, M. Salman wrote:
> Hi Nicolas,
> Looking at your logs and script lines, it seems you do not have
> websocket module installed.

Don't worry about the logs, those are old.Right now I got Kamailio with
MySQL working with pjsua and ekiga.
> First check your module directory, based on script you are using: htt
> ps://github.com/caruizdiaz/kamailio-ws/blob/master/modules.cfg#L42
> that you have websocket module in it or not, if not install it. 

websocket is installed and websocket.so is in the folder referenced in
the config.
> You can check you config by issuing command - kamailio -c to validate
> if the script file is alright or not.

Thanks, will use it
> > On Tue, May 2, 2017 at 9:43 PM, Nicolas Pace  wrote:
> > > Hi everyone,
> > > 
> > > As I shared with you before, We are working on a mobile app to
> > > connect the Community Cellular Networks (that uses 2G Cellular
> > > Networks) with the rest of the world via SIP, and we are
> > > considering using Kamailio for this.
> > > We choosed to build a Progresive Web App (PWA) through WebSockets
> > > to reduce the friction involved in using a new tool.
> > > 
> > > My question is, is there a reference config to use a web client
> > > through WebSockets?
> > > I don't have a clue on how to get from the stock config:
> > > https://gist.github.com/nicopace/9d44bf813fe309df69ff4cd0affe8324
> > > #file-_etc_kamailio_kamailio-conf
> > > to a fully functional WebSocket-enabled config.
> > > I've already read the WebSocket module documentation, but it is
> > > hard to understand as it assumes you already know how Kamailio
> > > works... too many moving parts :(
> > > 
> > > I tried with https://github.com/caruizdiaz/kamailio-ws but it is
> > > giving me some errors:
> > > 
> > > May 02 13:37:13 ubuntu kamailio[2329]: :  [cfg.y:3432]:
> > > yyerror_at(): parse error in config file
> > > /etc/kamailio/modules.cfg, line 48, column 12-25: failed to load
> > > module
> > > May 02 13:37:13 ubuntu kamailio[2329]: ERROR: 
> > > [cfg.y:3295]: yyparse(): cfg. parser: failed to find command
> > > ws_handle_handshake (params 0)
> > > May 02 13:37:13 ubuntu kamailio[2329]: :  [cfg.y:3435]:
> > > yyerror_at(): parse error in config file
> > > /etc/kamailio/kamailio.cfg, line 143, column 41: unknown command,
> > > missing loadmodule?
> > > 
> > > Which relates with:
> > > https://github.com/caruizdiaz/kamailio-ws/blob/master/modules.cfg
> > > #L48
> > > and
> > > https://github.com/caruizdiaz/kamailio-ws/blob/master/kamailio-ws
> > > .cfg#L143
> > > 
> > > What I'm trying to accomplish is to have a PWA that sends SIMPLE
> > > messages and CALLS to and from SIP Users (the 2G users are behind
> > > a FreeSwitch, so it could be done).
> > > 
> > > Just to give you some context, we will also add Push
> > > Notifications as 'ringing' or 'meesage recieved' alert, and that
> > > would be all (we also don't know how to do it).
> > > 
> > > Well... hope to hear from you guys!
> > > 
> > > Thanks!
> > > 
> > > 
> > > ___
> > > 
> > > Kamailio (SER) - Users Mailing List
> > > 
> > > sr-users@lists.kamailio.org
> > > 
> > > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
> > > 
> > > 
> > 
> > 
> > -- 
> > Regards
> > M. Salman
> > VoIP Professional
> > 
> > 
> 
> ___
> Kamailio (SER) - Users Mailing List
> sr-users@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

signature.asc
Description: This is a digitally signed message part
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] TCP read/write buffer size on per connection or per module basis

2017-05-02 Thread M S
OK. Thank you for detailed answer.

Let me discuss it internally and see what is best way to deal with it. If
possible I will try to write up a patch for per socket tcp buffer sizes and
submit it to you guys for inclusion in kamailio trunk.

Thank you.



On Tue, May 2, 2017 at 3:19 PM, Daniel-Constantin Mierla 
wrote:

> Hello,
>
>
> On 02.05.17 13:02, M S wrote:
> > Hi,
> >
> > I have a kamailio v4.4.5 deployment that serves TCP clients for SIP
> > and XCAP requests (without SIP presence). The kamailio's core TCP
> > parameters allow us to set TCP read and write buffer sizes which are
> > set globally for all TCP connections.
> >
> > However, i noticed that in general SIP over TCP request is much
> > smaller (<8KB for audio + video SIP INVITE request) then XCAP requests
> > (say to support up to 500 contacts we need TCP buffers =~ 64KB).
> >
> > So, if I set global TCP buffer size according to XCAP service needs
> > (e.g. 64KB), they waste too much RAM for SIP connections (assuming max
> > SIP packet is  8KB, there is 56KB buffer space wasted per connection).
> >
> > On the other hand, if i set global TCP buffer sizes to SIP service
> > needs (e.g. 8KB) then it is insufficient for XCAP (only 70-80 contacts
> > would fix in XCAP list).
> >
> > Therefore, i am looking for a way to allow TCP buffer size settings
> > per connection OR per module basis. Is it possible? If so then how?
> at this moment is not possible to set the buffer size per connection.
> The connection structure is created before knowing what is going to be
> received on it.
>
> Also, not per module, because the module is agnostic of the transport
> layer.
>
> An enhancement might be to specify it per socket, so when listening on
> port 5060, then use a specific buffer size and when listening on another
> port like 8060, use a different buffer size. But this requires C coding.
>
> On the other hand, the latest kernels use the physical memory only when
> writing. So if one allocates 2GB and uses only 10MB, only 10MB are used
> from the physical memory, the rest is just virtual memory.
>
> Cheers,
> Daniel
>
> --
> Daniel-Constantin Mierla
> www.twitter.com/miconda -- www.linkedin.com/in/miconda
> Kamailio Advanced Training - May 22-24 (USA) - www.asipto.com
> Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com
>
>
> ___
> Kamailio (SER) - Users Mailing List
> sr-users@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Retrieving the custom header parameter value from contact header

2017-05-02 Thread Daniel-Constantin Mierla
Hello,

be careful with using param transformation directly not to have a
conflict of parameter name between URI parameters and header parameters.

It may be safer to chain the tobody and param transformations to be sure
you access the right part of the header.

Cheers,
Daniel


On 02.05.17 09:02, vi...@advaitamtech.com wrote:
>
> I used " $(ct{param.value,tgrp});". It worked. Thanks for the input.
>
>  
>
> - Vivek.
>
>  
>
> -Original Message-
> From: "Juha Heinanen" 
> Sent: Monday, 1 May, 2017 6:15pm
> To: "Kamailio (SER) - Users Mailing List" 
> Subject: [SR-Users] Retrieving the custom header parameter value from
> contact header
>
> vi...@advaitamtech.com writes:
>
> > Tried using @hf_value.contact.p.tgrp . But it is giving me complete
> > contact header.
> > I want only "tgrp" paramter value "tg_0615_prsw1". Anyone , any
> > sugeestions?
>
> Try {uri.param,name} transformation.
>
> -- Juha
>
> ___
> Kamailio (SER) - Users Mailing List
> sr-users@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
>
>
> ___
> Kamailio (SER) - Users Mailing List
> sr-users@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - May 22-24 (USA) - www.asipto.com
Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] TCP read/write buffer size on per connection or per module basis

2017-05-02 Thread Daniel-Constantin Mierla
Hello,


On 02.05.17 13:02, M S wrote:
> Hi,
>
> I have a kamailio v4.4.5 deployment that serves TCP clients for SIP
> and XCAP requests (without SIP presence). The kamailio's core TCP
> parameters allow us to set TCP read and write buffer sizes which are
> set globally for all TCP connections.
>
> However, i noticed that in general SIP over TCP request is much
> smaller (<8KB for audio + video SIP INVITE request) then XCAP requests
> (say to support up to 500 contacts we need TCP buffers =~ 64KB). 
>
> So, if I set global TCP buffer size according to XCAP service needs
> (e.g. 64KB), they waste too much RAM for SIP connections (assuming max
> SIP packet is  8KB, there is 56KB buffer space wasted per connection).
>
> On the other hand, if i set global TCP buffer sizes to SIP service
> needs (e.g. 8KB) then it is insufficient for XCAP (only 70-80 contacts
> would fix in XCAP list).
>
> Therefore, i am looking for a way to allow TCP buffer size settings
> per connection OR per module basis. Is it possible? If so then how?
at this moment is not possible to set the buffer size per connection.
The connection structure is created before knowing what is going to be
received on it.

Also, not per module, because the module is agnostic of the transport layer.

An enhancement might be to specify it per socket, so when listening on
port 5060, then use a specific buffer size and when listening on another
port like 8060, use a different buffer size. But this requires C coding.

On the other hand, the latest kernels use the physical memory only when
writing. So if one allocates 2GB and uses only 10MB, only 10MB are used
from the physical memory, the rest is just virtual memory.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - May 22-24 (USA) - www.asipto.com
Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com


___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] TCP read/write buffer size on per connection or per module basis

2017-05-02 Thread M S
Hi,

I have a kamailio v4.4.5 deployment that serves TCP clients for SIP and
XCAP requests (without SIP presence). The kamailio's core TCP parameters
allow us to set TCP read and write buffer sizes which are set globally for
all TCP connections.

However, i noticed that in general SIP over TCP request is much smaller
(<8KB for audio + video SIP INVITE request) then XCAP requests (say to
support up to 500 contacts we need TCP buffers =~ 64KB).

So, if I set global TCP buffer size according to XCAP service needs (e.g.
64KB), they waste too much RAM for SIP connections (assuming max SIP packet
is  8KB, there is 56KB buffer space wasted per connection).

On the other hand, if i set global TCP buffer sizes to SIP service needs
(e.g. 8KB) then it is insufficient for XCAP (only 70-80 contacts would fix
in XCAP list).

Therefore, i am looking for a way to allow TCP buffer size settings per
connection OR per module basis. Is it possible? If so then how?

Thank you.
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Memory leak when reloading htable using db_cluster

2017-05-02 Thread Daniel-Constantin Mierla
Hello,

ok, thanks, I will review and merge.

To clarify, this is no longer related to reloading one or more tables,
right? And is it specific for usage with db_cluster or not?

Cheers, Daniel


On 02.05.17 08:06, Kristian F. Høgh wrote:
>
> Hi
>
>  
>
> The leak is only when reloading an empty htable.
>
> I created a pull request (https://github.com/kamailio/kamailio/pull/1110)
>
>  
>
> Regards,
>
> Kristian.
>
>  
>
> On Friday, April 28, 2017 1:56:51 PM CEST Kristian F. Høgh wrote:
>
> > Hi,
>
> >
>
> > I did some more testing.
>
> >
>
> > reloading address and domain is fixed in master
> (08f8e0bc72b9f16f76b78110c9c95b1ba7f1ce25)
>
> > If I only have one htable, I can reload many times without memory
> leak. (The content i database is unchanged)
>
> > If I have 2 htables and keep reloading both, kamailio leaks as
> below. (The content i database is unchanged)
>
> >
>
> > Regards,
>
> > Kristian.
>
> >
>
> >
>
> > On Friday, April 28, 2017 11:20:29 AM CEST Kristian F. Høgh wrote:
>
> > > Hi Daniel.
>
> > >
>
> > > Thanks alot.
>
> > > It fixed the problem at my testbed.
>
> > > In production i reload several htables + address and domain, so I
> updated my config.
>
> > >
>
> > > 16(31430) ALERT: qm_status: 1700. N address=0x7f9bf03905e8
> frag=0x7f9bf03905b0 size=64 used=1
>
> > > 16(31430) ALERT: qm_status: alloc'd from db_mysql: km_res.c:
> db_mysql_get_columns(77)
>
> > > 16(31430) ALERT: qm_status: start check=f0f0f0f0, end check=
> c0c0c0c0, abcdefed
>
> > > 16(31430) ALERT: qm_status: 1701. N address=0x7f9bf0390690
> frag=0x7f9bf0390658 size=64 used=1
>
> > > 16(31430) ALERT: qm_status: alloc'd from core: db_res.c:
> db_allocate_columns(150)
>
> > > 16(31430) ALERT: qm_status: start check=f0f0f0f0, end check=
> c0c0c0c0, abcdefed
>
> > > 16(31430) ALERT: qm_status: 1702. N address=0x7f9bf0390738
> frag=0x7f9bf0390700 size=64 used=1
>
> > > 16(31430) ALERT: qm_status: alloc'd from core: db_res.c:
> db_allocate_columns(160)
>
> > > 16(31430) ALERT: qm_status: start check=f0f0f0f0, end check=
> c0c0c0c0, abcdefed
>
> > > 16(31430) ALERT: qm_status: 1703. N address=0x7f9bf03907e0
> frag=0x7f9bf03907a8 size=64 used=1
>
> > > 16(31430) ALERT: qm_status: alloc'd from core: db_res.c:
> db_new_result(114)
>
> > > 16(31430) ALERT: qm_status: start check=f0f0f0f0, end check=
> c0c0c0c0, abcdefed
>
> > > 16(31430) ALERT: qm_status: 1706. N address=0x7f9bf0390a58
> frag=0x7f9bf0390a20 size=64 used=1
>
> > > 16(31430) ALERT: qm_status: alloc'd from db_mysql: km_res.c:
> db_mysql_new_result(236)
>
> > >
>
> > > Regards,
>
> > > Kristian.
>
> > >
>
> > > On Friday, April 28, 2017 9:38:25 AM CEST Daniel-Constantin Mierla
> wrote:
>
> > > > Hello,
>
> > > >
>
> > > > can you fetch the master and try again -- I just pushed some fixes.
>
> > > >
>
> > > > Cheers,
>
> > > > Daniel
>
> > > >
>
> > > >
>
> > > > On 28.04.17 08:17, Kristian F. Høgh wrote:
>
> > > > > Hi list,
>
> > > > >
>
> > > > > I use current git master.
>
> > > > > When I reload a htable using "kamcmd htable.reload htable1",
> the "ctl handler" process leaks 384 bytes of pkg memory
>
> > > > > If I use a direct mysql connection without db_cluster, the is
> no memory leak
>
> > > > >
>
> > > > > modparam("db_cluster", "connection",
> "con1=>mysql://user:p...@ip.addr/database")
>
> > > > > modparam("db_cluster", "connection",
> "con2=>mysql://user:pass@ip.addr2/database")
>
> > > > > modparam("db_cluster", "cluster", "cls1=>con1=9s9s;con2=8s8s")
>
> > > > >
>
> > > > > modparam("htable", "db_url", "cluster://cls1")
>
> > > > > # modparam("htable", "db_url",
> "mysql://user:p...@ip.addr/database"
>
> > > > > modparam("htable", "htable",
> "htable1=>size=8;autoexpire=0;dbtable=htable1;")
>
> > > > >
>
> > > > > 16(10429) ALERT: qm_status: 6513. N address=0x7f4e65e01720
> frag=0x7f4e65e016e8 size=128 used=1
>
> > > > > 16(10429) ALERT: qm_status: alloc'd from db_cluster:
> dbcl_api.c: db_cluster_init(294)
>
> > > > > 16(10429) ALERT: qm_status: start check=f0f0f0f0, end check=
> c0c0c0c0, abcdefed
>
> > > > > 16(10429) ALERT: qm_status: 6514. N address=0x7f4e65e01808
> frag=0x7f4e65e017d0 size=128 used=1
>
> > > > > 16(10429) ALERT: qm_status: alloc'd from core: db.c:
> db_do_init2(298)
>
> > > > > 16(10429) ALERT: qm_status: start check=f0f0f0f0, end check=
> c0c0c0c0, abcdefed
>
> > > > > 16(10429) ALERT: qm_status: 6515. N address=0x7f4e65e018f0
> frag=0x7f4e65e018b8 size=128 used=1
>
> > > > > 16(10429) ALERT: qm_status: alloc'd from core: db.c:
> db_do_init2(298)
>
> > > > > 16(10429) ALERT: qm_status: start check=f0f0f0f0, end check=
> c0c0c0c0, abcdefed
>
> > > > >
>
> > > > > Regards,
>
> > > > > Kristian Høgh
>
> > > > > Uni-tel A/S
>
> > > > >
>
> > > > >
>
> > > > >
>
> > > > > ___
>
> > > > > Kamailio (SER) - Users Mailing List
>
> > > > > sr-users@lists.kamailio.org
>
> > > > > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
> > > >
>
> > > >
>
> > >
>
> > >
>
> > > 

Re: [SR-Users] Memory leak when reloading htable using db_cluster

2017-05-02 Thread Kristian F . Høgh
Hi

The leak is only when reloading an empty htable.
I created a pull request (https://github.com/kamailio/kamailio/pull/1110)

Regards,
Kristian.

On Friday, April 28, 2017 1:56:51 PM CEST Kristian F. Høgh wrote:
> Hi,
> 
> I did some more testing.
> 
> reloading address and domain is fixed in master 
> (08f8e0bc72b9f16f76b78110c9c95b1ba7f1ce25)
> If I only have one htable, I can reload many times without memory leak. (The 
> content i database is unchanged)
> If I have 2 htables and keep reloading both, kamailio leaks as below. (The 
> content i database is unchanged)
> 
> Regards,
> Kristian.
> 
> 
> On Friday, April 28, 2017 11:20:29 AM CEST Kristian F. Høgh wrote:
> > Hi Daniel.
> > 
> > Thanks alot.
> > It fixed the problem at my testbed.
> > In production i reload several htables + address and domain, so I updated 
> > my config.
> > 
> > 16(31430) ALERT: qm_status:1700. N  address=0x7f9bf03905e8 
> > frag=0x7f9bf03905b0 size=64 used=1
> > 16(31430) ALERT: qm_status:   alloc'd from db_mysql: km_res.c: 
> > db_mysql_get_columns(77)
> > 16(31430) ALERT: qm_status:  start check=f0f0f0f0, end check= 
> > c0c0c0c0, abcdefed
> > 16(31430) ALERT: qm_status:1701. N  address=0x7f9bf0390690 
> > frag=0x7f9bf0390658 size=64 used=1
> > 16(31430) ALERT: qm_status:   alloc'd from core: db_res.c: 
> > db_allocate_columns(150)
> > 16(31430) ALERT: qm_status:  start check=f0f0f0f0, end check= 
> > c0c0c0c0, abcdefed
> > 16(31430) ALERT: qm_status:1702. N  address=0x7f9bf0390738 
> > frag=0x7f9bf0390700 size=64 used=1
> > 16(31430) ALERT: qm_status:   alloc'd from core: db_res.c: 
> > db_allocate_columns(160)
> > 16(31430) ALERT: qm_status:  start check=f0f0f0f0, end check= 
> > c0c0c0c0, abcdefed
> > 16(31430) ALERT: qm_status:1703. N  address=0x7f9bf03907e0 
> > frag=0x7f9bf03907a8 size=64 used=1
> > 16(31430) ALERT: qm_status:   alloc'd from core: db_res.c: 
> > db_new_result(114)
> > 16(31430) ALERT: qm_status:  start check=f0f0f0f0, end check= 
> > c0c0c0c0, abcdefed
> > 16(31430) ALERT: qm_status:1706. N  address=0x7f9bf0390a58 
> > frag=0x7f9bf0390a20 size=64 used=1
> > 16(31430) ALERT: qm_status:   alloc'd from db_mysql: km_res.c: 
> > db_mysql_new_result(236)
> > 
> > Regards,
> > Kristian.
> > 
> > On Friday, April 28, 2017 9:38:25 AM CEST Daniel-Constantin Mierla wrote:
> > > Hello,
> > > 
> > > can you fetch the master and try again -- I just pushed some fixes.
> > > 
> > > Cheers,
> > > Daniel
> > > 
> > > 
> > > On 28.04.17 08:17, Kristian F. Høgh wrote:
> > > > Hi list,
> > > >
> > > > I use current git master.
> > > > When I reload a htable using "kamcmd htable.reload htable1", the "ctl 
> > > > handler" process leaks 384 bytes of pkg memory
> > > > If I use a direct mysql connection without db_cluster, the is no memory 
> > > > leak
> > > >
> > > > modparam("db_cluster", "connection", 
> > > > "con1=>mysql://user:p...@ip.addr/database")
> > > > modparam("db_cluster", "connection", 
> > > > "con2=>mysql://user:pass@ip.addr2/database")
> > > > modparam("db_cluster", "cluster", "cls1=>con1=9s9s;con2=8s8s")
> > > >
> > > > modparam("htable", "db_url", "cluster://cls1")
> > > > # modparam("htable", "db_url", "mysql://user:p...@ip.addr/database"
> > > > modparam("htable", "htable", 
> > > > "htable1=>size=8;autoexpire=0;dbtable=htable1;")
> > > >
> > > > 16(10429) ALERT: qm_status:6513. N  address=0x7f4e65e01720 
> > > > frag=0x7f4e65e016e8 size=128 used=1
> > > > 16(10429) ALERT: qm_status:   alloc'd from db_cluster: 
> > > > dbcl_api.c: db_cluster_init(294)
> > > > 16(10429) ALERT: qm_status:  start check=f0f0f0f0, end check= 
> > > > c0c0c0c0, abcdefed
> > > > 16(10429) ALERT: qm_status:6514. N  address=0x7f4e65e01808 
> > > > frag=0x7f4e65e017d0 size=128 used=1
> > > > 16(10429) ALERT: qm_status:   alloc'd from core: db.c: 
> > > > db_do_init2(298)
> > > > 16(10429) ALERT: qm_status:  start check=f0f0f0f0, end check= 
> > > > c0c0c0c0, abcdefed
> > > > 16(10429) ALERT: qm_status:6515. N  address=0x7f4e65e018f0 
> > > > frag=0x7f4e65e018b8 size=128 used=1
> > > > 16(10429) ALERT: qm_status:   alloc'd from core: db.c: 
> > > > db_do_init2(298)
> > > > 16(10429) ALERT: qm_status:  start check=f0f0f0f0, end check= 
> > > > c0c0c0c0, abcdefed
> > > >
> > > > Regards,
> > > > Kristian Høgh
> > > > Uni-tel A/S
> > > >
> > > >  
> > > >
> > > > ___
> > > > Kamailio (SER) - Users Mailing List
> > > > sr-users@lists.kamailio.org
> > > > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
> > > 
> > > 
> > 
> > 
> > ___
> > Kamailio (SER) - Users Mailing List
> > sr-users@lists.kamailio.org
> > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
> 
> ___
> Kamailio (SER) - Users Mailing List
>