Get the extension number of the phone

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

Moderators: jwitt, sruffell, malcolmd, Moderator

Get the extension number of the phone

Postby ivansy » Wed Dec 04, 2013 6:27 pm

I have an digium app that talks to a dual-headed JSON<->PHP<->AMI and it get MailboxStatus (and perhaps anything on AMI) I don't want to talk directly to AMI as I want to have AMI listen only to loopback.

I need to pass the extension number to the "id" of the JSON request.
how do i get the extension number (and hopefully the context) and other details of a phone?
ivansy
Newsterisk
 
Posts: 2
Joined: Wed Dec 04, 2013 6:24 pm

Re: Get the extension number of the phone

Postby malcolmd » Thu Dec 05, 2013 8:19 am

The extension number isn't something known by the phone. Only Asterisk knows the extensions. The API also doesn't expose the SIP user or pass to custom applications. So, if you want to pass in something to an application that's analogous to an extension, just pass in your own values when you load the application onto the phone.

If you're going the XML route, see the "settings" child element here:
https://wiki.asterisk.org/wiki/display/ ... ovisioning
Malcolm Davenport
Digium, Inc. | Senior Product Manager
malcolmd
Moves Like Spencer
 
Posts: 3019
Joined: Wed Aug 03, 2005 3:53 pm
Location: Huntsville, AL, US

Re: Get the extension number of the phone

Postby ivansy » Fri Dec 06, 2013 9:05 pm

Thanks.

I know that custom apps are different than factory default apps. But how did the "Voicemail" app able to determine the extension number of the phone?

When i use the Voicemail app on a digium phone, it just gives me the list directly.

I hope there's another way to get the line number and potentially the context so I can move that to AMI's MailboxStatus routine.

THanks!
ivansy
Newsterisk
 
Posts: 2
Joined: Wed Dec 04, 2013 6:24 pm

Re: Get the extension number of the phone

Postby malcolmd » Mon Dec 09, 2013 8:21 am

I know that custom apps are different than factory default apps. But how did the "Voicemail" app able to determine the extension number of the phone?

When i use the Voicemail app on a digium phone, it just gives me the list directly.


Because DPMA knows the session of the phone and the SIP peer for that session, and, by inference, the app_voicemail mailbox for that SIP peer. Custom apps have no such ability to reach into the bowels of Asterisk that way. It's DPMA magic.

I hope there's another way to get the line number and potentially the context so I can move that to AMI's MailboxStatus routine.


You'll have to figure that out, and you'll have to pass it to your application as settings. Your app won't be able to derive that from Asterisk.

Cheers
Malcolm Davenport
Digium, Inc. | Senior Product Manager
malcolmd
Moves Like Spencer
 
Posts: 3019
Joined: Wed Aug 03, 2005 3:53 pm
Location: Huntsville, AL, US

Re: Get the extension number of the phone

Postby timo » Sun Jan 05, 2014 11:57 pm

Hi,
I had a similar problem lately and maybe you can use the way I solved it, too:

The account_id in the Auth-Object equals the phone number in our company so if you do the following you'll may get the info you need:

var app = require('app');
app.init();
var authObj = app.getAuth();
var Account_ID = authObj.getAccountId();

If not: The authObj has a method getCredentials() also where you possibly find the information you need...
timo
Newsterisk
 
Posts: 7
Joined: Wed Sep 25, 2013 6:07 am


Return to Digium Phone API

Who is online

Users browsing this forum: No registered users and 1 guest