[SR-Users] simple proxy

Daniel-Constantin Mierla miconda at gmail.com
Wed Nov 23 12:35:50 CET 2011


Hello,

keep the mailing list cc-ed, private messages from public mailing list 
discussions are going to be discarded.

See the comments inline.

On 11/23/11 12:20 PM, Iurii Andamasov wrote:
> Hello Daniel,
> i
> 23.11.2011, в 8:43, Daniel-Constantin Mierla написал(а):
>
>> Hello,
>>
>> On 11/23/11 4:02 AM, Iurii Andamasov wrote:
>>> Hello list.
>>> First of all sorry for dump question, i'm pretty new to kamailio so i hope someone point me in right direction
>>>
>>> currently i have one sip device which can handle sip request only from one ip,
>>> my goal is to put kamailio in front of it so i can proxy requests from several ips
>>>
>>> i added this to conf
>>>
>>> route{
>>> if ( src_ip == 10.46.1.121 || src_ip == 10.46.1.122 ) {
>>> if(method == "INVITE") {
>>> $rd="10.46.29.10";
>>> t_relay();
>>> }
>>> }
>>>
>>> and calls seems connecting but signaling is completely broken
>>>
>>> i understand that i'm doing something wrong, but can't get what is wrong
>> can you explain what is broken and what you would expect to happen?
> seems that occurs timeouts, from your next message i understand why,
> what i need it just to pass call through kamailio from that 2 ips

If you need to route all requests within a call through kamailio, then 
you need to use loose routing (see rr module).

Maybe it would be easier for you to start with an existing example of 
config, if the default config is too big to understand, maybe the one 
from dispatcher is simpler:

http://kamailio.org/docs/modules/stable/modules_k/dispatcher.html#id2523004

It has the parts of routing requests within dialog, you need to replace 
the part that uses dispatcher module with your forwarding to a specific 
ip (or use dispatcher and have that ip as single destination there).
Before line 'route(DISPATCH);' add the condition to deny INVITEs that 
don't match the trusted source ips:

if ( ! (src_ip == 10.46.1.121 || src_ip == 10.46.1.122 )) {
    send_reply("403", "Forbidden");
    exit;
}

Cheers,
Daniel

-- 
Daniel-Constantin Mierla -- http://www.asipto.com
Kamailio Advanced Training, Dec 5-8, Berlin: http://asipto.com/u/kat
http://linkedin.com/in/miconda -- http://twitter.com/miconda




More information about the sr-users mailing list