webphone
Class webphone


public class webphone

JVoIP SIP Stack public interface. This webphone class contains the available API functions.

Home page: https://www.mizu-voip.com/Software/SIPSDK/JavaSIPSDK.aspx
Documentation:
    PDF: https://www.mizu-voip.com/Portals/0/Files/JVoIP.pdf
    CHM: https://www.mizu-voip.com/Portals/0/Files/JVoIP.chm
    HTML: https://www.mizu-voip.com/Portals/0/Files/documentation/jvoip/index.html
Example code: https://www.mizu-voip.com/Portals/0/Files/JVoIPTest.java

We recommend to use the documentation as a reference as it is much better structured and more up to date.
Also the parameters are not listed here. See the documentation for the complete list of available settings ("Parameters" chapter).


Constructor Summary
webphone()
          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 will only create an empty phone instances.
 
Method Summary
 booleanAPI_Accept()
          Connect incoming call.
 booleanAPI_Accept(int line)
          Connect incoming call on the specified line.
 booleanAPI_Accept(int line, int calltype)
          Connect incoming call.
 booleanAPI_Accept(int line, int calltype, int strict)
          Connect incoming call.
 booleanAPI_Accept(int line, int calltype, int audiodirection, int videodirection)
          Connect incoming call.
 booleanAPI_Accept(int line, int calltype, int strict, int audiodirection, int videodirection)
          Connect incoming call.
 booleanAPI_AddContact(java.lang.String params)
          Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.
 booleanAPI_AddLog(int level, java.lang.String text)
          Add to sip stack log.
 booleanAPI_AddLog(java.lang.String text)
          Add to sip stack log.
 booleanAPI_AddToBlacklist(java.lang.String str)
          Add user to blacklist
 booleanAPI_AddToWhitelist(java.lang.String str)
          Add user to whitelist
 booleanAPI_AddVideo()
          Add video media for an existing voice call.
 booleanAPI_AddVideo(int line, int type, int direction)
          Add video media for an existing voice call.
Can be also used as video reload if it was put on hold before.
 booleanAPI_AudioDevice()
          Open audio device selector dialog (built-in user interface).
This function will not work with the headless version (the headless is for library/SDK or command line usage and it doesn’t have any built-in GUI).
 booleanAPI_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: usually 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)
 booleanAPI_Call(int line, java.lang.String peer, int type)
          Initiate call to a number or sip username.
If the number parameter is empty, then will redial the last number.
Note: usually 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)
 booleanAPI_Call(int line, java.lang.String peer, int type, int audiodirection, int videodirection)
          Initiate call to a number or sip username.
If the number parameter is empty, then will redial the last number.
Note: usually 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)
 booleanAPI_Call(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: usually 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)
 intAPI_CallIDToLine(java.lang.String callid)
          Get the line number for a SIP Call-ID.
 booleanAPI_CapabilityRequest()
          Will send an OPTION request to the server.
 booleanAPI_CapabilityRequest(java.lang.String server, java.lang.String username)
          Request server or server capabilities with SIP OPTIONS.
Rarely needed if any.
 booleanAPI_Chat(java.lang.String peer)
          Instead of calling the API_SendChat function and pass a message, with this function you can let the voip client to open its built-in chat form.
Will open the chat dialog (the “number” parameter can be empty)
Peer can be a SIP username or extension number.
This function will not work with the headless version (the headless is for library or command line usage and it doesn’t have any built-in GUI).
 booleanAPI_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).
User(s) passed by the userlist parameters will be added to the existing blfuserlist.
 voidAPI_CheckConnection()
          Verify connection state and reregister if required.
Should be called from app activated and screen turned on events for the quickest possible reregistration if previous registration failed (for example due to dosing or OS paused)
 booleanAPI_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.
 booleanAPI_CheckVoicemail()
          Will (re)subscribe for voicemail notifications.
 booleanAPI_CheckVoicemail(int line)
          Will (re)subscribe for voicemail notifications.
 booleanAPI_ClearCredentials()
          Clear existing user account details.
 booleanAPI_Conf(java.lang.String number)
          Create conference call by adding number to the current call.
 booleanAPI_ConfEx(int line, java.lang.String number, boolean add, int confline)
          Add/remove people to/from conference.
 booleanAPI_DelContact(java.lang.String name)
          Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.
 booleanAPI_DelSettings(int level)
          Delete settings and data.
 booleanAPI_DisableBLF(java.lang.String userlist)
          Remove extension(s) from BLF watch list (blfuserlist).
Note: existing BLF subscriptions might not be affected until next session.
 booleanAPI_Dtmf(int line, java.lang.String dtmf)
          Send DTMF message by In-Band,SIP INFO or RFC2833 method (depending on the “dtmfmode” parameter).
 booleanAPI_ED137PTT(int line, int ptt, int pttid)
          ED-137 Push to talk
 voidAPI_Exit()
          Will destroy the SIP stack.
 voidAPI_ExitEx()
          Will destroy the SIP stack and also will exit the Java Virtial Machine.
Should not be used.
 booleanAPI_Forward(int line, java.lang.String peer)
          Forward incoming call to peer (with 302 Moved Temporarily disconnect code)
 intAPI_GetAccountRegState(java.lang.String domain, java.lang.String proxy, java.lang.String username, java.lang.String sipusername, boolean pushnotify, boolean strict)
          Query account register state.
 java.lang.StringAPI_GetAccountRegStateString(java.lang.String domain, java.lang.String proxy, java.lang.String username, java.lang.String sipusername, boolean pushnotify, boolean strict)
          Query account register state.
 java.lang.StringAPI_GetAddress()
          Query local address.
 java.lang.StringAPI_GetAltWorkdir()
          Query the application alternative working directory (such as folder on external SD card).
 java.lang.StringAPI_GetAudioDevice(int dev)
          Query the current audio device name.
 java.lang.StringAPI_GetAudioDeviceList(int dev)
          Query the list of available audio devices.
Note: usually you don’t need to use this function.
 java.lang.StringAPI_GetBindir()
          Query the application path (folder with the app binaries or app home folder)
 java.lang.StringAPI_GetBlacklist()
          Query the current blacklist
 intAPI_GetBuildNumber()
          Get the BUILDNUMBER
 java.lang.StringAPI_GetCallerID()
          Query the peer Caller ID.
 java.lang.StringAPI_GetCallerID(int line)
          Query the peer Caller ID.
 java.lang.StringAPI_GetConfigHash()
          Get a has value of the configuration.
Should not be used.
 java.lang.StringAPI_GetContact(java.lang.String name)
          Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.
 java.lang.StringAPI_GetContactName(java.lang.String name)
          Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.
 java.lang.StringAPI_GetContactPhone(java.lang.String name)
          Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.
 java.lang.StringAPI_GetContactPresence(java.lang.String name)
          Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.
 java.lang.StringAPI_GetContactPresenceStr(java.lang.String name)
          Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.
 java.lang.StringAPI_GetContacts()
          Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.
 java.lang.StringAPI_GetContactSIP(java.lang.String name)
          Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.
 java.lang.StringAPI_GetContactSpeedDial(java.lang.String name)
          Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.
 intAPI_GetCurrentConnectedCallCount()
          Query the number of simultaneous calls currently in progress.
 java.lang.StringAPI_GetDeviceID()
          Get device identifier.
 java.lang.StringAPI_GetDiscReasonText(java.lang.String line)
          Query the disconnect reason of the last disconnected call.
 intAPI_GetExeVersion()
          Get the SDK version
 java.lang.StringAPI_GetGlobalStatus()
          Helper function to ask for the SIP stack state/details.
 java.lang.StringAPI_GetIncomingDisplay(int line)
          Get incoming caller id (might return two lines: caller id \n caller name)
 intAPI_GetIncomingVideoEndpoint(int line)
          Return line number of the incoming video call if any, otherwise -1.
 java.lang.StringAPI_GetLastCallDetails()
          Get details about the last finished call.
 java.lang.StringAPI_GetLastRecFileName()
          Query recently recorded file.
 java.lang.StringAPI_GetLastRecInvite()
          Get last received INVITE message.
 java.lang.StringAPI_GetLastRecSIPMessage(java.lang.String line)
          Get last received SIP message.
 java.lang.StringAPI_GetLastSentInvite()
          Get last sent INVITE message.
 intAPI_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).
 java.lang.StringAPI_GetLineDetails(int line)
          Get details about a line.
 java.lang.StringAPI_GetLineParameter(int line, java.lang.String param)
          Get line specific parameter for a specific current/next/all line.
 intAPI_GetLineStatus(int line)
          Query the state of a line.
Note: this is rarely needed since you receive the status also by event notifications
 java.lang.StringAPI_GetLineStatusText(int line)
          Query the state of a line.
Note: this is rarely needed since you receive the status also by event notifications
 java.lang.StringAPI_GetLogPath()
          Query the application log file path.
 java.lang.StringAPI_GetMAC()
          Get the device MAC address if possible.
Some devices will forbid access to MAC address
 byte[]API_GetMedia(int timeout)
           
 java.lang.StringAPI_GetMySIPURI(boolean all)
          Get the SIP URI on which the current endpoint can be reached such as username@server.com or username@localip:port.
 SIPNotificationAPI_GetNotification()
          Return the next notification object.
 java.lang.StringAPI_GetNotificationStrings()
          Return the notification strings.
 java.lang.StringAPI_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.
 java.lang.StringAPI_GetPresenceStatus()
          Query local presence state.
 java.lang.StringAPI_GetProfileStatusText(java.lang.String username)
          Get the profile status text for this user.
 java.lang.StringAPI_GetRegFailReason()
          Query the reason of the last failed registration.
 java.lang.StringAPI_GetRegFailReason(boolean extended)
          Query the reason of the last failed registration.
 java.lang.StringAPI_GetSDPField(int line, java.lang.String field)
           
 java.lang.StringAPI_GetSIPHeader(int line, java.lang.String hdr)
          Return a sip header value received by JVoIP.
 java.lang.StringAPI_GetSIPMessage(int line, int dir, int type)
          Return the last received or sent SIP signaling message as raw text.
 java.lang.StringAPI_GetStatus(int line)
          Returns line state or global state if you pass -2 as line parameter
 java.lang.StringAPI_GetStatus(int line, int strict)
          Returns line state or global state if you pass -2 as line parameter
 intAPI_GetStatusId(int line)
          Returns line state or global state id.
Should not be used (use the API_GetStatus instead)
 java.lang.StringAPI_GetVersion()
          Get the SIP stack version number.
 java.lang.StringAPI_GetVideoDevice()
          Query the video device in use.
 java.lang.StringAPI_GetVideoDeviceList()
          Query video recording devices.
 java.lang.StringAPI_GetVideoDeviceList(int async, boolean strict)
          Query video recording devices.
 intAPI_GetVideoEndpoint(int line)
          Return line number for the video call if any, otherwise -1.
 java.lang.StringAPI_GetVideoRTPAddrForPlayback()
          Return the rtsp socket address.
 intAPI_GetVolume(int dev, int line)
          Get Volume level
 java.lang.StringAPI_GetWhitelist()
          Query the current whitelist
 java.lang.StringAPI_GetWorkdir()
          Query the application working directory (data folder) Based on appcontext.getFilesDir().getPath() and Environment.getDataDirectory().getPath();
 booleanAPI_Hangup()
          Disconnect call.
 booleanAPI_Hangup(int line)
          Disconnect current call(s).
 booleanAPI_Hangup(int line, java.lang.String reason)
          Disconnect current call(s).
 booleanAPI_HasCallInProgress()
          Query of there is any call in progress (including calls in ringing or connected state).
 booleanAPI_HasCallInSpeaking()
          Query of there is any connected call.
 intAPI_HiddenLine()
          Query hiddel endpoint channel.
Hidden calls are usually the result of barge-in calls.
 booleanAPI_Hold()
          Put call on hold.
 booleanAPI_Hold(int line)
          Put call on hold.
 booleanAPI_Hold(int line, boolean hold)
          Put call on hold.
 booleanAPI_Hold(int line, int direction)
          Put call on hold.
 booleanAPI_Hold(int line, int direction, int media)
          Put call on hold.
 booleanAPI_HoldChange(int line)
          Togle hold state of the call.
 booleanAPI_HoldEx(int line, int direction, int media)
          Put call on hold.
 java.lang.StringAPI_HTTPGet(java.lang.String uri)
          Send a HTTP GET request.
 booleanAPI_HTTPPost(java.lang.String uri, java.lang.String data)
          Send a HTTP POST request.
 java.lang.StringAPI_HTTPReq(java.lang.String uri, java.lang.String data)
          Send a HTTP POST or GET request.
 booleanAPI_HTTPReqAsync(java.lang.String uri, java.lang.String data)
          Send a HTTP POST or GET request.
 booleanAPI_Ignore(int line)
          Ignore incoming call.
 booleanAPI_Info(int line, java.lang.String msg)
          Send custom INFO message (for DTMF use the API_Dtmf function instead).
 intAPI_IsEncrypted()
          Check if the connection is encrypted.
 intAPI_IsInCall()
          Query of there is any call in progress.
 booleanAPI_IsIncomingVideo()
          Check if current incoming call is video call.
 intAPI_IsMuted(int line)
          Return if the selected line is muted or not.
 intAPI_IsOnHold(int line)
          Query if the selected line is on hold or not
 booleanAPI_IsOnline()
          Query online state.
This is not the same with the register state (It can return true even if not registered)
 booleanAPI_IsRegistered()
          Get the registered state.
 intAPI_IsRegisteredEx()
          Get the extended registered state.
 booleanAPI_IsSpeaking()
          Query of there is any connected call.
 java.lang.StringAPI_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.
 java.lang.StringAPI_LoadFile(java.lang.String filename)
          Load file content from local disk.
 booleanAPI_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.
 java.lang.StringAPI_LoadFileRemoteSync(java.lang.String filename)
          Will download the specified file from remote storage synchronously (will block until done or fails).
 booleanAPI_MightStop()
          You might call this functions if your app might terminate soon.
This will just make sure that the internal SIP stack settings are properly saved and the sipstack is prepared for an unexpected termination.
Note: this function will NOT unregister or stop the SIP stack, because in some circumstances it might be better to let the app running in the background until possible to still listen for incoming calls.
 booleanAPI_Mute(int line, boolean mute)
          Mute current call.
 booleanAPI_Mute(int line, boolean mute, int what)
          Mute current call.
Same as the Mute API.
 booleanAPI_NATKeepAlive(java.lang.String server)
          Rarely needed if any, because the siptack will do it automatically.
 booleanAPI_NeedRatingRequest()
          Some servers might report call rating automatically in signaling.
 booleanAPI_NewUser(java.lang.String user)
          On newuser, you should ask the user if wish to accept it.
 booleanAPI_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.
 booleanAPI_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.
 SIPNotificationAPI_ParseNotification(java.lang.String notificationstring)
          Helper function to convert notification String to SIPNotification object
 booleanAPI_PlaySound(int start, java.lang.String file, int loop, boolean async, boolean localfile, boolean toremotepeer, int line, java.lang.String audiodevice, boolean isring)
          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.
 SIPNotificationAPI_PollNotification()
          Return the next notification object if any.
 java.lang.StringAPI_PollNotificationStrings()
          Return the notification strings.
 booleanAPI_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
 booleanAPI_RecFiles_Clear()
          Delete old recorded files.
 booleanAPI_RecFiles_Del()
          Delete local recorded files.
 java.lang.StringAPI_RecFiles_List()
          List pending voice record files.
 booleanAPI_RecFiles_Upload()
          Upload pending recorded files (if ftp/http URI was set)
 booleanAPI_Register()
          Set parameters for authentication and register to the SIP server.
Will connect to the SIP server.
 booleanAPI_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.
 booleanAPI_Registered()
          Get the registered state.
 booleanAPI_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.
 booleanAPI_Reject(int line)
          Reject incoming call.
You could also use the Hangup API function for this.
 booleanAPI_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.
 booleanAPI_ReStart()
          Will restart the SIP stack.
 booleanAPI_RTPHeaderExtension(int line, int profile, int extension)
          Set RTP header extension for the RTP packets
 java.lang.StringAPI_RTPStat(int line)
          Query for media quality reports.
 booleanAPI_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)
 booleanAPI_SaveFileRaw(java.lang.String filename, java.lang.String content)
          Will save the text file to local disk in the working directory as is.
 booleanAPI_SaveFileRemote(java.lang.String filename, java.lang.String content)
          Save file to remote storage (preconfigured ftp or http server )
 booleanAPI_SendChat(int line, java.lang.String number, java.lang.String message)
          Send a instant message.
 booleanAPI_SendChat(int line, java.lang.String number, java.lang.String group, java.lang.String message, int msgid)
          Group messaging.
 booleanAPI_SendChatIsComposing(int line, java.lang.String number)
          Send IM typing notification.
 booleanAPI_SendSIP(java.lang.String msg)
          Send custom SIP signaling message (for example OPTIONS, NOTIFY, etc) on the current active line.
 booleanAPI_SendSIPMessage(int line, java.lang.String msg, java.lang.String body, java.lang.String account, java.lang.String target)
          Send custom SIP signaling message.
 booleanAPI_SendSMS(int line, java.lang.String number, java.lang.String message, int msgid)
          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.
 booleanAPI_SendUSSD(int line, java.lang.String method, java.lang.String ussd)
          Send USSD message (After the IMS 3GPP TS 24.390 standard)
 booleanAPI_SendVideoRTP(int line, byte[] buffer, int length)
          Stream video to remote peer by passing video RTP packets with this function
 booleanAPI_SetAudioDevice(int dev, java.lang.String devicename)
          Select an audio device.
 booleanAPI_SetAudioDevice(int dev, java.lang.String devicename, int immediate)
          Select an audio device.
 booleanAPI_SetBlacklist(java.lang.String str)
          Set whole blacklist.
 booleanAPI_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.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.
 booleanAPI_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.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.
 booleanAPI_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.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.
 booleanAPI_SetContacts(java.lang.String contacts)
          Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.
 booleanAPI_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.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.
 booleanAPI_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.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.
 booleanAPI_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.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.
 booleanAPI_SetCredentials(java.lang.String server, java.lang.String username, java.lang.String password)
          Set parameters for authentication.
 booleanAPI_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.
 booleanAPI_SetCredentialsMD5(java.lang.String server, java.lang.String username, java.lang.String md5, java.lang.String realm)
          Set parameters for authentication.
 booleanAPI_SetLine(int line)
          Will set the current channel.
Use only if you present line selection for the users.
 booleanAPI_SetLineEx(java.lang.String line)
          Will set the current channel.
Use only if you present line selection for the users.
 booleanAPI_SetLineParameter(int line, java.lang.String param, java.lang.String value, int permanent)
          Set parameter for a specific current/next/all line.
 booleanAPI_SetLogLevel(int level)
          Set loglevel at runtime.
 booleanAPI_SetNotificationListener(SIPNotificationListener listener)
          Subscribe to notification events
 booleanAPI_SetParameter(java.lang.String param, boolean value)
          Configure the SIP stack by passing any parameter.
 booleanAPI_SetParameter(java.lang.String param, int value)
          Configure the SIP stack by passing any parameter.
 booleanAPI_SetParameter(java.lang.String param, long value)
          Configure the SIP stack by passing any parameter.
 booleanAPI_SetParameter(java.lang.String param, java.lang.String value)
          Configure the SIP stack by passing any parameter.
 booleanAPI_SetParameters(java.lang.String parameters)
          Configure the SIP stack with a list of parameters.
 booleanAPI_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.
 booleanAPI_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).
 booleanAPI_SetSpeakerMode(boolean loud)
          Set speaker mode,
 booleanAPI_SetSSLContext(javax.net.ssl.SSLContext sc)
          Set custom SSLContext for new TLS connections.
 booleanAPI_SetUUI(int line, java.lang.String value, int fortarget)
          Set a custom UUI (User-to-User Call Control Information as described in RFC 7433).
 booleanAPI_SetVideoDevice(java.lang.String devicename)
          Set the video input device.
 booleanAPI_SetVolume(int dev, int volume)
           
 booleanAPI_SetVolume(int dev, int volume, int line)
          Set volume for the selected device.
 booleanAPI_SetWhitelist(java.lang.String str)
          Set whole whitelist.
Only these peers will be allowed.
 intAPI_ShouldReset()
          Check if the sipstack should be restarted.
 booleanAPI_ShouldResetBeforeCall()
          This function might be called before calls and you should quickly restart the sipstack if returns true (the continue to make the call).
 booleanAPI_ShowLog()
          Show a new window with logs.
 booleanAPI_SO(java.lang.String peer, boolean on, java.lang.String server, java.lang.String body)
          Avaya Service Observing (barge in)
https://downloads.avaya.com/elmodocs2/merlin/r1_5/html/features/service%20observing/1.htm
Send a Service Observing PUBLISH request.
This is a non-standard proprietary method, which might be compatible only with Avaya systems.
 booleanAPI_Start()
          Will start the SIP engine.
This has to be called only if you use JVoIP as and SDK or as a java voip library.
 booleanAPI_StartRing(int line)
          Will start local ringtone.
Rarely needed if any.
 booleanAPI_StartStack()
          This function call is optional to start the sip stack on demand.
If not called, then the sip stack is started anyway if the startsipstack parameter is set, otherwise will start at first registration or outgoing call attempt.
 voidAPI_Stop(boolean fast)
          Will stop the SIP stack.
 voidAPI_Stop(int fast)
          Will stop the SIP stack.
 booleanAPI_StopRing(int line)
          Will stop pending ring tone.
Rarely needed if any.
 booleanAPI_StopVideo()
          Remove the video stream
 booleanAPI_StopVideo(int line, int direction)
          Remove the video stream at the specified line
Can be also used as an alternative for video hold
 booleanAPI_StreamSoundBuff(int start, int line, byte[] buff, int len)
          Audio streaming from buffer.
 booleanAPI_StreamSoundStream(int start, int line, java.io.InputStream inputstream)
          Audio streaming from InputStream.
 booleanAPI_Test()
          Test API availability.
 java.lang.StringAPI_TestEcho(java.lang.String echo)
          Test API availability.
 booleanAPI_Transfer(int line, java.lang.String number, int calltype)
          Transfer current call to peer which is usually a phone number or a SIP username.
 booleanAPI_TransferDialog()
          Show the call transfer input box.
 booleanAPI_Unregister()
          Will stop all endpoints (hangup current calls if any and unregister)
 booleanAPI_Unregister(int waitfor)
          Will stop all endpoints (hangup current calls if any and unregister)
 booleanAPI_Unsubscribe()
          You might use the API_UnSubscribe() API to unsubscribe all endpoints (this includes presence, voicemail and BLF subscribes).
 java.lang.StringAPI_VAD()
          Query for global voice activity statistics.
 java.lang.StringAPI_VAD(int line)
          Query line for received voice activity statistics.
 booleanAPI_VideoPreview(int line, int type)
          Launch local video preview
 booleanAPI_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.
 booleanAPI_VoiceRecord(int startstop, int now, java.lang.String filename, int line)
          Will start/stop a voice recording session.
Same as the API_VoiceRecord above but with an extra line parameter which you can use to record call only for a specific line.
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.
 booleanAPI_WaitFor()
          Wait max 3 seconds for sipstack to finish after Stop
Should not be used.
 booleanAPI_WaitFor(int maxmsec)
          Wait for sipstack to finish after Stop
Should not be used.
 

Constructor Detail

webphone

public webphone()
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 will only create an emty phone instances. The real initialization is performed by the API_Start function.
 

Method Detail

API_GetAddress

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

Returns:
local SIP listener address (IP:port)

API_SetCredentialsMD5

public boolean API_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

API_GetLastRecFileName

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

Returns:
the last recorded file name.

API_Test

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

Returns:
true if API working, otherwise false

API_TestEcho

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

Parameters:
echo - any string
Returns:
echo

API_SetParameters

public boolean API_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

API_GetParameter

public java.lang.String API_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 as string (you might convert it to int/long/boolean after your needs)

API_SetParameter

public boolean API_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

API_SetParameter

public boolean API_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

API_SetParameter

public boolean API_SetParameter(java.lang.String param,
                                long 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

API_SetParameter

public boolean API_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

API_SetCredentials

public boolean API_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

API_SetCredentials

public boolean API_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

API_SetCredentials

public boolean API_SetCredentials()
Deprecated. 

Apply the crendential parameters.

Returns:
true on success, false on failure

API_DelSettings

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

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

API_GetConfigHash

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

Returns:
hash string

API_IsEncrypted

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

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

API_GetWorkdir

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

Returns:
path

API_GetAltWorkdir

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

Returns:
path

API_GetLogPath

public java.lang.String API_GetLogPath()
Query the application log file path. This is usually the workdir + webphonelog.dat

Returns:
path

API_RecFiles_Del

public boolean API_RecFiles_Del()
Delete local recorded files.

Returns:
true on success, false on failure

API_RecFiles_Clear

public boolean API_RecFiles_Clear()
Delete old recorded files.

Returns:
true on success, false on failure

API_RecFiles_List

public java.lang.String API_RecFiles_List()
List pending voice record files.

Returns:
file names separated by comma

API_RecFiles_Upload

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

Returns:
true on success, false on failure

API_GetBindir

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

Returns:
path

API_IsOnline

public boolean API_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).

API_RTPStat

public java.lang.String API_RTPStat(int line)
Query for media quality reports. See the RTPSTAT notification for more details.
Note: if you call this function, RTPSTAT will not be sent automatically anymore after the rtpstat setting.

Parameters:
line - channel number
Returns:
media quality statistics

API_VAD

public java.lang.String API_VAD()
Query for global 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: VAD,local_vad: ON local_avg: 0 local_max: 0 local_speaking: no remote_vad: ON remote_avg: 0 remote_max: 0 remote_speaking: no

API_VAD

public java.lang.String API_VAD(int line)
Query line for received 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).

Parameters:
line - channel number
Returns:
voice activity statistics: VAD,line: X remote_vad: ON remote_avg: 0 remote_max: 0 remote_speaking: no

API_IsInCall

public int API_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

API_IsSpeaking

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

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

API_IsRegistered

public boolean API_IsRegistered()
Get the registered state.

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

API_Registered

public boolean API_Registered()
Get the registered state.

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

API_IsRegisteredEx

public int API_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)

API_GetRegFailReason

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

Returns:
reason text of the last failed registered attempt

API_GetAccountRegState

public int API_GetAccountRegState(java.lang.String domain,
                                  java.lang.String proxy,
                                  java.lang.String username,
                                  java.lang.String sipusername,
                                  boolean pushnotify,
                                  boolean strict)
Query account register state. Useful if you are using multiple accounts.

Returns:
-1: no such account register ep, 0: working, 1: success, 2: failed, 3: unregistered

API_GetAccountRegStateString

public java.lang.String API_GetAccountRegStateString(java.lang.String domain,
                                                     java.lang.String proxy,
                                                     java.lang.String username,
                                                     java.lang.String sipusername,
                                                     boolean pushnotify,
                                                     boolean strict)
Query account register state. Useful if you are using multiple accounts.

Returns:
status text (for example "Registered" if the account is registered to the server)

API_GetGlobalStatus

public java.lang.String API_GetGlobalStatus()
Helper function to ask for the SIP stack state/details.

Returns:
SIP stack details

API_GetRegFailReason

public java.lang.String API_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

API_GetCurrentConnectedCallCount

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

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

API_SaveFile

public boolean API_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

API_SaveFileRaw

public boolean API_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

API_LoadFile

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

Parameters:
filename - file path
Returns:
text file content

API_SaveFileRemote

public boolean API_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

API_LoadFileRemote

public boolean API_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

API_LoadFileRemoteSync

public java.lang.String API_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

API_NeedRatingRequest

public boolean API_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.

API_HTTPGet

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

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

API_HTTPPost

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

Returns:
true on success, false on failure

API_HTTPReq

public java.lang.String API_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”.

API_HTTPReqAsync

public boolean API_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

API_ShouldReset

public int API_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

API_ShouldResetBeforeCall

public boolean API_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

API_CheckConnection

public void API_CheckConnection()
Verify connection state and reregister if required.
Should be called from app activated and screen turned on events for the quickest possible reregistration if previous registration failed (for example due to dosing or OS paused)


API_Register

public boolean API_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)

API_StartStack

public boolean API_StartStack()
This function call is optional to start the sip stack on demand.
If not called, then the sip stack is started anyway if the startsipstack parameter is set, otherwise will start at first registration or outgoing call attempt.

Returns:
true on success, false on failure

API_Start

public boolean API_Start()
Will start the SIP engine.
This has to be called only if you use JVoIP as and SDK or as a java voip library. Don’t call it from JavaScript. Will start the engine.
The autostart behavior can be altered with the startsipstack setting.

Returns:
true on success, false on failure

API_ReStart

public boolean API_ReStart()
Will restart the SIP stack.

Returns:
true on success, false on failure

API_Register

public boolean API_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)

API_RegisterEx

public boolean API_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)

API_GetVersion

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

Returns:
version string

API_GetExeVersion

public int API_GetExeVersion()
Get the SDK version

Returns:
MAPPVERSION

API_GetBuildNumber

public int API_GetBuildNumber()
Get the BUILDNUMBER

Returns:
BUILDNUMBER

API_GuiStarted

public java.lang.String API_GuiStarted()
Test API

Returns:
string

API_ClearCredentials

public boolean API_ClearCredentials()
Clear existing user account details.

Returns:
true on success, false on failure

API_Unregister

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

Returns:
true on success, false on failure

API_Unregister

public boolean API_Unregister(int waitfor)
Will stop all endpoints (hangup current calls if any and unregister)

Parameters:
waitfor - -1 (auto), 0 (do not wait) or 1 (wait for unregister to complete before to return).
Returns:
true on success, false on failure

API_Exit

public void API_Exit()
Will destroy the SIP stack. Usually should not be used. Stop all endpoints and terminates the java sip application. This function call is optional when you unload the JVoIP java module or wish to issue a forced termination. Its behavior can be controlled by the “exitmethod” parameter.


API_ExitEx

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


API_CapabilityRequest

public boolean API_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

API_CapabilityRequest

public boolean API_CapabilityRequest()
Will send an OPTION request to the server. Usually you should not use this function.
The server parameter can be empty if you already set it with other API calls or by parameter.
The username parameter can be empty (in this case the “From” address will be set to “unknown”)

Returns:
true on success, false on failure

API_SendSIPMessage

public boolean API_SendSIPMessage(int line,
                                  java.lang.String msg,
                                  java.lang.String body,
                                  java.lang.String account,
                                  java.lang.String target)
Send custom SIP signaling message.

Parameters:
line - endpoint where the message will be sent. -3: new endpoint, -2: all endpoints, -1: current active, 0: register endpoint, 1+: call channel number
msg - SIP message to send. It can be just the method name (OPTIONS,MESSAGE,NOTIFY,INVITE,etc), the full message header or the full message including also a body (such as SDP)
body - optional SIP message body (such as SDP, xml payload or chat text, etc). It might be set if for the msg you just pass the method name. Set to "null" if body must not be sent.
account - optional SIP account details if you wish to use other parameters then the configured one. same format like the extraregisteraccounts parameter
target - optional target username, number of SIP URI if not specified in the msg
Returns:
true on success, false on failure

API_SO

public boolean API_SO(java.lang.String peer,
                      boolean on,
                      java.lang.String server,
                      java.lang.String body)
Avaya Service Observing (barge in)
https://downloads.avaya.com/elmodocs2/merlin/r1_5/html/features/service%20observing/1.htm
Send a Service Observing PUBLISH request.
This is a non-standard proprietary method, which might be compatible only with Avaya systems.

Parameters:
peer - the extension, username or phone number of the peer to be “observed”
on - set to true to turn on the Service Observing feature or false to turn it off
server - set this only if the request have to be sent to another server (not the configured one). same format like the extraregisteraccounts parameter (you can specify only the server address).
body - custom message body. Might be useful if the default implementation doesn’t fulfill your needs. In this case you can send any custom body (usually an xml) Example: API_SO("111", true, "serveraddress", "");

API_SendSIP

public boolean API_SendSIP(java.lang.String msg)
Send custom SIP signaling message (for example OPTIONS, NOTIFY, etc) on the current active line.

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

API_GetSIPHeader

public java.lang.String API_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

API_GetSIPHeaderInternal

public java.lang.String API_GetSIPHeaderInternal(int line,
                                                 java.lang.String hdr)

API_GetSDPField

public java.lang.String API_GetSDPField(int line,
                                        java.lang.String field)

API_GetSIPMessage

public java.lang.String API_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

API_SetLineParameter

public boolean API_SetLineParameter(int line,
                                    java.lang.String param,
                                    java.lang.String value,
                                    int permanent)
Set parameter for a specific current/next/all line.

Parameters:
line - channel number. If -2 then it will be set as global config like the API_SetParameter. If -1 then for the active line. If 0, then it will be applied for all next/new channel(s). Otherwise it will be applied for the specific line.
param - parameter name (setting key name)
value - param value as string (or "NULL" to clear any old preset)
permanent - param if 1 then the setting will be kept for all future lines with the same line number, if 0 then the setting will be applied only for the current or very next channel with the same line
Returns:
true on success, false on failure Note: remove line setting by passing "NULL" as the value. Remove all settings for all lines by passing 0 for the line and empty or NULL for both the key and the value.

API_GetLineParameter

public java.lang.String API_GetLineParameter(int line,
                                             java.lang.String param)
Get line specific parameter for a specific current/next/all line.

Parameters:
line - channel number. If -2 then it will get the global config like the API_GetParameter. If -1 then for the active line. If 0, then it will get for all next/new channel(s). Otherwise it read from the the specific line.
param - parameter name (setting key name)
Returns:
value as string

API_SetSIPHeader

public boolean API_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

API_RTPHeaderExtension

public boolean API_RTPHeaderExtension(int line,
                                      int profile,
                                      int extension)
Set RTP header extension for the RTP packets

Parameters:
line - channel number
profile - profile number
extension - bytes to send as string or int
Returns:
true if send initialized successfully or false on failure. Received RTP header extension can be seen from the RTPE notifications.

API_ED137PTT

public boolean API_ED137PTT(int line,
                            int ptt,
                            int pttid)
ED-137 Push to talk

Parameters:
line - channel number
ptt - (0: off (not speaking), 1: on (Normal PTT ON), 2: Coupling PTT ON, 3: Priority PTT ON, 4: Emergency PTT ON)
pttid - optional PTT-ID (otherwise if default / -1 is passed then it will be loaded from global config)
Returns:
true if send initiated successfully or false on failure.

API_SetUUI

public boolean API_SetUUI(int line,
                          java.lang.String value,
                          int fortarget)
Set a custom UUI (User-to-User Call Control Information as described in RFC 7433).

Parameters:
line - channel number
value - UUI data (can include also parameters. Example: 56a390f3d2b7310023a2;encoding=hex;purpose=foo;content=bar
fortarget - specify if the UUI have to be sent to target party with call transfer or redirect. 0: no (to peer with the User-to-User header), 1: yes (to target escaped in Contact or Refer-To URI), 2: both
Returns:
true on success, false on failure

API_NATKeepAlive

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

Parameters:
server - target server addresss

API_LineToCallID

public java.lang.String API_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

API_CallIDToLine

public int API_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

API_SetLine

public boolean API_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

API_SetLineEx

public boolean API_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

API_GetLine

public int API_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

API_GetLineStatus

public int API_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

API_GetLineStatusText

public java.lang.String API_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

API_Call

public boolean API_Call(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: usually 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:
number - peer, 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)

API_Call

public boolean API_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: usually 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 - peer, 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)

API_Call

public boolean API_Call(int line,
                        java.lang.String peer,
                        int type)
Initiate call to a number or sip username.
If the number parameter is empty, then will redial the last number.
Note: usually 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
peer - destinationnumber, SIP username or SIP URI to call
type - call type: -1: auto/default, 0: audio, 1: video, 2: screen-sharing
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)

API_Call

public boolean API_Call(int line,
                        java.lang.String peer,
                        int type,
                        int audiodirection,
                        int videodirection)
Initiate call to a number or sip username.
If the number parameter is empty, then will redial the last number.
Note: usually 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
peer - destinationnumber, SIP username or SIP URI to call
type - call type: -1: auto/default, 0: audio, 1: video, 2: screen-sharing
audiodirection - initial hold state for audio: -1: inactive, 0: send only, 1: receive only, 2: both way (default)
videodirection - initial hold state for video: -1: inactive, 0: send only, 1: receive only, 2: both way (default)
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)

API_GetVideoDeviceList

public java.lang.String API_GetVideoDeviceList()
Query video recording devices.

Returns:
list of installed camera devices or empty string if none are found

API_GetVideoDeviceList

public java.lang.String API_GetVideoDeviceList(int async,
                                               boolean strict)
Query video recording devices.

Parameters:
async - optional parameter: 2: immediately never blocking, 1: returns immediately only if already cached, 0: always blocking reload
strict - ptional parameter: false: might failback to old cached result, true: it will return empty string if can’t list the video input devices
Returns:
list of installed camera devices or empty string if none are found

API_GetVideoDevice

public java.lang.String API_GetVideoDevice()
Query the video device in use.

Returns:
selected video input device name if any (camera/webcam device name)

API_SetVideoDevice

public boolean API_SetVideoDevice(java.lang.String devicename)
Set the video input device.

Parameters:
devicename - camera/webcam device name. Set to "Default" to try using the default device.
Returns:
true on success or false on failure

API_GetVideoRTPAddrForPlayback

public java.lang.String API_GetVideoRTPAddrForPlayback()
Return the rtsp socket address. For old/android only.


API_SendVideoRTP

public boolean API_SendVideoRTP(int line,
                                byte[] buffer,
                                int length)
Stream video to remote peer by passing video RTP packets with this function

Parameters:
line - channel number
buffer - video RTP data
length - buffer size
Returns:
true on success, false on failure

API_VideoPreview

public boolean API_VideoPreview(int line,
                                int type)
Launch local video preview

Parameters:
line - optional channel number. default is -1. 3 means to be launched separately
type - optinal video_preview type
Returns:
disconnect reason text

API_AddVideo

public boolean API_AddVideo()
Add video media for an existing voice call.

Returns:
true on success, false on failure

API_AddVideo

public boolean API_AddVideo(int line,
                            int type,
                            int direction)
Add video media for an existing voice call.
Can be also used as video reload if it was put on hold before.

Parameters:
line - channel number
type - call-type: 1: add video 2: add screen-sharing
direction - set hold state: -1: inactive, 0: sendonly, 1: recvonly, 2: both
Returns:
true on success, false on failure

API_StopVideo

public boolean API_StopVideo()
Remove the video stream

Returns:
true on success, false on failure

API_StopVideo

public boolean API_StopVideo(int line,
                             int direction)
Remove the video stream at the specified line
Can be also used as an alternative for video hold

Parameters:
line - channel number
direction - 0: stop send, stop receive, 2: stop both way
Returns:
true on success, false on failure (Success doesn't mean call connected here)

API_Hangup

public boolean API_Hangup()
Disconnect call.

Returns:
true on success, false on failure

API_Hangup

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

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

API_Hangup

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

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

API_GetLastCallDetails

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

Returns:
call details

API_GetProfileStatusText

public java.lang.String API_GetProfileStatusText(java.lang.String username)
Get the profile status text for this user.

Returns:
profile status text

API_GetMySIPURI

public java.lang.String API_GetMySIPURI(boolean all)
Get the SIP URI on which the current endpoint can be reached such as username@server.com or username@localip:port.

Parameters:
all - if set to true, then it will return all possible URI’s separated by comma. Otherwise it will return single main URI
Returns:
main URI or multiple possible URI separated by comma

API_SetSSLContext

public boolean API_SetSSLContext(javax.net.ssl.SSLContext sc)
Set custom SSLContext for new TLS connections.

Parameters:
sc - SSLContext object prepared by you
Returns:
true on success, false on failure

API_GetIncomingDisplay

public java.lang.String API_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

API_Accept

public boolean API_Accept()
Connect incoming call.

Returns:
true on success, false on failure (Success doesn't mean call connected here)

API_Accept

public boolean API_Accept(int line)
Connect incoming call on the specified line.

Parameters:
line - channel number
Returns:
true on success, false on failure (Success doesn't mean call connected here)

API_Accept

public boolean API_Accept(int line,
                          int calltype)
Connect incoming call.

Parameters:
line - channel number
calltype - -1: default, 0: audio only, 1: with video, 2: force video
Returns:
true on success, false on failure (Success doesn't mean call connected here)

API_Accept

public boolean API_Accept(int line,
                          int calltype,
                          int audiodirection,
                          int videodirection)
Connect incoming call.

Parameters:
line - channel number
calltype - specify call type: -1: default, 0: audio only, 1: with video, 2: force video
audiodirection - audio hold state: -1: inactive, 0: sendonly, 1: recvonly, 2: both (defult)
videodirection - video hold state: -1: inactive, 0: sendonly, 1: recvonly, 2: both (defult)
Returns:
true on success, false on failure (Success doesn't mean call connected here)

API_Accept

public boolean API_Accept(int line,
                          int calltype,
                          int strict)
Connect incoming call.

Parameters:
line - channel number
calltype - specify call type: -1: default, 0: audio only, 1: with video, 2: force video
strict - set to 1 to strictly treat the line parameter. otherwise might auto guess the best line if incorrect
Returns:
true on success, false on failure (Success doesn't mean call connected here)

API_Accept

public boolean API_Accept(int line,
                          int calltype,
                          int strict,
                          int audiodirection,
                          int videodirection)
Connect incoming call.

Parameters:
line - channel number
calltype - specify call type: -1: default, 0: audio only, 1: with video, 2: force video
strict - set to 1 to strictly treat the line parameter. otherwise might auto guess the best line if incorrect
audiodirection - audio hold state: -1: inactive, 0: sendonly, 1: recvonly, 2: both (defult)
videodirection - video hold state: -1: inactive, 0: sendonly, 1: recvonly, 2: both (defult)
Returns:
true on success, false on failure (Success doesn't mean call connected here)

API_AcceptStrict

public boolean API_AcceptStrict(int line)
Deprecated. by API_Accept strict parameter

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

API_Ignore

public boolean API_Ignore(int line)
Ignore incoming call.

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

API_Forward

public boolean API_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

API_Reject

public boolean API_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

API_RejectEx

public boolean API_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

API_IsIncomingVideo

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

Returns:
true if video call, false if audio call

API_GetIncomingVideoEndpoint

public int API_GetIncomingVideoEndpoint(int line)
Return line number of the incoming video call if any, otherwise -1.

Parameters:
line - preferred channel number
Returns:
line number with video call or -1 if no video call found

API_GetVideoEndpoint

public int API_GetVideoEndpoint(int line)
Return line number for the video call if any, otherwise -1.

Parameters:
line - preferred channel number
Returns:
line number with video call or -1 if no video call found

API_GetLastRecInvite

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

Returns:
message text

API_GetLastSentInvite

public java.lang.String API_GetLastSentInvite()
Get last sent INVITE message.

Returns:
message text

API_AddLog

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

Parameters:
text - log text
Returns:
true on success, false on failure

API_AddLog

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

Parameters:
level - log level
text - log text
Returns:
true on success, false on failure

API_GetLastRecSIPMessage

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

Parameters:
line - channel number
Returns:
message text

API_GetDiscReasonText

public java.lang.String API_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

API_TransferDialog

public boolean API_TransferDialog()
Show the call transfer input box.

Returns:
true on success, false on failure

API_PushContactlist

public boolean API_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

API_SetBlacklist

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

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

API_GetBlacklist

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

Returns:
blacklisted users serparated by comma

API_AddToBlacklist

public boolean API_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

API_SetWhitelist

public boolean API_SetWhitelist(java.lang.String str)
Set whole whitelist.
Only these peers will be allowed.

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

API_GetWhitelist

public java.lang.String API_GetWhitelist()
Query the current whitelist

Returns:
blacklisted users serparated by comma

API_AddToWhitelist

public boolean API_AddToWhitelist(java.lang.String str)
Add user to whitelist

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

API_NumExists

public boolean API_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

API_GetPresenceStatus

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

Returns:
presence text

API_SetPresenceStatus

public boolean API_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

API_NewUser

public boolean API_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

API_Unsubscribe

public boolean API_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

API_CheckPresence

public boolean API_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

API_CheckBLF

public boolean API_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).
User(s) passed by the userlist parameters will be added to the existing blfuserlist.

Parameters:
userlist - users/extensions/phone numbers separated by comma (it can be a single entry)
Returns:
true on success, false on failure

API_DisableBLF

public boolean API_DisableBLF(java.lang.String userlist)
Remove extension(s) from BLF watch list (blfuserlist).
Note: existing BLF subscriptions might not be affected until next session.

Parameters:
userlist - users/extensions/phone numbers separated by comma (it can be a single entry)
Returns:
true on success, false on failure

API_SetContact

public boolean API_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.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.


API_SetContactPhone

public boolean API_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.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.


API_SetContactSIP

public boolean API_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.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.


API_SetContactName

public boolean API_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.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.


API_SetContactSpeedDial

public boolean API_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.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.


API_SetContactStatus

public boolean API_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.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.


API_GetContactPhone

public java.lang.String API_GetContactPhone(java.lang.String name)
Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.


API_GetContactSIP

public java.lang.String API_GetContactSIP(java.lang.String name)
Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.


API_GetContactName

public java.lang.String API_GetContactName(java.lang.String name)
Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.


API_GetContactSpeedDial

public java.lang.String API_GetContactSpeedDial(java.lang.String name)
Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.


API_AddContact

public boolean API_AddContact(java.lang.String params)
Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.


API_DelContact

public boolean API_DelContact(java.lang.String name)
Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.


API_GetContact

public java.lang.String API_GetContact(java.lang.String name)
Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.


API_GetContactPresence

public java.lang.String API_GetContactPresence(java.lang.String name)
Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.


API_GetContactPresenceStr

public java.lang.String API_GetContactPresenceStr(java.lang.String name)
Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.


API_SetContacts

public boolean API_SetContacts(java.lang.String contacts)
Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.


API_GetContacts

public java.lang.String API_GetContacts()
Helper function for contact manipulation in case if you wish contact management to be handled by the SIP stack.
If necessary then you might manage the contacts by implementing your own contacts module after your needs instead of using this contact management API.


API_Conf

public boolean API_Conf(java.lang.String number)
Create conference call by adding number to the current call.

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

API_ConfEx

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

Parameters:
line - channel number (to be created/added or removed)
number - destination number, username or SIP URI
add - set to true to add this number or false to remove
confline - existing line in conference in which this new conference party will be added
Returns:
true on success, false on failure

API_Transfer

public boolean API_Transfer(int line,
                            java.lang.String number,
                            int calltype)
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)
calltype - -1: auto guess, 0: audio only, 1: audio + video, 2: screen sharing
Returns:
true on success, false on failure

API_Mute

public boolean API_Mute(int line,
                        boolean mute)
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.
Returns:
true on success, false on failure

API_Mute

public boolean API_Mute(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

API_IsMuted

public int API_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)

API_IsOnHold

public int API_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

API_Hold

public boolean API_Hold(int line,
                        boolean hold)
Put call on hold. This will trigger an UPDATE or a reINVITE request.

Parameters:
line - channel number.
hold - true for hold and false to reload. If true, then it will hold the call as specified by the holdtypeonhold parameter.
Returns:
true on success, false on failure

API_HoldEx

public boolean API_HoldEx(int line,
                          int direction,
                          int media)
Put call on hold. This will trigger an UPDATE or a reINVITE request.

Parameters:
line - channel number (-3 means for next INVITE/OK)
direction - hold direction: -2: no hold change, -1: default (holdtypeonhold), 0: unhold, 1: mute instead of hold (not recommended. use API_Mute instead), 2: send only (mute playback. JVoIP will send a=sendonly), 3: receive only (mute recording. JVoIP will send a=recvonly),4: both in hold (inactive)
media - 0: audio, 1: video, 2: both (default)
Returns:
true on success, false on failure

API_Hold

public boolean API_Hold(int line,
                        int direction)
Put call on hold. This will trigger an UPDATE or a reINVITE request.

Parameters:
line - channel number (-3 means for next INVITE/OK)
direction - hold direction: -2: no hold change, -1: default (holdtypeonhold), 0: unhold, 1: mute instead of hold (not recommended. use API_Mute instead), 2: send only (mute playback. JVoIP will send a=sendonly), 3: receive only (mute recording. JVoIP will send a=recvonly),4: both in hold (inactive)
Returns:
true on success, false on failure

API_Hold

public boolean API_Hold(int line)
Put call on hold. This will trigger an UPDATE or a reINVITE request.

Parameters:
line - channel number (-3 means for next INVITE/OK)
Returns:
true on success, false on failure

API_Hold

public boolean API_Hold()
Put call on hold. This will trigger an UPDATE or a reINVITE request.

Returns:
true on success, false on failure

API_Hold

public boolean API_Hold(int line,
                        int direction,
                        int media)
Put call on hold. This will set the hold state of the endpoint and might trigger an UPDATE or a reINVITE request.

Parameters:
line - channel number. If -3 then it will be applied for the next action.
direction - -1: default (holdtypeonhold), 0=unhold,2=hold (mute microphone. this: sendonly, peer: recvonly),3=other party hold (mute speaker. this: recvonly, peer: sendonly),4=both in hold
media - 0=audio, 1=video, 2=both
Returns:
true on success, false on failure

API_HoldChange

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

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

API_Dtmf

public boolean API_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

API_Info

public boolean API_Info(int line,
                        java.lang.String msg)
Send custom INFO message (for DTMF use the API_Dtmf function instead).

Parameters:
line - channel number
msg - message to send
Returns:
true on success, false on failure

API_SendChat

public boolean API_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

API_SendSMS

public boolean API_SendSMS(int line,
                           java.lang.String number,
                           java.lang.String message,
                           int msgid)
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)
msgid - optional id to be reported by the CHATREPORT (can be used the match the message)
Returns:
true on success, false on failure

API_SendChat

public boolean API_SendChat(int line,
                            java.lang.String number,
                            java.lang.String group,
                            java.lang.String message,
                            int msgid)
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)
msgid - optional id to be reported by the CHATREPORT (can be used the match the message)
Returns:
true on success, false on failure

API_SendUSSD

public boolean API_SendUSSD(int line,
                            java.lang.String method,
                            java.lang.String ussd)
Send USSD message (After the IMS 3GPP TS 24.390 standard)

Parameters:
line - channel number
method - INVITE, INFO, BYE (if INVITE, then a new session will be created. otherwise will use the session suggested by the line parameter)
ussd - the USSD string or the whole XML
Returns:
true if send initialized successfully or false on failure. Further feedback about the actual delivery can be obtained from the USSD notifications.

API_SendChatIsComposing

public boolean API_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

API_CheckVoicemail

public boolean API_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

API_CheckVoicemail

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

Returns:
true on success, false on failure

API_Record

public boolean API_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

API_Chat

public boolean API_Chat(java.lang.String peer)
Instead of calling the API_SendChat function and pass a message, with this function you can let the voip client to open its built-in chat form.
Will open the chat dialog (the “number” parameter can be empty)
Peer can be a SIP username or extension number.
This function will not work with the headless version (the headless is for library or command line usage and it doesn’t have any built-in GUI).

Returns:
true on success, false on failure

API_VoiceRecord

public boolean API_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

API_VoiceRecord

public boolean API_VoiceRecord(int startstop,
                               int now,
                               java.lang.String filename,
                               int line)
Will start/stop a voice recording session.
Same as the API_VoiceRecord above but with an extra line parameter which you can use to record call only for a specific line.
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, 3 start to record both locally and to remote, 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)
line - set to -2 for all or other to specify current line
Returns:
true on success, false on failure

API_AudioDevice

public boolean API_AudioDevice()
Open audio device selector dialog (built-in user interface).
This function will not work with the headless version (the headless is for library/SDK or command line usage and it doesn’t have any built-in GUI).

Returns:
true on success, false on failure

API_GetMAC

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

Returns:
MAC address if successfully loaded

API_GetAudioDeviceList

public java.lang.String API_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.

API_SetAudioDevice

public boolean API_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

API_GetAudioDevice

public java.lang.String API_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

API_SetAudioDevice

public boolean API_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

API_SetVolume

public boolean API_SetVolume(int dev,
                             int volume,
                             int line)
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%)
line - optional channel number
Returns:
true on success, false on failure

API_GetVolume

public int API_GetVolume(int dev,
                         int line)
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.

API_SetVolumeIn

public boolean API_SetVolumeIn(int val)
Deprecated. 

Set volume in. Deprecated Use the SetVolume API instead

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

API_SetVolumeOut

public boolean API_SetVolumeOut(int val)
Deprecated. 

Set volume out. Deprecated Use the SetVolume API instead

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

API_HasCallInProgress

public boolean API_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.

API_HasCallInSpeaking

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

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

API_SetLogLevel

public boolean API_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

API_ShowLog

public boolean API_ShowLog()
Show a new window with logs.

Returns:
true on success, false on fail

API_SetNotificationListener

public boolean API_SetNotificationListener(SIPNotificationListener listener)
Subscribe to notification events

Returns:
true on success or false on error (an error will be returned only if the SIP stack is not initiated yet)

API_GetNotification

public SIPNotification API_GetNotification()
Return the next notification object. You should call this function 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 ",NEOL \r\n").

API_PollNotification

public SIPNotification API_PollNotification()
Return the next notification object if any. You should poll for the notifications periodically.
Will return immediatly (with null if no new notifications)

Returns:
notification object or null

API_GetNotificationStrings

public java.lang.String API_GetNotificationStrings()
Return the notification strings. You should call this function 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).

API_PollNotificationStrings

public java.lang.String API_PollNotificationStrings()
Return the notification strings. You should poll for the notifications periodically.
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 ",NEOL \r\n").

API_ParseNotification

public SIPNotification API_ParseNotification(java.lang.String notificationstring)
Helper function to convert notification String to SIPNotification object

Returns:
the SIPNotification object

API_GetMedia

public byte[] API_GetMedia(int timeout)
	Get RTP stream.
	Will return the next media (audio or video) packet as a byte buffer from the JVoIP internal queue. 

                Parameters:

        timeout - specified in milliseconds. If it is higher then 0, then JVoIP will use an additional waiting lock. If 0 then will issue a simple/fast blocking read.
 		Returns:
		byte buffer on success, null on failure

API_GetMediaEnd

public boolean API_GetMediaEnd()
	You might call this function if you don't need the media stream anymore (if you will not use the API_GetMedia anymore)

API_GetCallerID

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

Returns:
the caller-id

API_GetCallerID

public java.lang.String API_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

API_GetLineDetails

public java.lang.String API_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

API_GetCallerID

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

Query the remote party name.

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

API_HiddenLine

public int API_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.

API_GetStatus

public java.lang.String API_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.

API_GetStatusId

public int API_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

API_GetStatus

public java.lang.String API_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.

API_SetSpeakerMode

public boolean API_SetSpeakerMode(boolean loud)
Set speaker mode,

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

API_MightStop

public boolean API_MightStop()
You might call this functions if your app might terminate soon.
This will just make sure that the internal SIP stack settings are properly saved and the sipstack is prepared for an unexpected termination.
Note: this function will NOT unregister or stop the SIP stack, because in some circumstances it might be better to let the app running in the background until possible to still listen for incoming calls.


API_WaitFor

public boolean API_WaitFor()
Wait max 3 seconds for sipstack to finish after Stop
Should not be used.


API_WaitFor

public boolean API_WaitFor(int maxmsec)
Wait for sipstack to finish after Stop
Should not be used.


API_NoUnregister

public boolean API_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.


API_GetDeviceID

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

Returns:
unique device ID

API_Stop

public void API_Stop(boolean fast)
Will stop the SIP stack.


API_Stop

public void API_Stop(int fast)
Will stop the SIP stack.

Parameters:
fast - set to false if you can't wait a bit for graceful shutdown, or set to true for immediate shutdown.

API_StopRing

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

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

API_StartRing

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

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

API_PlaySound

public boolean API_PlaySound(int start,
                             java.lang.String file,
                             int loop,
                             boolean async,
                             boolean localfile,
                             boolean toremotepeer,
                             int line,
                             java.lang.String audiodevice,
                             boolean isring)
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

API_StreamSoundStream

public boolean API_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

API_StreamSoundBuff

public boolean API_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
len - audio data size in bytes
Returns:
true on success, false on failure