Version: v1.4.0

Methods

Only the built-in attributes come after an underscore; the custom attributes do not.

Lifecycle

Retrieves an AgoraAPI Instance (getInstanceWithoutMedia:)

This method retrieves an AgoraAPIOnlySignal instance.

+ (AgoraAPI*) getInstanceWithoutMedia:(NSString*)appId;
Parameter Description
appId The App ID provided by Agora. For more information, see Get an App ID.

Destroys the AgoraAPIOnlySignal Instance (destroy)

This method destroys the AgoraAPIOnlySignal instance.

- (void) destroy;

Login

Log into Agora's Signaling System (login:account:token:uid:deviceID:)

Use this method to log into Agora’s signaling system. Users must always log in before performing any operation.

- (void) login:(NSString*)appId account:(NSString*)account token:(NSString*)token uid:(uint32_t)uid deviceID:(NSString*)deviceID ;
  • When login is successful, the onLoginSuccess callback function is triggered.
  • When login fails, the onLoginFailed callback function is triggered.
  • When the SDK loses connection with the server, the onLogout callback function is triggered.
Parameter Description
appId The App ID provided by Agora. For more information, see Get an App ID.
account User ID defined by the client. It can be up to 128 visible characters (space is not allowed). It can be a uid, nickname, guid, and other content that must be unique. The account parameters in this document follow this rule.
token SignalingToken generated by the App ID and App Certificate. See How to Get and Use a SignalingToken for details.
uid N/A: Set it as 0
deviceID Set it as NULL.

You can skip generating the token in a test environment by setting token to _no_need_token. However, Agora does not recommend this in a production environment. By default, if you are already logged in, the call of login will be ignored. To cancel the previous login, call logout first without having to wait until it is successfully executed.

Log into Agora's Signaling System (login2:account:token:uid:deviceID:retry_time_in_s:retry_count:)

- (void) login2:(NSString*)appId account:(NSString*)account token:(NSString*)token uid:(uint32_t)uid deviceID:(NSString*)deviceID retry_time_in_s:(int)retry_time_in_s retry_count:(int)retry_count;

Use this method to log into Agora’s signaling system. Users must always log in before performing any operations.

  • When Login is successful, the onLoginSuccess callback function is triggered.
  • When login fails, the onLoginFailed callback function is triggered.
  • When loses connection with server, the onLogout callback function is triggered.
Parameter Description
appId The App ID provided by Agora. For more information, see Get an App ID.
account The user ID defined by the client. It can be up to 128 visible characters (space is not allowed). It can be uid, nickname, guid and other content, so long as it is unique. The account parameters in this document follow this rule.
token The SignalingToken generated by App ID and App Certificate. See How to Get and Use a SignalingToken for details.
uid Obsolete: set it to 0
deviceID Set it to NULL.
retry_time_in_s The maximum time allowed to re-login, 30 seconds by default.
retry_count The maximum times allowed to re-login, 3 times by default.

You can skip generating the token in a test environment by setting token to _no_need_token. However, Agora does not recommend this in a production environment. onLoginFailed will be triggered and reconnection stopped when either retry_time_in_s or retry_count is reached.

Log out of Agora's Signaling System (logout)

Use this method to log out of Agora's signaling system. This method triggers the onLogout callback function when called successfully.

- (void) logout;

Remote Calling Process (invoke:req:callID:)

This method is used for the remote calling process and triggers the onInvokeRet callback function when called successfully.

- (void) invoke:(NSString*)name req:(NSString*)req callID:(NSString*)callID ;
Function Parameter Settings and Returns
Queries the user status.
  • name: io.agora.signal.user_query_user_status
  • req: {“account”:account of the user}
  • Returns: status(1:online; 0:offline)
Sets a user attribute.
  • name: io.agora.signal.user_set_attr
  • req: {“name”:attribute name,”value”:attribute value}
Retrieves a user attribute.
  • name: io.agora.signal.user_get_attr
  • req: {“account”:account of the user,”name”:attribute name}
  • Returns: {“value”:attribute value}
Retrieves all attributes of a user.
  • name: io.agora.signal.user_get_attr_all
  • req: {“account”:account of the user}
  • Returns: The JSON value of all attributes
Retrieves the number of the users in a channel.
  • name: io.agora.signal.channel_query_num
  • req: {“name”:channel name}
  • Returns: All users in the channel
Checks if a user is in a specific channel.
  • name: io.agora.signal.channel_query_user_isin
  • req: {“name”:channel name,”account”:account of the user}
  • Returns: isin(1: in the channel; 0:not in the channel)
Retrieves a list of the users in a channel.
  • name: io.agora.signal.channel_query_userlist
  • req: {“name”:channel name}
  • Returns: {“num”:number of the users in the channel,”list”:the latest user}
Retrieves a list of the latest users in a channel.
  • name: io.agora.signal.channel_query_userlist_all
  • req: {“name”:channel name,”num”:number (by default 1000*1000)}
  • Returns: {“num”:number of the users in the channel,”list”:the latest users}
  • Agora recommends using it on the server. If using it on the client, pay attention to the limit on the usage frequency.
Clears all attributes of a specific channel.
  • name: io.agora.signal.channel_clear_attr
  • req: {“channel”:channel name}
Deletes an attribute of a specific channel.
  • name: io.agora.signal.channel_del_attr
  • req: {“channel”:channel name,”name”:attribute name}
Sets an attribute of a specific channel.
  • name: io.agora.signal.channel_set_attr
  • req: {“channel”:channel name,”name”:attribute name,”value”:value name}

Queries the User Status (queryUserStatus:)

This method checks whether a user is online and triggers the onQueryUserStatusResult callback function when called successfully.

- (void) queryUserStatus:(NSString*)account ;
Parameter Description
account Account of the user

Sets a User Attribute (setAttr:value:)

This method sets a user attribute.

- (void) setAttr:(NSString*)name value:(NSString*)value;
Parameter Description
name The attribute name, can be up to 128 visible characters. For example, _conn_timeout is the built-in attribute and refers to the offline timeout in seconds. It is set to 120 s by default value and ranges between 20 s and 120 s. The SDK automatically readjusts settings below 20 s to 20 s and settings exceeding 120 s to 120 s.
value The attribute value, can be up to 1024 visible characters.

Retrieves Your Specified Attribute (getAttr)

This method retrieves your specified attribute and triggers the onUserAttrResult callback function when called successfully.

- (void) getAttr:(NSString*)name;
Parameter Description
name

Attribute name.

It can be up to 128 visible characters

Retrieves all of Your Attributes (getAttrAll)

This method retrieves all of your attributes. You will receive the onUserAttrAllResult callback function upon a successful execution.

- (void) getAttrAll;

Retrieves the Attributes of a Specified User (getUserAttr:name:)

This method allows the user to retrieve the attributes of a specified user. The user will receive the onUserAttrResult callback function.

- (void) getUserAttr:(NSString*)account name:(NSString*)name;
Parameter Description
account User ID defined by the client.
name

Attribute name.

It can be up to 128 visible characters

Retrieves all Attributes of a Specified User (getUserAttrAll:)

This method allows the user to retrieve all attributes of a specified user and triggers the onUserAttrAllResult callback function when called successfully.

- (void) getUserAttrAll:(NSString*)account;
Parameter Description
account User ID defined by the client.

Sends a Point-to-point Message (messageInstantSend:uid:msg:msgID:)

This method allows a user to send a point-to-point message to a specified user.

When this method is called successfully, the sender receives the onMessageSendSuccess callback function, while the receiver receives the onMessageInstantReceive callback function.

If this method fails, the sender receives the onMessageSendError callback function.

- (void) messageInstantSend:(NSString*)account uid:(uint32_t)uid msg:(NSString*)msg msgID:(NSString*)msgID;
Parameter Description
account User ID defined by the client.
uid N/A: Set as 0.
msg Message body. Each message must not exceed 8 KB visible characters.
msgID Message ID. Agora recommends setting it to “”, allowing the SDK to generate and assign the msgID and to ensure its uniqueness.

Channel System

Allows a User to Join a Channel (channelJoin:)

This method allows a user to join a specified channel. When a user joins a specified channel, the user will be disconnected from any previously joined channel.

Once a user joins a channel, the user receives the onChannelJoined callback function, and the other users in the same channel receive the onChannelUserJoined callback function. If a user fails to join a specified channel, the user receives the onChannelJoinFailed callback function.

- (void) channelJoin:(NSString*)channelID;
Parameter Description
channelID

Channel name. It can be up to 128 visible characters and include the following special channel names and attributes:

  • _agora_user_online: All user-online or user-offline events within the current appID will be sent to this channel.
  • _agora_channel_event: All events about a user joining or leaving a channel within the current appID will be sent to this channel.

Special channels are used by servers only to receive login and channel events.

Allows a User to Leave a Channel (channelleave:)

This method allows users to leave the current channel. Once a user has left the channel, the other users in the channel will receive the onChannelUserLeaved callback function.

- (void) channelLeave:(NSString*)channelID;
Parameter Description
channelID

Channel name.

It can be up to 128 visible characters.

Queries the Number of Users in a Channel (channelQueryUserNum:)

This method allows a user to query the number of users in a specified channel. Upon a successful execution, the user will receive the onChannelQueryUserNumResult callback function.

- (void) channelQueryUserNum:(NSString*)channelID;
Parameter Description
channelID

Channel name.

It can be up to 128 visible characters.

Queries if a User is in a Channel (channelQueryUserIsIn:account:)

This method queries if a specified user is in a specified channel and triggers the onChannelQueryUserIsIn callback function when called successfully.

- (void) channelQueryUserIsIn:(NSString*)channelID account:(NSString*)account ;
Parameter Description
channelID Channel name. Maximum length is 128 visible characters.
account User ID defined by the client.

Sets the Channel Attributes (channelSetAttr:name:value:)

This method sets the channel attributes. Whenever a change is made to the attributes, all users in the channel will receive the onChannelAttrUpdated callback function.

- (void) channelSetAttr:(NSString*)channelID name:(NSString*)name value:(NSString*)value;
Parameter Description
channelID

Channel name.

It can be up to 128 visible characters.

name

Attribute name.

It can be up to 128 visible characters.

value

Attribute value.

It can be up to 8096 visible characters.

The following table shows the built-in attributes of the parameter, name:

Attributes Description
_userNotification
  • 1: (Default) The channel sends the callback function that a user has joined or left the channel.
  • 0: The channel does not send the callback function that a user has joined or left the channel.
_channel_ttl Time (s) between the last user leaving a channel and the system destroying the channel. The default value is 7200. A special channel will never be destroyed.
_member_num Number of the users currently in the channel. It is automatically updated by the system.
_auto_update_num

Indicates whether to automatically refresh the number of the users currently in the channel.

  • 0: (Default) Disabled
  • 1 - n: Refreshing frequency (s)
_total_member_num Automatically indicates the accumulated number of the users in the channel. Similar to _member_num , _auto_update_num and _auto_update_total_num both need to be set to none zero.
_auto_update_total_num

Indicates whether to automatically refresh the number of the users currently in the channel.

  • 0: (Default) Disabled
  • 1 - n: Refreshing frequency (s) (same as _auto_update_num )
_sendmsg_limit Maximum messages allowed to be sent in the channel.
_setattr_limit Maximum times for updating a channel attribute in a second.

Deletes the Channel Attributes (channelDelAttr:name:)

This method deletes the channel attributes. All users in the channel will receive the onChannelAttrUpdated callback function when this method is called successfully.

- (void) channelDelAttr:(NSString*)channelID name:(NSString*)name;
Parameter Description
channelID

Channel name.

It can be up to 128 visible characters.

name

Attribute name.

It can be up to 128 visible characters.

Deletes all Channel Attributes (channelClearAttr:)

This method deletes all attributes of a specified channel.

- (void) channelClearAttr:(NSString*)channelID;
Parameter Description
channelID

Channel name.

It can be up to 128 visible characters.

Sends a Channel Message (messageChannelSend:msg:msgID:)

This method sends a channel message, and all users in the same channel receive the onMessageChannelReceive callback function.

The user who sent the message receives the onMessageSendSuccess callback function upon a successful execution; otherwise, receives the onMessageSendError callback function.

- (void) messageChannelSend:(NSString*)channelID msg:(NSString*)msg msgID:(NSString*)msgID;
Parameter Description
channelID Channel name. It can be up to 128 visible characters.
msg Message body. Each channel message must not exceed 8 KB visible characters. Each user cannot send more than 60 messages per second, and the entire channel cannot send more than 1,000 messages per second.
msgID Visible characters. Message ID. Agora recommends setting it to “”, allowing the SDK to generate and assign the msgID and to ensure its uniqueness.

Calling

Initiates a Call (channelInviteUser:account:uid:)

Calling and joining a channel are two separate processes. The user has to call channelJoin() to join the channel. The user can either join the channel before sending a call invitation or send a call invitation before joining the channel (when the counterpart accepts the invitation).

This method initiates a call, that is, invites a user to join a specified channel. If the call fails, the user will receive the onInviteFailed callback function. Possible reasons include:

  • The other user is offline;
  • Local network issues;
  • Server errors;

If the caller gets a confirmation from the callee, the caller will receive the onInviteReceivedByPeer callback function, and the callee will receive the onInviteReceived callback function.

- (void) channelInviteUser:(NSString*)channelID account:(NSString*)account uid:(uint32_t)uid ;
Parameter Description
channelID

Channel name.

It can be up to 128 visible characters.

account User ID of the other user defined by the client.
uid N/A. Set as 0.

Initiates a Call (channelInviteUser2:account:extra:)

Same as channelInviteUser:account:uid: except for the parameters.

- (void) channelInviteUser2:(NSString*)channelID account:(NSString*)account extra:(NSString*)extra ;
Parameter Description
channelID Channel name: It can be up to 128 visible characters.
account User ID of the other user defined by the client.
extra

Extra information that the caller wants to send to the callee. It can be up to 8 KB visible characters and must be in JSON format. For example:

  • {“_require_peer_online”:1} If the counterpart is offline, the onInviteFailed callback function will be triggered immediately.
  • {“_require_peer_online”:0} If the counterpart is offline for more than 20 seconds, the onInviteFailed callback function will be triggered (default).
  • {“destMediaUid” : 123} Specify the uid for joining the corresponding media channel.
  • {“srcNum” : “+123456789”} Specify the phone number to be displayed on the screen of the remote phone.

You do not need to set the _require_peer_online field when making a SIP call.

Sends a DTMF (Dual-tone Multi-frequency) Message to the Other User (channelInviteDTMF:phoneNum:dtmf:)

This method sends a DTMF message to the other user by calling through the SIP gateway. The receiver will receive the onInviteMsg callback function.

- (void) channelInviteDTMF:(NSString*)channelID phoneNum:(NSString*)phoneNum dtmf:(NSString*)dtmf;
Parameter Description
channelID

Channel name.

It can be up to 128 visible characters.

phoneNum Phone number of the other user.
dtmf Subsequent analog phone number (DTMF) to be entered after the call gets through.

Accepts a Call (channelInviteAccept:account:uid:extra:)

This method accepts a call request or invitation. Once this API is called, the other user will receive the onInviteAcceptedByPeer callback function.

- (void) channelInviteAccept:(NSString*)channelID account:(NSString*)account uid:(uint32_t)uid extra:(NSString*)extra ;
Parameter Description
channelID

Channel name.

It can be up to 128 visible characters.

account The caller’s user ID.
uid

N/A.

Set as 0.

extra

In JSON format. Can be “”.

User-defined information.

Can be used for a SIP call.

Rejects a Call (channelInviteRefuse:account:uid:extra:)

This method rejects the received call invitation or request. Once this API is called, the other user will receive the onInviteRefusedByPeer callback function.

- (void) channelInviteRefuse:(NSString*)channelID account:(NSString*)account uid:(uint32_t)uid extra:(NSString*)extra ;
Parameter Description
channelID

Channel name.

It can be up to 128 visible characters.

account User ID of the other user defined by the client.
uid

N/A.

Set as 0.

extra

Extra information to send to the user being called.

For example, this is a video call or voice call.

It must be in JSON format.

Ends a Call (channelInviteEnd:account:uid:)

This method ends a call after the call has been connected. The user receives the onInviteEndByMyself callback function, and the other user receives the onInviteEndByPeer callback function.

- (void) channelInviteEnd:(NSString*)channelID account:(NSString*)account uid:(uint32_t)uid;
Parameter Description
channelID

Channel name.

It can be up to 128 visible characters.

account User ID of the other user defined by the client.
uid

N/A.

Set as 0.

Miscellaneous

Gets the User Status (getStatus)

This method gets the user status.

- (int) getStatus;
Return Value Description
LOGIN_STATE_NOT_LOGIN 0: The user has not logged in.
LOGIN_STATE_LOGINING 1: The user is logging in.
LOGIN_STATE_LOGINED 2: The user has logged in.
LOGIN_STATE_RECONNECTING 3: The user is reconnecting.

Retrieves the SDK Version (getSdkVersion)

This method retrieves the version of the SDK.

- (int) getSdkVersion;
Return Value Description
The SDK version. For example, 1010104019 means version 1.1.4.19.

Sends a Channel Message (messageChannelSendForce:msg:msgID:)

This method sends a channel message without joining a channel. Agora does not recommend using this method at the application level.

- (void) messageChannelSendForce:(NSString*)channelID msg:(NSString*)msg msgID:(NSString*)msgID ;
Parameter Description
channelID Channel ID.
msg The message to send.
msgID Message ID. Agora recommends setting it to “”, allowing the SDK to generate and assign the msgID and to ensure its uniqueness.

Obsolete Interfaces

Interfaces Prototype
messageDTMFSend (void) messageDTMFSend:(uint32_t)uid msg:(NSString*)msg msgID:(NSString*)msgID;
channelInvitePhone (void) channelInvitePhone:(NSString*)channelID phoneNum:(NSString*)phoneNum uid:(uint32_t)uid;
channelInvitePhone2 (void) channelInvitePhone2:(NSString*)channelID phoneNum:(NSString*)phoneNum sourcesNum:(NSString*)sourcesNum;
channelInvitePhone3 (void) channelInvitePhone3:(NSString*)channelID phoneNum:(NSString*)phoneNum sourcesNum:(NSString*)sourcesNum extra:(NSString*)extra;
isOnline (bool) isOnline;

Callback Functions

The following callback functions are related to Agora’s signaling system.

Avoid using synchronous or block callback operations. Otherwise, the signaling system may crash.

The Connection with the Agora’s Signaling System has been Lost (onReconnecting)

This callback function is triggered when the connection with Agora’s signaling system has been lost after login.

@property (copy) void(^onReconnecting)(uint32_t nretry) ;
Parameter Description
nretry The current reconnection number.

An Error has Occurred During SDK Runtime (onError:name:ecode:desc)

This callback function returns a detailed description of the error.

@property (copy) void(^onError)(NSString* name,AgoraEcode ecode,NSString* desc) ;
Parameter Description
name Error type.
ecode

Error code. For more information, see Error Codes and Warning Codes.

  • AgoraEcode_GENERAL_E = 1000: Unknown error
  • AgoraEcode_GENERAL_E_FAILED = 1001: Operation failed.
  • AgoraEcode_GENERAL_E_UNKNOWN = 1002: Unknown error
  • AgoraEcode_GENERAL_E_NOT_LOGIN = 1003: Not logged in.
  • AgoraEcode_GENERAL_E_WRONG_PARAM = 1004: Wrong parameter.
  • AgoraEcode_GENERAL_E_LARGE_PARAM = 1005: Large parameter.
desc Description of the error.

The User Status (onQueryUserStatusResult:name:status)

This callback function returns the query result of the user status and is triggered when queryUserStatus is called.

@property (copy) void(^onQueryUserStatusResult)(NSString* name,NSString* status) ;
Parameter Description
name Account of the user.
status

Status of the user: Whether the user is online.

  • 1: User is online.
  • 0: User is offline.

The Application has Reconnected to the Agora’s Signaling System (onReconnected)

This callback function is triggered when the application has reconnected to the Agora’s signaling system. When the reconnection fails, the onLogout callback function will be triggered instead.

@property (copy) void(^onReconnected)(int fd) ;
Parameter Description
fd Agora internal use only.

A User has Logged into the Agora’s Signaling System (onLoginSuccess)

This callback function is triggered when a user has logged into the Agora’s signaling system.

@property (copy) void(^onLoginSuccess)(uint32_t uid,int fd) ;
Parameter Description
fd Agora internal use only.

A User has Logged out of Agora’s Signaling System (onLogout)

This callback function is triggered when a user has logged out of Agora’s signaling system.

@property (copy) void(^onLogout)(AgoraEcode ecode) ;
Parameter Description
ecode error code

The Remote Calling Process has Succeeded (onInvokeRet)

This callback function is triggered when the remote calling process has succeeded.

@property (copy) void(^onInvokeRet)(NSString* callID,NSString* err,NSString* resp) ;
Parameter Description
callID Call ID introduced by invoke()
err Error code
resp Returned JSON value

A User has Failed to Log into Agora’s Signaling System (onLoginFailed)

This callback function is triggered when a user has failed to log into Agora’s signaling system.

@property (copy) void(^onLoginFailed)(AgoraEcode ecode) ;
Parameter Description
ecode Error code

A User has Joined a Channel (onChannelJoined)

This callback function is triggered when a user has joined a channel.

@property (copy) void(^onChannelJoined)(NSString* channelID) ;
Parameter Description
channelID Channel name

A User has Failed to Join a Channel (onChannelJoinFailed)

This callback function is triggered when a user has failed to join a channel.

@property (copy) void(^onChannelJoinFailed)(NSString* channelID,AgoraEcode ecode) ;
Parameter Description
channelID Channel name
ecode Error code

A User has Left a Channel (onChannelLeaved)

This callback function is triggered when a user has left a channel.

@property (copy) void(^onChannelLeaved)(NSString* channelID,AgoraEcode ecode) ;
Parameter Description
channelID Channel name
ecode Error code

Another User has Joined the Channel (onChannelUserJoined)

This callback function is triggered when another user has joined the channel.

@property (copy) void(^onChannelUserJoined)(NSString* account,uint32_t uid) ;
Parameter Description
account User ID of the other user defined by the client.
uid N/A.

Another User has Left the Channel (onChannelUserLeaved)

This callback function is triggered when another user has left the channel.

@property (copy) void(^onChannelUserLeaved)(NSString* account,uint32_t uid) ;
Parameter Description
account User ID of the other user defined by the client.
uid N/A.

The User List in the Channel (onChannelUserList)

A user will receive this callback function after joining a channel.

The retrieved user list includes a maximum of the latest 200 users in the channel.

@property (copy) void(^onChannelUserList)(NSMutableArray* accounts, NSMutableArray* uids);
Parameter Description
accounts List of User IDs defined by the client.
uids List of users in the channel.

The Number of Users in a Channel (onChannelQueryUserNumResult)

This callback function is triggered when a user has queried the number of users in a channel.

@property (copy) void(^onChannelQueryUserNumResult)(NSString* channelID,AgoraEcode ecode,int num) ;
Parameter Description
channelID Channel name
ecode Error code
num The query result

The Queried User is in the Channel (onChannelQueryUserIsIn)

This callback function is triggered when a user has queried whether he/she is in the channel.

public virtual void onChannelQueryUserIsIn(std::string channelID, std::string account, int isIn){}
Parameter Description
channelID Channel name.
account User ID defined by the client.
isIn

Whether the user is in the channel:

  • 1: In the channel
  • 0: Not in the channel

The Channel Attribute has Changed (onChannelAttrUpdated)

This callback function is triggered when the channel attribute has changed.

@property (copy) void(^onChannelAttrUpdated)(NSString* channelID,NSString* name,NSString* value,NSString* type) ;
Parameter Description
channelID Channel name.
name Attribute name.
value Attribute value.
type

Change types:

  • “update”: Update
  • “del”: Delete
  • “clear”: Delete all
  • “set”: N/A

A Call Request has been Received (onInviteReceived)

This callback function is received by the callee when the callee has received a call invitation or request.

@property (copy) void(^onInviteReceived)(NSString* channelID,NSString* account,uint32_t uid, NSString* extra) ;
Parameter Description
channelID Channel name.
account User ID of the caller defined by the client.
uid N/A.
extra

Extra information the caller wants to send to the callee.

For example, this is a video call or voice call.

It must be in JSON format.

The Callee has Received the Call Request (onInviteReceivedByPeer)

This callback function is received by the caller when the callee has received the call invitation or request.

@property (copy) void(^onInviteAcceptedByPeer)(NSString* channelID,NSString* account,uint32_t uid,NSString* extra) ;
Parameter Description
channelID Channel name.
account User ID of the callee defined by the client.
uid N/A.
extra

Extra information the caller wants to send to the callee.

For example, this is a video call or voice call.

It must be in JSON format.

The Callee has Accepted the Call Request (onInviteAcceptedByPeer)

This callback function is received by the caller when the callee has accepted the call invitation or request.

@property (copy) void(^onInviteRefusedByPeer)(NSString* channelID,NSString* account,uint32_t uid,NSString* extra) ;
Parameter Description
channelID Channel name.
account User ID of the callee defined by the client.
uid N/A.
extra

Extra information the caller wants to send to the callee.

For example, this is a video call or voice call.

It must be in JSON format.

The Callee has Rejected the Call Request (onInviteRefusedByPeer)

This callback function is received by the caller when the callee has rejected the call invitation or request.

@property (copy) void(^onInviteRefusedByPeer)(NSString* channelID,NSString* account,uint32_t uid) ;
Parameter Description
channelID Channel name.
account User ID of the other user defined by the client.
uid N/A.

A Call has Failed (onInviteFailed)

This callback function is triggered when a call has failed.

@property (copy) void(^onInviteFailed)(NSString* channelID,NSString* account,uint32_t uid,AgoraEcode ecode,NSString* extra) ;
Parameter Description
channelID Channel name.
account User ID of the callee defined by the client.
uid N/A.
extra

Extra information the caller wants to send to the callee.

For example, this is a video call or voice call.

It must be in JSON format.

The Callee has Ended the Call (onInviteEndByPeer)

This callback function is triggered when the callee has ended the call.

@property (copy) void(^onInviteEndByPeer)(NSString* channelID,NSString* account,uint32_t uid,NSString* extra) ;
Parameter Description
channelID Channel name
account User ID of the callee defined by the client.
msg Message body
extra

Extra information the caller wants to send to the callee.

For example, this is a video call or voice call.

It must be in JSON format.

The Caller has Ended the Call (onInviteEndByMyself)

This callback function is triggered when the caller has ended the call.

@property (copy) void(^onInviteEndByMyself)(NSString* channelID,NSString* account,uint32_t uid) ;
Parameter Description
channelID Channel name.
account User ID of the caller defined by the client.
uid N/A.

A DTMF Message sent by the Callee has been Received (onInviteMsg)

This callback function is triggered when the caller has received the DTMF message sent by the callee.

@property (copy) void(^onInviteMsg)(NSString* channelID,NSString* account,uint32_t uid,NSString* msgType,NSString* msgData,NSString* extra) ;
Parameter Description
channelID Channel name. It can be up to 128 visible characters.
account User ID of the callee defined by the client.
uid N/A.
msgType Message type (DTMF).
msgData Detailed DTMF message. Supported strings include: 0-9, * and #.
extra Extra information of the call, which can be a string, a JSON string, or NULL.

The User has Failed to Send a Message (onMessageSendError)

This callback function is triggered when the user has failed to send a message.

@property (copy) void(^onMessageSendError)(NSString* messageID,AgoraEcode ecode) ;
Parameter Description
messageID Message ID
ecode Error code

The User has Successfully Sent a Message (onMessageSendSuccess)

This callback function is triggered when the user has successfully sent a message.

@property (copy) void(^onMessageSendSuccess)(NSString* messageID) ;
Parameter Description
messageID Message ID

A Message has been Received (onMessageInstantReceive)

This callback function notifies a user that a message has been received.

@property (copy) void(^onMessageInstantReceive)(NSString* account,uint32_t uid,NSString* msg) ;
Parameter Description
account User ID defined by the client
uid N/A
msg Message body

A Channel Message has been Received (onMessageChannelReceive)

This callback function is triggered when a channel message has been received.

@property (copy) void(^onMessageChannelReceive)(NSString* channelID,NSString* account,uint32_t uid,NSString* msg) ;
Parameter Description
channelID Channel name
account User ID defined by the client
uid N/A
msg Message body

A Line has been Created in a Log File (onLog)

This callback function is triggered when a line has been created in a log file.

@property (copy) void(^onLog)(NSString* txt) ;
Parameter Description
txt Line in the log file

An Attribute of a Specified User (onUserAttrResult)

This callback function is triggered when the user has queried an attribute of a specified user.

@property (copy) void(^onUserAttrResult)(NSString* account,NSString* name,NSString* value) ;
Parameter Description
account User ID of the specified user defined by the client.
name Attribute name.
value Value of the attribute.

All Attributes of a Specified User (onUserAttrAllResult)

This callback function is triggered when a user has queried all attributes of a specified user.

@property (copy) void(^onUserAttrAllResult)(NSString* account, NSString* value) ;
Parameter Description
account User ID of the specified user defined by the client.
value JSON values of all attributes of the user.

Error Codes and Warning Codes

See Error Codes and Warning Codes.