61extern const char *envPhoneLinphonerc;
63extern int envPhoneSipPort;
65extern const char *envPhoneAudioDriver;
66extern const char *envPhoneAudioDevice;
67extern const char *envPhoneAudioInDevice;
68extern const char *envPhoneAudioOutDevice;
69extern float envPhoneAudioInGain;
70extern float envPhoneAudioOutGain;
71extern const char *envPhoneAudioCodec;
73extern int envPhoneEchoTail;
74extern int envPhoneEchoAlgo;
75extern int envPhoneEchoAggressiveness;
76extern bool envPhoneEchoNoiseSuppression;
78extern const char *envPhoneVideoDriver;
79extern const char *envPhoneVideoDevice;
80extern const char *envPhoneVideoCodec;
82extern const char *envPhoneRegister;
83extern const char *envPhoneSecret;
85extern const char *envPhoneRingbackFile;
86extern const char *envPhoneRingbackFileKey;
87extern float envPhoneRingbackLevel;
89extern int envPhoneRotation;
154 vf->planeY = vf->planeU = vf->
planeV = NULL;
155 vf->pitchY = vf->pitchU = vf->
pitchV = 0;
254 void Setup (
const char *agentName,
int _mediaSelected,
int withLogging,
275 bool Register (
const char *identity = NULL,
const char *secret = NULL);
356 EPhoneState GetIncomingCallAction () {
return incomingAction; }
368 void SelectMedia (
unsigned selected,
unsigned mask =
pmAll);
369 unsigned GetMediaSelected () {
return mediaSelected; }
371 void SetMicOn (
bool on) { SelectMedia (on ? pmOn : pmOff,
pmAudioIn); }
372 bool GetMicOn () {
return GetMediaSelected () &
pmAudioIn ? true :
false; }
373 void SetCamOn (
bool on) { SelectMedia (on ? pmOn : pmOff,
pmVideoIn); }
374 bool GetCamOn () {
return GetMediaSelected () &
pmVideoIn ? true :
false; }
391 virtual void OnPhoneStateChanged (
EPhoneState oldState);
392 void SetCbPhoneStateChanged (
void (*_cbPhoneStateChanged) (
void *,
EPhoneState),
void *data = NULL) { cbPhoneStateChanged = _cbPhoneStateChanged; cbPhoneStateChangedData = data; }
395 virtual void OnInfo (
const char *msg);
396 void SetCbInfo (
void (*_cbInfo) (
void *,
const char *),
void *data = NULL) { cbInfo = _cbInfo; cbInfoData = data; }
399 virtual void OnDtmfReceived (
char dtmf);
400 void SetCbDtmfReceived (
void (*_cbDtmfReceived) (
void *,
char),
void *data = NULL) { cbDtmfReceived = _cbDtmfReceived; cbDtmfReceivedData = data; }
440 void ReportInfo (
const char *fmt, ...);
441 void *GetLibData () {
return libData; }
442 const int GetLibDataSize () {
return sizeof (libData); }
453 void *cbPhoneStateChangedData, *cbInfoData, *cbDtmfReceivedData;
455 void (*cbInfo) (
void *,
const char *);
456 void (*cbDtmfReceived) (
void *, char);
462#define LIBDATA_SIZE 64
463 uint8_t libData [LIBDATA_SIZE];
TPhoneVideoFrame * VideoLockFrame(int streamId)
Lock the video stream and return info about the current picture.
bool AcceptCall()
Green button on the phone: Accept an incoming call.
void VideoUnlock()
Unlock the video stream.
bool SendDtmf(const char *dtmfSequence)
Send a sequence of DTMF characters.
void SetCbPhoneStateChanged(void(*_cbPhoneStateChanged)(void *, EPhoneState), void *data=NULL)
Callback on a phone state change; the second parameter is the previous state.
void SetIncomingCallAction(EPhoneState _incomingAction)
Set decision on what to do with an incoming call in form of a desired next state:
bool Hangup()
Red button on the phone: Cancel a call or a dialing process. If there is a paused call,...
bool CancelAllCalls()
Cancel all active calls, try to reach the idle state as soon as possible.
int GetCallDuration(int callId=0)
Get call duration in seconds.
void SetCbInfo(void(*_cbInfo)(void *, const char *), void *data=NULL)
Callback on the receipt of a new info message (should be displayed on the UI).
EPhoneState GetState()
Get current phone state.
void SetCbDtmfReceived(void(*_cbDtmfReceived)(void *, char), void *data=NULL)
Callback on the receipt of a DTMF character.
void Setup(const char *agentName, int _mediaSelected, int withLogging, const char *tmpDir)
Setup phone object.
void Iterate()
Iterate the backend and update the phone state; must be called regularly.
bool PrepareTransfer()
Pause (hold) the current call and set phone into the state 'psTransferIdle' to initiate an attended t...
bool Dial(const char *url)
Dial the number or URL.
bool CompleteTransfer()
Transfer the paused call to the active one (complete the transfer). If called when still dialing,...
bool Register(const char *identity=NULL, const char *secret=NULL)
Register phone with a registrar.
const char * GetPeerUrl(int callId=0)
Get the URL of the peer.
EPhoneState
Current phone state.
const char * StrPhoneVideoFormat(EPhoneVideoFormat x)
Get a readable string for the format.
EPhoneVideoFormat
Video frame pixel format. The values refer to the respective SDL pixel format types of a similar name...
static bool PhoneStateIsDevicePermitting(EPhoneState s)
Return whether the caller is allowed to use the media (audio/video) devices that may otherwise be occ...
@ psTransferIdle
Primary call is paused, UI may query a new number to transfer to.
@ psInCall
A call is active.
@ psRinging
This phone is ringing.
@ psTransferAutoComplete
Same as 'psTransferDialing', but on remote pickup the transfer will complete automatically.
@ psDialing
Phone is dialing, remote end may be ringing.
@ psNone
No state (e.g. phone not initialized).
@ psTransferDialing
Primary call is paused, a new call is in the dialing state.
@ psTransferInCall
Primary call is paused, secondary call is active; hanging up results in completing the transfer.
@ pmAudio
Microphone and Speaker.
@ pmVideo
Camera and Display.
Data structure to pass video frames to the UI.
int pitch
number of bytes between rows (for 'data != NULL')
bool changed
Set on change, reset on fetching.
uint8_t * planeV
color planes (Y, U, V) (for 'SDL_UpdateYUVTexture()')
uint8_t * data
Data, if all planes contiguous in memory (for 'SDL_UpdateTexture()')
int pitchV
number of bytes between rows (for 'SDL_UpdateYUVTexture()')
EPhoneVideoFormat format
Pixel format.