skinny_profile_t *profile;
switch_event_t *event = NULL;
switch_event_t *params = NULL;
- switch_xml_t xroot, xdomain, xgroup, xuser, xskinny, xbuttons, xbutton;
+ switch_xml_t xroot, xdomain, xgroup, xuser, xskinny, xparams, xparam, xbuttons, xbutton;
char *sql;
assert(listener->profile);
profile = listener->profile;
xskinny = switch_xml_child(xuser, "skinny");
if (xskinny) {
- xbuttons = switch_xml_child(xskinny, "buttons");
- if (xbuttons) {
+ if ((xparams = switch_xml_child(xskinny, "params"))) {
+ for (xparam = switch_xml_child(xparams, "param"); xparam; xparam = xparam->next) {
+ const char *name = switch_xml_attr_soft(xparam, "name");
+ const char *value = switch_xml_attr_soft(xparam, "value");
+ if (!strcasecmp(name, "skinny-firmware-version")) {
+ strncpy(listener->firmware_version, value, 16);
+ }
+ }
+ }
+ if ((xbuttons = switch_xml_child(xskinny, "buttons"))) {
uint32_t line_instance = 1;
for (xbutton = switch_xml_child(xbuttons, "button"); xbutton; xbutton = xbutton->next) {
uint32_t position = atoi(switch_xml_attr_soft(xbutton, "position"));
switch_status_t skinny_handle_version_request(listener_t *listener, skinny_message_t *request)
{
- /* TODO */
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
- "VersionReqMessage not implemented yet.\n");
- return SWITCH_STATUS_SUCCESS;
- /* return send_version(listener, ""); */
+ if (!zstr(listener->firmware_version)) {
+ return send_version(listener, listener->firmware_version);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
+ "Device %s:%d is requesting for firmware version, but none is set.\n",
+ listener->device_name, listener->device_instance);
+ return SWITCH_STATUS_SUCCESS;
+ }
}
switch_status_t skinny_handle_capabilities_response(listener_t *listener, skinny_message_t *request)