Hi I want to implement this tcl script on a cisco http://www.yasinkaplan.com/docs/simplelcr.pdf I have this auth querry rad_recv: Access-Request packet from host xxxxxxxxxxx port 1645, id=4, length=298 User-Name = "2001" User-Password = "" Cisco-AVPair = "call-id=77a36bec512d59f2148f4a935ed0c2f6@37.153.137.2:5060" h323-conf-id = "h323-conf-id=B6EED6D8 27D911E4 88FA91CF 8B17EE77" Cisco-AVPair = "remote-media-address=xxxxxxxx" Cisco-AVPair = "session-protocol=sipv2" Cisco-AVPair = "h323-ivr-out=transactionID:3" Called-Station-Id = "40755xxxxxxx" Service-Type = Login-User NAS-IP-Address = 46.214.35.172 And database is heare voip_cdr=# SELECT * from destinations ; prefix | destination | type | carrier --------+-------------+------------+------------ 4075 | RO ORANGE | MOB | 9901 (1 row) voip_cdr=# select * from carriers ; carrier | description ---------+------------- 9901 | orange (1 row) I m stucked heare CREATE function [dbo].[select_carrier](@dnis nvarchar(50)) returns table as return select top 1 'cisco|100' as Attribute, 'carrier:' + carrier as [Value] from destinations where prefix=substring(@dnis,1, len(prefix)) order by len(prefix) desc and as exmple of querry for freeradius is authorize_check_query = "SELECT id, UserName, Attribute, Value, Op \ FROM ${authcheck_table} \ WHERE Username = '%{SQL-User-Name}' \ ORDER BY id" authorize_reply_query = "SELECT id, UserName, Attribute, Value, Op \ FROM ${authreply_table} \ WHERE Username = '%{SQL-User-Name}' \ ORDER BY id" Thanks in advance