Skip to content

Instantly share code, notes, and snippets.

@leedm777
Created February 10, 2014 23:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leedm777/8926025 to your computer and use it in GitHub Desktop.
Save leedm777/8926025 to your computer and use it in GitHub Desktop.
Wed Feb 12 13:44:23 CST 2014 David M. Lee <dlee@digium.com>
* sip-application-type
Pass along the application field from the call_control module to the
prepaid rating engine.
diff -rN -u old-callcontrol/callcontrol/rating.py new-callcontrol/callcontrol/rating.py
--- old-callcontrol/callcontrol/rating.py 2014-02-12 13:47:09.000000000 -0600
+++ new-callcontrol/callcontrol/rating.py 2014-02-12 13:47:09.000000000 -0600
@@ -288,7 +288,8 @@
if call.inprogress:
args['State'] = 'Connected'
req = RatingRequest('MaxSessionTime', reliable=reliable, CallId=call.callid, From=call.billingParty, To=call.ruri,
- Gateway=call.sourceip, Duration=max_duration, **args)
+ Gateway=call.sourceip, Duration=max_duration,
+ Application=call.sip_application, **args)
if self.connection is not None:
return self.connection.protocol.send_request(req).deferred
else:
@@ -297,7 +298,8 @@
def debitBalance(self, call, reliable=True):
req = RatingRequest('DebitBalance', reliable=reliable, CallId=call.callid, From=call.billingParty, To=call.ruri,
- Gateway=call.sourceip, Duration=call.duration)
+ Gateway=call.sourceip, Duration=call.duration,
+ Application=call.sip_application)
if self.connection is not None:
return self.connection.protocol.send_request(req).deferred
else:
diff -rN -u old-callcontrol/callcontrol/sip.py new-callcontrol/callcontrol/sip.py
--- old-callcontrol/callcontrol/sip.py 2014-02-12 13:47:09.000000000 -0600
+++ new-callcontrol/callcontrol/sip.py 2014-02-12 13:47:09.000000000 -0600
@@ -109,6 +109,7 @@
self.ruri = request.ruri
self.sourceip = request.sourceip
self.token = request.call_token
+ self.sip_application = request.application # application is used below
self['from'] = request.from_ ## from is a python keyword
## Determine who will pay for the call
if self.diverter is not None:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment