pbx.request

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

Moderators: jwitt, sruffell, malcolmd, Moderator

pbx.request

Postby markgc2014 » Tue Jul 01, 2014 7:33 pm

I am trying to use pbx.request to notify AMI when my app is running on a phone, so AMI knows to issue my new custom methods I have implemented for making a call and answering an incoming call

I am receiving the following when I stringify the response

Phone model is D40

{"errors":[{"message":"No server defined. Make sure the auth param includes a valid server address."}]}

According to the doc this is optional as below excerpt - but this doesnt seem to be the case - are there any examples of working code using this method please ?



auth

Description

Type: object
An auth object that contains the account_id, username, password, and server address to authorize pbx requests.

If you want to send the request to the PBX the phone is configured to as the extension the phone is configured as, then this parameter is not needed. If you want to send the request to another PBX or make it as another user, then you need to pass in an Auth object.
markgc2014
Newsterisk
 
Posts: 14
Joined: Wed Jun 25, 2014 5:54 pm

Re: pbx.request

Postby malcolmd » Wed Jul 02, 2014 7:09 am

There should be an example of using pbx.request in the example conference application here:

https://github.com/digium/digium-phone- ... er/confapp

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: pbx.request

Postby markgc2014 » Wed Jul 02, 2014 4:35 pm

Thanks,

Yes that is definitely a good example of using pbx.request - below is an excerpt of the code from that

I had already found that and had used it to check I was doing what I should - it isn't passing in any auth settings either

Code: Select all
    // register to the server when app is started
    pbx.request( {
        'method' : 'digium.confapp',
        'parameters' : {
       'action' : 'register',
       'phonename' : confApp.user,
       'cid' : confApp.exten,
   },
        'onSuccess' : function(p) {
       util.debug("Got request result: " + JSON.stringify(p));
       processParams(p);
   },
   'onError' : function(p) {
       util.debug('We got an Error houston - this is p:');
       util.debug(JSON.stringify(p));
   }
    });


Below is my code that I am using - Im not passing in any parameters in this case but I have another where I do - and they both get the same error response
{"errors":[{"message":"No server defined. Make sure the auth param includes a valid server address."}]}


Code: Select all
    pbx.request({
        'method': 'mytest.event.started',
        'onSuccess': function (response) {
            util.debug(JSON.stringify(response));
        },
        'onError': function (response) {
            util.debug(JSON.stringify(response));
        }
    });


I will review the example code again and see if I can find a step that i am missing
markgc2014
Newsterisk
 
Posts: 14
Joined: Wed Jun 25, 2014 5:54 pm


Return to Digium Phone API

Who is online

Users browsing this forum: No registered users and 2 guests

cron