Hi,

On Wed, Sep 17, 2008 at 10:11 PM, Bill Root <[EMAIL PROTECTED]> wrote:
> sipxConfigGetNumAudioCodecs asserts if no codecs were found.  This is
> apparently because pInst->audioCodecSetting is not initialized in this case:
>
> SIPXTAPI_API SIPX_RESULT sipxConfigGetNumAudioCodecs(const SIPX_INST hInst,
>                                                      int* pNumCodecs)
> {
> ...
>         assert(pInst->audioCodecSetting.bInitialized);
> ...
> }
>
>
> My program is checking the number of loaded codecs.  If none were
> loaded, it would normally indicate a problem, but this assertion
> makes it impossible to check programmatically (using
> sipxConfigGetNumAudioCodecs, in any case).  Is there another way to
> determine that no codecs were loaded?  Or would it be unreasonable
> for sipxConfigGetNumAudioCodecs to just return zero (in the
> pNumCodecs arg) in this case?

Yeah, that sounds reasonable. I recommend using attached patch,
which I'll check in, once I figure out my password on the new svn server.

-- 
Regards,
Alexander Chemeris.

SIPez LLC.
SIP VoIP, IM and Presence Consulting
http://www.SIPez.com
tel: +1 (617) 273-4000
diff -r fa544efec546 sipXcallLib/src/tapi/sipXtapi.cpp
--- a/sipXcallLib/src/tapi/sipXtapi.cpp	Wed Oct 08 01:22:46 2008 +0400
+++ b/sipXcallLib/src/tapi/sipXtapi.cpp	Wed Oct 08 01:30:04 2008 +0400
@@ -6528,13 +6528,15 @@
 
     if (pInst && pNumCodecs)
     {
-        assert(pInst->audioCodecSetting.bInitialized);
-
         if (pInst->audioCodecSetting.bInitialized)
         {
             *pNumCodecs = pInst->audioCodecSetting.numCodecs;
-            rc = SIPX_RESULT_SUCCESS;
-        }
+        }
+        else
+        {
+            *pNumCodecs = 0;
+        }
+        rc = SIPX_RESULT_SUCCESS;
     }
     OsSysLog::add(FAC_SIPXTAPI, PRI_INFO,
         "sipxConfigGetNumAudioCodecs hInst=%p numCodecs=%d",
_______________________________________________
sipxtapi-dev mailing list
[email protected]
List Archive: http://list.sipfoundry.org/archive/sipxtapi-dev/

Reply via email to