Make own interface for calling

Community based support for the Digium Phone Application Programming Interface (API).

Moderators: jwitt, sruffell, malcolmd, Moderator

Make own interface for calling

Postby rjconrad » Tue Jul 23, 2013 11:27 am

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
rjconrad
Newsterisk
 
Posts: 12
Joined: Tue Jul 23, 2013 10:44 am

Re: Make own interface for calling

Postby wallnutmonkeys » Tue Jul 23, 2013 11:33 am

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
wallnutmonkeys
Newsterisk
 
Posts: 28
Joined: Thu Feb 10, 2011 9:52 pm

Re: Make own interface for calling

Postby rjconrad » Tue Jul 23, 2013 12:02 pm

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' : <WHAT GETS PUT HERE>,
'handler' : function(obj) {
util.debug(obj.state);
}
});

Thanks
rjconrad
Newsterisk
 
Posts: 12
Joined: Tue Jul 23, 2013 10:44 am

Re: Make own interface for calling

Postby wallnutmonkeys » Tue Jul 23, 2013 12:29 pm

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
wallnutmonkeys
Newsterisk
 
Posts: 28
Joined: Thu Feb 10, 2011 9:52 pm

Re: Make own interface for calling

Postby wallnutmonkeys » Tue Jul 23, 2013 12:38 pm

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
wallnutmonkeys
Newsterisk
 
Posts: 28
Joined: Thu Feb 10, 2011 9:52 pm

Re: Make own interface for calling

Postby rjconrad » Tue Jul 23, 2013 1:29 pm

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?
rjconrad
Newsterisk
 
Posts: 12
Joined: Tue Jul 23, 2013 10:44 am

Re: Make own interface for calling

Postby wallnutmonkeys » Tue Jul 23, 2013 1:57 pm

probably if you dont set this:

digium.app.exitAfterBackground = false;

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

wallnut
wallnutmonkeys
Newsterisk
 
Posts: 28
Joined: Thu Feb 10, 2011 9:52 pm


Return to Digium Phone API

Who is online

Users browsing this forum: No registered users and 0 guests