Hi,
So just to start at the beginning, from the scripts I can see that
there are di method calls to ServerProxy but in my sems log I don't see
that any of these have loaded.
Should there be methods for get_credit, subtractcredit etc. loaded with
xmlrpc server in some way? I suspect there is an xmlserver.pl that runs
and has this info in it but want to make sure before I go hunting for
it ;)
INFO: SBC: prepaid enabled
INFO: SBC: acc_module = 'cc_acc'
INFO: SBC: uuid = '$H(P-Caller-Uuid)'
INFO: SBC: acc_dest = '$H(P-Acc-Dest)'
INFO: SBC: active profile: 'custom,'
INFO: stats server listening on 127.0.0.1:5040
INFO: XMLRPC Server: Enabling builtin method 'di'.
INFO: XMLRPC Server: enabled builtin method 'calls'
INFO: XMLRPC Server: enabled builtin method 'get_loglevel'
INFO: XMLRPC Server: enabled builtin method 'set_loglevel'
INFO: XMLRPC Server: enabled builtin method 'get_shutdownmode'
INFO: XMLRPC Server: enabled builtin method 'set_shutdownmode'
INFO: XMLRPC Server: enabled builtin method 'get_callsavg'
INFO: XMLRPC Server: enabled builtin method 'get_callsmax'
INFO: XMLRPC Server: enabled builtin method 'get_cpsavg'
INFO: XMLRPC Server: enabled builtin method 'get_cpsmax'
INFO: XMLRPC Server: enabling method 'dial'
INFO: XMLRPC Server: enabling method 'di_dial.dial'
INFO: XMLRPC Server: enabling method 'dial_auth'
INFO: XMLRPC Server: enabling method 'di_dial.dial_auth'
INFO: XMLRPC Server: enabling method 'dial_auth_b2b'
INFO: XMLRPC Server: enabling method 'di_dial.dial_auth_b2b'
INFO: XMLRPC Server: enabling method 'dial_pin'
INFO: XMLRPC Server: enabling method 'di_dial.dial_pin'
INFO: XMLRPC Server: enabling method 'help'
INFO: XMLRPC Server: enabling method 'di_dial.help'
INFO: Initialized XMLRPC2DIServer with:
INFO: IP = ANY port = 8090
On Wed, 2011-08-24 at 14:39 -0700, Skyler wrote:
> Hi Stefan,
>
> Wow. I never would have figured all this was needed. Thank you, I will
> absorb this and try it out.
>
> S.
>
> On Wed, 2011-08-24 at 23:09 +0200, Stefan Sayer wrote:
> > Hello,
> >
> > the cc_acc module has an internal database of credits (measured in
> > seconds) for the different users (PINs, IDs, ...).
> >
> > You can add or set credit to users (PINs, IDs, ...) with the DI
> > functions, setCredit(user, credit) and addCredit(user, credit), e.g.
> > by XMLRPC.
> >
> > If the user is not found, you'll receive -1 as credit and the 500
> > response.
> >
> > Below some scripts to manage that internal database, load xmlrpc2di
> > module to access those functions.
> >
> > --- sems-acc-set-credit ---
> > #!/usr/bin/python
> > # -*- coding: utf-8 -*-
> > import sys
> > from xmlrpclib import *
> >
> > if len(sys.argv) != 3:
> > print "usage: %s <user> <credit>" % sys.argv[0]
> > sys.exit(1)
> >
> > s = ServerProxy('http://localhost:8090')
> > print "Active calls: %d" % s.calls()
> > print s.di('cc_acc','setCredit', sys.argv[1], sys.argv[2])
> >
> > --- sems-acc-add-credit ---
> > #!/usr/bin/python
> > # -*- coding: utf-8 -*-
> > import sys
> > from xmlrpclib import *
> >
> > if len(sys.argv) != 3:
> > print "usage: %s <user> <credit>" % sys.argv[0]
> > sys.exit(1)
> >
> > s = ServerProxy('http://localhost:8090')
> > print "Active calls: %d" % s.calls()
> > print s.di('cc_acc','addCredit', sys.argv[1], sys.argv[2])
> >
> >
> > --- sems-acc-subtract-credit ---
> > #!/usr/bin/python
> > # -*- coding: utf-8 -*-
> > import sys
> > from xmlrpclib import *
> >
> > if len(sys.argv) != 3:
> > print "usage: %s <user> <credit>" % sys.argv[0]
> > sys.exit(1)
> >
> > s = ServerProxy('http://localhost:8090')
> > print "Active calls: %d" % s.calls()
> > print s.di('cc_acc','subtractCredit', sys.argv[1], sys.argv[2])
> >
> > --- sems-acc-get-credit ---
> > #!/usr/bin/python
> > # -*- coding: utf-8 -*-
> > import sys
> > from xmlrpclib import *
> >
> > if len(sys.argv) != 2:
> > print "usage: %s <user>" % sys.argv[0]
> > sys.exit(1)
> >
> > s = ServerProxy('http://localhost:8090')
> > print "Active calls: %d" % s.calls()
> > print s.di('cc_acc','getCredit', sys.argv[1])
> >
> > Alternatively, e.g. if you want to fetch the credits from a server via
> > XMLRPC, use the cc_acc_xmlrpc module.
> >
> > hth
> > Stefan
> >
> > o Skyler on 08/24/2011 10:23 PM:
> > > Hi all,
> > >
> > > I'm stuck trying to figure out how the cc_acc module fetches credit. I
> > > haven't found any docs or examples describing 'where' to tell the module
> > > to look and see if credit is available. ngrep is below, the proper HF's
> > > are being sent through but I still am not 100% sure I understand 'how'
> > > the cc_acc module works when 'Fetching credit'.
> > >
> > > 500 response is what I get at the moment and sems.log shows:
> > >
> > > [onInvite, SBC.cpp:691] ERROR: Failed to fetch credit from accounting
> > > module
> > > [onSipRequest, AmSession.cpp:855] ERROR: 500 Server Internal
> > > Error
> > >
> > > Am I missing a piece to this puzzle?
> > >
> > > Any help is appreciated.
> > >
> > > TIA,
> > >
> > > Skyler
> > >
_______________________________________________
Sems mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/sems