6.7.1 Add
Add
is used to add a new event to the event log. It takes a set of input parameters that define the Type and properties of the event log to add.
The following is an example for using Add
:
log_id = logging_handle.call('Add',{'Type': u'Log', 'Item': {'EventType': 3, 'Direction': 1, 'EventDuration': 2, 'DeliveryStatus': 1, 'PhoneNumber': u'666'}})
The following table summarizes the specification of Add
:
Interface |
IDataSource |
Description |
Adds a new event to the event log. |
Response Model |
Synchronous and asynchronous |
Pre-condition |
IDataSource interface is loaded. |
Post-condition |
A new event is added to the event log. |
Input Parameters
Input parameter specifies the Type, and the properties of the event log. Input parameter properties are Type and Item.
Table 6.144:
Input parameters for Add
Name |
Type |
Range |
Description |
Type |
unicode string |
Log |
Specifies the Content Type. |
Item |
map
For more information, refer map 6.145 |
EventType (Indicates the type of log Event)
EKLogCallEventType : 0
EKLogDataEventType : 1
EKLogFaxEventType : 2
EKLogShortMessageEventType : 3
EKLogPacketDataEventType : 4
Direction
EIncomingEvent : 0
EOutgoingEvent : 1
EIncomingEvent Alternateline : 2
EOutgoingEvent Alternateline : 3
EFetchedEvent : 4
EMissedEvent : 5
EMissedEvent Alternateline : 6
DeliveryStatus
EStatusPending : 0
EStatusSent : 1
EStatusFalied : 2
EStatusNone : 3
EStatusDone : 4
EStatusNotSent : 5
EStatusScheduled : 6
LogFlags
EKLogEventContactSearched : 0
EKLogEventRead : 1
note:
Flag EKLogEventRead is set when you read the event in the log database.
Flag EKLogEventContactSearched is set when you search through contact database for performing any operation, like voice call or sms. |
Adds the given event to the event log. |
|
Table 6.145:
map
Key |
Value |
Description |
EventType |
32 bit int |
Unique Id to identify event type. |
[RemoteParty] |
unicode string |
Describes the destination of the out going event or source of incoming event. If the length of the specified string is greater than 64 characters, then the data is truncated. |
[Direction] |
32 bit int |
The direction of a call means incoming, outgoing, and so on. |
[EventDuration] |
32 bit int |
Time in seconds. |
[DeliveryStatus] |
32 bit int |
Delivered, pending, or failed. |
[Subject] |
unicode string |
Describes the subject for the event. If the length of the specified string is greater than 64 characters, then the data is truncated. |
[PhoneNumber] |
unicode string |
The phone number is associated with the event. This is used when the number cannot be stored in any other field. If the length of the specified string is greater than 100 characters, then the number is truncated. |
[EventData] |
8-bit Data |
Specific data associated with the event. |
[Link] |
32 bit int |
Link is used to relate this event to an entity in other application.
For example, it can be used to associate the event with the call ID or the message ID for emails and faxes. |
[LogFlags] |
32 bit int |
Sets the specified flags for this event. The function does not change any of the other flag bit settings. |
[RepeatDates] |
List of dates |
NA |
|
Output Parameters
Output contains ReturnValue
. It also contains ErrorCode
and an Error Message
if the operation fails.
ReturnValue
contains the identifier in the event log corresponding to the user specified input parameters.
Table 6.146:
Output parameters for Add
Name |
Type |
Range |
Description |
ErrorCode |
32 bit int |
NA |
Contains the SAPI specific error code when the operation fails. |
ErrorMessage |
string |
NA |
Error Description in Engineering English. |
ReturnValue |
string |
Unique identifier for the particular event in the log. |
|
|
Errors
The following table lists the error codes and their values:
Table 6.147:
Error codes
Error code value |
Description |
1000 |
Invalid service argument |
1002 |
Bad argument type |
1003 |
Missing argument |
1004 |
Service not supported |
|
Error Messages
The following table lists the error messages and their description:
Table 6.148:
Error messages
Error messages |
Description |
Logging:Add:TypeInvalid |
Invalid Type is passed to contenttype parameter. |
Logging:Add:TypeMissing |
Content Type missing in the inputparam list. |
Logging:Add:ItemInvalid |
Invalid Type is passed to Item parameter. |
Logging:Add:ItemMissing |
Item map missing in the inputparam list. |
Logging:Add:EventTypeInvalid |
Invalid Type is passed to EventType parameter. |
Logging:Add:EventTypeMissing |
EventType field is missing in the Item map. |
Logging:Add:RemotePartyInvalid |
Invalid Type is passed to RemoteParty parameter. |
Logging:Add:EventDurationInvalid |
Invalid Type is passed to EventDuration parameter. |
Logging:Add:DeliveryStatusInvalid |
Invalid Type is passed to DeliveryStatus parameter. |
Logging:Add:SubjectInvalid |
Invalid Type is passed to Subject parameter. |
Logging:Add:PhoneNumberInvalid |
Invalid Type is passed to PhoneNumber parameter. |
Logging:Add:EventDataInvalid |
Invalid Type is passed to EventData parameter. |
Logging:Add:LinkInvalid |
Invalid Type is passed to Link parameter. |
Logging:Add:LogFlagsInvalid |
Invalid Type is passed to LogFlags parameter. |
Logging:Add:DirectionInvalid |
Invalid Type is passed to Direction parameter. |
|
Example
The following sample code illustrates how to add a log entry:
import scriptext
logging_handle = scriptext.load('Service.Logging', 'IDataSource')
log_id = logging_handle.call('Add', {'Type': u'Log', 'Item': {'EventType': 3, 'Direction': 1, 'EventDuration': 2, 'DeliveryStatus': 1, 'PhoneNumber': u'666'}})
Release 2.0.0 final , documentation updated on 10 Feb 2010.
See About this document... for information on suggesting changes.