I’ve got a D40 running 1.3.0.2 (54153), connected to a Switchvox server running 5.7.1.1 (54321).
I’ve been experimenting with making pbx.request() calls. Attached is some tiny code that I have been working with, attempting to make the request. When I make the call, I get an error stating “No server defined. Make sure the auth param includes a valid server address.” I originally included the result from app.getAuth() as the parameter, but upon reading “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” in the pbx.request documentation, I took out the auth parameter. Unfortunately, I get the same error regardless of whether I include auth parameter or not. [attachment=0]screen_shot.png[/attachment] In looking at what app.getAuth() returns, I must admit that I’m a little confused:
{“lang”:
{“parameters”:
{“langLocale”:“en_us”,
“defaultLangLocale”:“en_us”
},
“allKeys”:
{“APP_ERROR”:[“Application Error”],
“APP_MISSREQ”:[“Missing required param (%s)”],
“APP_DISABLED”:[“This application is not enabled.”],
“APP_QUESTIONS”:[“If you have any questions,”],
“APP_CONTACT_ADMIN”:[“please contact your PBX administrator.”],
“AUTH_VERIFY_LOGIN”:[“Verifying Login”],
“AUTH_LOGIN_TITLE”:[“Switchvox Voicemail Login”],
“AUTH_SERVER”:[“Server”],
“AUTH_EXTENSION”:[“Extension”],
“AUTH_PASSWORD”:[“Password”],
“DEMO_STRING”:[“Language Demo String”],
“DEMO_FEET_TALL”:[“I am %s foot tall”,“I am %s feet tall”],
“FAIL_MSG”:[“The phone is in failover mode, this App is temporarily unavailable.”],
“FAIL_TITLE”:["%s App is Unavailable"],
“GC_ARE_YOU_SURE”:[“Are you sure you wish to perform this action?”],
“GC_TITLE”:[“Confirm Action”],
“GM_ERROR”:[“Please fix the following errors:”],
“GF_INVALID_INPUT”:[“Invalid %s”],
“GF_REQUIRED_INPUT”:["%s is a required field."],
“GM_BACK”:[“Back”],
“SI_SELECT_OPTION”:[“Choose an Option”],
“TC_CHANGE”:[“Change”],
“TC_NEXT”:[“Next”],
“TC_PREV”:[“Prev”],
“STD_SECONDS”:[“second”,“seconds”],
“STD_MINUTES”:[“minute”,“minutes”],
“STD_HOURS”:[“hour”,“hours”],
“STD_OK”:[“OK”],
“STD_DONE”:[“Done”],
“STD_YES”:[“Yes”],
“STD_NO”:[“No”],
“STD_MORE”:[“More”],
“STD_REFRESH”:[“Refresh”],
“STD_SUBMIT”:[“Submit”],
“STD_SELECT”:[“Select”],
“STD_CANCEL”:[“Cancel”],
“STD_HELP”:[“Help”],
“STD_SUCCESS”:[“Success”],
“STD_DELETE”:[“Delete”],
“STD_YESTERDAY”:[“Yesterday”],
“STD_SUNDAY”:[“Sunday”],
“STD_MONDAY”:[“Monday”],
“STD_TUESDAY”:[“Tuesday”],
“STD_WEDNESDAY”:[“Wednesday”],
“STD_THURSDAY”:[“Thursday”],
“STD_FRIDAY”:[“Friday”],
“STD_SATURDAY”:[“Saturday”],
“MM_REBOOTING”:[“Restarting phone, please be patient…”],
“MM_REBOOT”:[“Restart”],
“NETSELECT_TITLE”:[“Select Network”],
“NETSELECT_SAVE_TITLE”:[“Save Settings”],
“NETSELECT_SAVE_MSG”:[“Changing the phone’s network may require a reboot. Press OK to save.”],
“NETSELECT_SELECTED”:[“Selected”],
“NETSELECT_DONE_MSG”:[“Successfully saved network.”],
“NETSELECT_AUTO_DETECT”:[“Auto Detect”],
“NETSELECT_EMPTY_MSG”:[“No networks found in phone configuration.”],
“PBX_COMM_ERROR”:[“Error communicating with server. Please check the network connection and/or try again.”],
“PBX_BAD_STATUS”:[“Got a bad status back”],
“PBX_XML_ERR”:[“Error parsing XML. (%s)”],
“PBX_JSON_ERR”:[“Error parsing JSON”],
“PBX_MISSING_RESP_TAG”:[“Missing response tag”],
“PBX_RESP_UNDEF”:[“Missing result and errors???”],
“PBX_NO_SERVER”:[“No server defined. Make sure the auth param includes a valid server address.”]
}
}
}
Here’s the code (it’s also attached as a zip file). What am I doing wrong?
var app = require(‘app’);
app.init();
var pbx = require(‘pbx’);
// print(“app.getAuth()\n” + JSON.stringify(app.getAuth()) + “\n>>>\n”);
pbx.request({
‘method’ : ‘switchvox.users.phones.idleScreenImages.getFile’,
‘parameters’ : {
‘image_id’ : ‘1’
},
‘loadingText’ : ‘Getting info from pbx’,
‘onSuccess’ : function(response) {
print("Got response " + JSON.stringify(response.result) + “\n”);
}
});