Marc,<br><br>just to avoid unnecessary processing, I would say the patch for the connector should look like:<br> (authorize function, right after if MULTIPLE_PREPAID_ENGINES block<br><br> # Patch for the digest uri starting with + (openser is not able to touch that, and cdrtool not able to recognise)<br>
if to_uri.find('+') != -1:<br> log(1, 'destination containing +, will replace it with 00...')<br> to_uri = to_uri.replace('+', '00')<br> <br> res_newsession_raw=client_prepaid.new_session(username, to_uri, SESSION_MAXDUR)<br>
<br><br>In OpenSER, I have done the following, right after radius_proxy_authorize call:<br><br> if (!radius_proxy_authorize("")) {<br> proxy_challenge("","0");<br> exit;<br>
} else if (!check_from()) {<br> sl_send_reply("403", "Use From=ID");<br> exit;<br> };<br><br> if (uri=~"^sip:\+.*@"){<br> strip(1);<br>
prefix("00");<br> xlog("Changed RURI due to +, new one is: $rU");<br> };<br><br>DanB<br><br><br><br><div class="gmail_quote">On Mon, Mar 3, 2008 at 2:23 PM, Marc LEURENT <<a href="mailto:lftsy@leurent.eu">lftsy@leurent.eu</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">-----BEGIN PGP SIGNED MESSAGE-----<br>
Hash: SHA1<br>
<br>
</div>Thanks Dan and Iñaki for your answers:<br>
<br>
I've changed this in the freeradius-cdrtool module of Dan:<br>
#to_uri=atrbValue(params,'Digest-URI')<br>
to_uri=atrbValue(params,'Digest-URI').replace('+','00')<br>
<div class="Ih2E3d"><br>
> 2. A bit dirty patch on the freeradius-cdrtool connector to replace "+"<br>
> with "00" in case of calls starting with +, before querying cdrtool in<br>
> auth phase. In this case you must replace also in openser + with 00 so<br>
> when the call will go out, should go with 00 (to be properly reflected<br>
> later in cdrs). - this is what I did and looks like running smooth.<br>
</div>But I don't understand how to change the second part in OpenSER?<br>
<br>
Otherwize I will do it in the accounting python module?<br>
<br>
Thanks!<br>
<br>
<br>
Dan-Cristian Bogos a écrit :<br>
<div class="Ih2E3d">> Hi Marc,<br>
><br>
> had the same issue. The problem is that CDRTool supports only one type<br>
> of international prefix (in your case any of '00' or '+', so no way of<br>
> specifying two).<br>
> The reason you cannot replace + with 00 before authentication is that<br>
> the full digest-nonce is calculated based on a series of factors (which<br>
> includes original from and to uris and replacing to_uri before sending<br>
> the request to radius to be authenticated would mean that radius will<br>
> never recognize the nonce to be valid anymore).<br>
><br>
> There are two ways of fixing your problem, as I see them (and mines too):<br>
> 1. CDRTool folks should support some sort of list of international<br>
> prefixes recognized and stripped.<br>
> 2. A bit dirty patch on the freeradius-cdrtool connector to replace "+"<br>
> with "00" in case of calls starting with +, before querying cdrtool in<br>
> auth phase. In this case you must replace also in openser + with 00 so<br>
> when the call will go out, should go with 00 (to be properly reflected<br>
> later in cdrs). - this is what I did and looks like running smooth.<br>
><br>
><br>
> Cheers,<br>
> DanB<br>
><br>
> On Mon, Mar 3, 2008 at 12:46 PM, Marc LEURENT <<a href="mailto:lftsy@leurent.eu">lftsy@leurent.eu</a><br>
</div><div class="Ih2E3d">> <mailto:<a href="mailto:lftsy@leurent.eu">lftsy@leurent.eu</a>>> wrote:<br>
><br>
> Hello<br>
> I have trouble with number dialed starting with +<br>
> CDRTool doesn' understand it.<br>
> So I have to strip it from the request and replace it by 00!<br>
> The problem is that even using this at the begenning of OpenSER<br>
> script, it's not working (see CDRTool log below)<br>
><br>
> Any idea how to solve it?<br>
> Thanks<br>
><br>
> # normalization to e164<br>
> if($ruri.user =~ "^\+[1-9][0-9]+") {<br>
> xlog("STRIPING + For e164 NORMALIZATION \r\n");<br>
> strip(1);<br>
> prefix("00");<br>
> subst('/^To:(.*)sip:\+(.*)$/To:\1sip:00\2/ig');<br>
> };<br>
><br>
><br>
><br>
> Mar 3 12:24:49 krusty CDRTool[15025]: MaxSessionTime<br>
</div>> From=<a href="mailto:mleurent@sip.wifirst.net">mleurent@sip.wifirst.net</a> <mailto:<a href="mailto:mleurent@sip.wifirst.net">mleurent@sip.wifirst.net</a>><br>
<div class="Ih2E3d">> To=<a href="mailto:sip:+33677832975@sip.wifirst.net">sip:+33677832975@sip.wifirst.net</a><br>
</div>> <mailto:<a href="mailto:sip">sip</a>:+33677832975@<a href="http://sip.wifirst.net" target="_blank">sip.wifirst.net</a>> Dura<br>
<div class="Ih2E3d">> tion=10800 Lock=1<br>
> Mar 3 12:24:49 krusty CDRTool[15025]: Load last minute: 1 calls @<br>
> 0.00 cps, memory: 16.77 MB, uptime: 0.6 hours<br>
> Mar 3 12:24:49 krusty CDRTool[15025]: Call to<br>
</div>> +33677832975@<a href="http://sip.wifirst.net" target="_blank">sip.wifirst.net</a> <<a href="http://sip.wifirst.net" target="_blank">http://sip.wifirst.net</a>>, no limit imposed<br>
<div class="Ih2E3d">> Mar 3 12:24:49 krusty CDRTool[15025]: GetBalance<br>
</div>> From=<a href="mailto:mleurent@sip.wifirst.net">mleurent@sip.wifirst.net</a> <mailto:<a href="mailto:mleurent@sip.wifirst.net">mleurent@sip.wifirst.net</a>><br>
<div class="Ih2E3d">> Mar 3 12:24:51 krusty /usr/sbin/openser[18637]: ACC: call missed:<br>
> timestamp=1204543491;method=INVITE;from_tag=xirvq;to_tag=<br>
> ;call_id=<a href="mailto:cpvrqboancqnuii@192.168.95.139">cpvrqboancqnuii@192.168.95.139</a><br>
</div>> <mailto:<a href="mailto:cpvrqboancqnuii@192.168.95.139">cpvrqboancqnuii@192.168.95.139</a>>;code=487;reason=Request<br>
<div class="Ih2E3d">> Terminated<br>
> Mar 3 12:24:51 krusty CDRTool[15025]: DebitBalance<br>
</div>> From=<a href="mailto:mleurent@sip.wifirst.net">mleurent@sip.wifirst.net</a> <mailto:<a href="mailto:mleurent@sip.wifirst.net">mleurent@sip.wifirst.net</a>><br>
<div class="Ih2E3d">> To=<a href="mailto:sip:0033677832975@sip.wifirst.net">sip:0033677832975@sip.wifirst.net</a><br>
</div>> <mailto:<a href="mailto:sip">sip</a>:<a href="mailto:0033677832975@sip.wifirst.net">0033677832975@sip.wifirst.net</a>> Durat<br>
<div><div></div><div class="Wj3C7c">> ion=0<br>
><br>
><br>
> OpenSER config extract:<br>
><br>
> # ATTENTION: DO NOT PUT ; at the end of the radius_extra attribute<br>
> modparam("acc", "radius_extra", "<br>
> Called-Station-Id=$tu;<br>
> Calling-Station-Id=$fu;<br>
> Canonical-URI=$avp(to_destination);<br>
> User-Name=$avp(user_name);<br>
> Billing-Party=$avp(billing_party);<br>
> Sip-User-Realm=$ar;<br>
> SIP-Proxy-IP=$Ri;<br>
> Source-IP=$si;<br>
> Source-Port=$sp;<br>
> Acct-Authentic=$avp(s:authentic);<br>
> From-Header=$hdr(from);<br>
> User-Agent=$hdr(user-agent);<br>
> Contact=$hdr(contact);<br>
> Event=$hdr(event)")<br>
><br>
><br>
><br>
> # Set the acc flags<br>
> xlog("JUSTE BEFORE SETTING FLAGS FOR RADIUS\r\n");<br>
> if(is_method("INVITE") && !has_totag()) {<br>
> xlog("L_INFO", "I AM SETTING THE FLAGS FOR RADIUS \r\n");<br>
> # $avp(s:authentic) = 1;<br>
> # $avp(can_uri) = $ru; # SIP Request's URI<br>
> $avp(user_name) = $au + "@" + $ar;<br>
> $avp(billing_party) = $au + "@" + $ar;<br>
> $avp(to_destination) = $tu;<br>
> xlog("SETTING FLAGS 1 FOR RADIUS \r\n");<br>
> setflag(1); # radius_flag<br>
> xlog("SETTING FLAGS 2 FOR RADIUS \r\n");<br>
> setflag(2); # radius_missed_flag<br>
> };<br>
<br>
</div></div>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.openser.org">Users@lists.openser.org</a> <mailto:<a href="mailto:Users@lists.openser.org">Users@lists.openser.org</a>><br>
<div class="Ih2E3d"><a href="http://lists.openser.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.openser.org/cgi-bin/mailman/listinfo/users</a><br>
<br>
<br>
</div><div class="Ih2E3d">-----BEGIN PGP SIGNATURE-----<br>
Version: GnuPG v1.4.6 (GNU/Linux)<br>
Comment: Using GnuPG with Mozilla - <a href="http://enigmail.mozdev.org" target="_blank">http://enigmail.mozdev.org</a><br>
<br>
</div>iD8DBQFHy/vbrxOjjFYWQtoRAsrUAKCDWa3PPsuBCGy6Op9O0sr7Fk9uugCffchO<br>
p7WCUKUX3skiyPUcgqc8c/Y=<br>
=SWwN<br>
-----END PGP SIGNATURE-----<br>
</blockquote></div><br>