问题的实质。当设备忙时,重试不适用于Datacard。例如,如果2个呼叫文件立即启动,则只有一个可以工作,第二个会出错,不再尝试拨号:
[Nov 25 12:47:35] NOTICE[5801] pbx_spool.c: Call failed to go through, reason (0) Call Failure (not BUSY, and not NO_ANSWER, maybe
Circuit busy or down?)
以下是调用日志中的内容:
12:47:27 [74c414f9-b5b9-4c83-9ebd-79c7e417ca79]:{Type:1,Number:0038050xxxxxxx,Secret:xxx,Service:1}
12:47:35 [27a262f5-70dc-42bf-b023-0878712ac6cb]:{Type:1,Number:0038050yyyyyyy,Secret:xxx,Service:1}
12:47:49 [74c414f9-b5b9-4c83-9ebd-79c7e417ca79]: Call to +38050xxxxxxx ended with status OK.
这是我的通话文件:
#! /usr/bin/bash
CALL_SPOOL_DIR="/var/spool/asterisk/outgoing/"
CALL="/var/spool/asterisk/tmp/alarm-iax.call"
echo "Channel: Datacard/datacard0/$1">$CALL
echo "CallerId: 666">>$CALL
echo "MaxRetries: 10" >>$CALL
echo "RetryTime: 45">>$CALL
echo "WaitTime: 30">>$CALL
echo "Context: monitoring-alarm">>$CALL
echo "Extension: s">>$CALL
echo "Priority: 1">>$CALL
echo "Setvar: STATUS=$2">>$CALL
echo "Setvar: SERVICE=$3">>$CALL
echo "Setvar: NUM=$1">>$CALL
echo "Setvar: UID=$4">>$CALL
mv $CALL $CALL_SPOOL_DIR
扩展
[monitoring-alarm]
exten = s,1,Wait(0.5)
exten = s,2,Set(VOLUME(TX)=-5)
exten = s,3,Playback(${STATUS})
exten = s,4,Playback(ru_service)
exten = s,5,Playback(${SERVICE})
exten = s,6,Hangup
exten = h,1,System(echo ${STRFTIME(${EPOCH},"GMT-2","%a, %d %b %Y %H:%M:%S %z")}[${UID}]: Call to ${NUM} ended with status OK. >>
/var/log/informer.log)
答案 0 :(得分:1)
尝试通过本地频道:
将呼叫文件更改为
Channel: Local/$1@datacard/n
Set: datacardchan=datacard0
添加到extensions.conf
[datacard]
exten => _X.,1,Dial(Datacard/${datacardchan}/${EXTEN},,); dial
exten => _X.,n,Dumpchan; to see variables. remove in production
exten => _X.,n,Congestion; send congestion to pbx_spool
答案 1 :(得分:0)
Arheops迫使我做一些研究。这最终得到了下一个:
要使用Datacard处理重试,您应根据公式即时通话的最大数量 * 2 *(播放持续时间 + 延迟)在通话文件中设置WaitTime值重试之间)。在我的情况下,它的4-5次呼叫每次约10秒+ 20秒= 2 * 150 200-300秒就足够了。如果你错过了,那么当WaitTime熄灭时你会得到DIALSTATUS == CANCEL或DIALSTATUS == CHANUNAVAIL。
[datacard]
exten=_+X.,1,Set(ERROR_LOOP=0)
exten=_+X.,n(call),Dial(Datacard/${datacardchan}/${EXTEN},,M(alert^${STATUS}^${SERVICE}))
exten=_+X.,n(case1),GotoIf($[${HANGUPCAUSE} = 44]?error:case2)
exten=_+X.,n(case2),GotoIf($[${HANGUPCAUSE} = 17]?error:end)
exten=_+X.,n(error),System(echo ${STRFTIME(${EPOCH},"GMT-2","%a, %d %b %Y %H:%M:%S %z")}[${UID}]: Datacard is unavailable now. HANGUPCAUSE = ${HANGUPCAUSE}. ERROR_LOOP stage = ${ERROR_LOOP}. >> /var/log/informer-test.log)
exten=_+X.,n,Set(ERROR_LOOP=$[${ERROR_LOOP} + 1])
exten=_+X.,n,Wait(20)
exten=_+X.,n,GotoIf($[${ERROR_LOOP} <= 5]?call)
exten=_+X.,n,GotoIf($[${DIALSTATUS} = CANCEL]?retry)
exten=_+X.,n(end),Hangup
exten=_+X.,n(retry),Hangup(21)
exten=h,1,System(echo ${STRFTIME(${EPOCH},"GMT-2","%a, %d %b %Y %H:%M:%S %z")}[${UID}]: Calling process to ${NUM} ended with DIALSTATUS = ${DIALSTATUS}. >> /var/log/informer-test.log)
[macro-alert]
exten=s,1,Set(VOLUME(TX)=-5)
exten=s,n,Wait(0.5)
exten=s,n,Playback(${ARG1})
exten=s,n,Playback(ru_service)
exten=s,n,Playback(${ARG2})
呼叫文件
#! /usr/bin/bash
CALL_SPOOL_DIR="/var/spool/asterisk/outgoing/"
CALL="/var/spool/asterisk/tmp/alarm-iax.call"
echo "Channel: Local/$1@datacard/n">$CALL
echo "Set: datacardchan=datacard0">>$CALL
echo "WaitTime: 300">>$CALL
echo "Context: datacard">>$CALL
mv $CALL $CALL_SPOOL_DIR