[SR-Users] Beginner Help: Relay vs Forward

Daniel-Constantin Mierla miconda at gmail.com
Wed Nov 20 17:55:16 CET 2019


Hello,

adding few notes ...

Like Alex said in another response, the get_out_socket() error is when
Kamailio doesn't find a IP routing path between its listen socket and
target address (sip:192.168.86.110:5061).

Then, to your initial message: t_relay() does not create/track dialogs,
only SIP transactions (request-to-final-response).

If you just need to route SIP traffic without re-routing, accounting,
etc... then forward() (stateless mode) is ok.

If you forward REGISTER via intermediary proxy, then you have to do Path
handling (see path module).

Then, just for information, port 5061 is typically associated with TLS,
however there is no restriction to use it for udp.

Cheers,
Daniel

On 20.11.19 13:55, Michael Iedema wrote:
> I’ve switched from a Dockerized Kamailio instance to a native installation. Here is my most recent trace when trying to forward traffic:
>
>  0(70677) INFO: <script>: ORIGINATOR -> REGISTER: Destination URI is now sip:192.168.86.110:5061
>  0(70677) ERROR: *** cfgtrace:request_route=[DEFAULT_ROUTE] c=[/etc/kamailio/kamailio-proxy.cfg] l=155 a=24 n=t_relay
>  0(70677) ERROR: <core> [core/forward.c:181]: get_out_socket(): no socket found
>  0(70677) ERROR: <core> [core/forward.c:183]: get_out_socket(): no corresponding socket found for(udp:192.168.86.110:5061)
>  0(70677) ERROR: tm [./ut.h:318]: uri2dst2(): no corresponding socket found for "192.168.86.110" af 2 (udp:192.168.86.110:5061)
>  0(70677) ERROR: tm [t_fwd.c:467]: prepare_new_uac(): can't fwd to af 2, proto 1  (no corresponding listening socket)
>  0(70677) ERROR: tm [t_fwd.c:1724]: t_forward_nonack(): failure to add branches
>  0(70677) ERROR: *** cfgtrace:request_route=[DEFAULT_ROUTE] c=[/etc/kamailio/kamailio-proxy.cfg] l=156 a=2 n=exit
>
>
> My Kamailio instance is running on 192.168.86.107:6060. The originating service is on 192.168.86.110:5060. The REGISTER service is on 192.168.86.110:5061.
>
> The refactor in my architecture I’m trying to make is:
>  - previously: Originator Service -> Register Service
>  - now: Originator -> Kamailio -> Register Service
>
> I’m trying to get traffic from 192.168.86.110:5060 to route to 192.168.86.110:5061 but keep seeing this “no socket found” error. I didn’t think I was trying to bind that address, just rewriting the $du to point to the different host and port...
>
>
>  # ORIGINATOR sent us something
>  if ( $(ct{nameaddr.uri}{uri.port}) == PORT_ORIGINATOR ) {
>
>    xlog("L_INFO", "ORIGINATOR: sent $rm\n”);
>
>    if (is_method("REGISTER")) {
>      $du = "sip: HOST_REGISTER:PORT_REGISTER";
>      xlog("L_INFO", "ORIGINATOR -> REGISTER: Destination URI is now $du\n");
>      t_relay();
>      exit;
>    }
>   ...
>  }
>
> ## END SNIPPET ##
>
>
>
> Apologies if I’m missing something obvious! Thanks as always for your time.
>
> -Michael
>
>
>
>> On Nov 19, 2019, at 10:24, Michael Iedema <michael at kapsulate.com> wrote:
>>
>> Hi all,
>>
>> I am trying to place Kamailio between several SIP services which are differentiated by port and by the type of message they handle. To be concrete, here are the services:
>>
>> Originator:
>> - reachable on port 5060
>> - originates all traffic to the services
>>
>> Service A:
>> - reachable on port 5061
>> - handles REGISTER
>>
>> Service B:
>> - reachable on port 5062
>> - handles INVITE
>>
>> Service C:
>> - reachable on port 5063
>> - handles MESSAGE
>>
>> The services, originator and Kamailio instance may all be run on the same IP or may be split onto different addresses. Previously, the originator needed to know the address and port of each service. Now I want to make Kamailio responsible for that task so it can be done more intelligently.
>>
>> To start though I simply want to get traffic flowing between the services and this is where I’m struggling to climb the learning curve. In my test setup the originator and all services are on the same IP with only Kamailio running on a different IP.
>>
>> Address 1            Address 2
>> ========================
>> Originator  <-->  Kamailio:6060
>>                               |
>>                               |
>> Service A  <-------> |
>> Service B  <-------> |
>> Service C  <-------> |
>>
>>
>> My first attempt at the logic looks like this:
>>
>> # HOST DEFINITIONS
>> #!substdef "/HOST_ORIGINATOR/192.168.86.110/"
>> #!substdef "/HOST_REGISTER/192.168.86.110/“
>> #!substdef "/HOST_INVITE/192.168.86.110/"
>> #!substdef "/HOST_MESSAGE/192.168.86.110/"
>>
>> # PORT DEFINITIONS
>> #!substdef “/PORT_ORIGINATOR/5060/"
>> #!substdef "/PORT_REGISTER/5061/“
>> #!substdef "/PORT_INVITE/5062/"
>> #!substdef "/PORT_MESSAGE/5063/"
>>
>> # ROUTE LOGIC
>> route {
>>
>>  # ORIGINATOR sent us something
>>  if ( $(ct{nameaddr.uri}{uri.port}) == HOST_ORIGINATOR ) {
>>
>>    xlog("L_INFO", "ORIGINATOR: sent $rm\n”);
>>
>>    if (is_method("REGISTER")) {
>>      $du = "sip: HOST_REGISTER:PORT_REGISTER";
>>      xlog("L_INFO", "ORIGINATOR -> REGISTER: Destination URI is now $du\n");
>>      t_relay();
>>      exit;
>>    }
>>  }
>>>>
>> #### END SNIPPET ####
>>
>>
>> My very newbie questions are:
>> - Am I even on the right track here? I understand that t_relay() establishes a stateful dialog handler between the originator and register services.
>> - Can I accomplish this bi-directional path statelessly with forward()?
>> - Do I need to add logic to handle the messages from the REGISTER service back to ORIGINATOR?
>>
>> This config currently fails because of "no corresponding socket found” when the relay triggers. I believe this is because I’m running the Kamailio instance in a Docker container so my first step today is to set up a native install.
>>
>> I also looked at the dispatcher module which seems very close to what I want to do. Maybe that’s a more natural way to go?
>>
>>
>>
>> Anyway, apologies for the lengthy explanation. I hope it is at least clear what I intend to do. I will gladly research and do trial and error to solve this but need to know I’m going down roughly the right path. I’m not sure what I should even be googling even of the time :-)
>>
>>
>> Thanks as always for your time and the great software!
>>
>> Regards,
>> -Michael
>>
>>
>>
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio World Conference - April 27-29, 2020, in Berlin -- www.kamailioworld.com




More information about the sr-users mailing list