Hi All,
 
I'm using sipXtapi branch. SipUserAgent::SipUserAgent(...) constructor has null pointer (pContact = NULL) access in the following piece of code when no contact is added in mContactDb.

    if (!defaultAddress || strcmp(defaultAddress, "0.0.0.0") == 0)
    {
        // get the first CONTACT entry in the Db
        SIPX_CONTACT_ADDRESS* pContact = mContactDb.find (1);
        // Bind to the contact's Ip
        defaultSipAddress = pContact->cIpAddress;
    }

Actually sipXportLib\src\os\Wnt\getWindowsDNSServers.cpp::getAllLocalHostIps returns zero addresses when numAddresses=0. So createServerSocket, that fills the contact database down the line from inside SipUserAgent::addContactAddress, is not called. See code below.

SipUdpServer::SipUdpServer(...)
{
.
.
.
        int numAddresses = 0;
        const HostAdapterAddress* adapterAddresses[MAX_IP_ADDRESSES];
        getAllLocalHostIps(adapterAddresses, numAddresses);

        for (int i = 0; i < numAddresses; i++)
        {
            int serverSocketPort = port;
           
            createServerSocket(adapterAddresses[i]->mAddress.data(),
.
.
.
}

The bug can be temporarily solved by calling sipxInitialize with a good IP address (NOT "0.0.0.0") from application. A ground level fix, that works for me, is to make getAllLocalHostIps return all card addresses when numAddresses=0. See diff below.

D:\SIP\sipfoundry\sipX\src\sipXtapi\sipXportLib\src\os\Wnt>svn diff getWindowsDNSServers.cpp
Index: getWindowsDNSServers.cpp
===================================================================
--- getWindowsDNSServers.cpp     (revision 7258)
+++ getWindowsDNSServers.cpp    (working copy)
@@ -544,7 +544,12 @@
             char szAddr[16];

             memset((void*)szAddr, 0, sizeof(szAddr));
-            int maxAddresses = numAddresses;
+            int maxAddresses = 0;
+                       if (numAddresses > 0)
+                               maxAddresses = numAddresses;
+                       else
+                               maxAddresses = MAX_IP_ADDRESSES;
+
             rc = true;
             numAddresses = 0;

---
Regards,
KF
Rebaca Technologies, India
 
_______________________________________________
sipxtapi-dev mailing list
[email protected]
List Archive: http://list.sipfoundry.org/archive/sipxtapi-dev/

Reply via email to