1 """Voicemails.
2 """
3 __docformat__ = 'restructuredtext en'
4
5
6 from utils import *
7 from enums import *
8 from call import DeviceMixin
9
10
12 """Represents a voicemail.
13 """
14 _ValidateHandle = int
15
18
19 - def _Alter(self, AlterName, Args=None):
20 return self._Owner._Alter('VOICEMAIL', self.Id, AlterName, Args)
21
22 - def _Property(self, PropName, Set=None, Cache=True):
23 return self._Owner._Property('VOICEMAIL', self.Id, PropName, Set, Cache)
24
26 """Deletes this voicemail.
27 """
28 self._Alter('DELETE')
29
31 """Downloads this voicemail object from the voicemail server to a local computer.
32 """
33 self._Alter('DOWNLOAD')
34
36 """Opens and plays this voicemail.
37 """
38 self._Owner._DoCommand('OPEN VOICEMAIL %s' % self.Id)
39
41 """Changes the status of a voicemail from played to unplayed.
42 """
43
44
45
46
47
48
49
50 self._Owner._DoCommand('ALTER VOICEMAIL %d SETUNPLAYED' % self.Id,
51 'ALTER VOICEMAIL %d' % self.Id)
52
54 """Starts playing downloaded voicemail.
55 """
56 self._Alter('STARTPLAYBACK')
57
59 """Starts playing downloaded voicemail during a call.
60 """
61 self._Alter('STARTPLAYBACKINCALL')
62
64 """Stops playing a voicemail greeting and starts recording a voicemail message.
65 """
66 self._Alter('STARTRECORDING')
67
69 """Stops playing downloaded voicemail.
70 """
71 self._Alter('STOPPLAYBACK')
72
74 """Ends the recording of a voicemail message.
75 """
76 self._Alter('STOPRECORDING')
77
79 """Uploads recorded voicemail from a local computer to the voicemail server.
80 """
81 self._Alter('UPLOAD')
82
84 return int(self._Property('ALLOWED_DURATION'))
85
86 AllowedDuration = property(_GetAllowedDuration,
87 doc="""Maximum voicemail duration in seconds allowed to leave to partner
88
89 :type: int
90 """)
91
93 from datetime import datetime
94 return datetime.fromtimestamp(self.Timestamp)
95
96 Datetime = property(_GetDatetime,
97 doc="""Timestamp of this voicemail expressed using datetime.
98
99 :type: datetime.datetime
100 """)
101
103 return int(self._Property('DURATION'))
104
105 Duration = property(_GetDuration,
106 doc="""Actual voicemail duration in seconds.
107
108 :type: int
109 """)
110
112 return str(self._Property('FAILUREREASON'))
113
114 FailureReason = property(_GetFailureReason,
115 doc="""Voicemail failure reason. Read if `Status` == `enums.vmsFailed`.
116
117 :type: `enums`.vmr*
118 """)
119
122
123 Id = property(_GetId,
124 doc="""Unique voicemail Id.
125
126 :type: int
127 """)
128
130 return self._Property('PARTNER_DISPNAME')
131
132 PartnerDisplayName = property(_GetPartnerDisplayName,
133 doc="""DisplayName for voicemail sender (for incoming) or recipient (for outgoing).
134
135 :type: unicode
136 """)
137
139 return str(self._Property('PARTNER_HANDLE'))
140
141 PartnerHandle = property(_GetPartnerHandle,
142 doc="""Skypename for voicemail sender (for incoming) or recipient (for outgoing).
143
144 :type: str
145 """)
146
148 return str(self._Property('STATUS'))
149
150 Status = property(_GetStatus,
151 doc="""Voicemail status.
152
153 :type: `enums`.vms*
154 """)
155
157 return float(self._Property('TIMESTAMP'))
158
159 Timestamp = property(_GetTimestamp,
160 doc="""Timestamp of this voicemail.
161
162 :type: float
163 """)
164
166 return str(self._Property('TYPE'))
167
168 Type = property(_GetType,
169 doc="""Voicemail type.
170
171 :type: `enums`.vmt*
172 """)
173
174
177