Kamailio Advanced Training
Click here for more details!

Learn how to build RTC services with Kamailio!

Thursday, October 14, 2010

Best of New in Kamailio 3.1.0 - #10: Registration to Remote SIP Servers

Many DID providers require to register to their servers in order to route the calls to your server. While the recommended way is to get a peering agreement where all calls to your block of DIDs are sent to the IP address of your SIP server, in some cases, like SOHO or SMB, you usually register to some VoIP services that offer free DIDs. Then is hard to get a peering agreement just for one or two DIDs.

Normally you used such providers only for incoming calls, for outgoing you have a least cost routing system selecting the best route from many termination providers.

Kamailio 3.1.0 introduces a handy way to configure your SIP proxy to register to other SIP servers for incoming calls. You have to load uac module and add records to uacreg table. The table stores following attributes:
  • l_uuid - local unique user id, e.g.,: 12345678
  • l_username - local user name, e.g.,: daniel
  • l_domain - local domain, e.g.,: mysipserver.com
  • r_username - remote username, e.g.,: daniel123
  • r_domain - remote domain, e.g.,: sipprovider.com
  • realm - remote relam, e.g.,: sipprovider.com
  • auth_username - authentication username, e.g.,: daniel123
  • auth_password - authentication password, e.g.,: xxxxxx
  • auth_proxy - SIP address of authentication proxy, e.g.,: sip:sipprovider.com
The module takes care of sending REGISTER and refresh registrations before they expire.

When calls come in, you have to run uac_reg_lookup() that will detect if the call is coming from a remote SIP provider and can change the R-URI to local username@domain. Afterwards you can run location lookup.
if(uac_reg_lookup("$rU", "$ru")) {
xlog("request from a remote SIP provider [$ou => $ru]\n");

}
lookup("location");
The documentation for uac module is available at:

No comments:

Post a Comment