[SR-Users] Preprocessor define puzzle

Daniel-Constantin Mierla miconda at gmail.com
Mon Nov 9 08:03:46 CET 2015


Hello,

for completion -- there should be a log message printed at startup when
the number of ifdefs/endifs is not the same.

Cheers,
Daniel

On 09/11/15 06:39, Alex Balashov wrote:
> I traced this bizarre behaviour to an unbalanced number of
> ifdefs/endifs, although it's still bizarre.
>
> On 11/08/2015 09:22 PM, Alex Balashov wrote:
>
>> Hi,
>>
>> I've got:
>>
>> # define WITH_VENDOR_ROUTING_LNPOIP
>>
>> at the top of my config. This is intended to mean that this constant is
>> commented out and disabled ('# define' vs. '#!define'), and tests
>> correctly in a given request route.
>>
>> Later:
>>
>> route[STAGE_3] {
>>     ...
>>
>> #!ifdef WITH_VENDOR_ROUTING_LNPOIP
>>      xlog("L_INFO", "LNPOIP ENABLED STAGE 3\n");
>> #!else
>>      xlog("L_INFO", "LNPOIP NOT ENABLED STAGE 3\n");
>> #!endif
>>
>>          route(OUTBOUND_VENDOR_SELECT);
>> }
>>
>> This tests correctly:
>>
>> Nov  8 21:17:54 centosity6 /usr/local/sbin/kamailio[12296]: INFO: LNPOIP
>> NOT ENABLED STAGE 3
>>
>> However, in route[OUTBOUND_VENDOR_SELECT]:
>>
>> #!ifdef WITH_VENDOR_ROUTING_LNPOIP
>>          xlog("L_INFO", "LNPOIP ENABLED\n");
>> #!else
>>          xlog("L_INFO", "LNPOIP NOT ENABLED\n");
>> #!endif
>>
>> This prints:
>>
>> Nov  8 21:17:54 centosity6 /usr/local/sbin/kamailio[12296]: INFO: LNPOIP
>> ENABLED
>> Nov  8 21:17:54 centosity6 /usr/local/sbin/kamailio[12296]: INFO: LNPOIP
>> NOT ENABLED
>>
>> ... which I must admit is quite puzzling. Looks like it's both defined
>> and not defined.
>>
>> Running 4.3:16be09c here.
>>
>> Thanks!
>>
>> -- Alex
>>
>
>

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Book: SIP Routing With Kamailio - http://www.asipto.com
Kamailio Advanced Training, Nov 30-Dec 2, Berlin - http://asipto.com/kat




More information about the sr-users mailing list