This is a documentation for Flashphoner version 1.0.5.973
We recommend you upgrade to the last version and check the actual documentation

Javascript API


Functions

Name Description
getParameters():object Return object of properties from flashphoner.xml file
login(username:String,password:String):int Login to flashphoner_server, returned 0 - if 'username' is success, 1 - if 'username' is wrong.
Format 'username': "sip:[email protected]"
loginWithToken(token:String):void
Login to flashphoner_server by token which use in http-provider
loginClick2Call():void Login to user with login from server by parameter of file flashphoner.properties from server side.
logoff():void
log off current user
getInfoAboutMe():ModelLocator
Get info about logged user (login,password,sipAddress,sipPort,visibleName)
sendMessage(to:String, body:String, contentType:String):void
Send instance message to user with login 'callee'
call(callee:String, visibleName:String, isVideoCall:Boolean = true):int Call to user with login 'callee',
Returned 0 - if 'callee' is success, 1 - if 'callee' is wrong.
Format 'callee': "sip:[email protected]" or sip login or phone number or null. if 'callee' is null then 'callee' equals parameter of file flashphoner.properties from server side.
hangup(callId:String):void Hangup current call
answer(callId:String, isVideoCall:Boolean = false):void
Answer on incomming call
sendDTMF(callId:String,dtmf:String):void
Send DTMF command
setStatusHold(callId:String,isHold:Boolean = true):void
Hold/Unhold for the call
transfer(callId:String,target:String):void
Transfer call  to the user with login 'target'
setSendVideo(isSend:Boolean):void
Start/Stop sending video
getMicVolume():int Get current microphone volume
setMicVolume(volume:int):void Set volume current microphone
getVolume():int
Get volume of current speaker
setVolume(volume:int):void
Set volume of current sreaker
isMuted():int
Check access to the microphone.
Return
0 - if microphone does no exist
-1 - if has access
1 - if has not access
getMicropones():Array Get array of names all microphones
setMicrophone(name:String):void{} Set new micropohne by name
getCameras():Array Get array of names all cameras
setCamera(name:String):void{} Set new camera by name
getCurrentCall():Call
Get current call in TALK state
setCookie(key:String,value:String):void Set cookie for save info
getCookie(key:String):String Get cookie for load info
getVersion():String Get version of client and server. Version of the server shows if user logged
Notify functions  
notifyCloseConnection():void Close connection server
notifyConnected():void Application connected to the server
notifyRegistered():void User registered on sip server
notifyCallbackHold(call:Call,isHold:Boolean):void
Callback for operation - setStatusHold(callId:String,isHold:Boolean = true):void
notify(call:Call):void Notify state of call
notifyCost(call:Call,cost:Number):void Notify cost of current call
notifyBalance(balance:Number):void Notify balance of user
notifyCall(call:Call):void Notify incoming call
_sipObject is sip-headers of request and response.
notifyError(error:String):void Notify error with error code
notifyVideoFormat(call:Call):void Notify video height and width of incomming and outgoing video
notifyMessage(messageObject:Object):void Notify of the new instance message
notifyAddCall(call:Call):void Notify add new call in array
notifyRemoveCall(call:Call):void Notify remove call from array
addLogMessage(message:String):void
Add log message (example: for warnings)
notifyVersion(version:String):void
Notify change version
notifyFlashReady():void Notify if swf file and flashphoner.xml loaded

Objects and properties

Call

Property Desription
id:String; Сall identifier
state:String; Call status (TALK,RING,HOLD...)
iHolded:Boolean = false; Is holded call
callee:String; User, which created call
caller:String; User, which answered call
visibleNameCallee:String; Visible name of callee
visibleNameCaller:String; Vilible name of caller
playerVideoHeight:int; Height of video in player
playerVideoWidth:int; Width of video in player
streamerVideoHeight:int; Height of video in streamer
streamerVideoWidth:int; Width of video in player
timeOfCall:int = 0; Current time of call
anotherSideUser:String; A user on the other side
incoming:Boolean = false; Is incoming call
isVideoCall:Boolean = false; Is video call

Constants

ErrorCodes

Name Description
AUTHENTICATION_FAIL Registration on sip-server is fail.
This is response from the server about
an unsuccessful registration under sent
username and password.
USER_NOT_AVAILABLE User not available in sip server
TOO_MANY_REGISTER_ATTEMPTS User with name many register
LICENSE_RESTRICTION License of flashphoner is not valid
INTERNAL_SIP_ERROR Unknown sip error
CONNECTION_ERROR Connection to the server fail
REGISTER_EXPIRE Registration on sip server is expired

Call states

Name Description
STATE_RING Start ring of call
STATE_TALK Talk command for send and rerceive audio and video
STATE_FINISH Finish of current call
STATE_BUSY Busy of current call
STATE_HOLD
Hold of current call

Labels

javascript_api javascript_api Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.