opensips1.6.4+freeradius2.1.10+radiusclient0.5.6 problem do accounting

大家好:

我在做sip服务器的计费系统,选用的是开源的软件 opensips+freeradius+radiusclient,其中opensips是sip服务器,freeradius是计费系统的服务器,radiusclient是计费系统的客户端,当使用注册在opensips上的sip客户端通话的时候,opensips可以通过radiusclient和freeradius取得联系,实施计费的启动与停止,我想做过的大家懂得,不用我多说。

我的问题是,计费开始的条件,应该是opensips收到invite消息之后的ack消息时,但是我的freeradius在opensips收到invite消息后就有响应了,opensips收到ack消息时,又会有响应,opensips收到bye消息后,freeradius却没有响应了,freeradius具体的响应信息如下:

INVITE消息的响应信息:
  rad_recv: Accounting-Request packet from host 192.168.118.39 port 48558, id=171, length=288
        Acct-Status-Type = Start
        Service-Type = IAPP-Register
        EAP-Key-Name = "\000\000\000\310"
        Error-Cause = Invite
        Attr-55 = 0x4d34167a
        Sip-From-Tag = "d1125638"
        Sip-To-Tag = "b9e655f1f8cd47c28cddc4253a16adf5"
        Acct-Session-Id = "OTgyZjkxZDEzZjM1MTMxMWI5NDcyMjcxNGQ0ZDkzODk."
        User-Name = "[email protected]"
        Calling-Station-Id = "sip:[email protected]"
        Called-Station-Id = "sip:[email protected]"
        Sip-Translated-Request-URI = "sip:192.168.118.41:11520"
        Attr-223 = 0x3c7369703a33393032403139322e3136382e3131382e34313a34303031323e
        NAS-Port = 5060
        Acct-Delay-Time = 0
        NAS-IP-Address = 192.168.118.39
# Executing section preacct from file /usr/local/etc/raddb/sites-enabled/default
+- entering group preacct {...}
++[preprocess] returns ok
[acct_unique] Hashing 'NAS-Port = 5060,Client-IP-Address = 192.168.118.39,NAS-IP-Address = 192.168.118.39,Acct-Session-Id = "OTgyZjkxZDEzZjM1MTMxMWI5NDcyMjcxNGQ0ZDkzODk.",User-Name = "[email protected]"'
[acct_unique] Acct-Unique-Session-ID = "3508789790db359a".
++[acct_unique] returns ok
[suffix] Looking up realm "192.168.118.39" for User-Name = "[email protected]"
[suffix] No such realm "192.168.118.39"
++[suffix] returns noop
++[files] returns noop
# Executing section accounting from file /usr/local/etc/raddb/sites-enabled/default
+- entering group accounting {...}
[detail]        expand: /usr/local/var/log/radius/radacct/%{Client-IP-Address}/detail-%Y%m%d -> /usr/local/var/log/radius/radacct/192.168.118.39/detail-20110117
[detail] /usr/local/var/log/radius/radacct/%{Client-IP-Address}/detail-%Y%m%d expands to /usr/local/var/log/radius/radacct/192.168.118.39/detail-20110117
[detail]        expand: %t -> Mon Jan 17 18:14:18 2011
++[detail] returns ok
++[unix] returns ok
[radutmp]       expand: /usr/local/var/log/radius/radutmp -> /usr/local/var/log/radius/radutmp
[radutmp]       expand: %{User-Name} -> [email protected]
++[radutmp] returns ok
++[exec] returns noop
[attr_filter.accounting_response]       expand: %{User-Name} -> [email protected]
 attr_filter: Matched entry DEFAULT at line 12
++[attr_filter.accounting_response] returns updated
Sending Accounting-Response of id 171 to 192.168.118.39 port 48558
Finished request 0.
Cleaning up request 0 ID 171 with timestamp +75
Going to the next request
Ready to process requests.
ACK消息的响应:

  rad_recv: Accounting-Request packet from host 192.168.118.39 port 48558, id=171, length=288
        Acct-Status-Type = Start
        Service-Type = IAPP-Register
        EAP-Key-Name = "\000\000\000\310"
        Error-Cause = Invite
        Attr-55 = 0x4d34167a
        Sip-From-Tag = "d1125638"
        Sip-To-Tag = "b9e655f1f8cd47c28cddc4253a16adf5"
        Acct-Session-Id = "OTgyZjkxZDEzZjM1MTMxMWI5NDcyMjcxNGQ0ZDkzODk."
        User-Name = "[email protected]"
        Calling-Station-Id = "sip:[email protected]"
        Called-Station-Id = "sip:[email protected]"
        Sip-Translated-Request-URI = "sip:192.168.118.41:11520"
        Attr-223 = 0x3c7369703a33393032403139322e3136382e3131382e34313a34303031323e
        NAS-Port = 5060
        Acct-Delay-Time = 0
        NAS-IP-Address = 192.168.118.39
# Executing section preacct from file /usr/local/etc/raddb/sites-enabled/default
+- entering group preacct {...}
++[preprocess] returns ok
[acct_unique] Hashing 'NAS-Port = 5060,Client-IP-Address = 192.168.118.39,NAS-IP-Address = 192.168.118.39,Acct-Session-Id = "OTgyZjkxZDEzZjM1MTMxMWI5NDcyMjcxNGQ0ZDkzODk.",User-Name = "[email protected]"'
[acct_unique] Acct-Unique-Session-ID = "3508789790db359a".
++[acct_unique] returns ok
[suffix] Looking up realm "192.168.118.39" for User-Name = "[email protected]"
[suffix] No such realm "192.168.118.39"
++[suffix] returns noop
++[files] returns noop
# Executing section accounting from file /usr/local/etc/raddb/sites-enabled/default
+- entering group accounting {...}
[detail]        expand: /usr/local/var/log/radius/radacct/%{Client-IP-Address}/detail-%Y%m%d -> /usr/local/var/log/radius/radacct/192.168.118.39/detail-20110117
[detail] /usr/local/var/log/radius/radacct/%{Client-IP-Address}/detail-%Y%m%d expands to /usr/local/var/log/radius/radacct/192.168.118.39/detail-20110117
[detail]        expand: %t -> Mon Jan 17 18:14:18 2011
++[detail] returns ok
++[unix] returns ok
[radutmp]       expand: /usr/local/var/log/radius/radutmp -> /usr/local/var/log/radius/radutmp
[radutmp]       expand: %{User-Name} -> [email protected]
++[radutmp] returns ok
++[exec] returns noop
[attr_filter.accounting_response]       expand: %{User-Name} -> [email protected]
 attr_filter: Matched entry DEFAULT at line 12
++[attr_filter.accounting_response] returns updated
Sending Accounting-Response of id 171 to 192.168.118.39 port 48558
Finished request 0.
Cleaning up request 0 ID 171 with timestamp +75
Going to the next request
Ready to process requests.

opensips中计费有关的相关配置如下opensips.cfg:

 # ----- acc params -----
/* what sepcial events should be accounted ? */
modparam("acc", "early_media", 1)
modparam("acc", "report_ack", 1)
modparam("acc", "report_cancels", 1)
/* by default ww do not adjust the direct of the sequential requests.
   if you enable this parameter, be sure the enable "append_fromtag"
   in "rr" module */
modparam("acc", "detect_direction", 0)
/* account triggers (flags) */
modparam("acc", "failed_transaction_flag", 3)
modparam("acc", "log_flag", 1)
modparam("acc", "log_missed_flag", 2)
/* uncomment the following lines to enable DB accounting also */
#modparam("acc", "db_flag", 1)
#modparam("acc", "db_missed_flag", 2)
modparam("acc","aaa_flag",2)
modparam("acc","aaa_missed_flag",3)
modparam("acc","service_type",15)
#modparam("aaa_radius", "radius_config", "/usr/local/etc/radiusclient-ng/radiusclient.conf")
modparam("acc","aaa_url","radius:/usr/local/etc/radiusclient-ng/radiusclient.conf")
modparam("acc", "aaa_extra",    "User-Name=$Au ;\
                                  Calling-Station-Id=$from;\
                                  Called-Station-Id=$to ;\
                                  Sip-Translated-Request-URI=$ruri;\
                                   Sip-RPid=$avp(s:rpid);\
                                    Canonical-URI=$avp(s:can_uri);\
                                   Billing-Party=$avp(s:billing_party);\
                                   Divert-Reason=$avp(s:divert_reason);\
                                    X-RTP-Stat=$hdr(X-RTP-Stat);\
                                     Contact=$hdr(contact);\
                                      Event=$hdr(event);\
                                     SIP-Proxy-IP=$avp(s:sip_proxy_ip);\
                                     ENUM-TLD=$avp(s:enum_tld)") 

opensips和radiusclient中的dictionary文件设置如下:dictionary.opensips

#### Attributes ###
ATTRIBUTE Sip-Uri-User         208  string     # Proprietary, auth_radius
ATTRIBUTE Sip-Group            211  string     # Proprietary, group_radius
ATTRIBUTE Sip-Rpid             213  string     # Proprietary, auth_radius
ATTRIBUTE SIP-AVP              225  string     # Proprietary, avp_radius
ATTRIBUTE Sip-Call-Duration    227  integer
ATTRIBUTE Sip-Call-Setuptime   228  integer

###lines add###
ATTRIBUTE Sip-Method                    101  integer
ATTRIBUTE Sip-Response-Code             102  integer    # Schulzrinne, acc
ATTRIBUTE Sip-To-Tag                    104  string     # Schulzrinne, acc
ATTRIBUTE Sip-From-Tag                  105  string     # Schulzrinne, acc
ATTRIBUTE Sip-Translated-Request-URI    107  string     # Proprietary, acc

ATTRIBUTE Source-IP                     214  string
ATTRIBUTE Source-Port                   215  string
ATTRIBUTE Sip-Src-IP                    108  string     # Proprietary, acc
ATTRIBUTE Sip-Src-Port                  109  string     # Proprietary, acc
ATTRIBUTE Digest-Response               206  string     # Sterman, auth_radius

ATTRIBUTE Sip-Uri-User                  208  string     # Proprietary, auth_radius
ATTRIBUTE Sip-Group                     211  string     # Proprietary, group_radius
ATTRIBUTE Sip-Rpid                      213  string     # Proprietary, auth_radius
ATTRIBUTE SIP-AVP                       225  string     # Proprietary, avp_radius
ATTRIBUTE Digest-Realm                  1063  string    # Sterman, auth_radius
ATTRIBUTE Digest-Nonce                  1064  string    # Sterman, auth_radius
ATTRIBUTE Digest-Method                 1065  string    # Sterman, auth_radius
ATTRIBUTE Digest-URI                    1066  string    # Sterman, auth_radius
ATTRIBUTE Digest-QOP                    1067  string    # Sterman, auth_radius
ATTRIBUTE Digest-Algorithm              1068  string    # Sterman, auth_radius
ATTRIBUTE Digest-Body-Digest            1069  string    # Sterman, auth_radius
ATTRIBUTE Digest-CNonce                 1070  string    # Sterman, auth_radius
ATTRIBUTE Digest-Nonce-Count            1071  string    # Sterman, auth_radius
ATTRIBUTE Digest-User-Name              1072  string    # Sterman, auth_radius

ATTRIBUTE User-Name  1 string
ATTRIBUTE Called-Station-Id 30 string
ATTRIBUTE Calling-Station-Id 31 string
ATTRIBUTE       Canonical-URI          216     string
ATTRIBUTE       Delay-Time             217     string
ATTRIBUTE       Divert-Reason          219     string
ATTRIBUTE       X-RTP-Stat             220     string
ATTRIBUTE       From-Header            221     string
ATTRIBUTE       User-Agent             222     string
ATTRIBUTE       Contact                223     string
ATTRIBUTE       Event                  224     string
ATTRIBUTE       SIP-Proxy-IP           231     string
ATTRIBUTE       ENUM-TLD               232     string
ATTRIBUTE      Billing-Party             218     string
ATTRIBUTE  Acct-Status-Type  40  integer
ATTRIBUTE       Event-Timestamp       230     string
ATTRIBUTE      Acct-Session-Id       44     string

### Service-Type Values ###
VALUE     Service-Type       Group-Check      12   # Proprietary, group_radius
VALUE     Service-Type       SIP-Caller-AVPs  30   # Proprietary, avp_radius
VALUE     Service-Type       SIP-Callee-AVPs  31   # Proprietary, avp_radius
VALUE      Service-Type      Login-User           1      
VALUE      Service-Type      Framed-User          2      
VALUE      Service-Type      Callback-Login-User  3      
VALUE      Service-Type      Callback-Framed-User 4      
VALUE      Service-Type      Outbound-User        5      
VALUE      Service-Type      Administrative-User  6      
VALUE      Service-Type      NAS-Prompt-User      7      
VALUE      Service-Type      Authenticate-Only    8      
VALUE      Service-Type      Call-Check           10
VALUE      Service-Type      SIP-Session         15

### Sip-Method Values ###
#VALUE Sip-Method         Undefined      0
VALUE Sip-Method         Invite         1
VALUE Sip-Method         Cancel         2
VALUE Sip-Method         Ack            4
VALUE Sip-Method         Bye           8
VALUE Sip-Method         Info           16
VALUE Sip-Method         Options        32
VALUE Sip-Method         Update         64
VALUE Sip-Method         Register       128
VALUE Sip-Method         Message        256
VALUE Sip-Method         Subscribe      512
VALUE Sip-Method         Notify         1024
VALUE Sip-Method         Prack          2048
VALUE Sip-Method         Refer          4096
VALUE Sip-Method         Other          8192
####acct-status#####
VALUE Acct-Status-Type     Start             1         # RFC2866, acc
VALUE Acct-Status-Type     Stop              2         # RFC2866, acc
VALUE Acct-Status-Type     Failed           15         # RFC2866, acc
急等请各位高手指点呀,先谢过各位了!!
     

你可能感兴趣的:(opensips1.6.4+freeradius2.1.10+radiusclient0.5.6 problem do accounting)