Re: [OpenSIPS-Users] db_extra_bye - after BYE values in CDR in 2.4

2018-06-06 Thread Pat Burke

Răzvan,







Thanks for the reply.  I finally got a chance to try the fix.  




That fixed the issue.







Also, thank Liviu for the MATHOPS module.  




Between the two of these, we are able to fully rate the calls in opensips.



Thanks again,
Pat Burke



__
Direct: (402) 403-5121   |   Cell: (402) 443-8929  |   Email: 
p...@voxtelesys.com
1801 23rd Avenue North   |  Suite 217    |  Fargo, North Dakota 58102
 
-Original Message- 
> From: "Răzvan Crainea"  
> To: users@lists.opensips.org 
> Date: 05/18/18 02:13 
> Subject: Re: [OpenSIPS-Users] db_extra_bye - after BYE values in CDR in 2.4 
> 
> Hi, Pat!
> 
> Are you using event-based acc, or you are doing CDRs? I am asking 
> because I don't see anywhere in your script where you are trying to 
> match the BYE against a dialog, therefore a CDR cannot be properly 
> generated. Or perhaps you are doing the loose_route(), after setting the 
> variables. If that's the case, can you try setting them *after* 
> loose_route() or match_dialog()?
> 
> Best regards,
> Răzvan
> 
> On 05/17/2018 09:47 PM, Pat Burke wrote:
> > 
> > Răzvan,
> > 
> > 
> > 
> > 
> > That is what I assumed when I updated the code, but I am not getting the 
> > values from after the BYE inserted.  What am I doing wrong?  Thanks for 
> > your help.
> > 
> > 
> > 
> > 
> > *
> > 
> > Here are the acc configuration values
> > 
> > 
> > 
> > 
> >  Accounting module
> > 
> > loadmodule "acc.so"
> > 
> > modparam("acc","db_url","virtual://set1")
> > 
> > modparam("acc", "extra_fields", "db: 
> > setuptime_msec;end_setup_time;host_name;server_id;server_type;formatted_caller_number;formatted_callee_number;trunk_group;tech_prefix;dial_number;accountcode;prefered_codecs;callee_iso3;callee_iso2;callee_nanp;callee_dialcode;callee_routecode;caller_iso3;caller_iso2;caller_nanp;caller_dialcode;route_profile;caller_state;callee_state;callee_number_type;lrn;routeto_number;customer_rate;customer_rate_type;inter_intra;allowed_iso3s;max_carrier_rate;routing_history;current_carrier;current_carrier_price;current_carrier_idx;out_carrier;out_carrier_price;error_reason;host_ip;inbound_ip;outbound_ip;max_routes;vts_setup_ms;to180_msec;call_routed;carrier_choice;configuration_details;general_details;call_details;optional_details;additional_details;inbound_details;call_start_seconds;call_start_useconds;call_end_seconds;call_end_useconds;bye_src_ip;bye_time")
> > 
> > modparam("acc", "detect_direction", 1)
> > 
> > modparam("acc", "report_cancels", 1)
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > *
> > 
> > Here is the start of the script where the BYE is captured, you can see I am 
> > logging the acc_extra values just to make certain they are set.
> > 
> > 
> > 
> > 
> > route {
> > 
> >      if (!mf_process_maxfwd_header("10")) {
> > 
> >          sl_send_reply("483","Too Many Hops");
> > 
> >          exit;
> > 
> >      }
> > 
> > 
> > 
> > 
> > #xlog("L_INFO", "$ru - $rm\n");
> > 
> >      if (has_totag()) {
> > 
> >          if (is_method("BYE")) {
> > 
> >              if ($avp(call_end_seconds) == NULL) {
> > 
> > xlog("L_WARN", "phb 1\n");
> > 
> >                  $acc_extra(bye_src_ip) = $si;
> > 
> >                  $acc_extra(bye_time) = $Ts;
> > 
> >                  
> > get_timestamp($avp(call_end_seconds),$avp(call_end_useconds));
> > 
> > 
> > 
> > 
> >                  $acc_extra(call_end_seconds) = $avp(call_end_seconds);
> > 
> >                  $acc_extra(call_end_useconds) = $avp(call_end_useconds);
> > 
> > xlog("L_WARN", "phb 2 $acc_extra(bye_src_ip) = $si; $acc_extra(bye_time) = 
> > $Ts; $acc_extra(call_end_seconds) = $avp(call_end_seconds); 
> > $acc_extra(call_end_useconds) = $avp(call_end_useconds);\n");
> > 
> >              } else {
> > 
> >                  xlog("L_INFO", "$rU SCRIPT:BILLING:DEBUG: Extra BYE 
> > received.\n");
> > 
> >              }
> > 
> >          }
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > *
> > 
> > Here is the output from the phone call.  The values are set.
> > 
> > 
> > 
> > 
> > [2921]: phb 1
> > 
> > [2921]: phb 2 192.168.20.250 = 192.168.20.250; 1526580586 = 1526580586; 
> > 1526580586 = 1526580586; 232433 = 232433;
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > *
> > 
> > Here is the db insert that was actually sent to the database.  The values 
> > that I set are ''.
> > 
> > 
> > 
> > 
> > insert into acc 
> > (method,from_tag,to_tag,callid,sip_code,sip_reason,time,setuptime_msec,end_setup_time,host_name,server_id,server_type,
> > 
> > 
> > formatted_caller_number,formatted_callee_number,trunk_group,tech_prefix,dial_number,accountcode,prefered_codecs,
> > 
> > 
> > 

Re: [OpenSIPS-Users] Opensips 2.4 AAA_radius

2018-06-06 Thread Vishal Pai
Hi Bogdan

It worked.

Thanks

On Tue, Jun 5, 2018 at 2:16 PM, Bogdan-Andrei Iancu 
wrote:

> Hi Vishal,
>
> If you do not need the radius async support, just install the radiusclient
> lib + dev packages on your system. To compile the module with RADIUSCLIENT
> support do:
>
> > RADIUSCLIENT=RADIUSCLIENT make modules modules=moudles/aaa_radius
>
> Regards,
>
> Bogdan-Andrei Iancu
>
> OpenSIPS Founder and Developer
>   http://www.opensips-solutions.com
> OpenSIPS Summit 2018
>   http://www.opensips.org/events/Summit-2018Amsterdam
>
> On 06/03/2018 06:00 PM, Vishal Pai wrote:
>
> Hi All
>
> I want to compile aaa_radius on opensips 2.4. I am using External
> Libraries RADIUSCLIENT. My question is how i can compile the opensips 2.4
> source.
>
> As i read the document
>
> http://www.opensips.org/html/docs/modules/2.4.x/aaa_radius.html#idp4684960
>
> There are 3 options RADCLI, FREERADIUS, RADIUSCLIENT. need to compile only
> RADIUSCLIENT .
>
>
> Thanks
> Vishal Pai
>
>
> ___
> Users mailing 
> listUsers@lists.opensips.orghttp://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] user location cluster

2018-06-06 Thread Liviu Chircu

Hi Volga,

The comma-separated hosts are correctly parsed by OpenSIPS and fed to 
the libmongoc driver, which should be able to use them, as per [1].


So, in theory, this should work! In practice: nobody has yet lived to 
tell the story using the latest libmongoc. Please let me know if you run 
into any issues, and I'll happily help sort them out.


Best regards,

[1]: https://docs.mongodb.com/manual/reference/connection-string/

Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com

On 06.06.2018 17:30, volga...@networklab.ca wrote:

Hello Everyone,
We have the following config

 USeR LOCation module
loadmodule "usrloc.so"
modparam("usrloc", "db_url", "postgres://uri/db")
modparam("usrloc", "use_domain", 1)
modparam("usrloc", "working_mode_preset", "federation-cachedb-cluster")
modparam("usrloc", "location_cluster", 1)
modparam("usrloc", "cachedb_url", 
"mongodb://10.100.101.9:27017/opensips_prod01.userlocation")

modparam("usrloc","nat_bflag","NATED_CALLEE")


In our setup we have mongodb cluster with 2 mongos  to serve 
application. Is possible in modparam("usrloc", "cachedb_url" "uri")
specify URI in format like mongodb module where you specify 
mongodb:replica://primary mongos:port,backup mongos:port ?



volga629




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



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


[OpenSIPS-Users] user location cluster

2018-06-06 Thread volga629

Hello Everyone,
We have the following config

 USeR LOCation module
loadmodule "usrloc.so"
modparam("usrloc", "db_url", "postgres://uri/db")
modparam("usrloc", "use_domain", 1)
modparam("usrloc", "working_mode_preset", "federation-cachedb-cluster")
modparam("usrloc", "location_cluster", 1)
modparam("usrloc", "cachedb_url", 
"mongodb://10.100.101.9:27017/opensips_prod01.userlocation")

modparam("usrloc","nat_bflag","NATED_CALLEE")


In our setup we have mongodb cluster with 2 mongos  to serve 
application. Is possible in modparam("usrloc", "cachedb_url" "uri")
specify URI in format like mongodb module where you specify 
mongodb:replica://primary mongos:port,backup mongos:port ?



volga629




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


[OpenSIPS-Users] cluster presence

2018-06-06 Thread volga629

Hello Everyone,
I am trying put togher 3 nodes ( 2 active 1 backup) presence cluster 
and log filled with messages regard cleanup timer.

Any help thank you.

opensips-2.4.1.b044f11ee-16.fc27.x86_64


Jun  6 09:15:12 sbc01 /usr/sbin/opensips[4584]: 
WARNING:core:timer_ticker: timer task  already 
scheduled for 5201330 ms (now 5653910 ms), it may overlap..
Jun  6 09:15:13 sbc01 /usr/sbin/opensips[4584]: 
WARNING:core:timer_ticker: timer task  already 
scheduled for 5201330 ms (now 5654900 ms), it may overlap..



Slava.


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


Re: [OpenSIPS-Users] Using Sipp stress tool with Opensips

2018-06-06 Thread Daniel Zanutti
I think the problem is related to configuring SIPP properly.

If I'm not wrong, SIPP standard scenario for UAC/UAS is configured to work
with a gateway (B2B), but Opensips is a proxy. You have to use Routes to
properly handle the incoming call and respond it.

Take a lookt at "rrs" param of recv command.

This is the code I use on UAC.xml, after receiving 200 OK from initial
invite:


  

  
  

  

  

  

  
  
  

  
  

  

  




On Wed, Jun 6, 2018 at 7:32 AM, David Villasmil <
david.villasmil.w...@gmail.com> wrote:

> Are the 2 sipp instances behind nat? If so, you need to set the appropiate
> switch on sipp, i believe it is
> -bind_local the actual local ip
> -i the public ip
>
> Take a look at sipp's documentation
>
> Hope it helps
>
> David
>
> On Wed, Jun 6, 2018, 10:33 Jan Skórczyński 
> wrote:
>
>> Hello,
>>
>> I'm a beginner in VOIP world so maybe this question have obvious
>> answer...
>> I would like to perform series of stress tests of my Opensips server.
>>
>> Opensips instance is located on VPS at adres XXX.XXX.XXX.XXX (public IP)
>> and it is listening on 5060 port. I'm using custom client apps, everything
>> works fine, however I have some issue when I try to test with Sipp.
>>
>> I'm setting UAS on my VPS, with the following command:
>>
>> sipp -sn uas -rsa XXX.XXX.XXX.XXX:5060 -i XXX.XXX.XXX.XXX
>>
>> and UAC on my PC:
>>
>> sipp -sn uac XXX.XXX.XXX.XXX:5061  -i 192.168.0.103
>>
>> I can see on UAS that it receives messages from my UAC, but it cannot
>> reply to them.
>>
>> -- Scenario Screen  [1-9]: Change
>> Screen --
>>   Port   Total-time  Total-calls  Transport
>>   5061  19.07 s   30  UDP
>>
>>   0 new calls during 1.004 s period  1 ms scheduler resolution
>>   0 callsPeak was 6 calls, after 6 s
>>   0 Running, 31 Paused, 4 Woken up
>>   90 dead call msg (discarded)
>>   4 open sockets
>>
>>  Messages  Retrans   Timeout
>>  Unexpected-Msg
>>   --> INVITE 300 0 0
>>
>>   <-- 180300
>>   <-- 20030140
>>   --> ACK E-RTD1 0 0 0 30
>>
>>   --> BYE0 0 0 0
>>   <-- 2000 0
>>   [   4000ms] Pause  0 0
>> -- Sipp Server Mode
>> ---
>>
>>
>> Logs from UAC:
>>
>> -- Scenario Screen  [1-9]: Change
>> Screen --
>>   Call-rate(length)   Port   Total-time  Total-calls  Remote-host
>>   10.0(0 ms)/1.000s   5060  73.29 s   90
>> XXX.XXX.XXX.XXX:5061(UDP)
>>
>>   0 new calls during 1.004 s period  1 ms scheduler resolution
>>   30 calls (limit 30)Peak was 30 calls, after 3 s
>>   0 Running, 62 Paused, 24 Woken up
>>   0 dead call msg (discarded)0 out-of-call msg (discarded)
>>
>>   3 open sockets
>>
>>  Messages  Retrans   Timeout
>>  Unexpected-Msg
>>   INVITE --> 90415   60
>>  100 <-- 0 0 0 0
>>  180 <-- 0 0 0 0
>>  183 <-- 0 0 0 0
>>  200 <--  E-RTD1 0 0 0 0
>>  ACK --> 0 0
>>Pause [  0ms] 0 0
>>  BYE --> 0 0 0
>>  200 <-- 0 0 0 0
>>
>> -- [+|-|*|/]: Adjust rate  [q]: Soft exit  [p]: Pause traffic
>> -
>>
>> And here is my opensips.cfg routing script:
>>
>> route{
>> xlog("Begin route");
>> if (!mf_process_maxfwd_header("10")) {
>> xlog("Too many hops");
>> send_reply("483","Too Many Hops");
>> exit;
>> }
>>
>> if (has_totag() && ($fU!="sipp")) {
>> xlog("Has totag");
>> # handle hop-by-hop ACK (no routing required)
>> if ( is_method("ACK") && t_check_trans() ) {
>> xlog("Method: ACK && t_check_trans. Relaying...");
>> t_relay();
>> exit;
>> }
>>
>> # sequential request within a dialog should
>> # take the path determined by record-routing
>> if ( !loose_route() ) {
>> # we do record-routing for all our traffic, so we should not
>> # receive any sequential requests without Route hdr.
>> send_reply("404","Not here");
>> exit;
>> }
>>
>> if (is_method("BYE")) {
>> # do accounting even if the transaction fails
>> #do_accounting("log","failed");
>> }
>>
>> # route it out to whatever destination was set by loose_route()
>> # in $du (destination URI).
>> route(relay);
>> exit;
>> }
>>
>> # CANCEL processing
>> if (is_method("CANCEL")) {
>> if (t_check_trans())
>> t_relay();
>> exit;
>> }
>>
>> # absorb 

Re: [OpenSIPS-Users] Opensips 2.5 and fraud module

2018-06-06 Thread Denis via Users
And a final i made some tests and found that subsequent calls falls to this case"case 1:    if ($avp(3000)=="1")  xlog("L_INFO", "Route4:$rm was received (IPS=$si, IPD=$rd, CALLID=$ci, FROMTAG=$ft, TOTAG=$tt, AUTH=$au) and FRAUD: case 1");" -- С уважением, Денис.Best regards, Denis 06.06.2018, 16:12, "Денис Путято via Users" :Sorry, wrong button pushed))) Continue where,$avp(user) - caller number$rU - callee number$avp(profile) - profile id in the fraud module table in the acc table first call         101    06.06.2018 15:34:54 where, - caller number - caller nuber101 - duration of the call06.06.2018 15:34:54 - date/time of the call second call      0    06.06.2018 15:38:21the same parameters, call success, but without answer. Before the second call/usr/local/opensips2.2/sbin/opensipsctl fifo show_fraud_stats     1calls per minute:: 1total calls:: 1concurrent calls:: 0sequential calls:: 1 After the second call/usr/local/opensips2.2/sbin/opensipsctl fifo show_fraud_stats     1calls per minute:: 1total calls:: 2concurrent calls:: 0sequential calls:: 2 So, additionally, in opensips.cfg i have such logic event_route[E_FRD_CRITICAL] {fetch_event_params("param = $avp(frparam);value = $avp(frvalue);threshold = $avp(frthr);user = $avp(fruser);called_number = $avp(frcalled);rule_id = $avp(frruleid)");exec("echo -e 'Обнаружен фродовый трафик с номера $avp(fruser)\n Параметр фрода: $avp(frparam)\n Величина параметра фрода: $avp(frvalue)\n Порог параметра фрода: $avp(frthr)\n Номер вызывамого абонента: $avp(frcalled)' | mail -a 'Content-Type: text/plain; charset=UTF-8' -s 'Fraud detect!' fr...@ptl.ru fr...@ptl.ru");} Between two calls I have received email about the first call with param: call_duration So, why could i make the second call? Thank you -- С уважением, Денис.Best regards, Denis 06.06.2018, 15:51, "Denis" :Liviu, thank you very much! And, sorry, but i want to worry you more about the module. First of all, now, i am usingopensips 2.2.6 (x86_64/linux)flags: STATS: On, DISABLE_NAGLE, USE_MCAST, SHM_MMAP, PKG_MALLOC, QM_MALLOC, DBG_MALLOC, FAST_LOCK-ADAPTIVE_WAITADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.git revision: 5d229f5main.c compiled on 13:56:51 Apr 20 2018 with gcc 5.4.0 Recently i found such problem. Module detected fraud calls, dealing with call_duration (my previous question about seconds and minutes dealing with problem), but i cannot see calls drop. All in order, In opensips.cfg i have such logic:"check_fraud("$avp(user)","$rU","$avp(profile)");   switch($rc) {    case 2:    if ($avp(3000)=="1")  xlog("L_INFO", "Route4:$rm was received (IPS=$si, IPD=$rd, CALLID=$ci, FROMTAG=$ft, TOTAG=$tt, AUTH=$au) and FRAUD: case 2");    break;    case 1:    if ($avp(3000)=="1")  xlog("L_INFO", "Route4:$rm was received (IPS=$si, IPD=$rd, CALLID=$ci, FROMTAG=$ft, TOTAG=$tt, AUTH=$au) and FRAUD: case 1");    break;    case -1:    if ($avp(3000)=="1")  xlog("L_INFO", "Route4:$rm was received (IPS=$si, IPD=$rd, CALLID=$ci, FROMTAG=$ft, TOTAG=$tt, AUTH=$au) and FRAUD: case -1");    break;    case -2:    if ($avp(3000)=="1")  xlog("L_INFO", "Route4:$rm was received (IPS=$si, IPD=$rd, CALLID=$ci, FROMTAG=$ft, TOTAG=$tt, AUTH=$au) and FRAUD DETECTED");    $avp(501)=$ft+$ci;    $avp(501)=$(avp(501){s.md5});    acc_db_request("Fraud_detectead", "acc");    send_reply("403", "Forbidden");    exit;    break;    case -3:    if ($avp(3000)=="1")  xlog("L_INFO", "Route4:$rm was received (IPS=$si, IPD=$rd, CALLID=$ci, FROMTAG=$ft, TOTAG=$tt, AUTH=$au) and FRAUD failure");    $avp(501)=$ft+$ci;    $avp(501)=$(avp(501){s.md5});    acc_db_request("Fraud_detection_failure", "acc");    send_reply("403", "Forbidden");    exit;    break;  } where,  in" -- С уважением, Денис.Best regards, Denis 06.06.2018, 14:29, "Liviu Chircu" :Hi, Denis!According to the table data I wrote in the tutorial [1], it's definitely seconds. It's a pity that the docs do not reflect this as well -- I'll get them fixed!Best regards,[1]: http://www.opensips.org/Documentation/Tutorials-FraudDetection-2-1Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.comOn 06.06.2018 14:20, Denis via Users wrote:Hello, Liviu! It is me, again:))) One more, call_duration measured in seconds or in minutes? Thank you. -- С уважением, Денис.Best regards, Denis 27.04.2018, 09:25, "Denis via Users" :Hello, Liviu!OK, i understand..But, to speak the truth, it would be more reasonable to control exactly numbers, but not prefix.Because, now, "sequential calls" and "total calls", actually, perform the same control task.My experience tell me, that many fraud cases deal with calling to the same number in a some time period. Anyway, thank you!  -- С уважением, Денис.Best regards, Denis 26.04.2018, 08:22, "Liviu Chircu" 

Re: [OpenSIPS-Users] Opensips 2.5 and fraud module

2018-06-06 Thread Денис Путято via Users
Sorry, wrong button pushed))) Continue where,$avp(user) - caller number$rU - callee number$avp(profile) - profile id in the fraud module table in the acc table first call         101    06.06.2018 15:34:54 where, - caller number - caller nuber101 - duration of the call06.06.2018 15:34:54 - date/time of the call second call      0    06.06.2018 15:38:21the same parameters, call success, but without answer. Before the second call/usr/local/opensips2.2/sbin/opensipsctl fifo show_fraud_stats     1calls per minute:: 1total calls:: 1concurrent calls:: 0sequential calls:: 1 After the second call/usr/local/opensips2.2/sbin/opensipsctl fifo show_fraud_stats     1calls per minute:: 1total calls:: 2concurrent calls:: 0sequential calls:: 2 So, additionally, in opensips.cfg i have such logic event_route[E_FRD_CRITICAL] {fetch_event_params("param = $avp(frparam);value = $avp(frvalue);threshold = $avp(frthr);user = $avp(fruser);called_number = $avp(frcalled);rule_id = $avp(frruleid)");exec("echo -e 'Обнаружен фродовый трафик с номера $avp(fruser)\n Параметр фрода: $avp(frparam)\n Величина параметра фрода: $avp(frvalue)\n Порог параметра фрода: $avp(frthr)\n Номер вызывамого абонента: $avp(frcalled)' | mail -a 'Content-Type: text/plain; charset=UTF-8' -s 'Fraud detect!' fr...@ptl.ru fr...@ptl.ru");} Between two calls I have received email about the first call with param: call_duration So, why could i make the second call? Thank you -- С уважением, Денис.Best regards, Denis 06.06.2018, 15:51, "Denis" :Liviu, thank you very much! And, sorry, but i want to worry you more about the module. First of all, now, i am usingopensips 2.2.6 (x86_64/linux)flags: STATS: On, DISABLE_NAGLE, USE_MCAST, SHM_MMAP, PKG_MALLOC, QM_MALLOC, DBG_MALLOC, FAST_LOCK-ADAPTIVE_WAITADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.git revision: 5d229f5main.c compiled on 13:56:51 Apr 20 2018 with gcc 5.4.0 Recently i found such problem. Module detected fraud calls, dealing with call_duration (my previous question about seconds and minutes dealing with problem), but i cannot see calls drop. All in order, In opensips.cfg i have such logic:"check_fraud("$avp(user)","$rU","$avp(profile)");   switch($rc) {    case 2:    if ($avp(3000)=="1")  xlog("L_INFO", "Route4:$rm was received (IPS=$si, IPD=$rd, CALLID=$ci, FROMTAG=$ft, TOTAG=$tt, AUTH=$au) and FRAUD: case 2");    break;    case 1:    if ($avp(3000)=="1")  xlog("L_INFO", "Route4:$rm was received (IPS=$si, IPD=$rd, CALLID=$ci, FROMTAG=$ft, TOTAG=$tt, AUTH=$au) and FRAUD: case 1");    break;    case -1:    if ($avp(3000)=="1")  xlog("L_INFO", "Route4:$rm was received (IPS=$si, IPD=$rd, CALLID=$ci, FROMTAG=$ft, TOTAG=$tt, AUTH=$au) and FRAUD: case -1");    break;    case -2:    if ($avp(3000)=="1")  xlog("L_INFO", "Route4:$rm was received (IPS=$si, IPD=$rd, CALLID=$ci, FROMTAG=$ft, TOTAG=$tt, AUTH=$au) and FRAUD DETECTED");    $avp(501)=$ft+$ci;    $avp(501)=$(avp(501){s.md5});    acc_db_request("Fraud_detectead", "acc");    send_reply("403", "Forbidden");    exit;    break;    case -3:    if ($avp(3000)=="1")  xlog("L_INFO", "Route4:$rm was received (IPS=$si, IPD=$rd, CALLID=$ci, FROMTAG=$ft, TOTAG=$tt, AUTH=$au) and FRAUD failure");    $avp(501)=$ft+$ci;    $avp(501)=$(avp(501){s.md5});    acc_db_request("Fraud_detection_failure", "acc");    send_reply("403", "Forbidden");    exit;    break;  } where,  in" -- С уважением, Денис.Best regards, Denis 06.06.2018, 14:29, "Liviu Chircu" :Hi, Denis!According to the table data I wrote in the tutorial [1], it's definitely seconds. It's a pity that the docs do not reflect this as well -- I'll get them fixed!Best regards,[1]: http://www.opensips.org/Documentation/Tutorials-FraudDetection-2-1Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.comOn 06.06.2018 14:20, Denis via Users wrote:Hello, Liviu! It is me, again:))) One more, call_duration measured in seconds or in minutes? Thank you. -- С уважением, Денис.Best regards, Denis 27.04.2018, 09:25, "Denis via Users" :Hello, Liviu!OK, i understand..But, to speak the truth, it would be more reasonable to control exactly numbers, but not prefix.Because, now, "sequential calls" and "total calls", actually, perform the same control task.My experience tell me, that many fraud cases deal with calling to the same number in a some time period. Anyway, thank you!  -- С уважением, Денис.Best regards, Denis 26.04.2018, 08:22, "Liviu Chircu" :Yes, exactly. Apologies for my incomplete example scenario!Best regards,Liviu ChircuOpenSIPS Developerhttp://www.opensips-solutions.comOn 26.04.2018 07:57, Denis via Users wrote: Liviu, it seems, i confused. You gave an example "the "sequential calls" holds the size of the last batch of calls sent to the same number. For example, 

Re: [OpenSIPS-Users] Opensips 2.5 and fraud module

2018-06-06 Thread Denis via Users
Liviu, thank you very much! And, sorry, but i want to worry you more about the module. First of all, now, i am usingopensips 2.2.6 (x86_64/linux)flags: STATS: On, DISABLE_NAGLE, USE_MCAST, SHM_MMAP, PKG_MALLOC, QM_MALLOC, DBG_MALLOC, FAST_LOCK-ADAPTIVE_WAITADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.git revision: 5d229f5main.c compiled on 13:56:51 Apr 20 2018 with gcc 5.4.0 Recently i found such problem. Module detected fraud calls, dealing with call_duration (my previous question about seconds and minutes dealing with problem), but i cannot see calls drop. But all in order, In opensips.cfg i have such logic:"check_fraud("$avp(user)","$rU","$avp(profile)");   switch($rc) {    case 2:    if ($avp(3000)=="1")  xlog("L_INFO", "Route4:$rm was received (IPS=$si, IPD=$rd, CALLID=$ci, FROMTAG=$ft, TOTAG=$tt, AUTH=$au) and FRAUD: case 2");    break;    case 1:    if ($avp(3000)=="1")  xlog("L_INFO", "Route4:$rm was received (IPS=$si, IPD=$rd, CALLID=$ci, FROMTAG=$ft, TOTAG=$tt, AUTH=$au) and FRAUD: case 1");    break;    case -1:    if ($avp(3000)=="1")  xlog("L_INFO", "Route4:$rm was received (IPS=$si, IPD=$rd, CALLID=$ci, FROMTAG=$ft, TOTAG=$tt, AUTH=$au) and FRAUD: case -1");    break;    case -2:    if ($avp(3000)=="1")  xlog("L_INFO", "Route4:$rm was received (IPS=$si, IPD=$rd, CALLID=$ci, FROMTAG=$ft, TOTAG=$tt, AUTH=$au) and FRAUD DETECTED");    $avp(501)=$ft+$ci;    $avp(501)=$(avp(501){s.md5});    acc_db_request("Fraud_detectead", "acc");    send_reply("403", "Forbidden");    exit;    break;    case -3:    if ($avp(3000)=="1")  xlog("L_INFO", "Route4:$rm was received (IPS=$si, IPD=$rd, CALLID=$ci, FROMTAG=$ft, TOTAG=$tt, AUTH=$au) and FRAUD failure");    $avp(501)=$ft+$ci;    $avp(501)=$(avp(501){s.md5});    acc_db_request("Fraud_detection_failure", "acc");    send_reply("403", "Forbidden");    exit;    break;  } where,  in" -- С уважением, Денис.Best regards, Denis 06.06.2018, 14:29, "Liviu Chircu" :Hi, Denis!According to the table data I wrote in the tutorial [1], it's definitely seconds. It's a pity that the docs do not reflect this as well -- I'll get them fixed!Best regards,[1]: http://www.opensips.org/Documentation/Tutorials-FraudDetection-2-1Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.comOn 06.06.2018 14:20, Denis via Users wrote:Hello, Liviu! It is me, again:))) One more, call_duration measured in seconds or in minutes? Thank you. -- С уважением, Денис.Best regards, Denis 27.04.2018, 09:25, "Denis via Users" :Hello, Liviu!OK, i understand..But, to speak the truth, it would be more reasonable to control exactly numbers, but not prefix.Because, now, "sequential calls" and "total calls", actually, perform the same control task.My experience tell me, that many fraud cases deal with calling to the same number in a some time period. Anyway, thank you!  -- С уважением, Денис.Best regards, Denis 26.04.2018, 08:22, "Liviu Chircu" :Yes, exactly. Apologies for my incomplete example scenario!Best regards,Liviu ChircuOpenSIPS Developerhttp://www.opensips-solutions.comOn 26.04.2018 07:57, Denis via Users wrote: Liviu, it seems, i confused. You gave an example "the "sequential calls" holds the size of the last batch of calls sent to the same number. For example, if a user were to dial 44 and 45 prefixes in a round-robin manner, his "sequential calls" value would never exceed 1" So, it seems, that if we have TWO PREFIX field in fraud detection table with one profile, with 44 and 55 content, and ONE user were to dial 44 (for example 44667788 or 44223344 etc) and 45 (4567788 or 44223344 etc) prefixes in a round-robin manner, his "sequential calls" value would never exceed 1. In my case i have only ONE prefix - 810 - and, although, user were dial different numbers but with common prefix (810) "sequential calls" increased by one every call. And when counter reached predetermined value calls have started blocking. Am i right? Thank you. -- С уважением, Денис. Best regards, Denis ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users___Users mailing listUsers@lists.opensips.orghttp://lists.opensips.org/cgi-bin/mailman/listinfo/users,___Users mailing listUsers@lists.opensips.orghttp://lists.opensips.org/cgi-bin/mailman/listinfo/users ___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
,___Users mailing listUsers@lists.opensips.orghttp://lists.opensips.org/cgi-bin/mailman/listinfo/users___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Opensips 2.5 and fraud module

2018-06-06 Thread Denis via Users
Hello, Liviu! It is me, again:))) One more, call_duration measured in seconds or in minutes? Thank you. -- С уважением, Денис.Best regards, Denis 27.04.2018, 09:25, "Denis via Users" :Hello, Liviu!OK, i understand..But, to speak the truth, it would be more reasonable to control exactly numbers, but not prefix.Because, now, "sequential calls" and "total calls", actually, perform the same control task.My experience tell me, that many fraud cases deal with calling to the same number in a some time period. Anyway, thank you!  -- С уважением, Денис.Best regards, Denis 26.04.2018, 08:22, "Liviu Chircu" :Yes, exactly. Apologies for my incomplete example scenario!Best regards,Liviu ChircuOpenSIPS Developerhttp://www.opensips-solutions.comOn 26.04.2018 07:57, Denis via Users wrote: Liviu, it seems, i confused. You gave an example "the "sequential calls" holds the size of the last batch of calls sent to the same number. For example, if a user were to dial 44 and 45 prefixes in a round-robin manner, his "sequential calls" value would never exceed 1" So, it seems, that if we have TWO PREFIX field in fraud detection table with one profile, with 44 and 55 content, and ONE user were to dial 44 (for example 44667788 or 44223344 etc) and 45 (4567788 or 44223344 etc) prefixes in a round-robin manner, his "sequential calls" value would never exceed 1. In my case i have only ONE prefix - 810 - and, although, user were dial different numbers but with common prefix (810) "sequential calls" increased by one every call. And when counter reached predetermined value calls have started blocking. Am i right? Thank you. -- С уважением, Денис. Best regards, Denis ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users___Users mailing listUsers@lists.opensips.orghttp://lists.opensips.org/cgi-bin/mailman/listinfo/users,___Users mailing listUsers@lists.opensips.orghttp://lists.opensips.org/cgi-bin/mailman/listinfo/users___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Using Sipp stress tool with Opensips

2018-06-06 Thread David Villasmil
Are the 2 sipp instances behind nat? If so, you need to set the appropiate
switch on sipp, i believe it is
-bind_local the actual local ip
-i the public ip

Take a look at sipp's documentation

Hope it helps

David

On Wed, Jun 6, 2018, 10:33 Jan Skórczyński 
wrote:

> Hello,
>
> I'm a beginner in VOIP world so maybe this question have obvious answer...
> I would like to perform series of stress tests of my Opensips server.
>
> Opensips instance is located on VPS at adres XXX.XXX.XXX.XXX (public IP)
> and it is listening on 5060 port. I'm using custom client apps, everything
> works fine, however I have some issue when I try to test with Sipp.
>
> I'm setting UAS on my VPS, with the following command:
>
> sipp -sn uas -rsa XXX.XXX.XXX.XXX:5060 -i XXX.XXX.XXX.XXX
>
> and UAC on my PC:
>
> sipp -sn uac XXX.XXX.XXX.XXX:5061  -i 192.168.0.103
>
> I can see on UAS that it receives messages from my UAC, but it cannot
> reply to them.
>
> -- Scenario Screen  [1-9]: Change
> Screen --
>   Port   Total-time  Total-calls  Transport
>   5061  19.07 s   30  UDP
>
>   0 new calls during 1.004 s period  1 ms scheduler resolution
>   0 callsPeak was 6 calls, after 6 s
>   0 Running, 31 Paused, 4 Woken up
>   90 dead call msg (discarded)
>   4 open sockets
>
>  Messages  Retrans   Timeout
>  Unexpected-Msg
>   --> INVITE 300 0 0
>
>   <-- 180300
>   <-- 20030140
>   --> ACK E-RTD1 0 0 0 30
>
>   --> BYE0 0 0 0
>   <-- 2000 0
>   [   4000ms] Pause  0 0
> -- Sipp Server Mode
> ---
>
>
> Logs from UAC:
>
> -- Scenario Screen  [1-9]: Change
> Screen --
>   Call-rate(length)   Port   Total-time  Total-calls  Remote-host
>   10.0(0 ms)/1.000s   5060  73.29 s   90
> XXX.XXX.XXX.XXX:5061(UDP)
>
>   0 new calls during 1.004 s period  1 ms scheduler resolution
>   30 calls (limit 30)Peak was 30 calls, after 3 s
>   0 Running, 62 Paused, 24 Woken up
>   0 dead call msg (discarded)0 out-of-call msg (discarded)
>
>   3 open sockets
>
>  Messages  Retrans   Timeout
>  Unexpected-Msg
>   INVITE --> 90415   60
>  100 <-- 0 0 0 0
>  180 <-- 0 0 0 0
>  183 <-- 0 0 0 0
>  200 <--  E-RTD1 0 0 0 0
>  ACK --> 0 0
>Pause [  0ms] 0 0
>  BYE --> 0 0 0
>  200 <-- 0 0 0 0
>
> -- [+|-|*|/]: Adjust rate  [q]: Soft exit  [p]: Pause traffic
> -
>
> And here is my opensips.cfg routing script:
>
> route{
> xlog("Begin route");
> if (!mf_process_maxfwd_header("10")) {
> xlog("Too many hops");
> send_reply("483","Too Many Hops");
> exit;
> }
>
> if (has_totag() && ($fU!="sipp")) {
> xlog("Has totag");
> # handle hop-by-hop ACK (no routing required)
> if ( is_method("ACK") && t_check_trans() ) {
> xlog("Method: ACK && t_check_trans. Relaying...");
> t_relay();
> exit;
> }
>
> # sequential request within a dialog should
> # take the path determined by record-routing
> if ( !loose_route() ) {
> # we do record-routing for all our traffic, so we should not
> # receive any sequential requests without Route hdr.
> send_reply("404","Not here");
> exit;
> }
>
> if (is_method("BYE")) {
> # do accounting even if the transaction fails
> #do_accounting("log","failed");
> }
>
> # route it out to whatever destination was set by loose_route()
> # in $du (destination URI).
> route(relay);
> exit;
> }
>
> # CANCEL processing
> if (is_method("CANCEL")) {
> if (t_check_trans())
> t_relay();
> exit;
> }
>
> # absorb retransmissions, but do not create transaction
> t_check_trans();
>
> if ( !(is_method("REGISTER")  ) ) {
> if (is_myself("$fd")) {
> } else {
> # if caller is not local, then called number must be local
> if (!is_myself("$rd")) {
> send_reply("403","Relay Forbidden");
> exit;
> }
> }
> }
>
> # preloaded route checking
> if (loose_route()) {
> xlog("L_ERR",
> "Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");
> if (!is_method("ACK"))
> send_reply("403","Preload Route denied");
> exit;
> }
>
> # record routing
> if (!is_method("REGISTER|MESSAGE"))
> record_route();
>
> # account only INVITEs
> if (is_method("INVITE")) {
> create_dialog();
> engage_media_proxy();
> 

[OpenSIPS-Users] Using Sipp stress tool with Opensips

2018-06-06 Thread Jan Skórczyński
Hello,

I'm a beginner in VOIP world so maybe this question have obvious answer...
I would like to perform series of stress tests of my Opensips server.

Opensips instance is located on VPS at adres XXX.XXX.XXX.XXX (public IP)
and it is listening on 5060 port. I'm using custom client apps, everything
works fine, however I have some issue when I try to test with Sipp.

I'm setting UAS on my VPS, with the following command:

sipp -sn uas -rsa XXX.XXX.XXX.XXX:5060 -i XXX.XXX.XXX.XXX

and UAC on my PC:

sipp -sn uac XXX.XXX.XXX.XXX:5061  -i 192.168.0.103

I can see on UAS that it receives messages from my UAC, but it cannot reply
to them.

-- Scenario Screen  [1-9]: Change
Screen --
  Port   Total-time  Total-calls  Transport
  5061  19.07 s   30  UDP

  0 new calls during 1.004 s period  1 ms scheduler resolution
  0 callsPeak was 6 calls, after 6 s
  0 Running, 31 Paused, 4 Woken up
  90 dead call msg (discarded)
  4 open sockets

 Messages  Retrans   Timeout
 Unexpected-Msg
  --> INVITE 300 0 0

  <-- 180300
  <-- 20030140
  --> ACK E-RTD1 0 0 0 30

  --> BYE0 0 0 0
  <-- 2000 0
  [   4000ms] Pause  0 0
-- Sipp Server Mode
---


Logs from UAC:

-- Scenario Screen  [1-9]: Change
Screen --
  Call-rate(length)   Port   Total-time  Total-calls  Remote-host
  10.0(0 ms)/1.000s   5060  73.29 s   90
XXX.XXX.XXX.XXX:5061(UDP)

  0 new calls during 1.004 s period  1 ms scheduler resolution
  30 calls (limit 30)Peak was 30 calls, after 3 s
  0 Running, 62 Paused, 24 Woken up
  0 dead call msg (discarded)0 out-of-call msg (discarded)

  3 open sockets

 Messages  Retrans   Timeout
 Unexpected-Msg
  INVITE --> 90415   60
 100 <-- 0 0 0 0
 180 <-- 0 0 0 0
 183 <-- 0 0 0 0
 200 <--  E-RTD1 0 0 0 0
 ACK --> 0 0
   Pause [  0ms] 0 0
 BYE --> 0 0 0
 200 <-- 0 0 0 0

-- [+|-|*|/]: Adjust rate  [q]: Soft exit  [p]: Pause traffic
-

And here is my opensips.cfg routing script:

route{
xlog("Begin route");
if (!mf_process_maxfwd_header("10")) {
xlog("Too many hops");
send_reply("483","Too Many Hops");
exit;
}

if (has_totag() && ($fU!="sipp")) {
xlog("Has totag");
# handle hop-by-hop ACK (no routing required)
if ( is_method("ACK") && t_check_trans() ) {
xlog("Method: ACK && t_check_trans. Relaying...");
t_relay();
exit;
}

# sequential request within a dialog should
# take the path determined by record-routing
if ( !loose_route() ) {
# we do record-routing for all our traffic, so we should not
# receive any sequential requests without Route hdr.
send_reply("404","Not here");
exit;
}

if (is_method("BYE")) {
# do accounting even if the transaction fails
#do_accounting("log","failed");
}

# route it out to whatever destination was set by loose_route()
# in $du (destination URI).
route(relay);
exit;
}

# CANCEL processing
if (is_method("CANCEL")) {
if (t_check_trans())
t_relay();
exit;
}

# absorb retransmissions, but do not create transaction
t_check_trans();

if ( !(is_method("REGISTER")  ) ) {
if (is_myself("$fd")) {
} else {
# if caller is not local, then called number must be local
if (!is_myself("$rd")) {
send_reply("403","Relay Forbidden");
exit;
}
}
}

# preloaded route checking
if (loose_route()) {
xlog("L_ERR",
"Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");
if (!is_method("ACK"))
send_reply("403","Preload Route denied");
exit;
}

# record routing
if (!is_method("REGISTER|MESSAGE"))
record_route();

# account only INVITEs
if (is_method("INVITE")) {
create_dialog();
engage_media_proxy();
#do_accounting("log");
}
if (!is_myself("$rd")) {
append_hf("P-hint: outbound\r\n");
# if you have some interdomain connections via TLS
## CUSTOMIZE IF NEEDED
##if ($rd=="tls_domain1.net"
## || $rd=="tls_domain2.net"
##) {
## force_send_socket(tls:127.0.0.1:5061); # CUSTOMIZE
##}
route(relay);
}

# requests for my domain
if (is_method("PUBLISH|SUBSCRIBE")) {
send_reply("503", "Service Unavailable");
exit;
}

if (is_method("REGISTER")) {
xlog("NEW REGISTER!");
if ($proto == "tls")
setflag(TCP_PERSISTENT);
if (!save("location"))
sl_reply_error();

exit;
}

if 

Re: [OpenSIPS-Users] Round Robin alg and drouting

2018-06-06 Thread Abdoul Osséni
With cachedb_local module, I was able to implement this.

Regards

Abdoul OSSENI

2018-06-05 16:16 GMT+02:00 Abdoul Osséni :

> Hello list,
>
> Since a few days, I am looking for a solution to my problem without
> success.
>
> Any help will be appreciated.
>
> My question is how implemented round robin algo with drouting?
>
> For each prefix in dr_rule table, I try to make:
>
>1. first call -> gw1
>2. next call -> gw2
>3. after call  -> gw1
>4. next call -> gw2
>
> Regards
>
> Abdoul OSSENI
> Ingénieur DevOps chez Néo-Soft
> Co-Fondateur de ON SERVICES
> Tél : +33 601 135 167
>
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users