Make own interface for calling

Is there a way that, from an app, you can dial a number and display your own calling interface instead of the phone jumping out of the application and into the phones interface.

I know how to already stop the app from going into the background, but it doesnt solve the fact that the call interface is still on the phone interface and not my apps. Any ideas here?

Thanks,
Ryan

Hi, If I understand correctly you have your app’s interface in the foreground, and then you call digium.phone.dial to initiate a call, and then the “standard” interface pops up and puts your app in the background. If this is the case you can call digium.foreground(‘yourAppName’); which will put your app back in the foreground. I beleive you will need to set your app not to exit when put in background using “digium.app.exitAfterBackground = false”.

Hope this helps

wallnut

So then after it loads back up I would then do a window.clear() and then add in whatever calling widget I create to do the calling interface? Eventhough there is another call interface running behind the app from the phone?

Also I have a question about the callHandlers.

When I do:
digium.phone.dial({
‘number’ : 2,
‘handler’ : function (obj) {
util.debug(obj.state);
}
});
How do you save the call handler so that later you can use the:

digium.phone.observeCallEvents({
‘callHandle’ : ,
‘handler’ : function(obj) {
util.debug(obj.state);
}
});

Thanks

for the call handle it is returned by digium.phone.dial so you can do something like this:

var my_call_handle = digium.phone.dial(whatever params);

then use it as the param to hangup:

digium.phone.hangup({‘callHandle’ : my_call_handle});

For the other part of your question I’m not sure 100%, but I beleive that something in the phones code will background our apps once in a while. So when you bring it back to the foreground using digium.foreground(‘yourapp’), I think it will have the exact same state as before it was backgrounded.

I’m currently implementing a timer that should keep my app in the foreground at all times. I will update you with the result when I get it working.

cheers

wallnut

looks like its working here is what I’m doing so far:

I create a function like this:
function foregroundMyApp() {

    digium.foreground('MyApp');
    clearInterval(foreground_timer); 
    foreground_timer = setTimeout(function() { foregroundMyApp();}, 8000);

}

Once my apps main window is created I call the above function which puts my app in the foreground every 8 seconds. Not sure if the clearInterval is necessary but I beleive that the timer only fires a single event but really not sure on this part here, I will be testing it though.

cheers

wallnut

Thanks for the info on the callHandler.

Wouldn’t putting it in the foreground every 8 seconds make it display the “Loading…” and flash the screen every 8 seconds?

probably if you dont set this:

digium.app.exitAfterBackground = false;

then the app will stop executing when its put in the background.

wallnut