hello,<br><br>I would really thank you Juha, it works perfectly :)<br>I had to adapt some part of Radiator code (a little hook to replace the $urg variable when the auth request is coming).<br><br># -- AUTH ---------------------------------------------------------------- #<br>
route[6]<br>{<br>...<br>&nbsp;&nbsp;&nbsp; # urgency numbers : if called, flag it and get the urg geo number by radius :<br>&nbsp;&nbsp;&nbsp; if (uri=~&quot;^sip:1(5|7|8|12|15|19)@&quot;)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; xlog(&quot;L_INFO&quot;,&quot;-&gt; urgency code $rU called by $fU &quot;);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; setflag(13);&nbsp;&nbsp;&nbsp; # flag urg<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; # radius www authentication<br>&nbsp;&nbsp;&nbsp; if (!radius_proxy_authorize(&quot;&quot;))<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; proxy_challenge(&quot;&quot;, &quot;1&quot;);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ($retcode == -5)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xlog(&quot;L_INFO&quot;, &quot;-&gt; 500: internal server error&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sl_send_reply(&quot;500&quot;, &quot;Internal Server Error&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if ($retcode == -4)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xlog(&quot;L_INFO&quot;, &quot;-&gt; 404: credentials not found&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sl_send_reply(&quot;404&quot;, &quot;Credentials Not Found&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if ($retcode == -3)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xlog(&quot;L_INFO&quot;, &quot;-&gt; 400: bad request&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sl_send_reply(&quot;400&quot;, &quot;Bad Request&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ($adu)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { append_to_reply(&quot;$adu&quot;); }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; xlog(&quot;L_INFO&quot;, &quot;-&gt; 407 - proxy auth required&quot;);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; sl_send_reply(&quot;407&quot;, &quot;Proxy Authentication Required&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; drop;<br>&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; xlog(&quot;L_INFO&quot;, &quot;-&gt; authentication is ok, let it continue&quot;);<br>&nbsp;&nbsp;&nbsp; setflag(8);&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; # flag auth_ok<br>...<br>&nbsp;&nbsp;&nbsp; if (isflagset(13))<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; xlog(&quot;L_INFO&quot;, &quot;-&gt; urgency $rU called by $fU : send directly to pstn&quot;);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; route(15);&nbsp;&nbsp;&nbsp; # route PSTN<br>&nbsp;&nbsp;&nbsp; }<br>}<br><br>And it&#39;s ok in the radius :<br><br>*** Received from <a href="http://192.168.60.9">192.168.60.9</a> port 56178 ....<br>Code:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Access-Request<br>Identifier: 208<br>
Authentic:&nbsp; i.&lt;179&gt;;:_&lt;197&gt;H&lt;131&gt;&lt;232&gt;&lt;219&gt;+&lt;7&gt;2i&lt;153&gt;<br>Attributes:<br>&nbsp;&nbsp;&nbsp; Cisco-AVPair = &quot;<a href="mailto:0123451012@sip.720.fr">0123451012@sip.720.fr</a>&quot;<br>&nbsp;&nbsp;&nbsp; Digest-Attributes = &quot;&lt;10&gt;&lt;12&gt;0123451012&quot;<br>
&nbsp;&nbsp;&nbsp; Digest-Attributes = &quot;&lt;1&gt;&lt;12&gt;<a href="http://sip.720.fr">sip.720.fr</a>&quot;<br>&nbsp;&nbsp;&nbsp; Digest-Attributes = &quot;&lt;2&gt;2490f6a370000000e4448ccf0eb032d4998da6b6142aa03ea&quot;<br>&nbsp;&nbsp;&nbsp; Digest-Attributes = &quot;&lt;4&gt;&lt;19&gt;<a href="mailto:sip%3A18@sip.720.fr">sip:18@sip.720.fr</a>&quot;<br>
&nbsp;&nbsp;&nbsp; Digest-Attributes = &quot;&lt;3&gt;&lt;8&gt;INVITE&quot;<br>&nbsp;&nbsp;&nbsp; Digest-Attributes = &quot;&lt;5&gt;&lt;6&gt;auth&quot;<br>&nbsp;&nbsp;&nbsp; Digest-Attributes = &quot;&lt;9&gt;&lt;10&gt;00000001&quot;<br>&nbsp;&nbsp;&nbsp; Digest-Attributes = &quot;&lt;8&gt;&lt;10&gt;da2ac20f&quot;<br>
&nbsp;&nbsp;&nbsp; Digest-Response = &quot;fbfa3947386bcdeb0bd9c825b50fca2f&quot;<br>&nbsp;&nbsp;&nbsp; Service-Type = Sip-Session<br>&nbsp;&nbsp;&nbsp; Sip-URI-User = &quot;0123451012&quot;<br>&nbsp;&nbsp;&nbsp; cisco-avpair = &quot;call-id=<a href="mailto:60df24b8-54ec4365@192.168.1.5">60df24b8-54ec4365@192.168.1.5</a>&quot;<br>
&nbsp;&nbsp;&nbsp; NAS-Port = 5060<br>&nbsp;&nbsp;&nbsp; NAS-IP-Address = <a href="http://192.168.60.9">192.168.60.9</a><br><br>Mon Nov&nbsp; 3 22:11:39 2008: DEBUG: Handling request with Handler &#39;Service-Type=Sip-Session&#39;<br>Mon Nov&nbsp; 3 22:11:39 2008: DEBUG: Rewrote user name to <a href="mailto:0123451012@sip.720.fr">0123451012@sip.720.fr</a><br>
...<br>*** Sending to <a href="http://192.168.60.9">192.168.60.9</a> port 56178 ....<br>Code:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Access-Accept<br>Identifier: 208<br>Authentic:&nbsp; i.&lt;179&gt;;:_&lt;197&gt;H&lt;131&gt;&lt;232&gt;&lt;219&gt;+&lt;7&gt;2i&lt;153&gt;<br>
Attributes:<br>&nbsp;&nbsp;&nbsp; Message-Authenticator = &quot;&lt;0&gt;&lt;0&gt;&lt;0&gt;&lt;0&gt;&lt;0&gt;&lt;0&gt;&lt;0&gt;&lt;0&gt;&lt;0&gt;&lt;0&gt;&lt;0&gt;&lt;0&gt;&lt;0&gt;&lt;0&gt;&lt;0&gt;&lt;0&gt;&quot;<br>&nbsp;&nbsp;&nbsp; User-Name = &quot;0123451012&quot;<br>
&nbsp;&nbsp;&nbsp; Sip-User-ID = &quot;0123451012&quot;<br>&nbsp;&nbsp;&nbsp; Sip-User-Realm = &quot;<a href="http://sip.720.fr">sip.720.fr</a>&quot;<br>&nbsp;&nbsp;&nbsp; Sip-URI-User = &quot;<a href="mailto:0123451012@sip.720.fr">0123451012@sip.720.fr</a>&quot;<br>
&nbsp;&nbsp;&nbsp; Sip-Rpid = &quot;0123451012&quot;<br>&nbsp;&nbsp;&nbsp; Sip-Group = &quot;full&quot;<br>&nbsp;&nbsp;&nbsp; Sip-AVP = &quot;asserted_id:0123451012&quot;<br>&nbsp;&nbsp;&nbsp; Sip-AVP = &quot;urg:01233450018&quot;<br><br><br><br>I just want to know why the avp_print function understand another kind of AVP name than he one we got in the Radius request ?<br>
it adds &quot;caller_&quot; or &quot;callee_&quot; as a prefix ...<br><br>in the debug log :<br>Nov&nbsp; 3 22:07:34 ser0 kamailio[28252]: -&gt; urgency code 18 called by 0123451012 <br>Nov&nbsp; 3 22:07:34 ser0 kamailio[28252]: DBG:auth:check_nonce: comparing [490f69420000000c00de4aa46ee94c1b07cc0239f6ae8ef8] and [490f69420000000c00de4aa46ee94c1b07cc0239f6ae8ef8] <br>
Nov&nbsp; 3 22:07:34 ser0 kamailio[28252]: DBG:auth_radius:radius_authorize_sterman: Success <br>Nov&nbsp; 3 22:07:34 ser0 kamailio[28252]: DBG:auth_radius:generate_avps: getting SIP AVPs from avpair 225 <br>Nov&nbsp; 3 22:07:34 ser0 kamailio[28252]: DBG:auth_radius:extract_avp: string is &lt;asserted_id:0123451012&gt; <br>
Nov&nbsp; 3 22:07:34 ser0 kamailio[28252]: DBG:auth_radius:extract_avp: AVP name is &lt;asserted_id&gt; <br>Nov&nbsp; 3 22:07:34 ser0 kamailio[28252]: DBG:auth_radius:extract_avp: AVP val is &lt;0123451012&gt; <br>Nov&nbsp; 3 22:07:34 ser0 kamailio[28252]: DBG:auth_radius:generate_avps: AVP &#39;asserted_id&#39;/0=&#39;0123451012&#39;/0 has been added <br>
Nov&nbsp; 3 22:07:34 ser0 kamailio[28252]: DBG:auth_radius:extract_avp: string is &lt;urg:01233450018&gt; <br>Nov&nbsp; 3 22:07:34 ser0 kamailio[28252]: DBG:auth_radius:extract_avp: AVP name is &lt;urg&gt; <br>Nov&nbsp; 3 22:07:34 ser0 kamailio[28252]: DBG:auth_radius:extract_avp: AVP val is &lt;01233450018&gt; <br>
Nov&nbsp; 3 22:07:34 ser0 kamailio[28252]: DBG:auth_radius:generate_avps: AVP &#39;urg&#39;/0=&#39;01233450018&#39;/0 has been added <br><br>with an avp_print() :<br><br>Nov&nbsp; 3 22:05:00 kamailio[28252]: INFO:avpops:ops_print_avp: p=0x7f0037677ec8, flags=0x0003 <br>
Nov&nbsp; 3 22:05:00 kamailio[28252]: INFO:avpops:ops_print_avp: ^I^I^Iname=&lt;caller_urg&gt; <br>Nov&nbsp; 3 22:05:00 kamailio[28252]: INFO:avpops:ops_print_avp: ^I^I^Ival_str=&lt;01233450018 / 4&gt; <br><br><br>Again, many thanks,<br>
<br>.Sam.<br><br><br><br><br><div class="gmail_quote">On Tue, Oct 28, 2008 at 7:02 PM, Samuel Muller <span dir="ltr">&lt;<a href="mailto:sml@720.fr">sml@720.fr</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
oh, you&#39;re right, nice !<br><br>the idea should be (not the real script lines but similar in the concept) :<br><br>$fu INVITE $ruri (where $ruri is a urg code) :<br><br>route(authenticate)<br>{<br>&nbsp;&nbsp; if (ruri = (15|17|18)@)<br>

&nbsp;&nbsp; {<br>&nbsp;&nbsp; ($username == $urg);<br>&nbsp;&nbsp; setflag(urg);<br>&nbsp;&nbsp; }<br>&nbsp;&nbsp; radius_proxy_authorize(&quot;...&quot;)<br>&nbsp;&nbsp; {...}<br>}<br>route(pstn)<br>{<br>&nbsp;&nbsp; if (isflagset(urg))<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; rewriteusername($urg);<br>&nbsp;&nbsp;&nbsp; route(send_to_a_dedicated_trunk);<br>

&nbsp;&nbsp;&nbsp; exit;<br>&nbsp;&nbsp; }<br>}<br><br>and the radius replies during the authentication, the real associated geo number of the urg code.<br><br>nice ! many thanks ! I&#39;ll try it asap !<br><br>.Sam.<div><div></div><div class="Wj3C7c">
<br><br><br><br><div class="gmail_quote">
On Tue, Oct 28, 2008 at 6:39 PM, Juha Heinanen <span dir="ltr">&lt;<a href="mailto:jh@tutpro.com" target="_blank">jh@tutpro.com</a>&gt;</span> 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>Samuel Muller writes:<br>
<br>
&nbsp;&gt; when the sipphone calls the urgency code &quot;15&quot;, openser receives<br>
&nbsp;&gt; sip:15@realm<br>
&nbsp;&gt; &quot;<br>
&nbsp;&gt; so I use the avp_load_radius to get the AVP $urg (for example).<br>
&nbsp;&gt; the radius checks its db :<br>
&nbsp;&gt; . $fu -&gt; insee code=$insee (insee codes relates the geo number of urgencies)<br>
&nbsp;&gt; . $ruri -&gt; urg code=$urg<br>
&nbsp;&gt; so it translates the code in the good geo number (15 = 0123456789)<br>
&nbsp;&gt; then openser just rewrite the ruri like sip:$urg@realm.<br>
<br>
</div>sounds good, but if you authenticate the call in kamailio, you don&#39;t<br>
need this extra avp_load_radius call, because you can return the goe<br>
number already during authentication. &nbsp;on the other hand, there are not<br>
that many emergency calls that the extra call would matter.<br>
<font color="#888888"><br>
-- juha<br>
</font></blockquote></div><br><br clear="all"><br></div></div><div><div></div><div class="Wj3C7c">-- <br>Samuel MULLER<br>Ingénieur Reseaux &amp; Telecom<br>720 DEGRES<br>+33 (0)663 128 505<br><a href="mailto:sml@720.fr" target="_blank">sml@720.fr</a><br>

</div></div></blockquote></div><br><br clear="all"><br>-- <br>Samuel MULLER<br>Ingénieur Reseaux &amp; Telecom<br>720 DEGRES<br>+33 (0)663 128 505<br><a href="mailto:sml@720.fr">sml@720.fr</a><br>