Policy to Respond to Accounting Packets

Anthony McGarry agtmcgarry at gmail.com
Fri Aug 1 14:13:00 CEST 2014


Hi,

I receive CDRs from a gateway.

There are two types SS7 and SIP

I want to insert the SS7 and discard the SIP. 

However I need to respond to the gateway with an Accounting-Response for these SIP records or it will failover.

I have tried this below

deny_img_sip_acct {
                if (Dialogic-call-type =~ /SIP/) {
                        update control {
                                Response-Packet-Type := Accounting-Response
                        }
                handled
                }
        }

based on the do_not_respond template.

It stops the SIP from being wrote to the DB but it is not sending the response.

Is there a way to force a response?

Anthony

See below SS7 and SIP request

\\\\\SIP
Ready to process requests.
rad_recv: Accounting-Request packet from host 10.101.20.201 port 1813, id=5, length=630
	NAS-IP-Address = 10.101.20.201
	NAS-Port = 1813
	Calling-Station-Id = "499529638"
	Called-Station-Id = "ad061203407"
	Acct-Session-Id = "00201c1428fa008e00e213db832d4d0c1297"
	Acct-Status-Type = Start
	NAS-Port-Type = Ethernet
	Service-Type = Login-User
	Dialogic-call-origin = "answer"
	Dialogic-call-type = "SIP"
	Acct-Delay-Time = 6
	Login-IP-Host = 10.101.20.96
	Tunnel-Client-Endpoint:0 = "10.101.20.201"
	Dialogic-setup-time = "FRI AUG 01 13:08:14:285 2014"
	Dialogic-connect-time = "FRI AUG 01 13:08:14:295 2014"
	Dialogic-dnis-post-translate = "ad061203407"
	Dialogic-ani-post-translate = "499529638"
	Dialogic-call-direction = "OUTGOING LEG"
	Dialogic-trunk-grp-out = "cs03"
	Dialogic-next-hop-ip = "10.101.23.112"
	Dialogic-outgoing-req-uri = "sip:ad061203407 at 10.101.23.112"
	Dialogic-next-hop-dn = "10.101.23.112"
	Dialogic-call-id = "732a-408-71201412813-IMG1_DEG-1-10.101.23.201"
	Dialogic-voip-dst-sig-ip-out = "10.101.23.112"
	Dialogic-voip-dst-rtp-ip-out = "10.101.24.112"
	Dialogic-voip-src-rtp-ip-out = "10.101.24.201"
	Dialogic-voip-src-sig-ip-out = "10.101.23.201"
	Dialogic-voip-local-vocoders = "PCMA,PCMU,CLEARMODE,G729,telephone-event"
	Dialogic-voip-remote-vocoders = "PCMA,telephone-event"
	Dialogic-voip-codec-priority = "Local"
	Dialogic-span-id = "4160"
	Dialogic-channel-id = "8"
server img1010 {
  WARNING: Empty preacct section.  Using default return values.
# Executing section accounting from file /etc/raddb/radiusd.conf
+- entering group accounting {...}
++- entering policy deny_img_sip_acct {...}
+++? if (Dialogic-call-type =~ /SIP/)
? Evaluating (Dialogic-call-type =~ /SIP/) -> TRUE
+++? if (Dialogic-call-type =~ /SIP/) -> TRUE
+++- entering if (Dialogic-call-type =~ /SIP/) {...}
++++[control] returns noop
++++[handled] returns handled
+++- if (Dialogic-call-type =~ /SIP/) returns handled
++- policy deny_img_sip_acct returns handled
} # server img1010
Finished request 4.
Cleaning up request 4 ID 5 with timestamp +24
Going to the next request


\\\\SS7
Ready to process requests.
rad_recv: Accounting-Request packet from host 10.101.20.201 port 1813, id=7, length=433
	NAS-IP-Address = 10.101.20.201
	NAS-Port = 1813
	Calling-Station-Id = "871515967"
	Called-Station-Id = "17533010214548704f"
	Acct-Session-Id = "00201c1428fa009d000413db826a53181331"
	Acct-Session-Time = 206
	Acct-Status-Type = Stop
	Acct-Terminate-Cause = NAS-Request
	NAS-Port-Type = Ethernet
	Service-Type = Login-User
	Dialogic-call-origin = "originate"
	Dialogic-call-type = "SS7"
	Dialogic-Q931-disconnect-cause = "10"
	Acct-Delay-Time = 0
	Login-IP-Host = 10.101.20.96
	Tunnel-Client-Endpoint:0 = "10.101.20.201"
	Dialogic-setup-time = "FRI AUG 01 13:04:58:108 2014"
	Dialogic-connect-time = "FRI AUG 01 13:05:02:258 2014"
	Dialogic-disconnect-time = "FRI AUG 01 13:08:27:948 2014"
	Dialogic-release-source = "CALLED PARTY RELEASE,Remote"
	Dialogic-dnis-pre-translate = "ad0214548704"
	Dialogic-ani-pre-translate = "871515967"
	Dialogic-call-direction = "INCOMING LEG"
	Dialogic-trunk-grp-in = “Trunk"
	Dialogic-span-id = "2"
	Dialogic-channel-id = "11"
server img1010 {
  WARNING: Empty preacct section.  Using default return values.
# Executing section accounting from file /etc/raddb/radiusd.conf
+- entering group accounting {...}
++- entering policy deny_img_sip_acct {...}
+++? if (Dialogic-call-type =~ /SIP/)
? Evaluating (Dialogic-call-type =~ /SIP/) -> FALSE
+++? if (Dialogic-call-type =~ /SIP/) -> FALSE
++- policy deny_img_sip_acct returns noop
[sql_virtual_1] 	expand:  	UPDATE radacct SET              acctsessiontime    = '%{Acct-Session-Time}',              disconnecttime     = '%{Dialogic-disconnect-time}'           WHERE acctsessionid   = '%{Acct-Session-Id}'           AND nasipaddress      = '%{NAS-IP-Address}' ->  	UPDATE radacct SET              acctsessiontime    = '206',              disconnecttime     = 'FRI AUG 01 13:08:27:948 2014'           WHERE acctsessionid   = '00201c1428fa009d000413db826a53181331'           AND nasipaddress      = '10.101.20.201'
[sql_virtual_1] 	expand: /var/log/radius/sqltrace.sql -> /var/log/radius/sqltrace.sql
rlm_sql (sql_virtual_1): Reserving sql socket id: 3
rlm_sql_mysql: query:   	UPDATE radacct SET              acctsessiontime    = '206',              disconnecttime     = 'FRI AUG 01 13:08:27:948 2014'           WHERE acctsessionid   = '00201c1428fa009d000413db826a53181331'           AND nasipaddress      = '10.101.20.201'
[sql_virtual_1] 	expand:  	INSERT INTO radacct             (acctsessionid,    acctuniqueid,      nasipaddress,              setuptime,            connecttime,      disconnecttime,              callingstationid,     calledstationid,              trunkgroupin,    trunkgroupout,    spanid,               channelid, calldirection)           VALUES             ('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}',              '%{NAS-IP-Address}',              '%{Dialogic-setup-time}',              '%{Dialogic-connect-time}',              '%{Dialogic-disconnect-time}',              '%{Calling-Station-Id}',              '%{Called-Station-Id}',              '%{Dialogic-trunk-grp-in}',              '%{Dialogic-trunk-grp-out}',              '%{Dialogic-span-id}',              '%{Dialogic-channel-id}',              '%{Dialogic-call-direction}') ->  	INSERT INTO radacct             (acctsessionid,    acctuniqueid,      nasipaddress,              setuptime,            connecttime,      disconnecttime,              callingst
[sql_virtual_1] 	expand: /var/log/radius/sqltrace.sql -> /var/log/radius/sqltrace.sql
rlm_sql_mysql: query:   	INSERT INTO radacct             (acctsessionid,    acctuniqueid,      nasipaddress,              setuptime,            connecttime,      disconnecttime,              callingstationid,     calledstationid,              trunkgroupin,    trunkgroupout,    spanid,               channelid, calldirection)           VALUES             ('00201c1428fa009d000413db826a53181331', '',              '10.101.20.201',              'FRI AUG 01 13:04:58:108 2014',              'FRI AUG 01 13:05:02:258 2014',              'FRI AUG 01 13:08:27:948 2014',              '871515967',              '17533010214548704f',              ’Trunk',              '',              '2',              '11',              'INCOMING LEG')
rlm_sql (sql_virtual_1): Released sql socket id: 3
++[sql_virtual_1] returns ok
} # server img1010
Sending Accounting-Response of id 7 to 10.101.20.201 port 1813
Finished request 6.
Cleaning up request 6 ID 7 with timestamp +33
Going to the next request





More information about the Freeradius-Users mailing list