Re: [SR-Users] loose_route() does not find socket by name

2021-02-12 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> > Also, there is no "=".  So instead of ";sn=", the code should look for
> > "sn".
> 
> Indeed, I will push a fix for it.

I also did one, but yours is cleaner than mine.  Thanks. Tested and it
works, no more warnings to syslog.

Looks like no-one had ever before used this socket name feature in R-R
URIs.

-- Juha

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


Re: [SR-Users] loose_route() does not find socket by name

2021-02-12 Thread Juha Heinanen
Juha Heinanen writes:

> I think I found the bug:
> 
> ./src/core/config.h:#define SOCKNAME_PARAM ";sn="
> 
> but in parse_params() result params are without ";".

Also, there is no "=".  So instead of ";sn=", the code should look for
"sn".

-- Juha

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


Re: [SR-Users] loose_route() does not find socket by name

2021-02-12 Thread Juha Heinanen
I think I found the bug:

./src/core/config.h:#define SOCKNAME_PARAM ";sn="

but in parse_params() result params are without ";".

-- Juha

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


Re: [SR-Users] loose_route() does not find socket by name

2021-02-12 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> Do you have the rr modparam related socket name mode set?

Yes, sorry, forgot to mention it:

modparam("rr", "sockname_mode", 1)

I have added some debug to loose.c and some converted DBGs to INFOs in
rr_do_force_send_socket() function:

if(rr_sockname_mode!=0 && puri->params.len>0) {
s = puri->params;
if(s.s[s.len-1]==';') {
s.len--;
}
LM_INFO("Looking ;sn param from  %.*s\n", s.len, s.s);
...
LM_INFO("use of sockname parameter enabled, but failed to find 
it\n");
free_params(plist);
}

This is what I got to syslog:

eb 12 14:53:07 lab /usr/bin/sip-proxy[8662]: INFO: rr [loose.c:759]: 
rr_do_force_send_socket(): Looking ;sn param from  
transport=tls;r2=on;sn=ext_tls;lr;n1;savp=avp;pm=0
Feb 12 14:53:07 lab /usr/bin/sip-proxy[8662]: INFO: rr [loose.c:783]: 
rr_do_force_send_socket(): use of sockname parameter enabled, but failed to 
find it
Feb 12 14:53:07 lab /usr/bin/sip-proxy[8662]: WARNING: rr [loose.c:800]: 
rr_do_force_send_socket(): no socket found to match second RR 
(sip:tenantX.teams.tutpro.com:8007;transport=tls;r2=on;sn=ext_tls;lr;n1;savp=avp;pm=0)

So looks like some bug in the looking, since ;sn is there.

-- Juha

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


[SR-Users] loose_route() does not find socket by name

2021-02-12 Thread Juha Heinanen
I did more tests and found that loose_route() does not find socket by
name given in ;sn param:

Feb 12 10:40:59 lab /usr/bin/sip-proxy[16975]: WARNING: rr [loose.c:799]: 
rr_do_force_send_socket(): no socket found to match second RR 
(sip:tenantX.teams.tutpro.com:8007;transport=tls;r2=on;sn=ext_tls;lr;n1;savp=avp;pm=0)

In config I have defined:

listen=tls:192.x.x.x:8007  name "ext_tls"

-- Juha

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


Re: [SR-Users] loose_route() fails on domain name

2021-02-11 Thread Juha Heinanen
Seems to be OK not to include ;sn param in IP address R-R URIs.  At
least I didn't get any errors or warning to syslog when I called
loose_route() on in-dialog requests that had such Route headers.

-- Juha

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


Re: [SR-Users] loose_route() fails on domain name

2021-02-11 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> Set names to the sockets
> (https://www.kamailio.org/wiki/cookbooks/devel/core#listen):
> 
> listen= . name "s1"
> 
> And then add parameter "sn=s1" to the specific Record-Route header.

If sockname_mode param has value 1:

  modparam("rr", "sockname_mode", 1)

does it mean that ;sn=name param needs to be included in every R-R URI,
i.e, also in those that have an IP address that K is listening on?

Or may the ;sn param may be omitted in those URIs without causing
loose_route() to fail?

-- Juha



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


Re: [SR-Users] loose_route() fails on domain name

2021-02-11 Thread Juha Heinanen
Alex Balashov writes:

> That is the main reason I had previously thought it wasn’t possible!

Have you changed your mind?

The document

  https://skalatan.de/de/blog/kamailio-sbc-teams

tells

  Change in your configuration the existing record_route() function call
  to this one: 

  record_route_preset("SBC-DNS-DOMAIN:5061;transport=tls", "SBC-IP-ADDR:5060");

but does not tell, how to change loose_route() so that it would work on
the resulting Route headers.

It would be nice to learn the secret.

-- Juha


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


Re: [SR-Users] R-R to MS Teams Proxy

2021-02-11 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> The record_route_preset() is supposed to offer the flexibility of
> setting the address part in RR headers via variables. I do not see how
> the record_route() can be better variant, because it will end up in the
> same kind functionality: for which to use the FQDN? For first of the
> second Record-Route header, or for both?

I was thinking this kind of new function:

  record_route_with_fqdn(first_header_fqdn, second_header_fqdn)

It would work the same way as record_route, but would use the fqdn
param instead of IP address if the param is not "".

So, when INVITE goes to teams, I would make call

  record_route_with_fqdn("tenantX.teams.tutpro.com", "");

and then INVITE comes from teams, I would make call

  record_route_with_fqdn("", "tenantX.teams.tutpro.com");

> These are conditions that are made in configuration file, based on
> routing needs, when deciding what socket to use and where to send. There
> are variables that give access to receiving socket ip/port or sending
> socket.

Yes, I know that the variables exist, but it is messy to use them.

-- Juha

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


Re: [SR-Users] R-R to MS Teams Proxy

2021-02-11 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> If not, then that has to be added because the purpose of
> record_route_preset() is to be able to set rr header as one needs based
> on variables that can be used in parameters. Note that the parameters
> are only "host:port;transport=", without protocol, for the reason to let
> the code decide between sip and sips.

I didn't quite understand the last sentence.  In case of tls transport,
also port of the socket usually needs to be different than in case of
udp or tcp.

I haven't tested yet, if I only give host, will record_route_preset()
add both port and transport automatically based on which socket is used
to send the request out.

-- Juha

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


Re: [SR-Users] R-R to MS Teams Proxy

2021-02-11 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> The code of add_rr_param() used after the record-route header is added
> indicates that the values should be added. I didn't have the time to
> check what is with the cached params if add_rr_param() used beore the
> record-route header is added. I will try to reproduce.

> On your specific case, your probably can just add ";r2=on" in the params
> of the record_route_preset() function.

Yes, in this case I could just add ";r2=on" to record_route_preset().
But there are many other params that I use in R-R URIs that are not
constant.  For example, which rtpengine set was used in the call, what
kind of media conversion was done, etc.

So it would be good to get the add_rr_param() work also after
record_route_preset().

-- Juha

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


Re: [SR-Users] No ACK from MS Teams

2021-02-11 Thread Juha Heinanen
Henning Westerholt writes:

> not 100% sure what the other blog post is suggesting - but in my
> setups there is no need for a special record_route(..) in reply
> handling (like reply route).

Its is not question about reply handling, but direction of INVITE.  See
my earlier message.

-- Juha

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


Re: [SR-Users] R-R to MS Teams Proxy

2021-02-11 Thread Juha Heinanen
Carsten Bock writes:

> I don't understand the trouble:
> Wouldn't the following lead to the exact example:
> 
> listen=tls:1.2.3.4:8007 advertise teams.tutpro.com:8007
> listen=tcp:1.2.3.4:5070

That would not work when K is a multi-tenant carrier Teams SBC proxy
that requires tenant specific FQDN to be used in R-R header.

In that case the base domain would e.g. be teams.tutpro.com and each
tenant has its sub-domain, e.g., tenant1.teams.tutpro.com,
tenant2.teams.tutpro.com, ...

This is explained in

https://docs.microsoft.com/en-us/microsoftteams/direct-routing-sbc-multiple-tenants

-- Juha

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


Re: [SR-Users] No ACK from MS Teams

2021-02-11 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> What exactly do you need to do for R-R in replies?
> 
> The R-R headers are mirrored in replies, so if you add R-R for requests
> using the right order of parameters based on the direction, there is
> nothing to be done for replies, or at least I haven't had to do it for
> my Kamailio interconnect proxy for MS Teams.

Sorry, I was not clear.

When INVITE goes from K to Teams, the *top* R-R header (assuming there
is two) added by K needs to have K's FQDN.

But when INVITE comes from Teams to K, the *bottom* R-R header (assuming
there is two) added by K needs to have K's FQDN.

-- Juha

 

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


Re: [SR-Users] R-R to MS Teams Proxy

2021-02-11 Thread Juha Heinanen
Sergey Safarov writes:

> Maybe need to move into more global changes...
> 
> How about DNS hostname usage for all headers?
> "Via", "Record-Route" maybe "Contact" when Kamailio with extra modules
> play media?
> 
> how about global directive like
> header_with_hostname=tue

I'm not sure if that is a good idea, since, for example, I would like to
keep on using IP address 127.0.0.1:

Record-Route: 
Record-Route: 

-- Juha

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


Re: [SR-Users] No ACK from MS Teams

2021-02-11 Thread Juha Heinanen
Pepelux writes:

> Try to put SBC-FQDN instead of SBC-IP-ADDR in the Record-Route:
> 
> Record-Route:  :5060;ftag=c3da9477e05d45fca31c24a155af3318;lr=on>

Also, it better to follow OpenSIPS tips on the matter

https://blog.opensips.org/2019/09/16/opensips-as-ms-teams-sbc/

since it also mentions how to handle R-R in replies.  Author of the
Kamailio one has not bothered to update his.

-- Juha

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


Re: [SR-Users] R-R to MS Teams Proxy

2021-02-11 Thread Juha Heinanen
Daniel,

I don't want to use record_route_preset at all, since its use is very
complicated when Kamailio is listening on multiple IP addresses and when
request can come over UDP, TCP, or TLS and when R-R URIs can have many
parameters depending on if rtpengine is used, etc.

So I simply want to keep on using record_route() as before, but tell it
to use a FQDN instead of IP address of the proxy in the first or second
R-R header that it is adding.

-- Juha

-

Daniel-Constantin Mierla writes:
> 
> On 10.02.21 21:01, Juha Heinanen wrote:
> > When request is sent from Kamailio to MS Teams SIP Proxy, the top R-R
> > URI needs to contain FQDN of Kamailio SIP proxy instead of its IP
> > address.  Document
> >
> >   https://skalatan.de/de/blog/kamailio-sbc-teams
> >
> > suggest to replace record_route(); call with
> >
> >   record_route_preset("SBC-DNS-DOMAIN:5061;transport=tls", 
> > "SBC-IP-ADDR:5060");
> >
> > That works only in a very simple case where the request came in over UDP
> > or TCP and SIP Proxy has only one listening address, i.e., SBC-IP-ADDR.
> >
> > One way to solve the problem might be a new r_r function that would take
> > FQDN of the top R-R URI as argument or introduction of a pv from where
> > the current record_route() function would take the FQDN if it has been
> > set.
> >
> > Any comments or other solutions?
> 
> Not sure I understand: do you want to get the value of the second
> parameter for record_route_preset() based on local sockets where the
> request was received?
> 
> Cheers,
> Daniel
> 
> -- 
> 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


[SR-Users] R-R to MS Teams Proxy

2021-02-10 Thread Juha Heinanen
When request is sent from Kamailio to MS Teams SIP Proxy, the top R-R
URI needs to contain FQDN of Kamailio SIP proxy instead of its IP
address.  Document

  https://skalatan.de/de/blog/kamailio-sbc-teams

suggest to replace record_route(); call with

  record_route_preset("SBC-DNS-DOMAIN:5061;transport=tls", "SBC-IP-ADDR:5060");

That works only in a very simple case where the request came in over UDP
or TCP and SIP Proxy has only one listening address, i.e., SBC-IP-ADDR.

One way to solve the problem might be a new r_r function that would take
FQDN of the top R-R URI as argument or introduction of a pv from where
the current record_route() function would take the FQDN if it has been
set.

Any comments or other solutions?

-- Juha

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


Re: [SR-Users] run_trans_callbacks_internal crash

2021-02-09 Thread Juha Heinanen
Daniel-Constantin Mierla writes:
> Get also the output for gdb commands in frame 0:
> 
> list
> 
> p *cbp

Here, but not much:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x7f601d4b2f32 in run_trans_callbacks_internal 
(cb_lst=0x7f5ffb53e318, type=512, trans=0x7f5ffb53e2a0, 
params=0x7ffd1c349720) at t_hooks.c:254
254    t_hooks.c: No such file or directory.
(gdb) frame 0
#0  0x7f601d4b2f32 in run_trans_callbacks_internal 
(cb_lst=0x7f5ffb53e318, type=512, trans=0x7f5ffb53e2a0, 
params=0x7ffd1c349720) at t_hooks.c:254
254    in t_hooks.c
(gdb) list
249    in t_hooks.c
(gdb) p *cbp
Cannot access memory at address 0x72743b6d6f632e61
(gdb)

-- Juha

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


[SR-Users] run_trans_callbacks_internal crash

2021-02-09 Thread Juha Heinanen
We got the crash below with 5.4.2.  Before the crash there was

db_mysql_async_exec_task(): failed to execute query 

related error messages in syslog.

-- Juha

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x7f601d4b2f32 in run_trans_callbacks_internal 
(cb_lst=0x7f5ffb53e318, type=512, trans=0x7f5ffb53e2a0, 
params=0x7ffd1c349720)
     at t_hooks.c:254
254    t_hooks.c: No such file or directory.
(gdb) bt full
#0  0x7f601d4b2f32 in run_trans_callbacks_internal 
(cb_lst=0x7f5ffb53e318, type=512, trans=0x7f5ffb53e2a0, 
params=0x7ffd1c349720)
     at t_hooks.c:254
     cbp = 0x72743b6d6f632e61
     backup_from = 0x560e8abbe2f0 
     backup_to = 0x560e8abbe2f8 
     backup_dom_from = 0x560e8abbe300 
     backup_dom_to = 0x560e8abbe308 
     backup_uri_from = 0x560e8abbe2e0 
     backup_uri_to = 0x560e8abbe2e8 
     backup_xavps = 0x560e8abbeae0 <_xavp_list_head>
     backup_xavus = 0x560e8abbeae8 <_xavu_list_head>
     backup_xavis = 0x560e8abbeaf0 <_xavi_list_head>
     __func__ = "run_trans_callbacks_internal"
#1  0x7f601d4b35bb in run_trans_callbacks_with_buf (type=512, 
rbuf=0x7f5ffb53e370, req=0x7f5ffafe3b70, repl=0x,
     flags=0) at t_hooks.c:303
     params = {req = 0x7f5ffafe3b70, rpl = 0x, param 
= 0x7f5ffa61e640, code = 487, flags = 0, branch = 0,
   t_rbuf = 0x7f5ffb53e370, dst = 0x7f5ffb53e3c0, send_buf = {s 
= 0x7f5ffa6d4d40 "F", len = 621}}
     trans = 0x7f5ffb53e2a0
#2  0x7f601d458025 in relay_reply (t=0x7f5ffb53e2a0, 
p_msg=0x, branch=0, msg_status=408,
     cancel_data=0x7ffd1c349910, do_put_on_wait=0) at t_reply.c:2124
     relay = 0
     save_clone = 0
     buf = 0x7f601e46a4e0 "SIP/2.0 487 Request Terminated\r\nVia: 
SIP/2.0/TCP 
46.182.160.40;branch=z9hG4bK9ef2.1bbf20df35272cd85c43814302770601.2\r\nVia: 
SIP/2.0/UDP 
95.216.75.211;rport=5060;branch=z9hG4bK9ef2.d6265991eb8da9b735273"...
     res_len = 621
     relayed_code = 487
     relayed_msg = 0x
     reply_bak = 0x2000
     bm = {to_tag_val = {
     s = 0x7f601e46a692 
"f148edd50b878efc51a72f445b390303-e111\r\nCall-ID: 
c2e2b55c-e574-1239-3cbd-6cb3112351ce\r\nCSeq: 31882977 INVITE\r\nServer: 
OpenSIPg SIP Proxy (5.4.2-8 (x86_64/linux))\r\nContent-Length: 
0\r\n\r\n", len = 41}}
     totag_retr = 0
     reply_status = RPS_COMPLETED
     uas_rb = 0x7f5ffb53e370
     to_tag = 0x7f601d525770 
     reason = {s = 0x560e8aad2dbb "Request Terminated", len = 18}
     onsend_params = {req = 0x7ffd1c349940, rpl = 0x7f5ffaeeb7c0, 
param = 0x7ffd1c349880, code = 491640932, flags = 32608,
   branch = 0, t_rbuf = 0x59d, dst = 0x7f5ffb0ea590, send_buf = 
{s = 0x7ffd1c349940 "p\231\064\034\375\177", len = 491699179}}
     ip = {af = 1, len = 0, u = {addrl = {140050215200048, 
140050209586032}, addr32 = {4216579376, 32607, 4210965360, 32607},
     addr16 = {58672, 64339, 32607, 0, 15216, 64254, 32607, 0}, 
addr = "0\345S\373_\177\000\000p;\376\372_\177\000"}}
     __func__ = "relay_reply"
#3  0x7f601d49c7b3 in fake_reply (t=0x7f5ffb53e2a0, branch=0, 
code=408) at timer.c:295
     cancel_data = {cancel_bitmap = 0, reason = {cause = 0, u = 
{text = {s = 0x0, len = 517217456}, e2e_cancel = 0x0,
   packed_hdrs = {s = 0x0, len = 517217456
     do_cancel_branch = 0
     reply_status = 3845367323
#4  0x7f601d49cc35 in final_response_handler (r_buf=0x7f5ffb53e540, 
t=0x7f5ffb53e2a0) at timer.c:462
     silent = 0
     branch_ret = -1
     prev_branch = -1
     now = 2146494577
#5  0x7f601d49cd29 in retr_buf_handler (ticks=2146494577, 
tl=0x7f5ffb53e560, p=0xfa0) at timer.c:518
     rbuf = 0x7f5ffb53e540
     fr_remainder = 32608
     retr_remainder = 473209280
     retr_interval = 32765
     new_retr_interval_ms = 547787427795
     crt_retr_interval_ms = 140725076662752
     t = 0x7f5ffb53e2a0
     __func__ = "retr_buf_handler"
#6  0x560e8a7375fa in slow_timer_main () at core/timer.c:1105
     n = 12
     ret = 0
     tl = 0x7f5ffb53e560
     i = 610
     __func__ = "slow_timer_main"

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


[SR-Users] about kamailio-sbc-teams tutorial

2021-02-01 Thread Juha Heinanen
I read kamailio-sbc-teams tutorial

https://skalatan.de/blog/kamailio-sbc-teams

and it does not mention, which CA root certificates need to be included
tls config ca_list so that Kamalio is able to verify
sipX.pstnhub.microsoft.com server certificates.

-- Juha

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


Re: [SR-Users] kamailio.cfg fomatter

2020-12-10 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> You can add the new file there and eventually a few notes in the
> README.md how to install it.

Done, Juha

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


Re: [SR-Users] kamailio.cfg fomatter

2020-12-10 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> this is syntax highlighting for kamailio.cfg, right?

Yes, plus indentation, which it inherits from c-mode.

> We can create a repo on kamailio github oraganization, like
> emacs-kamailio-syntax, similar to what is now for vim:
> 
>   * https://github.com/kamailio/vim-kamailio-syntax

OK, Juha

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


[SR-Users] kamailio.cfg fomatter

2020-12-10 Thread Juha Heinanen
After noticing that emacs mode is missing, below is my first cut of
kamailio-mode.el.

-- Juha

---

;; kamailio mode for emacs (function list is not complete)

;; activate by starting your kamailio.cfg with this kind of line:

;; #-*-mode: kamailio; tab-width: 4; c-basic-offset: 4;

(setq kamailio-font-lock-keywords
  (let* (
;; define several category of keywords
(x-keywords '("branch_route" "break" "case" "default" "else" 
"event_route" "exit" "failure_route" "for" "if" "loadmodule" "onreply_route" 
"onsend_route" "reply_route" "request_route" "return" "route" "switch" "while"))
(x-types '())
(x-constants '())
(x-events '())
(x-functions '("acc_db_request" "add_path_received" "add_rr_param" 
"allow_routing" "allow_trusted" "append_hf" "append_to_reply" "avp_check" 
"avp_delete" "change_reply_status" "check_route_param" "defined" "dp_translate" 
"ERROR" "fix_nated_sdp" "force_send_socket" "forward" "get_redirects" 
"handle_ruri_alias" "inactivate_gw" "INFO" "in_list" "isflagset" "is_avp_set" 
"isbflagset" "is_direction" "is_domain_local" "is_e164" "is_gflag" "is_gruu" 
"is_method" "is_numeric" "is_present_hf" "jsonrpc_dispatch" "load_gws" 
"lookup_domain" "lookup" "loose_route" "modparam" "mt_match" "NOTICE" 
"proxy_challenge" "record_route" "redirecting" "remove_hf" "resetflag" 
"rtpengine_answer" "rtpengine_delete" "rtpengine_offer" "save" "sdp_content" 
"sdp_transport" "send_reply_mode" "send_reply" "setbflag" "setflag" "setxflag" 
"set_reply_close" "set_reply_no_connect" "set_rtpengine_set" "set_uri_host" 
"set_uri_user" "set_forward_no_connect" "sql_query" "sql_result_free" 
"starts_with" "subst_uri" "tel2sip" "t_check_status" "t_is_canceled" 
"t_load_contacts" "t_next_contacts" "t_on_branch" "t_on_failure" "t_on_reply" 
"t_relay_cancel" "t_relay" "t_set_fr" "unregister" "WARN" "ws_handle_handshake" 
"www_challenge" "xhttp_reply"))
(x-keywords-regexp (regexp-opt x-keywords 'words))
(x-types-regexp (regexp-opt x-types 'words))
(x-constants-regexp (regexp-opt x-constants 'words))
(x-events-regexp (regexp-opt x-events 'words))
(x-functions-regexp (regexp-opt x-functions 'words)))
`(
  (,x-types-regexp . font-lock-type-face)
  (,x-constants-regexp . font-lock-constant-face)
  (,x-events-regexp . font-lock-builtin-face)
  (,x-functions-regexp . font-lock-function-name-face)
  (,x-keywords-regexp . font-lock-keyword-face)
  )))

(defvar kamailio-mode-syntax-table nil "Syntax table for `kamailio-mode'.")

(setq kamailio-mode-syntax-table
  (let ( (synTable (make-syntax-table)))
;; python style comment: “# …”
(modify-syntax-entry ?# "<" synTable)
(modify-syntax-entry ?\n ">" synTable)
synTable))

(define-derived-mode kamailio-mode c-mode "kamailio mode"
  "Major mode for editing Kamailio configuration files"
  (setq font-lock-defaults '((kamailio-font-lock-keywords)))
  (set-syntax-table kamailio-mode-syntax-table))

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


[SR-Users] android client SIP TLS client autentication + kamailio

2020-12-02 Thread Juha Heinanen
beer Ll writes:

> Has anybody use a android SIP client with TLS client authentication enabled
> with kamailio?

One possibility is baresip and baresip+ available from Play Store and
F-Droid.

-- Juha

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


Re: [SR-Users] kamailio.cfg fomatter

2020-11-24 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> So, to summarize, there should be syntax highlighting (maintained at
> different levels) for the editors:
> 
>   * vim (I guess also neovim)
>   * vscode
>   * atom
>   * mcedit

Long list, but unfortunately the oldest editor is missing: emacs.

-- Juha

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


Re: [SR-Users] utility function to check if ip address is private?

2020-11-18 Thread Juha Heinanen
But these could be used:

  detailed_ip_type (ip, result)
  detailed_ipv4_type (ip, result)
  detailed_ipv6_type (ip, result)

-- Juha

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


Re: [SR-Users] utility function to check if ip address is private?

2020-11-18 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> this one:

> https://www.kamailio.org/docs/modules/stable/modules/ipops.html#ipops.f.is_ip_rfc1918

If it is really is based on RFC1918, then I doubt that it would handle
IPv6 private addresses, since when that RFC was written, IPv6 didn't
exist.

-- Juha

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


[SR-Users] utility function to check if ip address is private?

2020-11-18 Thread Juha Heinanen
I looked in the wiki for a utility function that would check if given ip
address is private, but didn't find one.  Does it exist?

-- Juha

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


Re: [SR-Users] send_reply() related feature request

2020-11-06 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> New function added, but no testing done -- if there are issues, open a
> bug report.

Works as expected, thanks, Juha

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


Re: [SR-Users] send_reply() related feature request

2020-11-06 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> New function added, but no testing done -- if there are issues, open a
> bug report.

Thanks, will test later today,

-- Juha

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


Re: [SR-Users] BYE and TCP

2020-11-06 Thread Juha Heinanen
Kjeld Flarup writes:

> My question is still, which port is the BYE from the server supposed to be
> sent to?

If client is behind NAT, the server must use the connection that the
client opened to it to send the request to client.  There is no way the
server opens the connection and uses it.

-- Juha

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


Re: [SR-Users] BYE and TCP

2020-11-06 Thread Juha Heinanen
Kjeld Flarup writes:

> How is TCP SIP actually supposed to handle a BYE, when the client is 
> behind NAT.

Client behind NAT is supposed to keep its TCP connection to SIP Proxy
alive and use it for all requests of the call.  If the connection breaks
for some reason, the client sets up a new one for the remaining
requests.

-- Juha

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


Re: [SR-Users] send_reply() related feature request

2020-11-04 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> I wanted to say that the new function to be added should be a bit more
> generic, not targeting only set_reply_close()+send_reply(), but have a
> "mode" parameter to control what other operations should be done before
> sending the reply out.

That is how I understood it too.  For me a new function with mode param
would be fine.

-- Juha

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


Re: [SR-Users] send_reply() related feature request

2020-11-03 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> set_reply_close() is very minimal wrapper action from the core setting
> an internal flag. It can be merged with a reply function, but maybe it
> should be a new function a little bit more generic, like
> send_reply_mode(code, reason, mode) where mode is a parameter that can
> be used for other purposes in the future (by using bit-based flags).

There may be cases where it is not good idea to close connection after
reply.  So it should not be automatically done by send_reply(). A new
function either with or without an extra argument would be fine.

-- Juha

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


[SR-Users] send_reply() related feature request

2020-11-03 Thread Juha Heinanen
Many times (especially when there is a hacking attempt) I want to close
TCP or TLS session after sending reply.  So, for example, I write:

  set_reply_close();
  send_reply("403", "Forbidden");

It would be more convenient if these two calls could be combined into
one, for example:

  send_reply_and_close("403", "Forbidden");

-- Juha

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


Re: [SR-Users] about registrar save()/lookup()

2020-10-20 Thread Juha Heinanen
Added note about branch flags in registrar readme:

https://github.com/kamailio/kamailio/commit/f2996bf733a0b5e00fe124440353b9a69a3532a2

-- Juha

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


[SR-Users] about registrar save()/lookup()

2020-10-20 Thread Juha Heinanen
I didn't find any mention in registrar module README that save()
function saves also branch flags and that lookup() retrieves them.

Is that documented somewhere?

-- Juha

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


[SR-Users] TLS connection from Chrome to Kamailio fails

2020-10-17 Thread Juha Heinanen
What I wrote in below, is not correct.

(1) Pointing Chrome to

https://:5061

does result in successful handshake:

Oct 17 17:53:06 lohi /usr/bin/sip-proxy[13274]: INFO: tls [tls_domain.c:751]: 
sr_ssl_ctx_info_callback(): SSL handshake started
Oct 17 17:53:06 lohi /usr/bin/sip-proxy[13274]: INFO: tls [tls_domain.c:751]: 
sr_ssl_ctx_info_callback(): SSL handshake started
Oct 17 17:53:06 lohi /usr/bin/sip-proxy[13274]: INFO: tls [tls_domain.c:763]: 
sr_ssl_ctx_info_callback(): SSL handshake done
Oct 17 17:53:06 lohi /usr/bin/sip-proxy[13274]: INFO: tls [tls_server.c:431]: 
tls_accept(): tls_accept: new connection from 192.168.43.159:43874 using 
TLSv1.3 TLS_AES_256_GCM_SHA384 256

(2) But when JsSIP TryIt app tries to connect to K at the same port, it does
not result in SSL handshake done, but a series of trials:

Oct 17 17:55:20 lohi /usr/bin/sip-proxy[13274]: INFO: tls [tls_domain.c:751]: 
sr_ssl_ctx_info_callback(): SSL handshake started
Oct 17 17:55:23 lohi /usr/bin/sip-proxy[13274]: INFO: tls [tls_domain.c:751]: 
sr_ssl_ctx_info_callback(): SSL handshake started
Oct 17 17:55:25 lohi /usr/bin/sip-proxy[13274]: INFO: tls [tls_domain.c:751]: 
sr_ssl_ctx_info_callback(): SSL handshake started
...

And if I first do (1), then also (2) succeeds.

With Firefox, (2) works without (1).

-- Juha

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


Re: [SR-Users] TLS connection from Chrome to Kamailio fails

2020-10-16 Thread Juha Heinanen
Jeff Bilyk writes:

> https://lists.kamailio.org/pipermail/sr-users/2013-March/077235.html may
> contain a helpful workaround,

Jeff,

Thanks for your reply.  I do have

tcp_accept_aliases=no

and this problems appears before event_route [xhttp:request], that is,
already during TLS handshake.

-- Juha

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


Re: [SR-Users] TLS connection from Chrome to Kamailio fails

2020-10-16 Thread Juha Heinanen
Henning Westerholt writes:

> Interesting. Does e.g. 5.4 still works for you? Might be then a
> regression in trunk.

Same problem with 5.4.

-- Juha

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


[SR-Users] TLS connection from Chrome to Kamailio fails

2020-10-16 Thread Juha Heinanen
Simple way to show this problem without any WebRTC SIP client is to
point Chrome browser to K's TLS listening port:

https://:5061

and look with wireshark or tshark how the handshake gets terminated by
Chrome right after Server Hello.

The same with Firefox works fine.

-- Juha


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


Re: [SR-Users] about $sht(htable=>key) htable name

2020-10-13 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> In the code is possible to lookup the hash table at runtime, being also
> done by some of the htable cfg functions. It will require some new code
> to evaluate the name expression every time at at runtime, then parse and
> lookup the hash table structure...

A use case where it would be convenient to have htable name in a
variable is when there is two hash tables, one of which is active while
the other waits new content to be loaded from database.  When done,
roles of the two hash tables are changed.

So instead of testing, which hash table is currently active and then use
its string name as htable name, it would be simpler to use a var where
the name of currently active table is stored.

-- Juha

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


[SR-Users] about $sht(htable=>key) htable name

2020-10-13 Thread Juha Heinanen
Is there some good reason why htable in $sht(htable=>key) cannot be a
dynamic string containing pseudo variables?

-- Juha

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


Re: [SR-Users] websocket transport protocol in Record-Route header

2020-09-29 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> If nobody else here can add more, this aspect can be clarified by asking
> on sip-implementors mailing list or maybe ietf sipcore wg mailing
> list.

Perhaps Inaki or Jose as authors of the RFC could comment. I agree that
secure transport is the only one that makes sense unless testing.

-- Juha

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


Re: [SR-Users] websocket transport protocol in Record-Route header

2020-09-27 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> For SIP URI the parameter value is always ws:
> 
>   * https://tools.ietf.org/html/rfc7118#section-5.2

Yes, according to that RFC, but does it make any sense, since how you
tell based on usrloc received value if ws or wss was used for the
registration?

-- Juha

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


[SR-Users] websocket transport protocol in Record-Route header

2020-09-26 Thread Juha Heinanen
It may be related that also usrloc received uri has ;transport=ws:

sip:192.168.43.83:51176;transport=ws

instead of ;transport=wss.

-- Juha

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


[SR-Users] websocket transport protocol in Record-Route header

2020-09-26 Thread Juha Heinanen
No matter if UA uses ws or wss to connect to Kamailio, when K routes
INVITE from this UA and record_route() is called, K always adds
;transport=ws parameter to Record-Route URI, for example,

Record-Route: 

In this test, Kamailio is listening on that port like this:

# SIP over WebSocket
listen=tls:192.168.43.83:7998

Why doesn't K in this case add ;transport=wss to the R-R URI?

-- Juha

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


Re: [SR-Users] Is there any way to remove stale registrations before expires time from usrloc ?

2020-09-11 Thread Juha Heinanen
sagar malam writes:

> I have tried ul_rm_contact but it is not working :
> curl POST --data
> '{"jsonrpc":"2.0","method":"ul.rm_contact","params":{"0":"location","1":"
> 30...@x.com
> <30...@jeff.sip.teledge.com>","2":"sip:30001@X.X.X.X:43108;x-nat=yes;pv-ip=10.212.134.167;pb-ip=X.X.X.X;pb-pt=43108;transport=tcp"}}'
> -H "Content-Type: application/json" -X POST 10.50.7.14:5060/RPC2

Second param is AOR (username@domain).  Yours does not look like it.
Use ul.dump to check.

-- Juha

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


[SR-Users] Is there any way to remove stale registrations before expires time from usrloc ?

2020-09-11 Thread Juha Heinanen
sagar malam writes:

> I am using the usrloc module to store registrations. I could not find any
> way to remove stale registrations before expires time. Most of the
> registrations are mobile app so they wont run in background to save battery
> of phone hence we end up having lots of registrations in usrloc which were
> not removed because app was killed in background by OS without letting it
> send unregister request.

There are apps (e.g. baresip) that run as foreground service to avoid
being killed and that don't consume lots of battery.

> Is there any way to remove stale registrations before expires time from
> usrloc ?

There is ul.rm_contact rpc command.

-- Juha

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


Re: [SR-Users] new compiler warning in 5.4 stable release

2020-08-30 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> Should be fixed now.

Yes, thanks, Juha

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


[SR-Users] new compiler warning in 5.4 stable release

2020-08-30 Thread Juha Heinanen
tls_locking.c: In function 'tls_init_locks':
tls_locking.c:191:1: warning: label 'error' defined but not used 
[-Wunused-label]
 error:
 ^

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


Re: [SR-Users] dns_naptr_ignore_rfc default value

2020-08-10 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> The DNS NAPTR is also turned off by default, which should be on, based
> on RFC, iirc, but that adds extra DNS query and slows down everything as
> most of services I saw so far do no relay on NAPTR.

It is OK to have NAPTR lookup off by default, but if it is turned on, I
don't see any point why order value is not obeyed by default.  For
example, if TLS preferred, that preference should be respected for
security reasons.

-- Juha

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


[SR-Users] dns_naptr_ignore_rfc default value

2020-08-10 Thread Juha Heinanen
What is the point of dns_naptr_ignore_rfc default value:

dns_naptr_ignore_rfc

If the DNS lookup should ignore the remote side's protocol preferences,
as indicated by the Order field in the NAPTR records and mandated by RFC
2915.

  dns_naptr_ignore_rfc = yes | no (default yes)

In my (and RFC 2915's) opinion the default should be 'no'.

-- Juha


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


[SR-Users] new in upcoming Kamailio 5.4.0

2020-07-14 Thread Juha Heinanen
Henning Westerholt writes:

>   *   5 new modules have been added (pv_headers, kafka, secsipid,
>   *   systemdops, dlgs)

Could not find many of these on page:

https://kamailio.org/docs/modules/devel/

-- Juha

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


Re: [SR-Users] 5.4 compiler warning

2020-07-14 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> Should be fixed now. What OS/compiler you use that reports such warning?
> My clang doesn't do it ...

I'm using Debian 10 with C compiler gcc 8.3.0.

-- Juha

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


[SR-Users] 5.4 compiler warning

2020-07-14 Thread Juha Heinanen
Got this when building 5.4;

CC (gcc) [sip-proxy]core/dset.o
core/dset.c: In function 'uri_trim_rcv_alias':
core/dset.c:1042:6: warning: variable 'proto' set but not used 
[-Wunused-but-set-variable]
  int proto;
  ^

-- Juha

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


[SR-Users] Map Diversion to History-Info

2020-05-05 Thread Juha Heinanen
Duarte Rocha writes:

> Does Kamailio have any method to transform an History-Info with redirecting
> info into a Diversion or the other way around?

I don't know of any builtin function for that, but you can handle it
with normal config script statements.

-- Juha

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


Re: [SR-Users] 488 Not Acceptable Here when remove codecs with rtcp-fb

2020-05-05 Thread Juha Heinanen
This 488 think reminds me that SIP over webrtc is broken.

Webrtc UAS (at least JsSIP) cannot issue 488 before the UAS has started
to ring.  It is very frustrating for the callee to get such a spam ring.

RFC3261 section "8.2 UAS Behavior" tells:

   Note that request processing is atomic.  If a request is accepted,
   all state changes associated with it MUST be performed.  If it is
   rejected, all state changes MUST NOT be performed.

So it is against the standard to issue 180 and after that reject the
request with 488.

-- Juha

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


Re: [SR-Users] 488 Not Acceptable Here when remove codecs with rtcp-fb

2020-05-05 Thread Juha Heinanen
José Lopes writes:
> Hello Daniel,
> 
> Thanks for your reply.
> 
> On the next link, I put the original SDP from webrtc client and the SDP
> after kamailio that exposes the issue.
> I am using Kamailio version 5.3.3 with sdpops and rtpengine module.
> 
> https://pastebin.com/bYr0AcVT

Perhaps it is this line that the webrtc UAS doesn't like:

  m=audio 18184 RTP/AVP 111 103 104 9 0 8 106 105 13 110 112 113 126

If I remember correctly, webrtc mandates UDP/TLS/RTP/SAVPF media
transport.

-- Juha

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


[SR-Users] H264 codec licence

2020-04-14 Thread Juha Heinanen
Prakash Ganesan writes:

> We are planning to use kamilio/RTP engine for our WebRTC calls. I would
> like to know how the H264 codec licences are handled as i know there is a
> royalty fee associated with this video codec from the server perspective.
> As of now there is plan to use H264 pass through and vp8/vp9 transcoded to
> H264 by the  kamilio/RTP engine.

My understanding is that H264 decoder is included in an FFmpeg lib and
encoder is in x264 lib, both of which are open source.

-- Juha

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


Re: [SR-Users] setting $du in branch route has no effect in 5.3

2020-03-30 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> These commits were pushed to branch 5.3 already.

Yes, I noticed, thanks, Juha

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


Re: [SR-Users] setting $du in branch route has no effect in 5.3

2020-03-30 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> I pushed two commits on master and branch 5.3 to skip reusing tcp
> connection id. See if it solves your case.

I tried with master and now setting of $du in branch route worked OK.

-- Juha

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


Re: [SR-Users] setting $du in branch route has no effect in 5.3

2020-03-30 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> > Mar 29 10:19:28 char /usr/bin/sip-proxy[26162]: INFO: * du = 
> > sip:127.0.0.1:5090;transport=tcp
> 
> Does this happen after a usrloc location lookup? Trying to figure out
> what destination-related processing is done before to see what fields
> were set...

Yes, it is in contact branch route:

  lookup() => t_load_contacts() => t_next_contacts() =>
t_on_branch() => t_relay)()

-- Juha


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


Re: [SR-Users] setting $du in branch route has no effect in 5.3

2020-03-29 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> Have you tested with tcp/tls or with udp? There was a group of commits
> trying to propagate the tcp connection id as much as possible to speed
> up connection search, maybe that needs to be reset -- I can look into
> it, if you tested for tcp/tls.

This is what has no effect in branch route:

Mar 29 10:19:28 char /usr/bin/sip-proxy[26162]: INFO: * du = 
sip:127.0.0.1:5090;transport=tcp

-- Juha

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


Re: [SR-Users] setting $du in branch route has no effect in 5.3

2020-03-29 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> The branch route is executed inside t_fwd.c (like 354 in master branch).
> You can try to do a diff of tm module between the branches to see if you
> can spot something related. I remember I grouped some variables in a
> structure at some point, but it should have not impacted old
> behaviour...

The bug does not exist, when I build 5.3 at this commit:

https://github.com/kamailio/kamailio/commit/50b0e5398b0ce698b287818d2c6fe4266d972152

and exists when I build 5.3 at this commit: 

https://github.com/kamailio/kamailio/commit/9ff491a881f326b5ee6eee4fd40c427f8d83ecf0

So looks like the latter broke something.

-- Juha

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


[SR-Users] setting $du in branch route has no effect in 5.3

2020-03-29 Thread Juha Heinanen
Juha Heinanen writes:

> I noticed that in 5.3 and master setting $du in branch route has no
> effect.  It works fine in 5.2 using exactly the same config.

This is pretty serious.  If someone can point to possible source code
files, where this bug might have been originated from, I can start
digging changes from 5.2.

-- Juha

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


[SR-Users] setting $du in branch route has no effect in 5.3

2020-03-29 Thread Juha Heinanen
I noticed that in 5.3 and master setting $du in branch route has no
effect.  It works fine in 5.2 using exactly the same config.

-- Juha

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


Re: [SR-Users] [ot] lightweight sip app for auto-answering with play file and echo mode

2020-03-27 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> Would it be possible to combine like playing a file first, then do echo
> mode?

As you noticed, play and echo use different audio_source and thus I
don't think it is possible to combine the two.

-- Juha

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


Re: [SR-Users] [ot] lightweight sip app for auto-answering with play file and echo mode

2020-03-27 Thread Juha Heinanen
Regarding echo, one can use same kind of baresip accounts file as
with play, such as

;auth_user=echo;auth_pass=xx;outbound="sip:192.168.43.82:5060;transport=tcp";ptime=20;audio_codecs=OPUS/48000/2,PCMU,PCMA;regint=600;pubint=0;regq=0.5;sipnat=outbound;answermode=auto

The difference is that in config file, these lines are needed:

audio_playeraubridge,pseudo0
audio_sourceaubridge,pseudo0
module  aubridge.so
module_app  echo.so

-- Juha

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


Re: [SR-Users] [ot] lightweight sip app for auto-answering with play file and echo mode

2020-03-27 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> > Here is an example configuration of a SIP UA that plays a file when it
> > receives a call:
> >
> > .baresip/config:
> > ...
> > audio_sourcegst,file:///tmp/file_to_play.wav
> > ...
> > module  gst1.so

gst1 module was recently renamed to gst. So the last line may need to be
replaced by

module  gst.so

-- Juha

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


Re: [SR-Users] [ot] lightweight sip app for auto-answering with play file and echo mode

2020-03-26 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> >> wondering if anyone here is aware of a lightweight sip app that can
> >> answer a call, play some file and/or do echo mode, mainly targeted at
> >> using it for basic sip routing and call testing.
> > baresip cli app can do all that.
> 
> OK, thanks, I will look into it! One more quick question: this is
> something that can be done directly via command line parameters or its
> config file?

Here is an example configuration of a SIP UA that plays a file when it
receives a call:

.baresip/config:
...
audio_sourcegst,file:///tmp/file_to_play.wav
...
module  gst1.so
...

.baresip/accounts:
"Play" 
;auth_user="play";auth_pass="something";outbound="sip:192.87.89.90:5060;transport=tcp";ptime=20;audio_codecs=OPUS/48000/2,PCMU,PCMA;regint=600;pubint=0;regq=0.5;sipnat=outbound;answermode=auto

-- Juha






> 
> Asking because in the past, with pjsua I had to write small shell
> command wrappers to simulate sending commands -- like for example
> sending the command set in $CMD after 30secs:
> 
> (sleep 30; echo $CMD) | pjsua ...
> 
> Cheers,
> Daniel
> 
> -- 
> Daniel-Constantin Mierla -- www.asipto.com
> www.twitter.com/miconda -- www.linkedin.com/in/miconda

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


[SR-Users] [ot] lightweight sip app for auto-answering with play file and echo mode

2020-03-26 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> wondering if anyone here is aware of a lightweight sip app that can
> answer a call, play some file and/or do echo mode, mainly targeted at
> using it for basic sip routing and call testing.

baresip cli app can do all that.

-- Juha

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


[SR-Users] about kamailio.cfg NAT test

2020-03-24 Thread Juha Heinanen
In kamailio/etc/kamailio.cfg NAT test is based on nat_uac_test("19").
19 includes test 16:

  16 - Test if the source port is different from the port in the “Via”
  header. If the “Via” header contains no port, it uses the default SIP
  port 5060

Based on a couple of tests using baresip, looks like that results in
false positive when UA connects to SIP proxy via TCP.

An example:

T 2020/03/24 13:57:12.685441 192.26.134.10:38940 -> 192.26.134.1:5060 [AP] #127
REGISTER sip:test.tutpro.com SIP/2.0.
Via: SIP/2.0/TCP 192.26.134.10:44717;branch=z9hG4bK5b6aa423104ef942;rport.

Does someone know why test 16 is included?

-- Juha

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


Re: [SR-Users] unknown error messages

2020-03-20 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> do you have an external application that keeps persistent connection for
> rpc/jsonrpc commands?

That was it.

-- Juha

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


[SR-Users] unknown error messages

2020-03-13 Thread Juha Heinanen
It turned out that the unknown error messages were produced by process
32058 that was not in ctl ps list at all.  So it must have survived
alive from a previous restart of K.

Question: how it is possible that a tcp worker that does not belong to
the current running K instance gets to service a json rpc request?

-- Juha

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


Re: [SR-Users] out of shm without any visible reason

2020-03-12 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> Try to install debugging symbols for libmariadb and maybe there will be
> more hints in the backtace of what it does internally, which can improve
> troubleshooting by searching on the web for similar cases.

I did that already earlier when I reported about similar issue, which
made K totally unresponsive for a long period of time.  Nothing was
found from the backtrace.

> What you can also try, is to change the database table type. What do you
> have now, MyISAM, InnoDB or something else?

DB type is InnoDB.

> To know better the ecosystem, what is the operation system and
> mysq/mariadb versions?

Latest stable Debian 10 that comes with mariadb 10.3.

On the positive side, so far the issue has not appeared after I
backported your db_cluster async insert patch to 5.3.  Perhaps there was
some issue in falling back to normal insert.

-- Juha

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


Re: [SR-Users] unknown error messages

2020-03-12 Thread Juha Heinanen
Henning Westerholt writes:

> If you only saw it once it is probably not worth to dig that deep into
> it, might be also caused from some external factors.

It has appeared several times and may be related to json request.
Perhaps tcp connection is broken before K has delivered the result.

-- Juha

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


[SR-Users] unknown error messages

2020-03-12 Thread Juha Heinanen
Any idea where this kind of error message could come from:

Mar 12 07:16:17 rox2 /usr/bin/sip-proxy[32058]: CRITICAL:  
[core/pass_fd.c:277]: receive_fd(): EOF on 61
Mar 12 07:16:17 rox2 /usr/bin/sip-proxy[32058]: ERROR:  
[core/io_wait.h:607]: io_watch_del(): trying to delete already erased 
entry 61 in the hash(-1, 0, 0x7f689c16a868) flags 0)
Mar 12 07:16:17 rox2 /usr/bin/sip-proxy[32058]: ERROR:  
[core/io_wait.h:607]: io_watch_del(): trying to delete already erased 
entry 64 in the hash(-1, 0, 0x7f68c063b0f0) flags 0)
Mar 12 07:16:17 rox2 /usr/bin/sip-proxy[32058]: CRITICAL:  
[core/pass_fd.c:191]: send_fd(): sendmsg failed sending 79 on 64: Broken 
pipe (32)
Mar 12 07:16:17 rox2 /usr/bin/sip-proxy[32058]: ERROR:  
[core/tcp_main.c:4225]: send2child(): send_fd failed for 0x7f689c18a0b0 
(flags 0x4018), fd 79

Debug does not give any hints.

-- Juha

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


Re: [SR-Users] out of shm without any visible reason

2020-03-12 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> > DB access works fine from K worker processes during the time when
> > insert is stuck in timer process.
> 
> Are new records inserted in acc table? I think there are some
> tools/commands for mysql to inspect the state a database table, check
> acc table and missed_calls, if you also use this one.

Accounting records are inserted without problems from other calls to the
same accounting table where the timer process tries to insert its
record but hangs.

-- Juha

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


Re: [SR-Users] out of shm without any visible reason

2020-03-11 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> If it happens periodically, maybe you can track why: try to identify
> apps accessing the database for back up, cdr generation, etc ... as well
> as infrastructure maintenance operations (vm backup snapshot).

DB access works fine from K worker processes during the time when
insert is stuck in timer process.

-- Juha

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


Re: [SR-Users] out of shm without any visible reason

2020-03-11 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> It seems to be the case of a retransmission timeout:
> 
> #17 0x7f7dc04d4aca in acc_onreply (t=0x7f7d9e3b0650, req=0x7f7d9e357650, 
> reply=0x, code=408) at acc_logic.c:604
> 
> Code is 408 and the reply is faked value. This case is happening in
> timer process.

That explains it.  But isn't it risky that in this kind of situation
the timer process (the only one) handles the reply and accounting?

The problem is related to db_cluster/mariadb/debian.  If db_cluster is
not used, everything works fine.  With db_cluster, accounting hangs the
timer process at regular (about 2 hour) intervals.

-- Juha

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


Re: [SR-Users] out of shm without any visible reason

2020-03-10 Thread Juha Heinanen
Regarding db_mysql timeout_interval, it has its default value 2, which
means 6 seconds.  The insert was hanging in the timer process much
longer and no error messages related to abort appear in syslog.  How is
that possible?

-- Juha

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


Re: [SR-Users] out of shm without any visible reason

2020-03-10 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> There is no async-insert done by acc with db_cluster, it is always
> standard (sync) insert. You would have to track why the mysql server (or
> the client library) is blocking from time to time, I don't think it is
> something that kamailio can do.

OK, thanks for the explanation.

One more question: why is the timer process involved with this acc
insert?  Isn't accounting done by the normal worker processes that
handle requests/responses?

-- Juha

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


Re: [SR-Users] out of shm without any visible reason

2020-03-10 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> The process is stuck in mysql client library.
> 
> The async insert is not implemented in the db_cluster module, so at this
> moment, if you want it, you have to use acc directly with db_mysql
> module.

Then how is it possible that most of the time accounting using async
inserts works and get stuck only once in awhile?

And would it be possible to detect that async inserts are trying to be
used when K is started and make the start to fail?

Maybe also some text about that in db_cluster module README would be
useful.

-- Juha

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


Re: [SR-Users] out of shm without any visible reason

2020-03-09 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> If you can reproduce it, watch what the timer processes do during that
> time frame. Get the list of processes with 'kamctl ps', then when the
> issue is exposed, grab the backtraces of all processes with:
> 
> kamctl trap
> 
> A file is created with the backtraces taken with gdb. Sent it over here
> to analyze, if you cannot spot an issue there.

Two traps were taken more than 10 sec apart when the number of
transactions and shared memory usage started to grow.  In both traps,
process PID: 6049 DSC: timer was in the exactly same state (below).

Looks like it is stuck in an acc to db operation.  How long is such an
operation allowed to last before an error is generated and the timer
process becomes free to do something else?

acc module db_insert_mode has value 2 and there is 2 async_workers
(process numbers 6056 and 5057 below).  db_mysql README does not mention
if it supports async insert.

-- Juha

---start 6049 -
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x7f7dc30107e4 in __GI___poll (fds=0x7fff233831e8, nfds=1, timeout=2000) at 
../sysdeps/unix/sysv/linux/poll.c:29
29  ../sysdeps/unix/sysv/linux/poll.c: No such file or directory.
#0  0x7f7dc30107e4 in __GI___poll (fds=0x7fff233831e8, nfds=1, 
timeout=2000) at ../sysdeps/unix/sysv/linux/poll.c:29
resultvar = 18446744073709551100
sc_ret = 
#1  0x7f7dc2064efa in ?? () from /usr/lib/x86_64-linux-gnu/libmariadb.so.3
No symbol table info available.
#2  0x7f7dc20652da in ?? () from /usr/lib/x86_64-linux-gnu/libmariadb.so.3
No symbol table info available.
#3  0x7f7dc2071425 in mysql_get_parameters () from 
/usr/lib/x86_64-linux-gnu/libmariadb.so.3
No symbol table info available.
#4  0x7f7dc2071626 in mysql_get_parameters () from 
/usr/lib/x86_64-linux-gnu/libmariadb.so.3
No symbol table info available.
#5  0x7f7dc2067c1e in ?? () from /usr/lib/x86_64-linux-gnu/libmariadb.so.3
No symbol table info available.
#6  0x7f7dc2068654 in ?? () from /usr/lib/x86_64-linux-gnu/libmariadb.so.3
No symbol table info available.
#7  0x7f7dc206d4ed in ?? () from /usr/lib/x86_64-linux-gnu/libmariadb.so.3
No symbol table info available.
#8  0x7f7dc2070513 in ?? () from /usr/lib/x86_64-linux-gnu/libmariadb.so.3
No symbol table info available.
#9  0x7f7dc206f230 in mysql_ping () from 
/usr/lib/x86_64-linux-gnu/libmariadb.so.3
No symbol table info available.
#10 0x7f7dc20bbaba in db_mysql_submit_query (_h=0x7f7dc237f3a0, 
_s=0x7f7dc210e1e0 ) at km_dbase.c:83
t = 1583739979
i = 0
code = 21923
__func__ = "db_mysql_submit_query"
#11 0x7f7dc20fb35e in db_do_submit_query (_h=0x7f7dc237f3a0, 
_query=0x7f7dc210e1e0 , submit_query=0x7f7dc20bb71d 
) at db_query.c:58
ret = -1039426148
tvb = {tv_sec = 94160937318932, tv_usec = 140178106086304}
tve = {tv_sec = 200798118576, tv_usec = 1782411427864}
tz = {tz_minuteswest = 24, tz_dsttime = 65147}
tdiff = 32637
__func__ = "db_do_submit_query"
#12 0x7f7dc20fdd29 in db_do_insert_cmd (_h=0x7f7dc237f3a0, 
_k=0x7f7dc04f88a0 , _v=0x7f7dc04f8b80 , _n=24, 
val2str=0x7f7dc20b9d9c , submit_query=0x7f7dc20bb71d 
, mode=0) at db_query.c:243
off = 804
ret = 415
__func__ = "db_do_insert_cmd"
#13 0x7f7dc20fe396 in db_do_insert (_h=0x7f7dc237f3a0, _k=0x7f7dc04f88a0 
, _v=0x7f7dc04f8b80 , _n=24, val2str=0x7f7dc20b9d9c 
, submit_query=0x7f7dc20bb71d ) at 
db_query.c:258
No locals.
#14 0x7f7dc20c08a4 in db_mysql_insert (_h=0x7f7dc237f3a0, _k=0x7f7dc04f88a0 
, _v=0x7f7dc04f8b80 , _n=24) at km_dbase.c:493
No locals.
#15 0x7f7dc07342a0 in db_cluster_insert (_h=0x7f7dc29bb650, 
_k=0x7f7dc04f88a0 , _v=0x7f7dc04f8b80 , _n=24) at 
dbcl_api.c:379
ret = -1
i = 5
k = 32637
sec = 36091306
rc = 0
rok = 0
j = 0
dbh = 0x7f7dc237f3a0
cls = 0x7f7dc239b980
__func__ = "db_cluster_insert"
#16 0x7f7dc04c18a0 in acc_db_request (rq=0x7f7d9e36d540) at acc.c:476
m = 24
n = -1640573632
i = 24
o = 17
t = 0x7f7d9e36e668
dtime = -4.6749039984044258e+154
__func__ = "acc_db_request"
#17 0x7f7dc04d4aca in acc_onreply (t=0x7f7d9e3b0650, req=0x7f7d9e357650, 
reply=0x, code=408) at acc_logic.c:604
new_uri_bk = {s = 0x7f7d9e36dc40 
"sip:xxx@x.x.x.x:5060;transport=udp203.29INVITE sip:x...@xxx.xxx 
SIP/2.0\r\nRecord-Route: \r\nVia: SIP/2.0/UDP 
x.x.x.x;branch"..., len = 50}
br = 0
hdr = 0x7f7dc15f3c0f 
cmsg = 0x7f7d9e36d540
cmsg_len = 6968
preq = 0x7f7d9e36d540
mstart = 0x7f7d9e36d540
mend = 0x7f7d9e36f078
__func__ = "acc_onreply"
#18 0x7f7dc04d5783 in tmcb_func (t=0x7f7d9e3b0650, type=512, 
ps=0x7fff23383a50) at 

Re: [SR-Users] out of shm without any visible reason

2020-03-05 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> It is ok, just add the documentation for the new function as well.

Done, Juha

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


Re: [SR-Users] out of shm without any visible reason

2020-03-05 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> The function can be added, should be easy to extract the code from the
> rpc command function.

How about the tm.c patch below?  Or should the function be placed in
some other tm/.c file and if so, which one?

-- Juha

---

*** /usr/src/orig/kamailio/src/modules/tm/tm.c  2020-03-06 00:13:15.534078140 
+0200
--- tm.c2020-03-06 00:45:26.405625701 +0200
***
*** 208,213 
--- 207,213 
char* pnexthop, char* psock, char *phdrs, char* pbody);
  static int w_t_get_status_code(sip_msg_t* msg, char *p1, char *p2);
  
+ static int t_clean(struct sip_msg* msg, char* key, char* value);
  
  /* by default the fr timers avps are not set, so that the avps won't be
   * searched for nothing each time a new transaction is created */
***
*** 411,416 
--- 411,417 
REQUEST_ROUTE | FAILURE_ROUTE},
{"t_next_contact_flow", t_next_contact_flow,0, 0, 0,
REQUEST_ROUTE },
+   {"t_clean", t_clean, 0, 0, 0, ANY_ROUTE },
  
/* not applicable from the script */
{"load_tm",(cmd_function)load_tm,   NO_SCRIPT,   0, 
0, 0},
***
*** 2952,2957 
--- 2909,2921 
return ki_t_relay_to_proxy_flags(msg, NULL, rflags);
  }
  
+ /* script function to clean active but very old transactions */
+ static int t_clean(struct sip_msg* msg, char* key, char* value)
+ {
+   tm_clean_lifetime();
+   return 1;
+ }
+ 
  /**
   *
   */


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


Re: [SR-Users] out of shm without any visible reason

2020-03-04 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> There was an unsafe list iteration - can you try with:
> 
>   -
> https://github.com/kamailio/kamailio/commit/325a45e846faae3e5dfa333727d5fab294e44dac
> 
> If all ok, you can backport.

Thanks for the patch.  The crash has only happened once, so it is not
easy to reproduce, and it is production a sip proxy running 5.3.

I'll backport to my own 5.3 copy.

-- Juha

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


Re: [SR-Users] out of shm without any visible reason

2020-03-04 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> If you can reproduce it, watch what the timer processes do during that
> time frame. Get the list of processes with 'kamctl ps', then when the
> issue is exposed, grab the backtraces of all processes with:
> 
> kamctl trap
> 
> A file is created with the backtraces taken with gdb. Sent it over here
> to analyze, if you cannot spot an issue there.

Will do that.  Now it happened that K crashed when tm.clean was given at
the time when the number transactions was growing. Below is backtrace of
that crash.

-- Juha

---
(gdb) bt full
#0  0x7f5151fa3cf8 in tm_clean_lifetime () at h_table.c:617
r = 53487
tcell = 0x0
texp = 1117017528
#1  0x7f5151fe1afd in tm_rpc_clean (rpc=0x7f51513b0a00 , 
c=0x7f51513b0920 <_jsonrpc_ctx_global>) at t_stats.c:299
No locals.
#2  0x7f515138fc9f in jsonrpc_dispatch (msg=0x7fff3d1dc210, s1=0x0, s2=0x0) 
at jsonrpcs_mod.c:1294
rpce = 0x7f5152dcf360
ctx = 0x7f51513b0920 <_jsonrpc_ctx_global>
ret = 0
nj = 0x0
val = {s = 0x557bb08fe9d0 "tm.clean", len = 8}
__func__ = "jsonrpc_dispatch"
#3  0x557bae5c28b5 in do_action (h=0x7fff3d1dc130, a=0x7f51537ebd30, 
msg=0x7fff3d1dc210) at core/action.c:1073
ret = -5
v = 1390957541
dst = {send_sock = 0xc0, to = {s = {sa_family = 6, sa_data = 
"\000\000\000\000\000\000\220\270\035=\377\177\000"}, sin = {sin_family = 6, 
sin_port = 0, sin_addr = {s_addr = 0}, sin_zero = "\220\270\035=\377\177\000"}, 
sin6 = {sin6_family = 6, sin6_port = 0, 
  sin6_flowinfo = 0, sin6_addr = {__in6_u = {__u6_addr8 = 
"\220\270\035=\377\177\000\000\000\b\302\tv\223\062\213", __u6_addr16 = {47248, 
15645, 32767, 0, 2048, 2498, 37750, 35634}, __u6_addr32 = {1025357968, 32767, 
163710976, 2335347574}}}, 
  sin6_scope_id = 1025358088}}, id = 32767, send_flags = {f = 
50272, blst_imask = 21212}, proto = 81 'Q', proto_pad0 = 127 '\177', proto_pad1 
= 0}
tmp = 0x7f5152ab3c1e "H\205\300\177\345ƃ\224"
new_uri = 0x7f51537e9da8 ""
end = 0x7fff3d1dc210 "\255\004"
crt = 0x557bb08fc931 "ip_proxy_cache"
cmd = 0x7f5152dd27c0
len = 4
user = 0
uri = {user = {s = 0x7fff3d1db580 "\340\265\035=\377\177", len = 
1390199904}, passwd = {s = 0x557bae7f69e3 "INFO", len = -1368709420}, host = {s 
= 0x7fff3d1db5a0 "", len = 1389801488}, port = {s = 0x7fff3d1db640 "\320\006", 
len = 1389801488}, params = {
s = 0x7fff3d1db5e0 "\020\266\035=\377\177", len = 1356175867}, 
sip_params = {s = 0x7fff3d1db7f0 "", len = 0}, headers = {s = 0xc0 , len = 1260448}, port_no = 56128, 
proto = 159, type = ERROR_URI_T, 
  flags = (unknown: 11322464), transport = {s = 0xb7fab0 , len = 16}, ttl = {s = 0x11e , len = 163710976}, user_param = {s = 
0x7fff3d1db610 "\220\266\035=\377\177", 
len = -1370752186}, maddr = {s = 0x0, len = 0}, method = {s = 
0x7f5153158560 "\320\006", len = 0}, lr = {s = 0x7fff3d1db690 
"\360\266\035=\377\177", len = -1368723422}, r2 = {s = 0x7f51531531f0 "\002", 
len = 1389801488}, gr = {s = 0x7f51537ea518 "\002", 
len = 1393897952}, transport_val = {s = 0x6d0 , len = 1389801488}, ttl_val = {s = 0x7f51531530d0 
, len = 1393899728}, user_param_val = {s = 
0x7f51531531f8 ">5\025SQ\177", len = 1390199904}, 
  maddr_val = {s = 0x557bae7f69e3 "INFO", len = 536870912}, method_val 
= {s = 0xc0 , len = 6}, 
lr_val = {s = 0x7fff3d1db6f0 "P\267\035=\377\177", len = -1371351967}, r2_val = 
{s = 0x7fff3d1dc210 "\255\004", 
len = 1400808728}, gr_val = {s = 0x7fff3d1db730 
"\220\267\035=\377\177", len = 163710976}}
next_hop = {user = {s = 0x0, len = 1390199904}, passwd = {s = 
0x557bae7f69e3 "INFO", len = 536870912}, host = {s = 0xc0 , len = 6}, port = {s = 0x7fff3d1db750 "", 
len = -1371324103}, params = {
s = 0x7fff3d1db7f0 "", len = 1400806792}, sip_params = {s = 
0x1917ac , len = 
1400808728}, headers = {s = 0x7fff3d1dc210 "\255\004", len = -1369366375}, 
port_no = 46992, proto = 15645, type = 32767, 
  flags = (unknown: 1390199904), transport = {s = 0x557bae7f69e3 
"INFO", len = 536870912}, ttl = {s = 0xc0 , len = 6}, user_param = {s = 0x7fff3d1db8a0 
"\340\271\035=\377\177", len = -1371320250}, maddr = {
s = 0x557bae7f69e3 "INFO", len = 536870912}, method = {s = 0xc0 
, len = 6}, lr = {s = 
0x7fff3d1db7f0 "", len = 1387308127}, r2 = {s = 0x7f51537eac00 "\031", len = 
1025358088}, gr = {
s = 0x7fff3d1dc210 "\255\004", len = 1025360176}, transport_val = 
{s = 0x17ac3d1db7f0 , 
len = 6060}, ttl_val = {s = 0x557bae7f69e3 "INFO", len = 536870912}, 
user_param_val = {s = 0x7f51537e9d88 "\a", 
len = 1400808728}, maddr_val = {s = 0x0, len = 0}, method_val = {s 
= 0x0, len = 0}, lr_val = {s = 0x557bae95a842  "976", len = 
1398451376}, r2_val = {s = 0x7fff3d1db900 "\360\275\331R\001", len = 

Re: [SR-Users] out of shm without any visible reason

2020-03-03 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> The rpc command tm.clean is like a last resort option when dealing with
> an unexpected situation that messed up the timer process, otherwise the
> transactions should be cleaned as they are expired or terminated because
> of final response sent upstream, with a delay of 5 seconds (default value).

Before we find out why the transactions are not freed on time, I would
like to run a test every minute that checks if the shm usage is too
high and, if so, executes tm.clean.  Something like this:

route [every_minute] {
$var(shm_usage) = ($stat(real_used_size) * 100) / $stat(total_size);
if ($var(shm_usage) > 90) t_clean();
}

Otherwise OK, but there is no t_clean() function.  Could that be added?

-- Juha

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


Re: [SR-Users] out of shm without any visible reason

2020-03-02 Thread Juha Heinanen
Here is some more details about the shm usage.  Usage was steady at
about 10 MB until time 17:05.  Then it usage started to steadily grow
during 15 min period and 17:21 hit 80 MB at which point tm.clean was
executed.  After that usage dropped straight back to 10 MB level.

How is that possible, i.e,, why the expired transactions were not
automatically cleared?

According to tm README:

   An INVITE transaction will be kept in memory for maximum:
   max_inv_lifetime+fr_timer(from the ACK to the final reply
   wait)+wt_timer.

In this case the max memory time was 180 + 5 + 5 = 190 sec, which is
much less than 16 minutes.

-- Juha

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


Re: [SR-Users] out of shm without any visible reason

2020-03-02 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> The $stat(name) can be used for any internal statistic. I think it takes
> only the name of statistic, not the group, so something like
> $stat(free_size).

Thanks, free_size and the others in

core.shmmem
{
total: 67108864
free: 58274976
used: 7403616
real_used: 8833888
max_used: 8851696
fragments: 10
}

were found.  For some reason, "_size" suffix needs to be appended to the
attribute names.

-- Juha

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


Re: [SR-Users] out of shm without any visible reason

2020-03-02 Thread Juha Heinanen
What kind of delay there is on cleaning of an expired transaction?  I'm
asking, since tm.clean released lots of shm.

-- Juha

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


Re: [SR-Users] out of shm without any visible reason

2020-03-01 Thread Juha Heinanen
John Petrini writes:

> The times we've seen this is when transactions are waiting on something so
> they pile up consuming shared memory. Do you have any database lookups or
> calls out to external services or scripts?

John,

Thanks for your reply.  Yes, there are MySQL operations both during
request/reply processing and also accounting to db.  I would assume that
any problems with those should show up in /var/log/mysql/error.log.

> Long timeouts can also contribute if something stops responding because
> transactions are waiting for a long timeout to expire.

There is quite long "fr_inv_timer" value, that could cause problems is
lots of INVITEs are ringing at the same time.

> It's typically a balance between setting reasonable timeouts and allocating
> enough shm. In addition we implemented some watcher scripts that monitor
> shm and will set gflags to disable non-critical external calls beyond a
> certain threshold as well as send us an alert.

I also created an external script to watch shm memory usage.  I would
have liked K to watch itself, but could not find pseudo variables
corresponding to core.shmmem entries.  Do they exist?

-- Juha

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


[SR-Users] out of shm without any visible reason

2020-02-28 Thread Juha Heinanen
K reported during about 90 sec period that it is out of shared memory:

Feb 28 09:47:28 rox1 /usr/bin/sip-proxy[19725]: ERROR: tm 
[t_hooks.c:136]: insert_tmcb(): out of shm. mem
Feb 28 09:47:28 rox1 /usr/bin/sip-proxy[19725]: ERROR: acc 
[acc_logic.c:394]: acc_onreq(): cannot register additional callbacks
Feb 28 09:47:28 rox1 /usr/bin/sip-proxy[19725]: ERROR:  
[core/sip_msg_clone.c:499]: sip_msg_shm_clone(): could not allocate 
shared memory from shm pool
Feb 28 09:47:28 rox1 /usr/bin/sip-proxy[19725]: ERROR: tm 
[t_lookup.c:1293]: new_t(): out of mem:
Feb 28 09:47:28 rox1 /usr/bin/sip-proxy[19725]: ERROR: tm 
[t_lookup.c:1439]: t_newtran(): new_t failed
...
Feb 28 09:47:29 rox1 /usr/bin/sip-proxy[19725]: ERROR:  
[core/mem/q_malloc.c:297]: qm_find_free(): qm_find_free(0x7f1f2a506000, 
1232); Free fragment not found!
Feb 28 09:47:29 rox1 /usr/bin/sip-proxy[19725]: ERROR:  
[core/mem/q_malloc.c:434]: qm_malloc(): qm_malloc(0x7f1f2a506000, 1232); 
Free fragment not found!
Feb 28 09:47:29 rox1 /usr/bin/sip-proxy[19725]: ERROR: tm 
[t_reply.c:1957]: relay_reply(): cannot alloc reply shmem
Feb 28 09:47:29 rox1 /usr/bin/sip-proxy[19725]: ERROR:  
[core/sip_msg_clone.c:499]: sip_msg_shm_clone(): could not allocate 
shared memory from shm pool
Feb 28 09:47:29 rox1 /usr/bin/sip-proxy[19725]: ERROR: acc 
[acc_logic.c:562]: acc_onreply(): failed to clone the request - acc aborted
...
Feb 28 09:48:51 rox1 /usr/bin/sip-proxy[19724]: ERROR:  
[core/mem/q_malloc.c:297]: qm_find_free(): qm_find_free(0x7f1f2a506000, 
5728); Free fragment not found!
Feb 28 09:48:51 rox1 /usr/bin/sip-proxy[19724]: ERROR:  
[core/mem/q_malloc.c:434]: qm_malloc(): qm_malloc(0x7f1f2a506000, 5728); 
Free fragment not found!
Feb 28 09:48:51 rox1 /usr/bin/sip-proxy[19724]: ERROR: tm 
[t_lookup.c:1293]: new_t(): out of mem:
Feb 28 09:48:51 rox1 /usr/bin/sip-proxy[19724]: ERROR: tm 
[t_lookup.c:1439]: t_newtran(): new_t failed

And after that period it started working normally again and 
core.shmmem showed:

{
     total: 134217728
     free: 124173808
     used: 9530960
     real_used: 10043920
     max_used: 134217728
     fragments: 349
}

As can be seen, shm had been full, but normally only about 10% of it
is in use.

Syslog does not show any traffic spikes or other unusual activity before
the memory got full.

Any ideas what could cause such a high memory usage or could there be
a bug in shm management?

-- Juha

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


Re: [SR-Users] Understanding set_rtp_engine with two sets

2020-02-25 Thread Juha Heinanen
Daniel-Constantin Mierla writes:
> Hello,
> 
> I didn't know about limitation, so far I needed only set_rtpengine_set()
> with one parameter. Now I am wondering why won't work for
> rtpengine_manage() because internally it calls the
> rtpengine_offer()/_answer().

I have never used rtpengine_manage, but regarding two sets, in request
route before rtpengine_offer I do:

set_rtpengine_set("$avp(mediaproxy_caller_setid)",
"$avp(mediaproxy_callee_setid)");

and in reply route before rtpengine_answer I do the same, i.e., the sets
are in the same order.

Of course the script also needs to take care of the situation when
request has no sdp and in-dialog requests.

-- Juha

___
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 detect "failure to add branches"?

2019-12-19 Thread Juha Heinanen
So, what is the conclusion on this?  It is not good if information about
failed branch route gets lost.  Would it be possible to return some
internal error reply and make t_relay() always succeed?

-- Juha

___
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 detect "failure to add branches"?

2019-12-16 Thread Juha Heinanen
Alex, check my message below.  If t_relay fails in request route, there must be 
a means to find out in request route , what happened in the failed branch route.

-- Juha

On December 16, 2019 5:18:06 PM GMT+09:00, Alex Balashov 
 wrote:
>But is there ever a situation where t_relay() immediately fails out of
>hand yet TM state hooks like failure_route are invoked?
>
>I think the idea is to deal with the problem right then in the original
>request route — having full access to variables and other initially
>available state — and re-initiate t_relay(). Right?
>
>—
>Sent from mobile, with due apologies for brevity and errors.
>
>> On Dec 16, 2019, at 3:00 AM, Juha Heinanen  wrote:
>> 
>> Daniel-Constantin Mierla writes:
>> 
>>> t_relay() should return negative (false) in such case, but I am not
>sure
>>> it returns a specific value for it -- this can be a variant to add
>if
>>> needed.
>> 
>> Yes, t_relay() returns false, but the branch flags I set in the
>branch
>> route are lost and I don't know what happened there so that I could
>> undo things.  For example, if branch route called rtpengine_offer, I
>> would need to know that.
>> 
>> -- Juha
>> 
>> ___
>> Kamailio (SER) - Users Mailing List
>> sr-users@lists.kamailio.org
>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
>___
>Kamailio (SER) - Users Mailing List
>sr-users@lists.kamailio.org
>https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

___
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 detect "failure to add branches"?

2019-12-16 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

> t_relay() should return negative (false) in such case, but I am not sure
> it returns a specific value for it -- this can be a variant to add if
> needed.

Yes, t_relay() returns false, but the branch flags I set in the branch
route are lost and I don't know what happened there so that I could
undo things.  For example, if branch route called rtpengine_offer, I
would need to know that.

-- Juha

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


<    1   2   3   4   >