<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"Source Sans Pro";
panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Century Gothic";
panose-1:2 11 5 2 2 2 2 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;
color:#333333;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman",serif;
color:#333333;}
span.E-MailFormatvorlage18
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:#1F497D;}
span.E-MailFormatvorlage19
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body bgcolor=white lang=DE-AT link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>This part with balances is complex unfortunately, but mandatory for fast sum queries (->dashboard) and the prepaid logic.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>Trying to summarize: essentially you need to create billing.contract_balances records (if not existent yet) before you begin rating a cdr („catchup“, „carry over“ from prior balance intervals and so on..), and update the balances a call duration is crossing (will usually be the most recent balance interval only) once you have calculated the definite call costs of the cdr. This then needs to be done for the balances of each involved contract (source customer, source provider, destination customer, destination provider).<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>Regards, rene<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=DE style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext'>Von:</span></b><span lang=DE style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext'> Javier Valencia [mailto:jv@voiper.es] <br><b>Gesendet:</b> Mittwoch, 25. Oktober 2017 11:54<br><b>An:</b> Rene Krenn <rkrenn@sipwise.com>; spce-user@lists.sipwise.com<br><b>Betreff:</b> Re: AW: [Spce-user] Custom rate-o-mat<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p><span style='font-family:"Source Sans Pro",serif'>thx</span><o:p></o:p></p><div><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width="100%" style='width:100.0%;background:white'><tr><td valign=top style='padding:0cm 0cm 0cm 0cm'><div align=center><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width="100%" style='width:100.0%'><tr><td valign=top style='padding:0cm 0cm 0cm 0cm'><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 align=left width=0 style='width:525.0pt;background:white'><tr><td valign=top style='padding:0cm 0cm 0cm 0cm'><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 align=left width=0 style='width:495.0pt'><tr><td style='padding:0cm 0cm 0cm 0cm'><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 align=left><tr><td valign=top style='padding:0cm 0cm 0cm 0cm'><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 align=left><tr><td valign=top style='padding:0cm 0cm 0cm 0cm'><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 align=left><tr><td style='padding:0cm 0cm 0cm 0cm'><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 align=left><tr><td style='padding:.75pt 3.75pt 0cm 0cm'><p class=MsoNormal align=center style='text-align:center'><a href="http://www.voiper.es/"><span style='text-decoration:none'><img border=0 width=250 height=87 id="_x0000_i1025" src="cid:image001.png@01D34D89.700C50F0" alt=Logo></span></a><o:p></o:p></p></td></tr></table></td></tr></table></td></tr></table></td><td valign=top style='padding:0cm 0cm 0cm 0cm'><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 align=left><tr><td valign=top style='border:none;border-left:solid black 1.0pt;padding:0cm 0cm 0cm 3.75pt'><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 align=left><tr><td style='padding:0cm 0cm 0cm 0cm'><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 align=left><tr><td style='padding:0cm 0cm 0cm 0cm'><p class=MsoNormal style='line-height:11.25pt'><b><span style='font-size:10.5pt;font-family:"Century Gothic",sans-serif;color:black;text-transform:uppercase'>Javier Valencia </span></b><span style='font-size:10.0pt;font-family:"Century Gothic",sans-serif;color:black'>| CTO <br>Centro de Negocios Martín Buendía <br>Camino de las Cañadas, nº 1C, Portal 1, 2ºG <br>29649 Mijas (Málaga) <o:p></o:p></span></p></td></tr></table></td></tr><tr><td valign=top style='padding:3.75pt 0cm 0cm 0cm'><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 align=left><tr><td style='padding:0cm 3.0pt 0cm 0cm'><p class=MsoNormal><img border=0 width=14 height=14 id="_x0000_i1026" src="cid:image003.png@01D34D89.700C50F0" alt="#"><o:p></o:p></p></td><td style='padding:0cm 0cm 0cm 0cm'><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Century Gothic",sans-serif;color:black'><a href="tel:951562080"><span style='color:black;text-decoration:none'>951562080 (T)</span></a> | <a href="tel:687486759"><span style='color:black;text-decoration:none'>687486759 (M)</span></a> <o:p></o:p></span></p></td></tr><tr><td style='padding:0cm 3.0pt 0cm 0cm'><p class=MsoNormal><img border=0 width=14 height=14 id="_x0000_i1027" src="cid:image005.png@01D34D89.700C50F0" alt="#"><o:p></o:p></p></td><td style='padding:0cm 0cm 0cm 0cm'><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Century Gothic",sans-serif;color:black'><a href="http://www.voiper.es/"><span style='color:black;text-decoration:none'>www.voiper.es </span></a><o:p></o:p></span></p></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></div></td></tr></table></div><div><p class=MsoNormal>El 25/10/17 a las 10:33, Rene Krenn escribió:<o:p></o:p></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>Hi,</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>you can find what and how to populate in the in the sub catchup_contract_balance entry point in rate-o-mat.pl.</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>regards, rene</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'> </span><o:p></o:p></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=DE style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext'>Von:</span></b><span lang=DE style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext'> Spce-user [<a href="mailto:spce-user-bounces@lists.sipwise.com">mailto:spce-user-bounces@lists.sipwise.com</a>] <b>Im Auftrag von </b>Javier Valencia<br><b>Gesendet:</b> Mittwoch, 25. Oktober 2017 10:25<br><b>An:</b> <a href="mailto:spce-user@lists.sipwise.com">spce-user@lists.sipwise.com</a><br><b>Betreff:</b> [Spce-user] Custom rate-o-mat</span><o:p></o:p></p></div></div><p class=MsoNormal> <o:p></o:p></p><p><span style='font-family:"Source Sans Pro",serif'>Hi,</span><o:p></o:p></p><p><span style='font-family:"Source Sans Pro",serif'>We develop own custom rating engine, and stop a rate-o-mat.</span><o:p></o:p></p><p><span style='font-family:"Source Sans Pro",serif'>When we rate a cdr (from accounting database) and it's marked as "rating_status: :ok, rated_at: Time.now" and sales/cost prices values, but antifraud and "Peering Costs" and "Customer Revenue" from dahsboard isn't counting.</span><o:p></o:p></p><p><span style='font-family:"Source Sans Pro",serif'>Which tables must we update to do balances consistently?</span><o:p></o:p></p><p><span style='font-family:"Source Sans Pro",serif'>Thanks.</span><o:p></o:p></p><p><span style='font-family:"Source Sans Pro",serif'>Kind regards, Javier Valencia.</span><o:p></o:p></p><p> <o:p></o:p></p><div><p class=MsoNormal>-- <o:p></o:p></p><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width="100%" style='width:100.0%;background:white'><tr><td valign=top style='padding:0cm 0cm 0cm 0cm'><div align=center><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width="100%" style='width:100.0%'><tr><td valign=top style='padding:0cm 0cm 0cm 0cm'><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 align=left width=0 style='width:525.0pt;background:white'><tr><td valign=top style='padding:0cm 0cm 0cm 0cm'><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 align=left width=0 style='width:495.0pt'><tr><td style='padding:0cm 0cm 0cm 0cm'><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 align=left><tr><td valign=top style='padding:0cm 0cm 0cm 0cm'><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 align=left><tr><td valign=top style='padding:0cm 0cm 0cm 0cm'><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 align=left><tr><td style='padding:0cm 0cm 0cm 0cm'><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 align=left><tr><td style='padding:.75pt 3.75pt 0cm 0cm'><p class=MsoNormal align=center style='text-align:center'><a href="http://www.voiper.es/"><span style='text-decoration:none'><img border=0 width=250 height=87 id="_x0000_i1028" src="cid:image001.png@01D34D89.700C50F0" alt=Logo></span></a><o:p></o:p></p></td></tr></table></td></tr></table></td></tr></table></td><td valign=top style='padding:0cm 0cm 0cm 0cm'><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 align=left><tr><td valign=top style='border:none;border-left:solid black 1.0pt;padding:0cm 0cm 0cm 3.75pt'><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 align=left><tr><td style='padding:0cm 0cm 0cm 0cm'><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 align=left><tr><td style='padding:0cm 0cm 0cm 0cm'><p class=MsoNormal style='line-height:11.25pt'><b><span style='font-size:10.5pt'>Javier Valencia </span></b><span style='font-size:10.0pt'>| CTO <br>Centro de Negocios Martín Buendía <br>Camino de las Cañadas, nº 1C, Portal 1, 2ºG <br>29649 Mijas (Málaga) </span><o:p></o:p></p></td></tr></table></td></tr><tr><td valign=top style='padding:3.75pt 0cm 0cm 0cm'><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 align=left><tr><td style='padding:0cm 3.0pt 0cm 0cm'><p class=MsoNormal><img border=0 width=14 height=14 id="_x0000_i1029" src="cid:image003.png@01D34D89.700C50F0" alt="#"><o:p></o:p></p></td><td style='padding:0cm 0cm 0cm 0cm'><p class=MsoNormal><span style='font-size:10.0pt'><a href="tel:951562080"><span style='color:black;text-decoration:none'>951562080 (T)</span></a> | <a href="tel:687486759"><span style='color:black;text-decoration:none'>687486759 (M)</span></a> </span><o:p></o:p></p></td></tr><tr><td style='padding:0cm 3.0pt 0cm 0cm'><p class=MsoNormal><img border=0 width=14 height=14 id="_x0000_i1030" src="cid:image005.png@01D34D89.700C50F0" alt="#"><o:p></o:p></p></td><td style='padding:0cm 0cm 0cm 0cm'><p class=MsoNormal><span style='font-size:10.0pt'><a href="http://www.voiper.es/"><span style='color:black;text-decoration:none'>www.voiper.es </span></a></span><o:p></o:p></p></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></div></td></tr></table><p class=MsoNormal><span style='color:windowtext'> </span><o:p></o:p></p></div></blockquote><p class=MsoNormal><o:p> </o:p></p></div></body></html>