[Serusers] Radius logging and telco calls

Alessio Focardi afoc at interconnessioni.it
Thu Apr 1 17:09:49 CEST 2004


Hello Klaus,

Thursday, April 1, 2004, 4:46:36 PM, you wrote:

you where right, I was stupid :) TNX !

now I have byes logged, but strangely I get 2 radius entry for each
invite ... perfectly equal !

an example of call logs:

hu Apr  1 15:59:46 2004
        Acct-Status-Type = Failed
        Service-Type = Sip-Session
        Sip-Response-Code = 0
        Sip-Method = 1
        User-Name = "300300 at mydomain.com"
        Calling-Station-Id = "sip:300300 at mydomain.com"
        Called-Station-Id = "sip:0190 at mydomain.com"
        Sip-Translated-Req-ID = "sip:0190 at mydomain.com"
        Acct-Session-Id = "3274C566-B0AC-44C5-B5DB-D7BA8A08902C at 192.168.0.157"
        Sip-To-Tag = "n/a"
        Sip-From-Tag = "3523280348"
        Sip-Cseq = "31534"
        NAS-IP-Address = 192.168.0.230
        NAS-Port = 5060
        Acct-Delay-Time = 0
        Client-IP-Address = 192.168.0.230
        Acct-Unique-Session-Id = "e98c50261d9120cf"
        Timestamp = 1080827986

Thu Apr  1 15:59:46 2004
        Acct-Status-Type = Failed
        Service-Type = Sip-Session
        Sip-Response-Code = 0
        Sip-Method = 1
        User-Name = "300300 at mydomain.com"
        Calling-Station-Id = "sip:300300 at mydomain.com"
        Called-Station-Id = "sip:0190 at mydomain.com"
        Sip-Translated-Req-ID = "sip:0190 at mydomain.com"
        Acct-Session-Id = "3274C566-B0AC-44C5-B5DB-D7BA8A08902C at 192.168.0.157"
        Sip-To-Tag = "n/a"
        Sip-From-Tag = "3523280348"
        Sip-Cseq = "31535"
        NAS-IP-Address = 192.168.0.230
        NAS-Port = 5060
        Acct-Delay-Time = 0
        Client-IP-Address = 192.168.0.230
        Acct-Unique-Session-Id = "e98c50261d9120cf"
        Timestamp = 1080827986

Thu Apr  1 15:59:57 2004
        Acct-Status-Type = Failed
        Service-Type = Sip-Session
        Sip-Response-Code = 0
        Sip-Method = 8
        User-Name = "300300 at mydomain.com"
        Calling-Station-Id = "sip:300300 at mydomain.com"
        Called-Station-Id = "sip:0190 at mydomain.com"
        Sip-Translated-Req-ID = "sip:0190 at 192.168.0.230:5090"
        Acct-Session-Id = "3274C566-B0AC-44C5-B5DB-D7BA8A08902C at 192.168.0.157"
        Sip-To-Tag = "as60ec7890"
        Sip-From-Tag = "3523280348"
        Sip-Cseq = "31536"
        NAS-IP-Address = 192.168.0.230
        NAS-Port = 5060
        Acct-Delay-Time = 0
        Client-IP-Address = 192.168.0.230
        Acct-Unique-Session-Id = "e98c50261d9120cf"
        Timestamp = 1080827997



my cfg



if (uri==myself) {

                                        


                if (method=="INVITE") {
                                        
                                        
                                        setflag(1); 
                                        acc_rad_request("Registrazione INVITE");
                                        record_route();                 

                                               
                
                                        if (uri=~"sip:0[0-9]+@"){
                                
                                        if (!proxy_authorize("mydomain.com", "subscriber")) {proxy_challenge("mydomain.com", "0");sl_send_reply("403", "That's not your home");break;}; #fine proxy challenge
                                        if (!is_user_in("credentials", "local")){sl_send_reply("403", "No permission for local calls");break;}; #fine invite                               
                
                                        rewritehostport("sip.mydomain.com:5090");
                                        t_relay();
                                        break;
                                
                                        }; #fine if uri sip:0          
                
                
        if (!lookup("location")) {sl_send_reply("404", "Not Found");break;}; #fine if lookup location
        
                
                                        }; #fine invite
                }; #fine myself
                
                


KD> you have to set the accounting flag also for the bye message.

KD>   if (method=="BYE") {
KD>                  setflag(1);
KD>                  acc_rad_request("Some comment");
KD> };

KD> regards,
KD> klaus

KD> Alessio Focardi wrote:

>> Hi friends,
>> 
>> we recently added an isdn card to our asterisk/ser server.
>> 
>> to keep track of outbound calls I have set up a radius server, I
>> would like to log every pstn call.
>> 
>> Problem is that I get start logged, but no call end.
>> 
>> this is ser.cfg part of the trick
>> 
>>  if (method=="INVITE") {
>>        
>>         if (uri==myself) {
>> 
>>                 
>>                 if (uri=~"sip:0[0-9]+@"){
>>                                 
>>                 setflag(1);
>>                 acc_rad_request("Some comment");
>>                 record_route();                 
>>                 rewritehostport("sip.mydomain.com:5090");
>>                 t_relay_to_udp("127.0.0.1", "5090");
>>                 break;
>>                                 
>>                 }; #fine if uri sip:0          
>> 
>> as you can see there is an asterisk listening on port 5090 (same
>> machine) that strips the leading 0 from every call and then forward to
>> the pstn ....
>> 
>> I suppose maybe t_relay_to_udp is not the right forward type ... do I
>> have to append brach or something like ?
>> 
>> Tnx for any help !
>> 



-- 
Best regards,
 Alessio                            mailto:afoc at interconnessioni.it





More information about the sr-users mailing list