0

I have developed a small voip client application in C using sofia library and based on the sofia-sip client example. Evertyhing works fine but one thing, if my Ip address changes once the application is running sofia doesn't update itself. I'll explain myself:

When I execute my voip application (running in Linux) sofia takes the current Ip address and the application will accept all the incoming calls to that address.

If the IP of the device where the application is running is changed (updating network config of Linux) i'm not able to update sofia in order to work with the new ip, therefore any incoming call is not received.

I've tried with ssc_set_public_address, which updates ssc_address and set the new value in nua using nua_set_params:

/**
* Sets the public address used for invites, messages,
* registrations, etc method.
*/
void ssc_set_public_address(ssc_t *ssc, const char *address)
{
  if (address) {
    su_free(ssc->ssc_home, ssc->ssc_address);
    ssc->ssc_address = su_strdup(ssc->ssc_home, address);

    nua_set_params(ssc->ssc_nua,
    SIPTAG_FROM_STR(ssc->ssc_address),
    TAG_NULL());
  }
}

After doing it, it looks like the internal ip address has changed (if I read it using get_params I get the new one), however something is missed because no incoming call will be received.

In order to work with the new IP I need to reboot the whole application.

Does anybody know how to really update the sofia IP without rebooting the application?

Thank you.

Omsitelta
  • 105
  • 9
  • Have you re-registered to the server using the new IP? – Shark Jan 11 '17 at 13:37
  • Commonly daemons re-read theit configuration on `SIGHUP`. You should follow that convention. And permanently changing the IP is probably not a good idea anyway. – too honest for this site Jan 11 '17 at 13:50
  • @Shark I have tried to do this using the ssc_register service, but I'm not sure if that is what you mean. What server do you refer to? – Omsitelta Jan 12 '17 at 14:14
  • @Olaf The daemon is not the problem here. It does it works correctly (which is update the network configuration files and ifdown && ifup to restart the network whe the user wants to change the IP). The IP is not going to change permnently, but it can be changed from time to time and the main application should not be rebooted. – Omsitelta Jan 12 '17 at 14:16
  • That was not my point. Your program should catch `SIGHUP` and reconnect correctly. You might need your of if-up/down script or dbus integration for this. – too honest for this site Jan 12 '17 at 15:25
  • The server you send your initial REGISTRATION request to... – Shark Jan 12 '17 at 15:54

0 Answers0