summaryrefslogtreecommitdiffhomepage
path: root/contrib/package/asterisk-xip/files/macros/lastcall.conf
blob: 5d178617fe666f612a6e661ae4214cb3939d6c37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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