[OpenSER-Users] Fwd: Prepaid acounts CDRTool

Dan-Cristian Bogos dan.bogos at gmail.com
Wed Aug 22 17:29:41 CEST 2007


You are getting this error because the interpreter does not accept "-"
in the name. I didn't need to import it in the interpreter and there
will be no use since radiusd package is available only within
freeradius process.

Thxs,
DanB

On 8/22/07, Marc LEURENT <lftsy at free.fr> wrote:
> Do you have this error?
> When I try to load your module in mython, I have this error because of the dash..
>
>
> root at sd-7501:[/home/../freeradius-cdrtool-1.0]# python
> Python 2.4.4 (#2, Apr  5 2007, 20:11:18)
> [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import freeradius-cdrtool
>   File "<stdin>", line 1
>     import freeradius-cdrtool
>                      ^
> SyntaxError: invalid syntax
> >>> import setup
> usage:  [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
>    or:  --help [cmd1 cmd2 ...]
>    or:  --help-commands
>    or:  cmd --help
>
> error: no commands supplied
> zsh: exit 1     python
>
> Dan-Cristian Bogos a écrit :
> > Marc,
> >
> > This is still an error from python, not my module. I think it has
> > something to do with linking inside between C and python. What were
> > the steps in your freeradius installation?
> >
> > DanB
> >
> > On 8/22/07, Marc LEURENT <lftsy at free.fr> wrote:
> >> I have compiled the experimental modules, now the python module is working but I have an error with yours...
> >> I have changed the rlm_digest.c and fixed the sql module to work with procedure
> >>
> >> rlm_sql (sql): Connected new DB handle, #4
> >> Module: Instantiated sql (sql)
> >> python_init done
> >> Module: Loaded python
> >>  python: mod_instantiate = "freeradius-cdrtool"
> >>  python: func_instantiate = "instantiate"
> >>  python: mod_authorize = "freeradius-cdrtool"
> >>  python: func_authorize = "authorize"
> >>  python: mod_authenticate = "(null)"
> >>  python: func_authenticate = "(null)"
> >>  python: mod_preacct = "(null)"
> >>  python: func_preacct = "(null)"
> >>  python: mod_accounting = "freeradius-cdrtool"
> >>  python: func_accounting = "accounting"
> >>  python: mod_checksimul = "(null)"
> >>  python: func_checksimul = "(null)"
> >>  python: mod_detach = "freeradius-cdrtool"
> >>  python: func_detach = "detach"
> >> exceptions.ImportError: /usr/lib/python2.4/lib-dynload/_socket.so: undefined symbol: _Py_TrueStruct
> >> Failed to import python module "freeradius-cdrtool"
> >> radiusd.conf[544]: python: Module instantiation failed.
> >> radiusd.conf[1884] Unknown module "python".
> >> radiusd.conf[1792] Failed to parse authorize section.
> >> zsh: exit 1     freeradius -X
> >>
> >>
> >>
> >>
> >> Dan-Cristian Bogos a écrit :
> >>> You can get it from here:
> >>> http://frad-cdrtool.sourceforge.net/rlm_digest.c
> >>>
> >>> DanB
> >>>
> >>> On 8/22/07, Marc LEURENT <lftsy at free.fr> wrote:
> >>>> I haven't found this patch on http://sourceforge.net/projects/frad-cdrtool...
> >>>> Where did you found it?
> >>>> Thanks
> >>>>
> >>>> Dan-Cristian Bogos a écrit :
> >>>>> Marc,
> >>>>>
> >>>>> I don't have this problem.
> >>>>> I have compiled freeradius with rlm_python from sources.
> >>>>>
> >>>>> For problems with freeradius, I think the best would be to grab some
> >>>>> support directly from their mailing list, since they are pretty
> >>>>> helpful. Don't forget about patching also rlm_digest in order to
> >>>>> sanitize the params coming from OpenSER in the authorization phase and
> >>>>> not the authentication one. They promised for future releases to
> >>>>> include this patch inside the distribution.
> >>>>>
> >>>>> Cheers,
> >>>>> DanB
> >>>>>
> >>>>>
> >>>>> On 8/22/07, Marc LEURENT <lftsy at free.fr> wrote:
> >>>>>> I have corrected it: mea culpa
> >>>>>>
> >>>>>> But now I have a real trouble:
> >>>>>> When I start freeradius, it said that it can't find rlm_python.so, but this is normal because we added --with-static-modules=python
> >>>>>>
> >>>>>>
> >>>>>> Did you have thos problem?
> >>>>>> Do you know how to correct it?
> >>>>>>
> >>>>>> Thanks
> >>>>>>
> >>>>>> rlm_sql (sql): Connected new DB handle, #4
> >>>>>> Module: Instantiated sql (sql)
> >>>>>> radiusd.conf[544] Failed to link to module 'rlm_python': rlm_python.so: cannot open shared object file: No such file or directory
> >>>>>> radiusd.conf[1884] Unknown module "python".
> >>>>>> radiusd.conf[1792] Failed to parse authorize section.
> >>>>>> zsh: exit 1     freeradius -X
> >>>>>>
> >>>>>>
> >>>>>> Dan-Cristian Bogos a écrit :
> >>>>>>> Hi Marc,
> >>>>>>>
> >>>>>>> it looks like you are getting some problems related to stored
> >>>>>>> procedure in your mysql database. Did u install also the radius patch
> >>>>>>> recommended by AG-Projects in order to work properly with stored
> >>>>>>> procedures? On the sql side I cannot help you too much since I am
> >>>>>>> using still the normal sql queries without stored procedures.
> >>>>>>>
> >>>>>>> DanB
> >>>>>>>
> >>>>>>> On 8/22/07, Marc LEURENT <lftsy at free.fr> wrote:
> >>>>>>>> I have followed your advice, Freeradius is recompiled with rlm_python,
> >>>>>>>> byt know, rlm_sql seems to encountered troubles
> >>>>>>>> like :
> >>>>>>>>
> >>>>>>>> rlm_sql (sql): Reserving sql socket id: 2
> >>>>>>>> rlm_sql_mysql: MYSQL check_error: 1312 received
> >>>>>>>>
> >>>>>>>> Any idea of how to repair this?
> >>>>>>>> Thanks
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> I have added this in my debian/rules file:
> >>>>>>>>
> >>>>>>>> modulelist=krb5 ldap sql_mysql sql_iodbc python
> >>>>>>>> ...
> >>>>>>>> ...
> >>>>>>>>         ./configure \
> >>>>>>>>                 $(confflags) \
> >>>>>>>>                 --prefix=/usr \
> >>>>>>>>                 ... \
> >>>>>>>>                 --with-static-modules=python
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> Here is my freeradius debug:
> >>>>>>>>
> >>>>>>>> rlm_detail: /var/log/freeradius/radacct/%{Client-IP-Address}/detail-%Y%m%d expands to /var/log/freeradius/radacct/127.0.0.1/detail-20070822
> >>>>>>>>   modcall[accounting]: module "detail" returns ok for request 5
> >>>>>>>>   modcall[accounting]: module "unix" returns noop for request 5
> >>>>>>>> radius_xlat:  '/var/log/freeradius/radutmp'
> >>>>>>>> radius_xlat:  ''
> >>>>>>>>   modcall[accounting]: module "radutmp" returns ok for request 5
> >>>>>>>> radius_xlat:  ''
> >>>>>>>> radius_xlat:  '          CALL insert_radacct_record(                 'radius',                 '52f74a-c0a80101-0-4 at 192.168.95.79',
> >>>>>>>> '36afb36cd5c82c34',                 'sip:101 at sd-7501.dedibox.fr:5060=3Buser=3Dphone',
> >>>>>>>> 'sip:101 at sd-7501.dedibox.fr:5060=3Buser=3Dphone',                 '88.191.45.91',                 '5060',                 '2007-08-22 13:59:25',
> >>>>>>>>            '0',                 '0',                 '0',                 '0',                 '',                 '',                 '200',
> >>>>>>>>         'Sip-Session',                 '',                 '',                 '0',                 '0',                 '200',
> >>>>>>>> 'INVITE',                 '',                 'c0a80101-5766ea7',                 'c0a80101-4e8244',                 '',                 '',
> >>>>>>>>        '',                 'sip:0033677832974 at sd-7501.dedibox.fr:5060=3Buser=3Dphone',                 '',                 ''                 )'
> >>>>>>>> rlm_sql (sql): Reserving sql socket id: 2
> >>>>>>>> rlm_sql_mysql: MYSQL check_error: 1312 received
> >>>>>>>> rlm_sql (sql): Couldn't insert SQL accounting START record - PROCEDURE radius.insert_radacct_record can't return a result set in the given context
> >>>>>>>> radius_xlat:  ''
> >>>>>>>> rlm_sql (sql): Released sql socket id: 2
> >>>>>>>>   modcall[accounting]: module "sql" returns ok for request 5
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> Dan-Cristian Bogos a écrit :
> >>>>>>>>> Marc,
> >>>>>>>>>
> >>>>>>>>> I would suggest as first step reading about how  prepaid works in
> >>>>>>>>> CDRTool. (see PREPAID.txt in doc folder).
> >>>>>>>>>
> >>>>>>>>> I personally use freeradius-cdrtool connector
> >>>>>>>>> (sourceforge.net/projects/frad-cdrtool), which I have written in
> >>>>>>>>> python and which needs rlm_python compiled into freeradius server.
> >>>>>>>>>
> >>>>>>>>> Have a look on all the info and let me know if u need any additional.
> >>>>>>>>>
> >>>>>>>>> Cheers,
> >>>>>>>>> DanB
> >>>>>>>>>
> >>>>>>>>> On 8/20/07, Marc LEURENT <lftsy at free.fr> wrote:
> >>>>>>>>>> No...
> >>>>>>>>>> Is it possible to do it with openser or is it compulsory to use asterisk?
> >>>>>>>>>> What do you use?
> >>>>>>>>>>
> >>>>>>>>>> Thanks
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>> Dan-Cristian Bogos a écrit :
> >>>>>>>>>>> Hi there Marc,
> >>>>>>>>>>>
> >>>>>>>>>>> are you using any application which locks, unlocks the prepaid
> >>>>>>>>>>> accounts, and instructs CDRTool to update the user's balance? Are you
> >>>>>>>>>>> aware that CDRTool uses separate applications for prepaid and postpaid
> >>>>>>>>>>> accounts?
> >>>>>>>>>>>
> >>>>>>>>>>> DanB
>




More information about the Users mailing list