Pbx.request

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.

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

github.com/digium/digium-phone- … er/confapp

Cheers

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

// 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

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