Using command line argument values in chan_sip.c

Hi everyone,

I have a problem that I can’t fix myself.

I want to use a command line argument variable in a different file than asterisk.c. I know it can be realized using the “extern” keyword. This is my code which is not working. The command line argument handling works just fine. But at the moment a SIP message gets into the system and the line where the variable is used get executed, the system remains silent.


#include "asterisk/chan_sip.h"
int VAR= 0;
[parsing of command line arguments and set VAR to value]
printf("%d\n", VAR); <== correct result


extern int VAR;


#include "asterisk/chan_sip.h"
extern int VAR;
printf("%d\n", VAR); <== system prints nothing

Can you spot any mistakes?


Please use the developer mailing list or IRC channel for developer questions.

1 Like