Robert Moskowitz
2007-Nov-14 18:32 UTC
[asterisk-users] Help in getting a dialplan to produce the right CDR info
I have been shaking down a dialplan for SIP fax to efax. The basic senario is an ATA on the same subnet as the Asterisk 1.2 box (avoid RTP packet lose and thus fax crash), calling a 'fax extension' and envoking rxfax then email. I leverage off of context: from-internal-additional-custom, so as not to have it overwritten by FreePBX. In extension_custom.conf I have: [from-internal-additional-custom] include => ext-local-fax-custom #include extensions_fax.conf [custom-fax1] exten => s,1,Answer exten => s,n,StopPlayTones exten => s,n,Set(FAXFILE=/var/spool/asterisk/fax/${UNIQUEID}.tif) exten => s,n,rxfax(${FAXFILE}) exten => s,n,Hangup exten => h,1,system(/var/lib/asterisk/bin/fax-process.pl --to ${FAX_TO_EMAIL} --from ${FAX_RX_FROM} --subject "Fax from ${URIENCODE(${CALLERID(number)})} ${URIENCODE(${CALLERID(name)})}" --attachment fax_${URIENCODE(${CALLERID(number)})}.pdf --type application/pdf --file ${FAXFILE}); exten => h,2,Hangup() And extensions_fax.conf has: exten => 29809,1,Set(__FAX_TO_EMAIL=rgm at htt-consult.com) exten => 29809,n,Macro(just-user-callerid,) exten => 29809,n,Goto(custom-fax1,s,1) [macro-just-user-callerid] exten => s,1,Set(AMPUSER=${DB(DEVICE/${CALLERID(number)}/user)}) exten => s,n,Set(AMPUSERCIDNAME=${DB(AMPUSER/${AMPUSER}/cidname)}) exten => s,n,Set(CALLERID(all)=${AMPUSERCIDNAME} <${AMPUSER}>) ======================================================== I had to add the just-user-callerid macro to pick up the callerid name. But the goto custom-fax1 results in the destination extension for the CDR record to be 's'. If I make custom-fax1 a macro instead, I get the proper value for the CDR record, but the Hangup logic does not work. I suspect that before executing rxfax, I could SET a variable with the destination extension, and then in the Hangup logic push it back in, but I need some help. Or a better way. And yes, I know that Asterisk 1.4 supports T.38, and I have every intension to get things set with 1.4.... Thank you.