[SR-Users] kamailio as simple sip forwarder / gateway / proxy

Peter Gervai grinapo at gmail.com
Thu Dec 17 16:36:07 CET 2015


Hello,

I've been browsing the net and the (not so friendly) documentation but
found no readily available solution.
I have tried to fabricate on myself but it seems it's not that easy
without getting deeply familarised with
SIP protocol internals which I don't quite want know.

The problem seems simple enough, maybe you can easily tell the solution.

There is kamailio at ip 256.10.10.1. It's task is to accept
connections from SIP clients
and forward them to PBX at 256.20.20.1, and accept PBX packets and
forward them to the
clients.  PBX handles registration, options, invites, everything.
Kamailio does not authenticate, authorise, just forwards everything
back and forth, like a mindless proxy.
No NAT involved.

[The reason is that K. have to call external scripts whenever an
outbound call (towards the clients) is
initiated, which the PBX is unable to. Please don't advise other
solutions (which isn't able to call executables
in-session).]

I have created a simplistic config which is not expected to work and
it doesn't quite (plenty of security stuff left out now):

route {
 if(src_ip==myself) {
   add_path();
   $du="sip:256.20.20.1:95060";
 } else {
  if(src_ip!="256.20.20.1") {
    $du="sip:256.20.20.1:95060";
  } else { #from gateway pkts aren't changed
  }

  if(!t_relay()) {
    sl_reply_error();
    break;
  }
}


There is several possible problems, but it seems Contact: is one main
one since it contains the client instead of
the proxy. Possibly this may even be the almost-good solution.

I'm sure there's an easy and pretty solution so before I start to make
ugly ones I ask the wise people.

Thanks,
Peter



More information about the sr-users mailing list