// // LinPhoneWraper.h // HDLLinPhoneSDK // // Created by 陈启扬 on 2021/8/12. // Copyright © 2021 陈启扬. All rights reserved. // #import #import #import NS_ASSUME_NONNULL_BEGIN typedef enum _AVPFMode { Default = -1, /// AVPF is disabled. Disabled = 0, /// AVPF is enabled. Enabled = 1 } AVPFMode; ///Enum algorithm checking. typedef enum _AccountCreatorAlgoStatus { Ok = 0, /// Algorithm not supported. NotSupported = 1 } AccountCreatorAlgoStatus; ///Enum describing Ip family. typedef enum _AddressFamily { Inet = 0, /// IpV6. Inet6 = 1, /// Unknown. Unspec = 2 } AddressFamily; ///Enum describing type of audio route. typedef enum _AudioRoute { Earpiece = 0, Speaker = 1 } AudioRoute; ///Enum describing the authentication methods. typedef enum _AuthMethod { /// Digest authentication requested. HttpDigest = 0, /// Client certificate requested. Tls = 1 } AuthMethod; ///LinphoneChatRoomBackend is used to indicate the backend implementation of a ///chat room. //typedef enum _ChatRoomBackend{ // // Basic = 0x01 << 0, // FlexisipChat = 0x01 << 1 //}ChatRoomBackend; // //typedef enum _ChatRoomCapabilities{ // // None = 0x1 << 0, // Basic = 0x01 << 1 //}ChatRoomCapabilities; typedef NS_OPTIONS(NSUInteger, ChatRoomBackend) { ChatRoomBackend_Basic = 0x01 << 0, ChatRoomBackend_FlexisipChat = 0x01 << 1 }; typedef NS_OPTIONS(NSUInteger, ChatRoomCapabilities) { ChatRoomCapabilities_None = 0x00, ChatRoomCapabilities_Basic = 0x01 << 0, ChatRoomCapabilities_RealTimeText = 0x01 << 1, ChatRoomCapabilities_Conference = 0x01 << 2, ChatRoomCapabilities_Proxy = 0x01 << 3, ChatRoomCapabilities_Migratable = 0x01 << 4, ChatRoomCapabilities_OneToOne = 0x01 << 5, ChatRoomCapabilities_Encrypted = 0x01 << 6 }; ///LinphoneChatRoomEncryptionBackend is used to indicate the encryption engine ///used by a chat room. typedef NS_OPTIONS(NSUInteger, ChatRoomEncryptionBackend) { ChatRoomEncryptionBackend_None = 0x00, ChatRoomEncryptionBackend_Lime = 0x01 << 0, }; ///TODO move to encryption engine object when available ///LinphoneChatRoomSecurityLevel is used to indicate the encryption security level ///of a chat room. typedef NS_ENUM(NSInteger,ChatRoomSecurityLevel) { Unsafe = 0, /// No encryption. ClearText = 1, /// Encrypted. Encrypted = 2, /// Encrypted and verified. Safe = 3 }; ///LinphoneGlobalState describes the global state of the `Core` object. typedef NS_ENUM(NSInteger,ConfiguringState) { Successful = 0, Failed = 1, Skipped = 2 }; ///Consolidated presence information: 'online' means the user is open for ///communication, 'busy' means the user is open for communication but involved in ///an other activity, 'do not disturb' means the user is not open for ///communication, and 'offline' means that no presence information is available. typedef NS_ENUM(NSInteger,ConsolidatedPresence) { Online = 0, Busy = 1, DoNotDisturb = 2, Offline = 3 }; ///Enum describing the result of the echo canceller calibration process. typedef NS_ENUM(NSInteger,EcCalibratorStatus) { /// The echo canceller calibration process is on going. InProgress = 0, /// The echo canceller calibration has been performed and produced an echo delay /// measure. Done = 1, /// The echo canceller calibration process has failed. EcCalibratorStatus_Failed = 2, /// The echo canceller calibration has been performed and no echo has been /// detected. DoneNoEcho = 3 }; ///LinphoneEventLogType is used to indicate the type of an event. typedef NS_ENUM(NSInteger,EventLogType) { /// No defined event. None = 0, /// Conference (created) event. ConferenceCreated = 1, /// Conference (terminated) event. ConferenceTerminated = 2, /// Conference call (start) event. ConferenceCallStart = 3, /// Conference call (end) event. ConferenceCallEnd = 4, /// Conference chat message event. ConferenceChatMessage = 5, /// Conference participant (added) event. ConferenceParticipantAdded = 6, /// Conference participant (removed) event. ConferenceParticipantRemoved = 7, /// Conference participant (set admin) event. ConferenceParticipantSetAdmin = 8, /// Conference participant (unset admin) event. ConferenceParticipantUnsetAdmin = 9, /// Conference participant device (added) event. ConferenceParticipantDeviceAdded = 10, /// Conference participant device (removed) event. ConferenceParticipantDeviceRemoved = 11, /// Conference subject event. ConferenceSubjectChanged = 12, /// Conference encryption security event. ConferenceSecurityEvent = 13, /// Conference ephemeral message (ephemeral message lifetime changed) event. ConferenceEphemeralMessageLifetimeChanged = 14, /// Conference ephemeral message (ephemeral message enabled) event. ConferenceEphemeralMessageEnabled = 15, /// Conference ephemeral message (ephemeral message disabled) event. ConferenceEphemeralMessageDisabled = 16 }; typedef NS_OPTIONS(NSUInteger, FriendCapability) { FriendCapability_None = 0x00, FriendCapability_GroupChat = 0x01 << 0, FriendCapability_LimeX3Dh = 0x01 << 1, FriendCapability_EphemeralMessages = 0x01 << 2 }; ///LinphoneGlobalState describes the global state of the `Core` object. typedef NS_ENUM(NSInteger,GlobalState) { /// State in which we're in after {@link Core#stop}. Off = 0, /// Transient state for when we call {@link Core#start} Startup = 1, /// Indicates `Core` has been started and is up and running. On = 2, /// Transient state for when we call {@link Core#stop} Shutdown = 3, /// Transient state between Startup and On if there is a remote provisionning URI /// configured. Configuring = 4, /// `Core` state after being created by linphone_factory_create_core, generally /// followed by a call to {@link Core#start} Ready = 5 }; ///Enum describing ICE states. typedef NS_ENUM(NSInteger,IceState) { /// ICE has not been activated for this call or stream. NotActivated = 0, /// ICE processing has failed. IceState_Failed = 1, /// ICE process is in progress. IceState_InProgress = 2, /// ICE has established a direct connection to the remote host. HostConnection = 3, /// ICE has established a connection to the remote host through one or several /// NATs. ReflexiveConnection = 4, /// ICE has established a connection through a relay. RelayConnection = 5 }; typedef NS_ENUM(NSInteger,LimeState) { /// Lime is not used at all. LimeState_Disabled = 0, /// Lime is always used. Mandatory = 1, /// Lime is used only if we already shared a secret with remote. Preferred = 2 }; typedef NS_ENUM(NSInteger,LogCollectionState) { LogCollectionState_Disabled = 0, LogCollectionState_Enabled = 1, EnabledWithoutPreviousLogHandler = 2 }; ///Verbosity levels of log messages. typedef NS_OPTIONS(NSUInteger, LogLevel) { LogLevel_Debug = 0x01, LogLevel_Trace = 0x01 << 1, LogLevel_Message = 0x01 << 2, LogLevel_Warning = 0x01 << 3, LogLevel_Error = 0x01 << 4, LogLevel_Fatal = 0x01 << 5 }; ///Indicates for a given media the stream direction. typedef NS_ENUM(NSInteger,MediaDirection) { Invalid = -1, Inactive = 0, /// No active media not supported yet. SendOnly = 1, /// Send only mode. RecvOnly = 2, /// recv only mode SendRecv = 3, }; ///Enum describing type of media encryption types. typedef NS_ENUM(NSInteger,MediaEncryption) { /// No media encryption is used. MediaEncryption_None = 0, /// Use SRTP media encryption. SRTP = 1, /// Use ZRTP media encryption. ZRTP = 2, /// Use DTLS media encryption. DTLS = 3, }; ///Activities as defined in section 3.2 of RFC 4480. typedef NS_ENUM(NSInteger,PresenceActivityType) { /// The person has a calendar appointment, without specifying exactly of what type. Appointment = 0, /// The person is physically away from all interactive communication devices. Away = 1, /// The person is eating the first meal of the day, usually eaten in the morning. Breakfast = 2, /// The person is busy, without further details. PresenceActivityType_Busy = 3, /// The person is having his or her main meal of the day, eaten in the evening or /// at midday. Dinner = 4, /// This is a scheduled national or local holiday. Holiday = 5, /// The person is riding in a vehicle, such as a car, but not steering. InTransit = 6, /// The person is looking for (paid) work. LookingForWork = 7, /// The person is eating his or her midday meal. Lunch = 8, /// The person is scheduled for a meal, without specifying whether it is breakfast, /// lunch, or dinner, or some other meal. Meal = 9, /// The person is in an assembly or gathering of people, as for a business, social, /// or religious purpose. Meeting = 10, /// The person is talking on the telephone. OnThePhone = 11, /// The person is engaged in an activity with no defined representation. Other = 12, /// A performance is a sub-class of an appointment and includes musical, /// theatrical, and cinematic performances as well as lectures. Performance = 13, /// The person will not return for the foreseeable future, e.g., because it is no /// longer working for the company. PermanentAbsence = 14, /// The person is occupying himself or herself in amusement, sport, or other /// recreation. Playing = 15, /// The person is giving a presentation, lecture, or participating in a formal /// round-table discussion. Presentation = 16, /// The person is visiting stores in search of goods or services. Shopping = 17, /// The person is sleeping. Sleeping = 18, /// The person is observing an event, such as a sports event. Spectator = 19, /// The person is controlling a vehicle, watercraft, or plane. Steering = 20, /// The person is on a business or personal trip, but not necessarily in-transit. Travel = 21, /// The person is watching television. TV = 22, /// The activity of the person is unknown. Unknown = 23, /// A period of time devoted to pleasure, rest, or relaxation. Vacation = 24, /// The person is engaged in, typically paid, labor, as part of a profession or /// job. Working = 25, /// The person is participating in religious rites. Worship = 26 }; ///Basic status as defined in section 4.1.4 of RFC 3863. typedef NS_ENUM(NSInteger,PresenceBasicStatus) { /// This value means that the associated contact element, if any, is ready to /// accept communication. Open = 0, /// This value means that the associated contact element, if any, is unable to /// accept communication. Closed = 1 }; typedef NS_ENUM(NSInteger,Privacy) { /// Privacy services must not perform any privacy function. Privacy_None = 0, /// Request that privacy services provide a user-level privacy function. User = 1, /// Request that privacy services modify headers that cannot be set arbitrarily by /// the user (Contact/Via). Header = 2, /// Request that privacy services provide privacy for session media. Session = 4, /// rfc3325 The presence of this privacy type in a Privacy header field indicates /// that the user would like the Network Asserted Identity to be kept private with /// respect to SIP entities outside the Trust Domain with which the user /// authenticated. Id = 8, /// Privacy service must perform the specified services or fail the request. Critical = 16, /// Special keyword to use privacy as defined either globally or by proxy using /// {@link ProxyConfig#setPrivacy} Privacy_Default = 32768 }; ///Enum for publish states. typedef NS_ENUM(NSInteger,PublishState) { /// Initial state, do not use. PublishState_None = 0, /// An outgoing publish was created and submitted. Progress = 1, /// Publish is accepted. PublishState_Ok = 2, /// Publish encoutered an error, {@link Event#getReason} gives reason code. Error = 3, /// Publish is about to expire, only sent if [sip]->refresh_generic_publish /// property is set to 0. Expiring = 4, /// Event has been un published. Cleared = 5 }; ///Enum describing various failure reasons or contextual information for some ///events. typedef NS_ENUM(NSInteger,Reason) { /// No reason has been set by the core. Reason_None = 0, /// No response received from remote. NoResponse = 1, /// Authentication failed due to bad credentials or resource forbidden. Forbidden = 2, /// The call has been declined. Declined = 3, /// Destination of the call was not found. NotFound = 4, /// The call was not answered in time (request timeout) NotAnswered = 5, /// Phone line was busy. Reason_Busy = 6, /// Unsupported content. UnsupportedContent = 7, /// Transport error: connection failures, disconnections etc... IOError = 8, /// Do not disturb reason. Reason_DoNotDisturb = 9, /// Operation is unauthorized because missing credential. Unauthorized = 10, /// Operation is rejected due to incompatible or unsupported media parameters. NotAcceptable = 11, /// Operation could not be executed by server or remote client because it didn't /// have any context for it. NoMatch = 12, /// Resource moved permanently. MovedPermanently = 13, /// Resource no longer exists. Gone = 14, /// Temporarily unavailable. TemporarilyUnavailable = 15, /// Address incomplete. AddressIncomplete = 16, /// Not implemented. NotImplemented = 17, /// Bad gateway. BadGateway = 18, /// The received request contains a Session-Expires header field with a duration /// below the minimum timer. SessionIntervalTooSmall = 19, /// Server timeout. ServerTimeout = 20, /// Unknown reason. Reason_Unknown = 21 }; ///LinphoneRegistrationState describes proxy registration states. typedef NS_ENUM(NSInteger,RegistrationState) { /// Initial state for registrations. RegistrationState_None = 0, /// Registration is in progress. RegistrationState_Progress = 1, /// Registration is successful. RegistrationState_Ok = 2, /// Unregistration succeeded. RegistrationState_Cleared = 3, /// Registration failed. RegistrationState_Failed = 4 }; ///LinphoneSecurityEventType is used to indicate the type of security event. typedef NS_ENUM(NSInteger,SecurityEventType) { /// Event is not a security event. SecurityEventType_None = 0, /// Chatroom security level downgraded event. SecurityLevelDowngraded = 1, /// Participant has exceeded the maximum number of device event. ParticipantMaxDeviceCountExceeded = 2, /// Peer device instant messaging encryption identity key has changed event. EncryptionIdentityKeyChanged = 3, /// Man in the middle detected event. ManInTheMiddleDetected = 4, }; ///Session Timers refresher. typedef NS_ENUM(NSInteger,SessionExpiresRefresher) { Unspecified = 0, UAS = 1, UAC = 2 }; ///Enum describing the stream types. typedef NS_ENUM(NSInteger,StreamType) { Audio = 0, Video = 1, Text = 2, StreamType_Unknown = 3 }; ///Enum controlling behavior for incoming subscription request. typedef NS_ENUM(NSInteger,SubscribePolicy) { /// Does not automatically accept an incoming subscription request. SPWait = 0, /// Rejects incoming subscription request. SPDeny = 1, /// Automatically accepts a subscription request. SPAccept = 2 }; ///Enum for subscription direction (incoming or outgoing). typedef NS_ENUM(NSInteger,SubscriptionDir) { /// Incoming subscription. Incoming = 0, /// Outgoing subscription. Outgoing = 1, /// Invalid subscription direction. InvalidDir = 2 }; ///Enum for subscription states. typedef NS_ENUM(NSInteger,SubscriptionState) { /// Initial state, should not be used. SubscriptionState_None = 0, /// An outgoing subcription was sent. SubscriptionState_OutgoingProgress = 1, /// An incoming subcription is received. SubscriptionState_IncomingReceived = 2, /// Subscription is pending, waiting for user approval. SubscriptionState_Pending = 3, /// Subscription is accepted. SubscriptionState_Active = 4, /// Subscription is terminated normally. SubscriptionState_Terminated = 5, /// Subscription was terminated by an error, indicated by {@link Event#getReason} SubscriptionState_Error = 6, /// Subscription is about to expire, only sent if [sip]->refresh_generic_subscribe /// property is set to 0. SubscriptionState_Expiring = 7 }; ///Enum listing frequent telephony tones. typedef NS_ENUM(NSInteger,ToneID) { /// Not a tone. Undefined = 0, /// Busy tone. ToneID_Busy = 1, CallWaiting = 2, /// Call waiting tone. CallOnHold = 3, /// Call on hold tone. CallLost = 4 }; ///Enum describing transport type for LinphoneAddress. typedef NS_ENUM(NSInteger,TransportType) { Udp = 0, Tcp = 1, TransportType_Tls = 2, Dtls = 3 }; ///Enum describing uPnP states. typedef NS_ENUM(NSInteger,UpnpState) { /// uPnP is not activate Idle = 0, /// uPnP process is in progress Pending = 1, /// Internal use: Only used by port binding. Adding = 2, /// Internal use: Only used by port binding. Removing = 3, /// uPnP is not available NotAvailable = 4, /// uPnP is enabled UpnpState_Ok = 5, /// uPnP processing has failed Ko = 6, /// IGD router is blacklisted. Blacklisted = 7 }; ///Enum describing the result of a version update check. typedef NS_ENUM(NSInteger,VersionUpdateCheckResult) { UpToDate = 0, NewVersionAvailable = 1, VersionUpdateCheckResult_Error = 2 }; ///Enum describing the types of argument for LinphoneXmlRpcRequest. typedef NS_ENUM(NSInteger,XmlRpcArgType) { XmlRpcArgType_None = 0, Int = 1, String = 2, StringStruct = 3 }; ///Enum describing the status of a LinphoneXmlRpcRequest. typedef NS_ENUM(NSInteger,XmlRpcStatus) { XmlRpcStatus_Pending = 0, XmlRpcStatus_Ok = 1, XmlRpcStatus_Failed = 2 }; ///Enum describing the ZRTP SAS validation status of a peer URI. typedef NS_ENUM(NSInteger,ZrtpPeerStatus) { /// Peer URI unkown or never validated/invalidated the SAS. ZrtpPeerStatus_Unknown = 0, /// Peer URI SAS rejected in database. ZrtpPeerStatus_Invalid = 1, /// Peer URI SAS validated in database. Valid = 2 }; /// Class basic linphone class @interface LinphoneObject : NSObject @property (assign, nonatomic) LinphoneConfig *cPtr; @property (assign, nonatomic) belle_sip_object_t *cPtr1; -(instancetype)initWith:(belle_sip_object_t*)cPointer; @end @interface Config : LinphoneObject +(instancetype)getSwiftObject:(LinphoneConfig*)cPointer; -(void)setString:(NSString *)section key:(NSString *)key value:(NSString *)value; -(NSString *)getString:(NSString *)section key:(NSString *)key defaultString:(NSString *)defaultString; -(void)setInt:(NSString *)section key:(NSString *)key value:(int)value; -(int)getInt:(NSString *)section key:(NSString *)key defaultValue:(int)defaultValue; @end @interface LinPhoneWraper : NSObject +(NSString *) charArrayToString:(nullable const char *)charPointer; @end NS_ASSUME_NONNULL_END