[SR-Users] Beginner Help: Relay vs Forward

Karsten Horsmann khorsmann at gmail.com
Wed Nov 20 14:21:23 CET 2019


Hi Michael,

the mostly used model AFAIK is dispatcher cos you can define groups (also
with only one member). That's more flexible if you scale up the backend
services.


Also an docker newbie the macvlan driver gives you native ip access within
the container.

The socket error message shows up an socket in Kamailio config like listen
directive that is not available but the config generates an request for
that.


can't fwd to af 2, proto 1 (no corresponding listening socket)

Did you switch protocols from udp to tcp or vice versa? Then you need also
udp AND tcp enabled in Kamailio.

Cheers
Karsten Horsmann


Michael Iedema <michael at kapsulate.com> schrieb am Di., 19. Nov. 2019, 10:30:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20191120/928d1722/attachment.html>


More information about the sr-users mailing list