[SR-Users] TLS testing (with sipp)

2019-12-18 Thread Sebastian Damm
Hi,

I'm trying to construct an end-to-end encrypted signalling test
through our setup. I thought I could use sipp for that, as it supports
TLS according to the man page. However, when I try to run it, I get
this error:

FI_init_ssl_context: SSL_CTX_use_certificate_file failed.

I searched the web; however, all similar questions end up without
answers. I tried specifying a local key and cert without success. I'd
think I should not need a cert for my client, though.

Has anyone ever successfully conducted an automated TLS test? I'm open
to using a different tool if necessary.

Thanks for all hints or examples.

Regards,
Sebastian

-- 
Sebastian Damm
Voice Engineer
__
sipgate GmbH
Gladbacher Straße 74 | 40219 Düsseldorf

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


Re: [SR-Users] TLS testing (with sipp)

2019-12-19 Thread Sebastian Damm
Hi Julien,

I had been thinking quite a while before posting it here, and maybe I
shouldn't have mentioned the sipp SSL error. But I thought, end2end
testing of kamailio setups could be of general interest from a
Kamailio user point of view. And I hoped to get suggestions on how to
do it.

Thanks for the link to voip_patrol. I'm already playing with it. Still
stuck with needing a client certificate, though. I shouldn't need that
for a client, I'd think. But I'll try my best.

Regards,
Sebastian

On Wed, Dec 18, 2019 at 7:31 PM Julien Chavanton  wrote:
>
> Hi Sebastian, this is off topic for the Kamailio mailing list.
>
> You can use Voip_patrol :
> https://github.com/jchavanton/voip_patrol
>
> Once you have your certificate, key and ca_list in default location
> ./voip_patrol -c ./xml/tls.xml
>
> [18:24:51.800][INFO] main: TLS tcfg.tlsConfig.ca_list  :tls/ca_list.pem
> [18:24:51.800][INFO] main: TLS tcfg.tlsConfig.certFile 
> :tls/certificate.pem
> [18:24:51.800][INFO] main: TLS tcfg.tlsConfig.privKeyFile  :tls/key.pem
>
> tls.xml
>
> 
> 
> 
>  username="VP_ENV_USERNAME" password="VP_ENV_PASSWORD" realm="domain.com" 
> registrar="ep.domain.com"/>
> 
>  hangup="5"/>
>  wait_until="3" expected_cause_code="200"
> caller="12062349971@1.1.1.1" callee="12012343...@ep.domain.com" 
> max_duration="15" hangup="5"
> username="VP_ENV_USERNAME" password="VP_ENV_PASSWORD" 
> realm="domain.com"
> />
> 
> 
> 
>
> On Wed, Dec 18, 2019 at 8:34 AM Sebastian Damm  wrote:
>>
>> Hi,
>>
>> I'm trying to construct an end-to-end encrypted signalling test
>> through our setup. I thought I could use sipp for that, as it supports
>> TLS according to the man page. However, when I try to run it, I get
>> this error:
>>
>> FI_init_ssl_context: SSL_CTX_use_certificate_file failed.
>>
>> I searched the web; however, all similar questions end up without
>> answers. I tried specifying a local key and cert without success. I'd
>> think I should not need a cert for my client, though.
>>
>> Has anyone ever successfully conducted an automated TLS test? I'm open
>> to using a different tool if necessary.
>>
>> Thanks for all hints or examples.
>>
>> Regards,
>> Sebastian
>>
>> --
>> Sebastian Damm
>> Voice Engineer
>> __
>> sipgate GmbH
>> Gladbacher Straße 74 | 40219 Düsseldorf
>>
>> ___
>> 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



-- 
Sebastian Damm
Voice Engineer

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


[SR-Users] Parallel forking and rtpengine handling

2020-01-22 Thread Sebastian Damm
Hi,

our scenario is the following: We have two clients registered to our
Kamailio server, one with a TLS capable phone, one via websocket. Now,
when a call comes in, the call is forked and is sent out to both
clients. rtpengine handling is done in the branch route, so there are
two offers, and we use the "via-branch" parameter.

Now, when one branch answers the call, what happens to the other
branch? I there a way to delete the other branch? How and in which
route? Or does Kamailio do this automatically?

I'm happy for a hint.

Regards,
Sebastian

-- 
Sebastian Damm
Voice Engineer
__
sipgate GmbH

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


Re: [SR-Users] Parallel forking and rtpengine handling

2020-01-23 Thread Sebastian Damm
Hi,

On Wed, Jan 22, 2020 at 8:29 PM Daniel-Constantin Mierla
 wrote:
> A remark for kamailio transaction states point of view: in failure route the 
> entire transaction is in failed state, so there is not active branch, so at 
> that point it should delete all (previous) rtpengine sessions/branches.

This is what I had in mind. I don't think I end up in failure route if
one branch is answered. My Question was, how to handle the canceled
branch.

> As I got it, the use of via-branch flag for deleting a session makes sense in 
> event route for branch-failure, when other branches can still be active or 
> one was answered.

Do branches that get cancelled due to another branch answering the
call go through the branch failure route?

> Also in the case of parallel forking, if via-branch is not give to rtpengine 
> offer command, does the 2nd (and the next) rtpengine offer command overwrite 
> the previous one, so the rtpengine keeps only the data from the last one?

We stumbled upon this problem only because we used rtpengine without
the branch parameter. And what we saw was that the second
rtpengine_offer overwrote the first one, making the first branch
impossible to be answered in certain scenarios.

Regards and thanks for all the answers so far.
Sebastian

-- 
Sebastian Damm
Voice Engineer
__
sipgate GmbH
Gladbacher Straße 74 | 40219 Düsseldorf

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


[SR-Users] Same Via Tag for INVITE and ACK on S/L loadbalancer

2020-02-10 Thread Sebastian Damm
Hi,

I stumbled upon an interop problem with a carrier. We have the
following scenario:

Gateway --> Loadbalancer --> Carrier

The loadbalancer generates a Via header for each request. But since it
is stateless, the Via tag is generated for each request. As a
consequence, the Via tag in the ACK differs from the one in the
INVITE. And one carrier doesn't handle those ACKs if the Via tag
differs.

Is there a way to force the creation of a "deterministic" Via branch
tag? For example, building it from a hash over call-id and from-tag or
something like that?

Thanks in advance
Sebastian

-- 
Sebastian Damm
Voice Engineer
__
sipgate GmbH

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


Re: [SR-Users] Same Via Tag for INVITE and ACK on S/L loadbalancer

2020-02-10 Thread Sebastian Damm
Hi,

actually, our only problem is handling negative replies. The ACK
belongs to the same transaction and therefore has to carry the same
Via branch ID.

Sebastian

On Mon, Feb 10, 2020 at 3:50 PM Yuriy Gorlichenko  wrote:
>
> ACK for successull response is a new transaction. It has to be different. May 
> be it is better to point provider to this?
>
> On Mon, 10 Feb 2020, 14:26 Sebastian Damm,  wrote:
>>
>> Hi,
>>
>> I stumbled upon an interop problem with a carrier. We have the
>> following scenario:
>>
>> Gateway --> Loadbalancer --> Carrier
>>
>> The loadbalancer generates a Via header for each request. But since it
>> is stateless, the Via tag is generated for each request. As a
>> consequence, the Via tag in the ACK differs from the one in the
>> INVITE. And one carrier doesn't handle those ACKs if the Via tag
>> differs.
>>
>> Is there a way to force the creation of a "deterministic" Via branch
>> tag? For example, building it from a hash over call-id and from-tag or
>> something like that?
>>
>> Thanks in advance
>> Sebastian
>>
>> --
>> Sebastian Damm
>> Voice Engineer
>> __
>> sipgate GmbH
>>
>> ___
>> 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



-- 
Sebastian Damm
Voice Engineer
__
sipgate GmbH

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


Re: [SR-Users] Same Via Tag for INVITE and ACK on S/L loadbalancer

2020-02-10 Thread Sebastian Damm
We use 5.2 on the affected systems.

On Mon, Feb 10, 2020 at 4:15 PM Serge S. Yuriev  wrote:
>
> Hi
>
> I believe you are using 5.2 or 5.3 series? This tend to work properly on 5.1 
> series
>
> 10.02.2020, 18:10, "Sebastian Damm" :
> > Hi,
> >
> > actually, our only problem is handling negative replies. The ACK
> > belongs to the same transaction and therefore has to carry the same
> > Via branch ID.
> >
> > Sebastian
> >
> > On Mon, Feb 10, 2020 at 3:50 PM Yuriy Gorlichenko  
> > wrote:
> >>  ACK for successull response is a new transaction. It has to be different. 
> >> May be it is better to point provider to this?
> >>
> >>  On Mon, 10 Feb 2020, 14:26 Sebastian Damm,  wrote:
> >>>  Hi,
> >>>
> >>>  I stumbled upon an interop problem with a carrier. We have the
> >>>  following scenario:
> >>>
> >>>  Gateway --> Loadbalancer --> Carrier
> >>>
> >>>  The loadbalancer generates a Via header for each request. But since it
> >>>  is stateless, the Via tag is generated for each request. As a
> >>>  consequence, the Via tag in the ACK differs from the one in the
> >>>  INVITE. And one carrier doesn't handle those ACKs if the Via tag
> >>>  differs.
> >>>
> >>>  Is there a way to force the creation of a "deterministic" Via branch
> >>>  tag? For example, building it from a hash over call-id and from-tag or
> >>>  something like that?
> >>>
> >>>  Thanks in advance
> >>>  Sebastian
> >>>
> >>>  --
> >>>  Sebastian Damm
> >>>  Voice Engineer
> >>>  __
> >>>  sipgate GmbH
> >>>
> >>>  ___
> >>>  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
> >
> > --
> > Sebastian Damm
> > Voice Engineer
> > __
> > sipgate GmbH
> >
> > ___
> > Kamailio (SER) - Users Mailing List
> > sr-users@lists.kamailio.org
> > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
> --
> wbr,
> Serge
>
>
> ___
> Kamailio (SER) - Users Mailing List
> sr-users@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users



-- 
Sebastian Damm
Voice Engineer
__
sipgate GmbH

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


Re: [SR-Users] Same Via Tag for INVITE and ACK on S/L loadbalancer

2020-02-11 Thread Sebastian Damm
Hi all,

thanks for the discussion and reminding everyone that it is already
fixed. Henning, I guess we owe you a beer or two at Kamailioworld. :)

Daniel, to answer your question regarding "why stateless": Our setup
includes anycast, so multiple machines share the same IP address. And
depending on the datacenter location of our gateways or the uplink to
the carrier, even requests and answers can be routed through different
instances running with the same IP address. So yes, even in 2020 there
can be use cases for a stateless loadbalancer.

We were running 5.2.2, and after I upgraded to 5.2.6, our error reply
counter dropped significantly. Wow.

Regards,
Sebastian

On Mon, Feb 10, 2020 at 8:02 PM Henning Westerholt  wrote:
>
> Hello Serge,
>
> there was a regression introduced by b64a25874e3 in 5.2 because of a wrong 
> refactoring. This were not noticed for some time because only a few people 
> (still) use stateless load balancers. I noticed it as well in middle of last 
> year during a customer project. It was fixed in  82635674517 end of July 
> 2019, you find in the related discussion also some test results that I posted 
> before doing the backport. So, if this is your problem, after 5.2.4 is should 
> work again.
>
> Cheers,
>
> Henning
>
> --
> Henning Westerholt – https://skalatan.de/blog/
> Kamailio services – https://gilawa.com
>
> -Original Message-
> From: sr-users  On Behalf Of Serge 
> S.Yuriev
> Sent: Monday, February 10, 2020 4:46 PM
> To: Kamailio (SER) - Users Mailing List 
> Subject: Re: [SR-Users] Same Via Tag for INVITE and ACK on S/L loadbalancer
>
> Hello,
>
> This stateless call flow is smooth in 5.1 branch, at least 5.1.7 but in 5.2.1 
> already broken IIRC.
> Some time ago I wrote about this very same issue
>
> 10.02.2020, 18:39, "Daniel-Constantin Mierla" :
> > In such case, because the proxy is doing stateless forwarding, there
> > is no transaction. I guess the solution right now is to use tm for
> > relaying
> > - is any concern of doing that?
> >
> > If someone wants to look at generating same via branch, I am fine with
> > it, eventually controlled by a parameter if the code change is
> > significant, to be able to switch to current mode if unexpected side
> > effects pop up.
> >
> > One more note in this case: I expect it would be required to generate
> > different tag for 200ok ACK, so it is matched as different transaction
> > by next hop, not sure if there is any easy way to discover the type of
> > ACK in a stateless proxy.
> >
> > I am not sure I remember correctly, but in some discussions I think it
> > was suggested to just reuse the branch value of incoming top Via when
> > doing stateless forwarding.
> >
> > Cheers,
> > Daniel
> >
> > On 10.02.20 16:26, Sebastian Damm wrote:
> >>  We use 5.2 on the affected systems.
> >>
> >>  On Mon, Feb 10, 2020 at 4:15 PM Serge S. Yuriev  wrote:
> >>>  Hi
> >>>
> >>>  I believe you are using 5.2 or 5.3 series? This tend to work
> >>> properly on 5.1 series
> >>>
> >>>  10.02.2020, 18:10, "Sebastian Damm" :
> >>>>  Hi,
> >>>>
> >>>>  actually, our only problem is handling negative replies. The ACK
> >>>>  belongs to the same transaction and therefore has to carry the
> >>>> same
> >>>>  Via branch ID.
> >>>>
> >>>>  Sebastian
> >>>>
> >>>>  On Mon, Feb 10, 2020 at 3:50 PM Yuriy Gorlichenko  
> >>>> wrote:
> >>>>>   ACK for successull response is a new transaction. It has to be 
> >>>>> different. May be it is better to point provider to this?
> >>>>>
> >>>>>   On Mon, 10 Feb 2020, 14:26 Sebastian Damm,  wrote:
> >>>>>>   Hi,
> >>>>>>
> >>>>>>   I stumbled upon an interop problem with a carrier. We have the
> >>>>>>   following scenario:
> >>>>>>
> >>>>>>   Gateway --> Loadbalancer --> Carrier
> >>>>>>
> >>>>>>   The loadbalancer generates a Via header for each request. But
> >>>>>> since it
> >>>>>>   is stateless, the Via tag is generated for each request. As a
> >>>>>>   consequence, the Via tag in the ACK differs from the one in the
> >>>>>>   INVITE. And one carrier doesn't handle those ACKs if the Via
> >>>>>> tag
> >>>>>>   differs.
> >>>>>>
> >>>>>>   Is there a way to force the creation of a "deterministic" Via
> >>>>>> branch
> >>>>>>   tag? For example, building it from a hash over call-id and
> >>>>>> from-tag or
> >>>>>>   something like that?
>
> --
> wbr,
> Serge
>
>
> ___
> Kamailio (SER) - Users Mailing List
> sr-users@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users



-- 
Sebastian Damm
Voice Engineer
__
sipgate GmbH

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


[SR-Users] Open separate TCP streams to the same destination

2021-03-11 Thread Sebastian Damm
Hi,

I have a peer that requests separate TCP connections for each registration to 
their server. Those registrations run through the same Kamailio instance on my 
side. 

Now what I tried is to use tcpops and the tcp_set_otcpid function, supplying a 
previously nonexistant TCP connection ID before relaying the register request. 
The command itself returns true, however, it does not do anything. The content 
of $conid of the reply is something totally different. So I guess, this 
function only works for already existing connections.

Is there another way to explicitly tell Kamailio to open up another connection 
to a peer even though a connection to that peer is already open?

Thanks in advance.

Regards,
Sebastian

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


Re: [SR-Users] Best way to ignore HTTP requests

2021-03-11 Thread Sebastian Damm
I would probably load the xhttp module and then discard those messages there. 
See the docs of xhttp, though, there's an option that has to be set to accept 
requests without Content-Length header.

Regards,
Sebastian

- Ursprüngliche Mail -
Von: "Ben Kaufman" 
An: "sr-users" 
Gesendet: Donnerstag, 11. März 2021 17:19:29
Betreff: Re: [SR-Users] Best way to ignore HTTP requests

I’m sorry – I should have been more clear in what I was looking at. 



As a brief summary of the ‘problem’, I see items like this in my logs 
intermittently (a few times a day): 



*** 

20(3085) ERROR:  [core/tcp_read.c:1531]: tcp_read_req(): bad request, 
state=7, error=4 buf: 

GET / HTTP/1.0 





parsed: 

GET / HTTP/1.0 





24(3089) ERROR:  [core/tcp_read.c:1531]: tcp_read_req(): bad request, 
state=7, error=4 buf: 

GET [ http://clientapi.ipip.net/echo.php?info=20210311155950 | 
http://clientapi.ipip.net/echo.php?info=20210311155950 ] HTTP/1.1 

Host: clientapi.ipip.net 

Accept: */* 

Pragma: no-cache 

User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) 

*** 



So, this is just (likely) random scanning from the internet. I mostly just want 
to remove much of this info from my log files. I’m not serving http on this 
port. The question about $rP was mostly looking to ignore GET, POST, etc., but 
I understand that this won’t work due to the fact that it’s message parsing 
that fails. I was just looking for a way to discard and ignore the bad message 
rather than trying to process it. 






Regards, 



Ben Kaufman 

[ mailto:ben.kauf...@altigen.com | ben.kauf...@altigen.com ] 

Director of Cloud Operations 

AltiGen Communications, Inc. 





From: sr-users  On Behalf Of Alex Balashov 
Sent: Monday, March 8, 2021 3:08 PM 
To: Kamailio (SER) - Users Mailing List  
Subject: Re: [SR-Users] Best way to ignore HTTP requests 




How would checking $rP help? 





Kamailio won’t process HTTP requests on a TCP SIP listener since they lack the 
SIP/2.0 request line signature. 





It’ll process them through xhttp, though. Is that the context in which this is 
an issue? If so, just expose your xhttp resources via an obscure URL ($hu) and 
deny anything else. 





— 


Sent from mobile, with due apologies for brevity and errors. 








On Mar 8, 2021, at 4:01 PM, Ben Kaufman < [ mailto:ben.kauf...@altigen.com | 
ben.kauf...@altigen.com ] > wrote: 







I’ve set up a server listening on TCP recently, and notice that I’m receiving 
intermittent, random HTTP requests from the internet. While it would probably 
be a good idea to enforce a firewall rule to only allow known hosts to 
communicate, what would be the best way within Kamailio to ignore http 
requests? Would just checking $rP work? 



Regards, 



Ben Kaufman 

[ mailto:ben.kauf...@altigen.com | ben.kauf...@altigen.com ] 

Director of Cloud Operations 

AltiGen Communications, Inc. 



___ 
Kamailio (SER) - Users Mailing List 
[ mailto:sr-users@lists.kamailio.org | sr-users@lists.kamailio.org ] 
[ https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users | 
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] Open separate TCP streams to the same destination

2021-03-12 Thread Sebastian Damm
Hi Daniel,

thanks for the clarification. I read RfC5923 again, and I guess we will use 
that for arguing with the peer. Implementing an "accounting per TCP session" 
method seems to be just dead wrong.

Regards,
Sebastian

- Ursprüngliche Mail -
Von: "Daniel-Constantin Mierla" 
An: "sr-users" , "Sebastian Damm" 

Gesendet: Freitag, 12. März 2021 09:27:03
Betreff: Re: [SR-Users] Open separate TCP streams to the same destination

Hello,

that is not possible at this moment, SIP does not associate the sessions
or the users with the transport layer connections, that's more the xmpp
c2s design. SIP relies on headers for matching.

Furthermore the connection reuse between two nodes comes from SIP specs.
Think also about record-routing which is given with server listen
ip:port, because it is not mandatory to have persistent connections, so
a node can close the connection and reconnect later when needs to the
address in record route.

Anyhow, being open source, you can extend kamailio to work as you need
(with configuration options to enable/disable). I haven't thought much,
but it should require some C code changes in the core to open new client
connections without binding for local socket, then keep the relation
between this client connections and the users/sessions. Here is probably
not easy how to do it, because SIP has a lot of flexibility in terms of
many devices per user, and many contacts/connections per device (e.g.,
see outbound specs, or devices with support for many transports at the
same time).

On the other hand, I haven't seem any such constraints from SIP systems
that work with proxy (support record-route, which is requirement in
RFC3261) or even with SBCs.

Cheers,
Daniel

On 11.03.21 17:00, Sebastian Damm wrote:
> Hi,
>
> I have a peer that requests separate TCP connections for each registration to 
> their server. Those registrations run through the same Kamailio instance on 
> my side. 
>
> Now what I tried is to use tcpops and the tcp_set_otcpid function, supplying 
> a previously nonexistant TCP connection ID before relaying the register 
> request. The command itself returns true, however, it does not do anything. 
> The content of $conid of the reply is something totally different. So I 
> guess, this function only works for already existing connections.
>
> Is there another way to explicitly tell Kamailio to open up another 
> connection to a peer even though a connection to that peer is already open?
>
> Thanks in advance.
>
> Regards,
> Sebastian
>
> ___
> Kamailio (SER) - Users Mailing List
> sr-users@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Funding: https://www.paypal.me/dcmierla

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


Re: [SR-Users] UDP workers block when one or more rtpengine instances go offline

2018-08-08 Thread Sebastian Damm
On Tue, Aug 7, 2018 at 3:04 PM Richard Fuchs  wrote:
> On 2018-08-06 06:58, Sebastian Damm wrote:
> When you query the running config via kamcmd for the value of
> rtpengine_tout_ms, what does it say? (Wondering if the default value of
> 1000 properly gets established or if some other value is in effect - it
> shouldn't block longer than this value)

kamcmd> cfg.get rtpengine rtpengine_tout_ms
1000

I actually don't know how long it blocks for one request. But I know
that whenever one RTPengine is gone, we get "SIP offline"
notifications from our monitoring system (sending SIP OPTIONS) within
minutes. I think, waiting for an RTPengine answer for a second is okay
if it happens once every 120 seconds, but it's not okay if it happens
every time.

Sebastian

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


Re: [SR-Users] UDP workers block when one or more rtpengine instances go offline

2018-08-09 Thread Sebastian Damm
Hi Muhammad,
On Thu, Aug 9, 2018 at 8:34 AM Muhammad Zaka
 wrote:
> You may need the following fix for your rtpengine module in Kamailio.
> https://github.com/kamailio/kamailio/pull/1593
> We had the similar issue with rtpengine module in Kamailio as it is using 
> package memory and not shared memory.

From the commit message I would expect this patch to apply only to
deleted rtpengine nodes but not temporarily offline nodes? Or is the
same code run when temporarily disabling a node as well?

Regards,
Sebastian

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


[SR-Users] What does "tls.reload" actually do?

2021-08-24 Thread Sebastian Damm
Hi,

I noticed a strange behavior on some of our proxy servers, all running Kamailio 
5.3.8. After running for some time (weeks), our monitoring system sporadically 
starts reporting errors. The check connects via tls and registers to an 
Asterisk behind the proxy server. When this happens, the Kamailio log shows the 
following line:

ERROR: tls [tls_util.h:42]: tls_err_ret(): TLS accept:error:1409441B:SSL 
routines:ssl3_read_bytes:tlsv1 alert decrypt error

When restarting Kamailio, the problem goes away only to come back after some 
weeks uptime again.

On one host, I tried to find something using kamcmd, and I don't know why but I 
also issued "tls.reload". And from that point, the monitoring system has not 
reported the system as faulty anymore. I repeated the same thing on other hosts 
when the problem occured there, all with the same result. "tls.reload" helps. 
But from the documentation, I don't know why.

Does anybody have an explanation for it?

Regards,
Sebastian


__
Kamailio - Users Mailing List - Non Commercial Discussions
  * sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:
  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] What does "tls.reload" actually do?

2021-08-30 Thread Sebastian Damm
Hi Henning,

unfortunately, I don't have a host without traffic showing the same behavior. 
Our dev hosts usually don't run long enough. (And they usually don't get 
monitored.)

The "sporadically" meant, that it can take sometimes up to one week until it 
occurs on the same host again. And yes, some hosts have a bit more traffic than 
others, I suppose that's why it occurs earlier on some hosts, later on others.

I guess we have to deploy updates more often. ;)

Regards,
Sebastian

- Ursprüngliche Mail -
Von: "Henning Westerholt" 
An: "sr-users" 
CC: "Sebastian Damm" 
Gesendet: Dienstag, 24. August 2021 14:21:31
Betreff: RE: What does "tls.reload" actually do?

Hello Sebastian,

on a first look to the code the tls.reload does similar operations as done 
during normal server startup, like
- load configuration
- fixing domains
- check sockets

If the error only happens sporadic and, on some servers, it is probably either 
an error that only occurs in specific circumstances unrelated to kamailio, or 
some internal corruption topic in the module/server.

Do you see it also on e.g., test systems without any real load? Is there a 
difference between the systems in kind of load, and this maybe also causes some 
difference when the error occurs?

Cheers,

Henning

-- 
Henning Westerholt - https://skalatan.de/blog/
Kamailio services - https://gilawa.com 

-Original Message-
From: sr-users  On Behalf Of Sebastian Damm
Sent: Tuesday, August 24, 2021 1:58 PM
To: sr-users 
Subject: [SR-Users] What does "tls.reload" actually do?

Hi,

I noticed a strange behavior on some of our proxy servers, all running Kamailio 
5.3.8. After running for some time (weeks), our monitoring system sporadically 
starts reporting errors. The check connects via tls and registers to an 
Asterisk behind the proxy server. When this happens, the Kamailio log shows the 
following line:

ERROR: tls [tls_util.h:42]: tls_err_ret(): TLS accept:error:1409441B:SSL 
routines:ssl3_read_bytes:tlsv1 alert decrypt error

When restarting Kamailio, the problem goes away only to come back after some 
weeks uptime again.

On one host, I tried to find something using kamcmd, and I don't know why but I 
also issued "tls.reload". And from that point, the monitoring system has not 
reported the system as faulty anymore. I repeated the same thing on other hosts 
when the problem occured there, all with the same result. "tls.reload" helps. 
But from the documentation, I don't know why.

Does anybody have an explanation for it?

Regards,
Sebastian


__
Kamailio - Users Mailing List - Non Commercial Discussions
  * sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:
  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

__
Kamailio - Users Mailing List - Non Commercial Discussions
  * sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:
  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] What does "tls.reload" actually do?

2021-08-30 Thread Sebastian Damm
Hi,

I suppose, it happens for real connections, too. But since it's so 
sporadically, I guess, clients just retry and then it works.

The operating system is an Ubuntu 18.04 (getting replaced by Ubuntu 20.04 
soon), thus it's running with libssl 1.1.1.

Regards,
Sebastian

- Ursprüngliche Mail -
Von: "miconda" 
An: "sr-users" , "Sebastian Damm" 

Gesendet: Montag, 30. August 2021 13:28:04
Betreff: Re: [SR-Users] What does "tls.reload" actually do?

Hello,

does it happen only for connections done by the monitoring system? Or
also for the connections tried from the usual sip phones?

What is the operating system and libssl version?

Cheers,
Daniel

On 30.08.21 11:57, Sebastian Damm wrote:
> Hi Henning,
>
> unfortunately, I don't have a host without traffic showing the same behavior. 
> Our dev hosts usually don't run long enough. (And they usually don't get 
> monitored.)
>
> The "sporadically" meant, that it can take sometimes up to one week until it 
> occurs on the same host again. And yes, some hosts have a bit more traffic 
> than others, I suppose that's why it occurs earlier on some hosts, later on 
> others.
>
> I guess we have to deploy updates more often. ;)
>
> Regards,
> Sebastian
>
> - Ursprüngliche Mail -
> Von: "Henning Westerholt" 
> An: "sr-users" 
> CC: "Sebastian Damm" 
> Gesendet: Dienstag, 24. August 2021 14:21:31
> Betreff: RE: What does "tls.reload" actually do?
>
> Hello Sebastian,
>
> on a first look to the code the tls.reload does similar operations as done 
> during normal server startup, like
> - load configuration
> - fixing domains
> - check sockets
>
> If the error only happens sporadic and, on some servers, it is probably 
> either an error that only occurs in specific circumstances unrelated to 
> kamailio, or some internal corruption topic in the module/server.
>
> Do you see it also on e.g., test systems without any real load? Is there a 
> difference between the systems in kind of load, and this maybe also causes 
> some difference when the error occurs?
>
> Cheers,
>
> Henning
>
> -- 
> Henning Westerholt - https://skalatan.de/blog/
> Kamailio services - https://gilawa.com 
>
> -Original Message-
> From: sr-users  On Behalf Of Sebastian 
> Damm
> Sent: Tuesday, August 24, 2021 1:58 PM
> To: sr-users 
> Subject: [SR-Users] What does "tls.reload" actually do?
>
> Hi,
>
> I noticed a strange behavior on some of our proxy servers, all running 
> Kamailio 5.3.8. After running for some time (weeks), our monitoring system 
> sporadically starts reporting errors. The check connects via tls and 
> registers to an Asterisk behind the proxy server. When this happens, the 
> Kamailio log shows the following line:
>
> ERROR: tls [tls_util.h:42]: tls_err_ret(): TLS accept:error:1409441B:SSL 
> routines:ssl3_read_bytes:tlsv1 alert decrypt error
>
> When restarting Kamailio, the problem goes away only to come back after some 
> weeks uptime again.
>
> On one host, I tried to find something using kamcmd, and I don't know why but 
> I also issued "tls.reload". And from that point, the monitoring system has 
> not reported the system as faulty anymore. I repeated the same thing on other 
> hosts when the problem occured there, all with the same result. "tls.reload" 
> helps. But from the documentation, I don't know why.
>
> Does anybody have an explanation for it?
>
> Regards,
> Sebastian
>
>
> __
> Kamailio - Users Mailing List - Non Commercial Discussions
>   * sr-users@lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to the 
> sender!
> Edit mailing list options or unsubscribe:
>   * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
> __
> Kamailio - Users Mailing List - Non Commercial Discussions
>   * sr-users@lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to the 
> sender!
> Edit mailing list options or unsubscribe:
>   * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda/

__
Kamailio - Users Mailing List - Non Commercial Discussions
  * sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:
  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] t_suspend() / t_continue() create new branches

2021-11-23 Thread Sebastian Damm
Hi,

I have the following weird problem. A Kamailio (5.4.x) with some asynchronous 
permission logic suspends outgoing INVITEs and resumes them after the answer of 
the permission system. Everything works as expected when the call is answered. 
However, when the called party rejects the call (with a 486 for example), the 
call doesn't get torn down immediately (it is rejected with a 408 eventually) 
because Kamailio logs the following:

Nov 23 14:51:02 host /usr/sbin/kamailio[1569]: DEBUG: app_python 
[apy_kemi.c:106]: sr_kemi_config_engine_python(): execution of route type 4 
with name [ksr_onreply_manage] returned 1
Nov 23 14:51:02 host /usr/sbin/kamailio[1569]: DEBUG: tm [t_reply.c:1363]: 
t_should_relay_response(): -> T_code=183, new_code=486
Nov 23 14:51:02 host /usr/sbin/kamailio[1569]: DEBUG: tm [t_reply.c:1448]: 
t_should_relay_response(): store - other branches still active
Nov 23 14:51:02 host /usr/sbin/kamailio[1569]: DEBUG: tm [t_reply.c:1926]: 
relay_reply(): reply status=3 branch=2, save=1, relay=-1 icode=0 msg status=486

I don't do any forking, the call is just forwarded.

I put the following line immediately after t_suspend() and in the beginning of 
the route specified in t_continue():

KSR.info("We're at branch index %d" % KSR.pv.get("$T(branch_index)"))

This produces the following output:

Nov 23 16:30:13 host /usr/sbin/kamailio[2745]: INFO:  [core/kemi.c:104]: 
sr_kemi_core_info(): We're at branch index 0
Nov 23 16:30:13 host /usr/sbin/kamailio[2725]: INFO:  [core/kemi.c:104]: 
sr_kemi_core_info(): We're at branch index 2

So apparently, the suspend and continue introduce new branches. (Other option: 
I'm doing something completely different creating those branches, but I don't 
have any append_branch() or similar in my code.)

I assume, I just missed a configuration parameter. Can I get Kamailio somehow 
to behave as if there was just one branch and forward the negative reply?

Thanks,
Sebastian

__
Kamailio - Users Mailing List - Non Commercial Discussions
  * sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:
  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] t_suspend() / t_continue() create new branches

2021-11-24 Thread Sebastian Damm
After spending more hours of unsuccessful debugging, I can add to my problem:

My call enters the branch_route_failure route, where I can get the 486 status 
with t_get_status_code(). However, I cannot issue a t_reply() in this phase of 
the call. And after some more seconds, when the transaction times out (looks 
like it's the no-answer-received timer of 30 seconds), Kamailio just sends a 
408 without entering any route anymore. I have a debug output in my failure 
route, which is never printed.

I tried virtually every command from tm or tmx module in the last hours that 
looked like it could help. Without success. Still stuck at "Why is there 
another branch after t_suspend and t_continue and how do I make it go away? 
There's just an evapi call to cgrates in between.

Grateful for any ideas.

Thanks,
Sebastian

- Ursprüngliche Mail -
Von: "Sebastian Damm" 
An: "sr-users" 
Gesendet: Dienstag, 23. November 2021 17:51:02
Betreff: [SR-Users] t_suspend() / t_continue() create new branches

Hi,

I have the following weird problem. A Kamailio (5.4.x) with some asynchronous 
permission logic suspends outgoing INVITEs and resumes them after the answer of 
the permission system. Everything works as expected when the call is answered. 
However, when the called party rejects the call (with a 486 for example), the 
call doesn't get torn down immediately (it is rejected with a 408 eventually) 
because Kamailio logs the following:

Nov 23 14:51:02 host /usr/sbin/kamailio[1569]: DEBUG: app_python 
[apy_kemi.c:106]: sr_kemi_config_engine_python(): execution of route type 4 
with name [ksr_onreply_manage] returned 1
Nov 23 14:51:02 host /usr/sbin/kamailio[1569]: DEBUG: tm [t_reply.c:1363]: 
t_should_relay_response(): ->>>>>>>>> T_code=183, new_code=486
Nov 23 14:51:02 host /usr/sbin/kamailio[1569]: DEBUG: tm [t_reply.c:1448]: 
t_should_relay_response(): store - other branches still active
Nov 23 14:51:02 host /usr/sbin/kamailio[1569]: DEBUG: tm [t_reply.c:1926]: 
relay_reply(): reply status=3 branch=2, save=1, relay=-1 icode=0 msg status=486

I don't do any forking, the call is just forwarded.

I put the following line immediately after t_suspend() and in the beginning of 
the route specified in t_continue():

KSR.info("We're at branch index %d" % KSR.pv.get("$T(branch_index)"))

This produces the following output:

Nov 23 16:30:13 host /usr/sbin/kamailio[2745]: INFO:  [core/kemi.c:104]: 
sr_kemi_core_info(): We're at branch index 0
Nov 23 16:30:13 host /usr/sbin/kamailio[2725]: INFO:  [core/kemi.c:104]: 
sr_kemi_core_info(): We're at branch index 2

So apparently, the suspend and continue introduce new branches. (Other option: 
I'm doing something completely different creating those branches, but I don't 
have any append_branch() or similar in my code.)

I assume, I just missed a configuration parameter. Can I get Kamailio somehow 
to behave as if there was just one branch and forward the negative reply?

Thanks,
Sebastian

__
Kamailio - Users Mailing List - Non Commercial Discussions
  * sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:
  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

__
Kamailio - Users Mailing List - Non Commercial Discussions
  * sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:
  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] t_suspend() / t_continue() create new branches

2021-11-24 Thread Sebastian Damm
Hi Daniel,

thanks for the explanation. 

I played around, and when setting fr_timer to 30s and fr_inv_timer to 500ms by 
default and setting the fr_inv_timer to 120s in branch route, it works as 
expected. At least when I call my mobile and reject the call there. So indeed 
it looks like the first branch still waits for a reply even though the branch 
is suspended. And when I call t_on_failure before suspending the transaction, I 
end up in failure route after the 30s timeout (before changing the fr_timer 
setting).

Does this sound like a bug in Kamailio or am I still doing something wrong? The 
settings I chose now could open up a race condition when the negative final 
reply on the request sent out comes in before the 500ms are over. I actually 
expect the initial branch not playing a role in call routing anymore after 
suspending it.

Regards,
Sebastian



- Ursprüngliche Mail -
Von: "miconda" 
An: "sr-users" , "Sebastian Damm" 

Gesendet: Mittwoch, 24. November 2021 16:30:19
Betreff: Re: [SR-Users] t_suspend() / t_continue() create new branches

Hello,

a suspend of a request is practically a branch that is not sent out,
which can also time out, if not resumed before retransmission timeout
value and can get in failure route if requested.

On continue, the suspended branch is closed like when a negative
response is received on that branch and a new one is created to allow
processing/routing further the request. So, yes, the mechanism behind is
relying on using branches.

Note that on re-routing, you have to request again failure route
execution. If no branch was answered with 200ok, you can enforce the
response code in failure route with t_reply().

Cheers,
Daniel

On 24.11.21 14:43, Sebastian Damm wrote:
> After spending more hours of unsuccessful debugging, I can add to my problem:
>
> My call enters the branch_route_failure route, where I can get the 486 status 
> with t_get_status_code(). However, I cannot issue a t_reply() in this phase 
> of the call. And after some more seconds, when the transaction times out 
> (looks like it's the no-answer-received timer of 30 seconds), Kamailio just 
> sends a 408 without entering any route anymore. I have a debug output in my 
> failure route, which is never printed.
>
> I tried virtually every command from tm or tmx module in the last hours that 
> looked like it could help. Without success. Still stuck at "Why is there 
> another branch after t_suspend and t_continue and how do I make it go away? 
> There's just an evapi call to cgrates in between.
>
> Grateful for any ideas.
>
> Thanks,
> Sebastian
>
> - Ursprüngliche Mail -
> Von: "Sebastian Damm" 
> An: "sr-users" 
> Gesendet: Dienstag, 23. November 2021 17:51:02
> Betreff: [SR-Users] t_suspend() / t_continue() create new branches
>
> Hi,
>
> I have the following weird problem. A Kamailio (5.4.x) with some asynchronous 
> permission logic suspends outgoing INVITEs and resumes them after the answer 
> of the permission system. Everything works as expected when the call is 
> answered. However, when the called party rejects the call (with a 486 for 
> example), the call doesn't get torn down immediately (it is rejected with a 
> 408 eventually) because Kamailio logs the following:
>
> Nov 23 14:51:02 host /usr/sbin/kamailio[1569]: DEBUG: app_python 
> [apy_kemi.c:106]: sr_kemi_config_engine_python(): execution of route type 4 
> with name [ksr_onreply_manage] returned 1
> Nov 23 14:51:02 host /usr/sbin/kamailio[1569]: DEBUG: tm [t_reply.c:1363]: 
> t_should_relay_response(): ->>>>>>>>> T_code=183, new_code=486
> Nov 23 14:51:02 host /usr/sbin/kamailio[1569]: DEBUG: tm [t_reply.c:1448]: 
> t_should_relay_response(): store - other branches still active
> Nov 23 14:51:02 host /usr/sbin/kamailio[1569]: DEBUG: tm [t_reply.c:1926]: 
> relay_reply(): reply status=3 branch=2, save=1, relay=-1 icode=0 msg 
> status=486
>
> I don't do any forking, the call is just forwarded.
>
> I put the following line immediately after t_suspend() and in the beginning 
> of the route specified in t_continue():
>
> KSR.info("We're at branch index %d" % KSR.pv.get("$T(branch_index)"))
>
> This produces the following output:
>
> Nov 23 16:30:13 host /usr/sbin/kamailio[2745]: INFO:  
> [core/kemi.c:104]: sr_kemi_core_info(): We're at branch index 0
> Nov 23 16:30:13 host /usr/sbin/kamailio[2725]: INFO:  
> [core/kemi.c:104]: sr_kemi_core_info(): We're at branch index 2
>
> So apparently, the suspend and continue introduce new branches. (Other 
> option: I'm doing something completely different creating those branches, but 
> I don't have any append_branch() or similar i

[SR-Users] tcp_set_connection_lifetime(1) does not close connection

2021-12-10 Thread Sebastian Damm
Hi, 

for having a maintenance mode, I need to implement some sort of draining 
functionality. All our clients register via TLS. So I thought, I just answer 
the next REGISTER of a client with a 503 and kill the tcp connection 
afterwards, so they need to open up a new connection to the loadbalancer in 
front and end up on a different server.

This is my code:

510 if msg.is_method("REGISTER"):
  1 if KSR.pv.get("$shv(MAINTENANCE_MODE)") == 1:
  2 KSR.info("In maintenance mode, rejecting registration")
  3 KSR.hdr.append_to_reply("Retry-After: 2\r\n")
  4 KSR.sl.sl_send_reply(503, "Draining")
  5 if KSR.tcpops.tcp_set_connection_lifetime(1) > 0:
  6 KSR.info("Set Connection lifetime to 1")
  7 return False

(Side note: msg is some internal class, this is obviously KEMI with python)

So now when I set the MAINTENANCE_MODE var to 1, Kamailio rejects the REGISTER 
requests, logs both lines and sends out a 503.

Debug log tells me this:
Dec 10 15:32:10 ifens5 /usr/sbin/kamailio[3851]: DEBUG: tcpops [tcpops.c:229]: 
tcpops_set_connection_lifetime(): new connection lifetime for conid=1: 908866403
Dec 10 15:32:21 ifens5 /usr/sbin/kamailio[3855]: DEBUG:  
[core/tcp_main.c:4554]: tcpconn_main_timeout(): entering timer for 
0x7f759cb26218 (ticks=908866499, timeout=908866499 (0 s), wr_timeout=0 
(211631299 s)), write queue: 0 bytes

In tcpdump I can see that the connection does not get closed immediately.

Is there some timer in the tcp stack which cleans up expired connections from 
time to time? Can I manipulate how often this timer runs? I couldn't find 
anything, and clearly even though I tell Kamailio to close the connection after 
1 second, it doesn't do it.


Thanks for any input.

Regards,
Sebastian

__
Kamailio - Users Mailing List - Non Commercial Discussions
  * sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:
  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] tcp_set_connection_lifetime(1) does not close connection

2021-12-13 Thread Sebastian Damm
Hi,

thanks for the hint. Indeed, this does what I need. Don't know why I didn't 
find that command. Maybe this thread will help somebody in the future, though.

Regards,
Sebastian

- Ursprüngliche Mail -
Von: "Arsen Semenov" 
An: "sr-users" 
Gesendet: Samstag, 11. Dezember 2021 08:19:27
Betreff: Re: [SR-Users] tcp_set_connection_lifetime(1) does not close connection

Hello Sebastian, 

Have you tried to use `set_reply_close()` instead ? 

[ https://www.kamailio.org/wiki/cookbooks/5.5.x/core#set_reply_close | 
https://www.kamailio.org/wiki/cookbooks/5.5.x/core#set_reply_close ] 

On Fri, Dec 10, 2021 at 8:49 PM Sebastian Damm < [ mailto:sd...@pascom.net | 
sd...@pascom.net ] > wrote: 


Hi, 

for having a maintenance mode, I need to implement some sort of draining 
functionality. All our clients register via TLS. So I thought, I just answer 
the next REGISTER of a client with a 503 and kill the tcp connection 
afterwards, so they need to open up a new connection to the loadbalancer in 
front and end up on a different server. 

This is my code: 

510 if msg.is_method("REGISTER"): 
1 if KSR.pv.get("$shv(MAINTENANCE_MODE)") == 1: 
2 KSR.info("In maintenance mode, rejecting registration") 
3 KSR.hdr.append_to_reply("Retry-After: 2\r\n") 
4 KSR.sl.sl_send_reply(503, "Draining") 
5 if KSR.tcpops.tcp_set_connection_lifetime(1) > 0: 
6 KSR.info("Set Connection lifetime to 1") 
7 return False 

(Side note: msg is some internal class, this is obviously KEMI with python) 

So now when I set the MAINTENANCE_MODE var to 1, Kamailio rejects the REGISTER 
requests, logs both lines and sends out a 503. 

Debug log tells me this: 
Dec 10 15:32:10 ifens5 /usr/sbin/kamailio[3851]: DEBUG: tcpops [tcpops.c:229]: 
tcpops_set_connection_lifetime(): new connection lifetime for conid=1: 
908866403 
Dec 10 15:32:21 ifens5 /usr/sbin/kamailio[3855]: DEBUG:  
[core/tcp_main.c:4554]: tcpconn_main_timeout(): entering timer for 
0x7f759cb26218 (ticks=908866499, timeout=908866499 (0 s), wr_timeout=0 
(211631299 s)), write queue: 0 bytes 

In tcpdump I can see that the connection does not get closed immediately. 

Is there some timer in the tcp stack which cleans up expired connections from 
time to time? Can I manipulate how often this timer runs? I couldn't find 
anything, and clearly even though I tell Kamailio to close the connection after 
1 second, it doesn't do it. 


Thanks for any input. 

Regards, 
Sebastian 

__ 
Kamailio - Users Mailing List - Non Commercial Discussions 
* [ mailto:sr-users@lists.kamailio.org | sr-users@lists.kamailio.org ] 
Important: keep the mailing list in the recipients, do not reply only to the 
sender! 
Edit mailing list options or unsubscribe: 
* [ https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users | 
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users ] 


-- 
Arsen Semenov 


__
Kamailio - Users Mailing List - Non Commercial Discussions
  * sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:
  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

__
Kamailio - Users Mailing List - Non Commercial Discussions
  * sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:
  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] Kamailio eats pkg mem, but where?

2022-06-14 Thread Sebastian Damm
Hi,

we have some Kamailio instances running (currently latest 5.4 release), and we 
need to restart it from time to time. We have a grafana graph showing the pkg 
memory usage of one random tcp listener, and it increases slowly over time. 
Config is pure python KEMI.

A mem dump directly after restarting Kamailio says this:

SipSeppBook22:tmp sdamm$ grep alloc pkgmem_before.log | awk '{ print substr( 
$0, 16, length($0) ) }' | sort | uniq -c | sort -k1n | tail -10
  16  sipproxy qm_status():   alloc'd from core: core/re.c: 
subst_parser(301)
  31  sipproxy qm_status():   alloc'd from core: core/sr_module.c: 
load_module(436)
  31  sipproxy qm_status():   alloc'd from core: core/sr_module.c: 
register_module(236)
  31  sipproxy qm_status():   alloc'd from core: core/sr_module.c: 
register_module(253)
  40  sipproxy qm_status():   alloc'd from core: core/pvapi.c: 
pv_init_buffer(2139)
  58  sipproxy qm_status():   alloc'd from core: core/cfg.lex: 
pp_define(1827)
 133  sipproxy qm_status():   alloc'd from core: core/rpc_lookup.c: 
rpc_hash_add(101)
 162  sipproxy qm_status():   alloc'd from core: core/counters.c: 
cnt_hash_add(339)
 211  sipproxy qm_status():   alloc'd from core: core/cfg.lex: 
addstr(1448)
 265  sipproxy qm_status():   alloc'd from core: core/pvapi.c: 
pv_table_add(236)


And after running for some weeks, the same dump looks like this:

SipSeppBook22:tmp sdamm$ grep alloc prod_pkgmem.log | awk '{ print substr( $0, 
16, length($0) ) }' | sort | uniq -c | sort -k1n | tail -10
  31  ifens5 qm_status():   alloc'd from core: core/sr_module.c: 
register_module(253)
  40  ifens5 qm_status():   alloc'd from core: core/pvapi.c: 
pv_init_buffer(2139)
  59  ifens5 qm_status():   alloc'd from core: core/cfg.lex: 
pp_define(1827)
 133  ifens5 qm_status():   alloc'd from core: core/rpc_lookup.c: 
rpc_hash_add(101)
 161  ifens5 qm_status():   alloc'd from core: core/counters.c: 
cnt_hash_add(339)
 203  ifens5 qm_status():   alloc'd from core: core/cfg.lex: 
addstr(1448)
 265  ifens5 qm_status():   alloc'd from core: core/pvapi.c: 
pv_table_add(236)
 686  ifens5 qm_status():   alloc'd from core: core/pvapi.c: 
pv_parse_format(1173)
 694  ifens5 qm_status():   alloc'd from htable: ht_var.c: 
pv_parse_ht_name(158)
 707  ifens5 qm_status():   alloc'd from core: core/pvapi.c: 
pv_cache_add(349)

I know, currently there are a few lines in the code which look like this:

self.instance_name = KSR.pv.get("$sht(pbxdata=>ip.%s)" % (ip,))

This has been an issue in the past and I have replaced the code with  something 
like this:

KSR.pv.sets("$var(tmpInstanceIp)", ip)
self.instance_name = KSR.pv.get("$sht(pbxdata=>ip.$var(tmpInstanceIp))")

However, even after changing this, the memory still grows slowly but steadily.


The usage scenario is TLS-only on one side (clients) and TCP-only on the other 
side (pbxes).


Does anybody have a hint for me how to debug this? Looks like there's a lot of 
pv stuff in the memory, but I don't really know where.


Thanks for any hints,
Sebastian

__
Kamailio - Users Mailing List - Non Commercial Discussions
  * sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:
  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] Dealing with failed SRV peers

2022-12-14 Thread Sebastian Damm
Hi,

we have some Kamailios working as outboundproxy. So they get requests from 
internal systems and send them to different providers. From time to time, one 
provider returns a server as primary resource which is currently unavailable.

I guess if the internal systems connected directly to the target, they would 
remember the failed server and remember to always use the server with second 
priority at least until DNS refresh time. In our setup, since every request is 
"new" for Kamailio, it doesn't remember, which host is reachable or not.


Example:
target: example.com

_sip._udp.example.com SRV resolves to:
10 192.0.2.42 5060
20 198.51.100.42 5060
30 203.0.113.42 5060

192.0.2.42 is unavailable. Still, Kamailio uses it for every new request and 
failover to 198.51.100.42 occurs only after timeouts hit.

Is there a best practice for solving this? I have played around with the 
dst_blocklist settings, but that caused even more trouble because Kamailio 
started blocking requests to peers that have only one server in the record 
having a short hickup.

Thanks in advance for every input, as this is causing trouble every time we run 
into such a situation.

Regards,
Sebastian
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: Dealing with failed SRV peers

2022-12-15 Thread Sebastian Damm
Hi Henning,

thanks for the input. Problem is, the peer(s) we have to find a workaround for 
is actually Deutsche Telekom with their CompanyFlex accounts. I know that it's 
bad to have non-working servers in their SRV entries, especially with the 
highest prio. But apparently, they are in the middle of some kind of migration 
and it currently happens almost every week. And since we enable end users to 
use our PBX with the CompanyFlex service, we have to follow the rules according 
to their TR119 spec. And that says, if we detect an outage, we must use the 
next prio server from the SRV entry and try the first prio server once in a 
while again. But those outages can remain for hours if not days. Currently, 
whenever we detect such an outage, we manipulate our DNS forwarder - an evil 
solution as well.

And since every customer has their own DNS SRV record 
($userid.primary.companyflex.de), the second approach of setting up dispatcher 
sets is unfortunately not an option.

The dst_blocklist feature blocked traffic to another trunk provider for our 
customers twice in as many days, and since it's the main enduser registration 
server in that case, we cannot route the traffic differently. We had not 
noticed outages with this peer before, so it probably is only for a few seconds 
but enough for the dst_blocklist module to catch it.

I already thought about implementing something manually, so to catch errors in 
failure route and then block it manually, but I don't know how. There are no 
commands to fill the dst_blocklist from routing logic, and I wouldn't know if I 
had an entry for example in a hash table, how to tell Kamailio to send the 
request to the next-best server from the SRV result. Is it even possible to 
manually choose the server from an SRV result set?


Regards

Sebastian


From: Henning Westerholt 
Sent: Thursday, December 15, 2022 16:59
To: Kamailio (SER) - Users Mailing List 
Cc: Sebastian Damm 
Subject: RE: Dealing with failed SRV peers


Hello Sebastian,



actually, it’s the fault is by the provider, that they do not manage their DNS 
records properly. It makes no sense to return non-working systems in the end, 
but some of them do not care.



I would probably just use the dst_blocklist functionality, probably with a 
shorter internal TTL.

Regarding the peers that are having only one server which fails, I would just 
route to another provider in this case, if they can not bother to fix it or to 
provide redundancy.



You could also implement a script that fetches periodically the SRV record, 
create a dispatcher cfg from it and then uses dispatcher. You could use active 
OPTIONS ping probing, or also manually deactivate the failed hosts for the time 
period.



Cheers,



Henning



--

Henning Westerholt – https://skalatan.de/blog/

Kamailio services – https://gilawa.com<https://gilawa.com/>



From: Sebastian Damm 
Sent: Thursday, December 15, 2022 7:29 AM
To: Kamailio (SER) - Users Mailing List 
Subject: [SR-Users] Dealing with failed SRV peers



Hi,



we have some Kamailios working as outboundproxy. So they get requests from 
internal systems and send them to different providers. From time to time, one 
provider returns a server as primary resource which is currently unavailable.



I guess if the internal systems connected directly to the target, they would 
remember the failed server and remember to always use the server with second 
priority at least until DNS refresh time. In our setup, since every request is 
"new" for Kamailio, it doesn't remember, which host is reachable or not.



Example:

target: example.com



_sip._udp.example.com SRV resolves to:

10 192.0.2.42 5060

20 198.51.100.42 5060

30 203.0.113.42 5060



192.0.2.42 is unavailable. Still, Kamailio uses it for every new request and 
failover to 198.51.100.42 occurs only after timeouts hit.



Is there a best practice for solving this? I have played around with the 
dst_blocklist settings, but that caused even more trouble because Kamailio 
started blocking requests to peers that have only one server in the record 
having a short hickup.



Thanks in advance for every input, as this is causing trouble every time we run 
into such a situation.



Regards,

Sebastian
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] htable Arrays and dbmode 1

2017-04-28 Thread Sebastian Damm
Hi,

I'm trying to use a htable array. For that, I have inserted some
values in the database (in pseudo CSV):

key_name; key_type; value_type; key_value
'1234567'; 1; 0; 'foo'
'1234567', 1, 0, 'bar'
'1234567', 1, 0, 'baz'

insert into htable (key_name , key_type , value_type , key_value )
values ('1234567', 1, 0, 'foo'),('1234567', 1, 0, 'bar'),('1234567',
1, 0, 'baz');

Now after just starting Kamailio, reading those values, from db and
then stopping Kamailio again, the table content looks like this:

key_name; key_type; value_type; key_value
'1234567[2]'; 0; 0; 'baz'
'1234567[0]', 0, 0, 'foo'
'1234567[1]', 0, 0, 'bar'
'1234567::size', 0, 1, 3

Is this how it is supposed to work? When re-reading those entries, the
htable contents look the same as during the first start, but in the
database it is a bit harder to read.


And while I'm at it: Is there a way to regularly write back the
current htable contents to the database? Or even to sync every write
directly into the database?

Thanks in advance
Sebastian

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


Re: [SR-Users] Issue with Dispatcher Failover algorithm

2017-05-31 Thread Sebastian Damm
Hi,

On Thu, May 25, 2017 at 2:18 PM, Cristi Constantin
 wrote:
>   if (ds_is_from_list(7, 3, "$ru")) {
>   remove_hf("Route");
>   if(!ds_select_dst("7", "8")) {
> send_reply("404", "No destination");
> exit;
>   }
>   }

I might be off, but what exactly is this line good for?

>   if (ds_is_from_list(7, 3, "$ru")) {

As I understand the documentation, you are checking whether the
request URI of your packet is in the dispatcher set for group 7. But
unless you modify $ru somewhere above this snippet to match one of the
entries of your dispatcher set 7, this if statement should never
evaluate to "true", so the ds_select_dst("7", "8") is never evaluated.

Maybe your call gets dispatched by some other part of your main route?

Regards,
Sebastian

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


[SR-Users] app_lua and sqlops returns error

2017-06-14 Thread Sebastian Damm
Hi,

I'm developing some routing logic with Kamailio 5.0.1 and app_lua.
I've integrated my lua script and now I'm trying to use sqlops within
the script. I want to use the reconnect stuff of sqlops instead of
implementing it by myself.

This is what the Kamailio config looks like:
[..]
loadmodule "db_mysql.so"
loadmodule "sqlops.so"
loadmodule "app_lua.so"
[..]
modparam("sqlops", "sqlcon", "ca=>mysql://kamailio:foobar@127.0.0.1/kamailio")

modparam("app_lua", "reload", 1)
modparam("app_lua", "register", "sqlops")
modparam("app_lua", "load", "/etc/kamailio/playground.lua")

### Routing Logic 


# Main SIP request routing logic
request_route {
route(everythinginlua);
}

onreply_route {
route(everythinginlua);
}

route[everythinginlua] {
if(!lua_run("handle_packet")) {
xlog("L_ERR", "SCRIPT: failed to execute lua function!\n");
}

drop;
exit;
}

The lua script looks like this:

-- Start of script
function handle_packet()
  sr.log("L_INFO", "Got packet method "..sr.pv.get("$rm"))
  local status = sr.sqlops.sql_query("ca", "SELECT * FROM table", "fooresult")
  sr.err("sql query returned status "..status)
end
-- End of script

Now when a packet comes in, I see the following in the log file:

Jun 14 11:19:59 busch /usr/sbin/kamailio[13254]: ERROR: app_lua
[app_lua_sr.c:104]: lua_sr_log(): Got packet method REGISTER
Jun 14 11:19:59 busch /usr/sbin/kamailio[13254]: ERROR: app_lua
[app_lua_api.c:713]: app_lua_run_ex(): error from Lua:
/etc/kamailio/playground.lua:4: attempt to call field 'sql_query' (a
nil value)
Jun 14 11:19:59 busch /usr/sbin/kamailio[13254]: ERROR: app_lua
[app_lua_api.c:726]: app_lua_run_ex(): error executing: handle_packet
(err: 2)
Jun 14 11:19:59 busch /usr/sbin/kamailio[13254]: ERROR: 

Re: [SR-Users] app_lua and sqlops returns error

2017-06-19 Thread Sebastian Damm
Hi Daniel,

thanks for the reply. I just set up a test configuration for KEMI, and
it does work when loading an external lua script. However, it would be
nice if I could write my 5 lines of glue code (I have written a class
for all my functions) within my kamailio.cfg. Is this somehow
possible?

Also, when loading app_lua with KEMI and then looking into the
functions list via kamcmd, I don't see my functions exported from
sqlops. Are they only available when using the "old way"?

Best Regards,
Sebastian

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


Re: [SR-Users] app_lua and sqlops returns error

2017-06-20 Thread Sebastian Damm
Hi,

On Tue, Jun 20, 2017 at 1:15 PM, Daniel-Constantin Mierla
 wrote:
>> thanks for the reply. I just set up a test configuration for KEMI, and
>> it does work when loading an external lua script. However, it would be
>> nice if I could write my 5 lines of glue code (I have written a class
>> for all my functions) within my kamailio.cfg. Is this somehow
>> possible?
> I don't really get what you mean here, can you provide more
> details/examples?

I start my kamailio.cfg with the usual lines:

listen=1.2.3.4:5060

loadmodule "lm.so"
loadmodule "app_lua.so"

modparam [..]

Now in the examples in the modparam of kemi and app_lua a lua file
gets loaded there. And after setting

cfgengine=lua

the kamailio.cfg ends. Everything else is done in this second file.

I was just wondering whether it would be possible to include the
content of the second file into the kamailio.cfg file, so that I have
only one configuration file. So after switching to lua as config
language, I would go on writing something like this directly into
kamailio.cfg:

foo = require "foo"

function ksr_request_route()
[..]
end

Is this possible? Or does the design of kemi explicitly demands a
second file to be loaded?

> The functions exported in the old way (not vi Kemi), are not listed in
> the rpc command response. If you try with master branch, sqlops has its
> functions also exported via Kemi and they will be listed via rpc.

I know that I can't find the old way functions via rpc. But what I
found out later was that sqlops doesn't export to kemi in 5.0.2.

Are there already plans on abandoning the old way of including lua
files? Or will both ways be available for quite a while? If I'm
setting up a new system, I don't want something I have to completely
redesign in the near future.

Best Regards,
Sebastian

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


[SR-Users] Using lock() correctly

2017-06-28 Thread Sebastian Damm
Hi,

for a project I need to make sure, I have a setup where I get
mirror-traffic into Kamailio which has to do something with it. To
work correctly, I need to make sure, the initial INVITE is processed
correctly before any reply to the same call. So I thought I use lock()
and unlock() for it.

This is what the relevant kamailio.cfg part looks like:

request_route {
  xlog("L_INFO", "Got new packet $rm: $si => $Ri\n");
  route(li);
}

onreply_route {
  xlog("L_INFO", "Got new packet $rm: $si => $Ri - Reply Code $rs\n");
  route(li);
}

route[magic] {
  lock("$ci");
  xlog("L_INFO", "Obtained lock, calling lua...\n");
  if(!lua_run("handle_packet")) {
xlog("L_ERR", "SCRIPT: failed to execute lua function!\n");
  }
  unlock("$ci");
  xlog("L_INFO", "Lua finished, released lock...\n");

  drop;
  exit;
}



And this is what the log says:

Jun 28 13:27:04 busch /usr/sbin/kamailio[18836]: INFO: 

Re: [SR-Users] get online user from api

2017-06-28 Thread Sebastian Damm
Hi,

you need to use the jsonrpcs module:
http://www.kamailio.net/docs/modules/5.0.x/modules/jsonrpcs.html

This needs the xhttp module to be loaded first, and you can find examples
in the documentation of those two modules.

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


Re: [SR-Users] remote ip address of sender and receiver

2017-06-29 Thread Sebastian Damm
Hi,

where do you get the IP address of the receiver from? You can get the
local interface address of Kamailio where the request was received
with $Ri, but I guess you want the IP address of the target host. If
you are dealing with locally registered users only, you can use the
request URI after calling lookup("location"). This should contain the
target's IP address somewhere.

Best Regards,
Sebastian

On Thu, Jun 29, 2017 at 4:27 PM, vuleetu  wrote:
> Hi, all
>
>Is there any way to get remote ip address of both sender($si) and
> receiver(?)? I am configuring kamailio with multiple rtpproxy sets.
> Basically, rtpproxy set will be choosed based on the country those ip
> addresses of caller and callee belong to. Lets say if caller and callee are
> both in US, set 1 will selected. If they are not in the same country, set 2
> will be selected.  I dont know if there is any way to do that.
>
>
> Best regards
>
> Fisher
>
> ___
> 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] Using lock() correctly

2017-07-03 Thread Sebastian Damm
Hi again,

since there really isn't much to find about the lock() function, can
somebody tell me if my assumptions about how it should work are wrong?
Daniel?

Best Regards,
Sebastian

On Wed, Jun 28, 2017 at 1:39 PM, Sebastian Damm  wrote:
> Hi,
>
> for a project I need to make sure, I have a setup where I get
> mirror-traffic into Kamailio which has to do something with it. To
> work correctly, I need to make sure, the initial INVITE is processed
> correctly before any reply to the same call. So I thought I use lock()
> and unlock() for it.
>
> This is what the relevant kamailio.cfg part looks like:
>
> request_route {
>   xlog("L_INFO", "Got new packet $rm: $si => $Ri\n");
>   route(li);
> }
>
> onreply_route {
>   xlog("L_INFO", "Got new packet $rm: $si => $Ri - Reply Code $rs\n");
>   route(li);
> }
>
> route[magic] {
>   lock("$ci");
>   xlog("L_INFO", "Obtained lock, calling lua...\n");
>   if(!lua_run("handle_packet")) {
> xlog("L_ERR", "SCRIPT: failed to execute lua function!\n");
>   }
>   unlock("$ci");
>   xlog("L_INFO", "Lua finished, released lock...\n");
>
>   drop;
>   exit;
> }
>
>
>
> And this is what the log says:
>
> Jun 28 13:27:04 busch /usr/sbin/kamailio[18836]: INFO: 

Re: [SR-Users] How to convert ipv6 to ipv4 address inside message body

2017-07-03 Thread Sebastian Damm
Hi,

On Fri, Jun 30, 2017 at 5:40 PM, Narayan P  wrote:
> But when 183 session progress came ,kamailio is sending its ipv6 address to
> pjsip client inside sdp body.So that  it is not accepting and 488 error
> message is giving.
>
>
> How to convert ipv6 to ipv4  inside kamailio so that pjsip can accept.

don't know how the appropriate options would look like for rtpproxy,
but with rtpengine you have to define an "external" and an "internal"
interface and then use the correct options for bridging from external
to internal. And you have to call the appropriate rtpproxy function
for each reply that has an SDP body, not only for the request.

See https://www.youtube.com/watch?v=j8e0D2aOE5A (from Kamailioworld
two years ago) for configuration examples using the rtpengine module.

HTH
Sebastian

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


Re: [SR-Users] Using lock() correctly

2017-07-03 Thread Sebastian Damm
Hi,

yes, it is. I'm really bad in fixing my configuration for the mailing
list or the bugtracker. But those two route calls do call
route[magic].

Best Regards,
Sebastian

On Mon, Jul 3, 2017 at 10:23 AM, Daniel-Constantin Mierla
 wrote:
> Hello,
>
> first a quick check: is route[li] supposed to be route[magic]? Otherwise
> it is missing from your example.
>
> Cheers,
> Daniel
>
> On 03.07.17 10:04, Sebastian Damm wrote:
>> Hi again,
>>
>> since there really isn't much to find about the lock() function, can
>> somebody tell me if my assumptions about how it should work are wrong?
>> Daniel?
>>
>> Best Regards,
>> Sebastian
>>
>> On Wed, Jun 28, 2017 at 1:39 PM, Sebastian Damm  wrote:
>>> Hi,
>>>
>>> for a project I need to make sure, I have a setup where I get
>>> mirror-traffic into Kamailio which has to do something with it. To
>>> work correctly, I need to make sure, the initial INVITE is processed
>>> correctly before any reply to the same call. So I thought I use lock()
>>> and unlock() for it.
>>>
>>> This is what the relevant kamailio.cfg part looks like:
>>>
>>> request_route {
>>>   xlog("L_INFO", "Got new packet $rm: $si => $Ri\n");
>>>   route(li);
>>> }
>>>
>>> onreply_route {
>>>   xlog("L_INFO", "Got new packet $rm: $si => $Ri - Reply Code $rs\n");
>>>   route(li);
>>> }
>>>
>>> route[magic] {
>>>   lock("$ci");
>>>   xlog("L_INFO", "Obtained lock, calling lua...\n");
>>>   if(!lua_run("handle_packet")) {
>>> xlog("L_ERR", "SCRIPT: failed to execute lua function!\n");
>>>   }
>>>   unlock("$ci");
>>>   xlog("L_INFO", "Lua finished, released lock...\n");
>>>
>>>   drop;
>>>   exit;
>>> }
>>>
>>>
>>>
>>> And this is what the log says:
>>>
>>> Jun 28 13:27:04 busch /usr/sbin/kamailio[18836]: INFO: 

Re: [SR-Users] Using lock() correctly

2017-07-03 Thread Sebastian Damm
Hi Daniel,

thanks for the reply.

On Mon, Jul 3, 2017 at 11:57 AM, Daniel-Constantin Mierla
 wrote:
> the last log message is outside of the lock()/unlock(), so it can
> printed whenever the OS decides to allocate CPU for it. You should move
> it inside the locked block, but then also be sure the syslog is not
> asynchronous, because then it can be syslog changing the order.

Well but shouldn't it be printed only after the lua block was
executed? It still looks like the second packet didn't wait for the
first packet to release the lock.

My problem is, that I'm writing entries into a hash table if some
conditions of an INVITE matches. But the 100 Trying often comes in
before the processing of the INVITE is finished. So it is dropped
because the reference in the hash table is missing. That's why I
wanted to have locking. The second process shouldn't print out
"Obtained lock" until the other one has released the lock. And since
the first process is still within it's lua logic, I'm pretty sure the
lock has not been released.

> Also, unrelated, you should not use drop, unless you want to drop the
> response and not sending it out. For request is not making any
> difference compared with exit.

Actually, I want to drop every packet on the system, because it is
only a sniffer that does something with the sniffed packets.

Best Regards,
Sebastian

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


Re: [SR-Users] Using lock() correctly

2017-07-03 Thread Sebastian Damm
Okay, I understand. But even after processing the second packet
finished, there are still messages coming from the lua script
processing the first packet. And those log lines come from within the
lock.

I would expect that the log lines look like that:

Jun 28 13:27:04 busch /usr/sbin/kamailio[18836]: INFO: 

Re: [SR-Users] Using lock() correctly

2017-07-03 Thread Sebastian Damm
Okay, this is the order from my first mail:

(1) Jun 28 13:27:04 busch /usr/sbin/kamailio[18836]: INFO: 

Re: [SR-Users] Using lock() correctly

2017-07-03 Thread Sebastian Damm
On Mon, Jul 3, 2017 at 3:05 PM, Daniel-Constantin Mierla
 wrote:
> Meanwhile, the one thing you cans till check is to be sure $ci is the
> same in both cases, print it with xlog, but within some chars (quotes,
> parenthesis) to be sure the is no white space around it.

In my latest example, without lua and just with "sleep" in there, I
have enclosed $ci in parentheses, so you see it is actually the same
Call-ID. I tried raising the log level to debug, too, but nothing gets
printed out when the lock() function is being called.

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


Re: [SR-Users] Using lock() correctly

2017-07-03 Thread Sebastian Damm
Hi,

On Mon, Jul 3, 2017 at 4:22 PM, Daniel-Constantin Mierla
 wrote:
> Can you paste here the parameters for cfgutils module related to locks?

Wow, that's what I missed. I didn't set any parameter at all. I didn't
expect the locking to not work at all if I don't set it. I thought
there was a reasonable default value, which I only have to tune if
needed. After setting

modparam("cfgutils", "lock_set_size", 4)

the locking works as expected. Maybe that should be added to
documentation. I'll create a PR.

So I should set the size to something greater than the amount of
concurrent locks expected later? Is there a maximum?

Best Regards and many thanks,
Sebastian

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


[SR-Users] app_lua reload - what exactly gets reloaded?

2017-07-05 Thread Sebastian Damm
Hi,

we have written some logic for a project in lua. There is a small
function that gets called from Kamailio, but the main logic is done in
a self-written module. That module does initialize some values from
database on the first request that comes in.

Now when reloading app_lua from kamcmd or via jsonrpc, I don't see the
log output generated when initializing.

In the debug log, I can see that the reload is taking place, but the
variables and state seem to not get reset.

What does the reload command actually reload?

Best Regards,
Sebastian

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


Re: [SR-Users] app_lua reload - what exactly gets reloaded?

2017-07-06 Thread Sebastian Damm
Hi,

On Wed, Jul 5, 2017 at 6:47 PM, Daniel-Constantin Mierla
 wrote:
> the reload command marks the scripts specified by 'load' parameter to be
> reloaded next time they are going to be used.

That's what I saw in the debug logs. But what does that exactly mean?
I thought the script would get reinitialized and starts with a fresh
state. As if I would restart Kamailio only without all the Kamailio
initialization. But that seems not to be true. My "initialize" method
is not called, because the global object variable is already set
(which isn't when the script is executed after Kamailio was started).

Is there any way to "reset" the script except restarting Kamailio?

Regards,
Sebastian

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


Re: [SR-Users] app_lua reload - what exactly gets reloaded?

2017-07-06 Thread Sebastian Damm
Hi,

On Thu, Jul 6, 2017 at 10:16 AM, Daniel-Constantin Mierla
 wrote:
> it sounds like you want to re-initialize the Lua interpreter, not to
> reload the Lua script. If you want a fully fresh Lua interpreter, then
> at this moment you have to restart kamailio.

Does the script get some kind of notification that a reload took place?

Is there any variable or something that I can use inside the script to
check whether it was just reloaded? It's really just an
initialisation. My script has to fetch some database entries once to
work. So if I could react on a signal or other kind of notification,
this could help, too.

Regards,
Sebastian

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


Re: [SR-Users] app_lua reload - what exactly gets reloaded?

2017-07-07 Thread Sebastian Damm
Hi,

On Thu, Jul 6, 2017 at 12:26 PM, Daniel-Constantin Mierla
 wrote:
> You can check a shared memory variable (like $sht(...) or $shv(...))
> that you can change via rpc, so you can re-fetch the database records
> even if you don't change the lua script.

I've implemented it as suggested, and it works as expected.

Thanks as always for the valuable input.

Best Regards,
Sebastian

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


Re: [SR-Users] What happens to calls when Kamailio restarts?

2017-07-13 Thread Sebastian Damm
Hi,

On Wed, Jul 12, 2017 at 11:53 AM, Alex Balashov
 wrote:
> All SIP messages passing through the proxy can be forwarded statelessly
> and based on properties of the SIP message alone.

There's one thing that could happen: Calls that get cancelled after a
restart, could possibly keep on ringing on the far end. At least if
you check for an active transaction in your kamailio config.

  if (!t_check_trans()) {
  sl_send_reply("481", "Call/Transaction does not exist");
  xlog("L_ERR", "CANCEL: found no matching transaction F=$fu T=$tu
R=$ru\n");
  return;
  }

And if you do some sort of random dispatching, CANCELs could end up on
a different gateway.

But other than that, a restart shouldn't cause much trouble.
Especially in-call requests get routed by Route headers only.

Regards,
Sebastian

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


Re: [SR-Users] about rtpengine-[offer-answer] via-branch flag

2017-07-18 Thread Sebastian Damm
Hi,

On Tue, Jul 18, 2017 at 9:42 AM, Juha Heinanen  wrote:
> Is the note about "serial forking" correct or should it be about
> "parallel forking" instead?  In case of serial forking, it would not
> matter if the whole call is deleted, because a new offer would be issued
> for the next branch.  Or perhaps I just don't understand the meaning of
> the note?

If the proxy that does the parallel forking is the same that issues
the rtpengine call, it shouldn't matter because there won't be a
delete command for the cancelled branch. If you have a scenario where
the proxy sends out multiple branches and for example a load balancer
does the rtpengine stuff, then the load balancer should use the via
branch flag or the cancelled branch will kill the call.

In serial forking, the new INVITE could go out before the CANCEL is
sent out. If that happens, the Via branch is needed to not kill the
whole call.

So one can think of scenarios with both serial and parallel forking,
where the via-branch flag can be useful.

Regards,
Sebastian

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


Re: [SR-Users] error using avp_db_load with mongodb

2017-07-26 Thread Sebastian Damm
Hi,

I've seen this before, but with MySQL. Kamailio is pretty strict with
data types of database fields. IIRC I tried to use it with a view and
the view returned a string value where Kamailio expected an integer
and threw the same error. So maybe you might want to check the
reference structure of the usr_preferences table under
https://github.com/kamailio/kamailio/blob/master/utils/kamctl/mongodb/kamailio/usr_preferences.json
with your local structure.

HTH
Sebastian

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


Re: [SR-Users] why is tcp_no_connect disabled by default

2017-07-27 Thread Sebastian Damm
Hi,

On Thu, Jul 27, 2017 at 3:57 PM, Vik Killa  wrote:
> thinking more about this, the only time it makes sense (on an IPv4 network)
> is if kamailio is operating as a UAC (using uac module)
> Or am i misunderstanding something?

There are many scenarios, where actively opening a TCP connection to a
peer is desired. Carrier interconnects for example. Or TCP connections
inside a (carrier) network. For those scenarios the default is
suitable.

For a registrar dealing with client connections, you will probably
want to turn creation of TCP sessions off.

Best Regards,
Sebastian

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


Re: [SR-Users] Kamailio cannot be installed in ubuntu

2017-07-28 Thread Sebastian Damm
Hi,

On Fri, Jul 28, 2017 at 8:25 AM, Ashutosh chaubey
 wrote:
> Jul 28 11:37:22 coditas-Vostro-3446 kamailio[5293]: ERROR: loading config
> file(/usr/local/kamailio-4.4/etc/kamailio/kamailio.cfg): No such file or
> directory

That's the actual error. Looks to me as if the $CFGFILE variable just
points to a non-existant configuration file.

Maybe you want to use the official Kamailio repositories, there are
Xenial packages available. Add this line to your sources.list:

deb http://deb.kamailio.org/kamailio xenial main

That's the current stable relase (5.0). If you really need the 4.4
release, use this repository:

deb http://deb.kamailio.org/kamailio44 xenial main

I would hope, that the error you experienced is fixed in the official sources.

Best Regards,
Sebastian

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


Re: [SR-Users] Kamailio cannot be installed in ubuntu

2017-07-28 Thread Sebastian Damm
Hi,

On Fri, Jul 28, 2017 at 1:25 PM, Ashutosh chaubey
 wrote:
> Hi,
> i was able to start kamailio service without database configuration but
> after the database configuration its giving the following error : -
> [..]
> Jul 28 16:37:51 coditas-Vostro-3446 /usr/sbin/kamailio[25077]: ERROR: 
> [db.c:318]: db_do_init2(): could not add connection to the pool
> Jul 28 16:37:51 coditas-Vostro-3446 /usr/sbin/kamailio[25077]: ERROR: usrloc
> [dlist.c:637]: register_udomain(): failed to open database connection
> Jul 28 16:37:51 coditas-Vostro-3446 /usr/sbin/kamailio[25077]: ERROR:
> registrar [reg_mod.c:561]: domain_fixup(): failed to register domain

There is a database connection error on a line not printed here.
journalctl -u kamailio.service could help.

Regards,
Sebastian

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


Re: [SR-Users] error using avp_db_load with mongodb

2017-07-31 Thread Sebastian Damm
Hi,

On Fri, Jul 28, 2017 at 6:03 PM, hdssdsdsdsfsdf hdssdsdsdsfsdf
 wrote:
> if (avp_db_load("$to/username", "$avp(s:email)")) {
> xlog("bla02");
> }

$to is not a valid pseudo variable. You probably want to replace
"$to/username" by "$tU" or "$rU" or some variable where the user you
are searching is written in the SIP packet.

BR
Sebastian

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


[SR-Users] Reverse DNS lookups inside Kamailio

2017-08-01 Thread Sebastian Damm
Hi,

for a project I need the option to do a reverse lookup of an IP
address and use the value from it in a variable.

As far as I could see the ipops module only allows SRV and A record
lookups. Is there anything I missed?

And if there is nothing inside Kamailio, how could a good approach look like?

Thanks in advance,
Sebastian

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


Re: [SR-Users] Kamailio inserting Quote " mark in SIP header

2017-08-03 Thread Sebastian Damm
Hi,

On Thu, Aug 3, 2017 at 3:26 AM, Arslan Saeed  wrote:
> We are seeing that Kamailio's nat_helper_module function  of
> add_rcv_param(),  inserts " (quote)  mark to some of the SIP headers (as
> below in the contact header in sip 200 OK response)
>
> Contact:
> ;expires=172
>
> We got few SIP UAs that are  complaining about the quote mark inclusion in
> contact header and responding back with SIP 400 bad syntax status code.
>
> Requesting views / suggestions from community about this behavior of
> kamailio and any workarounds available.

Indeed the quotes are put around the received address by nathelper -
and that has been the case since the initial commit. However, the same
param is for example added by the path module, but without quotes.

I have created a Pull request removing those quotes. However, I did
not try the change locally. Maybe you can grab the patch from here and
apply it to your Kamailio:
https://github.com/kamailio/kamailio/pull/1203

I've never used this function and don't know what it I could use it
for. We only use the add_contact_alias() function for appending the
received information. This information is later used when sending
incoming calls to registered clients.

HTH
Sebastian

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


Re: [SR-Users] carrierroute and failure route

2017-08-03 Thread Sebastian Damm
Hi,

On Thu, Aug 3, 2017 at 12:48 PM, Yu Boot  wrote:
> First one works OK, but if second route triggers, the following disaster
> occurs (tshark dump) https://pastebin.com/00Ayty36

it's not really a disaster. The Mediant2000 sends out a reINVITE after
the call was established. The client responds with a 200 OK, but then
the ACK is sent to the wrong request URI. While in the reINVITE the
request URI was "sip:200@172.16.0.158:5060;alias=1.2.176.33~5060~1",
it is "sip:200@172.16.0.158:5060" later in the ACK.

My guess is you're record routing your packets even in loose routing.
And you're not doing adding contact aliases there. I've seen before
that clients then re-learn their route to the other side and fuck up
loose routing.

You should only call record_route() in the initial call setup, never
again after the 200 OK. Then you should be fine.

Regards,
Sebastian

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


Re: [SR-Users] [ *SPAM* 5.1 ] Re: carrierroute and failure route

2017-08-04 Thread Sebastian Damm
Hi,

On Thu, Aug 3, 2017 at 3:45 PM, Yu Boot  wrote:
> I use this in WITHINDLG to handle reINVITEs
>
> else if ( is_method("INVITE") ) {
> record_route();
>
> or T.38 fax behind NAT doesn't work at all.

Actually that shouldn't be the case. I know, T.38 needs a reINVITE,
too, but the record route information is supplied in the 200 OK. (If
it isn't than that's what's broken.) The route information doesn't
change with reINVITEs, so there's no need to record-route reINVITEs.

But if you really need the record-route there, then you need to call
set_contact_alias() in the reply to your reINVITE. So you might have
to add a different reply_route[reinvite] and set t_on_reply(reinvite)
in the WITHINDLG route. But I really think that's not necessary.

Sebastian

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


Re: [SR-Users] [ *SPAM* 5.1 ] Re: carrierroute and failure route

2017-08-04 Thread Sebastian Damm
Hi,

On Fri, Aug 4, 2017 at 1:37 PM, Yu Boot  wrote:
> Problem was magically solved by replacing t_relay in CR route by route
> (RELAY) :)

Okay, the only thing route(RELAY) does more is set the reply route. So
maybe your replies were not correctly handled in first place. (And it
does take care of the dialog handling, but I don't know whether that's
important.)

> And finally a question. Can't find answer in Kami docs. What loose_route()
> proc actually does? Check some parameters, rewrite other parameters? I think
> real routing is performed by R-URI manipulations and t_relay to actually
> send created message, isn't it?

Actually, it just removes the top Route header (itself) and takes the
next Route header and places it's content into $du. When calling
t_relay() after that, the request is sent on to $du (or $ru if it was
the last hop before reaching the destination).

Documentation can be found here:
https://www.kamailio.org/docs/modules/devel/modules/rr.html#loose-route-id

BR
Sebastian

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


Re: [SR-Users] carrierroute and failure route

2017-08-07 Thread Sebastian Damm
Hi,

On Sat, Aug 5, 2017 at 7:00 PM, Yu Boot  wrote:
> Gotcha! I've added fix_nated_contact() to [NATDETECT] route and now all
> messages UNTIL reinvite occurs are with correct NATed IP in "Contact" field.

while fix_nated_contact() may work in your scenario, it is generally a
"bad variant" to use. The set_contact_alias() method is much less
invasive. Depending on the client, it could reject reINVITEs or other
in-call messages (like BYE) because the contact header initially sent
differs from the request URI of the incoming message.

That's why set_contact_alias() only appends the real IP of the client,
and handle_ruri_alias() takes care that the original contact is set
correctly.

As said, if it works in your environment, everything is fine. Just be
careful if you don't know what devices will be talking to your
service.

BR
Sebastian

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


Re: [SR-Users] how to remove a line in sdp

2017-08-09 Thread Sebastian Damm
Hi,

On Tue, Aug 8, 2017 at 12:24 PM, Sunil More  wrote:
> I have the following SDP coming in from a carrier and would like to remove
> the following line. Cant figure how to go about it.

sdpops should do what you need:

http://www.kamailio.net/docs/modules/5.0.x/modules/sdpops.html#sdpops.f.remove_line_by_prefix

Best Regards,
Sebastian

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


Re: [SR-Users] [Solved] Re: Reinvite, rewrite reply SDP?

2017-08-14 Thread Sebastian Damm
Hi,

On Mon, Aug 14, 2017 at 9:50 PM, Yu Boot  wrote:
> Problem was that SDPs in reinvite sequence have already "nortpproxy=yes"
> flag set (from initial INVITE transaction I think), and SDP rewriting just
> don't triggers when it should.

Oh, I've seen that before. User Agents adding received custom SDP
fields in their own response. Can be confusing.

> One little line has solved this issue:
> modparam("rtpproxy", "nortpproxy_str", "")
> Pretty dumb solution, but for now it finally works. Sorry for annoying :)

There's actually a flag for it in the rtpproxy_offer call.

From
http://www.kamailio.net/docs/modules/5.0.x/modules/rtpproxy.html#rtpproxy.f.rtpproxy_ofrer

f - instructs rtpproxy to ignore marks inserted by another rtpproxy in
transit to indicate that the session is already goes through another
proxy. Allows creating a chain of proxies.

Best Regards,
Sebastian

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


Re: [SR-Users] rtpengine : question about RTP/RTCP multiplexing (RFC 5761) and demultiplexing

2017-08-16 Thread Sebastian Damm
Hi,

On Wed, Aug 16, 2017 at 10:32 AM, Abdoul Osséni  wrote:
> Does this mean that uac must be compliance with RFC 5761 if I want multiplex
> and demultiplex RTP/RTCP between UAC and rtpengine?

I don't know whether I understand your question correctly, but the
options in rtpengine are "graceful". How rtpengine behaves depends on
what the client offered in the incoming SDP. So if your UAC isn't
capable of multiplexing, rtpengine won't force it into doing it.

Since Google changed their default to enable multiplexing in the
Chrome WebRTC implementation, we are using the following line for
converting audio between WebRTC and Asterisk:

WebRTC -> rtpengine -> Asterisk:
rtpengine_manage("force trust-address replace-origin
replace-session-connection ICE=remove RTP/AVP rtcp-mux-demux");

Asterisk -> rtpengine -> WebRTC:
rtpengine_manage("force trust-address replace-origin
replace-session-connection ICE=force RTP/SAVPF rtcp-mux-offer");

That makes rtpengine always send out rtp and rtcp on different ports
for audio going to Asterisk, and offers the multiplexing for audio
going to the WebRTC client. Still the client can choose whether it
wants to accept multiplexed traffic or receive it on two ports.

(BTW: Enabling this helped to dramatically reduce audio support issues
on WebRTC calls.)

Best Regards,
Sebastian

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


Re: [SR-Users] On the fly Change

2017-08-16 Thread Sebastian Damm
Hi,

On Wed, Aug 16, 2017 at 11:02 AM, Logeshwaran G  wrote:
> Is it possible to use the LCR reload command with the xmlrpc module?

Of course. You can use xmlrpc or jsonrpc, whichever you prefer. You
need the xhttp module as a dependency though.

Best Regards,
Sebastian

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


Re: [SR-Users] On the fly Change

2017-08-16 Thread Sebastian Damm
Unless you want to trigger that after receiving some kind of "SIP
control packet", you would rather add something like this in your
kamailio.cfg:

event_route[xhttp:request] {
  if ($hu =~ "^/jsonrpc") {
xlog("L_NOTICE", "Got jsonrpc request, body '$rb'\n");
jsonrpc_dispatch();
  } else {
xhttp_reply("500", "Internal Server Error", "text/html",
  "Unsupported URL $hu");
  }
  return;
}

Then you would use curl or a script in the language of your choice and
send a request to
http://kamailio_ip:kamailio_tcp_listen_port/jsonrpc
with the json string in the body.

Best Regards,
Sebastian

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


Re: [SR-Users] On the fly Change

2017-08-16 Thread Sebastian Damm
On Wed, Aug 16, 2017 at 1:59 PM, Logeshwaran G  wrote:
> I need to pass the json values through HTTP Request, (i.e Invoking through
> browser like postman client)
>
> Kindly provide me the json lcr.reload key values.

Something like this should work:

curl -X POST --data
'{"id":260,"method":"lcr.reload","jsonrpc":"2.0","params":[]}'
http://$kamailio_ip:$kamailio_port/jsonrpc

BR
Sebastian

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


Re: [SR-Users] On the fly Change

2017-08-17 Thread Sebastian Damm
On Thu, Aug 17, 2017 at 9:13 AM, Logeshwaran G  wrote:
> Also If I commented the dispatch_rpc();
> Kamailio is running but it dosent accepting the http request.
> Please Guide me.

Actually, it is all documented in the xmlrpc module. My example was
for using jsonrpc, xmlrpc works a bit different.

http://www.kamailio.net/docs/modules/5.0.x/modules/xmlrpc.html

The xmlrpc module doesn't depend on the xhttp module, it works
standalone. You need to specify the route name where xmlrpc requests
will end up. In this route you call dispatch_rpc(), just as example
1.8 shows you: 
http://www.kamailio.net/docs/modules/5.0.x/modules/xmlrpc.html#idp29963340

BR
Sebastian

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


Re: [SR-Users] On the fly Change

2017-08-17 Thread Sebastian Damm
I'm afraid I have no idea what you are doing. You already had the
requests coming to your Kamailio this morning when you tried using
dispatch_rpc() inside your xhttp event route. You posted an error log
line.

I don't know what the "http postman" is and what it does. All I know
is that my example code is coming from a Kamailio in my setup where it
is working.

I guess you need to use tcpdump or ngrep to see what's going on.

Sebastian

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


[SR-Users] Documenation of functions exported for KEMI

2017-08-17 Thread Sebastian Damm
Hi,

I was wondering whether there is some kind of documentation of all
functions currently exported for KEMI by Kamailio modules. I know I
can find them somehow via grep, but I could not find a page in the
Kamailio wiki listing all of them. Is there any?

Best Regards,
Sebastian

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


[SR-Users] Consistency: -1 sometimes true, sometimes false

2017-08-23 Thread Sebastian Damm
Hi,

we recently stumbled upon the following problem:

We had something like this in our route:

$var(ret) = allow_address("2");

if ($var(ret)) {
  do_something;
}

Turns out, this always evaluates to true, no matter whether the IP
address really is in address group 2 or not. The values in $var(ret)
are 1 or -1, depending on the outcome of allow_address().

However, if we write it this way

if (allow_address("2")) {
  do_something;
}

the code inside is only executed if the IP address is in address group 2.

Is this some kind of inconsistency? Should negative values in
variables evaluate to true or false?

Best Regards,
Sebastian

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


Re: [SR-Users] Consistency: -1 sometimes true, sometimes false

2017-08-23 Thread Sebastian Damm
Hi,

On Wed, Aug 23, 2017 at 9:47 AM, Alex Balashov
 wrote:
> Makes me think that the return value of functions cannot be captured by
> assigning an arbitrary variable in this manner:

Well, I printed out the content of the variable while debugging and it
carried 1 or -1 depending on the outcome of allow_address(), so this
basically seems to work.

Best Regards,
Sebastian

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


Re: [SR-Users] Consistency: -1 sometimes true, sometimes false

2017-08-24 Thread Sebastian Damm
Hi Daniel,

thanks für the explanation.

Best Regards,
Sebastian

On Wed, Aug 23, 2017 at 3:07 PM, Daniel-Constantin Mierla
 wrote:
> Hello,
>
>
> On 23.08.17 10:36, Alex Balashov wrote:
>> On Wed, Aug 23, 2017 at 10:34:03AM +0200, Sebastian Damm wrote:
>>
>>> Well, I printed out the content of the variable while debugging and it
>>> carried 1 or -1 depending on the outcome of allow_address(), so this
>>> basically seems to work.
>> Fair enough. Then it really is a case of evaluation rules being
>> different for variables than for inline function calls.
>>
> this kind of inconsistency it's a bag that had to be carried over the
> time due to initial version of the scripting language back in 2001-2002
> when it was decided how to evaluate the return codes for
> functions/routing blocks. At that moment there were no config variables,
> so it was considered to make it simple with:
>
>   - evaluate negative return to false
>   - evaluate 0 (zero) return to 'exit'
>   - evaluate positive return to true
>
> Starting with year like 2004-2005, with the addition of the variables,
> they were evaluated as integer numbers, more or less like in C. Boolean
> variables are not defined for config, so it is better (and more
> explicit) to evaluate PVs values against numbers.
>
> In short: boolean evaluation of a return code for a function is done
> differently that the evaluation of returned value by a variable.
>
> 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] Handeling Proxy Cancel event

2017-08-24 Thread Sebastian Damm
Hi,

On Thu, Aug 24, 2017 at 10:05 PM, Abdul Basit  wrote:
> I am trying to capture and distinguish two types of cancels generated by
> kamailio.
> 1- Cancel when Invite timeout 408

You can catch this one in failure route. Whenever an INVITE times out
and you have set t_on_failure(someroute) before, you end up in the
failure route named someroute.

> 2- Cancel generated when call lands on multiple devices and any one of them
> answer the call.

I don't know whether those actually run through any route.

> How can I capture and isolate these proxy generated CANCEL events?

What's the purpose of distinguishing those two CANCELs?

Regards
Sebastian

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


Re: [SR-Users] Handeling Proxy Cancel event

2017-08-25 Thread Sebastian Damm
Hi,

On Fri, Aug 25, 2017 at 10:28 AM, Mikko Lehto  wrote:
> Maybe t_is_canceled() works for your scenario:

Without having tested this, I would expect, that the transaction is
not cancelled but answered.

You might be able to catch it with t_on_branch_failure:
https://www.kamailio.org/docs/modules/devel/modules/tm.html#tm.f.t_on_branch_failure

Maybe those cancels go through there, too, and if you set an AVP when
getting the 200 OK on another branch, you could use those two
informations to get what you need.

Sebastian

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


Re: [SR-Users] Kamailio failover - dialog (transaction) that is available on different proxies

2017-08-28 Thread Sebastian Damm
Hi,

I think your setup might not work as you think it should. See my
comments inline.

On Sun, Aug 27, 2017 at 11:37 AM, Donat Zenichev
 wrote:
> According to my actual question, I've moved further and now think following
> scheme will work fine:
> 1. NAPTR records for every transport protocol (e.g. "
> _sip._udp.domain.org").

Did you mean SRV records? UACs query for SRV records, not NAPTR (as
far as I know).

> 2. SRV records for every NAPTR record (e.g. kamailio1.domain.org,
> kamailio2.domain.org) with same priority/weight for both of them, to balance
> half invites to first one and half invites to second one.

That's part of the SRV lookup in step 1.

> 3. A records for every domain name (e.g. kamailio1.domain.org - 10.0.0.1,
> 10.0.0.2, where actually second one is kamailio2;
> and the same for fqdn kamailio2.domain.org - 10.0.0.2, 10.0.0.1).

Typically DNS servers shuffle the results for a host. This means you
will probably get 10.0.0.2 as the primary IP for your Kamailio1 for
half of the queries. This might not be a problem, but you I don't know
a way of setting up a primary/secondary setup with two A records.

> So the sequence of dialog actions will be
>
> 1. Invite from uac is balanced to kamailio1;
> 2. Dialog is established and media stream is up;

While there is a DB mode parameter for the dialog module, from
documentation I expect the dialog entries only to be written to
database when set to mode 1. I think Kamailio actually operates with
what's in memory. So you can probably write the information to a
shared database, but Kamailio2 will know nothing about the data
written by Kamailio1 (unless Kamailio2 is restarted).

> 3. Then kamailio1 goes down;
> 4. Bye message tries to achieve host that was set in rr hf (kamailio1), but
> kamailio1 (10.0.0.1) is down, so bye message will be sent to 10.0.0.2
> (kamailio2) and a cause of the behaviour is 10.0.0.2 ip assigned to
> kamailio1 fqdn as second ip.

How should the "down" get detected by the UAC? I would expect the UAC
to just retransmit the BYE 6 times and then time out.

> 5. The message will be processed by kamailio2, because of common
> dialog/usrloc db.

My guess would be that neither one of your assumptions will happen.

Best Regards,
Sebastian

P.S.:
> I will make an effort to set up it next week.
> In case of success, I will write a short report here.

Of course, if I'm totally wrong, I'd be happy to hear that, too.

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


Re: [SR-Users] Loading keys with key_type="1" from database for htable - Module params help needed

2017-08-30 Thread Sebastian Damm
Hi,

adding to that, working with arrays in Kamailio is not really simple.
If in your database you have the following values:

key1 => value1
key1 => value2
key1 => value3

and have set those rows with an array type, the htable will look like
this after startup:

$sht(htableName=>key1[0]) == "value1"
$sht(htableName=>key1[1]) == "value2"
$sht(htableName=>key1[2]) == "value3"
$sht(htableName=>key1::size) == 3

Now you can use the size helper variable and iterate over those array
entries. So far so good. The bad comes when manipulating those
entries. Suppose you want to delete value2 from your htable. After you
did that, the key1[1] entry will just be missing, you'll have a hole
in your numbering, and the size counter will still be at three. And if
you then want to add another entry to the htable, you will have to
find out the next free key number (3) yourself, and you will have to
incement the size helper variable manually.

And to make it worse, when writing back the htable on shutdown, those
array type rows in database will end up as regular entries having
key1[0] etc as key. The size helper row will be written into database,
too.

So my recommendation would be to use the array stuff only on readonly
htables, but never on htables you manipulate inside Kamailio. There's
just too much that you have to think about.

Best Regards,
Sebastian

On Wed, Aug 30, 2017 at 9:04 PM, Daniel-Constantin Mierla
 wrote:
> Hello,
>
> can you try with a single value column?
>
> The array type is something that was supposed to help keeping keys simpler
> in database, but the key is concatenated with the index, is not really an
> array.
>
> Cheers,
> Daniel
>
>
> On 30.08.17 20:06, George Diamantopoulos wrote:
>
> Hello all, I'm becoming a regular here now, aren't I?
>
> So I have this table in mysql:
> +--+--++---+-+
> | key_name | key_type | value1 | value2 | value3 |
> +--+--++++
> | key1 | 1| valueA | valueF | valueK |
> | key1 | 1| valueB | valueG | valueL |
> | key1 | 1| valueC | valueH | valueM |
> | key2 | 1| valueD | valueI | valueN |
> | key2 | 1| valueE | valueJ | valueO |
>
> I was hoping I could have all this information available in an sht, where
> for example:
>
> $sht(a=>$key1[0]), $sht(a=>$key1[1]), etc
>
> would return:
>
> "valueA,valueF,valueK", "valueB,valueG,valueL" etc
>
> but I can't figure out how to setup htable to import this data on restart. I
> have tried various combinations of module parameters such as:
>
> modparam("htable", "htable",
> 'my_htable=>size=8;autoexpire=86400;dbtable=my_table;cols="key_name,value1,value2,value3";'
>
> I'm either getting errors, or dumping htable will only show one of the value
> sets (key_type is not set to array).
>
> Does anyone have a working config to share? Thanks!
>
> George
>
>
>
> ___
> 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] Change on the fly logging verbosity - Kamailio v5.0.2

2017-08-31 Thread Sebastian Damm
Hi,

I think you are looking for cfg_rpc:
http://www.kamailio.net/docs/modules/5.0.x/modules/cfg_rpc.html

HTH
Sebastian

On Thu, Aug 31, 2017 at 12:53 PM, Karsten Horsmann  wrote:
> Hello,
>
>
> at this moment i try to figure out the best way to add an "switch" for
> debug/log output.
> I use many xlog, like everyone that starts with kamailio too.
>
> Then i go further and add #!ifdef cases around to switch this via #!define.
>
> Is there any other way to turn on/off my "debug"-logging on the fly, while
> kamailio is still running?
>
>
>
> #!define TESTBED_MODE
>
> request_route{
> ...
> #!ifdef TESTBED_MODE
> route(DEBUG);
> #!endif
>
> ...
> #!ifdef TESTBED_MODE
> xlog("L_INFO","---FIX_SIPS-after: ru:($ru)");
> #!endif
> ...
> }
>
> --
> Kind Regards
> *Karsten Horsmann*
>
> ___
> 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] Call transfer between pbx servers behind kamailio proxy

2017-09-03 Thread Sebastian Damm
Hi,

On Fri, Sep 1, 2017 at 2:35 PM, Iskren Hadzhinedev
 wrote:
> Hi everyone,
> I'm having a hard time transferring calls when the users are on different
> FreeSWITCH servers behind kamailio.

We had to solve that problem a while ago, too. Only with Asterisk
instead of Freeswitch. In newer versions, Asterisk has support for
remote transfer built in, but their own page says you should avoid it
if possible.
https://wiki.asterisk.org/wiki/display/AST/res_pjsip+Remote+Attended+Transfers

I don't know whether that's a possible solution for you, but we found
a solution to make sure whenever there are more than one call for the
same user, they both run through the same Asterisk. So we remember (in
Kamailio whether there are running calls for a user and where they
came from or got dispatched to, and whenever a second call comes in
for that user, it gets sent to the same Asterisk. This way we have
only local transfers, and those do work.

Maybe this is something you can implement in your setup, too. However,
if you really need to send the call to user3 via FreeSWITCH2, then
maybe it could be a solution to first send the ourbound call from
user2 first to FreeSWITCH1 and then dial something on FreeSWITCH2.
This way you will also have the two channels to bridge on FreeSWITCH1.

HTH
Sebastian

___
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


Re: [SR-Users] Q: purpose of t_newtran() in kamailio-basic.cfg route[LOCATION]?

2017-09-09 Thread Sebastian Damm
Hi,

my guess would be that's only for accounting. If I remember correctly,
the acc module won't record this call if a transaction was never
created. So the transaction gets created before sending out the reply.

I could be wrong, though. :)

Best Regards,
Sebastian

On Sat, Sep 9, 2017 at 5:28 PM, Anthony Alba  wrote:
> In kamailio-basic.cfg route[LOCATION] we have the following:
>
> --snip--
> $var(rc) = $rc;
> t_newtran();
> switch ($var(rc)) {
> case -1:
> case -3:
> --snip--
>
> What is the purpose of t_newtran() here? Since we have not hit
> t_relay() yet (and
> don't have a transaction) is this to ensure the caller sees/acks the 404/405?
>
> Earlier in the mailing list
> https://lists.kamailio.org/pipermail/sr-users/2015-April/088062.html
> I read, although this is in reply to a different situation:
>
> "Why do you need to create new transactions yourself with t_newtran()?
> Nonexotic applications of Kamailio usually don't require this. ..."
>
>
> # User location service
> route[LOCATION] {
> if (!lookup("location")) {
> $var(rc) = $rc;
> t_newtran();
> switch ($var(rc)) {
> case -1:
> case -3:
> send_reply("404", "Not Found");
> exit;
> case -2:
> send_reply("405", "Method Not Allowed");
> exit;
> }
> }
>
> # when routing via usrloc, log the missed calls also
> if (is_method("INVITE")) {
> setflag(FLT_ACCMISSED);
> }
>
> route(RELAY);
> exit;
> }
>
> Thanks
> AAlba
>
> ___
> 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] Map Technique(Key value pair) in kamailio

2017-09-10 Thread Sebastian Damm
Hi,

On Mon, Sep 11, 2017 at 8:26 AM, Logeshwaran G  wrote:
> Is there any way to use the Mapping technique in kamailio.
>
> For Example:
> ==
>
> Key = 91, Value = India
> Key = 92, Value = Srilanka
>
> How to store Key Value Pairs into kamailio and how to Retrieve?

You can use a htable for that and read it from DB on startup (or
trigger reload via RPC).

$sht(yourHtableName=>91) would give you India then.

HTH
Sebastian

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


Re: [SR-Users] Proxy Invite to registered natted user

2017-09-19 Thread Sebastian Damm
Hi,

since this is still unanswered:

On Wed, Sep 13, 2017 at 11:01 AM, eskornev  wrote:

> Trying to set Kamailio as proxy in front of Asterisk.
>
> When natted user registers is remembered in Kamailio via save("location").
> Kamailio forwards Register to * with new contact field (pointing to Kamailio).
> But when server originates Invite to user, kamailio transfer
> request to "fake" address that was in original Register contact field 
> (getting it from lookup("location")).
>
> How can i set Kamailio to send Invite to source ip and port of user?
>
> You probably have to do some NAT handling before saving the location.
Especially this should help you:
http://www.kamailio.net/docs/modules/5.0.x/modules/nathelper.html#nathelper.f.add_contact_alias


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


[SR-Users] See how many workers are actually processing packets?

2017-09-19 Thread Sebastian Damm
Hi,

I think this has been answered before, but I don't know the answer. Is
there a way to find out, how many workers are busy right now processing
packets? For a new setup I don't know whether I need 16 or 96 UDP
listeners, but I'd like to scale it correctly.

The setup just inspects HEP messages and sends some of them to a RabbitMQ.
So TM or SL stats probably won't help.

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


[SR-Users] private memory leak - but where?

2017-09-19 Thread Sebastian Damm
Hi,

I'm trying to debug a Kamailio which runs out of memory after a while.
But following the hints at
https://www.kamailio.org/wiki/tutorials/troubleshooting/memory
doesn't help. I know it is the private memory that I'm missing. I
already increased the pkg size to 16M, but somehow that seems to be
not enough.

The Kamailio receives HEP messages, sends them to a lua script where
it is processed. Overall there are not more than 10 custom private
variables used.

In the log I'm seeing these messages:

Sep 19 17:04:42 salm /usr/sbin/kamailio[19134]: ERROR: app_lua
[app_lua_api.c:726]: app_lua_run_ex(): error executing: handle_packet
(err: 2)
Sep 19 17:04:42 salm /usr/sbin/kamailio[19134]: ERROR: 

Re: [SR-Users] private memory leak - but where?

2017-09-19 Thread Sebastian Damm
Okay, when restarting one of those operations I did earlier obviously
made Kamailio dump all its private memory information. So I grepped
everything from PID 19134 and then let the awk line from the Wiki page
run over it. Now I'm lost interpreting the results. The top usages
were those:

108  salm /usr/sbin/kamailio[19134]: WARNING: qm_status:
alloc'd from core: core/rpc_lookup.c: rpc_hash_add(100)
166  salm /usr/sbin/kamailio[19134]: WARNING: qm_status:
alloc'd from core: core/pvapi.c: pv_table_add(234)
195  salm /usr/sbin/kamailio[19134]: WARNING: qm_status:
alloc'd from core: core/cfg.lex: addstr(1382)
   1844  salm /usr/sbin/kamailio[19134]: WARNING: qm_status:
alloc'd from htable: ht_var.c: pv_parse_ht_name(141)
   1862  salm /usr/sbin/kamailio[19134]: WARNING: qm_status:
alloc'd from core: core/pvapi.c: pv_cache_add(272)
   1887  salm /usr/sbin/kamailio[19134]: WARNING: qm_status:
alloc'd from core: core/pvapi.c: pv_parse_format(1075)

Can anybody explain what that means? When are those memory parts allocated?

As I see, those operations seem to have something to do with htables,
right now there are absolutely no write operations, but for each
packet there's at least one read operation on a hash table to see
whether something is set for this Call-ID. All htable handling is done
from my lua script. And private pseudo variables are used pretty much
read-only as well. They might get zeroed at start of processing of the
message, but right now none of them are set again later.

Thanks in advance,
Sebastian

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


Re: [SR-Users] private memory leak - but where?

2017-09-19 Thread Sebastian Damm
Hi Daniel,

thanks for the quick response. See my other mail with more details.

I don't use cfg variable from the lua script, I only access $shv(...)
and $vn(...) or $var(...) and $sht(...) from it. And of course $tU,
$hdr(...) and other builtin variables. Some of the variables I'm
accessing might not be there always, though ($au for example).

Anything I can help with? I only need about half an hour to reproduce it.

Best Regards,
Sebastian

On Tue, Sep 19, 2017 at 5:46 PM, Daniel-Constantin Mierla
 wrote:
> Hello,
>
> do you use kamailio.cfg variables in the lua script? If yes, can you
> show how you do it?
>
> If you have troubles with pkg dump, it should be printed when you
> stop/restart. It would be good to do the pkg summary, it is easier to
> see the used chunks as a report. There are global parameters to
> configure it.
>
> Cheers,
> Daniel
>

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


Re: [SR-Users] private memory leak - but where?

2017-09-20 Thread Sebastian Damm
Thanks Daniel,

looks like that is indeed the case. We the hash table key is the
call-id, but we're not calling $sht(foo=>$ci) but instead passing in
the call-id as a string.

Ich have now written a test script with those two functions:

function handle_packet_bad()
  callId = sr.pv.get("$ci")
  if sr.pv.get("$sht(interceptedSessions=>"..callId..")") ~= nil then
sr.dbg("Lua found matching packet")
  end
end

function handle_packet_good()
  callId = sr.pv.get("$ci")
  sr.pv.sets("$var(htableKey)", callId)
  if sr.pv.get("$sht(interceptedSessions=>$var(htableKey))") ~= nil then
sr.dbg("Lua found matching packet")
  end
end

Then in my Kamailio config, I call one or the other function depending
on whether the PID is odd or even.

if ($pp & 1) {
if(!lua_run("handle_packet_bad")) {
xlog("L_ERR", "SCRIPT: failed to execute lua
function!\n");
}
} else {
if(!lua_run("handle_packet_good")) {
xlog("L_ERR", "SCRIPT: failed to execute lua
function!\n");
}
}

Now when I track the "real_mem" used by the UDP listeners, I see the
difference. While the odd PIDs use more and more memory, the even ones
stay about at the same level.

I wouldn't have found that by myself. Thanks again.

Best Regards,
Sebastian

On Wed, Sep 20, 2017 at 10:56 AM, Daniel-Constantin Mierla
 wrote:
> Hello,
>
> my guess is that you define many cfg variables from lua, which take from
> private memory (their definition).
>
> So $sht(x=>abc) is defined when used first time and kept in memory. If
> you use also $sht(x=>efg), this is another defined variable.
>
> This happens when you do KSR.pv.get("$sht(x=>abc)") or
> KSR.pv.get("$sht(x=>efg)")
>
> To avoid defining a lot of variables, you can do:
>
> KSR.pv.sets("$var(n)", "abc");
> KSR.pv.get("$sht(x=>$var(n)");
> KSR.pv.sets("$var(n)", "efg");
> KSR.pv.get("$sht(x=>$var(n)");
>
> The practically you define only one cfg variable,
> KSR.pv.get("$sht(x=>$var(n)")
>
> The issue is known, there were other reporting it here on the mailing
> list. It's in my to-do before 5.1 to fix it in a way or another, by
> either setting a limit of defined variables and then throw error
> (easier), or track when a variable is used and start deleting the
> definition for older ones when the limit is exceeded.
>
> Cheers,
> Daniel
>
>
>
> On 19.09.17 17:56, Sebastian Damm wrote:
>> Hi Daniel,
>>
>> thanks for the quick response. See my other mail with more details.
>>
>> I don't use cfg variable from the lua script, I only access $shv(...)
>> and $vn(...) or $var(...) and $sht(...) from it. And of course $tU,
>> $hdr(...) and other builtin variables. Some of the variables I'm
>> accessing might not be there always, though ($au for example).
>>
>> Anything I can help with? I only need about half an hour to reproduce it.
>>
>> Best Regards,
>> Sebastian
>>
>> On Tue, Sep 19, 2017 at 5:46 PM, Daniel-Constantin Mierla
>>  wrote:
>>> Hello,
>>>
>>> do you use kamailio.cfg variables in the lua script? If yes, can you
>>> show how you do it?
>>>
>>> If you have troubles with pkg dump, it should be printed when you
>>> stop/restart. It would be good to do the pkg summary, it is easier to
>>> see the used chunks as a report. There are global parameters to
>>> configure it.
>>>
>>> Cheers,
>>> Daniel
>>>
>> ___
>> 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] Encryption of voice stream

2017-09-21 Thread Sebastian Damm
Hello,

since Kamailio does not deal with voice streams, it depends on the
voice gateway or B2BUA or devices you plan to use. Kamailio handles
only signalling, and it can deal with TLS encrypted SIP.

BR
Sebastian

On Thu, Sep 21, 2017 at 11:30 AM, Vasan VS  wrote:
> Hello all,
>
> Kindly let us know if we can have a mechanism to have the voice stream in
> using the SIP server completely encrypted as well as prove that it is
> encrypted using any speific mechanism.
>
> Thanks in advance
>
> Vasan
>
>
> ___
> 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] Send 407 for Invite

2017-09-26 Thread Sebastian Damm
Hello,

http://www.kamailio.net/docs/modules/5.0.x/modules/auth.html

Sebastian

On Tue, Sep 26, 2017 at 9:28 AM, Logeshwaran G  wrote:
> Hi,
>
> How to send the 407 proxy authentication for Invite message?
>
> Input Please
>
> Thanks & Kind Regards,
> Logeshwaran G
>
> "Be Hungry, Stay Foolish"
>
> ___
> 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-10-06 Thread Sebastian Damm
Hello,

On Tue, Sep 5, 2017 at 4:08 PM, Richard Fuchs  wrote:
> 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.

I tried the solution in a free minute today, but wondered how the
actual Kamailio config code should look like. I tried doing it in a
failure branch route.

My branch route looks like this:

branch_route[callToPhoneExtension] {
route("checkNat");
# handle branch failure on calls to TLS devices
if (isbflagset(0)) {
t_on_branch_failure("handle_tls_branch");
}
}

route checkNat does some NAT foo and sets the branch flag 0 if the
call goes to a TLS device. And calls the RTP proxy with RTP/SAVP
parameter.

When the call fails (my Snom returns a 488), I jump into the branch
failure route.

event_route[tm:branch-failure:handle_tls_branch] {
if(t_check_status("488")) {
if (isbflagset(0) && !isbflagset(1)) {
xlog("L_NOTICE", "Call to TLS device was
rejected, trying without SRTP F=$fu T=$tu R=$ru\n");
rtpengine_delete();
t_reuse_branch();
setbflag(1);
route("rtpProxyOffer");
t_relay();
}
}
}

This way I call rtpengine again with the RTP/AVP parameter and then
send the call to the device again.

Is this the way it should look like? My Kamailio doesn't send out the
request without me setting $du manually due to a bug
(https://github.com/kamailio/kamailio/issues/1264), but otherwise it
does work.

Was my approach the right one?

Best Regards,
Sebastian

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


Re: [SR-Users] custom kamailio-x.deb package

2017-10-06 Thread Sebastian Damm
Hi,

did you see that there are debian folders coming with your kamailio
source code? I think all you have to do is symlink the correct folder
to the root project folder so it is accessible under
/path/to/kamailio-sources/debian and you should be ready to go. Then
your dpkg-buildpackage command should have everything you need.

HTH
Sebastian

On Mon, Oct 2, 2017 at 10:31 PM, Abdul Basit  wrote:
> Hi All,
>
> I am trying to compile custom .deb package from kamailio source that will
> install dependencies like mysql-server, lua, rtpproxy, etc. and will install
> few custom scripts along with additional db tables from tables-create.sql
> files.
>
> I am able to create kamailio_x-amd64.deb package that I installed on fresh
> machine
> dpkg -i  kamailio_x-amd64.deb
>
> This package installed kamailio config files and modules in appropriate
> locations but it didn't created default, init.d and kamailio.service files.
> Nor it asked for installing the dependencies which I mentioned in control
> file.
>
> OS: Debian GNU/Linux 8.9 (jessie)
> Kamailio: 5.0.3 through git clone
>
> I am creating .deb package for the very 1st time. Can anyone point me to the
> right direction?
>
> --
> regards,
>
> abdul basit
>
> ___
> 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] custom kamailio-x.deb package

2017-10-13 Thread Sebastian Damm
If you rename your packages in your control file, then you of course
need to change the dependencies as well.

Example:

Original:
Package: kamailio-mysql-modules
Architecture: linux-any
Multi-Arch: same
Pre-Depends: ${misc:Pre-Depends}
Depends: kamailio (= ${binary:Version}),
 default-mysql-client | virtual-mysql-client,
 ${misc:Depends},
 ${shlibs:Depends}
Description: MySQL database connectivity module for Kamailio
 Kamailio is a very fast and flexible SIP (RFC3261)
 server. Written entirely in C, Kamailio can handle thousands calls
 per second even on low-budget hardware.
 .
 This package provides the MySQL database driver for Kamailio.

Must be changed to:
Package: kamailio503-mysql-modules
Architecture: linux-any
Multi-Arch: same
Pre-Depends: ${misc:Pre-Depends}
Depends: kamailio503 (= ${binary:Version}),
 default-mysql-client | virtual-mysql-client,
 ${misc:Depends},
 ${shlibs:Depends}
Description: MySQL database connectivity module for Kamailio
 Kamailio is a very fast and flexible SIP (RFC3261)
 server. Written entirely in C, Kamailio can handle thousands calls
 per second even on low-budget hardware.
 .
 This package provides the MySQL database driver for Kamailio.

HTH
Sebastian


On Thu, Oct 12, 2017 at 12:08 PM, Abdul Basit  wrote:
> Hi,
>
> Yes. I can see the debian folder that contain the control and rules files.
> I have managed to build and install the custom kamailio packages by updating
> control and rules files.
> But now i am stuck with the issues that while install with apt-get install
> kamailio503*
>
> its also ask to install kamailio-* packages from public repo.
>
> Like i want to install kamailio503-mysql-modules.deb but in addition to that
> apt-get also installs kamailio-mysql-modules:amd64
> To prevent that, i created my own local repo and removed all other entries
> from /etc/apt/source.list
>
> echo "deb http://192.168.10.23/packages/amd64/ /" > /etc/apt/sources.list
>
> Now getting below errors:
>
> dpkg: dependency problems prevent configuration of
> kamailio-mysql-modules:amd64:
>  kamailio-mysql-modules:amd64 depends on kamailio (= 5.0.3-1); however:
>   Package kamailio is not configured yet.
>
> dpkg: error processing package kamailio-mysql-modules:amd64 (--configure):
>  dependency problems - leaving unconfigured
>
> How can i avoid this situation?
> Where to make changes to limit to my customized packages only even public
> repo is available in "/etc/apt/sources.list"
>
> I am almost stuck here. Kindly help.
>
>
> --
> regards,
>
> abdul basit | p: +92 32 1416 4196 | o: +92 30 0841 1445
>
> On 6 October 2017 at 20:02, Sebastian Damm  wrote:
>>
>> Hi,
>>
>> did you see that there are debian folders coming with your kamailio
>> source code? I think all you have to do is symlink the correct folder
>> to the root project folder so it is accessible under
>> /path/to/kamailio-sources/debian and you should be ready to go. Then
>> your dpkg-buildpackage command should have everything you need.
>>
>> HTH
>> Sebastian
>>
>> On Mon, Oct 2, 2017 at 10:31 PM, Abdul Basit  wrote:
>> > Hi All,
>> >
>> > I am trying to compile custom .deb package from kamailio source that
>> > will
>> > install dependencies like mysql-server, lua, rtpproxy, etc. and will
>> > install
>> > few custom scripts along with additional db tables from
>> > tables-create.sql
>> > files.
>> >
>> > I am able to create kamailio_x-amd64.deb package that I installed on
>> > fresh
>> > machine
>> > dpkg -i  kamailio_x-amd64.deb
>> >
>> > This package installed kamailio config files and modules in appropriate
>> > locations but it didn't created default, init.d and kamailio.service
>> > files.
>> > Nor it asked for installing the dependencies which I mentioned in
>> > control
>> > file.
>> >
>> > OS: Debian GNU/Linux 8.9 (jessie)
>> > Kamailio: 5.0.3 through git clone
>> >
>> > I am creating .deb package for the very 1st time. Can anyone point me to
>> > the
>> > right direction?
>> >
>> > --
>> > regards,
>> >
>> > abdul basit
>> >

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


Re: [SR-Users] unexpected behavior of save from registrar module

2017-10-13 Thread Sebastian Damm
Hi,

indeed, when a function returns with 0, Kamailio immediately ends the
processing of the packet. So that's why the unlock statement is never
executed.

I am wondering, why you are using locks at this point. That way, only
one REGISTER can be processed at the same time, since they all share
the same lock. I've never seen somebody do this before, and multiple
REGISTERs being processed in parallel should be no problem. What
problem do you try to solve by surrounding the save command with
locks?

Best Regards,
Sebastian

On Thu, Oct 12, 2017 at 6:03 PM, Vasiliy Ganchev  wrote:
> Hi, community!
>
> I have in my Kamailio script following block (while REGISTER processing,
> after auth succeed):
>
>  .
> /* Save to usrloc */
> lock("LOCATION_LOCK");
> if (!save("location")) {
> unlock("LOCATION_LOCK");
> sl_reply_error();
> exit();
> }
> unlock("LOCATION_LOCK");
>
> ..
>
> According to module documentation - if "save" - failed (for any reason) - I
> expected the control to be returned to the script with error code "-1"
>
> But, there are cases - when this does not happen - which lead to deadlock
> for workers processing REGISTERs (I never unlock("LOCATION_LOCK")):
> - module answers with internal error - and return 0 from "save" function:
> https://github.com/kamailio/kamailio/blob/master/src/modules/registrar/save.c
> - line 1013
>
> My use case happened due to malfunctioning device that in some moment of
> time:
> - send REGISTER update
> - kamailio answers 200OK
> - device retransmit the same REGISTER (same CSeq)
> - during 20 seconds (hardcoded value in registrar module) - kamailio answers
> 200OK (and everything is ok)
> - if retransmission continue more than 20s - kamailio answered 400 Bad
> request, and did not return control to script (as a result I had no chance
> to unlock("LOCATION_LOCK") from code above)
>
> Tested it on kamailio 4.2.5 and 5.0.3.
>
> as for me, possible solutions are:
> - return -1 instead of 0 from "save" by default
> - if there are some reasons not to do this - we should change documentation,
> and explicitly mention that there are cases - when script execution is
> stopped.
>
> thanks in advance!
>
> cheers
>
>
>
> --
> Sent from: http://sip-router.1086192.n5.nabble.com/Users-f3.html
>
> ___
> 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] How to check 4XX/5XX response in general.

2017-10-23 Thread Sebastian Damm
Hi,

you can use a regex match for that as well.

if ($rs =~ "^[45].*") {
# do something
}

HTH
Sebastian

On Mon, Oct 23, 2017 at 11:34 AM, vi...@advaitamtech.com
 wrote:
> Hi,
>
>
>
> Is there any way to catch all 4XX and 5XX SIP error codes rather then
> specifying individually ie. 404, 500, 400 etc in kamailio.
>
>
>
> Thanks,
>
> Vivek.
>
>
> ___
> 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] allow_trusted not passing

2017-11-28 Thread Sebastian Damm
Hi,

On Tue, Nov 28, 2017 at 1:47 AM, voipspace voipspace
 wrote:
> Unfortunately that does not work. Second argument is required

Try it with only if (!allow_trusted()) { ... }

If you check against the source address, you don't need an argument at all.

I don't know if some pattern is needed for the trusted entry to work.
In our setup the trusted entries look like this:

item: {
ip: w.x.y.z
proto: 0
pattern: ^sip:.*$
ruri_pattern: NULL
tag: NULL
priority: 0
}

Regards,
Sebastian

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


Re: [SR-Users] OpenSIPS-devel not starting (TCP Error)

2017-11-28 Thread Sebastian Damm
Hi,

I think you ended up on the wrong mailing list. This list is for
Kamailio, not OpenSIPS. You might want to ask your question again
somewhere here:
https://www.opensips.org/Support/MailingLists

Regards,
Sebastian

On Tue, Nov 28, 2017 at 8:33 PM, SamyGo  wrote:
> P.S:
> Unchecking the EXTRA_DEBUG and DBG_TCPCON flags at compile time makes
> OpenSIPS work normally.
>
> On Tue, Nov 28, 2017 at 2:10 PM, SamyGo  wrote:
>>
>> Hi,
>> I just installed the head version from git.
>>
>> version: opensips 2.4.0-dev (x86_64/linux)
>> flags: STATS: On, SHM_EXTRA_STATS, EXTRA_DEBUG, DISABLE_NAGLE, USE_MCAST,
>> SHM_MMAP, PKG_MALLOC, QM_MALLOC, DBG_MALLOC, FAST_LOCK-ADAPTIVE_WAIT
>> ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16,
>> MAX_URI_SIZE 1024, BUF_SIZE 65535
>> poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
>> git revision: d1a4419
>> main.c compiled on 19:53:20 Nov 28 2017 with gcc 4.8
>>
>> It was compiled with EXTRA_DEBUG and DBG_TCPCON flags;
>> While starting opensips with the residential vanilla script it gives
>> following error:
>>
>> Nov 28 20:05:52 [30899] ERROR:core:tcp_init: oom con hist
>> Nov 28 20:05:52 [30899] CRITICAL:core:main: could not initialize tcp
>> Nov 28 20:05:52 [30899] INFO:core:cleanup: cleanup
>> Nov 28 20:05:52 [30899] DBG:core:shm_mem_destroy: destroying the shared
>> memory lock
>> Nov 28 20:05:52 [30899] NOTICE:core:main: Exiting
>>  already running
>>
>> Even if I remove the proto_tcp, and tcp related things this still gives
>> error and doesn't start.
>>
>> Kindly help.
>>
>> Regards,
>> Sammy
>
>
>
> ___
> 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] how to add new media server in dispatcher table through "ANSIBLE"

2017-11-28 Thread Sebastian Damm
Hi,

we deploy our gateways through ansible, and while doing that we insert
a database entry for the gateway into the dispatcher table. After
that, we issue a dispatcher.reload on our Kamailio servers. You need
some delegate_to statements in your playbook, but this way we can add
gateways automatically.

After inserting and reloading we even wait a few seconds and then
issue a kamcmd dispatcher.list within the playbook to check whether
the new gateway is reachable from Kamailio.

HTH
Sebastian

On Wed, Nov 29, 2017 at 7:33 AM, Narayan P  wrote:
> Hello Joel,
>
> I am using mysql database.
>
> Thanks,
> Narayan
>
> 
> From: Narayan P
> Sent: Wednesday, November 29, 2017 6:31:46 AM
>
> To: Kamailio (SER) - Users Mailing List
> Subject: Re: [SR-Users] how to add new media server in dispatcher table
> through "ANSIBLE"
>
>
> Hello Joel,
>
>
> I am using mysql database.
>
>
> Thanks,
>
> Narayan
>
> 
> From: sr-users  on behalf of Joel
> Serrano 
> Sent: Wednesday, November 29, 2017 3:14:35 AM
> To: Kamailio (SER) - Users Mailing List
> Subject: Re: [SR-Users] how to add new media server in dispatcher table
> through "ANSIBLE"
>
> What backend database are you using for Kamailio?
>
>
>
> On Tue, Nov 28, 2017 at 11:32 AM, Narayan P  wrote:
>> Hello Experts,
>>
>>
>> I am new to ansible and deploying kamailio through ansible.Sucessfully
>> deployed kamailio but my requirement is to add media server through
>> ansible.As I am using dispatcher module in kamailio,not able to find any
>> script that directly insert one media server IP and port into dispatcher
>> table from ansible.(I am using ansible in one system and deploying
>> kamailio
>> in other).
>>
>>
>>
>>
>> Any suggestion will be highly appreciated as always.
>>
>>
>>
>> Thanks,
>>
>> Narayan
>>
>> +91-9035438928
>>
>>
>>
>>
>>

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


Re: [SR-Users] How to change To header URI from Kamailio?

2017-12-04 Thread Sebastian Damm
Hi,

most user agents ignore the domain and port in the from header. Your
UAC must be special.

However, the uac module has some functions to help you. But don't
forget to restore it on the way back.

Regards,
Sebastian

On Tue, Dec 5, 2017 at 5:32 AM, Arun NV  wrote:
> Hi,
> I am using Kamailio 4.4. I would like to forward the request to a different
> port number of my endpoint. I have changed the destination URI and the
> INVITE  correctly reached to the new port. But the To header in the INVITE
> request has the old port. so the endpoint is not responding to the request.
> Then I tried to remove and replace To header using remove_hf("To") and
> insert_hf("To: $var(modified_to_header) \r\n"); functions. But the to header
> not changed.
> So, is there any way to change the To header URI.
>
> ___
> 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] t_relay dying ?

2018-01-03 Thread Sebastian Damm
Hi Jean,

as pointed out earlier, the ACK is probably broken. Every packet after the
200 OK should have the contact of the 200 OK in the Request URI. Your
example packet carries probably the original request URI, which is most
certainly wrong, exept if you use some topology hiding.

This is something you can't fix but the voip provider has to fix. They
apparently can't handle proxied SIP connections.

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


Re: [SR-Users] t_relay dying ?

2018-01-08 Thread Sebastian Damm
Hi,

On Mon, Jan 8, 2018 at 2:39 PM, Jean Cérien  wrote:

>
> Thanks for this answer. The voip provider is not really eager to alter its
> SBC as it considers that the contact field is not mandatory in the ACK. The
> RFC states (section 8.1.1.8)
>

The problem is not that the ACK doesn't carry a Contact header. The problem
is that the ACK is constructed incorrectly. This is what the RfC says to
UAC behavior (section 12.1.2):

The route set MUST be set to the list of URIs in the Record-Route header
field from the response, taken in reverse order and preserving all URI
parameters. If no Record-Route header field is present in the response, the
route set MUST be set to the empty set. This route set, even if empty,
overrides any pre-existing route set for future requests in this dialog. *The
remote target MUST be set to the URI from the Contact header field of the
response.*

This is what the carrier's SBC gets wrong. It doesn't address your Asterisk
but instead addresses your Kamailio, although the Contact of your 200 OK
(hopefully) contains the Asterisk IP.

Please verify that your 200 OK going to the carrier actually does carry a
Contact header with the Asterisk IP, but if it does, section 12.1.2 of the
SIP RfC could help when arguing with the carrier.

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


[SR-Users] two Kamailio instances suddenly stopped handling packets

2018-01-11 Thread Sebastian Damm
Hi,

this morning, two Kamailio servers suddenly stopped working after having
worked without a problem for months. Both are running 5.0.2 on Debian
Jessie. Those systems only analyze mirrored traffic and write some
information to a RabbitMQ.

I tried restarting, but after a few seconds they get stuck the same way as
before. Then I attached a gdb to some of the UDP listeners, and they all
look pretty much the same.


===8< process 1 =
(gdb) bt
#0  0x7f404ca435b9 in syscall () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x7f4049f41260 in futex_get (lock=0x7f4041bccd00) at
../../core/parser/../mem/../futexlock.h:108
#2  0x7f4049f477d7 in cfg_lock_helper (lkey=0x7fff3c048650, mode=0) at
cfgutils.c:667
#3  0x7f4049f481ed in w_cfg_lock_wrapper (msg=0x7f404ba17f18,
key=0x7f404ba15488, mode=0) at cfgutils.c:712
#4  0x7f4049f4823c in w_cfg_lock (msg=0x7f404ba17f18,
key=0x7f404ba15488 "\210a\241K@\177", s2=0x0) at cfgutils.c:717
#5  0x0045cd85 in do_action (h=0x7fff3c049410, a=0x7f404b9d5170,
msg=0x7f404ba17f18) at core/action.c:1060
#6  0x00469afa in run_actions (h=0x7fff3c049410, a=0x7f404b9d5170,
msg=0x7f404ba17f18) at core/action.c:1552
#7  0x0045958d in do_action (h=0x7fff3c049410, a=0x7f404b9ce558,
msg=0x7f404ba17f18) at core/action.c:678
#8  0x00469afa in run_actions (h=0x7fff3c049410, a=0x7f404b9cdf70,
msg=0x7f404ba17f18) at core/action.c:1552
#9  0x0046a2bd in run_top_route (a=0x7f404b9cdf70,
msg=0x7f404ba17f18, c=0x0) at core/action.c:1641
#10 0x00580033 in receive_msg (
buf=0xa393f9  "REGISTER sip:domain SIP/2.0\r\nVia: SIP/2.0/UDP
1.2.3.4;branch=z9hG4bKfc98.c762d7151f110c7eb71fc7d4e0648f1f.0\r\nVia:
SIP/2.0/UDP 192.168.0.3:5060
;rport=38020;received=62.30.8.128;branch=z9hG4"...,
len=799, rcv_info=0x7fff3c049810) at core/receive.c:264
#11 0x7f40483efcdf in parsing_hepv3_message (buf=0xa39380 
"HEP3\003\230", len=920) at hep.c:499
#12 0x7f40483ee264 in hepv3_received (buf=0xa39380 
"HEP3\003\230", len=920, ri=0x7fff3c049a50) at hep.c:231
#13 0x7f40483ec9cb in hep_msg_received (data=0x7fff3c049a30) at hep.c:85
#14 0x0049e4e1 in sr_event_exec (type=7, data=0x7fff3c049a30) at
core/events.c:263
#15 0x0048731a in udp_rcv_loop () at core/udp_server.c:466
#16 0x00422d08 in main_loop () at main.c:1623
#17 0x0042a408 in main (argc=13, argv=0x7fff3c049ef8) at main.c:2643
(gdb) quit
===8< process 1 =


===8< process 2 =
(gdb) bt
#0  0x7f404ca435b9 in syscall () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x7f4049f41260 in futex_get (lock=0x7f4041bccd00) at
../../core/parser/../mem/../futexlock.h:108
#2  0x7f4049f477d7 in cfg_lock_helper (lkey=0x7fff3c048650, mode=0) at
cfgutils.c:667
#3  0x7f4049f481ed in w_cfg_lock_wrapper (msg=0x7f404ba17f18,
key=0x7f404ba15488, mode=0) at cfgutils.c:712
#4  0x7f4049f4823c in w_cfg_lock (msg=0x7f404ba17f18,
key=0x7f404ba15488 "\210a\241K@\177", s2=0x0) at cfgutils.c:717
#5  0x0045cd85 in do_action (h=0x7fff3c049600, a=0x7f404b9d5170,
msg=0x7f404ba17f18) at core/action.c:1060
#6  0x00469afa in run_actions (h=0x7fff3c049600, a=0x7f404b9d5170,
msg=0x7f404ba17f18) at core/action.c:1552
#7  0x0045958d in do_action (h=0x7fff3c049600, a=0x7f404b9cf920,
msg=0x7f404ba17f18) at core/action.c:678
#8  0x00469afa in run_actions (h=0x7fff3c049600, a=0x7f404b9ce9c0,
msg=0x7f404ba17f18) at core/action.c:1552
#9  0x0046a2bd in run_top_route (a=0x7f404b9ce9c0,
msg=0x7f404ba17f18, c=0x7fff3c049600) at core/action.c:1641
#10 0x00580a69 in receive_msg (
buf=0xa393f9  "SIP/2.0 200 OK\r\nVia: SIP/2.0/UDP
172.20.40.8;branch=z9hG4bKa69c.5cca5a54c4d270c515eeb4bbb5e0bb44.0\r\nVia:
SIP/2.0/UDP 2.3.4.5:5060\r\nContact:
\r\nTo:
"..., len=506, rcv_info=0x7fff3c049810) at core/receive.c:327
#11 0x7f40483efcdf in parsing_hepv3_message (buf=0xa39380 
"HEP3\002s", len=627) at hep.c:499
#12 0x7f40483ee264 in hepv3_received (buf=0xa39380  "HEP3\002s",
len=627, ri=0x7fff3c049a50) at hep.c:231
#13 0x7f40483ec9cb in hep_msg_received (data=0x7fff3c049a30) at hep.c:85
#14 0x0049e4e1 in sr_event_exec (type=7, data=0x7fff3c049a30) at
core/events.c:263
#15 0x0048731a in udp_rcv_loop () at core/udp_server.c:466
#16 0x00422d08 in main_loop () at main.c:1623
#17 0x0042a408 in main (argc=13, argv=0x7fff3c049ef8) at main.c:2643
(gdb) quit
===8< process 2 =

Looks to me as if Kamailio gets stuck trying to get a lock for this packet.

The config file when handling those packets looks like this:

request_route {
route(initialize_variables);
route(foo);
}

onreply_route {
route(initialize_variables);
route(foo);
}

route[initialize_variables] {
$vn(bar) = $null;
$vn(baz) = $null;
$vn(barbaz) = $null;
$vn(foobar) = $null;

}

route[foo] {
lock("

Re: [SR-Users] two Kamailio instances suddenly stopped handling packets

2018-01-12 Thread Sebastian Damm
Hi Daniel,

unless there is a silent exit from some module (those extra routes just
write some information into redis), I can't find any other drop and exits
than the one in the route posted.

We have added some logging around the lock functions, and although we are
missing some log lines for some packets, making it look like some locks
don't get released, we do see that another PID can successfully lock the
same key later.

There is no other lock/unlock in the config.

Is there a way to debug the lock array? One guess could be that the lock
array is full, although we already have the lock size set to 10.

Regards,
Sebastian

On Fri, Jan 12, 2018 at 11:08 AM, Daniel-Constantin Mierla <
mico...@gmail.com> wrote:

> Hello,
>
> have you checked that any of the route blocks used in between lock() and
> unlock() don't do an exit/drop (also not return 0)?
>
> Do you have other lock() / unlock() in the config?
>
> Cheers,
> Daniel
>
> On 12.01.18 08:49, Sebastian Damm wrote:
>
> Hi,
>
> this morning, two Kamailio servers suddenly stopped working after having
> worked without a problem for months. Both are running 5.0.2 on Debian
> Jessie. Those systems only analyze mirrored traffic and write some
> information to a RabbitMQ.
>
> I tried restarting, but after a few seconds they get stuck the same way as
> before. Then I attached a gdb to some of the UDP listeners, and they all
> look pretty much the same.
>
>
> ===8< process 1 =
> (gdb) bt
> #0  0x7f404ca435b9 in syscall () from /lib/x86_64-linux-gnu/libc.so.6
> #1  0x7f4049f41260 in futex_get (lock=0x7f4041bccd00) at
> ../../core/parser/../mem/../futexlock.h:108
> #2  0x7f4049f477d7 in cfg_lock_helper (lkey=0x7fff3c048650, mode=0) at
> cfgutils.c:667
> #3  0x7f4049f481ed in w_cfg_lock_wrapper (msg=0x7f404ba17f18,
> key=0x7f404ba15488, mode=0) at cfgutils.c:712
> #4  0x7f4049f4823c in w_cfg_lock (msg=0x7f404ba17f18,
> key=0x7f404ba15488 "\210a\241K@\177", s2=0x0) at cfgutils.c:717
> #5  0x0045cd85 in do_action (h=0x7fff3c049410, a=0x7f404b9d5170,
> msg=0x7f404ba17f18) at core/action.c:1060
> #6  0x00469afa in run_actions (h=0x7fff3c049410, a=0x7f404b9d5170,
> msg=0x7f404ba17f18) at core/action.c:1552
> #7  0x0045958d in do_action (h=0x7fff3c049410, a=0x7f404b9ce558,
> msg=0x7f404ba17f18) at core/action.c:678
> #8  0x00469afa in run_actions (h=0x7fff3c049410, a=0x7f404b9cdf70,
> msg=0x7f404ba17f18) at core/action.c:1552
> #9  0x0046a2bd in run_top_route (a=0x7f404b9cdf70,
> msg=0x7f404ba17f18, c=0x0) at core/action.c:1641
> #10 0x00580033 in receive_msg (
> buf=0xa393f9  "REGISTER sip:domain SIP/2.0\r\nVia:
> SIP/2.0/UDP 
> 1.2.3.4;branch=z9hG4bKfc98.c762d7151f110c7eb71fc7d4e0648f1f.0\r\nVia:
> SIP/2.0/UDP 192.168.0.3:5060;rport=38020;received=62.30.8.128;branch=
> z9hG4"...,
> len=799, rcv_info=0x7fff3c049810) at core/receive.c:264
> #11 0x7f40483efcdf in parsing_hepv3_message (buf=0xa39380 
> "HEP3\003\230", len=920) at hep.c:499
> #12 0x7f40483ee264 in hepv3_received (buf=0xa39380 
> "HEP3\003\230", len=920, ri=0x7fff3c049a50) at hep.c:231
> #13 0x7f40483ec9cb in hep_msg_received (data=0x7fff3c049a30) at
> hep.c:85
> #14 0x0049e4e1 in sr_event_exec (type=7, data=0x7fff3c049a30) at
> core/events.c:263
> #15 0x0048731a in udp_rcv_loop () at core/udp_server.c:466
> #16 0x00422d08 in main_loop () at main.c:1623
> #17 0x0042a408 in main (argc=13, argv=0x7fff3c049ef8) at
> main.c:2643
> (gdb) quit
> ===8< process 1 =
>
>
> ===8< process 2 =
> (gdb) bt
> #0  0x7f404ca435b9 in syscall () from /lib/x86_64-linux-gnu/libc.so.6
> #1  0x7f4049f41260 in futex_get (lock=0x7f4041bccd00) at
> ../../core/parser/../mem/../futexlock.h:108
> #2  0x7f4049f477d7 in cfg_lock_helper (lkey=0x7fff3c048650, mode=0) at
> cfgutils.c:667
> #3  0x7f4049f481ed in w_cfg_lock_wrapper (msg=0x7f404ba17f18,
> key=0x7f404ba15488, mode=0) at cfgutils.c:712
> #4  0x7f4049f4823c in w_cfg_lock (msg=0x7f404ba17f18,
> key=0x7f404ba15488 "\210a\241K@\177", s2=0x0) at cfgutils.c:717
> #5  0x0045cd85 in do_action (h=0x7fff3c049600, a=0x7f404b9d5170,
> msg=0x7f404ba17f18) at core/action.c:1060
> #6  0x00469afa in run_actions (h=0x7fff3c049600, a=0x7f404b9d5170,
> msg=0x7f404ba17f18) at core/action.c:1552
> #7  0x0045958d in do_action (h=0x7fff3c049600, a=0x7f404b9cf920,
> msg=0x7f404ba17f18) at core/action.c:678
> #8  0x00469afa in run_actions (h=0x7fff3c049600, a=0x7f404b9ce9c0,
> msg=0x7f404ba17f18) at core/action.c:1552
> #9  0x0

[SR-Users] UDP workers block when one or more rtpengine instances go offline

2018-08-06 Thread Sebastian Damm
Hi,

we run multiple rtpengine servers to share the load. Whenever we need
to take an rtpengine server offline, we used to just block the control
port via iptables, then no new calls ended up on this instance of
rtpengine. This worked pretty well in Kamailio 4.4.5.

However, since Kamailio 5.0, and the problem persists with 5.1.4,
Kamailio hangs almost immediately after we block the control port
traffic. In the log file there are almost no packets processed except
every few seconds, which looks like a timeout thing.

Did we configure anything wrong there? Or is the "dead rtpengine
detection" just broken?

Our configuration:

loadmodule "rtpengine.so"
modparam("rtpengine", "rtpengine_disable_tout", 120)
modparam("rtpengine", "setid_avp", "$avp(rtpsetid)")
modparam("rtpengine", "rtpengine_sock", "0 == udp:1.2.3.4:9001=2
udp:1.2.3.5:9001=2 udp:1.2.3.6:9001=2")
modparam("rtpengine", "rtpengine_sock", "1 == udp:2.3.4.5:9001=2")

Any help appreciated.

Regards,
Sebastian

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


  1   2   >