| | |
| | | import android.content.Intent; |
| | | import android.graphics.Bitmap; |
| | | import android.os.Bundle; |
| | | import android.text.TextUtils; |
| | | import android.util.Log; |
| | | import android.view.View; |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.hdl.hdllinphonesdk.HDLLinphoneKit; |
| | | import com.hdl.hdllinphonesdk.activity.HDLLinphoneIntercomActivity; |
| | | import com.hdl.hdllinphonesdk.activity.HDLLinphoneMonitorActivity; |
| | | import com.hdl.hdllinphonesdk.callback.OnHDLLinphoneCallListener; |
| | | //import com.hdl.hdllinphonesdk.core.EasyLinphone; |
| | | import com.hdl.hdllinphonesdk.core.service.HDLLinphoneService; |
| | | import com.hdl.hdllinphonesdk.utils.HDLLog; |
| | | |
| | | import org.linphone.core.Address; |
| | | import org.linphone.core.Call; |
| | | import org.linphone.core.CallParams; |
| | | import org.linphone.core.Core; |
| | | import org.linphone.core.ProxyConfig; |
| | | |
| | |
| | | // HDLLinphoneKit.getInstance().setAccountAndLogin("5555", "85521566", "test-gz.hdlcontrol.com:5060"); |
| | | // HDLLinphoneKit.getInstance().setAccountAndLogin("6666", "85521566", "test-gz.hdlcontrol.com:5060"); |
| | | |
| | | HDLLinphoneKit.getInstance().setAccountAndLogin("7777", "85521566", "test-gz.hdlcontrol.com:5060"); |
| | | // |
| | | HDLLinphoneKit.getInstance().setAccountAndLogin("7777", "85521566", "test-gz.hdlcontrol.com:35060"); |
| | | |
| | | |
| | | |
| | | |
| | | // |
| | | // HDLLinphoneKit.getInstance().setAccountAndLogin("8888", "85521566", "test-gz.hdlcontrol.com:5060"); |
| | | // |
| | | // HDLLinphoneKit.getInstance().setAccountAndLogin("4444", "85521566", "test-gz.hdlcontrol.com:5060"); |
| | |
| | | mTextView4.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | HDLLinphoneKit.getInstance().setAccountAndLogin("5555", "85521566", "test-gz.hdlcontrol.com:5060"); |
| | | clearProxyConfig(); |
| | | HDLLinphoneKit.getInstance().setAccountAndLogin("5555", "85521566", "test-gz.hdlcontrol.com:35060"); |
| | | } |
| | | }); |
| | | |
| | |
| | | @Override |
| | | public void onClick(View v) { |
| | | |
| | | logoutLog(); |
| | | return; |
| | | //// HDLLinphoneKit.getInstance().callTo("61723164995779",true); |
| | | //// HDLcallTo("61723164995779",true); |
| | | // logoutLog(); |
| | | // return; |
| | | // HDLLinphoneKit.getInstance().callTo("61723164995779",true); |
| | | // HDLcallTo("61723164995779",true); |
| | | // HDLLinphoneKit.getInstance().callTo("1427186301744910338",true); |
| | | // startActivity(HDLLinphoneMonitorActivity.class); |
| | | HDLLinphoneKit.getInstance().callTo("5555",true); |
| | | |
| | | startActivity(HDLLinphoneMonitorActivity.class); |
| | | |
| | | |
| | | } |
| | |
| | | mTextView3.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | HDLLinphoneKit.getInstance().logout(); |
| | | |
| | | HDLLinphoneKit.getInstance().getCore().setNetworkReachable(true); |
| | | // isOpen = !isOpen; |
| | | // showToast("当前设置状态:"+isOpen); |
| | | // HDLLinphoneKit.getInstance().getCore().enableVideoCapture(isOpen);//禁用手机摄像头视频采集 |
| | | // //1.启用PCMA 8000 |
| | | // PayloadType[] ptList = HDLLinphoneKit.getInstance().getCore().getAudioPayloadTypes(); |
| | | // for (PayloadType pt : ptList) { |
| | | //// HDLLog.i("payloadaudio", pt.getMimeType()); |
| | | // if ((pt.getMimeType().equals("PCMA") || pt.getMimeType().equals("PCMU")) && pt.getClockRate() == 8000) { |
| | | //// pt.enable(true); |
| | | // HDLLog.i("payloadaudio true", pt.getMimeType() + ": "+ pt.getClockRate()+"HZ " + pt.enabled()); |
| | | // } else { |
| | | //// pt.enable(false); |
| | | // HDLLog.i("payloadaudio false", pt.getMimeType() + ": "+ pt.getClockRate()+"HZ "+ pt.enabled()); |
| | | // } |
| | | // } |
| | | // logout(); |
| | | } |
| | | }); |
| | | |
| | |
| | | setOnHDLLinphoneCallListener(); |
| | | } |
| | | |
| | | |
| | | boolean isOpen; |
| | | |
| | | /** |
| | | * 退出清空账号 |
| | |
| | | config.done(); |
| | | } |
| | | } |
| | | core.clearAllAuthInfo();//清除所有认证信息。 |
| | | // core.clearAllAuthInfo();//清除所有认证信息。 |
| | | // core.clearProxyConfig();//从配置中删除所有代理。 |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | public void clearProxyConfig() { |
| | | Core core = HDLLinphoneService.getCore(); |
| | | if (core != null) { |
| | | core.setDefaultProxyConfig(null); |
| | | core.clearAllAuthInfo(); |
| | | core.clearProxyConfig(); |
| | | // core.refreshRegisters();//强制在下一次迭代时启动注册刷新 |
| | | // core.ensureRegistered(); |
| | | } |
| | | |
| | | } |
| | | |
| | | public void logoutLog() { |
| | |
| | | |
| | | @Override |
| | | public void onUnlockAction() { |
| | | // |
| | | HDLLinphoneKit.getInstance().getCore().clearAllAuthInfo(); |
| | | |
| | | // showToast("开锁"); |
| | | // EasyLinphone.callTo("61723164995779",true); |
| | | openSuccess = !openSuccess; |
| | | if(openSuccess){ |
| | | HDLLinphoneKit.getInstance().onOpenSuccess(); |
| | | }else{ |
| | | HDLLinphoneKit.getInstance().onOpenError("设备不在线"); |
| | | } |
| | | // openSuccess = !openSuccess; |
| | | // if(openSuccess){ |
| | | // HDLLinphoneKit.getInstance().onOpenSuccess(); |
| | | // }else{ |
| | | // HDLLinphoneKit.getInstance().onOpenError("设备不在线"); |
| | | // } |
| | | |
| | | |
| | | } |