summaryrefslogtreecommitdiffhomepage
path: root/contrib/asterisk-xip/files/macros
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/asterisk-xip/files/macros')
-rw-r--r--contrib/asterisk-xip/files/macros/clock.conf23
-rw-r--r--contrib/asterisk-xip/files/macros/lastcall.conf78
2 files changed, 101 insertions, 0 deletions
diff --git a/contrib/asterisk-xip/files/macros/clock.conf b/contrib/asterisk-xip/files/macros/clock.conf
new file mode 100644
index 0000000000..3250b396a8
--- /dev/null
+++ b/contrib/asterisk-xip/files/macros/clock.conf
@@ -0,0 +1,23 @@
+; Talking clock by Michael Geddes
+; Borrowed from bits here and there.
+[macro-talkingclock] ; (TimeFormat, DateFormat, Zone)
+exten => s,1,Answer
+exten => s,n,set(tcTimeFormat=${ARG1})
+exten => s,n,GotoIf($["${tcTimeFormat}" = ""]?:tfOK)
+exten => s,n,set(tcTimeFormat=HM\'vm-and\'S\'seconds\')
+exten => s,n(tfOK),set(tcDateFormat=${ARG2})
+exten => s,n,GotoIf($["${tcDateFormat}" = ""]?:dfOK)
+exten => s,n,set(tcDateFormat=AdBY)
+exten => s,n(dfOK),set(tcZone=${ARG3})
+exten => s,n,GotoIf($["${tcZone}" = ""]?:znOK)
+exten => s,n,set(tcZone=${TalkingClockZone})
+exten => s,n(znOK),SayUnixTime(,${tcZone},${tcDateFormat})
+exten => s,n(again),Wait(2)
+exten => s,n,Set(FutureTime=$[${EPOCH} + 6])
+exten => s,n,Playback(misc/at-tone-time-exactly)
+exten => s,n,SayUnixTime(${FutureTime},${tcZone},${tcTimeFormat})
+; Wait to say the beep.
+exten => s,n(waitforit),noop
+exten => s,n,GotoIf($[ ${EPOCH} < ${FutureTime} ]?waitforit:)
+exten => s,n,playback(beep)
+exten => s,n,goto(again)
diff --git a/contrib/asterisk-xip/files/macros/lastcall.conf b/contrib/asterisk-xip/files/macros/lastcall.conf
new file mode 100644
index 0000000000..5d178617fe
--- /dev/null
+++ b/contrib/asterisk-xip/files/macros/lastcall.conf
@@ -0,0 +1,78 @@
+; Last-Called number storage and calling.
+; Author: Michael Geddes aka FrogOnWheels
+
+[macro-lastcallstore] ; (Number , EntryType, BufferSize)
+exten => s,1,set(lcsName=lastcall)
+exten => s,n,set(lcsCount=10)
+exten => s,n,GotoIf($["${ARG2}" = ""]?blankarg)
+exten => s,n,GotoIf($["${ARG2}" = "lastcall"]?blankarg)
+exten => s,n,Set(lcsName=lastcall_${ARG2})
+exten => s,n(blankarg),GotoIf($["${ARG3}" = ""]?nocount)
+exten => s,n,Set(lcsCount=${ARG3})
+exten => s,n(nocount),Noop(${lcsName}:${DB(${lcsName}/number1)}:${ARG1})
+exten => s,n,GotoIf($["${DB(${lcsName}/number1)}" = "${ARG1}"]?setdate)
+exten => s,n,set(CallerPointer=1)
+
+exten => s,n(again),GotoIf($["${DB(${lcsName}/ddate${CallerPointer})}" = ""]?copynext)
+exten => s,n,GotoIf($["${DB(${lcsName}/number${CallerPointer})}" = "${ARG1}"]?copynext)
+exten => s,n,Set(CallerPointer=$[${CallerPointer}+1])
+exten => s,n,GotoIf($[${CallerPointer} <= ${lcsCount}]?again)
+
+exten => s,n(copynext),set(DB(${lcsName}/ddate$[${CallerPointer}])=${DB(${lcsName}/ddate$[${CallerPointer}-1])})
+exten => s,n,set(DB(${lcsName}/number$[${CallerPointer}])=${DB(${lcsName}/number$[${CallerPointer}-1])})
+exten => s,n,set(CallerPointer=$[${CallerPointer}-1])
+exten => s,n,GotoIf($[${CallerPointer} > 0]?copynext)
+exten => s,n,set(DB(${lcsName}/number1)=${ARG1})
+exten => s,n(setdate),set(DB(${lcsName}/ddate1)=${EPOCH})
+
+[macro-lastcallapp] ; (Entrytype, Count, RingContext, Tag)
+exten => s,1,set(lcsName=lastcall)
+exten => s,n,set(lcsCount=10)
+exten => s,n,GotoIf($["${ARG1}" = ""]?blankName)
+exten => s,n,Set(lcsName=lastcall_${ARG1})
+exten => s,n(blankName),GotoIf($["${ARG2}" = ""]?nocount)
+exten => s,n,Set(lcsCount=${ARG2})
+exten => s,n(nocount),set(lcsCallContext=internal)
+exten => s,n,GotoIf($["${ARG3}" = ""]?blankContext)
+exten => s,n,Set(lcsCallContext=${ARG3})
+exten => s,n(blankContext),set(lcsTag=${ARG4})
+exten => s,n,GotoIf($["${lcsTag}" != ""]?hasTag)
+exten => s,n,Set(lcsTag=lastcall/previous-numbers)
+exten => s,n(hasTag),Set(lcsPointer=1)
+exten => s,n,GotoIf($["${DB(${lcsName}/ddate1)}" != ""]?macrobody_lastcallapp|s|1)
+exten => s,n,playback(${lcsTag}&lastcall/none-available)
+[macrobody_lastcallapp]
+exten => s,1(repeat),background(${lcsTag})
+exten => s,n(again),wait(1)
+exten => s,n,Set(lcsLastnum=${DB(${lcsName}/number${lcsPointer})})
+exten => s,n,Set(ddate=${DB(${lcsName}/ddate${lcsPointer})})
+exten => s,n,GotoIf($["${lcsLastnum}" != "anonymous"]?checkblank)
+exten => s,n,Set(lcsLastnum="")
+exten => s,n(checkblank),GotoIf($["${lcsLastnum}" = ""]?noinfo)
+exten => s,n,saydigits(${lcsLastnum})
+exten => s,n(saycalltime),wait(.5)
+exten => s,n,sayunixtime(${ddate},${LASTCALLZONE},QIMp)
+exten => s,n(saymenu),background(silence/1)
+exten => s,n,Set(lcsLastDate=${DB(${lcsName}/ddate$[ ${lcsPointer} + 1])})
+exten => s,n,GotoIf($[$[${lcsPointer} = ${lcsCount}] | $["${lcsLastDate}" = ""]]?noprev)
+exten => s,n,background(lastcall/next)
+exten => s,n(noprev),GotoIf($["${lcsLastnum}" = ""]?nocall)
+exten => s,n,background(lastcall/call-number)
+exten => s,n(nocall),GotoIf($[${lcsPointer} = 1]?nonext)
+exten => s,n,background(lastcall/previous)
+exten => s,n(nonext),background(silence/10)
+exten => s,n,Goto(repeat)
+exten => s,n(noinfo),background(lastcall/no-number-info)
+exten => s,n,goto(saycalltime)
+exten => 5,1,GotoIf($["${lcsLastnum}" = ""]?noinfo])
+exten => 5,n,Ringing()
+exten => 5,n,Goto(${lcsCallContext},${lcsLastnum},1)
+exten => 6,1,GotoIf($[$[${lcsPointer} = ${lcsCount}] | $["${lcsLastDate}" = ""]]?sayn)
+exten => 6,n,Set(lcsPointer=$[${lcsPointer} + 1])
+exten => 4,1,GotoIf($[${lcsPointer}=1]?sayn)
+exten => 4,n,Set(lcsPointer=$[${lcsPointer} - 1])
+exten => _[46],n(sayn),saynumber(${lcsPointer})
+exten => _[46],n,goto(s|again)
+exten => i,1,Goto(s|again)
+exten => t,1,playback(goodbye)
+exten => t,n,Hangup