<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div>
<div>
<div>If you can point me to the pull request, I can take a look and see if I can integrate it in.</div>
<div>
<div id="MAC_OUTLOOK_SIGNATURE"></div>
</div>
</div>
</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:12pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>&lt;<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org">freeswitch-users-bounces@lists.freeswitch.org</a>&gt; on behalf of Luis Daniel Lucio Quiroz &lt;<a href="mailto:luis.daniel.lucio@gmail.com">luis.daniel.lucio@gmail.com</a>&gt;<br>
<span style="font-weight:bold">Reply-To: </span>FreeSWITCH Users Help &lt;<a href="mailto:freeswitch-users@lists.freeswitch.org">freeswitch-users@lists.freeswitch.org</a>&gt;<br>
<span style="font-weight:bold">Date: </span>Sunday, April 10, 2016 at 11:09 AM<br>
<span style="font-weight:bold">To: </span>FreeSWITCH Users Help &lt;<a href="mailto:freeswitch-users@lists.freeswitch.org">freeswitch-users@lists.freeswitch.org</a>&gt;<br>
<span style="font-weight:bold">Subject: </span>Re: [Freeswitch-users] nibblebill do not terminate calls properly<br>
</div>
<div><br>
</div>
<div>
<div>
<p dir="ltr">There is. It is not from myself. I just don't remember it</p>
<div class="gmail_quote">Le 10 avr. 2016 1:44 PM, &quot;Ken Rice&quot; &lt;<a href="mailto:krice@freeswitch.org">krice@freeswitch.org</a>&gt; a écrit&nbsp;:<br type="attribution">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="auto">
<div>If there is a known bug and a patch for this, there should be a jira and a pull request for the patch<br>
<br>
Sent from my iPhone</div>
<div><br>
On Apr 10, 2016, at 12:40 PM, Luis Daniel Lucio Quiroz &lt;<a href="mailto:luis.daniel.lucio@gmail.com" target="_blank">luis.daniel.lucio@gmail.com</a>&gt; wrote:<br>
<br>
</div>
<blockquote type="cite">
<div>
<p dir="ltr">There is a known bug and a known patch to fix it. I can't remember right now which one it is.</p>
<div style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">Hello<br>
I would like to use nibblebilling for fraud prevention on international and premium numbers ( national or emergency calls should never be blocked and should still working even if the billing database is unavailable&nbsp; )<br>
<br>
Unfortunately that never hangup my calls using standard dial plan<br>
<br>
<b>nibblebill.conf.xml</b><br>
<br>
<tt>&lt;configuration name=&quot;nibblebill.conf&quot; description=&quot;Nibble Billing&quot;&gt;</tt><tt><br>
</tt><tt>&nbsp; &lt;settings&gt;</tt><tt><br>
</tt><tt>&nbsp;&nbsp;&nbsp; &lt;!-- See <a href="http://wiki.freeswitch.org/wiki/Mod_nibblebill" target="_blank">
http://wiki.freeswitch.org/wiki/Mod_nibblebill</a> for help with these options --&gt;</tt><tt><br>
</tt><tt><br>
</tt><tt>&nbsp;&nbsp;&nbsp; &lt;!-- Information for connecting to your database --&gt;</tt><tt><br>
</tt><tt>&nbsp;&nbsp;&nbsp; &lt;param name=&quot;db_dsn&quot; value=&quot;pgsql://hostaddr=127.0.0.1 dbname=xxxx user=xxxx password=xxxx&quot;/&gt;</tt><tt><br>
</tt><tt><br>
</tt><tt>&nbsp;&nbsp;&nbsp; &lt;!-- The database table where your CASH column is located --&gt;</tt><tt><br>
</tt><tt>&nbsp;&nbsp;&nbsp; &lt;param name=&quot;db_table&quot; value=&quot;accounts&quot;/&gt;</tt><tt><br>
</tt><tt><br>
</tt><tt>&nbsp;&nbsp;&nbsp; &lt;!-- The column name where we store the value of the account --&gt;</tt><tt><br>
</tt><tt>&nbsp;&nbsp;&nbsp; &lt;param name=&quot;db_column_cash&quot; value=&quot;cash&quot;/&gt;</tt><tt><br>
</tt><tt><br>
</tt><tt>&nbsp;&nbsp;&nbsp; &lt;!-- The column name for the unique ID identifying the account --&gt;</tt><tt><br>
</tt><tt>&nbsp;&nbsp;&nbsp; &lt;param name=&quot;db_column_account&quot; value=&quot;id&quot;/&gt;</tt><tt><br>
</tt><tt><br>
</tt><tt>&nbsp;&nbsp;&nbsp; &lt;!-- Default heartbeat interval. Set to 'off' for no heartbeat (i.e. bill only at end of call) --&gt;</tt><tt><br>
</tt><tt>&nbsp;&nbsp;&nbsp; &lt;param name=&quot;global_heartbeat&quot; value=&quot;20&quot;/&gt;</tt><tt><br>
</tt><tt><br>
</tt><tt>&nbsp;&nbsp;&nbsp; &lt;!-- By default, warn a caller when their balance is at $5.00. You can set this to a negative number. --&gt;</tt><tt><br>
</tt><tt>&nbsp;&nbsp;&nbsp; &lt;param name=&quot;lowbal_amt&quot; value=&quot;-100&quot;/&gt;</tt><tt> &lt;!-- i don't need this --&gt;<br>
</tt><tt>&nbsp;&nbsp;&nbsp; &lt;param name=&quot;lowbal_action&quot; value=&quot;play ding&quot;/&gt;</tt><tt><br>
</tt><tt><br>
</tt><tt>&nbsp;&nbsp;&nbsp; &lt;!-- By default, terminate a caller when their balance hits $0.00. You can set this to a negative number. --&gt;</tt><tt><br>
</tt><tt>&nbsp;&nbsp;&nbsp; &lt;param name=&quot;nobal_amt&quot; value=&quot;0&quot;/&gt;</tt><tt><br>
</tt><tt>&nbsp;&nbsp;&nbsp; &lt;param name=&quot;nobal_action&quot; value=&quot;hangup&quot;/&gt;</tt><tt><br>
</tt><tt><br>
</tt><tt>&nbsp;&nbsp;&nbsp; &lt;!-- If a call goes beyond a certain dollar amount, flag or terminate it --&gt;</tt><tt><br>
</tt><tt>&nbsp;&nbsp;&nbsp; &lt;param name=&quot;percall_max_amt&quot; value=&quot;10&quot;/&gt;</tt><tt><br>
</tt><tt>&nbsp;&nbsp;&nbsp; &lt;param name=&quot;percall_action&quot; value=&quot;hangup&quot;/&gt;</tt><tt><br>
</tt><tt><br>
</tt><tt>&nbsp; &lt;/settings&gt;</tt><tt><br>
</tt><tt>&lt;/configuration&gt;</tt><br>
<br>
<b>outbound route</b><br>
<br>
<tt>&lt;extension name=&quot;international&quot; &gt;</tt><tt><br>
</tt><tt>&nbsp;&nbsp; &lt;condition field=&quot;destination_number&quot; expression=&quot;^00(\d{6,20})$&quot; &gt;</tt><tt><br>
</tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action application=&quot;nibblebill&quot; data=&quot;flush&quot;/&gt;</tt><tt><br>
</tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action application=&quot;set&quot; data=&quot;nibble_account=${accountcode}&quot;/&gt;</tt><tt><br>
</tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action application=&quot;set&quot; data=&quot;nibble_rate=0.1&quot;/&gt;</tt><tt><br>
</tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action application=&quot;bridge&quot; data=&quot;sofia/gateway/gw_idt/$1&quot; /&gt;</tt><tt><br>
</tt><tt>&nbsp;&nbsp; &lt;/condition&gt;</tt><tt><br>
</tt><tt>&lt;/extension&gt;</tt><br>
<br>
<br>
<b>My balance</b><br>
My balance is already negative<br>
<br>
<tt>&nbsp;select * from accounts ;</tt><tt><br>
</tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp; cash&nbsp;&nbsp;&nbsp; </tt><tt><br>
</tt><tt>----------------------------------&#43;-----------</tt><tt><br>
</tt><tt>&nbsp;<a href="http://company.voip.mydomain.com" target="_blank">company.voip.mydomain.com</a> | -0.789471</tt><br>
<br>
<b>A sample call</b><br>
My balance already negative, the call will be billed but never blocked<br>
<br>
<tt>Dialplan: <a href="mailto:sofia/internal/5003@company.voip.domain.com" target="_blank">
sofia/internal/5003@company.voip.domain.com</a> Action nibblebill(flush)</tt><tt><br>
</tt><tt>Dialplan: <a href="mailto:sofia/internal/5003@company.voip.domain.com" target="_blank">
sofia/internal/5003@company.voip.domain.com</a> Action set(nibble_account=${accountcode})</tt><tt><br>
</tt><tt>Dialplan: <a href="mailto:sofia/internal/5003@company.voip.domain.com" target="_blank">
sofia/internal/5003@company.voip.domain.com</a> Action set(nibble_rate=0.1)</tt><tt><br>
</tt><tt>EXECUTE <a href="mailto:sofia/internal/5003@company.voip.domain.com" target="_blank">
sofia/internal/5003@company.voip.domain.com</a> nibblebill(flush)</tt><tt><br>
</tt><tt>EXECUTE <a href="mailto:sofia/internal/5003@company.voip.domain.com" target="_blank">
sofia/internal/5003@company.voip.domain.com</a> set(nibble_account=<a href="http://company.voip.domain.com" target="_blank">company.voip.domain.com</a>)</tt><tt><br>
</tt><tt>2016-04-10 12:10:04.049418 [DEBUG] mod_dptools.c:1477 <a href="mailto:sofia/internal/5003@company.voip.domain.com" target="_blank">
sofia/internal/5003@company.voip.domain.com</a> SET [nibble_account]=[<a href="http://company.voip.domain.com" target="_blank">company.voip.domain.com</a>]</tt><tt><br>
</tt><tt>EXECUTE <a href="mailto:sofia/internal/5003@company.voip.domain.com" target="_blank">
sofia/internal/5003@company.voip.domain.com</a> set(nibble_rate=0.1)</tt><tt><br>
</tt><tt>2016-04-10 12:10:04.049418 [DEBUG] mod_dptools.c:1477 <a href="mailto:sofia/internal/5003@company.voip.domain.com" target="_blank">
sofia/internal/5003@company.voip.domain.com</a> SET [nibble_rate]=[0.1]</tt><tt><br>
</tt><tt>2016-04-10 12:10:52.132458 [DEBUG] mod_nibblebill.c:488 Attempting to bill at $0.1 per minute to account
<a href="http://company.voip.domain.com" target="_blank">company.voip.domain.com</a></tt><tt><br>
</tt><tt>2016-04-10 12:10:52.132458 [INFO] mod_nibblebill.c:540 Beginning new billing on 644488fc-ff04-11e5-9a27-fd2791153af9</tt><tt><br>
</tt><tt>2016-04-10 12:10:52.132458 [DEBUG] mod_nibblebill.c:546 42 seconds passed since last bill time of 2016-04-10 12:10:09</tt><tt><br>
</tt><tt>2016-04-10 12:10:52.132458 [DEBUG] mod_nibblebill.c:563 Billing $0.071033 to
<a href="http://company.voip.domain.com" target="_blank">company.voip.domain.com</a> (Call: / 0.000000 so far)</tt><tt><br>
</tt><tt>2016-04-10 12:10:52.132458 [DEBUG] mod_nibblebill.c:393 Doing update query</tt><tt><br>
</tt><tt>2016-04-10 12:10:52.172440 [DEBUG] mod_nibblebill.c:420 Doing lookup query</tt><tt><br>
</tt><tt>[SELECT cash AS nibble_balance FROM accounts WHERE id='<a href="http://company.voip.domain.com" target="_blank">company.voip.domain.com</a>']</tt><tt><br>
</tt><tt>2016-04-10 12:10:52.172440 [DEBUG] mod_nibblebill.c:428 Retrieved current balance for account
<a href="http://company.voip.domain.com" target="_blank">company.voip.domain.com</a> (balance = -0.860504)</tt><br>
<br>
<br>
<b>Using b-leg only</b><br>
Alternatively i tried an alternative dialplan ( Even if i don't relay understand what is the meaning of b-leg billing&nbsp; )<br>
<br>
<tt>&lt;action application=&quot;bridge&quot; data=&quot;{enable_heartbeat_events=5,nibble_rate=0.1,nibble_account=${accountcode},originate_timeout=90}sofia/gateway/gw_idt/33$1&quot; /&gt;</tt><tt></tt><br>
<br>
The result is better because the pending call is hanged up when the balance reach 0.<br>
<br>
<tt>2016-04-10 12:39:59.012462 [CRIT] mod_nibblebill.c:607 Balance of -0.003237 fell below allowed amount of 0.000000! (Account
</tt><tt><a href="http://company.voip.domain.com" target="_blank">company.voip.domain.com</a></tt><tt>)</tt><br>
<br>
But if i make a new call ( when my balance is negative )&nbsp; , the caller party is immediately hanged but this did not cancel immediately the bridge:&nbsp; The called party ring and can stay bridged for 61 seconds after answer.<br>
<br>
<br>
<br>
<br>
<br>
</div>
<br>
_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" rel="noreferrer" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" rel="noreferrer" target="_blank">http://confluence.freeswitch.org</a><br>
<a href="http://www.cluecon.com" rel="noreferrer" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br>
</div>
</div>
</blockquote>
<blockquote type="cite">
<div><span>_________________________________________________________________________</span><br>
<span>Professional FreeSWITCH Consulting Services: </span><br>
<span><a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a></span><br>
<span><a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a></span><br>
<span></span><br>
<span>Official FreeSWITCH Sites</span><br>
<span><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a></span><br>
<span><a href="http://confluence.freeswitch.org" target="_blank">http://confluence.freeswitch.org</a></span><br>
<span><a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a></span><br>
<span></span><br>
<span>FreeSWITCH-users mailing list</span><br>
<span><a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a></span><br>
<span><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a></span><br>
<span>UNSUBSCRIBE:http://<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">lists.freeswitch.org/mailman/options/freeswitch-users</a></span><br>
<span><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a></span></div>
</blockquote>
</div>
<br>
_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" rel="noreferrer" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" rel="noreferrer" target="_blank">http://confluence.freeswitch.org</a><br>
<a href="http://www.cluecon.com" rel="noreferrer" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br>
</blockquote>
</div>
</div>
</div>
</span>
</body>
</html>