How to create independent log file for each call

I need separated call log files.
how to create independent log file for each call?
if someone know this, please help me.

You would need to write something that would parse the log files, look for the thread ID and then write each one to it’s own file. There is nothing built into Asterisk that does this.

What exactly do you mean with “logfile”? CDR records? Console log? SIP traffic?

log file.
you can check log file location?
in there, we can see full.log etc file.
in here, we can see all log in the one file.
i dont want this.
I want to seperate call part in the full log file.

There’s NO such thing as “call part” in those logfiles, unless you raise the debug or verbose levels of the logs, which on active production servers will just waste a LOT of diskspace.

What exactly will you use the information for? What problem are you trying to solve?

It makes no sense asking for a cube, when all you wanna do, is play a nice game of golf, and really need a sphere.

ok.
I want to get dtmf code in log file without read function.
it is possible?

It might be, but it would make no sense to me, why you’d even want to do that, when you have so many other ways to react to keypresses in asterisk. Eg. using ARI or (E)AGI, if you need something more advanced than what is possible in other ways, like if you wanna make a telephone controlled game.

current If i use read function and AGI, i can not hear audio whlie dtmf part work.
I dont know the reason really.

Because that’s the way it works. It won’t do two things at once.

Well, in that case, you need to figure our what problem you need to solve, and why. If you don’t understand the actual problem your trying to solve, and only does what you’re directly told, you’ll have a hard time doing a great job.

Anyways, for getting the logs split by call, you need to filter them at regular intervals, it’s not really possible to do in real time, you might be able to have a background process watch the logfile, and react to new lines, but buffering, locks and other fun filesystem stuff, will make it hard to avoid delays, and even a few 100 ms of delay between action and reaction, will be noticeable.

The only way to react to key presses during a call, is feature codes.

while dtmf works, to hear audio, what i have to do?

Use feature codes.

sorry, I dont know about that.
could you give me some hints?

Sorry, but I won’t help any further.

As has already been said, Read will stop playing audio after the first digit.

If you want to play a certain audio bit, you can use Read digit by digit. However, this will start a separate audio file each digit.

If you want a continuous stream of audio, you could try using Playback combined with StoreDTMF(). You basically need a hook to collect the DTMF digits asynchronously while something else is running on the channel, which is what StoreDTMF does. However, that doesn’t work like Read as the functionality is quite a bit different. You may need a custom module for your specific use case if that doesn’t work, and you would probably need to hire somebody to write that for you.

Another option is to detect DTMF asynchronously using AMI.

It’s definitely possible to do what you want, but it may complicate things more you want and you should check your requirements to see if that’s really what you need.

To your other question, there is a DTMF log level so you can get a log file of just DTMF digits without all the other stuff.

1 Like

wow very interested.
I will check storeDMTF, and AMI in short time.
thanks.
and then DTMF log level creating, i have to change logger conf file?

Yes.

I checked AMI part.
I understand.
but stupid question.
I gonna run the ami event for dtmf with python.
if i run the python in calling, then i can get dtmf code with the python solution?

Back to the title of the thread…

This is just a thought, but how about configuring Asterisk to log everything to syslog?

I think rsyslogd can be configured to forward specific messages to another logging process.

So, write your own logging process and then you’re in control of nearly real-time messages and can act upon or log as you see fit.

This also sounds like an XY problem to me.

It sounds like the OP wants to use the logs for a call to detect DTMF digits, and that is most certainly the wrong way to do that.