<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hi Paul,<div><br></div><div>I have reviewed the patch but is not going to be included the way it is currently written. The patch mixes in the same code path audio calls with text messages while the logic for them are completely different. In case of a message, there is nothing to start or to stop, no MaxSessionTime needs to be called in the rating engine either, is just a one shot DebitBalance operation.</div><div><div><div><div><br></div><div>OpenSIPS configuration&nbsp;</div><div><br></div><div>It should read something like:<br><div><div><br></div></div><div><font class="Apple-style-span" face="monospace"><span class="Apple-style-span" style="white-space: pre; "><div>if (is_method("MESSAGE")) {</div><div>&nbsp; &nbsp; debit_sms_balance();</div><div>&nbsp; &nbsp; switch ($retcode) {</div><div>&nbsp; &nbsp; case -1:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; xlog("L_INFO", "Call control: not enough credit for debit balance\n");</div><div>&nbsp; &nbsp; &nbsp; &nbsp; sl_send_reply("402", "Not enough credit");</div><div>&nbsp; &nbsp; &nbsp; &nbsp; exit;</div><div><br></div><div>    else allow message</div><div>       ...</div><div><br></div></span></font>Communication with Rating Engine</div><div><div><br></div><div>This should be a single debit balance function call instead of doing call_control_start() and&nbsp;call_control_sop()&nbsp;immediately after each other, which makes little to no sense. &nbsp;CDRTool already implements this SMS debit interface and is able to debit the balance based on its rating tables.&nbsp;</div><div><br></div><div>DebitBalance To=user@Domain &nbsp;From=number@domain application=SMS</div></div><div><br></div><div>If you are willing to modify it the patch along these lines we can advise further how and then we shall include it.</div><div><div><div></div></div></div><div><br></div><div>Regards,</div><div>Adrian</div></div></div></div></div></div><div><br></div><div><br></div><div><br></div><br><div><div>On Oct 14, 2012, at 8:53 AM, Paul Wise wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hi all,<br><br>At my last job we developed text messaging via SIP and OpenSIPS,<br>including billing with callcontrol. The company is now defunct and my<br>ex-boss has asked that I contribute these patches to OpenSIPS and<br>callcontrol. I've updated our patches so they apply to OpenSIPS SVN<br>trunk and callcontrol darcs head. The patches are attached, hopefully<br>they are useful to someone. To use them you want something like this:<br><br>if (is_method("MESSAGE")) {<br><span class="Apple-tab-span" style="white-space:pre">        </span>your SMS sending function here<br><span class="Apple-tab-span" style="white-space:pre">        </span>if( $avp(s:sms_status) == "accepted" ){<br><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>call_control_start();<br><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>call_control_stop();<br><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>t_reply("200", "OK");<br><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>exit;<br><span class="Apple-tab-span" style="white-space:pre">        </span>} else {<br><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>call_control_stop();<br><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>t_reply("500", "Error sending SMS");<br><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>exit;<br><span class="Apple-tab-span" style="white-space:pre">        </span>}<br>}<br><br>-- <br>bye,<br>pabs<br><br><a href="http://bonedaddy.net/pabs3/">http://bonedaddy.net/pabs3/</a><br><span>&lt;callcontrol-text-billing.patch&gt;</span><span>&lt;opensips-text-billing.patch&gt;</span>_______________________________________________<br>Users mailing list<br>Users@lists.opensips.org<br>http://lists.opensips.org/cgi-bin/mailman/listinfo/users<br></div></blockquote></div><br></body></html>