pbx.request with nested parameters

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

Moderators: jwitt, sruffell, malcolmd, Moderator

pbx.request with nested parameters

Postby intellectit » Fri Jun 05, 2015 10:31 pm

I've got a problem with 'switchvox.digiumPhones.assignments.checkConflicts'. The method has nested parameters as shown below.

Code: Select all
<request method="switchvox.digiumPhones.assignments.checkConflicts">
    <parameters>
        <account_ids>
            <account_id>1106</account_id>
        </account_ids>
        <mac_addresses>
            <mac_address>aabbcc112233</mac_address>
        </mac_addresses>
    </parameters>
</request>


I've tried this:
Code: Select all
pbx.request({
    'auth' : auth,
    'method' : 'switchvox.digiumPhones.assignments.checkConflicts',
   'parameters'    : {
      'account_id' : "1193,
      'mac_address' : "aabbcc112233"
        },
    'onSuccess' : function (response) {
        screen.clear();
        var resp = new Text(0, Text.LINE_HEIGHT, window.w, window.h);
        resp.label = JSON.stringify(response);
        resp.align(Widget.WRAP);
        window.add(resp);
      util.debug(JSON.stringify(response));
        },
   'onError': function (response) {
        util.debug(JSON.stringify(response));
        }
});


And this:
Code: Select all
pbx.request({
    'auth' : auth,
    'method' : 'switchvox.digiumPhones.assignments.checkConflicts',
   'parameters'    : {
      'account_ids' : {'account_id' : "1193"},
      'mac_addresses' : {'mac_address' : "aabbcc112233"}
        },
    'onSuccess' : function (response) {
        screen.clear();
        var resp = new Text(0, Text.LINE_HEIGHT, window.w, window.h);
        resp.label = JSON.stringify(response);
        resp.align(Widget.WRAP);
        window.add(resp);
      util.debug(JSON.stringify(response));
        },
   'onError': function (response) {
        util.debug(JSON.stringify(response));
        }
});


However on the debug output it just shows the request being made and then nothing is returned. Any help would be greatly appreciated.
intellectit
Oldsterisk
 
Posts: 112
Joined: Sun Aug 02, 2009 8:08 am

Re: pbx.request with nested parameters

Postby intellectit » Mon Jun 08, 2015 12:26 am

I figured this one out. You can omit the parent tags and go directly with the child tags. This is the correct format below.

Code: Select all
pbx.request({
    'auth' : auth,
    'method' : 'switchvox.digiumPhones.assignments.checkConflicts',
   'parameters'    : {
   'account_id' : "1193",
   'mac_address' : "aabbcc112233"
        },
intellectit
Oldsterisk
 
Posts: 112
Joined: Sun Aug 02, 2009 8:08 am


Return to Digium Phone API

Who is online

Users browsing this forum: No registered users and 6 guests