1
votes

I have an Asterisk extension that runs on a very long line. A part of it is the body of an email, which contains several line breaks. How can I break down the extension into multiple lines (for readability) without messing up the email?

same => n,System(echo -e "Asterisk call. \n Duration: ${CDR(billsec)} seconds.\n Caller ID ${CDR(clid)} \n Source ${CDR(src)} \n Destination ${CDR(dst)} \n Destination context ${CDR(dcontext)} \n Channel name ${CDR(channel)} \n Destination channel ${CDR(dstchannel)} \n Last app executed ${CDR(lastapp)} \n Last app's arguments ${CDR(lastdata)} \n Time the call started. ${CDR(start)} \n Time the call was answered. ${CDR(answer)} \n Time the call ended. ${CDR(end)} \n Duration of the call. ${CDR(duration)} \n Duration of the call once it was answered. ${CDR(billsec)} \n ANSWERED, NO ANSWER, BUSY ${CDR(disposition)} \n DOCUMENTATION, BILL, IGNORE etc ${CDR(amaflags)} \n The channel's account code. ${CDR(accountcode)} " | mail -s '${RESULTREV} (${CALLERID(num)}) called on ${STRFTIME(${EPOCH},,%A %d.%m.%Y at %H:%M:%S)}' [email protected])

2

2 Answers

2
votes

Create a shell-script that takes the various ${CDR} variables and use it to generate the message body and launch mail. That way you do not need to maintain the message body text inside your dialplan.

0
votes

You can use quote and doublequote.

http://www.voip-info.org/wiki/view/Asterisk+Expressions

However you should keep in mind that asterisk will ignore any info if string longer then 255 chars.