com.mizuvoip.jvoip
Class SipStack

java.lang.Object
  extended by com.mizuvoip.jvoip.SipStack

public class SipStack
extends java.lang.Object

This is the old documentation using notification strings (instead of SIPNotification objects)

AJVoIP SIP Stack API: https://www.mizu-voip.com/Software/SIPSDK/AndroidSIPSDK.aspx.
Lookup the documentation for a detailed description: https://www.mizu-voip.com/Portals/0/Files/AJVoIP_With_Notification_Strings.pdf
Sample project: https://www.mizu-voip.com/Portals/0/Files/AJVoIPTest_With_Notification_Strings.zip 

 


Field Summary
 Commoncommon
          Internal common object instance.
 webphonephone
          Internal phone object instance.
 
Constructor Summary
SipStack()
          Constructor to create a new SIP stack.
 
Method Summary
 booleanAccept(int line)
          Connect incoming call.
 booleanAcceptStrict(int line)
          Connect incoming call.
 booleanAddContact(java.lang.String params)
          Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
 booleanAddLog(int level, java.lang.String text)
          Add to sip stack log.
 booleanAddLog(java.lang.String text)
          Add to sip stack log.
 booleanAddToBlacklist(java.lang.String str)
          Add user to blacklist
 booleanAddVideo(int line, int type)
          Deprecated.  
 booleanCall(int line, java.lang.String number)
          Initiate call to a number or sip username.
 booleanCall(int line, java.lang.String number, boolean async)
          Initiate call to a number or sip username.
 booleanCallEx(int line, java.lang.String number, int type)
          Deprecated.  
 intCallIDToLine(java.lang.String callid)
          Get the line number for a SIP Call-ID.
 booleanCanBluetooth()
          Query bluetooth setting.
 booleanCapabilityRequest(java.lang.String server, java.lang.String username)
          Request server or server capabilities with SIP OPTIONS.
 booleanCheckBLF(java.lang.String userlist)
          To subscribe to other extensions call state, you can set the blfuserlist parameter or use the API_CheckBLF(userlist) to subscribe to other extension(s) state changes (users separated by comma).
 booleanCheckPresence(java.lang.String userlist)
          Call this function to save softswitch resources, you should carefully select the contacts.
 booleanCheckVoicemail(int line)
          Will (re)subscribe for voicemail notifications.
 booleanClearCredentials()
          Clear existing user account details.
 voidClearSettings()
          Clear all settings (including stored settings)
 booleanConf(int line, java.lang.String number)
          Add people to conference or initiate conference call.
 booleanConfEx(int line, java.lang.String number, boolean add)
          Add/remove people to/from conference.
 booleanCredentialsChanged(java.lang.String newserver, java.lang.String newusername)
          Deprecated.  
 booleanDelContact(java.lang.String name)
          Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
 booleanDelSettings(int level)
          Delete settings and data.
 booleanDtmf(int line, java.lang.String dtmf)
          Send DTMF message by In-Band,SIP INFO or RFC2833 method (depending on the “dtmfmode” parameter).
 voidExit()
          Will destroy the SIP stack.
 voidExitEx()
          Will destroy the SIP stack and also will exit the Java Virtial Machine.
 booleanForward(int line, java.lang.String peer)
          Forward incoming call to peer (with 302 Moved Temporarily disconnect code)
 voidFullStop()
          Will stop the SIP stack and all services (push notifications or jobs/alarms that might have started to keep your app running as background service)
 java.lang.StringGetAddress()
          Query local address.
 java.lang.StringGetAltWorkdir()
          Query the application alternative working directory (such as folder on external SD card).
 java.lang.StringGetAudioDevice(int dev)
          Query the current audio device name.
 java.lang.StringGetAudioDeviceList(int dev)
          Query the list of available audio devices.
 java.lang.StringGetBindir()
          Query the application path (folder with the app binaries or app home folder)
 java.lang.StringGetBlacklist()
          Query the current blacklist
 java.lang.StringGetCallerID()
          Query the peer Caller ID.
 java.lang.StringGetCallerID(int line)
          Query the peer Caller ID.
 java.lang.StringGetCallerID(int line, int type)
          Deprecated.  
 CommonGetCommonObj()
          Provides access to the internal Common object instance.
 java.lang.StringGetConfigHash()
          Get a has value of the configuration.
 java.lang.StringGetContact(java.lang.String name)
          Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
 java.lang.StringGetContactName(java.lang.String name)
          Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
 java.lang.StringGetContactPhone(java.lang.String name)
          Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
 java.lang.StringGetContactPresence(java.lang.String name)
          Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
 java.lang.StringGetContactPresenceStr(java.lang.String name)
          Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
 java.lang.StringGetContacts()
          Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
 java.lang.StringGetContactSIP(java.lang.String name)
          Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
 java.lang.StringGetContactSpeedDial(java.lang.String name)
          Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
 intGetCurrentConnectedCallCount()
          Query the number of simultaneous calls currently in progress.
 java.lang.StringGetDeviceID()
          Get device identifier.
 java.lang.StringGetDiscReasonText(java.lang.String line)
          Query the disconnect reason of the last disconnected call.
 GUtilityGetGUtilityObj()
           
 java.lang.StringGetIncomingDisplay(int line)
          Get incoming caller id (might return two lines: caller id \n caller name)
 java.lang.StringGetLastCallDetails()
          Get details about the last finished call.
 java.lang.StringGetLastRecFileName()
          Query recently recorded file.
 java.lang.StringGetLastRecInvite()
          Get last received INVITE message.
 java.lang.StringGetLastRecSIPMessage(java.lang.String line)
          Get last received SIP message.
 intGetLine()
          Get the currently active line.
 java.lang.StringGetLineDetails(int line)
          Get details about a line.
 intGetLineStatus(int line)
          Query the state of a line.
 java.lang.StringGetLineStatusText(int line)
          Query the state of a line.
 java.lang.StringGetLogs()
          Can be used to get the logs (which are otherwise written also to standard output and to Logcat).
 java.lang.StringGetMAC()
          Get the device MAC address if possible.
 java.lang.StringGetNotifications()
          Return the notification strings.
 java.lang.StringGetNotificationsSync()
          Return the notification strings.
static SipStackGetObj()
          Access the sipstack instance from static code.
 java.lang.StringGetParameter(java.lang.String param)
          Query parameter.
 java.lang.StringGetPresenceStatus()
          Query local presence state.
 intGetPushNotifications()
          Simplified query for push notification state if push was initited befere with the SetPushNotifications API.
 intGetPushNotificationsEx(boolean thissessiononly)
          Query the push notification state if push was initited befere with the SetPushNotifications API.
 java.lang.StringGetRegFailReason(boolean extended)
          Query the reason of the last failed registration.
 java.lang.StringGetSIPHeader(int line, java.lang.String hdr)
          Return a sip header value received by JVoIP.
 java.lang.StringGetSIPMessage(int line, int dir, int type)
          Return the last received or sent SIP signaling message as raw text.
 java.lang.StringGetStatus(int line)
          Returns line state or global state if you pass -2 as line parameter
 java.lang.StringGetStatus(int line, int strict)
          Returns line state or global state if you pass -2 as line parameter
 intGetStatusId(int line)
          Returns line state or global state id.
 java.lang.StringGetVersion()
          Get the SIP stack version number.
 intGetVolume(int dev)
          Get Volume level
static webphoneGetWebPhoneObj()
          Provides access to the internal phone object instance.
static webphoneGetWebPhoneObj(Context contextin)
          Provides access to the internal phone object instance.
 java.lang.StringGetWorkdir()
          Query the application working directory (data folder) Based on appcontext.getFilesDir().getPath() and Environment.getDataDirectory().getPath();
 booleanHangup()
          Disconnect call.
 booleanHangup(int line)
          Disconnect current call(s).
 booleanHangup(int line, java.lang.String reason)
          Disconnect current call(s).
 booleanHasCallInProgress()
          Query of there is any call in progress (including calls in ringing or connected state).
 booleanHasCallInSpeaking()
          Query of there is any connected call.
 intHiddenLine()
          Query hiddel endpoint channel.
 booleanHold(int line, boolean hold)
          Hold current call.
 booleanHoldChange(int line)
          Togle hold state of the call.
 java.lang.StringHTTPGet(java.lang.String uri)
          Send a HTTP GET request.
 booleanHTTPKeepAlive()
          Deprecated.  
 booleanHTTPPost(java.lang.String uri, java.lang.String data)
          Send a HTTP POST request.
 java.lang.StringHTTPReq(java.lang.String uri, java.lang.String data)
          Send a HTTP POST or GET request.
 booleanHTTPReqAsync(java.lang.String uri, java.lang.String data)
          Send a HTTP POST or GET request.
 booleanIgnore(int line)
          Ignore incoming call.
 booleanInit(Context context_in)
          Initialize the SIP stack.
 booleanIsBluetooth()
          Check if call on bluetooth.
 intIsEncrypted()
          Check if the connection is encrypted.
 booleanIsIdle()
          Query idle state
 intIsInCall()
          Query of there is any call in progress.
 booleanIsIncomingVideo()
          Check if current incoming call is video call.
 booleanIsLoudspeaker()
          Query if using loudspeaker
 intIsMuted(int line)
          Return if the selected line is muted or not.
 intIsOnHold(int line)
          Query if the selected line is on hold or not
 booleanIsOnline()
          Query online state.
 booleanIsRegistered()
          Get the registered state.
 intIsRegisteredEx()
          Get the extended registered state.
 booleanIsSpeaking()
          Query of there is any connected call.
 java.lang.StringLineToCallID(int line)
          Get the SIP Call-ID for a line number.
 java.lang.StringLoadFile(java.lang.String filename)
          Load file content from local disk.
 booleanLoadFileRemote(java.lang.String filename)
          Load file from remote storage.
 java.lang.StringLoadFileRemoteSync(java.lang.String filename)
          Will download the specified file from remote storage synchronously (will block until done or fails).
 booleanMute(int line, boolean mute, int what)
          Mute current call.
 booleanMuteEx(int line, boolean mute, int what)
          Mute current call.
 booleanMuteVideo(int state, int direction, int height)
          Disable/enable video(stream) during a video call.
 booleanNATKeepAlive(java.lang.String server)
          Rarely needed if any, because the siptack will do it automatically.
 booleanNeedRatingRequest()
          Some servers might report call rating automatically in signaling.
 booleanNewUser(java.lang.String user)
          On newuser, you should ask the user if wish to accept it.
 voidNoUnregister()
          Signal that no unregistration is needed.
 booleanNumExists()
          Use this only with the Mizu Softswitch.
 voidOnVideoRemoved(GVideo instance)
          This function should not be used.
 booleanPeerIsMizu(int line)
          Check if peer is Mizutech software.
 booleanPlayFile(java.lang.String filename)
          Play any sound file locally.
 booleanPlayFile(java.lang.String filename, boolean start)
          Play any sound file locally.
 booleanPlaySound(int start, int resourceid, int loop)
          Play any sound from resource file.
 booleanPlaySound(int start, java.lang.String file, boolean localfile, boolean toremotepeer, int line)
          Play any sound file.
 java.lang.StringPoll()
          Deprecated.  
 booleanPushContactlist(java.lang.String userlist)
          User for presence.
 booleanRecFiles_Clear()
          Delete old recorded files.
 booleanRecFiles_Del()
          Delete local recorded files.
 booleanRecFiles_Upload()
          Upload pending recorded files (if ftp/http URI was set)
 booleanRecord(int record)
          Deprecated.  
 booleanRegister()
          Set parameters for authentication and register to the SIP server.
 booleanRegister(java.lang.String server, java.lang.String username, java.lang.String password, boolean async)
          Set parameters for authentication and register to the SIP server.
 booleanRegister(java.lang.String server, java.lang.String username, java.lang.String password, java.lang.String authusername, java.lang.String displayname, boolean async)
          Set parameters for authentication and register to the SIP server.
 booleanRegistered()
          Get the registered state.
 booleanRegisterEx(java.lang.String accounts)
          You can use this function for multiple secondary accounts (up to 99) on the same or other servers.
 booleanReject(int line)
          Reject incoming call.
 booleanRejectEx(int line, java.lang.String reasontext)
          Reject incoming call.
 booleanRemoveVideo()
          Will remove the video fragment (will also disconnect video call if any).
 booleanReStart()
          Will restart the SIP stack.
 booleanSaveFile(java.lang.String filename, java.lang.String content)
          Will save the text file to local disk in the working directory in encrypted format (use API_SaveFileRaw to save as-is)
 booleanSaveFileRaw(java.lang.String filename, java.lang.String content)
          Will save the text file to local disk in the working directory as is.
 booleanSaveFileRemote(java.lang.String filename, java.lang.String content)
          Save file to remote storage (preconfigured ftp or http server )
 voidSaveSettings()
          Might be called before quit to make sure that the settings are saved properly (call it before Stop).
 booleanSendChat(int line, java.lang.String number, java.lang.String message)
          Send a instant message.
 booleanSendChat(int line, java.lang.String number, java.lang.String group, java.lang.String message)
          Group messaging.
 booleanSendChatIsComposing(int line, java.lang.String number)
          Send IM typing notification.
 booleanSendSIP(java.lang.String msg)
          Will send a custom SIP signaling message (for example OPTIONS, NOTIFY, etc).
 booleanSendSMS(int line, java.lang.String number, java.lang.String message)
          Send a SMS message if softswitch has SMS delivery capabilities (Otherwise might try to deliver as IM).
 booleanServerIsMizu()
          Check if SIP server is Mizutech softswitch.
 booleanSetAudioDevice(int dev, java.lang.String devicename)
          Select an audio device.
 booleanSetAudioDevice(int dev, java.lang.String devicename, int immediate)
          Select an audio device.
 booleanSetBlacklist(java.lang.String str)
          Set whole blacklist.
 voidSetBluetooth(boolean on)
          Set audio via Bluetooth.
 booleanSetContact(java.lang.String name, java.lang.String params)
          Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
 booleanSetContactName(java.lang.String name, java.lang.String param)
          Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
 booleanSetContactPhone(java.lang.String name, java.lang.String param)
          Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
 booleanSetContacts(java.lang.String contacts)
          Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
 booleanSetContactSIP(java.lang.String name, java.lang.String param)
          Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
 booleanSetContactSpeedDial(java.lang.String name, java.lang.String param)
          Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
 booleanSetContactStatus(java.lang.String name, java.lang.String param)
          Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
 booleanSetCredentials()
          Deprecated.  
 booleanSetCredentials(java.lang.String server, java.lang.String username, java.lang.String password)
          Set parameters for authentication.
 booleanSetCredentials(java.lang.String server, java.lang.String username, java.lang.String password, java.lang.String authusername, java.lang.String displayname)
          Set parameters for authentication.
 booleanSetCredentialsMD5(java.lang.String server, java.lang.String username, java.lang.String md5, java.lang.String realm)
          Set parameters for authentication.
 booleanSetIdle(boolean idle)
          You might use this API to further extend the battery life (above the usual phone power state changes).
 booleanSetLine(int line)
          Will set the current channel.
 booleanSetLineEx(java.lang.String line)
          Will set the current channel.
 booleanSetLogLevel(int level)
          Set loglevel at runtime.
 booleanSetParameter(java.lang.String param, boolean value)
          Configure the SIP stack by passing any parameter.
 booleanSetParameter(java.lang.String param, int value)
          Configure the SIP stack by passing any parameter.
 booleanSetParameter(java.lang.String param, java.lang.String value)
          Configure the SIP stack by passing any parameter.
 booleanSetParameters(java.lang.String parameters)
          Configure the SIP stack with a list of parameters.
 booleanSetPresenceStatus(java.lang.String status)
          Use the API_SetPresenceStatus(statustring) function call to change the user online status.
 booleanSetPushNotifications(int pushnotifications, java.lang.String clientid, java.lang.String packagename, java.lang.String gateway)
          Call this function if you wish the SIP stack to manage push notifications, useful especially when used with the mizu server or MPUSH gateway.
 booleanSetSIPHeader(int line, java.lang.String hdr)
          Set a custom sip header (a line in the SIP signaling) that will be sent with all messages.
 booleanSetSpeakerMode(boolean loud)
          Set speaker mode,
 booleanSetSSID(java.lang.String ssidval)
          Should not be used.
 booleanSetVideoDevice(java.lang.String devicename)
          Select video device.
 booleanSetVideoDisplaySize(int type, int width, int height)
          Use this function to control the video display size (both for remote and local video).
 booleanSetVolume(int dev, int volume)
          Set volume for the selected device.
 booleanSetVolumeIn(int val)
          Deprecated.  
 booleanSetVolumeOut(int val)
          Deprecated.  
 intShouldReset()
          Check if the sipstack should be restarted.
 booleanShouldResetBeforeCall()
          This function might be called before calls and you should quickly restart the sipstack if returns true (the continue to make the call).
 booleanStart()
          Will start the SIP engine (starting the internal main thread).
 booleanStartRing(int line)
          Will start local ringtone.
 booleanStartStack()
          Deprecated.  
 voidStop()
          Will stop the SIP stack.
 voidStop(boolean fast)
          Will restart the SIP stack.
 booleanStopRing(int line)
          Will stop pending ring tone.
 booleanStreamSoundBuff(int start, int line, byte[] buff, int len)
          Audio streaming from buffer.
 booleanStreamSoundStream(int start, int line, java.io.InputStream inputstream)
          Audio streaming from InputStream.
 booleanTest()
          Test API availability.
 java.lang.StringTestEcho(java.lang.String echo)
          Test API availability.
 booleanTransfer(int line, java.lang.String number)
          Transfer current call to peer which is usually a phone number or a SIP username.
 booleanUnregister()
          Will stop all endpoints (hangup current calls if any and unregister)
 booleanUnsubscribe()
          You might use the API_UnSubscribe() API to unsubscribe all endpoints (this includes presence, voicemail and BLF subscribes).
 java.lang.StringVAD()
          Query for voice activity statistics.
 booleanVideoCall(java.lang.String destination, int fragmentResId, FragmentActivity fragmentinstance)
          
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

phone

public webphone phone
Internal phone object instance. Usually you should not interact with this member directly. (Do not touch.)


common

public Common common
Internal common object instance. Usually you should not interact with this member directly. (Do not touch.)

Constructor Detail

SipStack

public SipStack()
Constructor to create a new SIP stack. Usually you need only one instance in your application since it has multi-account and multi-line capabilities, but if you need, you can create also multiple instances. The constructor doesn't do much things. The real initialization is performed with the Init and Start functions.

Method Detail

Init

public boolean Init(Context context_in)
Initialize the SIP stack. This is the very first function you must call to initialize the internal data structures.

Parameters:
context_in: - your application or activity Context
Returns:
true on success, false on failure

Start

public boolean Start()
Will start the SIP engine (starting the internal main thread).

Returns:
true on success, false on failure

StartStack

public boolean StartStack()
Deprecated. 


GetCommonObj

public Common GetCommonObj()
Provides access to the internal Common object instance. Usually you don't need this kind of access. DO NOT USE THIS FUNCTION unless you have some very special needs!

Returns:
the internal Common object instance.

GetObj

public static SipStack GetObj()
Access the sipstack instance from static code. This is safe to use only if you have one single instance.

Returns:
the sipstack instance

GetWebPhoneObj

public static webphone GetWebPhoneObj()
Provides access to the internal phone object instance. Usually you don't need this kind of access. DO NOT USE THIS FUNCTION unless you have some very special needs!

Returns:
the internal webphone object instance.

GetWebPhoneObj

public static webphone GetWebPhoneObj(Context contextin)
Provides access to the internal phone object instance. Usually you don't need this kind of access. DO NOT USE THIS FUNCTION unless you have some very special needs!

Parameters:
contextin - your app/activity Context
Returns:
the internal webphone object instance.

ReStart

public boolean ReStart()
Will restart the SIP stack.

Returns:
true on success, false on failure

FullStop

public void FullStop()
Will stop the SIP stack and all services (push notifications or jobs/alarms that might have started to keep your app running as background service)


Stop

public void Stop()
Will stop the SIP stack.


Stop

public void Stop(boolean fast)
Will restart the SIP stack.

Parameters:
fast - Set to true if should not wait

Exit

public void Exit()
Will destroy the SIP stack. Should not be used.


ExitEx

public void ExitEx()
Will destroy the SIP stack and also will exit the Java Virtial Machine. Should not be used.


WaitFor

public void WaitFor()
Wait for sipstack to finish after Stop Should not be used.


SaveSettings

public void SaveSettings()
Might be called before quit to make sure that the settings are saved properly (call it before Stop). Should not be used.


ClearSettings

public void ClearSettings()
Clear all settings (including stored settings)


GetVersion

public java.lang.String GetVersion()
Get the SIP stack version number.

Returns:
version string

GetStatus

public java.lang.String GetStatus(int line)
Returns line state or global state if you pass -2 as line parameter

Parameters:
line - channel number
Returns:
The possible returned texts are the same like for notifications.

GetStatusId

public int GetStatusId(int line)
Returns line state or global state id. Should not be used (use the API_GetStatus instead)

Parameters:
line - channel number
Returns:
the state id

GetStatus

public java.lang.String GetStatus(int line,
                                  int strict)
Returns line state or global state if you pass -2 as line parameter

Parameters:
line - channel number
strict - If set to 1, then it will return “Unknown” if no such line is activated. If set to 0, then it will return the default active line if the line doesn’t exists.
Returns:
The possible returned texts are the same like for notifications.

VoiceRecord

public boolean VoiceRecord(int startstop,
                           int now,
                           java.lang.String filename)
Will start/stop a voice recording session This function should be used only if you would like to control the recording duration. If all conversations have to be recorded, then just set the “voicerecording” parameter after your needs.

Parameters:
startstop - 0 to stop, 1 to start locally, 2 to start remote ftp, 3 start to record both locally and to remote ftp, 4 start to record as it is set by the “voicerecording” parameter
now - used if the startstop is set to 0. 0 means that the recorded file will be saved and/or uploaded at the end of the conversation only. 2 means that the file will be saved immediately
filename - file name used for storing the recorded voice (if empty string, than will use a default file name)
Returns:
true on success, false on failure

SetCredentialsMD5

public boolean SetCredentialsMD5(java.lang.String server,
                                 java.lang.String username,
                                 java.lang.String md5,
                                 java.lang.String realm)
Set parameters for authentication. These values can also be passed by parameters (SetParameter).

Parameters:
server - SIP server address (domain or IP:port)
username - SIP username
md5 - md5 checksum for username:realm:password
realm - This parameter is optional (can be set as an empty string) but it is recommended for easy error detection. If present and the server realm don’t match with this one, an error message will be displayed
Returns:
true on success, false on failure

SetCredentials

public boolean SetCredentials(java.lang.String server,
                              java.lang.String username,
                              java.lang.String password)
Set parameters for authentication. These values can also be passed by parameters (SetParameter).

Parameters:
server - SIP server address (domain or IP:port)
username - SIP username
password - SIP password
Returns:
true on success, false on failure

SetCredentials

public boolean SetCredentials(java.lang.String server,
                              java.lang.String username,
                              java.lang.String password,
                              java.lang.String authusername,
                              java.lang.String displayname)
Set parameters for authentication. These values can also be passed by parameters (SetParameter). If authname is empty, then the username will be used for authentications.

Parameters:
server - SIP server address (domain or IP:port)
username - SIP username
password - SIP password
authusername - SIP auth username (if different from username)
displayname - user full name (can be empty)
Returns:
true on success, false on failure

SetCredentials

public boolean SetCredentials()
Deprecated. 

Apply the crendential parameters.

Returns:
true on success, false on failure

RegisterEx

public boolean RegisterEx(java.lang.String accounts)
You can use this function for multiple secondary accounts (up to 99) on the same or other servers. Instead of this function you can just set the “extraregisteraccounts” parameter to the same value.

Parameters:
accounts - must have the following format: server,usr,pwd,ival;server2,usr2,pwd2, ival;
Returns:
true on success, false on failure. The true return value means that the operation was initiated successfully (not completed yet)

Register

public boolean Register(java.lang.String server,
                        java.lang.String username,
                        java.lang.String password,
                        boolean async)
Set parameters for authentication and register to the SIP server. Will connect to the SIP server. This can be also done automatically by parameter (“register”). This function have to be called only once at the startup. Further re-registrations are done automatically based on the “registerinterval” parameter. When called subsequently, the old registrar endpoint is deleted, a new one will be created with a new call-id and AJVoIP will reregister. Even if you wish to force re-registration, you should not call this more frequently than 40 seconds (because up to 40 seconds might be needed for a slow registration attempt)

Parameters:
server - SIP server address (domain or IP:port)
username - SIP username
password - SIP password
async - false if register have to be dow from this thread. true if from separate thread. It is recommended to set to true.
Returns:
true on success, false on failure. The true return value doesn't mean successful registration (That it returned later via notifications)

Register

public boolean Register(java.lang.String server,
                        java.lang.String username,
                        java.lang.String password,
                        java.lang.String authusername,
                        java.lang.String displayname,
                        boolean async)
Set parameters for authentication and register to the SIP server. Will connect to the SIP server. This can be also done automatically by parameter (“register”). This function have to be called only once at the startup. Further re-registrations are done automatically based on the “registerinterval” parameter. When called subsequently, the old registrar endpoint is deleted, a new one will be created with a new call-id and AJVoIP will reregister. Even if you wish to force re-registration, you should not call this more frequently than 40 seconds (because up to 40 seconds might be needed for a slow registration attempt)

Parameters:
server - SIP server address (domain or IP:port)
username - SIP username
password - SIP password
authusername - SIP auth username (if different from username)
displayname - user full name (can be empty)
async - false if register have to be dow from this thread. true if from separate thread. It is recommended to set to true.
Returns:
true on success, false on failure. The true return value doesn't mean successful registration (That it returned later via notifications)

Register

public boolean Register()
Set parameters for authentication and register to the SIP server. Will connect to the SIP server. This can be also done automatically by parameter (“register”). This function have to be called only once at the startup. Further re-registrations are done automatically based on the “registerinterval” parameter. When called subsequently, the old registrar endpoint is deleted, a new one will be created with a new call-id and AJVoIP will reregister. Even if you wish to force re-registration, you should not call this more frequently than 40 seconds (because up to 40 seconds might be needed for a slow registration attempt)

Returns:
true on success, false on failure. The true return value doesn't mean successful registration (That it returned later via notifications)

Unregister

public boolean Unregister()
Will stop all endpoints (hangup current calls if any and unregister)

Returns:
true on success, false on failure

HTTPKeepAlive

public boolean HTTPKeepAlive()
Deprecated. 

Not needed.


StopRing

public boolean StopRing(int line)
Will stop pending ring tone. Rarely needed if any.

Parameters:
line - channel number
Returns:
true on success, false on failure

StartRing

public boolean StartRing(int line)
Will start local ringtone. Rarely needed if any.

Parameters:
line - channel number
Returns:
true on success, false on failure

NATKeepAlive

public boolean NATKeepAlive(java.lang.String server)
Rarely needed if any, because the siptack will do it automatically.

Parameters:
server - target server addresss

CapabilityRequest

public boolean CapabilityRequest(java.lang.String server,
                                 java.lang.String username)
Request server or server capabilities with SIP OPTIONS. Rarely needed if any.

Parameters:
server - peer or server SIP signaling address (IP:port or domain)
username - user name to be sent in the SIP request
Returns:
true on success, false on failure

LineToCallID

public java.lang.String LineToCallID(int line)
Get the SIP Call-ID for a line number. Note: will return the current default line if the line number is 0 or negative.

Parameters:
line - channel number
Returns:
call-id string or empty string if no such line found

CallIDToLine

public int CallIDToLine(java.lang.String callid)
Get the line number for a SIP Call-ID.

Parameters:
callid - SIP Call-ID string
Returns:
line number or -1 if no such Call-ID exists

SetLine

public boolean SetLine(int line)
Will set the current channel. Use only if you present line selection for the users. Otherwise you don’t have to take care about the lines. Note: Instead of using each API call with the line parameter, you can just use this function when you wish to change the active line and use all the other API calls with -1 for the line parameter.

Parameters:
line - channel number
Returns:
true on success, false on failure

SetLineEx

public boolean SetLineEx(java.lang.String line)
Will set the current channel. Use only if you present line selection for the users. Otherwise you don’t have to take care about the lines. Note: Instead of using each API call with the line parameter, you can just use this function when you wish to change the active line and use all the other API calls with -1 for the line parameter.

Parameters:
line - channel number, SIP Call-ID or peer username/number
Returns:
true on success, false on failure

GetLine

public int GetLine()
Get the currently active line. This should be the line which you have set previously except after incoming and outgoing calls (the SIP client will automatically switch the active line to a new free line for these if the current active line is already occupied by a call).

Returns:
the current active channel number

Call

public boolean Call(int line,
                    java.lang.String number)
Initiate call to a number or sip username. If the number parameter is empty, then will redial the last number. Note: you should pass only the peer number, extension or username to this function and not the full SIP URI (the SIP stack will construct the full SIP URI with the serveraddress already set)

Parameters:
line - channel number
number - destinationnumber, SIP username or SIP URI to call
Returns:
true on success, false on failure. The true return value means that the call was initiated successfully (Not completed yet. You will receive STATUS notifications about the call state)

Call

public boolean Call(int line,
                    java.lang.String number,
                    boolean async)
Initiate call to a number or sip username. If the number parameter is empty, then will redial the last number. Note: you should pass only the peer number, extension or username to this function and not the full SIP URI (the SIP stack will construct the full SIP URI with the serveraddress already set)

Parameters:
line - channel number
number - destinationnumber, SIP username or SIP URI to call
async - ignored (always asyncron)
Returns:
true on success, false on failure. The true return value means that the call was initiated successfully (Not completed yet. You will receive STATUS notifications about the call state)

CallEx

public boolean CallEx(int line,
                      java.lang.String number,
                      int type)
Deprecated. 

Initiate call to a number or sip username. If the number parameter is empty, then will redial the last number. Note: you should pass only the peer number, extension or username to this function and not the full SIP URI (the SIP stack will construct the full SIP URI with the serveraddress already set)

Parameters:
line - channel number
number - destinationnumber, SIP username or SIP URI to call
type - call type
Returns:
true on success, false on failure. The true return value means that the call was initiated successfully (Not completed yet. You will receive STATUS notifications about the call state)

RemoveVideo

public boolean RemoveVideo()
Will remove the video fragment (will also disconnect video call if any). Instead of this function, you should just hide/destroy your video container element from the user interface.

Returns:
true on success, false on failure

OnVideoRemoved

public void OnVideoRemoved(GVideo instance)
This function should not be used. Will clean the video handle.


VideoCall


SetVideoDisplaySize

public boolean SetVideoDisplaySize(int type,
                                   int width,
                                   int height)
Use this function to control the video display size (both for remote and local video).

Parameters:
type - 1=for remote video container, 2=for local video container
width - width in pixels
height - height in pixels; this parameter can be 0, and the height will be set depending on the video's aspect ratio
Returns:
true on success, false on failure

MuteVideo

public boolean MuteVideo(int state,
                         int direction,
                         int height)
Disable/enable video(stream) during a video call.

Parameters:
state - Pass true for the state to mute the video or false to un-mute.
direction - 0: mute in and out, 1: mute remote, 2: mute local
Returns:
true on success, false on failure

AddVideo

public boolean AddVideo(int line,
                        int type)
Deprecated. 

Add video to current call. Should not be used!

Returns:
true on success, false on failure

Accept

public boolean Accept(int line)
Connect incoming call.

Parameters:
line - channel number
Returns:
true on success, false on failure

AcceptStrict

public boolean AcceptStrict(int line)
Connect incoming call. Will accept the call only if the line strictly match an incoming channel number.

Parameters:
line - channel number
Returns:
true on success, false on failure

Reject

public boolean Reject(int line)
Reject incoming call. You could also use the Hangup API function for this.

Parameters:
line - channel number
Returns:
true on success, false on failure

RejectEx

public boolean RejectEx(int line,
                        java.lang.String reasontext)
Reject incoming call. You could also use the Hangup API function for this. Will reject the call only if the line strictly match an incoming channel number.

Parameters:
line - channel number
Returns:
true on success, false on failure

Hangup

public boolean Hangup()
Disconnect call.

Returns:
true on success, false on failure

Hangup

public boolean Hangup(int line)
Disconnect current call(s).

Parameters:
line - channel number
Returns:
true on success, false on failure

Hangup

public boolean Hangup(int line,
                      java.lang.String reason)
Disconnect current call(s).

Parameters:
line - channel number
Returns:
true on success, false on failure

Transfer

public boolean Transfer(int line,
                        java.lang.String number)
Transfer current call to peer which is usually a phone number or a SIP username. (Will use the REFER method after SIP standards). You can set the mode of the transfer with the “transfertype” parameter. If the peer parameter is empty than will interconnect the currently running calls (should be used only if you have 2 simultaneous calls)

Parameters:
line - channel number
number - destination number (transfer-to)
Returns:
true on success, false on failure

Conf

public boolean Conf(int line,
                    java.lang.String number)
Add people to conference or initiate conference call. If peer is empty than will mix the currently running calls (if there is more than one call) Otherwise it will call the new peer (usually a phone number or a SIP user name) and once connected will join with the current session.

Parameters:
line - channel number
number - destination number, username or SIP URI
Returns:
true on success, false on failure

ConfEx

public boolean ConfEx(int line,
                      java.lang.String number,
                      boolean add)
Add/remove people to/from conference.

Parameters:
line - channel number
number - destination number, username or SIP URI
add - set to true to add this number or false to remove
Returns:
true on success, false on failure

Mute

public boolean Mute(int line,
                    boolean mute,
                    int what)
Mute current call.

Parameters:
line - channel number (-2 for all or -1 for current line)
mute - Set the mute parameter to true for mute or false to un-mute.
what - The direction can have the following values: 0: mute in and out, 1: mute out (speakers), 2: mute in (microphone), 3: mute in and out (same as 0), 4: mute default (set by the “defmute” parameter, which is “mute microphone only” by default)
Returns:
true on success, false on failure

MuteEx

public boolean MuteEx(int line,
                      boolean mute,
                      int what)
Mute current call. Same as the Mute API.

Parameters:
line - channel number (-2 for all or -1 for current line)
mute - Set the mute parameter to true for mute or false to un-mute.
what - The direction can have the following values: 0: mute in and out, 1: mute out (speakers), 2: mute in (microphone), 3: mute in and out (same as 0), 4: mute default (set by the “defmute” parameter, which is “mute microphone only” by default)
Returns:
true on success, false on failure

IsMuted

public int IsMuted(int line)
Return if the selected line is muted or not.

Parameters:
line - channel number
Returns:
-1: unknown, 0: not muted, 1: both muted (in/out), 2: out muted (speaker), 3: in muted (microphone), 4: both muted (in/out; same as 1)

IsOnHold

public int IsOnHold(int line)
Query if the selected line is on hold or not

Parameters:
line - channel number
Returns:
-1: unknown, 0: no, 1: not used, 2: on hold, 3: other party held, 4: both in hold

Ignore

public boolean Ignore(int line)
Ignore incoming call.

Parameters:
line - channel number
Returns:
true on success, false on failure

Forward

public boolean Forward(int line,
                       java.lang.String peer)
Forward incoming call to peer (with 302 Moved Temporarily disconnect code)

Parameters:
line - channel number
Returns:
true on success, false on failure

Hold

public boolean Hold(int line,
                    boolean hold)
Hold current call. This will issue an UPDATE or a reINVITE.

Parameters:
line - channel number
hold - true for hold and false to reload.
Returns:
true on success, false on failure

HoldChange

public boolean HoldChange(int line)
Togle hold state of the call.

Parameters:
line - channel number
Returns:
true on success, false on failure

Dtmf

public boolean Dtmf(int line,
                    java.lang.String dtmf)
Send DTMF message by In-Band,SIP INFO or RFC2833 method (depending on the “dtmfmode” parameter).

Parameters:
line - channel number
dtmf - one or more dtmf digits. Use the space char to insert delays between the digits.
Returns:
true on success, false on failure

SendChat

public boolean SendChat(int line,
                        java.lang.String number,
                        java.lang.String message)
Send a instant message. (SIP MESSAGE method after RFC 3428)

Parameters:
line - channel number
number - phone number or SIP username/extension number
message - text (chat body content)
Returns:
true on success, false on failure

SendChat

public boolean SendChat(int line,
                        java.lang.String number,
                        java.lang.String group,
                        java.lang.String message)
Group messaging. (SIP MESSAGE method after RFC 3428)

Parameters:
line - channel number
number - phone number or SIP username/extension number
group - groupname (members separated by | )
message - text (chat body content)
Returns:
true on success, false on failure

SendSMS

public boolean SendSMS(int line,
                       java.lang.String number,
                       java.lang.String message)
Send a SMS message if softswitch has SMS delivery capabilities (Otherwise might try to deliver as IM). The message is delivered as a standard SIP MESSAGE with X-Sms: Yes header. The server is responsible to convert it to SMS.

Parameters:
line - channel number
number - target mobile phone number
message - text (SMS text)
Returns:
true on success, false on failure

SendChatIsComposing

public boolean SendChatIsComposing(int line,
                                   java.lang.String number)
Send IM typing notification.

Parameters:
line - channel number
number - phone number or SIP username/extension number
Returns:
true on success, false on failure

SetVolumeIn

public boolean SetVolumeIn(int val)
Deprecated. 

Set volume in. Deprecated Use the SetVolume API instead

Parameters:
val - volume level
Returns:
true on success, false on failure

SetVolumeOut

public boolean SetVolumeOut(int val)
Deprecated. 

Set volume out. Deprecated Use the SetVolume API instead

Parameters:
val - volume level
Returns:
true on success, false on failure

SetVolume

public boolean SetVolume(int dev,
                         int volume)
Set volume for the selected device.

Parameters:
dev - specify the device: 0 for the recording (microphone) audio device, 1 for the playback (speaker) audio device, 2 for the ringback (speaker) audio device
volume - volume level from 0 to 100 (percent value: 0-100%)
Returns:
true on success, false on failure

GetVolume

public int GetVolume(int dev)
Get Volume level

Parameters:
dev - specify the device to query: 0 for the recording (microphone) audio device, 1 for the playback (speaker) audio device, 2 for the ringback (speaker) audio device
Returns:
the volume (0-100%) for the selected device.

SetLogLevel

public boolean SetLogLevel(int level)
Set loglevel at runtime. You can also just pass the "loglevel" parameter

Parameters:
level - loglevel from 1-5 (0 is not recommended because it will mute also the important notifications. values higher then 5 will increase the system load)
Returns:
true on success, false on failure

HasCallInProgress

public boolean HasCallInProgress()
Query of there is any call in progress (including calls in ringing or connected state).

Returns:
true if there is call in progress, otherwise false.

HasCallInSpeaking

public boolean HasCallInSpeaking()
Query of there is any connected call.

Returns:
true if there is any connected call, otherwise false.

IsInCall

public int IsInCall()
Query of there is any call in progress.

Returns:
0 if no call is in progress, 1 if we have a ringing call or 2 if we have a connected call

IsSpeaking

public boolean IsSpeaking()
Query of there is any connected call.

Returns:
true if there is any connected call, otherwise false.

GetCurrentConnectedCallCount

public int GetCurrentConnectedCallCount()
Query the number of simultaneous calls currently in progress.

Returns:
the number of concurrent calls or 0 if there is no any calls.

SetIdle

public boolean SetIdle(boolean idle)
You might use this API to further extend the battery life (above the usual phone power state changes). The sipstack internally has an idle state which can be useful to decrease CPU and RAM usage by using less resources, slowing down all operations, running threads in low priority and increases internal timer intervals. This means that the app can enter in idle state even if running in foreground on a non-sleeping phone state (but with no user interaction and no important task running such as an ongoing call) You should call this function with the idle parameter set to true if the screen is dimmed/off, there is no call and no user interaction with the application for a while. Call with the idle parameter set to false when the user begins any interaction with the application. The sipstack will also automatically disable the idle state when there is a new incoming call, chat or other important event that might require user interaction or CPU resources.

Parameters:
idle - true if no user activity
Returns:
true on success, false on failure

IsIdle

public boolean IsIdle()
Query idle state

Returns:
true is sip stack in idle, otherwise false

IsOnline

public boolean IsOnline()
Query online state. This is not the same with the register state (It can return true even if not registered)

Returns:
true if network connection can be made, otherwise false (no network or no internet connection).

NeedRatingRequest

public boolean NeedRatingRequest()
Some servers might report call rating automatically in signaling.

Returns:
true if rating can be received only by API. return false if rating can be received automatically.

GetRegFailReason

public java.lang.String GetRegFailReason(boolean extended)
Query the reason of the last failed registration. Set the extended parameter to true to get more details

Parameters:
extended - set to true for extended report
Returns:
reason text of the last failed registered attempt

PeerIsMizu

public boolean PeerIsMizu(int line)
Check if peer is Mizutech software.

Returns:
false: Third-party or unknown, true: Mizutech softphone or webphone

ServerIsMizu

public boolean ServerIsMizu()
Check if SIP server is Mizutech softswitch.

Returns:
false: Third-party server, true: Mizutech server

GetDiscReasonText

public java.lang.String GetDiscReasonText(java.lang.String line)
Query the disconnect reason of the last disconnected call.

Parameters:
line - can be line number or SIP call-id
Returns:
disconnect reason text

ShouldReset

public int ShouldReset()
Check if the sipstack should be restarted. Usually this is required only on local network change (such as IP change or changing from mobile data to wifi).

Returns:
0=no,1=not registered for a while,2=network changed

ShouldResetBeforeCall

public boolean ShouldResetBeforeCall()
This function might be called before calls and you should quickly restart the sipstack if returns true (the continue to make the call).

Returns:
true if you should restart the sip stack before to make the call

CanBluetooth

public boolean CanBluetooth()
Query bluetooth setting.

Returns:
0=no, not searching; 2=no, failed; 4=no,unknown; 6=no, searching; 8=yes, should; 10=yes, enabled

IsBluetooth

public boolean IsBluetooth()
Check if call on bluetooth.

Returns:
true if call using bluetooth device, otherwise false

PlaySound

public boolean PlaySound(int start,
                         java.lang.String file,
                         boolean localfile,
                         boolean toremotepeer,
                         int line)
Play any sound file. At least wave files are supported in the following format: PCM SIGNED 8000.0 Hz (8 kHz) 16 bit mono (2 bytes/frame) in little-endian (128 kbits). This function can be used to play audio locally, but also for remote streaming. For remote playback, make sure to force a narrowband codec if your file is narrowband and wideband codec (speex, opus) if your file is wideband (16 kHz, 16 bit mono in little-endian). The file must be found locally.

Parameters:
start - 1 for start or 0 to stop the playback, -1 to pre-cache
file - file name
localfile - true if the file have to be read from the device file system. False if remote file (for example if the file is on the webserver)
toremotepeer - stream the playback to the connected peer
line - used with toremotepeer if there are multiple calls in progress to specify the call (usually set to -1 for the current call if any)
Returns:
true on success, false on failure

StreamSoundStream

public boolean StreamSoundStream(int start,
                                 int line,
                                 java.io.InputStream inputstream)
Audio streaming from InputStream.

Parameters:
start - 1 for start or 0 to stop the playback, -1 to pre-cache
line - channel number
inputstream - audio data stream
Returns:
true on success, false on failure

StreamSoundBuff

public boolean StreamSoundBuff(int start,
                               int line,
                               byte[] buff,
                               int len)
Audio streaming from buffer.

Parameters:
start - 1 for start or 0 to stop the playback, -1 to pre-cache
line - channel number
buff - audio data buffer
buff - audio data size in bytes
Returns:
true on success, false on failure

PlaySound

public boolean PlaySound(int start,
                         int resourceid,
                         int loop)
Play any sound from resource file.

Parameters:
start - 1 for start or 0 to stop the playback, -1 to pre-cache
resourceid - resource id
loop - specify how many times to play
Returns:
true on success, false on failure

PlayFile

public boolean PlayFile(java.lang.String filename)
Play any sound file locally.

Parameters:
filename - file name
Returns:
true on success, false on failure

PlayFile

public boolean PlayFile(java.lang.String filename,
                        boolean start)
Play any sound file locally.

Parameters:
filename - file name
start - true to start playing, false to stop current playback
Returns:
true on success, false on failure

SetBluetooth

public void SetBluetooth(boolean on)
Set audio via Bluetooth.

Parameters:
on - toggle bluetooth on (true) / off (false)

IsLoudspeaker

public boolean IsLoudspeaker()
Query if using loudspeaker

Returns:
true if yes, false if no

SetSpeakerMode

public boolean SetSpeakerMode(boolean loud)
Set speaker mode,

Parameters:
loud - set to true if you wish to set to loudspeaker. otherwise false for normal earspeaker.

GetIncomingDisplay

public java.lang.String GetIncomingDisplay(int line)
Get incoming caller id (might return two lines: caller id \n caller name)

Parameters:
line - channel number
Returns:
details like: name, number, for incoming calls

GetLogs

public java.lang.String GetLogs()
Can be used to get the logs (which are otherwise written also to standard output and to Logcat).

Returns:
accumulated log lines separated by CRLF

GetNotifications

public java.lang.String GetNotifications()
Return the notification strings. You should poll for the notifications periodically from a separate thread. Will return immediatly (with empty string if no new notifications)

Returns:
accumulated notifications or empty string. It will return accumulated events since the last function call (notifications separated by CRLF).

GetNotificationsSync

public java.lang.String GetNotificationsSync()
Return the notification strings. You should poll for the notifications periodically from a separate thread. Will return only when new notification(s) exists (Blocking read).

Returns:
accumulated events since the last function call (notifications separated by CRLF).

Poll

public java.lang.String Poll()
Deprecated. 

Return the notification strings.


GetAddress

public java.lang.String GetAddress()
Query local address.

Returns:
local SIP listener address (IP:port)

GetLastRecFileName

public java.lang.String GetLastRecFileName()
Query recently recorded file.

Returns:
the last recorded file name.

Test

public boolean Test()
Test API availability. Should not be used.

Returns:
true if API working, otherwise false

TestEcho

public java.lang.String TestEcho(java.lang.String echo)
Test API availability. Should not be used.

Parameters:
echo - any string
Returns:
echo

SetParameters

public boolean SetParameters(java.lang.String parameters)
Configure the SIP stack with a list of parameters. See the documentation for the available settings.

Parameters:
parameters - You can pass a set of parameters with this function in value=key lines separated by CRLF (\r\n).
Returns:
true on success, false on failure

SetParameter

public boolean SetParameter(java.lang.String param,
                            java.lang.String value)
Configure the SIP stack by passing any parameter. See the documentation for the available setting. Note: some basic parameters should be set before the Start function have been called (such as “register”), however most parameters can be also changed at run-time.

Parameters:
param - parameter name (setting name)
Returns:
true on success, false on failure

SetParameter

public boolean SetParameter(java.lang.String param,
                            int value)
Configure the SIP stack by passing any parameter. See the documentation for the available setting. Note: some basic parameters should be set before the Start function have been called (such as “register”), however most parameters can be also changed at run-time.

Parameters:
param - parameter name (setting name)
Returns:
true on success, false on failure

SetParameter

public boolean SetParameter(java.lang.String param,
                            boolean value)
Configure the SIP stack by passing any parameter. See the documentation for the available setting. Note: some basic parameters should be set before the Start function have been called (such as “register”), however most parameters can be also changed at run-time.

Parameters:
param - parameter name (setting name)
Returns:
true on success, false on failure

GetParameter

public java.lang.String GetParameter(java.lang.String param)
Query parameter. Note: some basic parameters should be set before the Start function have been called (such as “register”), however most parameters can be also changed at run-time.

Parameters:
param - parameter name (setting name)
Returns:
the value of the parameter

SetSSID

public boolean SetSSID(java.lang.String ssidval)
Should not be used.


DelSettings

public boolean DelSettings(int level)
Delete settings and data.

Parameters:
level - 0: nothing, 1: settings, 2: everything
Returns:
true on success, false on failure

GetConfigHash

public java.lang.String GetConfigHash()
Get a has value of the configuration. Should not be used.

Returns:
hash string

IsEncrypted

public int IsEncrypted()
Check if the connection is encrypted.

Returns:
-1: unknown, 0=no,1=partially/weak yes,2=yes,3=always strong

GetBindir

public java.lang.String GetBindir()
Query the application path (folder with the app binaries or app home folder)

Returns:
path

GetWorkdir

public java.lang.String GetWorkdir()
Query the application working directory (data folder) Based on appcontext.getFilesDir().getPath() and Environment.getDataDirectory().getPath();

Returns:
path

GetAltWorkdir

public java.lang.String GetAltWorkdir()
Query the application alternative working directory (such as folder on external SD card).

Returns:
path

RecFiles_Del

public boolean RecFiles_Del()
Delete local recorded files.

Returns:
true on success, false on failure

RecFiles_Clear

public boolean RecFiles_Clear()
Delete old recorded files.

Returns:
true on success, false on failure

RecFiles_Upload

public boolean RecFiles_Upload()
Upload pending recorded files (if ftp/http URI was set)

Returns:
true on success, false on failure

VAD

public java.lang.String VAD()
Query for voice activity statistics. See the VAD notification for more details. Note: if you call this function, VAD will not be sent automatically anymore. (So you will need to continue to poll for the details).

Returns:
voice activity statistics

IsRegistered

public boolean IsRegistered()
Get the registered state.

Returns:
true if the UAC is registered (“connected”) to the SIP server.

Registered

public boolean Registered()
Get the registered state.

Returns:
true if the UAC is registered (“connected”) to the SIP server.

IsRegisteredEx

public int IsRegisteredEx()
Get the extended registered state.

Returns:
0=unknown,1=not needed,2=yes,3=working yes,4=working unknown,5=working no,6=unregistered,7=no (failed)

SaveFile

public boolean SaveFile(java.lang.String filename,
                        java.lang.String content)
Will save the text file to local disk in the working directory in encrypted format (use API_SaveFileRaw to save as-is)

Parameters:
filename - file path
content - file content
Returns:
true on success, false on failure

SaveFileRaw

public boolean SaveFileRaw(java.lang.String filename,
                           java.lang.String content)
Will save the text file to local disk in the working directory as is.

Parameters:
filename - file path
content - file content
Returns:
true on success, false on failure

SaveFileRemote

public boolean SaveFileRemote(java.lang.String filename,
                              java.lang.String content)
Save file to remote storage (preconfigured ftp or http server )

Parameters:
filename - file path
content - file content
Returns:
true on success, false on failure

LoadFile

public java.lang.String LoadFile(java.lang.String filename)
Load file content from local disk.

Parameters:
filename - file path
Returns:
text file content

LoadFileRemote

public boolean LoadFileRemote(java.lang.String filename)
Load file from remote storage. The download process is performed asynchronously. You need to call this function only once and then a few seconds later call the API_LoadFile function with the same file name. It will contain “ERROR: reason” text if the download failed.

Parameters:
filename - file path
Returns:
true on success, false on failure

LoadFileRemoteSync

public java.lang.String LoadFileRemoteSync(java.lang.String filename)
Will download the specified file from remote storage synchronously (will block until done or fails).

Parameters:
filename - file path
Returns:
text file content

HTTPGet

public java.lang.String HTTPGet(java.lang.String uri)
Send a HTTP GET request.

Parameters:
uri - HTTP URI
Returns:
content or failure reason beginning with “ERROR”.

HTTPPost

public boolean HTTPPost(java.lang.String uri,
                        java.lang.String data)
Send a HTTP POST request.

Returns:
true on success, false on failure

HTTPReq

public java.lang.String HTTPReq(java.lang.String uri,
                                java.lang.String data)
Send a HTTP POST or GET request. (If data is empty, then GET will be sent). Can be tunneled. Can block for up to 20 seconds.

Parameters:
uri - HTTP URI
data - conent to post
Returns:
content or failure reason beginning with “ERROR”.

HTTPReqAsync

public boolean HTTPReqAsync(java.lang.String uri,
                            java.lang.String data)
Send a HTTP POST or GET request. (If data is empty, then GET will be sent). Can be tunneled. The result will be returned in notifications with “ANSWER” header.

Parameters:
uri - HTTP URI
data - conent to post
Returns:
true on success, false on failure

ClearCredentials

public boolean ClearCredentials()
Clear existing user account details.

Returns:
true on success, false on failure

SendSIP

public boolean SendSIP(java.lang.String msg)
Will send a custom SIP signaling message (for example OPTIONS, NOTIFY, etc). The message will be sent within 1-3 seconds after the function call is completed.

Parameters:
msg - SIP message to send
Returns:
true on success, false on failure

GetSIPHeader

public java.lang.String GetSIPHeader(int line,
                                     java.lang.String hdr)
Return a sip header value received by JVoIP. If not found it will return a string beginning with “ERROR:” such as “ERROR: no such line”.

Parameters:
line - channel number
hdr - SIP header to request
Returns:
SIP header value

GetSIPMessage

public java.lang.String GetSIPMessage(int line,
                                      int dir,
                                      int type)
Return the last received or sent SIP signaling message as raw text.

Parameters:
line - channel number
dir - 0: in (incoming/received message), 1: out (outgoing/sent message)
type - 0: any, 1: SIP request (such as INVITE, REGISTER, BYE), 2: SIP answer (such as 200 OK, 401 Unauthorized and other response codes), 3: INVITE (the last INVITE received or sent), 4: the last 200 OK (call connect, ok for register or other)
Returns:
the SIP message

SetSIPHeader

public boolean SetSIPHeader(int line,
                            java.lang.String hdr)
Set a custom sip header (a line in the SIP signaling) that will be sent with all messages. Can be used for various integration purposes (for example for sending the http session id). Multiple headers can be separated by CRLF (\r\n). You can also set this with parameter (customsipheader).

Parameters:
line - channel number
hdr - SIP header (line) to set
Returns:
true on success, false on failure

GetLineStatus

public int GetLineStatus(int line)
Query the state of a line. Note: this is rarely needed since you receive the status also by event notifications

Parameters:
line - channel number
Returns:
line state id

GetLineStatusText

public java.lang.String GetLineStatusText(int line)
Query the state of a line. Note: this is rarely needed since you receive the status also by event notifications

Parameters:
line - channel number
Returns:
line state as text

GetLastCallDetails

public java.lang.String GetLastCallDetails()
Get details about the last finished call.

Returns:
call details

IsIncomingVideo

public boolean IsIncomingVideo()
Check if current incoming call is video call.

Returns:
true if video call, false if audio call

GetLastRecInvite

public java.lang.String GetLastRecInvite()
Get last received INVITE message.

Returns:
message text

GetLastRecSIPMessage

public java.lang.String GetLastRecSIPMessage(java.lang.String line)
Get last received SIP message.

Parameters:
line - channel number
Returns:
message text

AddLog

public boolean AddLog(java.lang.String text)
Add to sip stack log.

Returns:
true on success, false on failure

AddLog

public boolean AddLog(int level,
                      java.lang.String text)
Add to sip stack log.

Returns:
true on success, false on failure

PushContactlist

public boolean PushContactlist(java.lang.String userlist)
User for presence. Call this to pass all the usernames and phonenumbers from your external contact list if any. This is necessary, because for existing contacts JVoIP can accept the requests automatically, while for other it might ask for user permission

Parameters:
userlist - users separated by comma (or a single user)
Returns:
true on success, false on failure

GetPresenceStatus

public java.lang.String GetPresenceStatus()
Query local presence state.

Returns:
presence text

SetPresenceStatus

public boolean SetPresenceStatus(java.lang.String status)
Use the API_SetPresenceStatus(statustring) function call to change the user online status. This function will start to send NOTIFY requests to subscribed parties.

Parameters:
status - one of the followings strings: Online, Away, DND, Invisible , Offline (case sensitive) .
Returns:
true on success, false on failure

CheckPresence

public boolean CheckPresence(java.lang.String userlist)
Call this function to save softswitch resources, you should carefully select the contacts. (Send only the contacts which are actually used and called numbers. We recommend up to 50 contacts. If the user select a contact, then you can call this function later with that single contact to request its status). This function will start to send SUBSCRIBE requests.

Parameters:
userlist - users separated by comma (or a single user)
Returns:
true on success, false on failure

CheckBLF

public boolean CheckBLF(java.lang.String userlist)
To subscribe to other extensions call state, you can set the blfuserlist parameter or use the API_CheckBLF(userlist) to subscribe to other extension(s) state changes (users separated by comma).

Parameters:
userlist - users separated by comma
Returns:
true on success, false on failure

Unsubscribe

public boolean Unsubscribe()
You might use the API_UnSubscribe() API to unsubscribe all endpoints (this includes presence, voicemail and BLF subscribes).

Returns:
true on success, false on failure

NewUser

public boolean NewUser(java.lang.String user)
On newuser, you should ask the user if wish to accept it. If accepted, call the API_NewUser function. The same function should be called when the user adds a new contact to its contactlist.

Parameters:
user - username of the user to accept
Returns:
true on success, false on failure

SetBlacklist

public boolean SetBlacklist(java.lang.String str)
Set whole blacklist.

Parameters:
str - users/numbers separated by comma
Returns:
true on success, false on failure

AddToBlacklist

public boolean AddToBlacklist(java.lang.String str)
Add user to blacklist

Parameters:
str - username, phone number or SIP URI to block
Returns:
true on success, false on failure

GetBlacklist

public java.lang.String GetBlacklist()
Query the current blacklist

Returns:
blacklisted users serparated by comma

NumExists

public boolean NumExists()
Use this only with the Mizu Softswitch. On first start you might call API_NumExists. If using the Mizu VoIP server, then it will return all existing contacts with SERVERCONTACTS,userlist notification where userlist are populated with the valid users and their online status.

Returns:
true on success, false on failure

SetContact

public boolean SetContact(java.lang.String name,
                          java.lang.String params)
Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack. It is not recommended to use the contact management API. You should manage your contacts yourself after your needs.


SetContactPhone

public boolean SetContactPhone(java.lang.String name,
                               java.lang.String param)
Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack. It is not recommended to use the contact management API. You should manage your contacts yourself after your needs.


SetContactSIP

public boolean SetContactSIP(java.lang.String name,
                             java.lang.String param)
Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack. It is not recommended to use the contact management API. You should manage your contacts yourself after your needs.


SetContactName

public boolean SetContactName(java.lang.String name,
                              java.lang.String param)
Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack. It is not recommended to use the contact management API. You should manage your contacts yourself after your needs.


SetContactSpeedDial

public boolean SetContactSpeedDial(java.lang.String name,
                                   java.lang.String param)
Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack. It is not recommended to use the contact management API. You should manage your contacts yourself after your needs.


SetContactStatus

public boolean SetContactStatus(java.lang.String name,
                                java.lang.String param)
Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack. It is not recommended to use the contact management API. You should manage your contacts yourself after your needs.


GetContactPhone

public java.lang.String GetContactPhone(java.lang.String name)
Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack. It is not recommended to use the contact management API. You should manage your contacts yourself after your needs.


GetContactSIP

public java.lang.String GetContactSIP(java.lang.String name)
Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack. It is not recommended to use the contact management API. You should manage your contacts yourself after your needs.


GetContactName

public java.lang.String GetContactName(java.lang.String name)
Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack. It is not recommended to use the contact management API. You should manage your contacts yourself after your needs.


GetContactSpeedDial

public java.lang.String GetContactSpeedDial(java.lang.String name)
Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack. It is not recommended to use the contact management API. You should manage your contacts yourself after your needs.


AddContact

public boolean AddContact(java.lang.String params)
Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack. It is not recommended to use the contact management API. You should manage your contacts yourself after your needs.


DelContact

public boolean DelContact(java.lang.String name)
Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack. It is not recommended to use the contact management API. You should manage your contacts yourself after your needs.


GetContact

public java.lang.String GetContact(java.lang.String name)
Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack. It is not recommended to use the contact management API. You should manage your contacts yourself after your needs.


GetContactPresence

public java.lang.String GetContactPresence(java.lang.String name)
Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack. It is not recommended to use the contact management API. You should manage your contacts yourself after your needs.


GetContactPresenceStr

public java.lang.String GetContactPresenceStr(java.lang.String name)
Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack. It is not recommended to use the contact management API. You should manage your contacts yourself after your needs.


SetContacts

public boolean SetContacts(java.lang.String contacts)
Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack. It is not recommended to use the contact management API. You should manage your contacts yourself after your needs.


GetContacts

public java.lang.String GetContacts()
Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack. It is not recommended to use the contact management API. You should manage your contacts yourself after your needs.


CheckVoicemail

public boolean CheckVoicemail(int line)
Will (re)subscribe for voicemail notifications. No need to call this function if the “voicemail” parameter is set to 2.

Parameters:
line - channel number. should be set to -1.
Returns:
true on success, false on failure

Record

public boolean Record(int record)
Deprecated. 

Set voice recording. You should not use this function. Use the VoiceRecord API instead.

Parameters:
record - 0=no,1=local,2=remote ftp,3=both
Returns:
true on success, false on failure

GetMAC

public java.lang.String GetMAC()
Get the device MAC address if possible. Most devices will forbid access to MAC address

Returns:
MAC address if successfully loaded

GetAudioDeviceList

public java.lang.String GetAudioDeviceList(int dev)
Query the list of available audio devices. Note: usually you don’t need to use this function. Just call the “API_AudioDevice” to let the users to change their audio settings.

Parameters:
dev - Set to 0 to list the recording device names or set to 1 for to get the playback or ringer devices.
Returns:
list of audio devices separated by CRLF.

SetAudioDevice

public boolean SetAudioDevice(int dev,
                              java.lang.String devicename)
Select an audio device.

Parameters:
dev - 0: recording device (microphone), 1: playback device (speaker, headset), 2: ringer device (speaker, headset)
devicename - name of the audio device. Should be a valid audio device name (you can list them with the GetAudioDeviceList call)
Returns:
true on success, false on failure

SetVideoDevice

public boolean SetVideoDevice(java.lang.String devicename)
Select video device.

Parameters:
devicename - name of the video device
Returns:
true on success, false on failure

GetAudioDevice

public java.lang.String GetAudioDevice(int dev)
Query the current audio device name.

Parameters:
dev - 0 for recording, 1 for playback, 2 for ringer
Returns:
the currently selected audio device for the dev line

SetAudioDevice

public boolean SetAudioDevice(int dev,
                              java.lang.String devicename,
                              int immediate)
Select an audio device.

Parameters:
dev - 0: recording device (microphone), 1: playback device (speaker, headset), 2: ringer device (speaker, headset)
devicename - name of the audio device. Should be a valid audio device name (you can list them with the GetAudioDeviceList call)
immediate - 0: default (after the “changeaudiodevimmediate” parameter), 1: next call only, 2: immediately for active calls
Returns:
true on success, false on failure

GetCallerID

public java.lang.String GetCallerID()
Query the peer Caller ID. This is usually the remote party name, phone number, username or extension

Returns:
the caller-id

GetCallerID

public java.lang.String GetCallerID(int line)
Query the peer Caller ID. This is usually the remote party name, phone number, username or extension

Parameters:
line - channel number
Returns:
the caller-id

GetCallerID

public java.lang.String GetCallerID(int line,
                                    int type)
Deprecated. 

Query the remote party name.

Parameters:
line - channel number
Returns:
the remote party name

GetLineDetails

public java.lang.String GetLineDetails(int line)
Get details about a line. The line parameter can be -1 (will return the “best” line status).

Parameters:
line - channel number
Returns:
LINEDETAILS,line,state,callid,remoteusername,localusername,type,localaddress,serveraddress,mute,hold,remotefullname

HiddenLine

public int HiddenLine()
Query hiddel endpoint channel. Hidden calls are usually the result of barge-in calls.

Returns:
hidden line number or 0/minus value if no hidden call is in progress.

CredentialsChanged

public boolean CredentialsChanged(java.lang.String newserver,
                                  java.lang.String newusername)
Deprecated. 

Notify the sipstack abut credentials change.


NoUnregister

public void NoUnregister()
Signal that no unregistration is needed. For example you might call this before to stop the SIP stack if you don't wish that the server to be notified.


GetDeviceID

public java.lang.String GetDeviceID()
Get device identifier.

Returns:
unique device ID

GetPushNotifications

public int GetPushNotifications()
Simplified query for push notification state if push was initited befere with the SetPushNotifications API.

Returns:
0=disabled, 1=enabled unknown, 2=success, 3=failed

GetPushNotificationsEx

public int GetPushNotificationsEx(boolean thissessiononly)
Query the push notification state if push was initited befere with the SetPushNotifications API. Simplified return values: 0: disabled, -1,1,2,3,22: enabled (unknow status), 12,13: success, 23: failed

Returns:
-1=auto default,0=disabled,1=enabled auto,2=enabled direct,3=enabled via gateway,12=set direct, 13=set via gateay (auto changed from 1 to 2 by the sip stack),22=failed via direct server (temporary failure, might try via gateway)23=failed all (final failure)

SetPushNotifications

public boolean SetPushNotifications(int pushnotifications,
                                    java.lang.String clientid,
                                    java.lang.String packagename,
                                    java.lang.String gateway)
Call this function if you wish the SIP stack to manage push notifications, useful especially when used with the mizu server or MPUSH gateway. Should be called after API_Start. Never before API_Start. It can be called also at runtime if needed.

Parameters:
pushnotifications - -1=auto guess, 0=disabled, 1=enabled auto, 2=enabled direct,3=enabled via gateway
clientid - token received from FCM
packagename - your app package name to be used for push notification. If empty then it will readed from your app context. If using mizu push gateway then leave it empty or set to "com.mizuvoip.mizudroid.app"
gateway - address of the gateway if you wish to use a gateway for push notifications
Returns:
true on success, false on failure

GetGUtilityObj

public GUtility GetGUtilityObj()