Tuesday, July 7, 2009

Groundhog Day Reminders

Voice reminders via telephone input were not working properly. Every time the 8-digit date was entered, it would playback today's date instead of the date entered. The same problem occurred for the time: we would hear the current time rather than the entered time.

I snooped around extensions_custom.conf , in which the dialplan was located. The key parts were:

[reminder2] and [reminder4]

After looking up each command that was called, I noticed this:
http://www.voip-info.org/wiki/view/Asterisk+cmd+AGI

Thanks to my upgrade to Asterisk 1.6, the AGI command now has a different separator for arguments! ie. None of the arugments were being read, which is why Trixy decided to repeat the same day and time every time!

The fix for Asterisk 1.6:

Change all "|" in AGI commands to "," . ie:

[reminder2]
exten => s,1,Set(TIMEOUT(digit)=7)
exten => s,2,Set(TIMEOUT(response)=10)
exten => s,3,Read(APPTDT,custom/reminder2,8)
exten => s,4,AGI(checkdate.php|${APPTDT})
...
exten => s,4,AGI(checkdate.php|${APPTDT}) should be exten => s,4,AGI(checkdate.php,${APPTDT})


[reminder4]
exten => s,1,Set(TIMEOUT(digit)=7)
exten => s,2,Set(TIMEOUT(response)=10)
exten => s,3,Read(APPTTIME,custom/reminder3,4)
exten => s,4,GotoIf($["foo${APPTTIME}" < "foo1200"]?reminder5,s,1) exten => s,5,AGI(checktime.php|${APPTDT}|${APPTTIME}|0|${APPTPHONE})
...
exten => s,12,AGI(checktime.php|${APPTDT}|${APPTTIME}|1200|${APPTPHONE})
exten => s,5,AGI(checktime.php|${APPTDT}|${APPTTIME}|0|${APPTPHONE})... should be exten => s,5,AGI(checktime.php,${APPTDT},${APPTTIME},0,${APPTPHONE}) and
exten => s,12,AGI(checktime.php,${APPTDT},${APPTTIME},1200,${APPTPHONE})

I also found it in this section, which actually sets the reminder. This explains why no reminders were being sent out regardless of the time inputed.
[reminder9a]
exten => s,1,NoOp(APPTDT: ${APPTDT})
exten => s,2,NoOp(APPTTIME: ${APPTTIME})
exten => s,3,NoOp(APPTPHONE: ${APPTPHONE})
exten => s,4,NoOp(RECURRING: ${APPTRECUR})
exten => s,5,NoOp(APPTMSG: /var/lib/asterisk/sounds/custom/${APPTTIME}.${APPTDT}.${APPTP$
exten => s,6,Playback(your-msg-has-been-saved)
exten => s,7,Playback(goodbye)
exten => s,8,Wait(2)
exten => s,9,Hangup
exten => h,1,System(/bin/mv -f /var/lib/asterisk/sounds/custom/${TMPMSG}.gsm /var/lib/as$
exten => h,2,DeadAGI(reminder.php|${APPTDT}|${APPTTIME}|${APPTPHONE}|${APPTRECUR})
exten => h,3,Hangup

exten => h,2,DeadAGI(reminder.php|${APPTDT}|${APPTTIME}|${APPTPHONE}|${APPTRECUR}) should be
exten => h,2,DeadAGI(reminder.php,${APPTDT},${APPTTIME},${APPTPHONE},${APPTRECUR})

Do an amportal restart

NOW you have a functional prank call system.

DJ@Today

No comments:

Post a Comment