Possible to get call debug number from /var/log/asterisk/full via dialplan?

The full log for asterisk contains a number generated for each call “thread”.
IE:
[Mar 26 14:03:06] DEBUG[24390] app_rxfax.c: Fax successfully received.
[Mar 26 14:03:06] DEBUG[24390] app_rxfax.c: Remote station id: unknown
[Mar 26 14:03:06] DEBUG[24390] app_rxfax.c: Local station id:
[Mar 26 14:03:06] DEBUG[24390] app_rxfax.c: Pages transferred: 1
[Mar 26 14:03:06] DEBUG[24390] app_rxfax.c: Image resolution: 8031 x 7700
[Mar 26 14:03:06] DEBUG[24390] app_rxfax.c: Transfer Rate: 9600

is it possible to get this number -(24390 in this instance) from the dialplan?

I’m trying to round up information regarding random failed faxes (1/20?) into a separate log file, and would like to be able to have the dialplan echo out the magic number to a temp file, then I would use a bash/perl script at the end of the dialplan to gather all the relevant data pertaining to the fax and email that to me.

I hacked this up to resolve this:

Modified [ext-fax] to insert “Fax Finish Time is:” statement.
(yes, this will be overwritten whenever freepbx reloads/saves information.)

[ext-fax]
.


exten => s,n,Noop(Receiving Fax for: ${FAX_RX_EMAIL} , From: ${CALLERID(all)})
exten => s,n(receivefax),Noop(Start time is: ${STRFTIME(${EPOCH},%b %d %H:%M:%S)})
exten => s,n,Set(FAXSTARTTIME=${STRFTIME(${EPOCH},%b %d %H:%M:%S)})
exten => s,n,rxfax(${ASTSPOOLDIR}/fax/${UNIQUEID}.tif|debug)
exten => h,1,GotoIf($["${FAXSTATUS:0:6}" = “FAILED”]?failed)
exten => h,n(process),GotoIf($[${LEN(${FAX_RX_EMAIL})} = 0]?end)
exten => h,n,System(${ASTVARLIBDIR}/bin/fax-process.pl --to ${FAX_RX_EMAIL} --from "[email protected]" --dest “${FROM_DID}” --subject "New $
exten => h,n,Noop(Fax finish time is: ${STRFTIME(${EPOCH},%b %d %H:%M:%S)})
exten => h,n,Set(FAXFINISHTIME=${STRFTIME(${EPOCH},%b %d %H:%M:%S)})
exten => h,n,System(/var/lib/asterisk/bin/calltrace.sh “${FAXSTARTTIME}” “${FAXFINISHTIME}”)
exten => h,n(end),Macro(hangupcall,)
exten => h,process+101(failed),Noop(FAX ${FAXSTATUS} for: ${FAX_RX_EMAIL} , From: ${CALLERID(all)})
exten => h,n,Macro(hangupcall,)

I have a bash script in /var/lib/asterisk/bin that looks like this:
It looks in the /var/log/asterisk/full log for the “Fax Finish Time is:” line with an additional timestamp, and pulls the wanted number out of the log.

#!/bin/bash #will locate a specific calltrace number within the Asterisk full log. # StartCallTime is passed via $1 and FinishCallTime is passed via $2 #sleep for 3 seconds to let the live log information be written to full. sleep 3 echo ========================================================= >>/var/log/asterisk/fax-in.log echo Start Call Time: $1 >>/var/log/asterisk/fax-in.log

A=cat /var/log/asterisk/full |grep "Fax finish time is:" |grep "$2"
#echo $A

#echo ${A##*VERBOSE}
B=echo ${A##*VERBOSE}

CALLNUM=echo ${B:1:7} |sed 's/[^0-9]*//g'
#echo $CALLNUM
cat /var/log/asterisk/full |grep $CALLNUM >>/var/log/asterisk/fax-in.log
echo Finish Fax Time: $2 >>/var/log/asterisk/fax-in.log

I’ve got a rough log of just incoming faxes at this point.