A few quick thoughts on this:



Regards,
Kaufman

From: Fernando Lopes via sr-users <sr-users@lists.kamailio.org>
Sent: Wednesday, July 23, 2025 11:48 AM
To: sr-users@lists.kamailio.org <sr-users@lists.kamailio.org>
Cc: Fernando Lopes <fernandolopes20003@gmail.com>
Subject: [SR-Users] Error: different number of preprocessor directives
 
CAUTION: This email originated from outside the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.


Hello everyone,

I'm having an issue with my Kamailio config where I'm getting the following error:

ERROR: bad config file (0 errors) (parsing code: 0)
0(2) ERROR: <core> [core/ppcfg.c:276]: pp_ifdef_level_error(): different number of preprocessor directives: 1 more #!if[n]def as #!endif

I've gone through the config up and down so many times and can't seem to find the problem. I have a definitions.cfg file where I define all the variables, and I’ve made sure that every #!ifdef WITH_SOMETHING has a corresponding definition.
I also ran this command (recommended by GPT):

grep -E '#!ifn?def|#!endif' /usr/local/etc/kamailio/kamailio.cfg

It shows matching numbers of #!ifdef and #!endif, and I’ve checked it manually several times — everything looks fine.
Any tips for debuging or finding the problem.

#!ifdef WITH_CDRS
#!endif
#!ifdef WITH_DEBUG
#!endif
#!ifdef WITH_TLS
#!endif
#!ifdef WITH_NAT
#!endif
#!ifdef WITH_TLS
#!endif
#!ifdef WITH_FAIL2BAN
#!ifdef WITH_ANTIFLOOD
#!endif
#!endif
#!ifdef WITH_DISPATCHER
#!endif
#!ifdef WITH_RESPONSE_STATS
#!endif
#!ifdef WITH_HOMER
#!endif
#!ifdef WITH_CDRS
#!endif
#!ifdef WITH_RTPENGINE
#!endif
#!ifdef WITH_HTTP
#!endif
#!ifdef WITH_WEBSOCKETS
#!endif
#!ifdef WITH_NAT
#!ifdef WITH_RTPENGINE
#!endif
#!endif
#!ifdef WITH_TLS
#!endif
#!ifdef WITH_ANTIFLOOD
#!endif
#!ifdef WITH_FAIL2BAN
#!endif
#!ifdef WITH_DISPATCHER
#!endif
#!ifdef WITH_HOMER
#!endif
#!ifdef WITH_CDRS
#!endif
#!ifdef WITH_FAIL2BAN
#!endif
#!ifdef WITH_RTPENGINE
#!endif
#!ifdef WITH_HOMER
#!endif
#!ifdef WITH_RTPENGINE
#!endif
#!ifdef WITH_ANTIFLOOD
#!endif
#!ifdef WITH_NATSIPPING
#!endif
#!ifdef WITH_NOAUTH_PRIVATE_NET
#!endif
#!ifdef WITH_AUTH
#!endif
#!ifdef WITH_NAT
#!endif
#!ifdef WITH_NAT
#!endif
#!ifdef WITH_NAT
#!endif
#!ifdef WITH_RTPENGINE
#!endif
#!ifdef WITH_DISPATCHER
#!endif
#!ifdef WITH_WEBSOCKETS
#!endif
#!ifdef WITH_HTTP
#!ifdef WITH_WEBSOCKETS
#!endif
#!endif
#!ifdef WITH_RTPENGINE
#!endif

Thank you.
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions -- sr-users@lists.kamailio.org
To unsubscribe send an email to sr-users-leave@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!