I have set up the Asterisk Server properly for allowing GUI interface, to check this I have tried & tested an already available Application for Android & tested the same with my browser. I am able to login & view the files. eg. http://192.168.8.x:8088/asterisk/rawman?action=getconfig&filename=users.conf
this commands shows me the user.conf file.
However the same commands does not works from my Android Application. It results in
Response: Error Message: Permission denied
my code: 1st button click: try{ new mygoogleSearch().execute(http://192.168.8.x:8088/asterisk/rawman?action=login&username=tismo&secret=tismo123); } catch(Exception e) { Log.v("Exception google search","Exception:"+e.getMessage()); }
this returns: 03-27 17:27:09.468: E/GoogleSearch(21686): Response: SuccessMessage: Authentication accepted
On 2nd Button click:
try{
new Execute().execute("http://192.168.8.4:8088/asterisk/rawman?action=getconfig&filename=test.conf");
} catch(Exception e) {
Log.v("Exception google search","Exception:"+e.getMessage());
}
class mygoogleSearch extends AsyncTask {
protected String doInBackground(String... searchKey) {
;
String cmd = searchKey[0];
try {
return action(cmd);
} catch(Exception e) {
Log.v("Exception ",
"Exception:"+e.getMessage());
return "";
}
}
private String action(String uRL) throws MalformedURLException, IOException { String newFeed= uRL; StringBuilder response = new StringBuilder();
URL url = new URL(newFeed);
HttpURLConnection httpconn = (HttpURLConnection) url.openConnection();
httpconn.setUseCaches(false);
//httpconn.setRequestProperty("Cache", "false");
if(httpconn.getResponseCode()==HttpURLConnection.HTTP_OK) {
BufferedReader input = new BufferedReader(
new InputStreamReader(httpconn.getInputStream()),
8192);
String strLine = null;
while ((strLine = input.readLine()) != null) {
response.append(strLine);
}
input.close();
}
return response.toString();
}
this returns:
03-27 17:28:31.808: E/GoogleSearch(21800): Response: ErrorMessage: Permission denied