Skinny: allow skinny-default-soft-key-set-set per device

This commit is contained in:
Mathieu Parent 2010-09-04 10:06:07 +02:00
parent f5a6831ffc
commit 07c3c94d7a
3 changed files with 12 additions and 3 deletions

View File

@ -3,6 +3,7 @@
<params>
<!-- for devices requesting firmware via SCCP, like ATA186
<param name="skinny-firmware-version" value="ATA030101SCCP04"
<param name="skinny-default-soft-key-set-set" value="default"
-->
<param name="foo" value="bar"/>
</params>

View File

@ -135,6 +135,7 @@ struct listener {
uint32_t device_type;
char firmware_version[16];
char *default_soft_key_set_set;
switch_socket_t *sock;
switch_memory_pool_t *pool;

View File

@ -999,6 +999,8 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r
const char *value = switch_xml_attr_soft(xparam, "value");
if (!strcasecmp(name, "skinny-firmware-version")) {
strncpy(listener->firmware_version, value, 16);
} else if (!strcasecmp(name, "skinny-default-soft-key-set-set")) {
listener->default_soft_key_set_set = switch_core_strdup(profile->pool, value);
}
}
}
@ -1693,14 +1695,19 @@ end:
switch_status_t skinny_handle_soft_key_set_request(listener_t *listener, skinny_message_t *request)
{
skinny_message_t *message;
skinny_message_t *message = NULL;
message = switch_core_hash_find(listener->profile->soft_key_set_sets_hash, "default");
if (listener->default_soft_key_set_set) {
message = switch_core_hash_find(listener->profile->soft_key_set_sets_hash, listener->default_soft_key_set_set);
}
if (!message) {
message = switch_core_hash_find(listener->profile->soft_key_set_sets_hash, "default");
}
if (message) {
skinny_send_reply(listener, message);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"Profile %s doesn't have a default <soft-key-set-set>. Profile ignored.\n", listener->profile->name);
"Profile %s doesn't have a default <soft-key-set-set>.\n", listener->profile->name);
}
/* Init the states */