Hi guys,<div><br></div><div>To get a more flexible credit control when running several concurrent calls on the same user I'm trying to add some functionality to the call control module.</div><div><br></div><div>Basically what I'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'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 class="Apple-style-span" face="'courier new', monospace"> def __expire(self):</font></div>
<div><span class="Apple-style-span" style="font-family: 'courier new', monospace; "> rating = RatingEngineConnections.getConnection(self)</span></div><div><font class="Apple-style-span" face="'courier new', monospace"> rating.getCallLimit(self).addCallbacks(callback=self._reinit_simple_calllimit, errback=self._start_error)</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> """</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> self.expired = True</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> self.application.clean_call(self.callid)</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> self.end(reason='call control', sendbye=True)</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> """</font></div></div></div><div><br></div><div>In <font class="Apple-style-span" face="'courier new', monospace">_reinit_sample_calllimit</font> I mimic <font class="Apple-style-span" face="'courier new', monospace">_start_finish_calllimit</font> in a lot of ways, trying different timer combinations. I've tried with cancel followed by a new setup, I've tried delay, I've tried reset, I'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'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>