[Kamailio-Users] Checking the destination IP after dispatcher
Daniel-Constantin Mierla
miconda at gmail.com
Tue Jan 12 12:35:50 CET 2010
Hello,
On 1/11/10 6:55 PM, Geoffrey Mina wrote:
> this was from a regular route[] block. I ended up finding an old
> thread which pointed me in the right direction.
>
> I am currently using this to retrieve the destination IP POST dispatcher lookup:
>
> $var(destIP) = $(ru{s.select,1,:}{s.select,1,@});
>
> It seems to be working well. Anything I should be aware of while
> using this technique?
>
actually ds_next_dst() populates the dst uri, which is accessible via
$du. Make sure ds_append_branch parameter is set to 0:
http://kamailio.org/docs/modules/3.0.x/modules_k/dispatcher.html#id2543896
Then you call append_branch() after doing your IP check.
If you do ds_next domain() then you get the new address in r-uri
(therefore $ru).
To get access to dest uri domain, simply use: $dd.
Your expression with transformations will give you the ip along with
protocol and uri parameters, if they are present in r-uri.
Cheers,
Daniel
> thanks.
>
>
> On Mon, Jan 11, 2010 at 11:56 AM, Alex Balashov
> <abalashov at evaristesys.com> wrote:
>
>> Branch route?
>>
>> On 01/11/2010 11:50 AM, Geoffrey Mina wrote:
>>
>>
>>> What pseudo variable would i check after running ds_next_dst() to
>>> check the IP we are about to forward the INVITE to?
>>>
>>> Basically I want to have a check for $si == [something] to ensure I am
>>> not about to send the INVITE to the same UI which just requested it.
>>>
>>> While I have your attention, I may as well see if anyone has a better
>>> solution for what I am trying to accomplish:
>>>
>>> I am doing this because asterisk can't handle a hairpin scenario and I
>>> need to generate two distinct calls in my network, so I figure i'll
>>> just forward the request to another server in the network to deal with
>>> this.
>>>
>>> INVITE from PSTN --> Kamailio --> Asterisk#1 [Asterisk#1 needs to
>>> create a new session, but stay on-net] --> INVITE from Asterisk#1 to
>>> Kamailio --> [Dispatcher] --> INVITE from Kamailio to Asterisk#2
>>>
>>> This would basically create 3 legs of the call, which is what I want
>>>
>>> PSTN --> Asterisk#1 --> Asterisk#2
>>>
>>> I would prefer if Asterisk#1 could just INVITE to LocalHost, but that
>>> doesn't seem to be allowed. Not sure if that's a limitation of SIP or
>>> Asterisk...
>>>
>>> Thanks!
>>>
>>> _______________________________________________
>>> Kamailio (OpenSER) - Users mailing list
>>> Users at lists.kamailio.org
>>> http://lists.kamailio.org/cgi-bin/mailman/listinfo/users
>>> http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
>>>
>>
>> --
>> Alex Balashov - Principal
>> Evariste Systems
>> Web : http://www.evaristesys.com/
>> Tel : (+1) (678) 954-0670
>> Direct : (+1) (678) 954-0671
>>
>> _______________________________________________
>> Kamailio (OpenSER) - Users mailing list
>> Users at lists.kamailio.org
>> http://lists.kamailio.org/cgi-bin/mailman/listinfo/users
>> http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
>>
>>
> _______________________________________________
> Kamailio (OpenSER) - Users mailing list
> Users at lists.kamailio.org
> http://lists.kamailio.org/cgi-bin/mailman/listinfo/users
> http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
>
>
--
Daniel-Constantin Mierla
* http://www.asipto.com/
More information about the sr-users
mailing list