< Previous by Date Date Index Next by Date >
  Thread Index  

[reSIProcate-users] The DNS is not works on iPhone


Hi, I have tried run the resip on iPhone, but it not works with DNS, I'm found below code it's seems not support iOS, does anyone knows how to support the iOS ?

Thanks


 #if defined(__APPLE__) || defined(__MACH__)
static void init_by_defaults_apple_nameservers(ares_channel channel)
{
  SCDynamicStoreContext context = {0, NULL, NULL, NULL, NULL};
  SCDynamicStoreRef store = 0;
  
  channel->nservers = 0;
  // .amr. iPhone/iOS SDK's don't support SCDynamicStoreCreate so in that case fall back
  // to the nservers=0 case.
#ifndef TARGET_OS_IPHONE
  store = SCDynamicStoreCreate(NULL, CFSTR("init_by_defaults_apple_nameservers"), NULL, &context);

  if (store)
  {
    // kSCDynamicStoreDomainState/kSCCompNetwork/kSCCompGlobal/kSCEntNetDNS
    CFStringRef key = CFSTR("State:/Network/Global/DNS");
    CFDictionaryRef dnsDict = SCDynamicStoreCopyValue(store, key);

    if (dnsDict)
    {
      CFArrayRef addresses = (CFArrayRef) CFDictionaryGetValue(dnsDict, kSCPropNetDNSServerAddresses);
      if (addresses)
      {
        //CFShow(addresses);
        channel->nservers = CFArrayGetCount(addresses);
        channel->servers = malloc(channel->nservers * sizeof(struct server_state));
        memset(channel->servers, '\0', channel->nservers * sizeof(struct server_state));

        int i;
        for (i = 0; i < channel->nservers; i++)
        {
          CFStringRef address = CFArrayGetValueAtIndex(addresses, i);
          //CFShow(address);
          const int kBufferSize = 20;
          char str[kBufferSize];

          CFStringGetCString(address, str, kBufferSize, kCFStringEncodingUTF8);
          inet_pton4(str, (u_char*)&channel->servers[i].addr);
#ifdef USE_IPV6
          channel->servers[i].family = AF_INET;
#endif
        }
      }

      CFRelease(dnsDict);
    }

    CFRelease(store);
  }
#endif // TARGET_OS_IPHONE
}
#endif 

Attachment: ios_log.log
Description: Binary data