HI, we need the unique id contained in $(UNIQUEID) variable to be printed in every log statement of the call, that the unique id is associated with.
Currently we tried several approach(using grep, verbose(), log() application) mentioned in this asterisk mail, but couldn’t get it in every log line.
The application, Verbose() and Log(), just prints the id only once, but we need it to be printed in every log corresponding to a call. So that we can debug / trace that call.
We’re using CDR to save the call records, but that is not sufficient to debug the call.
So please tell us, are there any other workaround / ways for this?
Ok, but that Id is only created after the channel is established between two endpoints, right?.
So I generated an error while calling ( intentionally ) and confirmed that Call Identifier is not printed in logs if some error occurs.
Also why TID ( thread Id ) which is printed along the log level, is not recommended to grep the logs for a particular call?. Can it be duplicate or what?.
A lot of events for a SIP call are handled on the thread that handles incoming SIP requests, rather than the PABX thread. Some events may be the result of scheduled operations run on timers.
As well a call identifier won’t exist if a call doesn’t exist in Asterisk, ie: it was rejected early. You wouldn’t have a unique id in that case either.
Ok, thank you that clears some doubt I had.
So what I did is modified the logger.c to print the uniqueid and how I got that uniqueid? I made a function in cdr.c to get it. But this is wrong, as it’s values changes and doesn’t persist.
Can you please guide me how can I get uniqueid in logger.c? then this is solved.
Edit : I rectified it using volatile as variable type of a variable, in which I’m saving the uniqueid in cdr.c. Also I tested this using concurrent calls, everything is working as it should.
So just confirming now, am I doing it right? Some tips on this?