Hi Adrian,<div><br></div><div>I struggle to figure out how the MaxSessionTime for new calls are calculated. As a simple example, have a first session ask for 3600s. Then a second session does the same directly thereafter, with the same rate (for simplicity), but credit is low and only 2000s is allowed. How does call control figure out that both calls should end after 2800 seconds?</div>

<div><br></div><div>Even more importantly to me is what happens when a third call is entered into the mix. The credit is now at 0, is this call established?</div><div><br></div><div>What I&#39;m trying to achieve right here is handling multiple sessions without blocking the credit. By having call control re-ask for MaxSessionTime after a shorter time-period (60s), blocking will not occur to such a large degree.</div>

<div><br></div><div>Is this a bad way of doing it? I&#39;m actually trying to integrate this with a 3rd party rating engine that supports this schema as I believe it&#39;s a good way of handling multiple sessions.</div><div>

<br></div><div>Cheers,</div><div>Magnus<br><br><div class="gmail_quote">2010/6/18 Adrian Georgescu <span dir="ltr">&lt;<a href="mailto:ag@ag-projects.com">ag@ag-projects.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div style="word-wrap:break-word">The call control engine + rating engine already supports multiple parallel prepaid sessions per user, all calls stop when the balance reaches zero.<div><br></div><div>What do you try to achieve?</div>

<div><br></div><div>Adrian</div><div><br><div><br></div><div><div><div><div><div></div><div class="h5"><div>On Jun 18, 2010, at 4:56 PM, Magnus Burman wrote:</div><br></div></div><blockquote type="cite"><div><div></div><div class="h5">

Hi guys,<div><br></div><div>To get a more flexible credit control when running several concurrent calls on the same user I&#39;m trying to add some functionality to the call control module.</div><div><br></div><div>Basically what I&#39;m trying to do is set a low time limit, such as 60 seconds, and when the timer runs out send a new getCallLimit, until the call ends either by a return of 0 or by hangup.</div>



<div><br></div><div>I&#39;ve been trying to do this by adding a new getCallLimit in the Call.__expire method in sip.py. </div><div><br></div><div><div><div><font face="&#39;courier new&#39;, monospace">    def __expire(self):</font></div>



<div><span style="font-family:&#39;courier new&#39;, monospace">        rating = RatingEngineConnections.getConnection(self)</span></div><div><font face="&#39;courier new&#39;, monospace">        rating.getCallLimit(self).addCallbacks(callback=self._reinit_simple_calllimit, errback=self._start_error)</font></div>



<div><font face="&#39;courier new&#39;, monospace">        &quot;&quot;&quot;</font></div><div><font face="&#39;courier new&#39;, monospace">        self.expired = True</font></div>

<div><font face="&#39;courier new&#39;, monospace">        self.application.clean_call(self.callid)</font></div><div><font face="&#39;courier new&#39;, monospace">        self.end(reason=&#39;call control&#39;, sendbye=True)</font></div>



<div><font face="&#39;courier new&#39;, monospace">        &quot;&quot;&quot;</font></div></div></div><div><br></div><div>In <font face="&#39;courier new&#39;, monospace">_reinit_sample_calllimit</font> I mimic <font face="&#39;courier new&#39;, monospace">_start_finish_calllimit</font> in a lot of ways, trying different timer combinations. I&#39;ve tried with cancel followed by a new setup, I&#39;ve tried delay, I&#39;ve tried reset, I&#39;ve tried manually doing a new ReactorTimer and all of the above!</div>



<div><br></div><div>I get the MaxSessionTime call to work, but I fail with the timer somehow. __expire is never called again after the first time, and the call is never interrupted.</div><div><br></div><div>Anyone with tips? At this point I&#39;m about to dive into the twisted framework and reactors, but any hints are much appreciated!</div>



<div><br></div><div>Cheers,<br>Magnus</div></div></div>
_______________________________________________<br>Users mailing list<br><a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br><a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>

</blockquote></div><br></div></div></div></div><br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br></blockquote></div><br></div>