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

Răzvan Crainea razvan at opensips.org
Fri May 18 03:11:12 EDT 2018


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,
> 
> 				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,
> 
> COLUMNS HERE ->	call_end_seconds,call_end_useconds,bye_src_ip,bye_time,setuptime,created,duration,ms_duration )
> 
> values ('INVITE','e61fa171a5','2082486450','V30_d0RXCDUtMWYrRVFWYn1mZA--','200','OK','2018-05-17 15:39:25','2079','1526571565','wahoo-OpenSipsCore02','29','1',
> 
> 				'14024035128','14024035121','90761','none','14024035121','190761','PCMU|PCMA|telephone-event',
> 
> 				'USA','US','1','1402','4022060','USA','US','1','1402',
> 
> 				'30','NE','NE','Landline','4022060239','4022060','11000','FLAT','1',
> 
> 				'','0','[ { \"idx\": 2, \"cc\": \"1105\", \"cp\": 1000, \"st\": 1526571563, \"ct\": 1526571565, \"rs\": \"\", \"rr\": \"\" } ]','1105','1000','2',
> 
> 				'1111, 1105, 1067, 1088, 1060, 1076, 1062, 1051','726, 1000, 1020, 1800, 2400, 2500, 7000, 14400',
> 
> 				'1111 Diff Removed.','192.168.20.251','192.168.20.113','192.168.20.250','4','6','58','','1',
> 
> 				'{ \"max_cc\": \"15\", \"max_cps\": \"4\", \"ingress_server_id\": \"30\", \"core_server_group\": \"10002\", \"caller_format_profile\": 60000, \"callee_format_profile\": 50000, \"cnam_enabled\": 0, \"route_profile\": 30, \"auth_profile\": 5, \"dtmfmode\": \"2833\", \"t38\": 0, \"privacy\": 0, \"rtpproxy_group\": 1, \"landline_only\": 0, \"is_mark_up_rate\": 0, \"nanp_rate_id\": 5, \"international_rate_id\": 2, \"limit_calls_to_profit\": 0, \"mark_up_margin\": 0, \"min_profit_margin\": 0, \"max_mark_up\": 150000, \"immediate_media\": 0, \"tz\": \"US\\/Eastern\", \"dnc_mode\": \"NONE\", \"dnc_route\": \"ALWAYS\" }',
> 
> 				'{ }',
> 
> 				'{ \"inbound_media\": \"c=IN IP4 192.168.20.113\", \"proxy_media\": 1, \"default_caller_id\": \"14024034435\", \"default_caller_name\": \"UNKNOWN\", \"callername\": \"\", \"callernameset\": 0, \"dr_grp\": 1, \"dr_part\": \"INTRA\", \"cust_dr_grp\": 4, \"cust_dr_part\": \"CUST_INTRA\", \"callee_routecode\": \"4022060\", \"route_to_number\": \"4022060239\", \"callee_number_type\": \"Landline\", \"ringtype\": 180 }',
> 
> 				'{ }',
> 
> 				'{ \"flat_rates\": \"CAN,11000,11000!CNT,200000,200000!PRI,15000,15000!TFN,5000,5000!UAK,40000,40000!UHI,19000,19000!USA,11000,11000!VIR,25000,25000\", \"supplemental_rates\": \"none\" }',
> 
> 				'{ }',
> 
> 				'1526571565','940740',
> 
> VALUES HERE ->	'','','','',2,'2018-05-17 15:39:23',4,3910)
> 
> 
> 
> 
> The values for call_end_seconds,call_end_useconds,bye_src_ip,bye_time are all ''.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Regards,
> Pat Burke
> 
> 
> 
> ______________________________________________________________________________________
> Direct: (402) 403-5121   |   Cell: (402) 443-8929  |   Email: pat at voxtelesys.com
> 1801 23rd Avenue North   |  Suite 217    |  Fargo, North Dakota 58102
>   
> -----Original Message-----
>> From: "Răzvan Crainea" <razvan at opensips.org>
>> To: users at lists.opensips.org
>> Date: 05/17/18 04:13
>> Subject: Re: [OpenSIPS-Users] db_extra_bye - after BYE values in CDR in 2.4
>>
>> Hi, Pat!
>>
>> In the new 2.4, the process of setting extras became even simpler. All
>> you have to do is to set the $acc_extra() value when the BYE is receved.
>> Let me know if you have further questions.
>>
>> Best regards,
>> Răzvan
>>
>> On 05/16/2018 11:38 PM, Pat Burke wrote:
>>> Hello,
>>>
>>>
>>> I am trying to store data in the CDR from both before the BYE and after
>>> the BYE.
>>>
>>>
>>> In OpenSIPS 2.2.x we did the following -
>>>
>>>
>>> modparam("acc",
>>> "db_extra","setuptime_msec=$avp(setuptime_msec);end_setup_time=$Ts;host_name=$avp(host_name)
>>> ....
>>>
>>> modparam("acc", "db_extra_bye",
>>> "call_end_seconds=$avp(call_end_seconds);call_end_useconds=$avp(call_end_useconds);bye_src_ip=$avp(bye_src_ip);bye_time=$avp(bye_time)")
>>>
>>>
>>> All of the values were sent to the database.
>>>
>>>
>>>
>>>
>>> In OpenSIPS 2.4.x we are doing the following -
>>>
>>> modparam("acc", "extra_fields", "db:
>>> setuptime_msec;end_setup_time;host_name; ...
>>> ;call_end_seconds;call_end_useconds;bye_src_ip;bye_time")
>>>
>>> I am setting the $acc_extra(call_end_seconds) values after the BYE, but
>>> nothing is being sent to the database.
>>>
>>>
>>> How do we handle the after BYE values into the CDR for 2.4?
>>>
>>>
>>> Thanks in advance.
>>>
>>>
>>> Regards,
>>> *Pat Burke*
>>>
>>> Voxtelesys | solutions to grow your business
>>> ______________________________________________________________________________________
>>> Direct: (402) 403-5121 |   Cell: (402) 443-8929 |   Email:
>>> pat at voxtelesys.com <mailto:pat at voxtelesys.com>
>>> 1801 23rd Avenue North |  Suite 217 |  Fargo, North Dakota 58102
>>>
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.opensips.org
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>
>>
>> -- 
>> Răzvan Crainea
>> OpenSIPS Core Developer
>>     http://www.opensips-solutions.com
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> 
> 
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> 

-- 
Răzvan Crainea
OpenSIPS Core Developer
   http://www.opensips-solutions.com



More information about the Users mailing list