Diego,

the connector is just the translator between cdrtool and radius/openser, so no need of coding anything inside, but use that information inside openser to make a decision.
A good way to go would be an AVP check inside openser.cfg like:

check_value_of_ ($avp(s:credit)): (need to be replaced by real condition you want to match)
    $rU = "ann-insufficient_credit";

Cheers,
DanB


On Tue, Sep 30, 2008 at 10:38 PM, Diego Zuaneti Arruda <diego@fasternet.com.br> wrote:
 DanB,
 
  The problem was solved with the new version.
  I don't understand very well the python language.
  It's possible to return SIP-AVP = nocredit#1 when the user have no credits? So I can return a message to the user saying he has no credits.
 
 
 
Thanks again.
Diego.
----- Original Message -----
From: DanB
Sent: Tuesday, September 30, 2008 3:15 PM
Subject: Re: [Kamailio-Users] Send MaxCallDuration and UserCredit for freeradius-cdrtool

Hi Diego,

fixed now in pre2.

Cheers,
DanB

On Tue, Sep 30, 2008 at 5:58 PM, Diego Zuaneti Arruda <diego@fasternet.com.br> wrote:
  DanB,
 
   I'm testing the freeradius-cdrtool, and found a possible problem.
   When I turn off the call before answer, the session is not finished.
   Here's a part of the logs:
 
rlm_python [freeradius-cdrtool]: Entering accounting section
rlm_python [freeradius-cdrtool]: Got the following params: (('Acct-Status-Type', 'Failed'), ('Service-Type', 'Sip-Session'), ('Sip-Response-Code', '503'), ('Sip-Method', 'Invite'), ('X-Ascend-Bridge', '0x694de248a0b22d087cf199b7'), ('Sip-From-Tag', '"000d6570880e01462b3c62f9-0908d279"'), ('Acct-Session-Id', '"000d6570-880e0028-2a382841-1ef5c833@200.187.80.9"'), ('User-Name', '"87001@fastervoip.com.br"'), ('Calling-Station-Id', '"sip:87001@fastervoip.com.br"'), ('Called-Station-Id', '"sip:01591184701@fastervoip.com.br"'), ('Sip-Translated-Request-URI', '"sip:01591184701@200.187.80.17:5060;transport=udp"'), ('Sip-Rpid', '"87001"'), ('Source-IP', '"200.187.80.9"'), ('Source-Port', '"5070"'), ('Acct-Authentic', '49'), ('SIP-Proxy-IP', '"127.0.0.1"'), ('Canonical-URI', '"sip:01591184701@fastervoip.com.br"'), ('Billing-Party', '"87001@fastervoip.com.br"'), ('Contact', '"<sip:87001@200.187.80.9:5070;transport=udp>"'), ('NAS-Port', '5060'), ('Acct-Delay-Time', '0'), ('NAS-IP-Address', '127.0.0.1'), ('Client-IP-Address', '127.0.0.1'), ('Acct-Unique-Session-Id', '"3db548b64d9445ce"'))
rlm_python [freeradius-cdrtool]: Extracted atribute <Acct-Status-Type> with value <Failed>
rlm_python [freeradius-cdrtool]: Extracted atribute <User-Name> with value <87001@fastervoip.com.br>
rlm_python [freeradius-cdrtool]: Extracted atribute <Canonical-URI> with value <sip:01591184701@fastervoip.com.br>
rlm_python [freeradius-cdrtool]: Extracted atribute <Called-Station-Id> with value <sip:01591184701@fastervoip.com.br>
rlm_python [freeradius-cdrtool]: Extracted atribute <Acct-Session-Id> with value <000d6570-880e0028-2a382841-1ef5c833@200.187.80.9>
rlm_python:EXCEPT:<type 'exceptions.TypeError'>: end_session() takes exactly 6 arguments (4 given)
  modcall[accounting]: module "python" returns ?? for request 261
modcall: leaving group accounting (returns ok) for request 261
Sending Accounting-Response of id 147 to 127.0.0.1 port 41560
Finished request 261
 
 
Diego.
----- Original Message -----
From: DanB
Sent: Tuesday, September 30, 2008 11:54 AM
Subject: Re: [Kamailio-Users] Send MaxCallDuration and UserCredit for freeradius-cdrtool

"The avps received will be available in openser as: callMaxDur and credit, where callMaxDur is the maximum duration the user is allowed to be connected with the destination and credit represents the amount of credit available at starting of the call. This info can be used later in an bbua able to timeout calls based on duration.
"

On Tue, Sep 30, 2008 at 4:38 PM, Diego Zuaneti Arruda <diego@fasternet.com.br> wrote:
  Thanks DanB, the problem was solved.
  How send BYE when expires credit in conversation?
 
 
Thanks.
Diego.
----- Original Message -----
From: DanB
Sent: Tuesday, September 30, 2008 11:19 AM
Subject: Re: [Kamailio-Users] Send MaxCallDuration and UserCredit for freeradius-cdrtool

Here is an already patched version:
http://frad-cdrtool.sourceforge.net/rlm_digest.c
You should replace your rlm_digest.c with this one and recompile the server.

DanB

On Tue, Sep 30, 2008 at 4:14 PM, Diego Zuaneti Arruda <diego@fasternet.com.br> wrote:
  I'm using the freeradius 1.1.7, and not patched the rlm_digest.
  Where to find the patch rlm_digest ?
 
 
Diego.
----- Original Message -----
From: DanB
Sent: Tuesday, September 30, 2008 11:08 AM
Subject: Re: [Kamailio-Users] Send MaxCallDuration and UserCredit for freeradius-cdrtool

Diego,

the problem is with your digest module which is sanitizing the  parameters in authentication phase only, therefore the parameters like Username, Digest-URI are not available in the authorization phase (no way for the connector to read them).
Did u patch your rlm_digest as per the README.txt? What version of freeradius are u using?

DanB

On Tue, Sep 30, 2008 at 3:56 PM, Diego Zuaneti Arruda <diego@fasternet.com.br> wrote:
  DanB,
 
   Yes, I changed the kamailio.cfg.
   I´m sending the full log of radius attached.
 
 
Diego.
----- Original Message -----
From: DanB
Sent: Tuesday, September 30, 2008 10:34 AM
Subject: Re: [Kamailio-Users] Send MaxCallDuration and UserCredit for freeradius-cdrtool

Diego,

looks like there was no session started at first place.
Did u change the openser.cfg config? You need to add callid into radius_proxy_authorize so that the callid should be used (example in README.txt of the freeradius-cdrtool sources).

Also, can u post a full authorize/account_start/account_stop sequence as logged by "radiusd -X".

DanB
On Tue, Sep 30, 2008 at 3:00 PM, Diego Zuaneti Arruda <diego@fasternet.com.br> wrote:
  Hi DanB,
 
I updated the CDRTool to version 6.6.8 and freeradius-cdrtool to version 1.2-pre.
I'm getting this log and not doing the Debit.
 
Sep 30 09:57:22 sipserver1 cdrtool[12948]: DebitBalance CallId=000d6570-880e0035-39c8f267-5c77e9d2@192.168.0.1 From=87001@mydomain.com.br To=sip:00551599998888@mydomain.com.br Gateway=127.0.0.1 Duration=11
Sep 30 09:57:22 sipserver1 cdrtool[12948]: ConnectFee=0.00 Span=1 Duration=60 DestId=55159 domain=mydomain.com.br Profile=551 Period=weekday Rate=551 Interval=0-24 Cost=0.85/60 Price=0.8500
Sep 30 09:57:22 sipserver1 cdrtool[12948]: Error: session 000d6570-880e0035-39c8f267-5c77e9d2@192.168.0.1 for 87001@mydomain.com.br does not exist
 
 
Thanks.
Diego.
----- Original Message -----
From: DanB
Sent: Tuesday, September 30, 2008 5:47 AM
Subject: Re: [Kamailio-Users] Send MaxCallDuration and UserCredit for freeradius-cdrtool

Hi Diego,

you don't need to set anything in Users file. The connector does that for you dynamically, based on the responses received from cdrtool. Your configuration will be static and always limit the user to the same call duration. For more information, see the README file within freeradius-cdrtool source directory.

Cheers,
DanB

On Mon, Sep 29, 2008 at 10:49 PM, Diego Zuaneti Arruda <diego@fasternet.com.br> wrote:
  Hi all,
 
   How I send to freeradius-cdrtool the maxCallDuration and UserCredit?
   On the /etc/raddb/users I have:
 
87001@mydomain.com.br Auth-Type := Digest, User-Password == "mypassword"
        Reply-Message = "Authenticated",
        SIP-AVP = "authentic#1",
        SIP-AVP = "callMaxDur:60",
        SIP-AVP = "credit:25"
 
   Is this correct ?
 
 
 
Thanks.
Diego.
 

_______________________________________________
Users mailing list
Users@lists.kamailio.org
http://lists.kamailio.org/cgi-bin/mailman/listinfo/users