new liblinphonne multi call api
inband dtmf is pcm codec play dtmf on digit pressed
This commit is contained in:
parent
ccb588d880
commit
5138d4b506
12 changed files with 250 additions and 102 deletions
|
@ -6,3 +6,5 @@ endif
|
|||
APP_BUILD_SCRIPT:=$(call my-dir)/Android.mk
|
||||
APP_PLATFORM := android-3
|
||||
APP_ABI := armeabi armeabi-v7a
|
||||
#APP_OPTIM := debug
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,5 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="pref_escape_plus">Replace + by 00</string>
|
||||
<string name="pref_escape_plus_key">pref_escape_plus_key</string>
|
||||
<string name="pref_ilbc_summary">iLBC might be unavailable depending on ARM processor and Android OS version.</string>
|
||||
<string name="pref_echo_cancellation">Echo cancellation</string>
|
||||
<string name="pref_echo_cancellation_key">pref_echo_cancellation_key</string>
|
||||
|
|
|
@ -28,12 +28,13 @@
|
|||
<CheckBoxPreference android:title="@string/pref_handle_outcall" android:key="@string/pref_handle_outcall_key" android:summary="@string/pref_handle_outcall_summarry"></CheckBoxPreference><CheckBoxPreference android:key="@string/pref_echo_cancellation_key" android:title="@string/pref_echo_cancellation" android:summary="@string/pref_echo_cancellation_summary"></CheckBoxPreference><EditTextPreference android:title="@string/pref_prefix"
|
||||
android:key="@string/pref_prefix_key"></EditTextPreference>
|
||||
|
||||
<CheckBoxPreference android:key="@string/pref_debug_key"
|
||||
<CheckBoxPreference android:key="@string/pref_escape_plus_key" android:title="@string/pref_escape_plus"></CheckBoxPreference><CheckBoxPreference android:key="@string/pref_debug_key"
|
||||
android:title="@string/pref_debug" android:enabled="true"></CheckBoxPreference>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
|
|
@ -19,10 +19,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
package org.linphone;
|
||||
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreListener;
|
||||
import org.linphone.core.LinphoneCore.GeneralState;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.core.LinphoneCall.State;
|
||||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
|
@ -35,9 +38,11 @@ import android.os.Bundle;
|
|||
import android.os.PowerManager;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.View.OnLongClickListener;
|
||||
import android.view.View.OnTouchListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ImageButton;
|
||||
|
@ -95,7 +100,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
|||
*
|
||||
* @return null if not ready yet
|
||||
*/
|
||||
public static DialerActivity getDialer() {
|
||||
public static DialerActivity getDialer() {
|
||||
if (theDialer == null) {
|
||||
return null;
|
||||
} else {
|
||||
|
@ -118,7 +123,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
|||
try {
|
||||
|
||||
|
||||
mAddress = (TextView) findViewById(R.id.SipUri);
|
||||
mAddress = (TextView) findViewById(R.id.SipUri);
|
||||
mDisplayNameView = (TextView) findViewById(R.id.DisplayNameView);
|
||||
mErase = (Button)findViewById(R.id.Erase);
|
||||
|
||||
|
@ -145,14 +150,14 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
|||
});
|
||||
|
||||
mCall = (ImageButton) findViewById(R.id.Call);
|
||||
mCall.setOnClickListener(new OnClickListener() {
|
||||
mCall.setOnClickListener(new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
LinphoneCore lLinphoneCore = LinphoneService.instance().getLinphoneCore();
|
||||
if (lLinphoneCore.isInComingInvitePending()) {
|
||||
try {
|
||||
lLinphoneCore.acceptCall();
|
||||
lLinphoneCore.acceptCall(lLinphoneCore.getCurrentCall());
|
||||
} catch (LinphoneCoreException e) {
|
||||
lLinphoneCore.terminateCall();
|
||||
lLinphoneCore.terminateCall(lLinphoneCore.getCurrentCall());
|
||||
Toast toast = Toast.makeText(DialerActivity.this
|
||||
,String.format(getString(R.string.warning_wrong_destination_address),mAddress.getText().toString())
|
||||
, Toast.LENGTH_LONG);
|
||||
|
@ -160,7 +165,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
|||
}
|
||||
return;
|
||||
}
|
||||
if (mAddress.getText().length() >0) {
|
||||
if (mAddress.getText().length() >0) {
|
||||
newOutgoingCall(mAddress.getText().toString(),mDisplayName);
|
||||
}
|
||||
}
|
||||
|
@ -173,37 +178,14 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
|||
|
||||
public void onClick(View v) {
|
||||
LinphoneCore lLinphoneCore = LinphoneService.instance().getLinphoneCore();
|
||||
lLinphoneCore.terminateCall();
|
||||
lLinphoneCore.terminateCall(lLinphoneCore.getCurrentCall());
|
||||
}
|
||||
|
||||
};
|
||||
mHangup.setOnClickListener(lHangupListener);
|
||||
mDecline.setOnClickListener(lHangupListener);
|
||||
|
||||
class DialKeyListener implements OnClickListener {
|
||||
final String mKeyCode;
|
||||
final TextView mAddressView;
|
||||
DialKeyListener(TextView anAddress, char aKeyCode) {
|
||||
mKeyCode = String.valueOf(aKeyCode);
|
||||
mAddressView = anAddress;
|
||||
}
|
||||
public void onClick(View v) {
|
||||
LinphoneCore lc = LinphoneService.instance().getLinphoneCore();
|
||||
if (lc.isIncall()) {
|
||||
lc.sendDtmf(mKeyCode.charAt(0));
|
||||
} else {
|
||||
int lBegin = mAddressView.getSelectionStart();
|
||||
if (lBegin == -1) {
|
||||
lBegin = mAddressView.getEditableText().length();
|
||||
}
|
||||
if (lBegin >=0) {
|
||||
mAddressView.getEditableText().insert(lBegin,mKeyCode);
|
||||
}
|
||||
mDisplayName="";
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
mCallControlRow = (LinearLayout) findViewById(R.id.CallControlRow);
|
||||
mInCallControlRow = (TableRow) findViewById(R.id.IncallControlRow);
|
||||
mAddressLayout = (LinearLayout) findViewById(R.id.Addresslayout);
|
||||
|
@ -287,10 +269,11 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
|||
|
||||
mZero = (Button) findViewById(R.id.Button00) ;
|
||||
if (mZero != null) {
|
||||
|
||||
mZero.setOnClickListener(new DialKeyListener(mAddress,'0'));
|
||||
setDigitListener(mZero,'0');
|
||||
mZero.setOnLongClickListener(new OnLongClickListener() {
|
||||
public boolean onLongClick(View arg0) {
|
||||
LinphoneCore lc = LinphoneService.instance().getLinphoneCore();
|
||||
lc.stopDtmf();
|
||||
int lBegin = mAddress.getSelectionStart();
|
||||
if (lBegin == -1) {
|
||||
lBegin = mAddress.getEditableText().length();
|
||||
|
@ -303,27 +286,27 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
|||
|
||||
});
|
||||
mOne = (Button) findViewById(R.id.Button01) ;
|
||||
mOne.setOnClickListener(new DialKeyListener(mAddress,'1'));
|
||||
setDigitListener(mOne,'1');
|
||||
mTwo = (Button) findViewById(R.id.Button02);
|
||||
mTwo.setOnClickListener(new DialKeyListener(mAddress,'2'));
|
||||
setDigitListener(mTwo,'2');
|
||||
mThree = (Button) findViewById(R.id.Button03);
|
||||
mThree.setOnClickListener(new DialKeyListener(mAddress,'3'));
|
||||
setDigitListener(mThree,'3');
|
||||
mFour = (Button) findViewById(R.id.Button04);
|
||||
mFour.setOnClickListener(new DialKeyListener(mAddress,'4'));
|
||||
setDigitListener(mFour,'4');
|
||||
mFive = (Button) findViewById(R.id.Button05);
|
||||
mFive.setOnClickListener(new DialKeyListener(mAddress,'5'));
|
||||
setDigitListener(mFive,'5');
|
||||
mSix = (Button) findViewById(R.id.Button06);
|
||||
mSix.setOnClickListener(new DialKeyListener(mAddress,'6'));
|
||||
setDigitListener(mSix,'6');
|
||||
mSeven = (Button) findViewById(R.id.Button07);
|
||||
mSeven.setOnClickListener(new DialKeyListener(mAddress,'7'));
|
||||
setDigitListener(mSeven,'7');
|
||||
mEight = (Button) findViewById(R.id.Button08);
|
||||
mEight.setOnClickListener(new DialKeyListener(mAddress,'8'));
|
||||
setDigitListener(mEight,'8');
|
||||
mNine = (Button) findViewById(R.id.Button09);
|
||||
mNine.setOnClickListener(new DialKeyListener(mAddress,'9'));
|
||||
setDigitListener(mNine,'9');
|
||||
mStar = (Button) findViewById(R.id.ButtonStar);
|
||||
mStar.setOnClickListener(new DialKeyListener(mAddress,'*'));
|
||||
setDigitListener(mStar,'*');
|
||||
mHash = (Button) findViewById(R.id.ButtonHash);
|
||||
mHash.setOnClickListener(new DialKeyListener(mAddress,'#'));
|
||||
setDigitListener(mHash,'#');
|
||||
}
|
||||
|
||||
mStatus = (TextView) findViewById(R.id.status_label);
|
||||
|
@ -380,9 +363,9 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
|||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
public void generalState(LinphoneCore lc, GeneralState state, String message) {
|
||||
public void globalState(LinphoneCore lc, LinphoneCore.GlobalState state, String message) {
|
||||
|
||||
if (state == GeneralState.GSTATE_POWER_ON) {
|
||||
if (state == LinphoneCore.GlobalState.GlobalOn) {
|
||||
mCall.setEnabled(!lc.isIncall());
|
||||
mHangup.setEnabled(!mCall.isEnabled());
|
||||
try{
|
||||
|
@ -418,32 +401,30 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
|||
newOutgoingCall(getIntent().getData().toString().substring("tel://".length()));
|
||||
getIntent().setData(null);
|
||||
}
|
||||
} else if (state == GeneralState.GSTATE_REG_OK) {
|
||||
//nop
|
||||
} else if (state == GeneralState.GSTATE_CALL_OUT_INVITE) {
|
||||
}
|
||||
}
|
||||
public void registrationState(final LinphoneCore lc, final LinphoneProxyConfig cfg,final LinphoneCore.RegistrationState state,final String smessage) {/*nop*/};
|
||||
public void callState(final LinphoneCore lc,final LinphoneCall call, final State state, final String message) {
|
||||
if (state == LinphoneCall.State.OutgoingInit) {
|
||||
mWakeLock.acquire();
|
||||
enterIncalMode(lc);
|
||||
routeAudioToReceiver();
|
||||
} else if (state == GeneralState.GSTATE_CALL_IN_INVITE) {
|
||||
} else if (state == LinphoneCall.State.IncomingReceived) {
|
||||
callPending();
|
||||
} else if (state == GeneralState.GSTATE_CALL_IN_CONNECTED
|
||||
|| state == GeneralState.GSTATE_CALL_OUT_CONNECTED) {
|
||||
} else if (state == LinphoneCall.State.Connected) {
|
||||
enterIncalMode(lc);
|
||||
} else if (state == GeneralState.GSTATE_CALL_ERROR) {
|
||||
} else if (state == LinphoneCall.State.Error) {
|
||||
if (mWakeLock.isHeld()) mWakeLock.release();
|
||||
Toast toast = Toast.makeText(this
|
||||
,String.format(getString(R.string.call_error),message)
|
||||
, Toast.LENGTH_LONG);
|
||||
toast.show();
|
||||
exitCallMode();
|
||||
} else if (state == GeneralState.GSTATE_CALL_END) {
|
||||
} else if (state == LinphoneCall.State.CallEnd) {
|
||||
exitCallMode();
|
||||
}
|
||||
}
|
||||
public void inviteReceived(LinphoneCore lc, String from) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void show(LinphoneCore lc) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
@ -512,14 +493,14 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
|||
public void newOutgoingCall(String aTo) {
|
||||
newOutgoingCall(aTo,null);
|
||||
}
|
||||
public void newOutgoingCall(String aTo, String displayName) {
|
||||
public synchronized void newOutgoingCall(String aTo, String displayName) {
|
||||
String lto = aTo;
|
||||
if (aTo.contains(OutgoingCallReceiver.TAG)) {
|
||||
lto = aTo.replace(OutgoingCallReceiver.TAG, "");
|
||||
}
|
||||
mAddress.setText(lto);
|
||||
mDisplayName = displayName;
|
||||
LinphoneCore lLinphoneCore = LinphoneService.instance().getLinphoneCore();
|
||||
LinphoneCore lLinphoneCore = LinphoneService.instance().getLinphoneCore();
|
||||
if (lLinphoneCore.isIncall()) {
|
||||
Toast toast = Toast.makeText(DialerActivity.this, getString(R.string.warning_already_incall), Toast.LENGTH_LONG);
|
||||
toast.show();
|
||||
|
@ -546,4 +527,44 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
|||
return;
|
||||
}
|
||||
}
|
||||
private void setDigitListener(Button aButton,char dtmf) {
|
||||
class DialKeyListener implements OnClickListener ,OnTouchListener{
|
||||
final String mKeyCode;
|
||||
final TextView mAddressView;
|
||||
boolean mIsDtmfStarted=false;
|
||||
DialKeyListener(TextView anAddress, char aKeyCode) {
|
||||
mKeyCode = String.valueOf(aKeyCode);
|
||||
mAddressView = anAddress;
|
||||
}
|
||||
public void onClick(View v) {
|
||||
LinphoneCore lc = LinphoneService.instance().getLinphoneCore();
|
||||
lc.stopDtmf();
|
||||
mIsDtmfStarted=false;
|
||||
if (lc.isIncall()) {
|
||||
lc.sendDtmf(mKeyCode.charAt(0));
|
||||
} else {
|
||||
int lBegin = mAddressView.getSelectionStart();
|
||||
if (lBegin == -1) {
|
||||
lBegin = mAddressView.getEditableText().length();
|
||||
}
|
||||
if (lBegin >=0) {
|
||||
mAddressView.getEditableText().insert(lBegin,mKeyCode);
|
||||
}
|
||||
mDisplayName="";
|
||||
}
|
||||
}
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
if (mIsDtmfStarted ==false) {
|
||||
LinphoneCore lc = LinphoneService.instance().getLinphoneCore();
|
||||
lc.playDtmf(mKeyCode.charAt(0), -1);
|
||||
mIsDtmfStarted=true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
DialKeyListener lListener = new DialKeyListener(mAddress,dtmf);
|
||||
aButton.setOnClickListener(lListener);
|
||||
aButton.setOnTouchListener(lListener);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,13 +27,15 @@ import java.util.Timer;
|
|||
import java.util.TimerTask;
|
||||
|
||||
import org.linphone.core.LinphoneAuthInfo;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LinphoneCoreListener;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.core.PayloadType;
|
||||
import org.linphone.core.LinphoneCore.GeneralState;
|
||||
import org.linphone.core.LinphoneCall.State;
|
||||
import org.linphone.core.LinphoneCore.GlobalState;
|
||||
|
||||
|
||||
import android.app.Notification;
|
||||
|
@ -45,7 +47,6 @@ import android.content.Intent;
|
|||
import android.content.SharedPreferences;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.preference.PreferenceManager;
|
||||
|
@ -192,9 +193,9 @@ public class LinphoneService extends Service implements LinphoneCoreListener {
|
|||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
public void generalState(final LinphoneCore lc, final LinphoneCore.GeneralState state, final String message) {
|
||||
public void globalState(final LinphoneCore lc, final LinphoneCore.GlobalState state, final String message) {
|
||||
Log.i(TAG, "new state ["+state+"]");
|
||||
if (state == GeneralState.GSTATE_POWER_ON) {
|
||||
if (state == GlobalState.GlobalOn) {
|
||||
mNotification.iconLevel=IC_LEVEL_OFFLINE;
|
||||
mNotification.when=System.currentTimeMillis();
|
||||
mNotification.setLatestEventInfo(this
|
||||
|
@ -202,9 +203,19 @@ public class LinphoneService extends Service implements LinphoneCoreListener {
|
|||
,getString(R.string.notification_started)
|
||||
, mNofificationContentIntent);
|
||||
mNotificationManager.notify(NOTIFICATION_ID, mNotification);
|
||||
if (DialerActivity.getDialer()!=null) {
|
||||
mHandler.post(new Runnable() {
|
||||
public void run() {
|
||||
DialerActivity.getDialer().globalState(lc,state,message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
if (state == GeneralState.GSTATE_REG_OK && lc.getDefaultProxyConfig().isRegistered()) {
|
||||
}
|
||||
public void registrationState(final LinphoneCore lc, final LinphoneProxyConfig cfg,final LinphoneCore.RegistrationState state,final String smessage) {
|
||||
Log.i(TAG, "new state ["+state+"]");
|
||||
if (state == LinphoneCore.RegistrationState.RegistrationOk && lc.getDefaultProxyConfig().isRegistered()) {
|
||||
mNotification.iconLevel=IC_LEVEL_ORANGE;
|
||||
mNotification.when=System.currentTimeMillis();
|
||||
mNotification.setLatestEventInfo(this
|
||||
|
@ -213,7 +224,7 @@ public class LinphoneService extends Service implements LinphoneCoreListener {
|
|||
, mNofificationContentIntent);
|
||||
mNotificationManager.notify(NOTIFICATION_ID, mNotification);
|
||||
}
|
||||
if (state == GeneralState.GSTATE_REG_FAILED ) {
|
||||
if (state == LinphoneCore.RegistrationState.RegistrationFailed ) {
|
||||
mNotification.iconLevel=IC_LEVEL_OFFLINE;
|
||||
mNotification.when=System.currentTimeMillis();
|
||||
mNotification.setLatestEventInfo(this
|
||||
|
@ -222,25 +233,29 @@ public class LinphoneService extends Service implements LinphoneCoreListener {
|
|||
, mNofificationContentIntent);
|
||||
mNotificationManager.notify(NOTIFICATION_ID, mNotification);
|
||||
}
|
||||
|
||||
if (DialerActivity.getDialer()!=null) {
|
||||
mHandler.post(new Runnable() {
|
||||
public void run() {
|
||||
DialerActivity.getDialer().generalState(lc,state,message);
|
||||
DialerActivity.getDialer().registrationState(lc,cfg,state,smessage);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (state == GeneralState.GSTATE_CALL_IN_INVITE) {
|
||||
}
|
||||
public void callState(final LinphoneCore lc,final LinphoneCall call, final State state, final String message) {
|
||||
if (DialerActivity.getDialer()!=null) {
|
||||
mHandler.post(new Runnable() {
|
||||
public void run() {
|
||||
DialerActivity.getDialer().callState(lc,call,state,message);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (state == LinphoneCall.State.IncomingReceived) {
|
||||
//wakeup linphone
|
||||
Intent lIntent = new Intent();
|
||||
lIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
lIntent.setClass(this, LinphoneActivity.class);
|
||||
startActivity(lIntent);
|
||||
}
|
||||
}
|
||||
public void inviteReceived(LinphoneCore lc, String from) {
|
||||
|
||||
|
||||
}
|
||||
public void show(LinphoneCore lc) {
|
||||
// TODO Auto-generated method stub
|
||||
|
@ -353,7 +368,7 @@ public class LinphoneService extends Service implements LinphoneCoreListener {
|
|||
lDefaultProxyConfig.setDialPrefix(lPrefix);
|
||||
}
|
||||
//escape +
|
||||
lDefaultProxyConfig.setDialEscapePlus(true);
|
||||
lDefaultProxyConfig.setDialEscapePlus(mPref.getBoolean(getString(R.string.pref_escape_plus_key),false));
|
||||
//outbound proxy
|
||||
if (mPref.getBoolean(getString(R.string.pref_enable_outbound_proxy_key), false)) {
|
||||
lDefaultProxyConfig.setRoute(lProxy);
|
||||
|
@ -392,5 +407,6 @@ public class LinphoneService extends Service implements LinphoneCoreListener {
|
|||
theLinphone=null;
|
||||
mNotificationManager.cancel(NOTIFICATION_ID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
63
src/org/linphone/core/LinphoneCallImpl.java
Normal file
63
src/org/linphone/core/LinphoneCallImpl.java
Normal file
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
LinphoneCallImpl.java
|
||||
Copyright (C) 2010 Belledonne Communications, Grenoble, France
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
package org.linphone.core;
|
||||
|
||||
|
||||
class LinphoneCallImpl implements LinphoneCall {
|
||||
|
||||
protected final long nativePtr;
|
||||
boolean ownPtr = false;
|
||||
native private void ref(long ownPtr);
|
||||
native private void unref(long ownPtr);
|
||||
native private long getCallLog(long nativePtr);
|
||||
private native boolean isIncoming(long nativePtr);
|
||||
native private long getRemoteAddress(long nativePtr);
|
||||
native private int getState(long nativePtr);
|
||||
protected LinphoneCallImpl(long aNativePtr) {
|
||||
nativePtr = aNativePtr;
|
||||
ref(nativePtr);
|
||||
}
|
||||
protected void finalize() throws Throwable {
|
||||
unref(nativePtr);
|
||||
}
|
||||
public LinphoneCallLog getCallLog() {
|
||||
long lNativePtr = getCallLog(nativePtr);
|
||||
if (lNativePtr!=0) {
|
||||
return new LinphoneCallLogImpl(lNativePtr);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public CallDirection getDirection() {
|
||||
return isIncoming(nativePtr)?CallDirection.Incoming:CallDirection.Outgoing;
|
||||
}
|
||||
public LinphoneAddress getRemoteAddress() {
|
||||
long lNativePtr = getRemoteAddress(nativePtr);
|
||||
if (lNativePtr!=0) {
|
||||
return new LinphoneAddressImpl(lNativePtr);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public State getState() {
|
||||
return LinphoneCall.State.fromInt(getState(nativePtr));
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -38,12 +38,12 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
|
||||
private native void clearProxyConfigs(long nativePtr);
|
||||
private native void addAuthInfo(long nativePtr,long authInfoNativePtr);
|
||||
private native void invite(long nativePtr,String uri);
|
||||
private native void terminateCall(long nativePtr);
|
||||
private native long invite(long nativePtr,String uri);
|
||||
private native void terminateCall(long nativePtr, long call);
|
||||
private native long getRemoteAddress(long nativePtr);
|
||||
private native boolean isInCall(long nativePtr);
|
||||
private native boolean isInComingInvitePending(long nativePtr);
|
||||
private native void acceptCall(long nativePtr);
|
||||
private native void acceptCall(long nativePtr, long call);
|
||||
private native long getCallLog(long nativePtr,int position);
|
||||
private native int getNumberOfCallLogs(long nativePtr);
|
||||
private native void delete(long nativePtr);
|
||||
|
@ -52,7 +52,7 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
private native float getPlaybackGain(long nativeptr);
|
||||
private native void muteMic(long nativePtr,boolean isMuted);
|
||||
private native long interpretUrl(long nativePtr,String destination);
|
||||
private native void inviteAddress(long nativePtr,long to);
|
||||
private native long inviteAddress(long nativePtr,long to);
|
||||
private native void sendDtmf(long nativePtr,char dtmf);
|
||||
private native void clearCallLogs(long nativePtr);
|
||||
private native boolean isMicMuted(long nativePtr);
|
||||
|
@ -60,6 +60,9 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
private native int enablePayloadType(long nativePtr, long payloadType, boolean enable);
|
||||
private native void enableEchoCancellation(long nativePtr,boolean enable);
|
||||
private native boolean isEchoCancellationEnabled(long nativePtr);
|
||||
private native long getCurrentCall(long nativePtr) ;
|
||||
private native void playDtmf(long nativePtr,char dtmf,int duration);
|
||||
private native void stopDtmf(long nativePtr);
|
||||
|
||||
LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException {
|
||||
mListener=listener;
|
||||
|
@ -86,9 +89,14 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
}
|
||||
}
|
||||
|
||||
public synchronized void invite(String uri) {
|
||||
public synchronized LinphoneCall invite(String uri) {
|
||||
isValid();
|
||||
invite(nativePtr,uri);
|
||||
long lNativePtr = invite(nativePtr,uri);
|
||||
if (lNativePtr!=0) {
|
||||
return new LinphoneCallImpl(lNativePtr);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void iterate() {
|
||||
|
@ -115,9 +123,9 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
isValid();
|
||||
clearProxyConfigs(nativePtr);
|
||||
}
|
||||
public synchronized void terminateCall() {
|
||||
public synchronized void terminateCall(LinphoneCall aCall) {
|
||||
isValid();
|
||||
terminateCall(nativePtr);
|
||||
if (aCall!=null)terminateCall(nativePtr,((LinphoneCallImpl)aCall).nativePtr);
|
||||
}
|
||||
public synchronized LinphoneAddress getRemoteAddress() {
|
||||
isValid();
|
||||
|
@ -136,9 +144,9 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
isValid();
|
||||
return isInComingInvitePending(nativePtr);
|
||||
}
|
||||
public synchronized void acceptCall() {
|
||||
public synchronized void acceptCall(LinphoneCall aCall) {
|
||||
isValid();
|
||||
acceptCall(nativePtr);
|
||||
acceptCall(nativePtr,((LinphoneCallImpl)aCall).nativePtr);
|
||||
|
||||
}
|
||||
public synchronized Vector<LinphoneCallLog> getCallLogs() {
|
||||
|
@ -181,8 +189,13 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
throw new LinphoneCoreException("Cannot interpret ["+destination+"]");
|
||||
}
|
||||
}
|
||||
public void invite(LinphoneAddress to) {
|
||||
inviteAddress(nativePtr,((LinphoneAddressImpl)to).nativePtr);
|
||||
public LinphoneCall invite(LinphoneAddress to) {
|
||||
long lNativePtr = inviteAddress(nativePtr,((LinphoneAddressImpl)to).nativePtr);
|
||||
if (lNativePtr!=0) {
|
||||
return new LinphoneCallImpl(lNativePtr);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public void sendDtmf(char number) {
|
||||
sendDtmf(nativePtr,number);
|
||||
|
@ -219,4 +232,43 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
return isEchoCancellationEnabled(nativePtr);
|
||||
|
||||
}
|
||||
|
||||
public synchronized LinphoneCall getCurrentCall() {
|
||||
isValid();
|
||||
long lNativePtr = getCurrentCall(nativePtr);
|
||||
if (lNativePtr!=0) {
|
||||
return new LinphoneCallImpl(lNativePtr);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public int getPlayLevel() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
public void setPlayLevel(int level) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
public void setSignalingTransport(Transport aTransport) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
public void enableSpeaker(boolean value) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
public boolean isSpeakerEnabled() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
public void playDtmf(char number, int duration) {
|
||||
playDtmf(nativePtr,number, duration);
|
||||
|
||||
}
|
||||
public void stopDtmf() {
|
||||
stopDtmf(nativePtr);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
12
submodules/externals/build/exosip/Android.mk
vendored
12
submodules/externals/build/exosip/Android.mk
vendored
|
@ -9,7 +9,7 @@ LOCAL_PRELINK_MODULE := false
|
|||
|
||||
LOCAL_SRC_FILES = \
|
||||
src/eXosip.c \
|
||||
src/eXconf.c \ \
|
||||
src/eXconf.c \
|
||||
src/eXregister_api.c \
|
||||
src/eXcall_api.c \
|
||||
src/eXmessage_api.c \
|
||||
|
@ -24,9 +24,7 @@ LOCAL_SRC_FILES = \
|
|||
src/eXutils.c \
|
||||
src/jevents.c \
|
||||
src/misc.c \
|
||||
src/jauth.c \
|
||||
src/eXtransport.h \
|
||||
src/eXosip2.h
|
||||
src/jauth.c
|
||||
|
||||
LOCAL_SRC_FILES += \
|
||||
src/eXtl.c \
|
||||
|
@ -37,9 +35,7 @@ LOCAL_SRC_FILES += \
|
|||
|
||||
LOCAL_SRC_FILES += \
|
||||
src/milenage.c \
|
||||
src/rijndael.c \
|
||||
src/milenage.h \
|
||||
src/rijndael.h
|
||||
src/rijndael.c
|
||||
|
||||
# BUILD_MAXSIZE: -UMINISIZE
|
||||
LOCAL_SRC_FILES += \
|
||||
|
@ -50,9 +46,7 @@ LOCAL_SRC_FILES += \
|
|||
src/jnotify.c \
|
||||
src/jsubscribe.c \
|
||||
src/inet_ntop.c \
|
||||
src/inet_ntop.h \
|
||||
src/jpipe.c \
|
||||
src/jpipe.h \
|
||||
src/eXrefer_api.c \
|
||||
src/jpublish.c \
|
||||
src/sdp_offans.c
|
||||
|
|
5
submodules/externals/build/speex/Android.mk
vendored
5
submodules/externals/build/speex/Android.mk
vendored
|
@ -48,10 +48,7 @@ fft_SRC_FILES += libspeex/smallft.c
|
|||
# Un-comment for KISS_FFT
|
||||
fft_SRC_FILES += \
|
||||
libspeex/kiss_fft.c \
|
||||
libspeex/_kiss_fft_guts.h \
|
||||
libspeex/kiss_fft.h \
|
||||
libspeex/kiss_fftr.c \
|
||||
libspeex/kiss_fftr.h
|
||||
libspeex/kiss_fftr.c
|
||||
|
||||
libspeexdsp_SRC_FILES := \
|
||||
libspeex/preprocess.c \
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 82291db35ec30473717f9566025e0f3ff512a1d8
|
||||
Subproject commit 55aa245f04845e8d1353cc0ac95dbe8ce176890b
|
Loading…
Reference in a new issue