[OpenSER-Users] OpenSER prepaid CDRTool 6.2.3 problem with replacing '+' with '00'

Iñaki Baz Castillo ibc at in.ilimit.es
Mon Mar 3 12:57:37 CET 2008


El Monday 03 March 2008 12:46:04 Marc LEURENT escribió:
> Hello
> I have trouble with number dialed starting with +
> CDRTool doesn' understand it.

Yes, I revised the PHP code and it's not possible to set "+" as international 
prefix, just numbers :(


> So I have to strip it from the request and replace it by 00!
> The problem is that even using this at the begenning of OpenSER script,
> it's not working (see CDRTool log below)
>
> Any idea how to solve it?
> Thanks
>
>         # normalization to e164
>         if($ruri.user =~ "^\+[1-9][0-9]+") {
>                 xlog("STRIPING + For e164 NORMALIZATION \r\n");
>                 strip(1);
>                 prefix("00");
>                 subst('/^To:(.*)sip:\+(.*)$/To:\1sip:00\2/ig');
>         };

Please, don't change the "To", it's not necessary at all !


> OpenSER config extract:
>
> # ATTENTION: DO NOT PUT ; at the end of the radius_extra attribute
> modparam("acc", "radius_extra", "
>                                 Called-Station-Id=$tu;
>                                 Calling-Station-Id=$fu;
>                                 Canonical-URI=$avp(to_destination);
>                                 User-Name=$avp(user_name);
>                                 Billing-Party=$avp(billing_party);
>                                 Sip-User-Realm=$ar;
>                                 SIP-Proxy-IP=$Ri;
>                                 Source-IP=$si;
>                                 Source-Port=$sp;
>                                 Acct-Authentic=$avp(s:authentic);
>                                 From-Header=$hdr(from);
>                                 User-Agent=$hdr(user-agent);
>                                 Contact=$hdr(contact);
>                                 Event=$hdr(event)")
>
>
>
>         # Set the acc flags
>         xlog("JUSTE BEFORE SETTING FLAGS FOR RADIUS\r\n");
>         if(is_method("INVITE") && !has_totag()) {
>                 xlog("L_INFO", "I AM SETTING THE FLAGS FOR RADIUS \r\n");
> #               $avp(s:authentic) = 1;
> #               $avp(can_uri) = $ru;            # SIP Request's URI
>                 $avp(user_name) = $au + "@" + $ar;
>                 $avp(billing_party) = $au + "@" + $ar;
>                 $avp(to_destination) = $tu;
>                 xlog("SETTING FLAGS 1 FOR RADIUS \r\n");
>                 setflag(1);             # radius_flag
>                 xlog("SETTING FLAGS 2 FOR RADIUS \r\n");
>                 setflag(2);             # radius_missed_flag
>         };

CDRTool looks for the Canonical-URI radius attribute, and you don't set it.
Note that in "radius_extra" you set "Canonical-URI=$avp(to_destination)", so 
add this after RURI transformation ("+" -> "00").

  $avp(to_destination) = $ru;

Just it.


;)



-- 
Iñaki Baz Castillo
ibc at in.ilimit.es




More information about the Users mailing list