Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void onHandleIntent(Intent intent) {
- String sipAddress = intent.getStringExtra("address");
- String password = intent.getStringExtra("password");
- final LinphoneCoreFactory lcFactory = LinphoneCoreFactory.instance();
- // First instantiate the core Linphone object given only a listener.
- // The listener will react to events in Linphone core.
- try {
- lc = lcFactory.createLinphoneCore(new LinphoneCoreListenerBase() {
- @Override
- public void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message) {
- super.callState(lc, call, state, message);
- Log.i(TAG, "callState: ");
- }
- }, getApplication());
- } catch (LinphoneCoreException e) {
- e.printStackTrace();
- }
- lc.setUserAgent("Test app", "1.0");
- try {
- LinphoneAddress address = lcFactory.createLinphoneAddress(sipAddress);
- String username = address.getUserName();
- String domain = address.getDomain();
- if (password != null) {
- lc.addAuthInfo(lcFactory.createAuthInfo(username, password, null, domain));
- }
- // create proxy config
- LinphoneProxyConfig proxyCfg = lc.createProxyConfig(sipAddress, domain, null, true);
- proxyCfg.setExpires(2000);
- lc.addProxyConfig(proxyCfg); // add it to linphone
- lc.setDefaultProxyConfig(proxyCfg);
- running = true;
- while (running) {
- lc.iterate(); // first iterate initiates registration
- sleep(20);
- }
- } catch (LinphoneCoreException e) {
- e.printStackTrace();
- }
- }
Add Comment
Please, Sign In to add comment