Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am developing an apps for my organization which will connect to any employee desk phone after dialing his/her extension after main organization number. and this extension is saved in application db. suppose main contact number is "123456789" and then ext "234#" is required to connect an employee.

In Main Activity we have code like this:

Intent newIntent=new Intent();
newIntent.setAction(Intent.ACTION_CALL);
newIntent.setData(Uri.parse("tel: 123456789"));

As per above lines of code application is able to start call activity to specified number. but after this I want to know how to implement to enter extension number programmatically in background.

What I have tried:

Tried to create new Intent to parse extension number in broadCastReceiver class as below:
if(stateStr.equals(TelephonyManager.EXTRA_STATE_OFFHOOK)){
state = TelephonyManager.CALL_STATE_OFFHOOK;
callReceived=true;
Intent newIntent=new Intent();
newIntent.setAction(Intent.ACTION_DIAL);
newIntent.setData(Uri.parse("tel: 234#"));

}

But this code snippet is not working.

Then I tried with PAUSE/WAIT number in MainActivity as below:

Intent newIntent=new Intent();
newIntent.setAction(Intent.ACTION_CALL);
newIntent.setData(Uri.parse("tel: 123456789;234#"));
}
But this ask user to click 'ok' with a message to send tune.
Posted
Updated 23-Jan-18 23:05pm
Comments
David Crow 24-Jan-18 8:57am    
Have you tried something like:

newIntent.setData(Uri.parse("tel:123456789,,234"));
Member 13640588 29-Jan-18 0:45am    
it will dial extension 234 before call is answered and user is asked to enter the extension. I have already tried with this approach including wait(;) But on implementing code through wait(;) activity ask user to send tunes(extension: 234) and need to press 'ok' button. My requirement is to dial extension when user is asked and this should be done in background.

1 solution

Please check this thread below.Let me know with your key undertakings.As per your suggestion i will try to improve the solution or will freeze it.

java - how to programmatically enter the number into phone application screen in android during conversation - Stack Overflow[^]
 
Share this answer
 
v2
Comments
Member 13640588 29-Jan-18 0:40am    
I have already gone through the above threads and tried with the approach to implement code using pause or wait. But on implementing "wait(;)" it ask users to send tones(extension), on clicking switch='ok' only it will dial extension. i want to implement this in background. Is there any other way to implement wait(;) in background.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900