Hey guys,
I'm using Radius to do pretty much everything regarding my users, i.e. registrations, authorization, features and preferences. I implemented my own way of doing speeddial by using AVPs provided by radius and AVPOPs module, Here is the snippet:
AVP-SIP = speedial:30:15615551212
avp_subst("s:caller_speedial/i:99", "/(.*):(.*)/\2/"); #15615551212
avp_printf("i:98","$rU:*"); #30
avp_printf("i:97","sip:$avp($temp2)@$td"); # sip:15615551212@xx.xx.xx.xx
avp_printf("i:96","sip:$avp($temp2)@$td\r\n"); # sip:15615551212@xx.xx.xx.xx.
xlog("L_N"," SPEEDIALING: $fU is speed-dialing $hdr(To)->$avp($temp2)\n");
if (avp_check("s:caller_speedial", "fm/$temp1/g")) {
#avp_pushto("$To","i:96");
#avp_pushto("$ruri","i:97");
#avp_pushto("$duri","i:97");
#subst('/^To: (.*)@(.*)/To: "$avp($temp2)" <$avp($temp2)@\2/');
#append_hf("To: "5615551212" 15615551212@xx.xx.xx.xx;user=phone");
#subst_uri('/^sip:(.*)@(.*)$/sip:$avp($temp2)@\2/i');
#subst_user('/(.*)/$avp($temp2)/');
#remove_hf("To");
rewriteuser("15615551212");
xlog("L_N"," SPEEDIALING: $fU is dialing $hdr(To) $avp($temp2)\n");
avp_delete("$temp1/g");
avp_delete("$temp2/g");
};
In this scenario, im forcing it instead of getting the value from AVPs just for ease of showing my point. The problem that I'm having is that no matter what I do to change the To header or change the R-URI, radius ALWAYS sends the accounting records with the original R-URI, in my case 30@xx.xx.xx.xx, how can I get acc.so to send the final resulting URI (15615551212@xx.xx.xx.xx) in the Called-Station-Id AVP?
rad_recv: Accounting-Request packet from host xx.xx.xx.xx:39216, id=97, length=298
Acct-Status-Type = Start
Service-Type = Sip-Session
Acct-Terminate-Cause = 200
Error-Cause = Invite
User-Name = "1000@xx.xx.xx.xx"
Calling-Station-Id = "sip:1000@xx.xx.xx.xx"
Called-Station-Id = "sip:30@xx.xx.xx.xx;user=phone"
Sip-Translated-Request-URI = "sip:949449852150#15615551212@gateway;user=phone"
Acct-Session-Id = "000d2890-d47f01e8-1dcc30bc-7a49c7a4@yy.yy.yy.yy"
Sip-To-Tag = "230383F4-2AF"
Sip-From-Tag = "000d2890d47f20f54576a906-290bdc33"
Sip-CSeq = "102"
NAS-IP-Address = xx.xx.xx.xx
NAS-Port = 5060
Acct-Delay-Time = 0
rlm_sql (sql): Reserving sql socket id: 12
rlm_sql (sql): Released sql socket id: 12
Sending Accounting-Response of id 97 to xx.xx.xx.xx:39216
rad_recv: Accounting-Request packet from host xx.xx.xx.xx:39216, id=98, length=292
Acct-Status-Type = Stop
Service-Type = Sip-Session
Acct-Terminate-Cause = 200
Error-Cause = 8
User-Name = "1000@xx.xx.xx.xx"
Calling-Station-Id = "sip:1000@xx.xx.xx.xx"
Called-Station-Id = "sip:30@xx.xx.xx.xx;user=phone"
Sip-Translated-Request-URI = "sip:949449852150#15615551212@gateway:5060"
Acct-Session-Id = "000d2890-d47f01e8-1dcc30bc-7a49c7a4@yy.yy.yy.yy"
Sip-To-Tag = "230383F4-2AF"
Sip-From-Tag = "000d2890d47f20f54576a906-290bdc33"
Sip-CSeq = "103"
NAS-IP-Address = xx.xx.xx.xx
NAS-Port = 5060
Acct-Delay-Time = 0
Thanks in advance!
Lenir