[SR-Users] msilo on proxy in front of registrar

2018-03-15 Thread Stefan Sayer
Hello,

I have a bit of a strange situation where I want to add SIP MESSAGE
reliability (store and forward) for a proxy that is in front of the
(message-wise unreliable) registrar/message originator. So I m_store
MESSAGEs in the failure_route of MESSAGE requests.

By default, msilo's m_dump works only for REQUEST_ROUTE, thus I can't
use that in the 200 to REGISTER. But when I add a function to msilo
for ONREPLY_ROUTE (without the check for MESSAGE support) it works.

So, is there a reason that there's m_dump only for REQUEST_ROUTE? And,
is this:
  if ((msg->first_line).type == SIP_REQUEST)
the correct way to check whether we're handling a request or reply?

Also, is there a way to check the expires of contacts in the 200 to
REGISTER from the script, so I don't try to m_dump on de-REGISTER? Or
does this have to go into the m_dump function for the ONREPLY_ROUTE case?

Many thanks for hints!
Stefan

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


Re: [SR-Users] Need useful graphics ideas

2018-03-15 Thread Joel Serrano
Hi Karsten,

In my specific case, I had a requirement that it had to be compatible with
the telegraf httpjson input plugin.

Kamailio by default returns all the metrics in an array, and has a ':' in
the metric name.

Example:

{
  "jsonrpc":  "2.0",
  "result": [
"core:bad_URIs_rcvd = 26",
"core:bad_msg_hdr = 354",
"core:drop_replies = 0",
"core:drop_requests = 1634",
"core:err_replies = 0",
"core:err_requests = 0",
"core:fwd_replies = 222",
"core:fwd_requests = 140221",
"core:rcv_replies = 3633129",
"core:rcv_replies_18x = 153980",
"core:rcv_replies_1xx = 388669",
"core:rcv_replies_2xx = 2844680",
"core:rcv_replies_3xx = 0",
"core:rcv_replies_401 = 335571",
"core:rcv_replies_404 = 1882",
"core:rcv_replies_407 = 3960",
"core:rcv_replies_480 = 4818",
"core:rcv_replies_486 = 6734",
"core:rcv_replies_4xx = 388874",
"core:rcv_replies_5xx = 10410",
"core:rcv_replies_6xx = 496",
"core:rcv_requests = 1406155",
"core:rcv_requests_ack = 200019",
"core:rcv_requests_bye = 141683",
"core:rcv_requests_cancel = 32887",
"core:rcv_requests_info = 332",
"core:rcv_requests_invite = 200125",
"core:rcv_requests_message = 0",
"core:rcv_requests_notify = 0",
"core:rcv_requests_options = 500785",
"core:rcv_requests_prack = 0",
"core:rcv_requests_publish = 0",
"core:rcv_requests_refer = 0",
"core:rcv_requests_register = 42",
"core:rcv_requests_subscribe = 0",
"core:rcv_requests_update = 0",
"core:unsupported_methods = 19",
"dialog:active_dialogs = 27",
"dialog:early_dialogs = 2",
"dialog:expired_dialogs = 14",
"dialog:failed_dialogs = 59781",
"dialog:processed_dialogs = 197375",
"dns:failed_dns_request = 5762",
"httpclient:connections = 0",
"httpclient:connfail = 55",
"httpclient:connok = 101123",
"pike:blocked_ips = 0",
"shmem:fragments = 61",
"shmem:free_size = 532084488",
"shmem:max_used_size = 5328880",
"shmem:real_used_size = 4786424",
"shmem:total_size = 536870912",
"shmem:used_size = 4454760",
"siptrace:traced_replies = 0",
"siptrace:traced_requests = 0",
"sl:1xx_replies = 0",
"sl:200_replies = 827319",
"sl:202_replies = 0",
"sl:2xx_replies = 0",
"sl:300_replies = 0",
"sl:301_replies = 0",
"sl:302_replies = 0",
"sl:3xx_replies = 0",
"sl:400_replies = 83",
"sl:401_replies = 0",
"sl:403_replies = 1847",
"sl:404_replies = 4",
"sl:407_replies = 0",
"sl:408_replies = 0",
"sl:483_replies = 0",
"sl:4xx_replies = 883",
"sl:500_replies = 4",
"sl:5xx_replies = 976",
"sl:6xx_replies = 0",
"sl:failures = 0",
"sl:received_ACKs = 1634",
"sl:sent_err_replies = 0",
"sl:sent_replies = 831116",
"sl:xxx_replies = 0",
"tcp:con_reset = 0",
"tcp:con_timeout = 0",
"tcp:connect_failed = 0",
"tcp:connect_success = 0",
"tcp:current_opened_connections = 1",
"tcp:current_write_queue_size = 0",
"tcp:established = 2",
"tcp:local_reject = 0",
"tcp:passive_open = 2",
"tcp:send_timeout = 0",
"tcp:sendq_full = 0",
"tmx:2xx_transactions = 2844324",
"tmx:3xx_transactions = 0",
"tmx:4xx_transactions = 709680",
"tmx:5xx_transactions = 10733",
"tmx:6xx_transactions = 495",
"tmx:UAC_transactions = 3196487",
"tmx:UAS_transactions = 3561209",
"tmx:active_transactions = 6",
"tmx:inuse_transactions = 7",
"tmx:rpl_absorbed = 287838",
"tmx:rpl_generated = 571117",
"tmx:rpl_received = 3632903",
"tmx:rpl_relayed = 3345065",
"tmx:rpl_sent = 3916182",
"usrloc:registered_users = 0"
  ],
  "id": 8362
}


That format (although correct) isn't compatible with what the httpjson
telegraf plugin expects:
https://github.com/influxdata/telegraf/tree/master/plugins/inputs/httpjson

I had to build my own JSON in a way that telegraf liked it:


jsonrpc_exec('{"jsonrpc": "2.0","method":
"stats.get_statistics","params": ["all"],"id": 1}');
$var(metrics_count) = 0;
jansson_array_size("result", $jsonrpl(body), "$var(total_metrics)");
while($var(metrics_count) < $var(total_metrics)) {
jansson_get("result[$var(metrics_count)]", $jsonrpl(body),
"$var(v)");
$var(metric_key) =
$(var(v){s.select,0,=}{s.trim}{s.replace,:,-});
$var(metric_value) = $(var(v){s.select,1,=}{s.trim});
jansson_set("integer", "$var(metric_key)",
"$var(metric_value)", "$var(metrics_json)");
$var(metrics_count) = $var(metrics_count) + 1;
}


And this is an example if the resulting JSON:

{
   "core-bad_URIs_rcvd":26,
   "core-bad_msg_hdr":354,
   "core-drop_replies":0,
   "core-drop_requests":1634,
   "core-err_replies":0,
   "core-err_requests":0,
   "core-fwd_replies":222,
   "core-fwd_requests":140287,
   "core-rcv_replies":3633735,
   "core-rcv_replies_18x":154043,
   "core-rcv_replies_1xx":388838,
   

Re: [SR-Users] logging sip messages

2018-03-15 Thread Karthik Srinivasan
Thank you;  I will take a look.

Karthik

On Tue, Mar 6, 2018 at 8:16 AM, Daniel-Constantin Mierla 
wrote:

> Hello,
>
> look at sipdump module, it is a simple solution for getting the traffic
> stored in a file (with rotation):
>
>   - https://www.kamailio.org/docs/modules/stable/modules/sipdump.html
> The look also at siptrace, it can do it to datebase, or, as suggested in
> another reply, homer sipcapture project.
>
> Cheers,
> Daniel
>
> On 02.03.18 21:12, Karthik Srinivasan wrote:
>
> Hello:
>
> I am trying to find a simple way to log each and every SIP message that
> Kamailio receives or Kamailio sends. In a nutshell, here is what i'm trying
> to accomplish:
>
> - log sip message received;  log ip address and port of where message was
> received from
> - log sip message to be sent or sent;  log ip address and port of
> destination.
>
> I am trying to achieve this in the context of my general log file that
> contains routing/event logic from the kamailio.cfg file.  By this i mean i
> don't want to have to run an external program like tcpdump to capture the
> packets and log them.
>
> I have tried a few thing but haven't been able to capture all conditions.
>
> examples:
>
> i have included things like  event_routes for [tm:local-response];
> [sl:local-response]; [sl:filtered-ack], onreply_route...   I can capture
> most replies and responses via those but am not able to capture a 200ok
> relayed response from Kamailio back to the originating UA for example.
>
> I can log incoming messages without problem.
>
> I have also tried to activate IO interrupt to route to
> event_route[NETWORK:MSG] but unfortunately i can't access the source/dest
> ip address/port info or other pseudo variables.
>
> So back to the original question:  How does one log every SIP message that
> Kamailio gets?  How does one log every SIP message that Kamailio sends?
> via the context of the routing/replies/event routes in kamailio.cfg.
>
> Thanks,
>
> Karthik
>
>
>
> ___
> Kamailio (SER) - Users Mailing 
> Listsr-users@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
>
> --
> Daniel-Constantin Mierlawww.twitter.com/miconda -- www.linkedin.com/in/miconda
> Kamailio Advanced Training - March 5-7, 2018, Berlin - www.asipto.com
> Kamailio World Conference - May 14-16, 2018 - 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] Need useful graphics ideas

2018-03-15 Thread Karsten Horsmann
Hello List,
Hello Joel,


i have now the time to implement this idea.

How you got  $var(metrics_json)  filed with the kamailio stats / whatever
internal informations?

btw i use kamailio 5.0.6 at this moment.

Thanks!



2017-12-06 18:11 GMT+01:00 Joel Serrano :

> I use a mix of the above...
>
> With kamailio I export that stats I want via http:
>
>
> event_route[xhttp:request] {
> # Verify request come from localhost
> if(src_ip!=127.0.0.1) {
> xhttp_reply("403", "Forbidden", "text/html",
> "Forbidden");
> xlog("L_WARN", "[HTTP] Unauthorized access from: $si\n");
> exit;
> }
>
> # Metrics endpoint
> if ($hu =~ "^/statistics") {
>
> ... build a $var(metrics_json) with the metrics you want, must be
> JSON format ...
>
> }
> xhttp_reply("200", "OK", "application/json", "$var(metrics_json)");
> }
> return;
> }
>
>
> Then in telegraf I use the httpjson module to gather the metrics:
>
> ...
> [[inputs.httpjson]]
>   name_override = "kamailio"
>   servers = [ "http://127.0.0.1/statistics; ]
>   method = "GET"
> ...
>
>
>
> This is an example:
>
> joel@sbc-dev:~$ curl -q http://127.0.0.1/statistics 2> /dev/null | python
> -m json.tool
> {
> "core-bad_URIs_rcvd": 0,
> [cut some output
> "tmx-rpl_received": 436444,
> "tmx-rpl_relayed": 379358,
> "tmx-rpl_sent": 489589,
> "usrloc-registered_users": 0
> }
> joel@sbc-dev:~$
>
>
> We have all those metrics available now in influxdb, then, as others have
> stated, Grafana is your best friend to make those metrics look nice.
>
>
> Hope these little snippets help you and anyone else getting started with
> Kamailio metrics.
>
>
> Cheers,
> Joel.
>
> On Wed, Dec 6, 2017 at 1:20 AM, Daniel-Constantin Mierla <
> mico...@gmail.com> wrote:
>
>> Hello,
>>
>> have you seen the article posted at:
>>
>>   - https://www.kamailio.org/w/2015/03/kamailio-statsd-best-practices/
>>
>> Eloy had a blog about it linked from above page.
>>
>> Cheers,
>> Daniel
>>
>> On 06.12.17 08:54, Karsten Horsmann wrote:
>>
>> Hello List,
>>
>> I thought about some kind of Kamailio stats source (like registered
>> users, calls active and some other things) to collect them into influx dB
>> and draw them with grafana.
>>
>> How do you solved that?
>>
>> Timer based routes or statsd or whatever?
>>
>> Kind regards
>> Karsten Horsmann
>>
>>
>> ___
>> Kamailio (SER) - Users Mailing 
>> Listsr-users@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>
>>
>> --
>> Daniel-Constantin Mierlawww.twitter.com/miconda -- 
>> www.linkedin.com/in/miconda
>> Kamailio Advanced Training - www.asipto.com
>> Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com
>>
>>
>> ___
>> Kamailio (SER) - Users Mailing List
>> sr-users@lists.kamailio.org
>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>
>>
>


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


Re: [SR-Users] Lua script reload

2018-03-15 Thread Igor Olhovskiy
Hi!

Checked with 5.1.4 about ds_is_from_list

exporting KSR.dispatcher.ds_select(...)
exporting KSR.dispatcher.ds_select_limit(...)
exporting KSR.dispatcher.ds_select_domain(...)
exporting KSR.dispatcher.ds_select_domain_limit(...)
exporting KSR.dispatcher.ds_next_domain(...)
exporting KSR.dispatcher.ds_select_dst(...)
exporting KSR.dispatcher.ds_select_dst_limit(...)
exporting KSR.dispatcher.ds_next_dst(...)
initializing kemi sub-module: KSR.dispatcher (dispatcher) (8/24/261)

Seems no function for check if source in dispatcher table….

Also not mentioned here

https://www.kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/modules/#dispatcher

Regards, Igor

On Mar 14, 2018, 5:58 PM +0200, Daniel-Constantin Mierla , 
wrote:
>
>
> On 14.03.18 16:53, Igor Olhovskiy wrote:
> > It was has_body(), not has_totag()
> Ohh, I misread...
> >
> > Thanks for tip, will try to upgrade. This version was from debian repo.
> Probably from debian repo for master branch, which meanwhile has kamailio 
> 5.2.0-dev there.
>
> >
> > Also missing quite needed function like ds_is_from_list
>
> Stable branch releases 5.1.x should have it.
>
> Cheers,
> Daniel
>
> >
> > Regards, Igor
> >
> > On Mar 14, 2018, 11:13 AM +0200, Daniel-Constantin Mierla 
> > , wrote:
> > > Again, wrote in previous response, if you are looking for has_totag(), 
> > > you look at the wrong module.
> > > However, regarding the exports, you are using a version during devel 
> > > phase, upgrade to latest stable 5.1.x and you will get more exported 
> > > functions.
> > > On the other hand, for some of the functions related to string 
> > > search/comparison, I put lower priority, because they can be done in the 
> > > scripting language itself - Lua has more operations and functions for 
> > > string handling that we have in our modules. I do not recall by heart 
> > > right now if I exported all of them at the end, but there are more than 
> > > you listed here in 5.1.2.
> > > Cheers,
> > > Daniel
> > >
> > > On 13.03.18 15:57, Igor Olhovskiy wrote:
> > > > For textops.
> > > >
> > > > Seems textops module not exporting everything to Lua
> > > >
> > > > app_lua [app_lua_sr.c:1961]: lua_sr_kemi_register_libs(): exporting 
> > > > KSR.textops.search(...)
> > > > app_lua [app_lua_sr.c:1961]: lua_sr_kemi_register_libs(): exporting 
> > > > KSR.textops.search_body(...)
> > > > app_lua [app_lua_sr.c:1961]: lua_sr_kemi_register_libs(): exporting 
> > > > KSR.textops.search_hf(...)
> > > > app_lua [app_lua_sr.c:1961]: lua_sr_kemi_register_libs(): exporting 
> > > > KSR.textops.is_present_hf(...)
> > > > app_lua [app_lua_sr.c:1961]: lua_sr_kemi_register_libs(): exporting 
> > > > KSR.textops.subst(...)
> > > > app_lua [app_lua_sr.c:1961]: lua_sr_kemi_register_libs(): exporting 
> > > > KSR.textops.subst_uri(...)
> > > > app_lua [app_lua_sr.c:1961]: lua_sr_kemi_register_libs(): exporting 
> > > > KSR.textops.subst_user(...)
> > > > app_lua [app_lua_sr.c:1961]: lua_sr_kemi_register_libs(): exporting 
> > > > KSR.textops.subst_body(...)
> > > > app_lua [app_lua_sr.c:1961]: lua_sr_kemi_register_libs(): exporting 
> > > > KSR.textops.subst_hf(...)
> > > > app_lua [app_lua_sr.c:1961]: lua_sr_kemi_register_libs(): exporting 
> > > > KSR.textops.remove_hf_re(...)
> > > > app_lua [app_lua_sr.c:1961]: lua_sr_kemi_register_libs(): exporting 
> > > > KSR.textops.remove_hf_exp(...)
> > > > app_lua [app_lua_sr.c:1975]: lua_sr_kemi_register_libs(): initializing 
> > > > kemi sub-module: KSR.textops (textops)
> > > >
> > > >
> > > > Regards, Igor
> > > >
> > > > On Mar 13, 2018, 4:03 PM +0200, Igor Olhovskiy 
> > > > , wrote:
> > > > > Hi!
> > > > >
> > > > > I’m playing with new KEMI framework and trying to reload script 
> > > > > without reloading Kamailio.
> > > > >
> > > > > Lua code is mostly one from example.
> > > > >
> > > > > ...
> > > > > modparam("app_lua", "load", "/etc/kamailio/lua/kamailio.lua")
> > > > > cfgengine "lua"
> > > > > ...
> > > > >
> > > > > So, I’m changing lua code and giving command
> > > > >
> > > > > kamctl rpc app_lua.reload
> > > > >
> > > > > But in the answer
> > > > >
> > > > > {
> > > > >   "jsonrpc":  "2.0",
> > > > >   "error":  {
> > > > >     "code": -32000,
> > > > >     "message":  "Execution Error"
> > > > >   },
> > > > >   "id": 11098
> > > > > }
> > > > >
> > > > > In syslog there is a string
> > > > >
> > > > > /usr/sbin/kamailio[10939]: ERROR: app_lua [app_lua_api.c:399]: 
> > > > > lua_sr_reload_script(): reload is not activated
> > > > >
> > > > >
> > > > > What is need to be done to activate reload?
> > > > >
> > > > >
> > > > > Regards, Igor
> > > >
> > > >
> > > > ___
> > > > 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 -- 

[SR-Users] UAC Restore Mode

2018-03-15 Thread Duarte Rocha
Greetings,

I have a question about the UAC module and its restore mode.

If i use the "auto" restore mode in the "restore_mode" parameter will the
entire info be saved in the From Tag for restore?

I'm asking because i will implement High Avaliability and need to know if
in event of a failure and i switch to a kamailio in a different machine i
will be able to do the To\From restore.

Thanks in advance,

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


[SR-Users] kamailio implamentation

2018-03-15 Thread kossivi HOLONOU
Hello,
I am developing a project on MSRP Kamailio with webRTC client for my end of 
training project, can you help me with documentation or configuration side 
kamailio and webRTC client to implement to get there? Thank you for your support

BesT Regards,Kossivi HolonouBO VAS EngineerDakar-Sénégal___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users