Thanks Miklos,
I think this is just what I'm looking for. But I get some errors for this line: if ((src_ip != @ruri.host) || (src_port != @ruri.port)) {
0(30074) parse error (175,16-17): syntax error 0(30074) parse error (175,16-17): ip address or hostname expected 0(30074) parse error (175,16-17): bad command 0(30074) parse error (175,21-22): bad command 0(30074) parse error (175,21-22): bad command 0(30074) parse error (175,26-27): bad command 0(30074) parse error (175,26-27): bad command 0(30074) parse error (175,28-30): bad command 0(30074) parse error (175,31-32): bad command 0(30074) parse error (175,32-40): bad command 0(30074) parse error (175,41-43): bad command 0(30074) parse error (175,44-45): bad command 0(30074) parse error (175,49-50): bad command 0(30074) parse error (175,49-50): bad command 0(30074) parse error (175,54-55): bad command 0(30074) parse error (175,54-55): bad command 0(30074) parse error (175,55-56): bad command 0(30074) parse error (175,57-58): bad command
Any idea why ?
Thanks, ilker
-----Original Message----- From: Miklos Tirpak [mailto:miklos@iptel.org] Sent: Wednesday, July 12, 2006 11:58 AM To: İlker Aktuna (Koç.net) Cc: serusers@iptel.org Subject: Re: [Serusers] prevent INVITE without REGISTERing
Hi Ilker,
just my first idea, not tested:
1. lookup the From HF
if (!lookup_user("From")) { # reject the INVITE ... }
2. save original To UID and Request URI
$orig_to_uid = $tu.uid; $orig_req_uri = @ruri;
3. set To UID -- registrar module will use this in the lookup
$tu.uid = $fu.uid;
4. lookup From HF and compare the source address of the INVITE with the source address of the REGISTER message
if (lookup("location")) { if ((src_ip != @ruri.host) || (src_port != @ruri.port)) { # reject the INVITE ... } # restore original To UID and Request URI $tu.uid = $orig_to_uid; attr2uri("$orig_req_uri"); } else { # reject the INVITE ... }
Note, that the above solution is a bit ugly, you can get into troubles when the user registers multiple contact addresses. It is better to disable branches (see append_branches parameter in registrar module), but you loose some functionality.
Regards, Miklos
İlker Aktuna (Koç.net) wrote:
http://387555.sigclick.mailinfo.com/sigclick/060A030C/040D4D00/06020645/0315249181.jpg _____________________________________________________________________________________________________________________________________________ Bu e-posta mesaji kisiye ozel olup, gizli bilgiler iceriyor olabilir. Eger bu e-posta mesaji size yanlislikla ulasmissa, icerigini hic bir sekilde kullanmayiniz ve ekli dosyalari acmayiniz. Bu durumda lutfen e-posta mesajini kullaniciya hemen geri gonderiniz ve tum kopyalarini mesaj kutunuzdan siliniz. Bu e-posta mesaji, hic bir sekilde, herhangi bir amac icin cogaltilamaz, yayinlanamaz ve para karsiligi satilamaz. Bu e-posta mesaji viruslere karsi anti-virus sistemleri tarafindan taranmistir. Ancak yollayici, bu e-posta mesajinin - virus koruma sistemleri ile kontrol ediliyor olsa bile - virus icermedigini garanti etmez ve meydana gelebilecek zararlardan dogacak hicbir sorumlulugu kabul etmez. This message is intended solely for the use of the individual or entity to whom it is addressed , and may contain confidential information. If you are not the intended recipient of this message or you receive this mail in error, you should refrain from making any use of the contents and from opening any attachment. In that case, please notify the sender immediately and return the message to the sender, then, delete and destroy all copies. This e-mail message, can not be copied, published or sold for any reason. This e-mail message has been swept by anti-virus systems for the presence of computer viruses. In doing so, however, sender cannot warrant that virus or other forms of data corruption may not be present and do not take any responsibility in any occurrence. _____________________________________________________________________________________________________________________________________________
İlker Aktuna (Koç.net) wrote:
You can access src_ip and src_port via xl_lib:
$registered_host = @ruri.host; $registered_port = @ruri.port;
if ((!avp_equals_xl("$registered_host", "%si")) || (!avp_equals_xl("$registered_port", "%sp"))) { ...
Miklos