Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public SipManager mSipManager = null;
- public SipProfile mSipProfile = null;
- String username="100";
- String domain="192.168.56.1";
- String password="100";
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- lbl= (TextView) findViewById(R.id.label);
- if(mSipManager == null) {
- mSipManager = SipManager.newInstance(this);
- }
- try {
- SipProfile.Builder builder = new SipProfile.Builder(username,domain);
- builder.setPassword(password);
- mSipProfile = builder.build();
- Intent intent = new Intent();
- intent.setAction("android.SipDemo.INCOMING_CALL");
- PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent, Intent.FILL_IN_DATA);
- mSipManager.open(mSipProfile, pendingIntent, null);
- mSipManager.setRegistrationListener(mSipProfile.getUriString(), new SipRegistrationListener() {
- public void onRegistering(String localProfileUri) {
- lbl.setText("Registering with SIP Server...");
- }
- public void onRegistrationDone(String localProfileUri, long expiryTime) {
- lbl.setText("Ready");
- }
- public void onRegistrationFailed(String localProfileUri, int errorCode,
- String errorMessage) {
- lbl.setText("Registration failed. Please check settings.");
- }
- });
- //throw new SipException();
- }catch (ParseException pe) {
- Log.i("STATE11","Connection Error.");
- }catch (SipException se ){
- Log.i("STATE11","Connection Error."+se);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement