[SR-Users] SQL for ordered LCR rules

2017-09-05 Thread Juha Heinanen
Patrick Wakano writes:

> I am trying to ease the management of LCR routing rules, since once we
> begin to have multiple prefixes, multiple GWs and so on, the visualization
> and management of the rules priorities becomes exponentially hard to
> do.

I have written a simple web based interface for LCR configuration.  I
have a Routing page with these kind of rows:

  Callee Prefix  Caller URI Regex  Stop

When I on that page click a Callee Prefix, I get to Gateways page of that
prefix, where I have rows:

  Gateway  Priority  Weight

And when I on that page click a Gateway, I get to a page where all kinds
of inbound and outbound properties of that gw can be configured.

-- Juha

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


Re: [SR-Users] SQL for ordered LCR rules

2017-09-05 Thread Patrick Wakano
Nice! but I think I can invert the test and do it like this: 'FULL_NUMBER'
LIKE CONCAT(lr.prefix,'%')
Probably not as fast but should do the job!


On 6 September 2017 at 12:25, Alex Balashov 
wrote:

> Indeed.
>
> On September 5, 2017 10:24:07 PM EDT, Patrick Wakano 
> wrote:
> >Thanks for the attention Alex, so this "prefix" add on for Postgresql
> >is
> >supposed to replace my lr.prefix SIMILAR TO '(|PREFIX%)' ? So then I
> >could
> >actually use a complete number against the LCR prefixes, instead of
> >having
> >to use a prefix in the test?
> >
> >Cheers,
> >Patrick Wakano
> >
> >
> >
> >On 6 September 2017 at 09:57, Alex Balashov 
> >wrote:
> >
> >> https://github.com/dimitri/prefix
> >
> >>
> >>
> >> Regardless of how many routes you have, you don't want to do it the
> >way
> >> you're doing it. Trust me.
> >>
> >> -- Alex
> >>
> >> On Sep 5, 2017, at 7:54 PM, Patrick Wakano  wrote:
> >>
> >> Thanks for the response guys!
> >> The link https://github.com/dimitri/prefixIt is returning 404
> >> Regarding the performance itself I am not worried since this select
> >it is
> >> just for management and I don't expect having millions of rules.
> >> The idea is just to have an easy way to have a picture of how the LCR
> >will
> >> order and select the gateways based on a given prefix. The three LCR
> >tables
> >> are not so easy to handle and manage from command line so my idea was
> >to
> >> have a single SELECT or VIEW to return me all I need at once!
> >> From what I could check, I think the select I sent pretty much
> >translates
> >> what LCR module does internally, I am just trying to verify if it has
> >some
> >> flaw, which could mislead me in the rules management.
> >>
> >> Cheers,
> >> Patrick Wakano
> >>
> >>
> >> On 6 September 2017 at 00:32, Dmitry Sinina
> >
> >> wrote:
> >>
> >>> https://yeti-switch.org/demo.html
> >>>
> >>>
> >>> On 9/5/17 5:29 PM, Dmitry Sinina wrote:
> >>>
>  And you can try our opensource LCR engine. We use kamailio as load
>  balancer and SEMS as SBC.
> 
>  On 9/5/17 3:02 AM, Patrick Wakano wrote:
> 
> > Hello list,
> >
> > Hope you all doing well!
> > I am trying to ease the management of LCR routing rules, since
> >once we
> > begin to have multiple prefixes, multiple GWs and so on, the
> >visualization
> > and management of the rules priorities becomes exponentially hard
> >to do.
> > So first thing I am trying to achieve is an easy way of retrieving
> >the
> > rules in an ordered manner. I couldn't find any tool to do such
> >thing and
> > source code was not very friendly so I've come up with this
> >Postgresql
> > query that I think retrieves all rules in the same order I expect
> >LCR to
> > select the GWs.
> >
> > SELECT lr.lcr_id, lr.prefix, lrt.priority, lg.gw_name, lg.ip_addr
> > FROM lcr_rule lr
> > JOIN lcr_rule_target lrt ON lrt.lcr_id = lr.lcr_id AND lrt.rule_id
> >=
> > lr.id 
> > JOIN lcr_gw lg ON lg.lcr_id = lr.lcr_id AND lg.id  =
> > lrt.gw_id
> > WHERE lr.enabled = 1 AND lg.defunct = 0 AND lr.lcr_id = ID AND
> > lr.prefix SIMILAR TO '(|PREFIX%)'
> > ORDER BY lr.lcr_id, LENGTH(lr.prefix) DESC, lrt.priority;
> >
> > It is missing the weights calculation, but it is rather complex
> >and I
> > am not using it anyway Other than that does anyone did
> >something
> > similar to check if my query really matches what LCR engine does?
> >
> > Thanks,
> > Patrick Wakano
> >
> > ___
> > 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
> >> sr-users@lists.kamailio.org
> >> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
> >>
> >>
>
>
> -- Alex
>
> --
> Principal, Evariste Systems LLC (www.evaristesys.com)
>
> Sent from my Google Nexus.
>
> ___
> 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] SQL for ordered LCR rules

2017-09-05 Thread Alex Balashov
Indeed. 

On September 5, 2017 10:24:07 PM EDT, Patrick Wakano  wrote:
>Thanks for the attention Alex, so this "prefix" add on for Postgresql
>is
>supposed to replace my lr.prefix SIMILAR TO '(|PREFIX%)' ? So then I
>could
>actually use a complete number against the LCR prefixes, instead of
>having
>to use a prefix in the test?
>
>Cheers,
>Patrick Wakano
>
>
>
>On 6 September 2017 at 09:57, Alex Balashov 
>wrote:
>
>> https://github.com/dimitri/prefix
>
>>
>>
>> Regardless of how many routes you have, you don't want to do it the
>way
>> you're doing it. Trust me.
>>
>> -- Alex
>>
>> On Sep 5, 2017, at 7:54 PM, Patrick Wakano  wrote:
>>
>> Thanks for the response guys!
>> The link https://github.com/dimitri/prefixIt is returning 404
>> Regarding the performance itself I am not worried since this select
>it is
>> just for management and I don't expect having millions of rules.
>> The idea is just to have an easy way to have a picture of how the LCR
>will
>> order and select the gateways based on a given prefix. The three LCR
>tables
>> are not so easy to handle and manage from command line so my idea was
>to
>> have a single SELECT or VIEW to return me all I need at once!
>> From what I could check, I think the select I sent pretty much
>translates
>> what LCR module does internally, I am just trying to verify if it has
>some
>> flaw, which could mislead me in the rules management.
>>
>> Cheers,
>> Patrick Wakano
>>
>>
>> On 6 September 2017 at 00:32, Dmitry Sinina
>
>> wrote:
>>
>>> https://yeti-switch.org/demo.html
>>>
>>>
>>> On 9/5/17 5:29 PM, Dmitry Sinina wrote:
>>>
 And you can try our opensource LCR engine. We use kamailio as load
 balancer and SEMS as SBC.

 On 9/5/17 3:02 AM, Patrick Wakano wrote:

> Hello list,
>
> Hope you all doing well!
> I am trying to ease the management of LCR routing rules, since
>once we
> begin to have multiple prefixes, multiple GWs and so on, the
>visualization
> and management of the rules priorities becomes exponentially hard
>to do.
> So first thing I am trying to achieve is an easy way of retrieving
>the
> rules in an ordered manner. I couldn't find any tool to do such
>thing and
> source code was not very friendly so I've come up with this
>Postgresql
> query that I think retrieves all rules in the same order I expect
>LCR to
> select the GWs.
>
> SELECT lr.lcr_id, lr.prefix, lrt.priority, lg.gw_name, lg.ip_addr
> FROM lcr_rule lr
> JOIN lcr_rule_target lrt ON lrt.lcr_id = lr.lcr_id AND lrt.rule_id
>=
> lr.id 
> JOIN lcr_gw lg ON lg.lcr_id = lr.lcr_id AND lg.id  =
> lrt.gw_id
> WHERE lr.enabled = 1 AND lg.defunct = 0 AND lr.lcr_id = ID AND
> lr.prefix SIMILAR TO '(|PREFIX%)'
> ORDER BY lr.lcr_id, LENGTH(lr.prefix) DESC, lrt.priority;
>
> It is missing the weights calculation, but it is rather complex
>and I
> am not using it anyway Other than that does anyone did
>something
> similar to check if my query really matches what LCR engine does?
>
> Thanks,
> Patrick Wakano
>
> ___
> 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
>> sr-users@lists.kamailio.org
>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>
>>


-- Alex

--
Principal, Evariste Systems LLC (www.evaristesys.com)

Sent from my Google Nexus.

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


Re: [SR-Users] SQL for ordered LCR rules

2017-09-05 Thread Patrick Wakano
Thanks for the attention Alex, so this "prefix" add on for Postgresql is
supposed to replace my lr.prefix SIMILAR TO '(|PREFIX%)' ? So then I could
actually use a complete number against the LCR prefixes, instead of having
to use a prefix in the test?

Cheers,
Patrick Wakano



On 6 September 2017 at 09:57, Alex Balashov 
wrote:

> https://github.com/dimitri/prefix 
>
>
> Regardless of how many routes you have, you don't want to do it the way
> you're doing it. Trust me.
>
> -- Alex
>
> On Sep 5, 2017, at 7:54 PM, Patrick Wakano  wrote:
>
> Thanks for the response guys!
> The link https://github.com/dimitri/prefixIt is returning 404
> Regarding the performance itself I am not worried since this select it is
> just for management and I don't expect having millions of rules.
> The idea is just to have an easy way to have a picture of how the LCR will
> order and select the gateways based on a given prefix. The three LCR tables
> are not so easy to handle and manage from command line so my idea was to
> have a single SELECT or VIEW to return me all I need at once!
> From what I could check, I think the select I sent pretty much translates
> what LCR module does internally, I am just trying to verify if it has some
> flaw, which could mislead me in the rules management.
>
> Cheers,
> Patrick Wakano
>
>
> On 6 September 2017 at 00:32, Dmitry Sinina 
> wrote:
>
>> https://yeti-switch.org/demo.html
>>
>>
>> On 9/5/17 5:29 PM, Dmitry Sinina wrote:
>>
>>> And you can try our opensource LCR engine. We use kamailio as load
>>> balancer and SEMS as SBC.
>>>
>>> On 9/5/17 3:02 AM, Patrick Wakano wrote:
>>>
 Hello list,

 Hope you all doing well!
 I am trying to ease the management of LCR routing rules, since once we
 begin to have multiple prefixes, multiple GWs and so on, the visualization
 and management of the rules priorities becomes exponentially hard to do.
 So first thing I am trying to achieve is an easy way of retrieving the
 rules in an ordered manner. I couldn't find any tool to do such thing and
 source code was not very friendly so I've come up with this Postgresql
 query that I think retrieves all rules in the same order I expect LCR to
 select the GWs.

 SELECT lr.lcr_id, lr.prefix, lrt.priority, lg.gw_name, lg.ip_addr
 FROM lcr_rule lr
 JOIN lcr_rule_target lrt ON lrt.lcr_id = lr.lcr_id AND lrt.rule_id =
 lr.id 
 JOIN lcr_gw lg ON lg.lcr_id = lr.lcr_id AND lg.id  =
 lrt.gw_id
 WHERE lr.enabled = 1 AND lg.defunct = 0 AND lr.lcr_id = ID AND
 lr.prefix SIMILAR TO '(|PREFIX%)'
 ORDER BY lr.lcr_id, LENGTH(lr.prefix) DESC, lrt.priority;

 It is missing the weights calculation, but it is rather complex and I
 am not using it anyway Other than that does anyone did something
 similar to check if my query really matches what LCR engine does?

 Thanks,
 Patrick Wakano

 ___
 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
> 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] SQL for ordered LCR rules

2017-09-05 Thread Alex Balashov
> https://github.com/dimitri/prefix

Regardless of how many routes you have, you don't want to do it the way you're 
doing it. Trust me.

-- Alex

> On Sep 5, 2017, at 7:54 PM, Patrick Wakano  wrote:
> 
> Thanks for the response guys!
> The link https://github.com/dimitri/prefixIt is returning 404
> Regarding the performance itself I am not worried since this select it is 
> just for management and I don't expect having millions of rules.
> The idea is just to have an easy way to have a picture of how the LCR will 
> order and select the gateways based on a given prefix. The three LCR tables 
> are not so easy to handle and manage from command line so my idea was to have 
> a single SELECT or VIEW to return me all I need at once!
> From what I could check, I think the select I sent pretty much translates 
> what LCR module does internally, I am just trying to verify if it has some 
> flaw, which could mislead me in the rules management.
> 
> Cheers,
> Patrick Wakano
> 
> 
>> On 6 September 2017 at 00:32, Dmitry Sinina  
>> wrote:
>> https://yeti-switch.org/demo.html
>> 
>> 
>>> On 9/5/17 5:29 PM, Dmitry Sinina wrote:
>>> And you can try our opensource LCR engine. We use kamailio as load balancer 
>>> and SEMS as SBC.
>>> 
 On 9/5/17 3:02 AM, Patrick Wakano wrote:
 Hello list,
 
 Hope you all doing well!
 I am trying to ease the management of LCR routing rules, since once we 
 begin to have multiple prefixes, multiple GWs and so on, the visualization 
 and management of the rules priorities becomes exponentially hard to do.
 So first thing I am trying to achieve is an easy way of retrieving the 
 rules in an ordered manner. I couldn't find any tool to do such thing and 
 source code was not very friendly so I've come up with this Postgresql 
 query that I think retrieves all rules in the same order I expect LCR to 
 select the GWs.
 
 SELECT lr.lcr_id, lr.prefix, lrt.priority, lg.gw_name, lg.ip_addr
 FROM lcr_rule lr
 JOIN lcr_rule_target lrt ON lrt.lcr_id = lr.lcr_id AND lrt.rule_id = lr.id 
 
 JOIN lcr_gw lg ON lg.lcr_id = lr.lcr_id AND lg.id  = 
 lrt.gw_id
 WHERE lr.enabled = 1 AND lg.defunct = 0 AND lr.lcr_id = ID AND lr.prefix 
 SIMILAR TO '(|PREFIX%)'
 ORDER BY lr.lcr_id, LENGTH(lr.prefix) DESC, lrt.priority;
 
 It is missing the weights calculation, but it is rather complex and I am 
 not using it anyway Other than that does anyone did something similar 
 to check if my query really matches what LCR engine does?
 
 Thanks,
 Patrick Wakano
 
 ___
 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
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] SQL for ordered LCR rules

2017-09-05 Thread Patrick Wakano
Thanks for the response guys!
The link https://github.com/dimitri/prefixIt is returning 404
Regarding the performance itself I am not worried since this select it is
just for management and I don't expect having millions of rules.
The idea is just to have an easy way to have a picture of how the LCR will
order and select the gateways based on a given prefix. The three LCR tables
are not so easy to handle and manage from command line so my idea was to
have a single SELECT or VIEW to return me all I need at once!
>From what I could check, I think the select I sent pretty much translates
what LCR module does internally, I am just trying to verify if it has some
flaw, which could mislead me in the rules management.

Cheers,
Patrick Wakano


On 6 September 2017 at 00:32, Dmitry Sinina 
wrote:

> https://yeti-switch.org/demo.html
>
>
> On 9/5/17 5:29 PM, Dmitry Sinina wrote:
>
>> And you can try our opensource LCR engine. We use kamailio as load
>> balancer and SEMS as SBC.
>>
>> On 9/5/17 3:02 AM, Patrick Wakano wrote:
>>
>>> Hello list,
>>>
>>> Hope you all doing well!
>>> I am trying to ease the management of LCR routing rules, since once we
>>> begin to have multiple prefixes, multiple GWs and so on, the visualization
>>> and management of the rules priorities becomes exponentially hard to do.
>>> So first thing I am trying to achieve is an easy way of retrieving the
>>> rules in an ordered manner. I couldn't find any tool to do such thing and
>>> source code was not very friendly so I've come up with this Postgresql
>>> query that I think retrieves all rules in the same order I expect LCR to
>>> select the GWs.
>>>
>>> SELECT lr.lcr_id, lr.prefix, lrt.priority, lg.gw_name, lg.ip_addr
>>> FROM lcr_rule lr
>>> JOIN lcr_rule_target lrt ON lrt.lcr_id = lr.lcr_id AND lrt.rule_id =
>>> lr.id 
>>> JOIN lcr_gw lg ON lg.lcr_id = lr.lcr_id AND lg.id  =
>>> lrt.gw_id
>>> WHERE lr.enabled = 1 AND lg.defunct = 0 AND lr.lcr_id = ID AND lr.prefix
>>> SIMILAR TO '(|PREFIX%)'
>>> ORDER BY lr.lcr_id, LENGTH(lr.prefix) DESC, lrt.priority;
>>>
>>> It is missing the weights calculation, but it is rather complex and I am
>>> not using it anyway Other than that does anyone did something similar
>>> to check if my query really matches what LCR engine does?
>>>
>>> Thanks,
>>> Patrick Wakano
>>>
>>> ___
>>> 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] real-time update question

2017-09-05 Thread Alex Balashov
On Tue, Sep 05, 2017 at 01:38:50PM -0400, Fred Posner wrote:

> I understand that restarting Kamailio may freak you out... but, it doesn't
> have to.

+1.

> Unless you have something specific running in memory space (such as
> with htables, etc), this means that Kamailio doesn't "remember" any of
> the traffic that it proxies; instead using the information within the
> SIP traffic to route the packets. A restart of the service does not
> have an effect on the routing of this traffic, since the system is not
> using memory to guide the proxying of traffic.

Yep, generally true. The exception would be CANCELs, since they are
hop-by-hop and require state in order to route. Another wrinkle is TCP
state if you use TCP or TLS, obviously.

But in the main, this is absolutely right. Restarting Kamailio isn't
that scary and doesn't inherently cause anything to drop or fail.

-- 
Alex Balashov | Principal | Evariste Systems LLC

Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free) 
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/

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


Re: [SR-Users] real-time update question

2017-09-05 Thread Fred Posner

On 9/5/17 9:41 AM, Stent, Bob wrote:
I am just starting out with Kamailio.  One of the things I want to be 
able to do is add a domain to the configuration and have Kamailio pick 
it up without having to restart.


[snipped]



I understand that restarting Kamailio may freak you out... but, it 
doesn't have to.


Kamailio is a stateless proxy.

Unless you have something specific running in memory space (such as with 
htables, etc), this means that Kamailio doesn't "remember" any of the 
traffic that it proxies; instead using the information within the SIP 
traffic to route the packets. A restart of the service does not have an 
effect on the routing of this traffic, since the system is not using 
memory to guide the proxying of traffic.


--fred

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


[SR-Users] real-time update question

2017-09-05 Thread Stent, Bob
I am just starting out with Kamailio.  One of the things I want to be able to 
do is add a domain to the configuration and have Kamailio pick it up without 
having to restart.
I see there is a runtime update framework but I am having trouble navigating 
the documentation to find out what this actually does for me.
Can somebody point me to the right set of docs to read to figure this out?

Do I simply add an alias to the kamalio.cfg file and somehow send an RPC 
command to Kamalio to re-read configuration?

Bob Stent
Aspect Software
5 Technology Park Drive Suite #9
Westford, MA 01886

This email (including any attachments) is proprietary to Aspect Software, Inc. 
and may contain information that is confidential. If you have received this 
message in error, please do not read, copy or forward this message. Please 
notify the sender immediately, delete it from your system and destroy any 
copies. You may not further disclose or distribute this email or its 
attachments.
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] 5.0 Version compiling gives warning

2017-09-05 Thread Yasin CANER

  
  
hello,
i am on holiday now.
on remote, i can reach at below.
Have a nice day


man vsnprintf
NAME
     printf,  fprintf,  sprintf, snprintf, vprintf, vfprintf,
  vsprintf, vsnprintf - for-
     matted output conversion
  
  SYNOPSIS
     #include 
  
     int printf(const char *format, ...);
     int fprintf(FILE *stream, const char *format, ...);
     int sprintf(char *str, const char *format, ...);
     int snprintf(char *str, size_t size, const char *format,
  ...);
  
     #include 
  
     int vprintf(const char *format, va_list ap);
     int vfprintf(FILE *stream, const char *format, va_list ap);
     int vsprintf(char *str, const char *format, va_list ap);
     int vsnprintf(char *str, size_t size, const char *format,
  va_list ap);
  
     Feature Test Macro Requirements for glibc (see
  feature_test_macros(7)):
  
     snprintf(), vsnprintf(): _BSD_SOURCE || _XOPEN_SOURCE >=
  500 || _ISOC99_SOURCE; or
     cc -std=c99
man snprintf

NAME
     printf,  fprintf,  sprintf, snprintf, vprintf, vfprintf,
  vsprintf, vsnprintf - for-
     matted output conversion
  
  SYNOPSIS
     #include 
  
     int printf(const char *format, ...);
     int fprintf(FILE *stream, const char *format, ...);
     int sprintf(char *str, const char *format, ...);
     int snprintf(char *str, size_t size, const char *format,
  ...);
  
     #include 
  
     int vprintf(const char *format, va_list ap);
     int vfprintf(FILE *stream, const char *format, va_list ap);
     int vsprintf(char *str, const char *format, va_list ap);
     int vsnprintf(char *str, size_t size, const char *format,
  va_list ap);
  
     Feature Test Macro Requirements for glibc (see
  feature_test_macros(7)):
  
     snprintf(), vsnprintf(): _BSD_SOURCE || _XOPEN_SOURCE >=
  500 || _ISOC99_SOURCE; or
     cc -std=c99
  


4.09.2017 11:22 tarihinde
  Daniel-Constantin Mierla yazdı:


  
  Hello,
  can you do man vsnprintf or man snprintf and see if it lists
special #include or #define? On macos and debian all compiles
fine, no warnings.
  
  Cheers,
  Daniel
  
  On 31.08.17 08:18, Yasin CANER wrote:
  
  

Hello,
    Compiling
branch 5.0 gives error as below.
Thanks
  
Centos 6.5
Linux  
2.6.32-431.17.1.el6.x86_64 #1 SMP Wed May 7 23:32:49 UTC
2014 x86_64 x86_64 x86_64 GNU/Linux
gcc (GCC) 4.4.7
20120313 (Red Hat 4.4.7-18)

WARNING:
  CC (gcc) [M xmlrpc.so]  xmlrpc.o
  xmlrpc.c: In function ‘set_fault’:
  xmlrpc.c:888: warning: implicit declaration of function
  ‘vsnprintf’
  xmlrpc.c: In function ‘print_value’:
  xmlrpc.c:1018: warning: implicit declaration of function
  ‘snprintf’
  xmlrpc.c:1018: warning: incompatible implicit declaration of
  built-in function ‘snprintf’
  
  -- 
  

  

  


  
  


  
  

  

  

  
  

  

  

  

  

  




___
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 - www.asipto.com
Kamailio World Conference - www.kamailioworld.com


-- 
  
  
  
  

  

  



  
  

  Yasin CANER
  Communication Tech Engineer
  0850 303 0 303 / 0312 911 0 911
  www.netgsm.com.tr

  
  

  

  

  


Re: [SR-Users] Dialplan Module

2017-09-05 Thread Nelson Migliaro
Do you know if it is possible to use more than one value un attributes
(attrs) in dial plan module?

As an example, instead of using:
modparam("dialplan", "attrs_pvar", "$var(variable1)")

= 9 > attrs (value in database field)

xlog("L_NOTICE","variable 1 value is: $var(variable1) \n");

use something like:
modparam("dialplan", "attrs_pvar", "$var(variable1); $var(variable2)")

= 9; 8 > attrs (value in database field)

xlog("L_NOTICE","variable 1 value is: $var(variable1) \n");
xlog("L_NOTICE","variable 2 value is: $var(variable2) \n");

Thank you

Nelson.-





2017-09-05 17:38 GMT+02:00 Nelson Migliaro :

> Hello,
>
> Do you know if its possible to
>
>
>
>
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Dialplan Module

2017-09-05 Thread Antony Stone
On Tuesday 05 September 2017 at 17:38:31, Nelson Migliaro wrote:

> Hello,
> 
> Do you know if its possible to

Sometimes it is, yes :)


Antony.

-- 
Never automate fully anything that does not have a manual override capability. 
Never design anything that cannot work under degraded conditions in emergency.

   Please reply to the list;
 please *don't* CC me.

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


[SR-Users] Dialplan Module

2017-09-05 Thread Nelson Migliaro
Hello,

Do you know if its possible to
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Problem implementing usrloc via dmq

2017-09-05 Thread Charles Chance
Hi,

Glad you solved it - omitting the call to dmq_handle_message() appears to
be a common mistake. I may try to make it clearer in the docs that things
will not work as expected if this is not included.

As for the dialog/dmq integration, I've not had a chance to test it myself.
I will try to take a look later this week!

Cheers,

Charles

On 5 September 2017 at 16:09, Aleksandar Sosic 
wrote:

> Hi Charles,
>
> I did solve the problem with
>
> if(is_method("KDMQ")) {
> dmq_handle_message();
> }
>
> in the main route and the dmq_usrloc is working now.
>
> I enabled dmq for the dialog also:
> modparam("dialog", "enable_dmq", 1)
>
> and the dmq is working between kamailio instances but the call does
> not end and the kamailio instance where the call was made crashes.
>
> sr01.evox.it| 30(38) CRITICAL:  [core/pass_fd.c:277]:
> receive_fd(): EOF on 24
> sr01.evox.it|  0(8) ALERT:  [main.c:742]: handle_sigs():
> child process 18 exited by a signal 11
> sr01.evox.it|  0(8) ALERT:  [main.c:745]: handle_sigs():
> core was generated
> sr01.evox.it|  0(8) INFO:  [main.c:768]: handle_sigs():
> terminating due to SIGCHLD
> sr01.evox.it|  1(9) INFO:  [main.c:823]: sig_usr(): signal 15
> received
> sr01.evox.it| 20(28) INFO:  [main.c:823]: sig_usr(): signal
> 15 received
> sr01.evox.it| 11(19) INFO:  [main.c:823]: sig_usr(): signal
> 15 received
>
> I have also done a gdb on the core dump:
> root@sr01:/tmp/sr01# gdb /usr/sbin/kamailio ./core
> GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
> Copyright (C) 2016 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later  html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "x86_64-linux-gnu".
> Type "show configuration" for configuration details.
> For bug reporting instructions, please see:
> .
> Find the GDB manual and other documentation resources online at:
> .
> For help, type "help".
> Type "apropos word" to search for commands related to "word"...
> Reading symbols from /usr/sbin/kamailio...(no debugging symbols
> found)...done.
> [New LWP 8]
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
> Core was generated by `/usr/sbin/kamailio -f
> /etc/kamailio/kamailio.cfg -DD -E -e -w /tmp/sr01'.
> Program terminated with signal SIGABRT, Aborted.
> #0  0x7f9403a3f428 in __GI_raise (sig=sig@entry=6) at
> ../sysdeps/unix/sysv/linux/raise.c:54
> 54  ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
>
> But cannot manage to solve the issue now.
>
> NB. I have this order of modules loades:
> ...
> loadmodule "dmq.so"
> loadmodule "dmq_usrloc.so"
>
> loadmodule "htable.so"
>
> loadmodule "dialog.so"
> ...
>
> # - dialog params -
> # modparam("dialog", "db_url", DBURL)
> modparam("dialog", "default_timeout", 10800)
> modparam("dialog", "profiles_with_value", "calllimit")
> modparam("dialog", "enable_stats", 1)
> modparam("dialog", "db_mode", 0)
> modparam("dialog", "dlg_flag", FLT_DLG)
> modparam("dialog", "enable_dmq", 1)
> ...
>
>
> Do you have any hints?
>
> Thanks in advance,
> --
> Aleksandar Sosic
> mail: alex.so...@timenet.it
> skype: alex.sosic
> cell: +385 91 2505 146
>
>
> On Mon, Sep 4, 2017 at 10:47 AM, Charles Chance
>  wrote:
> > Hello,
> >
> > Sorry for slow reply.
> >
> > Can you set debug=4 and send the output from startup through to register,
> > for both nodes?
> >
> > Also the full config would be useful, or at least the default request
> route
> > up to your call to dmq_handle_message().
> >
> > Cheers,
> >
> > Charles
>
> ___
> Kamailio (SER) - Users Mailing List
> sr-users@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>

-- 
Sipcentric Ltd. Company registered in England & Wales no. 7365592. Registered 
office: Faraday Wharf, Innovation Birmingham Campus, Holt Street, 
Birmingham Science Park, Birmingham B7 4BB.
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Problem implementing usrloc via dmq

2017-09-05 Thread Aleksandar Sosic
Hi Charles,

I did solve the problem with

if(is_method("KDMQ")) {
dmq_handle_message();
}

in the main route and the dmq_usrloc is working now.

I enabled dmq for the dialog also:
modparam("dialog", "enable_dmq", 1)

and the dmq is working between kamailio instances but the call does
not end and the kamailio instance where the call was made crashes.

sr01.evox.it| 30(38) CRITICAL:  [core/pass_fd.c:277]:
receive_fd(): EOF on 24
sr01.evox.it|  0(8) ALERT:  [main.c:742]: handle_sigs():
child process 18 exited by a signal 11
sr01.evox.it|  0(8) ALERT:  [main.c:745]: handle_sigs():
core was generated
sr01.evox.it|  0(8) INFO:  [main.c:768]: handle_sigs():
terminating due to SIGCHLD
sr01.evox.it|  1(9) INFO:  [main.c:823]: sig_usr(): signal 15 received
sr01.evox.it| 20(28) INFO:  [main.c:823]: sig_usr(): signal
15 received
sr01.evox.it| 11(19) INFO:  [main.c:823]: sig_usr(): signal
15 received

I have also done a gdb on the core dump:
root@sr01:/tmp/sr01# gdb /usr/sbin/kamailio ./core
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/sbin/kamailio...(no debugging symbols found)...done.
[New LWP 8]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `/usr/sbin/kamailio -f
/etc/kamailio/kamailio.cfg -DD -E -e -w /tmp/sr01'.
Program terminated with signal SIGABRT, Aborted.
#0  0x7f9403a3f428 in __GI_raise (sig=sig@entry=6) at
../sysdeps/unix/sysv/linux/raise.c:54
54  ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.

But cannot manage to solve the issue now.

NB. I have this order of modules loades:
...
loadmodule "dmq.so"
loadmodule "dmq_usrloc.so"

loadmodule "htable.so"

loadmodule "dialog.so"
...

# - dialog params -
# modparam("dialog", "db_url", DBURL)
modparam("dialog", "default_timeout", 10800)
modparam("dialog", "profiles_with_value", "calllimit")
modparam("dialog", "enable_stats", 1)
modparam("dialog", "db_mode", 0)
modparam("dialog", "dlg_flag", FLT_DLG)
modparam("dialog", "enable_dmq", 1)
...


Do you have any hints?

Thanks in advance,
--
Aleksandar Sosic
mail: alex.so...@timenet.it
skype: alex.sosic
cell: +385 91 2505 146


On Mon, Sep 4, 2017 at 10:47 AM, Charles Chance
 wrote:
> Hello,
>
> Sorry for slow reply.
>
> Can you set debug=4 and send the output from startup through to register,
> for both nodes?
>
> Also the full config would be useful, or at least the default request route
> up to your call to dmq_handle_message().
>
> Cheers,
>
> Charles

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


Re: [SR-Users] rtpengine - optional srtp

2017-09-05 Thread Daniel-Constantin Mierla


On 05.09.17 16:08, Richard Fuchs wrote:
> On 09/05/2017 02:32 AM, Daniel-Constantin Mierla wrote:
>> Hello,
>>
>> wondering if anyone has a quick answer to spare some time searching the
>> web or source code -- is there a way to offer optional SRTP (just SDES
>> is also fine) in SDP with RTPEngine? The use case is when the target
>> device is not yet known to support (or not) SRTP.
>>
>> There are couple of ways in specs or practices (e.g., RFC5939/6871, or
>> advertising crypto attributes on RTP/AVP stream, or offering two streams
>> one RTP and one SRTP), I am looking to find if it is possible to do it
>> with RTPEngine and which of the options are supported/what are the
>> parameters for doing it...
>
> That's not currently supported (neither as an offerer nor as an
> accepter). AFAIK the usual mantra is to offer SRTP first and then
> fallback to RTP when a "not supported" (415) is received.
>
> However, it shouldn't be too hard to implement if there's a specific
> use case.
Thanks for the info.

The use case is to do 'best possible' secure communication, in the way
that SRTP is offered, but call should not fail if not supported. Doing
re-routing on 415 could be a solution, however, I met the situation when
the call was accepted but then now audio was heard. It may be a broken
UA after wall.

Anyhow, if it is easy to add and you have some spare time at some point,
it would simplify doing best possible secure session.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - www.asipto.com
Kamailio World Conference - 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] SQL for ordered LCR rules

2017-09-05 Thread Alex Balashov
On Tue, Sep 05, 2017 at 05:26:04PM +0300, Dmitry Sinina wrote:

> Hi. You could use prefix_range indexing in postgresql for fast longest
> match lookup https://github.com/dimitri/prefixIt works pretty fast on
> millions routes for us.

+1.

-- 
Alex Balashov | Principal | Evariste Systems LLC

Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free) 
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/

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


Re: [SR-Users] SQL for ordered LCR rules

2017-09-05 Thread Dmitry Sinina

Hi. You could use prefix_range indexing in postgresql for fast longest match 
lookup https://github.com/dimitri/prefixIt works pretty fast on millions routes 
for us.

On 9/5/17 3:02 AM, Patrick Wakano wrote:

Hello list,

Hope you all doing well!
I am trying to ease the management of LCR routing rules, since once we begin to 
have multiple prefixes, multiple GWs and so on, the visualization and 
management of the rules priorities becomes exponentially hard to do.
So first thing I am trying to achieve is an easy way of retrieving the rules in an ordered manner. I couldn't find any tool to do such thing and source code was not very friendly so I've come up with this Postgresql query that I think retrieves all rules in the same order I expect LCR to select 
the GWs.


SELECT lr.lcr_id, lr.prefix, lrt.priority, lg.gw_name, lg.ip_addr
FROM lcr_rule lr
JOIN lcr_rule_target lrt ON lrt.lcr_id = lr.lcr_id AND lrt.rule_id = lr.id 

JOIN lcr_gw lg ON lg.lcr_id = lr.lcr_id AND lg.id  = lrt.gw_id
WHERE lr.enabled = 1 AND lg.defunct = 0 AND lr.lcr_id = ID AND lr.prefix 
SIMILAR TO '(|PREFIX%)'
ORDER BY lr.lcr_id, LENGTH(lr.prefix) DESC, lrt.priority;

It is missing the weights calculation, but it is rather complex and I am not 
using it anyway Other than that does anyone did something similar to check 
if my query really matches what LCR engine does?

Thanks,
Patrick Wakano

___
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] rtpengine - optional srtp

2017-09-05 Thread Richard Fuchs

On 09/05/2017 02:32 AM, Daniel-Constantin Mierla wrote:

Hello,

wondering if anyone has a quick answer to spare some time searching the
web or source code -- is there a way to offer optional SRTP (just SDES
is also fine) in SDP with RTPEngine? The use case is when the target
device is not yet known to support (or not) SRTP.

There are couple of ways in specs or practices (e.g., RFC5939/6871, or
advertising crypto attributes on RTP/AVP stream, or offering two streams
one RTP and one SRTP), I am looking to find if it is possible to do it
with RTPEngine and which of the options are supported/what are the
parameters for doing it...


That's not currently supported (neither as an offerer nor as an 
accepter). AFAIK the usual mantra is to offer SRTP first and then 
fallback to RTP when a "not supported" (415) is received.


However, it shouldn't be too hard to implement if there's a specific use 
case.


Cheers

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


Re: [SR-Users] issue when trying to start kamailio using db_postgres and dialplan modules

2017-09-05 Thread David Escartín

hello all

sorry for the delay about this issue, issue is fixed when you install 
the postgres 9 libraries


thanks a lot and regards
david


El 31/07/17 a las 18:34, David Escartín escribió:

hello all

we are having an issue when trying to start kamailio using these 
modules and a kamailio version higher than 4.2


we install libpq5 and libpq-dev and we always have this error

 0(10800) ERROR:  [core/sr_module.c:582]: load_module(): could 
not open module 
: 
/usr/local/kamailio-5.0/lib64/kamailio/modules/db_postgres.so: 
undefined symbol: PQconnectdbParams


do you know which lib or packet would we miss? we are trying to 
install it on centos6, ubuntu 10 or centos7


best regards
david



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


Re: [SR-Users] Incorrect value when setting number like values in Htable using Kamcmd

2017-09-05 Thread Tony - Telecomy
Prefixing the numbers with "s:" fixed the issue.

Thank you for your help.

Tony


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


Re: [SR-Users] crash after using async_route()

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

does it happen to have the pcap (or ngrep) with the sip traffic for the
call? It will be useful to see the flow with
requests/replies/retransmissions and their timestamps...

Is this version the snapshot of 5.0.2 release or a build from branch 5.0?

Cheers,
Daniel


On 05.09.17 10:01, Vitaliy Aleksandrov wrote:
> Hello kamailio list,
>
> Recently found a problem in my configuration that uses async_route()
> functionality.
> It crashes after several calls when wait_timer fires.
>
> #0  0xb74a8556 in raise () from /lib/libc.so.6
> #1  0xb74a9d78 in abort () from /lib/libc.so.6
> #2  0x08293ae2 in qm_free (qmp=0xad65d000, p=0x3d64692d,
> file=0xb6216a16 "tm: h_table.c", func=0xb621663c <__FUNCTION__.18751>
> "free_cell_helper", line=187, mname=0xb621664d "tm") at
> core/mem/q_malloc.c:471
> #3  0xb613f103 in free_cell_helper (dead_cell=0xae2cd210, silent=0,
> fname=0xb6239ea5 "timer.c", fline=655) at h_table.c:187
> #4  0xb61e7758 in wait_handler (ti=557858937, wait_tl=0xae2cd258,
> data=0xae2cd210) at timer.c:655
> #5  0x0826a2cc in timer_list_expire (t=557858937, h=0xad6b9668,
> slow_l=0xad6ba144, slow_mark=312) at core/timer.c:874
> #6  0x08267cb1 in timer_handler () at core/timer.c:939
> #7  0x0826a4d3 in timer_main () at core/timer.c:978
> #8  0x08069575 in main_loop () at main.c:1721
> #9  0x080707ca in main (argc=11, argv=0xbf85f044) at main.c:2723
>
> When crash happens, kamailio prints the following message:
> Sep  4 16:15:38 [18938]: :  [core/mem/q_malloc.c:469]:
> qm_free(): BUG: qm_free: bad pointer 0x70707553 (out of memory block!)
> called from tm: h_table.c: free_cell_helper(187) - aborting
>
> Also had a few crashes in retransmission_handler():
>
> #0  0xb750b556 in raise () from /lib/libc.so.6
> #1  0xb750cd78 in abort () from /lib/libc.so.6
> #2  0xb6249b5a in retransmission_handler (r_buf=0xae036674) at timer.c:367
> #3  0xb6247558 in retr_buf_handler (ticks=123446, tl=0xae036688,
> p=0x1f40) at timer.c:594
> #4  0x0826a2cc in timer_list_expire (t=123446, h=0xad71c668,
> slow_l=0xad71cd44, slow_mark=2232) at core/timer.c:874
> #5  0x08267cb1 in timer_handler () at core/timer.c:939
> #6  0x0826a4d3 in timer_main () at core/timer.c:978
> #7  0x08069575 in main_loop () at main.c:1721
> #8  0x080707ca in main (argc=11, argv=0xbff64134) at main.c:2723
>
> ERROR: tm [timer.c:366]: retransmission_handler(): transaction
> 0xae0365e0 scheduled for deletion and called from RETR timer (flags 6d)
>
> Both timers fired for an INVITE transaction that was previously
> suspended by async_route(), then resumed, sent out and received a 4xx
> reply (407).
>
> This configuration worked fine with kamailio 4.2.x and problem
> appeared after upgrading to 5.0.2.
>
> Trying to figure out how to narrow down the problem. Any input is
> appreciated.
>
>
> ___
> 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 - www.asipto.com
Kamailio World Conference - 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] Incorrect value when setting number like values in Htable using Kamcmd

2017-09-05 Thread Daniel-Constantin Mierla


On 05.09.17 09:53, Sebastian Damm wrote:
> Hi,
>
> On Tue, Sep 5, 2017 at 8:37 AM, Tony - Telecomy  wrote:
>> I'm having an issue setting phone numbers values in htable using kamcmd when
>> the phone number is above the integer range 2147483647.
>>
>> Initially I planned to set the values as strings but this is not working as
>> expected as well.
> I think, Daniel answered that a few days ago in another thread, and it
> is written somewhere in the Kamailio wiki, if you want to set strings
> with number-like values, prefixing them with "s:" helps kamcmd
> understand you really want to set a string.
... and for reference the link to FAQ:

  -
https://www.kamailio.org/wiki/tutorials/faq/main#kamcmd_sometime_fails_to_execu
Cheers,
Daniel

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - www.asipto.com
Kamailio World Conference - 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] Cost deduction in kamailio

2017-09-05 Thread Logeshwaran G
Hi ,

I have tried the Cnxcc to deduct the credit amount and its working fine.
Please find the below logs in kamailio -ddd mode.

10(19003) DEBUG: cnxcc [cnxcc_check.c:85]: check_calls_by_money(): CID
[4vL4DJsLpRSfwoMaJVbegWBLWy7k7-UP], start_timestamp [1504598301], seconds
alive [36], consumed credit [20.00]
10(19003) DEBUG: cnxcc [cnxcc_check.c:107]: check_calls_by_money(): Client
[] | Ended-Calls-Credit-Spent: 0.00  TotalCredit/MaxCredit:
20.00/30.00
10(19003) DEBUG: cnxcc [cnxcc_check.c:85]: check_calls_by_money(): CID
[4vL4DJsLpRSfwoMaJVbegWBLWy7k7-UP], start_timestamp [1504598301], seconds
alive [37], consumed credit [20.00]
10(19003) DEBUG: cnxcc [cnxcc_check.c:107]: check_calls_by_money(): Client
[] | Ended-Calls-Credit-Spent: 0.00  TotalCredit/MaxCredit:
20.00/30.00


But Through Sql query how can I get the Deducted Value.. For Example in my
case, in the above kamailio log, Total Credit Spent is 20.00, Where this
values are storing in Database. Please Guide me

Thanks & Kind Regards,
Logeshwaran G

On Wed, Aug 30, 2017 at 2:12 PM, Logeshwaran G 
wrote:

> Ok let me try it out!
>
> Will add the sqlops query module in the event route!
>
> Thanks
>
> Thanks & Kind Regards,
> Logeshwaran G
>
> On Wed, Aug 30, 2017 at 2:09 PM, Federico Cabiddu <
> federico.cabi...@gmail.com> wrote:
>
>> Hi,
>> I told you previously hat you have to use sql_ops to actually do the
>> update of the balance after calculating the call cost using the dialog
>> variables.
>>
>> Cheers,
>>
>> Federico
>>
>>
>>
>> On Wed, Aug 30, 2017 at 10:34 AM, Logeshwaran G 
>> wrote:
>>
>>> As per your Input I have changed the Variables to dialog variables, But
>>> I dont know what to add in event route.
>>>
>>> Thanks & Kind Regards,
>>> Logeshwaran G
>>>
>>> On Wed, Aug 30, 2017 at 2:00 PM, Federico Cabiddu <
>>> federico.cabi...@gmail.com> wrote:
>>>
 Hi,
 did you read this comment in the event_route?

 # perform some kind of notification, database update, email sending,
 etc.

 Have you put any logic to do the accounting there (as I suggested)?

 Regards,

 Federico

 On Wed, Aug 30, 2017 at 9:50 AM, Logeshwaran G >>> > wrote:

> Hi,
>
> I am using the below scenario : but there is no cost deduction
> happening , Correct me if I am wrong.
>
> route[CNXCC]
> {
> $dlg_var(subscriber)= $fU;
> $dlg_var(customer_id)   = "customer-" + $fU;
> $dlg_var(initial_p) = "1";
> $dlg_var(final_p)   = "1";
> $dlg_var(cps)   = "1"; ;
> $var(minbal) = 1;
> $var(ret) = avp_db_query("SELECT credits FROM subscriber where
> username='$fU'", "$avp(s:credits)");
> xlog("L_WARN", "CNXCC: var(ret)=$var(ret)
> avp(s:credits)=$avp(s:credits)\n");
> #if(!cnxcc_set_max_credit("$var(customer)",
> "$avp(s:credits)", "$var(cps)", "$var(initial_p)", "$var(final_p)"))
> if(!cnxcc_set_max_credit("$dlg_var(subscriber)",
> "$avp(s:credits)", "$dlg_var(cps)", "$dlg_var(initial_p)",
> "$dlg_var(final_p)"))
> {
> xlog("Error setting up credit control");
> sl_reply_error();
> exit;
>
> }
> if ($avp(s:credits)<  $var(minbal)){
> xlog("L_ALERT", "ALERT: Credit balance is low, sent
> 403:Forbidden. required=$var(minbal)\n");
> sl_send_reply("403", "Forbidden: Low balance");
> drop;
>
> }
> }
>
> event_route[cnxcc:call-shutdown]
> {
> xlog("L_ALERT", "event_route:cnxcc: [$ci]: call killed");
>
> # perform some kind of notification, database update, email
> sending, etc.
> }
>
> Thanks & Kind Regards,
> Logeshwaran G
>
> On Wed, Aug 30, 2017 at 11:40 AM, Aqs Younas 
> wrote:
>
>> This might help you.
>> https://github.com/caruizdiaz/cnxcc-example?files=1
>>
>> On 30 Aug 2017 11:09 am, "Logeshwaran G" 
>> wrote:
>>
>>> Thanks Federico! Will try it out.
>>>
>>> Thanks & Kind Regards,
>>> Logeshwaran G
>>>
>>> On Wed, Aug 30, 2017 at 11:34 AM, Federico Cabiddu <
>>> federico.cabi...@gmail.com> wrote:
>>>
 Hi,
 yes it's correct, but if you want to deduct the cost at the end of
 the call you should use dlg_var to store cps etc.

 Regards,

 Federico

 On Wed, Aug 30, 2017 at 7:16 AM, Logeshwaran G <
 logeshwara...@gmail.com> wrote:

> Hi,
>
> Is this the correct way of using the CNXCC for cost deduction,
> Guide me please.
>
> route[CNXCC]
> {
> $var(customer) = $fU;
>   

[SR-Users] crash after using async_route()

2017-09-05 Thread Vitaliy Aleksandrov
Hello kamailio list,

Recently found a problem in my configuration that uses async_route()
functionality.
It crashes after several calls when wait_timer fires.

#0  0xb74a8556 in raise () from /lib/libc.so.6
#1  0xb74a9d78 in abort () from /lib/libc.so.6
#2  0x08293ae2 in qm_free (qmp=0xad65d000, p=0x3d64692d, file=0xb6216a16
"tm: h_table.c", func=0xb621663c <__FUNCTION__.18751> "free_cell_helper",
line=187, mname=0xb621664d "tm") at core/mem/q_malloc.c:471
#3  0xb613f103 in free_cell_helper (dead_cell=0xae2cd210, silent=0,
fname=0xb6239ea5 "timer.c", fline=655) at h_table.c:187
#4  0xb61e7758 in wait_handler (ti=557858937, wait_tl=0xae2cd258,
data=0xae2cd210) at timer.c:655
#5  0x0826a2cc in timer_list_expire (t=557858937, h=0xad6b9668,
slow_l=0xad6ba144, slow_mark=312) at core/timer.c:874
#6  0x08267cb1 in timer_handler () at core/timer.c:939
#7  0x0826a4d3 in timer_main () at core/timer.c:978
#8  0x08069575 in main_loop () at main.c:1721
#9  0x080707ca in main (argc=11, argv=0xbf85f044) at main.c:2723

When crash happens, kamailio prints the following message:
Sep  4 16:15:38 [18938]: :  [core/mem/q_malloc.c:469]: qm_free():
BUG: qm_free: bad pointer 0x70707553 (out of memory block!) called from tm:
h_table.c: free_cell_helper(187) - aborting

Also had a few crashes in retransmission_handler():

#0  0xb750b556 in raise () from /lib/libc.so.6
#1  0xb750cd78 in abort () from /lib/libc.so.6
#2  0xb6249b5a in retransmission_handler (r_buf=0xae036674) at timer.c:367
#3  0xb6247558 in retr_buf_handler (ticks=123446, tl=0xae036688,
p=0x1f40) at timer.c:594
#4  0x0826a2cc in timer_list_expire (t=123446, h=0xad71c668,
slow_l=0xad71cd44, slow_mark=2232) at core/timer.c:874
#5  0x08267cb1 in timer_handler () at core/timer.c:939
#6  0x0826a4d3 in timer_main () at core/timer.c:978
#7  0x08069575 in main_loop () at main.c:1721
#8  0x080707ca in main (argc=11, argv=0xbff64134) at main.c:2723

ERROR: tm [timer.c:366]: retransmission_handler(): transaction 0xae0365e0
scheduled for deletion and called from RETR timer (flags 6d)

Both timers fired for an INVITE transaction that was previously suspended
by async_route(), then resumed, sent out and received a 4xx reply (407).

This configuration worked fine with kamailio 4.2.x and problem appeared
after upgrading to 5.0.2.

Trying to figure out how to narrow down the problem. Any input is
appreciated.
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Incorrect value when setting number like values in Htable using Kamcmd

2017-09-05 Thread Sebastian Damm
Hi,

On Tue, Sep 5, 2017 at 8:37 AM, Tony - Telecomy  wrote:
> I'm having an issue setting phone numbers values in htable using kamcmd when
> the phone number is above the integer range 2147483647.
>
> Initially I planned to set the values as strings but this is not working as
> expected as well.

I think, Daniel answered that a few days ago in another thread, and it
is written somewhere in the Kamailio wiki, if you want to set strings
with number-like values, prefixing them with "s:" helps kamcmd
understand you really want to set a string.

HTH
Sebastian

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