星号拨号方案中的多行扩展

时间:2016-06-07 16:56:30

标签: asterisk

我的Asterisk扩展程序在很长的一行上运行。它的一部分是电子邮件的正文,其中包含多个换行符。如何在不弄乱电子邮件的情况下将扩展分解为多行(为了便于阅读)?

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)}' aag@aag.com)

2 个答案:

答案 0 :(得分:2)

创建一个shell脚本,该脚本采用各种${CDR}变量并使用它来生成消息正文并启动mail。这样您就不需要在拨号方案中维护消息正文文本了。

答案 1 :(得分:0)

您可以使用引号和双引号。

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

但是,您应该记住,如果字符串超过255个字符,则星号将忽略任何信息。