package com.teamnemitoff.phonedialer;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.json.JSONObject;
import org.json.JSONArray;
import org.json.JSONException;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;

public class PhoneDialer extends CordovaPlugin {
	@Override
	public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
	    try {
	TelephonyManager telMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
    	if(tm.getSimState() != TelephonyManager.SIM_STATE_ABSENT)
		    {
	    	String phoneNumber = args.getString(0);
	    	Uri uri = Uri.parse("tel:"+phoneNumber);
            Intent callIntent = new Intent(Intent.ACTION_CALL);
            callIntent.setData(uri);
            this.cordova.getActivity().startActivity(callIntent);
            callbackContext.success();
            return true;
		    }
        } catch (Exception e) {
        	String msg = "Exception Dialing Phone Number: " + e.getMessage();
        	System.err.println(msg);
	        callbackContext.error(msg);
	        return false;
        }
	}
}

@@ -280,15 +280,90 @@
 oid.
-net.Uri
+content.Context;%0Aimport android.net.Uri;%0Aimport android.telephony.TelephonyManager
 ;%0A%0Ap
@@ -543,16 +543,92 @@
   try %7B%0A
+%09%09%09Context context = this.cordova.getActivity().getApplicationContext(); %0A%09%09
 %09Telepho
@@ -665,16 +665,24 @@
 anager) 
+context.
 getSyste
@@ -722,18 +722,20 @@
 E);%0A
-    
+%09%09
 %09if(t
-m
+elMgr
 .get
@@ -786,22 +786,14 @@
 ENT)
+ %7B
 %0A%09%09
-    %7B%0A%09    
+%09
 %09Str
@@ -830,20 +830,18 @@
 ng(0);%0A%09
-    
+%09%09
 %09Uri uri
@@ -874,28 +874,20 @@
 umber);%0A
-            
+%09%09%09%09
 Intent c
@@ -930,28 +930,20 @@
 _CALL);%0A
-            
+%09%09%09%09
 callInte
@@ -959,28 +959,20 @@
 a(uri);%0A
-            
+%09%09%09%09
 this.cor
@@ -1017,28 +1017,20 @@
 ntent);%0A
-            
+%09%09%09%09
 callback
@@ -1052,20 +1052,12 @@
 ();%0A
-            
+%09%09%09%09
 retu
@@ -1067,20 +1067,17 @@
 true;%0A%09%09
-    
+%09
 %7D%0A      
@@ -1248,25 +1248,24 @@
 r(msg);%0A
-%09
         
 return f
@@ -1256,16 +1256,20 @@
         
+%7D%0A%09%09
 return f
@@ -1278,19 +1278,10 @@
 se;%0A
-        %7D%0A
 %09%7D%0A
+%0A
 %7D%0A

Fix broken pull request