[OpenSIPS-Users] [NEW]memcached implementation for memory caching

2009-07-15 Thread andrei dragus


Hello,

A new module that provides a new caching method using memcached servers was 
added.
It provides a way to access memcached servers using the existing memcache API.

Advantages over the existing "localcache" module:
- memory costs are no longer on the server
- many servers may be used so the memory is virtually unlimited
- the cache is persistent so a restart of the server will not affect 
the cache
- memcached is an open-source project so it can be used to exchange 
data with various other applications
- servers may be grouped together (e.g. for security purposes : some 
can be inside a private network, some can be in a public one).
  
Limitations:
- keys (in key:value pairs) may not contain spaces or control characters

Requirements:
- libmemcahed is a dependency of the module ( see docs)
- memcached servers must exist somewhere accessible via the network.

Usage:
- memcached module must be loaded
- server parameters must be set
E.g:

...
modparam("memcached", "server","group1 = localhost:,127.0.0.1" );
modparam("memcached", "server","y = random_url:" );
...
This creates two groups of servers( one called "group1" and one called 
"y").


- Calls to the two groups will be done via the memcache API by passing 
the first parameter as "memcached_($GROUP_NAME)".
E.g:

...
cache_store("memcached_group1","key","$ru value");
... 
This stores "key"="$ru value" on the group denoted by "group1".
The key is only stored on one of the servers in a consistent fashion
(subsequent calls with "key" will be stored, deleted from the same server).


...
cache_fetch("memcached_y","key",$avp(i:10));
cache_remove("memcached_y","key");
...
This attempts to fetch/remove key from the group named "y".

Thanks, Andrei.




  

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


[OpenSIPS-Users] Fw: Re: [NEW]memcached implementation for memory caching

2009-07-15 Thread andrei dragus



 Hi, Richard.

 Yes.
 
 As long as the server (ip and port) is the same, keys are
 visible from all opensips distribution accessing that
 cache.
 
 Careful! In some cases this may be unwanted behavior.
 
 Also if you use a group of servers you don't have complete
 control over which keys go on which servers, but if you use
 the same groups on all opensips servers it is guaranteed
 that they are distributed in the same way, so again they are
 visible from all servers.
 
 Andrei.
 
 --- On Wed, 7/15/09, Richard Revels 
 wrote:
 
 
 > Andrei,
 > 
 > I'll read the documentation shortly but I wonder if
 you
 > could give me  
 > a quick booster here.  Does this module allow for
 two
 > or more opensips  
 > proxies to access the same memory cached data on the
 > distributed cache?
 > 
 > Richard Revels
 > 
 > 



  

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


Re: [OpenSIPS-Users] codec manipulation feature

2009-07-22 Thread andrei dragus


Hi Jeff,

This is Andrei. I am currently working on this right now. It should be finished 
in a couple of days if nothing comes up.

Andrei.

--- On Wed, 7/22/09, Jeff Pyle  wrote:


> Just curious if you had a chance to see what the status is
> of this SDP
> manipulation code.
>
>
> Thanks,
> Jeff
>
>
>
> On 6/15/09 6:36 PM, "Bogdan-Andrei Iancu" 
> wrote:
>
> > Hi Jeff,
> >
> > I have some code from last year - let me check it out
> and see what is
> > the status.
> >
> > Regards,
> > Bogdan
> >
> > Jeff Pyle wrote:
> >> Hi Bogdan,
> >>
> >> It¹s been a little while since we talked about
> this. I was wondering
> >> if there was anything in the works to detect
> and/or manipulate the
> >> codecs present in an SDP.
> >>
> >>
> >>
> >> - Jeff
> >>
> >>
> >>
> >> On 2/1/09 4:08 AM, "Steve Kurzeja" 
> wrote:
> >>
> >> This idea is quite
> standard in SBCs, typically called codec
> >> profiles, where you permit
> only certain codecs to be passed
> >> through the SBC in an
> INVITE and all the rest are stripped out.
> >>
> >> We use it to get around
> interop issues with certain codecs. E.g.
> >> we have some end
> devices/customers that have issues using g729a so
> >> we choose to remove this
> codec for these specific endpoints.
> >>
> >> The poor man's method to
> implementing this is just doing header
> >> manipulations in the SDP
> but it would be nice to be standardized.
> >>
> >> Regards,
> >> Steve
> >>
> >>
> >> On Fri, Jan 30, 2009 at
> 2:20 AM, Jeff Pyle
> >> 
> wrote:
> >>
> >> Hi Bogdan,
> >>
> >> I'm looking
> for the ability to selectively remove codec
> >> 
>advertisements from
> >> the SDP. For
> example, if my customer sends a call to me for PSTN
> >> termination
> he may advertise G711 and G729, with G711
> >> preferred.
> By looking
> >> at the
> number of existing dialogs I may know that he's running
> >> low on
> >> bandwidth,
> so I would like to suppress the G711 advertisement
> >> ultimately
> >> causing a
> 200 OK from the carrier with G729.
> >>
> >> Generically,
> in this application we're looking only to
> >> suppress
> G711 at
> >> certain
> times.
> >>
> >> I understand
> normally codec selection is done completely by
> >> the gateway
> >> device.
> However, my gateway devices aren't smart enough to
> >> take
> bandwidth
> >> utilization
> into consideration when choosing which codecs to
> >> advertise.
> I'm
> >> hoping my
> proxy might be. :)
> >>
> >> Does that
> make sense?
> >>
> >>
> >>
> >> - Jeff
> >>
> >>
> >>
> >> On 1/29/09
> 5:04 AM, "Bogdan-Andrei Iancu"
> >> 
> wrote:
> >>
> >>> Hi Jeff,
> >>>
> >>> right now there is only available some
> functionality to check
> >> the codecs
> >>> (to see what codecs are advertised in the
> SDP)... What
> >> exactly are
> you
> >>> looking for (like codec ops) ?
> >>>
> >>> Regards,
> >>> Bogdan
> >>>
> >>> Jeff Pyle wrote:
>  Bogdan,
> 
>  Some months back you mentioned an upcoming
> feature that
> >> would allow
>  Opensips to manipulate the codecs present
> in the SDP. Just
> >> wondering
>  if there is anything available to test
> yet. This feature, in
>  combination with dialog contexts, will be
> of great use to us
> >> to allow
>  us to take a guess at the bandwidth
> consumption for a particular
>  customer and force the use of a compressed
> codec if necessary.
> 
> 
>  Thanks,
>  Jeff
> >>>
>
>
> ___
> 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] codec manipulation feature

2009-07-22 Thread andrei dragus

Yes.

--- On Wed, 7/22/09, Ovidiu Sas  wrote:

> From: Ovidiu Sas 

> Hello Andrei,
> 
> Are you using the core sdp parser implementation?
> 
> Ovidiu
> 
> On Wed, Jul 22, 2009 at 8:59 AM, andrei dragus
> wrote:
> >
> >
> > Hi Jeff,
> >
> > This is Andrei. I am currently working on this right
> now. It should be finished in a couple of days if nothing
> comes up.
> >
> > Andrei.
> >
> > --- On Wed, 7/22/09, Jeff Pyle 
> wrote:
> >
> >
> >> Just curious if you had a chance to see what the
> status is
> >> of this SDP
> >> manipulation code.
> >>
> >>
> >> Thanks,
> >> Jeff
> >>
> >>
> >>
> >> On 6/15/09 6:36 PM, "Bogdan-Andrei Iancu" 
> >> wrote:
> >>
> >> > Hi Jeff,
> >> >
> >> > I have some code from last year - let me
> check it out
> >> and see what is
> >> > the status.
> >> >
> >> > Regards,
> >> > Bogdan
> >> >
> >> > Jeff Pyle wrote:
> >> >> Hi Bogdan,
> >> >>
> >> >> It¹s been a little while since we talked
> about
> >> this. I was wondering
> >> >> if there was anything in the works to
> detect
> >> and/or manipulate the
> >> >> codecs present in an SDP.
> >> >>
> >> >>
> >> >>
> >> >> - Jeff
> >> >>
> >> >>
> >> >>
> >> >> On 2/1/09 4:08 AM, "Steve Kurzeja" 
> >> wrote:
> >> >>
> >> >>     This idea is quite
> >> standard in SBCs, typically called codec
> >> >>     profiles, where you permit
> >> only certain codecs to be passed
> >> >>     through the SBC in an
> >> INVITE and all the rest are stripped out.
> >> >>
> >> >>     We use it to get around
> >> interop issues with certain codecs. E.g.
> >> >>     we have some end
> >> devices/customers that have issues using g729a so
> >> >>     we choose to remove this
> >> codec for these specific endpoints.
> >> >>
> >> >>     The poor man's method to
> >> implementing this is just doing header
> >> >>     manipulations in the SDP
> >> but it would be nice to be standardized.
> >> >>
> >> >>     Regards,
> >> >>     Steve
> >> >>
> >> >>
> >> >>     On Fri, Jan 30, 2009 at
> >> 2:20 AM, Jeff Pyle
> >> >>     
> >> wrote:
> >> >>
> >> >>         Hi Bogdan,
> >> >>
> >> >>         I'm looking
> >> for the ability to selectively remove codec
> >> >>
> >>    advertisements from
> >> >>         the SDP. For
> >> example, if my customer sends a call to me for
> PSTN
> >> >>         termination
> >> he may advertise G711 and G729, with G711
> >> >>         preferred.
> >> By looking
> >> >>         at the
> >> number of existing dialogs I may know that he's
> running
> >> >>         low on
> >> >>         bandwidth,
> >> so I would like to suppress the G711
> advertisement
> >> >>         ultimately
> >> >>         causing a
> >> 200 OK from the carrier with G729.
> >> >>
> >> >>         Generically,
> >> in this application we're looking only to
> >> >>         suppress
> >> G711 at
> >> >>         certain
> >> times.
> >> >>
> >> >>         I understand
> >> normally codec selection is done completely by
> >> >>         the gateway
> >> >>         device.
> >> However, my gateway devices aren't smart enough
> to
> >> >>         take
> >> bandwidth
> >> >>         utilization
> >> into consideration when choosing which codecs to
> >> >>         advertise.
> >> I'm
> >> >>         hoping my
> >> proxy might be. :)
> >> >>
> >> >>         Does that
> >> make sense?
> >> >>
> >> >>
> >> >>
> >> >>         - Jeff
> >> >>
> >> >>
> >> >>
> >> >>         On 1/29/09
> >> 5:04 AM, "Bogdan-Andrei Iancu"
> >> >>         
> >> wrote:
> >> >>
> >> >>> Hi Jeff,
> >> >>>
> >> >>> right now there is only available
> some
> >> functionality to check
> >> >>         the codecs
> >> >>> (to see what codecs are advertised in
> the
> >> SDP)... What
> >> >>         exactly are
> >> you
> >> >>> looking for (like codec ops) ?
> >> >>>
> >> >>> Regards,
> >> >>> Bogdan
> >> >>>
> >> >>> Jeff Pyle wrote:
> >> >>>> Bogdan,
> >> >>>>
> >> >>>> Some months back you mentioned an
> upcoming
> >> feature that
> >> >>         would allow
> >> >>>> Opensips to manipulate the codecs
> present
> >> in the SDP. Just
> >> >>         wondering
> >> >>>> if there is anything available to
> test
> >> yet. This feature, in
> >> >>>> combination with dialog contexts,
> will be
> >> of great use to us
> >> >>         to allow
> >> >>>> us to take a guess at the
> bandwidth
> >> consumption for a particular
> >> >>>> customer and force the use of a
> compressed
> >> codec if necessary.
> >> >>>>
> >> >>>>
> >> >>>> Thanks,
> >> >>>> Jeff
> >> >>>
> >>
> >>
> >> ___
> >> 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] [NEW] SDP codec manipulation feature

2009-07-23 Thread andrei dragus

Hello,

Methods have been added for SDP codec manipulation in the textops module.
Please update your module if you wish to use them.

There are 4 methods:
  codec_exists(name[,clock]); //test if a codec exists
  codec_delete(name[,clock]); //delete a codec
  codec_move_up(name[,clock]); //move a codec to the front of the list
  codec_move_down(name[,clock]);//move a codec to the back of the list

Each of them can take a codec name and an optional clock parameter. If the 
clock is unspecified all of the codecs with that name will match.

All of the methods will act on all streams from all sessions inside the SDP.

You can use these methods one after another to get a desired effect.
E.g. To make GSM the least prefered codec but GSM/8000 the most prefered of all 
GSM codecs use:

codec_move_up("GSM","8000");
codec_move_down("GSM");

Once a codec was deleted it will not be detected by codec_exists().

Feel free to test these methods and please report any bugs you may find.

Thanks,
Andrei.





  

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


Re: [OpenSIPS-Users] Problem with codec_move_up

2010-08-05 Thread Andrei Dragus
Hi,

The codec functions do not accept script variables as parameters for 
now. That may be implemented later.

Andrei

Abeed Saleh wrote:
> Hi,
>
> I'm having problem with calling codec_move_up by passing a variable as 
> parameter.
>
> Example:
> codec_move_up("$hdr(X-Codecs)");
>
> When I pass "$hdr(X-Codecs)" nothing happens and it returns false.
>
> Any idea what this is happening?
>
> Thank you
>
> - Abeed
> 
>
> ___
> Users mailing list
> Users@lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>   

-- 
Andrei Dragus
www.voice-system.ro 


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


[OpenSIPS-Users] [NEW] DB_HTTP module added

2009-09-03 Thread andrei dragus
Hello,

A new module was added that allows opensips to use a database via HTTP, similar 
to a RESTful web service.

This module can be used for 2  purposes:
  - if you wish to bypass a firewall that allows only http
  - if you want data encryption (you can use https).


In order to use this module you must have a http-server that complies to the 
specifications given in the module docs. Unfortunately there isn't a free 
implementation for such a server so you must create one if you wish to use it.  

I hope you find this useful, and please report any problems you may have.

Andrei.


  

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


Re: [OpenSIPS-Users] [NEW] DB_HTTP module added

2009-09-03 Thread andrei dragus
Module docs have been place on the site:

http://www.opensips.org/html/docs/modules/devel/db_http.html

--- On Thu, 9/3/09, andrei dragus  wrote:

> From: andrei dragus 
> Subject: [OpenSIPS-Users] [NEW] DB_HTTP module added
> To: "user list" , de...@lists.opensips.org
> Date: Thursday, September 3, 2009, 5:46 AM
> Hello,
> 
> A new module was added that allows opensips to use a
> database via HTTP, similar to a RESTful web service.
> 
> This module can be used for 2  purposes:
>   - if you wish to bypass a firewall that allows only
> http
>   - if you want data encryption (you can use https).
> 
> 
> In order to use this module you must have a http-server
> that complies to the specifications given in the module
> docs. Unfortunately there isn't a free implementation for
> such a server so you must create one if you wish to use
> it.  
> 
> I hope you find this useful, and please report any problems
> you may have.
> 
> Andrei.
> 
> 
>       
> 
> ___
> 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] Development & SDP header

2009-09-04 Thread andrei dragus
Hi,

Well an SDP header can contain multiple sessions and each session can contain 
multiple streams ( video,voice, etc).

Example of an SDP containing a single session called "SDP Seminar" and 
containing 3 media streams ( # are comments, they are not in the RFC ).

v=0
o=mhandley 2890844526 2890842807 IN IP4 126.16.64.4
s=SDP Seminar  # session name
i=A Seminar on the session description protocol
u=http://www.cs.ucl.ac.uk/staff/M.Handley/sdp.03.ps
e=...@isi.edu (Mark Handley)
c=IN IP4 224.2.17.12/127

t=2873397496 2873404696
a=recvonly
m=audio 49170 RTP/AVP 0#first media called audio
m=video 51372 RTP/AVP 31   #second media called video
m=application 32416 udp wb #third media called application 
a=orient:portrait

If you know which session you want to look at you can use the session name,
and each stream has a name but in general it is quite difficult to distinguish 
amongst them.


>From sdp_stream_cell in sdp.h:

str media; //represents media name
str port;
str transport;
str payloads; //represents the list of codecs
int payloads_num;

struct sdp_payload_attr *payload_attr; //represents the lists of a= 
lines

When I wrote code to modify the SDP header I simply modified all streams in all 
sessions because it was to difficult to distinguish amongst them.

The code is in modules/textops/codecs.c if you find it useful.


Andrei.


> 
> Hello,
> 
> I'm trying to investigate the media type inside the SDP
> header, when I  
> had a look at the structure of SDP inside sdp.h, I found
> that:
> sdp_info contains a list of sessions and each session is
> constituted  
> of more than one stream which contains the media header
> field.
> So, how can I reach the real type of media?
> Thank you very much.
> 
> Regards.
> 
> 
> ___
> 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] [NEW] JSON module

2009-09-07 Thread andrei dragus


Hello everyone,


A new module has been added to Opensips that provides means for serialization 
and deserialization of data structures using JSON format.

Benefits of the JSON module:

   - JSON is a widespread format so it can be used to share structured 
information with other applications

   - it can be used to place complex data types into storage as strings (ex: 
any information can be placed into a database while requiring  only a column of 
type string )

   - it can be used as a general data structure from the script ( array, 
hashtable ) as it has all the methods specific to these structures ( putting , 
geting and deleting information) while also allowing the use of script
variables.


Requirements:
   - the json module depends on the json-c library that can be found at: 
http://oss.metaparadigm.com/json-c/ 

How to use it:

   - the new module introduces a new variable that provides  methods for all of 
this.

   Example:

   $json(obj1) := "{}";   # initialize an empty JSON object
   $json(obj1/key) = "value"; #replace or insert the (key,value)
  #pair into the json object;
   xlog("$json(obj1)");   # print the serialized version of the object  
 
   

For more information please read the docs found at: 
http://www.opensips.org/html/docs/modules/devel/json.html#id228250
 
Hope you find this useful and please report any bugs you may find.
 
 
Andrei.


  

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


Re: [OpenSIPS-Users] Latest SVN and Memory issuses

2009-09-17 Thread andrei dragus
There was a memory leak in the dialog module.

If you were using this module then this was probably the cause.
It was fixed starting with revision 6147.

Please update and try again, and report if you still have issues.

Andrei.

--- On Wed, 9/16/09, Brett Nemeroff  wrote:


> Look in config.h for:#define
> PKG_MEM_POOL_SIZE 1024*1024 
> and try changing that to:#define
> PKG_MEM_POOL_SIZE 1024*1024*2
> 
> On Wed, Sep 16, 2009 at 5:34 PM,
> Ron McCarthy 
> wrote:
> 
> 
> Hi List,
> 
> I just upgraded to the latest SVN relase and after a few
> thousand calls I start getting:
> 
> Sep 16 15:25:37 sips /usr/local/sbin/opensips[2271]:
> ERROR:core:get_hdr_field: out of pkg memory
> 
> 
> Sep 16 15:25:37 sips /usr/local/sbin/opensips[2271]:
> ERROR:tm:t_check: reply cannot be parsed
> 
> Sep 16 15:25:37 sips /usr/local/sbin/opensips[2271]:
> ERROR:core:parse_from_header: out of pkg_memory
> Sep 16 15:25:37 sips /usr/local/sbin/opensips[2271]:
> ERROR:dialog:pre_match_parse: failed to get From header
> Sep 16 15:25:37 sips /usr/local/sbin/opensips[2271]:
> ERROR:core:parse_from_header: out of pkg_memory
> 
> 
> 
> Sep 16 15:25:37 sips  /usr/local/sbin/opensips[2271]:
> ERROR:tm:parse_dlg: From broken
> Sep 16 15:25:37 sips /usr/local/sbin/opensips[2271]:
> ERROR:tm:matching_3261: dlg parsing failed
> Sep 16 15:25:37 sips /usr/local/sbin/opensips[2271]:
> ERROR:core:build_req_buf_from_sip_req: out of pkg memory
> 
> 
> 
> Sep 16 15:25:37 sips /usr/local/sbin/opensips[2271]:
> ERROR:core:forward_request: building req buf failed
> Sep 16 15:25:37 sips /usr/local/sbin/opensips[2271]:
> ERROR:core:get_hdr_field: out of pkg memory
> Sep 16 15:25:37 sips /usr/local/sbin/opensips[2271]:
> ERROR:tm:t_check: reply cannot be parsed
> 
> 
> 
> Sep 16 15:25:37 sips /usr/local/sbin/opensips[2271]:
> ERROR:core:get_hdr_field: out of pkg memory
> Sep 16 15:25:37 sips  /usr/local/sbin/opensips[2271]:
> ERROR:tm:t_check: reply cannot be parsed
> 
> Ive got it  using -m 2048 at startup, from what I can tell
> never more then 1 gig of RAM get's used. This is at
> around 70CPS on a single dual core Xeon, CPU is at 90%+
> idle. Anything else I can tweek, or this a bug/memory leak
> perhaps?
> 
> 
> 
> 
> We are using quit a few memcache_fetch calls for LCR and
> other purposes, about 12 or so per call.
> 
> It's also dumping a core, will that help me?
> 
> Thanks!
> 
> 
> 
> ___
> 
> Users mailing list
> 
> Users@lists.opensips.org
> 
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> 
> 
> 
> 
> 
> -Inline Attachment Follows-
> 
> ___
> 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] Memcache and increment/decrement

2009-10-19 Thread andrei dragus

Right now OpenSIPS does not have increment/decrement functions, primarily 
because memcached support is offered via the generic memcache API.

If you really need to do this, you could use a fetch followed by a store, 
though this may cause race conditions. 

>  
> Hi,
> 
> 
> 
> I know memcache itself has options for to increment and
> decrement
> values, does openSIPs have this? Ive looked everywhere and
> can not find
> anything, this could be very useful for many types of
> custom scripts.
> 
> 
> 
> Thanks
> 
> 



  

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


Re: [OpenSIPS-Users] Memcache and increment/decrement

2009-10-19 Thread andrei dragus
> OpenSIPs uses the libmemcached library right, thats the
> generic API?
> 
 
 Yes OpenSIPS is using the libmemcached library, but this was not what I was 
talking about. I was talking about the memcache system in the core.

E.g:

/* from the script */
cache_fetch("memcached_x", "nume2", $avp(i:30));

This actually calls the memcache system from the core ( which can be used with 
a local cache too, so it is general), and then depending on the type of cache 
used calls the libmemcached library or the localcache implementation.

This system does not have support for incrementing or decrementing values.

> 
> Im gonna look about writing a patch and getting it added
> natively.
> 

 There are 2 ways to do this, either add functions to the core system ( but I 
don't think this is an option) or just add exported functions to the memcached 
module.


Andrei.



  

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


[OpenSIPS-Users] [NEW] Improved version of f_malloc

2009-10-26 Thread andrei dragus
Hello,

A new version of f_malloc (fast memory allocator) was added to the trunk.

Improvements over existing f_malloc implementation:

1. No more memory fragmentation:
   - Memory fragmentation is prevented during normal allocations.
   - If an allocation cannot find a large enough size, it will start a 
forced memory defragmentation until it builds a proper size. ( this may be a 
little slow, but it will generaly not get to this case because of the 
prevention methods).

   2. Allocation speeds have improved*:
  - old version: malloc = 0.075 ms free = 0.037 ms
  - new version: malloc = 0.050 ms free = 0.043 ms 
  
Hope you find this useful.

Thanks,
Andrei.

* Times represent total times measured for 1.800.000 allocations and 1.800.000 
frees on a 2Ghz machine.


  

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


Re: [OpenSIPS-Users] [NEW] Improved version of f_malloc

2009-10-26 Thread andrei dragus
>    2. Allocation speeds have improved*:
>       - old version: malloc = 0.075 ms free = 0.037 ms
>       - new version: malloc = 0.050 ms free = 0.043 ms 
       
In order to rectify this times are measured in seconds not milliseconds , sorry 
for the mistake.


Andrei.
 


  

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


[OpenSIPS-Users] [Improvement]Speed-up in user location

2009-11-13 Thread Andrei Dragus
Hi all,

A new version of the usrloc module has been added to OpenSIPS trunk.
What is added when compared to the old version:
   - user location queries are now faster ( up to 3 times faster)
   - user location queries now take a constant amount of time 
regardless of the number
of registered users.

For a comparison between the two versions go to:
http://www.opensips.org/Resources/TestsUsrloc

Hope you find this useful.

-- 
Andrei Dragus
www.voice-system.ro 


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


Re: [OpenSIPS-Users] Memcached errors

2009-11-17 Thread Andrei Dragus
Brad Bendy wrote:
>
> ERROR:memcached:wrap_memcached_insert: Failed to insert: ACTION QUEUED
> ERROR:memcached:wrap_memcached_get: Failed to get: SUCCESS
>
Strange, I can understand that an insert was queued, but as far as the 
get , the docs clearly state that if a library "get" returns NULL an 
error occurred.

I haven't seen these errors ever so I am curious if you could build from 
sources and comment modules/memcached/memcached.c lines 387 - 395  and 
see if the errors persist.


-- 
Andrei Dragus
www.voice-system.ro 


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


Re: [OpenSIPS-Users] High load average due to mi_datagram's sockets

2009-12-16 Thread Andrei Dragus
Hi Magnus,

The load average is the average length of the run-queue in the kernel 
scheduler. It can be fairly high and still have a low level of CPU-usage.

I've looked into the sources and it seems that sharing Unix sockets is 
implemented using some form of user-space synchronization (it uses 
spinlocks).

The problem is not in OpenSIPS but rather in the implementation of unix 
sockets. If this presents a problem, switch to udp sockets, or set the 
number of processes very low.


 */ /*



Bogdan-Andrei Iancu wrote:
> Hi Magnus,
>
> I was able to reproduce this behaviour on my machine ...but this happens 
> only with unixsocks and not with UDP socks.
>
> Let me investigate and see what I will find about.
>
> Regards,
> Bogdan
>
> Magnus Burman wrote:
>   
>> I noticed a strange load average on my system. When the system was 
>> idle, I had a load of 4.00. It turns out that it's directly related to 
>> mi_datagram:s children_count. I had 5, and the load was 4. Lowering to 
>> 2 I got load 1.00, lowering to 1 I get 0.00, increasing to 20 I get 19.
>>
>> This is on an idle system (no calls), with nothing but a "regular" 
>> setup of Opensips + Mediaproxy (w/ radius and cdrtool).
>>
>> What could possible cause this?
>>
>> --
>>
>> modparam("mi_datagram", "socket_name", 
>> "/var/run/opensips/mi_datagram.sock")
>> modparam("mi_datagram", "children_count", 20)
>> modparam("mi_datagram", "unix_socket_mode", 0666) # same without this row
>> modparam("mi_datagram", "socket_timeout", 2000) # same without this row
>>
>> --
>>
>> top - 16:35:46 up 2 days, 20:19,  4 users,  load average: 19.00, 
>> 18.99, 18.22
>> Tasks: 141 total,   1 running, 140 sleeping,   0 stopped,   0 zombie
>> Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  
>> 0.0%si,  0.0%st
>> Mem:   3060736k total,  1198600k used,  1862136k free,   123576k buffers
>> Swap:  9896000k total,0k used,  9896000k free,   559468k cached
>>
>> --
>>
>> Best Regards,
>> Magnus
>> 
>>
>> ___
>> Users mailing list
>> Users@lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>   
>> 
>
>
>   

-- 
Andrei Dragus
www.voice-system.ro 


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


Re: [OpenSIPS-Users] sched_yield()

2010-01-20 Thread Andrei Dragus
Hi Alex,

Are you building OpenSIPS from source?
How many processes do you have and on how many cores?


Alex Massover wrote:
>
> Hello!
>
> I’m facing a strange problem, sometimes under a stress OpenSIPS 
> “locks” - load average jumps, SIP processing delays, opensips msg 
> queue fills with a lot of sip messages, opensips processes start to 
> comsume a lot of CPU.
>
> And strace shows:
>
> sched_yield()
>
> sched_yield()
>
> sched_yield()
>
> sched_yield()
>
> ….
>
> for all processes.
>
> If I stop the stress – after a while (not immediately) – it unlocks, 
> also suddenly, I can see in top that all opensips processes stop to 
> consume CPU.
>
> What can it be? Some kind of starvation?
>
> --
>
> Best Regards,
>
> Alex Massover
>
> VoIP R&D TL
>
> Jajah Inc.
>
>
>
> This mail was sent via Mail-SeCure System.
> 
>
> _______
> Users mailing list
> Users@lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>   

-- 
Andrei Dragus
www.voice-system.ro 


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


Re: [OpenSIPS-Users] sched_yield()

2010-01-20 Thread Andrei Dragus
Hi,

I think that there is a lock that is being held more than it should be 
and that's what causes starvation. It would help us if you could attach 
to a process using gdb and give us a full backtrace.

Temporary solutions which should work would be to reduce the number of 
processes to 4-6 or to recompile replacing -DFAST_LOCK with one of the 
other options (-DUSE_POSIX_SEM or -DUSE_PTHREAD_MUTEX) but we should see 
where this is from to fix it.

Alex Massover wrote:
> Hi!
>
> Yes, from the source on debian, I build deb package. (I did some minor 
> changes to the source, but the problem happens also without my changes)
> 16 children on 4 cores.
>
> What do you suggest to reduce it to 4? It runs on 2.6.32 on VMware ESX.
>
> I'm also trying now sleep(0) instead of sched_yield().
>
> --
> Best Regards,
> Alex Massover
> VoIP R&D TL
> Jajah Inc.
>   
>> -Original Message-
>> From: users-boun...@lists.opensips.org [mailto:users-
>> boun...@lists.opensips.org] On Behalf Of Andrei Dragus
>> Sent: Wednesday, January 20, 2010 1:05 PM
>> To: OpenSIPS users mailling list
>> Subject: Re: [OpenSIPS-Users] sched_yield()
>>
>> Hi Alex,
>>
>> Are you building OpenSIPS from source?
>> How many processes do you have and on how many cores?
>>
>>
>> Alex Massover wrote:
>> 
>>> Hello!
>>>
>>> I'm facing a strange problem, sometimes under a stress OpenSIPS
>>> "locks" - load average jumps, SIP processing delays, opensips msg
>>> queue fills with a lot of sip messages, opensips processes start to
>>> comsume a lot of CPU.
>>>
>>> And strace shows:
>>>
>>> sched_yield()
>>>
>>> sched_yield()
>>>
>>> sched_yield()
>>>
>>> sched_yield()
>>>
>>> 
>>>
>>> for all processes.
>>>
>>> If I stop the stress - after a while (not immediately) - it unlocks,
>>> also suddenly, I can see in top that all opensips processes stop to
>>> consume CPU.
>>>
>>> What can it be? Some kind of starvation?
>>>
>>> --
>>>
>>> Best Regards,
>>>
>>> Alex Massover
>>>
>>> VoIP R&D TL
>>>
>>> Jajah Inc.
>>>
>>>
>>>
>>> This mail was sent via Mail-SeCure System.
>>> -
>>>   
>> ---
>> 
>>> ___
>>> Users mailing list
>>> Users@lists.opensips.org
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>
>>>   
>> --
>> Andrei Dragus
>> www.voice-system.ro
>>
>>
>> ___
>> Users mailing list
>> Users@lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>> This mail was received via Mail-SeCure System.
>>
>> 
>
>
> This mail was sent via Mail-SeCure System.
>
>
>
> ___
> Users mailing list
> Users@lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>   

-- 
Andrei Dragus
www.voice-system.ro 


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


Re: [OpenSIPS-Users] sched_yield()

2010-01-21 Thread Andrei Dragus
y ()
>>> #12 0xb7627d39 in t_relay_to () from /usr/lib/opensips/modules/tm.so
>>> #13 0xb7634501 in ?? () from /usr/lib/opensips/modules/tm.so
>>> #14 0x08055030 in do_action ()
>>> #15 0x08053ebf in run_action_list ()
>>> #16 0x08095cf2 in eval_expr ()
>>> #17 0x080958d9 in eval_expr ()
>>> #18 0x08095919 in eval_expr ()
>>> #19 0x080554e2 in do_action ()
>>> #20 0x08053ebf in run_action_list ()
>>> #21 0x08056e7a in do_action ()
>>> #22 0x08053ebf in run_action_list ()
>>> ---Type  to continue, or q  to quit---
>>> #23 0x080569d8 in do_action ()
>>> #24 0x08053ebf in run_action_list ()
>>> #25 0x08056e7a in do_action ()
>>> #26 0x08053ebf in run_action_list ()
>>> #27 0x08057d99 in run_top_route ()
>>> #28 0x0808ad6c in receive_msg ()
>>> #29 0x080bd2f2 in udp_rcv_loop ()
>>> #30 0x08069339 in main ()
>>> (gdb)
>>>
>>> --
>>> Best Regards,
>>> Alex Massover
>>> VoIP R&D TL
>>> Jajah Inc.
>>>   
>>>> -Original Message-
>>>> From: users-boun...@lists.opensips.org [mailto:users-
>>>> boun...@lists.opensips.org] On Behalf Of Andrei Dragus
>>>> Sent: Wednesday, January 20, 2010 2:58 PM
>>>> To: OpenSIPS users mailling list
>>>> Subject: Re: [OpenSIPS-Users] sched_yield()
>>>>
>>>> Hi,
>>>>
>>>> I think that there is a lock that is being held more than it should
>>>> 
>>> be
>>>   
>>>> and that's what causes starvation. It would help us if you could
>>>> 
>>> attach
>>>   
>>>> to a process using gdb and give us a full backtrace.
>>>>
>>>> Temporary solutions which should work would be to reduce the number
>>>> 
>>> of
>>>   
>>>> processes to 4-6 or to recompile replacing -DFAST_LOCK with one of
>>>> 
>>> the
>>>   
>>>> other options (-DUSE_POSIX_SEM or -DUSE_PTHREAD_MUTEX) but we
>>>> 
>> should
>> 
>>>> see
>>>> where this is from to fix it.
>>>>
>>>> Alex Massover wrote:
>>>> 
>>>>> Hi!
>>>>>
>>>>> Yes, from the source on debian, I build deb package. (I did some
>>>>>   
>>>> minor changes to the source, but the problem happens also without
>>>> 
>> my
>> 
>>>> changes)
>>>> 
>>>>> 16 children on 4 cores.
>>>>>
>>>>> What do you suggest to reduce it to 4? It runs on 2.6.32 on
>>>>>   
>> VMware
>> 
>>>> ESX.
>>>> 
>>>>> I'm also trying now sleep(0) instead of sched_yield().
>>>>>
>>>>> --
>>>>> Best Regards,
>>>>> Alex Massover
>>>>> VoIP R&D TL
>>>>> Jajah Inc.
>>>>>
>>>>>   
>>>>>> -Original Message-
>>>>>> From: users-boun...@lists.opensips.org [mailto:users-
>>>>>> boun...@lists.opensips.org] On Behalf Of Andrei Dragus
>>>>>> Sent: Wednesday, January 20, 2010 1:05 PM
>>>>>> To: OpenSIPS users mailling list
>>>>>> Subject: Re: [OpenSIPS-Users] sched_yield()
>>>>>>
>>>>>> Hi Alex,
>>>>>>
>>>>>> Are you building OpenSIPS from source?
>>>>>> How many processes do you have and on how many cores?
>>>>>>
>>>>>>
>>>>>> Alex Massover wrote:
>>>>>>
>>>>>> 
>>>>>>> Hello!
>>>>>>>
>>>>>>> I'm facing a strange problem, sometimes under a stress OpenSIPS
>>>>>>> "locks" - load average jumps, SIP processing delays, opensips
>>>>>>>   
>> msg
>> 
>>>>>>> queue fills with a lot of sip messages, opensips processes
>>>>>>>   
>> start
>> 
>>> to
>>>   
>>>>>>> comsume a lot of CPU.
>>>>>>>
>>>>>>> And strace shows:
>>>>>>>
>>>>>>> sched_yield()
&g

Re: [OpenSIPS-Users] sched_yield()

2010-01-21 Thread Andrei Dragus
My guess is that there is not enough shared memory. When an allocation 
failes OpenSIPS tries to defragment memory to make room which takes a 
lot of time and must be done under lock.

Please try to increase the shared memory size and tell me if it persists.


Alex Massover wrote:
> Hi!
>
> Yes, with -DF_MALLOC.
>
> 1.6.1 from sources, I build deb package.
> I use 128M of shared and 10*1024*1024 private memory (can increase - no 
> problem).
>
> H, "opensipsctl fifo get_statistics all" crashes/stops the opensips.
>
> 'fifo uptime' or 'fifo debug' are OK.
>
> strace while 'fifo get_statistics all':
> Process 9509 attached - interrupt to quit
> pause() = ? ERESTARTNOHAND (To be restarted)
> --- SIGUSR2 (User defined signal 2) @ 0 (0) ---
> sigreturn() = ? (mask now [])
> pause() = ? ERESTARTNOHAND (To be restarted)
> --- SIGCHLD (Child exited) @ 0 (0) ---
> sigreturn() = ? (mask now [])
> waitpid(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGUSR2}], WNOHANG) = 9520
> waitpid(-1, 0xbf84b4c8, WNOHANG)= 0
> kill(0, SIGTERM)= 0
> --- SIGTERM (Terminated) @ 0 (0) ---
> --- SIGCHLD (Child exited) @ 0 (0) ---
> sigreturn() = ? (mask now [TERM])
> sigreturn() = ? (mask now [])
> rt_sigaction(SIGALRM, {0x8065920, [ALRM], SA_RESTART}, {SIG_DFL}, 8) = 0
> alarm(60)   = 0
> wait4(-1, NULL, 0, NULL)= 9514
> wait4(-1, NULL, 0, NULL)= 9519
> wait4(-1, NULL, 0, NULL)= 9521
> wait4(-1, NULL, 0, NULL)= 9522
> wait4(-1, NULL, 0, NULL)= 9512
> --- SIGCHLD (Child exited) @ 0 (0) ---
> sigreturn() = ? (mask now [])
> --- SIGCHLD (Child exited) @ 0 (0) ---
> sigreturn() = ? (mask now [])
> wait4(-1, NULL, 0, NULL)= 9510
> wait4(-1, NULL, 0, NULL)= 9516
> --- SIGCHLD (Child exited) @ 0 (0) ---
> sigreturn() = ? (mask now [])
> --- SIGCHLD (Child exited) @ 0 (0) ---
> sigreturn() = ? (mask now [])
> wait4(-1, NULL, 0, NULL)= 9515
> wait4(-1, NULL, 0, NULL)= 9517
> wait4(-1, NULL, 0, NULL)= 9524
> wait4(-1, NULL, 0, NULL)= 9525
> --- SIGCHLD (Child exited) @ 0 (0) ---
> sigreturn() = ? (mask now [])
> --- SIGCHLD (Child exited) @ 0 (0) ---
> sigreturn() = ? (mask now [])
> --- SIGCHLD (Child exited) @ 0 (0) ---
> sigreturn() = ? (mask now [])
> --- SIGCHLD (Child exited) @ 0 (0) ---
> sigreturn() = ? (mask now [])
> wait4(-1, NULL, 0, NULL)= 9511
> wait4(-1, NULL, 0, NULL)= 9513
> wait4(-1, NULL, 0, NULL)= 9518
> wait4(-1, NULL, 0, NULL)= 9523
> wait4(-1, NULL, 0, NULL)= -1 ECHILD (No child processes)
> rt_sigaction(SIGALRM, {0x8066080, [ALRM], SA_RESTART}, {0x8065920, [ALRM], 
> SA_RESTART}, 8) = 0
> stat64("/tmp/opensips_fifo", {st_mode=S_IFIFO|0660, st_size=0, ...}) = 0
> unlink("/tmp/opensips_fifo")= 0
> munmap(0xaed25000, 134217728)   = 0
> unlink("/var/run/opensips/opensips.pid") = 0
> alarm(0)= 60
> rt_sigaction(SIGALRM, {SIG_IGN}, {0x8066080, [ALRM], SA_RESTART}, 8) = 0
> exit_group(0)   = ?
> Process 9509 detached
>
> --
> Best Regards,
> Alex Massover
> VoIP R&D TL
> Jajah Inc.
>
>   
>> -Original Message-
>> From: users-boun...@lists.opensips.org [mailto:users-
>> boun...@lists.opensips.org] On Behalf Of Andrei Dragus
>> Sent: Thursday, January 21, 2010 3:09 PM
>> To: OpenSIPS users mailling list
>> Subject: Re: [OpenSIPS-Users] sched_yield()
>>
>>
>> Hi,
>>
>> Since all the backtraces are in allocation routines my guess is that
>> the
>> shared memory lock might be causing a problem.
>>
>> Are you compiling with -DF_MALLOC?
>> What version of OpenSIPS are you using?
>> What is the total shared memory pool you are allocating?
>> What amount of memory are you using? ( Use : opensipsctl fifo
>> get_statistics all )
>>
>> Alex Massover wrote:
>> 
>>> Some more,
>>>
>>> (gdb) bt
>>> #0  0xb78dc424 in __kernel_vsyscall ()
>>> #1  0xb781741c in

Re: [OpenSIPS-Users] sched_yield()

2010-01-22 Thread Andrei Dragus
Hi,

The new f_malloc will not do anything extra when compared to the old one 
until memory usage goes way up.
I've added a warning in mem/f_malloc.c so you can see when defrag 
starts. If you get this warning then it is clear that the problem is 
from high memory usage.

1 GB for 4k calls seems a lot ( 250k per call). You can try to use 
"opensipsctl fifo get_statistics shmem:" and see what the memory usage 
is for diferent number of concurrent calls ( 1k,2k,3k,4k), and if indeed 
the memory usage is that high we should investigate the cause.


Alex Massover wrote:
> Hi,
>
> Now shared memory is 1G (-m 1024), and all memory  is dedicated to the 
> virtual machine (it was shared till now).
> But it still happens, just not so often.
>
> I originate the calls for this stress test in Asterisk with the same 
> resources and looks like Asterisk performs much better than OpenSIPS. How can 
> it be?
> In my stress OpenSIPS does no blocking/slow requests. And it's just 4K 
> concurrent calls, each one is 2-3 min.
>
> Maybe OpenSIPS does too much low level memory management and virtual machine 
> is not suitable for it (despite that Asterisk runs well over VMware)?
>
> I'm not sure but I have a feeling that 1.4 performed better. What can cause 
> performance degradation in 1.6? Storing vars on dialog, new malloc()?
>
> gdb) bt
> #0  0xb78ad424 in __kernel_vsyscall ()
> #1  0xb77e841c in sched_yield () from /lib/i686/cmov/libc.so.6
> #2  0x080bf23d in new_avp ()
> #3  0x080bf53f in add_avp ()
> #4  0x08080e6e in pv_set_avp ()
> #5  0x0808229c in pv_set_value ()
> #6  0x08053c9d in do_assign ()
> #7  0x0805447a in do_action ()
> #8  0x08053ebf in run_action_list ()
> #9  0x08056e7a in do_action ()
> #10 0x08053ebf in run_action_list ()
> #11 0x08056e7a in do_action ()
> #12 0x08053ebf in run_action_list ()
> #13 0x080569d8 in do_action ()
> #14 0x08053ebf in run_action_list ()
> #15 0x08056e7a in do_action ()
> #16 0x08053ebf in run_action_list ()
> #17 0x08057d99 in run_top_route ()
> #18 0x0808ad6c in receive_msg ()
> #19 0x080bd2f2 in udp_rcv_loop ()
> #20 0x08069339 in main ()
> (gdb) quit
>
>
> (gdb) bt
> #0  0xb78ad424 in __kernel_vsyscall ()
> #1  0xb77e841c in sched_yield () from /lib/i686/cmov/libc.so.6
> #2  0xb76f52cd in build_cell () from /usr/lib/opensips/modules/tm.so
> #3  0xb770ac4a in t_newtran () from /usr/lib/opensips/modules/tm.so
> #4  0xb76ff7b8 in t_relay_to () from /usr/lib/opensips/modules/tm.so
> #5  0xb770c501 in ?? () from /usr/lib/opensips/modules/tm.so
> #6  0x08055030 in do_action ()
> #7  0x08053ebf in run_action_list ()
> #8  0x08095cf2 in eval_expr ()
> #9  0x080958d9 in eval_expr ()
> #10 0x08095919 in eval_expr ()
> #11 0x080554e2 in do_action ()
> #12 0x08053ebf in run_action_list ()
> #13 0x080569d8 in do_action ()
> #14 0x08053ebf in run_action_list ()
> #15 0x08056e7a in do_action ()
> #16 0x08053ebf in run_action_list ()
> #17 0x08057d99 in run_top_route ()
> #18 0x0808ad6c in receive_msg ()
> #19 0x080bd2f2 in udp_rcv_loop ()
> #20 0x08069339 in main ()
>
>
> --
> Best Regards,
> Alex Massover
> VoIP R&D TL
> Jajah Inc.
>
>   
>> -Original Message-
>> From: users-boun...@lists.opensips.org [mailto:users-
>> boun...@lists.opensips.org] On Behalf Of Andrei Dragus
>> Sent: Thursday, January 21, 2010 3:43 PM
>> To: OpenSIPS users mailling list
>> Subject: Re: [OpenSIPS-Users] sched_yield()
>>
>> My guess is that there is not enough shared memory. When an allocation
>> failes OpenSIPS tries to defragment memory to make room which takes a
>> lot of time and must be done under lock.
>>
>> Please try to increase the shared memory size and tell me if it
>> persists.
>>
>>
>> Alex Massover wrote:
>> 
>>> Hi!
>>>
>>> Yes, with -DF_MALLOC.
>>>
>>> 1.6.1 from sources, I build deb package.
>>> I use 128M of shared and 10*1024*1024 private memory (can increase -
>>>   
>> no problem).
>> 
>>> H, "opensipsctl fifo get_statistics all" crashes/stops the
>>>   
>> opensips.
>> 
>>> 'fifo uptime' or 'fifo debug' are OK.
>>>
>>> strace while 'fifo get_statistics all':
>>> Process 9509 attached - interrupt to quit
>>> pause() = ? ERESTARTNOHAND (To be
>>>   
>> restarted)
>> 
>>> --- SIGUSR2 (User defined signal 2) @ 0 (0) ---
>>> sigreturn() = ? (mask now [])
>>> pause() = ? E

Re: [OpenSIPS-Users] sched_yield()

2010-01-22 Thread Andrei Dragus

To determine if running on vmware is a problem you could try to test it 
on a real machine and see.

And just to make sure that f_malloc is not the issue you could try 
getting an older version of the mem folder ( either one from revision 
r6274 or one from 1.5 branch)


Alex Massover wrote:
> Hi,
>
> Unfortunately 'fifo get_statistics' crashes opensips, I opened a bug.
> But no chance that 1G is not enough, only about 400M is used for all linux 
> processes:
> Mem:   3115120k total,   398360k used,  2716760k free,  536k buffers
>
> Maybe sched_yield() just cause problems on 2.3.62 or on vmware or on SMP?
>
> I'm trying now with fork=yes and children=1.
> If I have only one working child, does it suppose to lock and shed_yeild() 
> itself from any reason?
>
> Meanwhile with single child OpenSIPS easily handles 4K of concurrent calls at 
> 15cps, load average is 0.00 (!) and CPU is about 96% idle.
>
> I wonder if single working child also hangs.
>
> --
> Best Regards,
> Alex Massover
> VoIP R&D TL
> Jajah Inc.
>   
>> -Original Message-
>> From: users-boun...@lists.opensips.org [mailto:users-
>> boun...@lists.opensips.org] On Behalf Of Andrei Dragus
>> Sent: Friday, January 22, 2010 1:17 PM
>> To: OpenSIPS users mailling list
>> Subject: Re: [OpenSIPS-Users] sched_yield()
>>
>> Hi,
>>
>> The new f_malloc will not do anything extra when compared to the old
>> one
>> until memory usage goes way up.
>> I've added a warning in mem/f_malloc.c so you can see when defrag
>> starts. If you get this warning then it is clear that the problem is
>> from high memory usage.
>>
>> 1 GB for 4k calls seems a lot ( 250k per call). You can try to use
>> "opensipsctl fifo get_statistics shmem:" and see what the memory usage
>> is for diferent number of concurrent calls ( 1k,2k,3k,4k), and if
>> indeed
>> the memory usage is that high we should investigate the cause.
>>
>>
>> Alex Massover wrote:
>> 
>>> Hi,
>>>
>>> Now shared memory is 1G (-m 1024), and all memory  is dedicated to
>>>   
>> the virtual machine (it was shared till now).
>> 
>>> But it still happens, just not so often.
>>>
>>> I originate the calls for this stress test in Asterisk with the same
>>>   
>> resources and looks like Asterisk performs much better than OpenSIPS.
>> How can it be?
>> 
>>> In my stress OpenSIPS does no blocking/slow requests. And it's just
>>>   
>> 4K concurrent calls, each one is 2-3 min.
>> 
>>> Maybe OpenSIPS does too much low level memory management and virtual
>>>   
>> machine is not suitable for it (despite that Asterisk runs well over
>> VMware)?
>> 
>>> I'm not sure but I have a feeling that 1.4 performed better. What can
>>>   
>> cause performance degradation in 1.6? Storing vars on dialog, new
>> malloc()?
>> 
>>> gdb) bt
>>> #0  0xb78ad424 in __kernel_vsyscall ()
>>> #1  0xb77e841c in sched_yield () from /lib/i686/cmov/libc.so.6
>>> #2  0x080bf23d in new_avp ()
>>> #3  0x080bf53f in add_avp ()
>>> #4  0x08080e6e in pv_set_avp ()
>>> #5  0x0808229c in pv_set_value ()
>>> #6  0x08053c9d in do_assign ()
>>> #7  0x0805447a in do_action ()
>>> #8  0x08053ebf in run_action_list ()
>>> #9  0x08056e7a in do_action ()
>>> #10 0x08053ebf in run_action_list ()
>>> #11 0x08056e7a in do_action ()
>>> #12 0x08053ebf in run_action_list ()
>>> #13 0x080569d8 in do_action ()
>>> #14 0x08053ebf in run_action_list ()
>>> #15 0x08056e7a in do_action ()
>>> #16 0x08053ebf in run_action_list ()
>>> #17 0x08057d99 in run_top_route ()
>>> #18 0x0808ad6c in receive_msg ()
>>> #19 0x080bd2f2 in udp_rcv_loop ()
>>> #20 0x08069339 in main ()
>>> (gdb) quit
>>>
>>>
>>> (gdb) bt
>>> #0  0xb78ad424 in __kernel_vsyscall ()
>>> #1  0xb77e841c in sched_yield () from /lib/i686/cmov/libc.so.6
>>> #2  0xb76f52cd in build_cell () from /usr/lib/opensips/modules/tm.so
>>> #3  0xb770ac4a in t_newtran () from /usr/lib/opensips/modules/tm.so
>>> #4  0xb76ff7b8 in t_relay_to () from /usr/lib/opensips/modules/tm.so
>>> #5  0xb770c501 in ?? () from /usr/lib/opensips/modules/tm.so
>>> #6  0x08055030 in do_action ()
>>> #7  0x08053ebf in run_action_list ()
>>> #8  0x08095cf2 in eval_expr ()
>>> #9  0x080958d9 in eval_exp

[OpenSIPS-Users] [New] Probing for drouting module

2010-02-19 Thread Andrei Dragus
Hi all,

A new feature has been added to the drouting module that allows the 
probing of gateways in case they become unreachable.

Typical usages:
- if a gateway becomes unreachable it is automatically marked as 
disabled and no messages are forwarded to it.
- when it comes back online it is automatically marked as enabled 
and it is used again.
- the user can mark a gateway as disabled from script ( for example 
when receiving timeouts)
- the user can mark a gateway as disabled from MI ( for example to 
stop all transmissions while doing maintenance of the gateway)

What has changed:
- a new row has been added to the dr_gateways table to select 
behavior for each gateway ( see docs for explanations).
   
The behavior is similar to that of the loadbalancer module for 
consistency. Check the docs if you need more information : 
http://www.opensips.org/html/docs/modules/devel/drouting.html.

Hope you find it useful,
Andrei.

-- 
Andrei Dragus
www.voice-system.ro 


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


Re: [OpenSIPS-Users] [New] Probing for drouting module

2010-02-19 Thread Andrei Dragus
Right now you need to update your table.
I will add a change so it is possible to work with the previous version 
of the database, but the default behavior will be not to ping the 
gateways and in order to change this you will have to update your tables

David J. wrote:
> Sounds good, Do we need to update the DB Schema or if the column is 
> missing it fails gracefully?
>
> Thanks.
>
>
> Andrei Dragus wrote:
>   
>> Hi all,
>>
>> A new feature has been added to the drouting module that allows the 
>> probing of gateways in case they become unreachable.
>>
>> Typical usages:
>> - if a gateway becomes unreachable it is automatically marked as 
>> disabled and no messages are forwarded to it.
>> - when it comes back online it is automatically marked as enabled 
>> and it is used again.
>> - the user can mark a gateway as disabled from script ( for example 
>> when receiving timeouts)
>> - the user can mark a gateway as disabled from MI ( for example to 
>> stop all transmissions while doing maintenance of the gateway)
>>
>> What has changed:
>> - a new row has been added to the dr_gateways table to select 
>> behavior for each gateway ( see docs for explanations).
>>
>> The behavior is similar to that of the loadbalancer module for 
>> consistency. Check the docs if you need more information : 
>> http://www.opensips.org/html/docs/modules/devel/drouting.html.
>>
>> Hope you find it useful,
>> Andrei.
>>
>>   
>> 
>
>
> ___
> Users mailing list
> Users@lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>   

-- 
Andrei Dragus
www.voice-system.ro 


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


Re: [OpenSIPS-Users] [New] Probing for drouting module

2010-02-19 Thread Andrei Dragus
The schema is in trunk/db/schema/dr_gateways.xml.
The table creation scripts are in trunk/scripts.
It is also in the docs with an example in section 1.1.5.

David J. wrote:
> Where is the new schema?
> Is it in the docs?
>
>
>
> Andrei Dragus wrote:
>   
>> Right now you need to update your table.
>> I will add a change so it is possible to work with the previous version 
>> of the database, but the default behavior will be not to ping the 
>> gateways and in order to change this you will have to update your tables
>>
>> David J. wrote:
>>   
>> 
>>> Sounds good, Do we need to update the DB Schema or if the column is 
>>> missing it fails gracefully?
>>>
>>> Thanks.
>>>
>>>
>>> Andrei Dragus wrote:
>>>   
>>> 
>>>   
>>>> Hi all,
>>>>
>>>> A new feature has been added to the drouting module that allows the 
>>>> probing of gateways in case they become unreachable.
>>>>
>>>> Typical usages:
>>>> - if a gateway becomes unreachable it is automatically marked as 
>>>> disabled and no messages are forwarded to it.
>>>> - when it comes back online it is automatically marked as enabled 
>>>> and it is used again.
>>>> - the user can mark a gateway as disabled from script ( for example 
>>>> when receiving timeouts)
>>>> - the user can mark a gateway as disabled from MI ( for example to 
>>>> stop all transmissions while doing maintenance of the gateway)
>>>>
>>>> What has changed:
>>>> - a new row has been added to the dr_gateways table to select 
>>>> behavior for each gateway ( see docs for explanations).
>>>>
>>>> The behavior is similar to that of the loadbalancer module for 
>>>> consistency. Check the docs if you need more information : 
>>>> http://www.opensips.org/html/docs/modules/devel/drouting.html.
>>>>
>>>> Hope you find it useful,
>>>> Andrei.
>>>>
>>>>   
>>>> 
>>>>   
>>>> 
>>> ___
>>> 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
>   

-- 
Andrei Dragus
www.voice-system.ro 


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


Re: [OpenSIPS-Users] [New] Probing for drouting module

2010-03-01 Thread Andrei Dragus
>
> scripts/mysql/drouting-create.sql
>  
> this sql only update the mysql table ?
This will only create the table. You should drop the table and 
recreate or you could alter the table by hand ( so you don't lose all 
the data in it) and modify the version number to 4 (in the version table).

You need to set the value in the probe_mode column to an appropriate 
value if you want to use it (see docs), the default is to be disabled.

-- 
Andrei Dragus
www.voice-system.ro 


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


Re: [OpenSIPS-Users] Core Dump with db_http and avp_db_query

2010-04-19 Thread Andrei Dragus
Hi,

1. Do you have a server that is prepared to respond to queries via HTTP ?
2. The avpops module uses raw queries. The db_http module has raw
queries turned off by default. You should set the following parameter if
you know your server supports raw queries:

modparam("db_http", "cap_raw_quey", 1)

Andrei



Brad Bendy wrote:
> Hi List,
>
> I wanted to test some things using the db_http driver and using 
> avp_db_query to perform db queries. This happens on 1.6.1 and 1.6.2 
> both no-tls on 32bit BSD.
>
> When we load db_http and assign the db_url for avpops to it we get a 
> core dump on startup, ive tried this:
>
> modparam("avpops","db_url","http://user:p...@localhost/db_http";)
> modparam("avpops","db_url","http://user:p...@localhost";)
>
> If we change the db_url to say mysql we have no issues and all works well.
>
> Backtrace shows:
>
>
> #0  0x in ?? ()
> #1  0x285b8070 in db_query_avp (url=0x81bf244, msg=0xbfbfe84c, 
> query=0x8221768 "SELECT foo FROM bar WHERE foo = bar", dest=0x8229b8c) 
> at avpops_db.c:417
> #2  0x285bacb6 in ops_dbquery_avps (msg=0xbfbfe84c, query=0x8229b40, 
> url=0x81bf244, dest=0x8229b8c) at avpops_impl.c:755
> #3  0x285b2f81 in w_dbquery_avps (msg=0xbfbfe84c, query=0x8229b40 
> "�%\034\b#", dest=0x8229b8c "\004", url=0x0) at avpops.c:1130
> #4  0x08053f56 in do_action (a=0x81c2760, msg=0xbfbfe84c) at action.c:967
> #5  0x08052920 in run_action_list (a=0x81c2760, msg=0xbfbfe84c) at 
> action.c:139
> #6  0x08057485 in run_top_route (a=0x81c2760, msg=0xbfbfe84c) at 
> action.c:119
> #7  0x080a31e2 in run_startup_route () at route.c:1867
> #8  0x0806f7c2 in main (argc=3, argv=0xbfbfec5c) at main.c:811
>
>
> I have also moved it out of the startup_route into a route block and 
> the switch then crashes as soon as a call is sent to that particular 
> route block.
>
>
> Am I just trying to use db_http wrong and my configuration is not correct?
>
> Thanks for any help
> --------
>
> ___
> Users mailing list
> Users@lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>   

-- 
Andrei Dragus
www.voice-system.ro



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


Re: [OpenSIPS-Users] db_http module

2010-05-12 Thread Andrei Dragus
Hi,

The db_http is a "backend" module that implements a database via http. 
It does NOT export any functions in the script. The modules that rely on 
databases will submit queries whenever they need to automatically. If 
you want certain queries you can use the avpops module.

If you have a script that works fine with any other type of database 
(MySQL, postgres etc) all you need to change in the config file are:

1. load the db_http module instead of the db_mysql module
2. set the corresponding module parameters ( if you want SSL, if you 
want raw queries, etc.)
3. set the db_url parameter of all the modules that you want to use this 
module to your http url.

Keep in mind that in order to use this module you must have a working 
http server that complies to the specifications given in the docs.

For example if the server receives a GET query like the following:

GET /presentity/?c=id,username,domain HTTP/1.1

it should reply something like :

int;string;string
6;something=something;1000
100;mine;10002030



Andrei.


samoh wrote:
> Hi everyone,
>
> I want to use the db_http module with an http server but I don't know how I
> must proceed, the documentation of this module isn't well explained.
>
> What are functions of this module ??
>
> Someone can help me to inderstand how can I work it ? an example please.
>
> Thanks.
> Sam. 
>
>
>   

-- 
Andrei Dragus
www.voice-system.ro 


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


Re: [OpenSIPS-Users] mi_datagram: causing a load average of 9

2010-05-12 Thread Andrei Dragus
Hi,

I think this was discussed before, see:

http://lists.opensips.org/pipermail/users/2009-December/009714.html

Andrei

Mike O'Connor wrote:
> On 12/05/10 5:00 PM, Saúl Ibarra Corretgé wrote:
>   
>> Hi,
>>
>> 
>>> As soon as opensips is started, and it continues for ever. I did not
>>> notice it for a couple of days after I added the configuration, but it
>>> had been there from that point. My munin graphs confirmed this.
>>>
>>>   
>> So we can assume MediaProxy is not generating that load, because it
>> happens when you start OpenSIPS, right? Besides, MediaProxy doesn't do
>> any polling on that socket, so I don't see a reason for that high load
>> there.
>>
>> Could there be any other software that is connecting to that socket? I
>> have never experienced this so far, so I can just guess here... :-S
>>
>>
>> Regards,
>>
>> 
> I do not think anything else is using it, I not installed anything which
> mentions it.
>
> Is it possible for mediaproxy and opensips to use the udp option ?
>
> ie udp:10.1.5.243:8080
>
> Mike
>
> ___
> Users mailing list
> Users@lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>   

-- 
Andrei Dragus
www.voice-system.ro 


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


Re: [OpenSIPS-Users] how to use DB_HTTP module ?

2010-05-17 Thread Andrei Dragus
Hi,

This module was designed to act as a database module, if you want to use 
it to exchange data with a server you have to work around this.

The "q" variable represents a raw query. Its name cannot be changed, but 
you can give it any value.

You can use the avpops module like this to retrieve data:

avp_db_query("whatever you want to put in the q variable","$avp(i:678)");

The server MUST reply with a HTTP message that has a body similar to:

string
whatever answer you want in the avp

Opensips will take this reply, see that it has only one column and place 
the result in the given avp.

If you want to exchange several variables you have to invent a way to 
put all the variables in a single string.


Andrei.

samoh wrote:
> Hi everyone,
>
> I already posted a message about of how to use db but I did not have
> concrete answers, all those who responded to me told me to see the
> documentation of this module but after reading the documentation several
> time I can't manage to understand how it works, if someone already used the
> module db_http it would very nice of him to show me how he did.
>
> In my opensips.cfg I did this :
>
> modparam("avpops","db_url","http://localhost/db_http";)
> modparam("avpops","avp_table","script.php")
>
> I make a query to the http server :
>
> avp_db_query("1");  
> __
>  if I change "1" by a string I will have it on ::1 - - [17/May/2010:12:31:21
> +0200] "GET /db_http/script.php/?q="string"
> __
> in the log of apache i have this :
>
> ::1 - - [17/May/2010:12:31:21 +0200] "GET
> /db_http/script.php/?q=1&query_type=custom HTTP/1.1" 200 362 "-" "-"
> 127.0.0.1 - - [17/May/2010:12:31:21 +0200] "POST / HTTP/1.1" 200 45 "-" "-"
>
> My script.php which is in db_http directory on the http server get the
> variable by the url with $_GET['q'] but I don't know how change the name of
> variable "q" AND how send a lot of variable on the http request ???
>
> I would like to send the avp variable to the http sever, after analyzing it
> by my script I wont to retrieve result on my opensips.cfg.
>
> Someone can help me ??
>
> Best regards.
> Sam. 
>
>   

-- 
Andrei Dragus
www.voice-system.ro 


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


Re: [OpenSIPS-Users] how to use DB_HTTP module ?

2010-05-17 Thread Andrei Dragus
Hi,

You cannot use these variables directly from script.

Each module will use these variables if it needs to, they are only 
accessible from C-code directly.
If you want, you can use the avp_db_load and avp_db_store functions and 
see what variables these use.

I have the feeling that you are trying to use the module for something 
it was not designed for, so you will need to workaround its design.


Andrei
| |
samoh wrote:
> Hi Andrei,
>
> Thank you for your fast reply. now I understand better.
>
> In the documentation of this module, I see :
>
>k=
>   Describes the keys (columns) that will be used for comparison.Can have
> multiple values.
>   op=
>   Describes the operators that will be used for comparison.Can have
> multiple values.
>   v=
>   Describes the values that columns will be compaired against. Can have
> multiple values. 
>
> How can I use this variables ?.
>
> Best regards.
> Sam.
>
>
>   

-- 
Andrei Dragus
www.voice-system.ro 


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


Re: [OpenSIPS-Users] how to use DB_HTTP module ?

2010-05-17 Thread Andrei Dragus

> I understand that this module isn't intended to be used to share variables
> with PHP?
>   
No, this was not the purpose of this module.

> I want to use this module to use a php script to process each call
>
> If I do this:
>
> avp_db_query("select something from table", $avp(i:986));
>
> can I retrieve the results on my $avp(i:986) ?
>
> What I must have In my script.php to treat this request and make the
> exchange ?
>   
I don't know PHP but what you have to do is build a 200 OK HTTP reply 
containing the body:

string
answer

After this $avp(i:986) will contain "answer".

-- 
Andrei Dragus
www.voice-system.ro 


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


Re: [OpenSIPS-Users] how to use DB_HTTP module ?

2010-05-18 Thread Andrei Dragus

What is the exact reply that you are sending? (Use wireshark or ngrep)
Are you getting any errors in the logs?

Andrei.

samoh wrote:
> Hi Andrei,
>
> My script.php returs string by echo string; (php function), so I want to be
> able to retrieve this string in avp variable with avp_db_query("somthing",
> $avp(s:86)); but after doing call my $avp(s:86) has NULL value ?!. I saw in
> the documentation this example :
> Example 1.14. Example Reply.
> ...
> int;string;blob
> 6;something=something;1000
> 100;mine;10002030
> ...
>
> where can I find the result of my request ?.
>
> Thank you in advance.
>
> Sam.
>
>
>   

-- 
Andrei Dragus
www.voice-system.ro 


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


Re: [OpenSIPS-Users] how to use DB_HTTP module ?

2010-05-19 Thread Andrei Dragus
And what do you send? Use ngrep or wireshark.

samoh wrote:
> in the my opensips.log I have this :
>
> May 18 16:46:24 samy-desktop /home/opensips/sbin/opensips[18200]: ACC:
> transaction answered:
> timestamp=1274193984;method=INVITE;from_tag=4126SIPpTag00103;to_tag=;call_id=103-4...@127.0.1.1;code=200;reason=OK
>  
> May 18 16:46:24 samy-desktop /home/opensips/sbin/opensips[18199]:
> ERROR:db_http:put_type_in_result: Unknown datatype 
> May 18 16:46:24 samy-desktop /home/opensips/sbin/opensips[18200]:
> ERROR:db_http:put_type_in_result: Unknown datatype 
> May 18 16:46:24 samy-desktop /home/opensips/sbin/opensips[18201]:
> ERROR:db_http:put_type_in_result: Unknown datatype 
>
> Best regards.
> Sam.
>   

-- 
Andrei Dragus
www.voice-system.ro 


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