private void runExample() { this.clearInfoLines(); this.addInfoLine("Local IP Address:" + Utils.getIPAddress(true)); // Voip Lib Initialization Params HashMap<String, String> params = buildParams(); Log.d(TAG, "Initializing the lib..."); if (myVoip == null) { Log.d(TAG, "Voip null... Initialization....."); myVoip = new VoipLibBackend(); this.voipHandler = new AnswerCallHandler(this, myVoip); // Initialize the library providing custom initialization params and an handler where // to receive event notifications. Following Voip methods are called form the handleMassage() // callback method // boolean result = myVoip.initLib(params, new RegistrationHandler(this, myVoip)); myVoip.initLib(this.getApplicationContext(), params, this.voipHandler); } else { Log.d(TAG, "Voip is not null... Destroying the lib before reinitializing....."); // Reinitialization will be done after deinitialization event callback this.voipHandler.reinitRequest = true; myVoip.destroyLib(); } }
private HashMap<String, String> buildParams() { HashMap<String, String> params = new HashMap<String, String>(); params.put("sipServerIp", serverIp); params.put("userName", "steand"); params.put("userPwd", "steand"); String onHoldSoundPath = Utils.getResourcePathByAssetCopy(this.getApplicationContext(), "", "test_hold.wav"); Log.d(TAG, "OnHoldSoundPath:" + onHoldSoundPath); params.put("onHoldSound", onHoldSoundPath); // params.put("sipServerPort","5060"); // optional: default 5060 return params; }