<br><br><div>Hi Bogdan,</div><div><br></div><div>Thanks for your reply. As you suggested about check_source_address() function, I get its return value using $avp(i:checksrc) as listed down below;</div><div><div><br></div><div>
$avp(s:checksrc) = check_source_address("0");</div><div> log("#################################################################################\n");</div><div> xlog("Check Source Address from Address TABLE Where Value 1 is Equal to True: $(avp(s:checksrc))\n");</div>
<div> log("#################################################################################\n");</div></div><div><br></div><div><div> if($avp(s:checksrc)!=1)</div><div> {</div><div> if(is_method("INVITE"))</div>
<div> {</div><div> log("#################### CHECK SOURCE ADDRESS ######################");</div><div> route(1);</div><div> setflag(1);</div>
<div> }</div><div> }</div><div> else</div><div> {</div><div> t_reply("403","Forbidden");</div><div> exit;</div><div> }</div><div><br>
</div></div><div>But the problem I'm facing is when I enlist IP in address table i.e. 11.22.33.44, call is rejected when else condition is used, when else condition is commented call is made. But on other hand when I remove the IP as mentioned from address table, it should reject the call (commenting else condition), unfortunately the call is made.</div>
<div><br></div><div>Kindly assist me how can I permit or deny calls on IP bases, when user is not registered from OpenSIPS but sending calls from GW to OpenSIPs?</div><div><br></div><div><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Date: Mon, 22 Mar 2010 00:09:43 +0200<br>
From: Bogdan-Andrei Iancu <<a href="mailto:bogdan@voice-system.ro">bogdan@voice-system.ro</a>><br>
Subject: Re: [OpenSIPS-Users] Check Live Peers on OpenSIPS<br>
To: OpenSIPS users mailling list <<a href="mailto:users@lists.opensips.org">users@lists.opensips.org</a>><br>
Message-ID: <<a href="mailto:4BA69927.2050102@voice-system.ro">4BA69927.2050102@voice-system.ro</a>><br>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed<br>
<br>
Hi Ahmed<br>
<br>
Ahmed Munir wrote:<br>
> Hi Bogdan,<br>
><br>
> Thanks for your suggestion, few things I want to ask from you;<br>
><br>
> 1- Can I use rewritehostport(); function instead of $rd='11.22.33.44'<br>
> and append it to t_relay()? Like;<br>
><br>
> setflag(2);<br>
> rewritehostport("11.22.33.55<a href="http://203.215.179.34:5060" target="_blank">:5060</a>");<br>
> t_relay();<br>
> route(1);<br>
> exit;<br>
<br>
Yes, that is correct.<br>
><br>
> 2- When using check_source_address() function of permissions module,<br>
> I'm facing weird problem. On machine A I've installed OpenSIPS ver<br>
> 1.6.1 svn one, I used this function to permitted certain source IPs as<br>
> I listed in address table. On machine B (currently working on it using<br>
> Radius) I've installed same version of OpenSIPS as on machine A, when<br>
> I call its check_source_address() function in INVITE section, it is<br>
> working as it worked on machine A. Machine A settings are listed below;<br>
><br>
><br>
> if(is_method("INVITE") && check_source_address("0"))<br>
> {<br>
> log("#################### CHECK SOURCE ADDRESS<br>
> ######################");<br>
> route(1);<br>
> setflag(1);<br>
> }<br>
><br>
><br>
> Machine B description I'm mentioning below;<br>
><br>
> 2-1- If user registered him/her self on SIP phone their source IP not<br>
> going to be checked, and make calls to each other.<br>
> 2-2- If user A is on GW calls user B who is located and Registered on<br>
> OpenSIPS, user A GW's source IP must be checked by OpenSIPs, if the<br>
> IP exists on address table, call is permitted if not deny the call.<br>
><br>
> Problems;<br>
><br>
> When I user A and user B registered on OpenSIPs (using Radius) they<br>
> can call each other, but if a user A calling from GW to user B who is<br>
> registered on OpenSIPs, calls is made even the address is not listed<br>
> on address table. And also in logs I see that that permissions module<br>
> shows that it doesn't find any IP enlisted in its hash table, but<br>
> still permitting it.<br>
The function just checks if the source IP is in the table, but does not<br>
take any action - you need to so this manually from the script, based on<br>
the return code (true or false) of the function.<br>
<br>
Regards,<br>
Bogdan<br>
> The configuration of machine B is listed below;<br>
><br>
> [........]<br>
><br>
> Kindly assist me, how can I permit or deny user from source IP ?<br>
> Because on machine A, check_source_address() function is working<br>
> perfectly but I haven't integrated FreeRadius with OpenSIPs. Please<br>
> sort out my problem as your earliest.<br>
><br>
><br>
><br>
><br>
> Date: Thu, 18 Mar 2010 18:38:29 +0200<br>
> From: Bogdan-Andrei Iancu <<a href="mailto:bogdan@voice-system.ro">bogdan@voice-system.ro</a><br>
> <mailto:<a href="mailto:bogdan@voice-system.ro">bogdan@voice-system.ro</a>>><br>
> Subject: Re: [OpenSIPS-Users] Check Live Peers on OpenSIPS<br>
> To: OpenSIPS users mailling list <<a href="mailto:users@lists.opensips.org">users@lists.opensips.org</a><br>
> <mailto:<a href="mailto:users@lists.opensips.org">users@lists.opensips.org</a>>><br>
> Message-ID: <<a href="mailto:4BA25705.10506@voice-system.ro">4BA25705.10506@voice-system.ro</a><br>
> <mailto:<a href="mailto:4BA25705.10506@voice-system.ro">4BA25705.10506@voice-system.ro</a>>><br>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed<br>
><br>
> Hi Ahmed,<br>
><br>
> Ahmed Munir wrote:<br>
> > Hi Bogdan,<br>
> ><br>
> > Thanks for reply. I forgot to mention earlier that for I'm using<br>
> > OpenSIPS + FreeRadius, where radius is doing accounting and<br>
> > authentication. I used aaa_does_uri_exist() function as well, but<br>
> > seems not working or making mistake while implementing it. On other<br>
> > hand using lookup("location",m) function, on retcode = -1, I<br>
> > redirected the INVITE to GW, using Dispatcher. But though<br>
> thanks for<br>
> > your suggestion and I'll consider it.<br>
> ><br>
> > Few things I want to ask you, as I listed below;<br>
> > 1-How can I forward SIP INVITE request to other SIP machine in state<br>
> > full manner ?<br>
> simply do:<br>
> # set new destination in RURI<br>
> $rd= "11.22.33.44";<br>
> # send it out in stateful mode<br>
> t_relay();<br>
> exit;<br>
><br>
> > 2- While accounting using radius, when user A (registered on<br>
> OpenSIPS)<br>
> > calls the user B who is located at GW side, accounting doesn't take<br>
> > place. On the other hand when user B (from GW) calls user A (to<br>
> > OpenSIPS), accounting take place. I want to know its cause?<br>
> Because I<br>
> > want its accounting on both sides.<br>
> take care and check where you set in script the acc flag - maybe<br>
> you are<br>
> setting it only if lookup is successful.<br>
><br>
> Regards,<br>
> Bogdan<br>
> ><br>
> > Kindly advise me at your earliest.<br>
> ><br>
> ><br>
> > ------------------------------<br>
> ><br>
> > Message: 6<br>
> > Date: Thu, 18 Mar 2010 10:23:27 +0200<br>
> > From: Bogdan-Andrei Iancu <<a href="mailto:bogdan@voice-system.ro">bogdan@voice-system.ro</a><br>
> <mailto:<a href="mailto:bogdan@voice-system.ro">bogdan@voice-system.ro</a>><br>
> > <mailto:<a href="mailto:bogdan@voice-system.ro">bogdan@voice-system.ro</a> <mailto:<a href="mailto:bogdan@voice-system.ro">bogdan@voice-system.ro</a>>>><br>
> > Subject: Re: [OpenSIPS-Users] Check Live Peers on OpenSIPS<br>
> > To: OpenSIPS users mailling list <<a href="mailto:users@lists.opensips.org">users@lists.opensips.org</a><br>
> <mailto:<a href="mailto:users@lists.opensips.org">users@lists.opensips.org</a>><br>
> > <mailto:<a href="mailto:users@lists.opensips.org">users@lists.opensips.org</a><br>
> <mailto:<a href="mailto:users@lists.opensips.org">users@lists.opensips.org</a>>>><br>
> > Message-ID: <<a href="mailto:4BA1E2FF.3060702@voice-system.ro">4BA1E2FF.3060702@voice-system.ro</a><br>
> <mailto:<a href="mailto:4BA1E2FF.3060702@voice-system.ro">4BA1E2FF.3060702@voice-system.ro</a>><br>
> > <mailto:<a href="mailto:4BA1E2FF.3060702@voice-system.ro">4BA1E2FF.3060702@voice-system.ro</a><br>
> <mailto:<a href="mailto:4BA1E2FF.3060702@voice-system.ro">4BA1E2FF.3060702@voice-system.ro</a>>>><br>
> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed<br>
> ><br>
> > Hi Ahmed,<br>
> ><br>
> > if the destination number (called number) is not a local<br>
> subscriber (a<br>
> > SIP user), you simply route the call to a PSTN GW (you do this<br>
> > re-route<br>
> > from the script)<br>
> ><br>
> > To check if a user is a local subscriber, you can either check a<br>
> > pattern<br>
> > (like all my local users are alphanumeric, or all starts<br>
> with 3345*,<br>
> > etc), either simply check if the user does exists in the<br>
> subscriber<br>
> > table (see the URI module, the db_does_uri_exists() function:<br>
> ><br>
> <a href="http://www.opensips.org/html/docs/modules/1.6.x/uri.html#id271131" target="_blank">http://www.opensips.org/html/docs/modules/1.6.x/uri.html#id271131</a><br>
> ><br>
> > Regards,<br>
> > Bogdan<br>
> ><br>
> > Ahmed Munir wrote:<br>
> > > Hi,<br>
> > ><br>
> > > I want to know how can I check the peers of source and<br>
> destination<br>
> > > phones? Like if both phones are located (registered) on one<br>
> > > UAS(OpenSIPS) can call SIP-SIP, if any one phone is registered<br>
> > on UAS<br>
> > > and other is on PSTN, call will be re-routed to SIP-PSTN.<br>
> In case of<br>
> > > SIP-SIP, lookup("location") function works and I need to know<br>
> > how can<br>
> > > I forward call to SIP-PSTN ?<br>
> > ><br>
> > > Kindly advise me the method/ function can used for it.<br>
> > ><br>
> > > --<br>
> > > Regards,<br>
> > ><br>
> > > Ahmed Munir<br>
> > ><br>
> > ><br>
> > ><br>
> ><br>
> ------------------------------------------------------------------------<br>
> > ><br>
> > > _______________________________________________<br>
> > > Users mailing list<br>
> > > <a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a> <mailto:<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>><br>
> <mailto:<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a> <mailto:<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>>><br>
> > > <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
> > ><br>
> ><br>
> ><br>
> > --<br>
> > Bogdan-Andrei Iancu<br>
> > <a href="http://www.voice-system.ro" target="_blank">www.voice-system.ro</a> <<a href="http://www.voice-system.ro" target="_blank">http://www.voice-system.ro</a>><br>
> <<a href="http://www.voice-system.ro" target="_blank">http://www.voice-system.ro</a>><br>
> ><br>
> ><br>
> ><br>
> ><br>
> > --<br>
> > Regards,<br>
> ><br>
> > Ahmed Munir<br>
> ><br>
> ><br>
> ><br>
> ------------------------------------------------------------------------<br>
> ><br>
> > _______________________________________________<br>
> > Users mailing list<br>
> > <a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a> <mailto:<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>><br>
> > <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
> ><br>
><br>
><br>
> --<br>
> Bogdan-Andrei Iancu<br>
> <a href="http://www.voice-system.ro" target="_blank">www.voice-system.ro</a> <<a href="http://www.voice-system.ro" target="_blank">http://www.voice-system.ro</a>><br>
><br>
><br>
><br>
><br>
><br>
> --<br>
> Regards,<br>
><br>
> Ahmed Munir<br>
><br>
><br>
> ------------------------------------------------------------------------<br>
><br>
> _______________________________________________<br>
> Users mailing list<br>
> <a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
> <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
><br>
<br>
<br>
--<br>
Bogdan-Andrei Iancu<br>
<a href="http://www.voice-system.ro" target="_blank">www.voice-system.ro</a><br>
<br>
<br><br></blockquote></div><br>-- <br>Regards,<br><br>Ahmed Munir<br><br><br>
</div>