Search code examples
fileasteriskphone-callabort

Asterisk - abort scheduled auto dial - call file spool


Is there any way to flush pbx_spools's cache? pbx_spool.so didn't support reload by CLI too.

Example:

#!/bin/bash
cat >/tmp/wakeup.call <<EOF
Channel: SIP/telefon
CallerID: "Weckruf" <9999>
MaxRetries: 3
WaitTime: 60
Context: wecker
Extension: s
Priority: 1
EOF
touch -d "7 hours" /tmp/wakeup.call

# At this point Asterisk learns his task
mv /tmp/wakeup.call /var/spool/asterisk/outgoing/

# for demonstration I decided to not want to be waken later
sleep 10 && rm /var/spool/asterisk/outgoing/wakeup.call

Finally Asterisk does ring 7 hours later...

I'd expect, if I delete the .call-file manually from /var/spool/asterisk/outgoing/ before it should be dialed that Asterisk didn't place the call anymore. But it does.


Solution

  • The solution to this behavior is the use of unique filenames.

    Asterisk reads in the callfile at the point of creation and only checks at the time of execution if a file with that identical name is still present. Regardless of what's in there.

    Either Asterisk didn't mention the removal of the file in between. The filename with its contents is still hammered in the stack and even newly created files with the same filename are ignored. Only the presence of a file with that name at the time of execution makes asterisk triggering the initial callfile contents.