mod_skinny: implement per device setting of ext- extensions

This commit is contained in:
Nathan Neulinger 2013-08-02 13:53:29 -05:00
parent d1268e8103
commit c2d5d47078
3 changed files with 34 additions and 6 deletions

View File

@ -2,8 +2,11 @@
<user id="SEP001120AABBCC">
<params>
<!-- for devices requesting firmware via SCCP, like ATA186
<param name="skinny-firmware-version" value="ATA030101SCCP04"
<param name="skinny-soft-key-set-set" value="default"
<param name="skinny-firmware-version" value="ATA030101SCCP04">
<param name="skinny-soft-key-set-set" value="default">
<param name="ext-voicemail" value="voicemail">
<param name="ext-redial" value="redial">
<param name="ext-meetme" value="conference">
-->
<param name="foo" value="bar"/>
</params>

View File

@ -35,6 +35,12 @@
#include <switch.h>
/*****************************************************************************/
/* UTILITY MACROS */
/*****************************************************************************/
#define empty_null(a) ((a)?(a):NULL)
#define empty_null2(a,b) ((a)?(a):empty_null(b))
/*****************************************************************************/
/* LOGGING FUNCTIONS */
/*****************************************************************************/
@ -183,6 +189,9 @@ struct listener {
uint32_t flags;
time_t expire_time;
struct listener *next;
char *ext_voicemail;
char *ext_redial;
char *ext_meetme;
};
typedef struct listener listener_t;

View File

@ -1034,6 +1034,18 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r
strncpy(listener->firmware_version, value, 16);
} else if (!strcasecmp(name, "skinny-soft-key-set-set")) {
listener->soft_key_set_set = switch_core_strdup(profile->pool, value);
} else if (!strcasecmp(name, "ext-voicemail")) {
if (!listener->ext_voicemail || strcmp(value,listener->ext_voicemail)) {
listener->ext_voicemail = switch_core_strdup(profile->pool, value);
}
} else if (!strcasecmp(name, "ext-redial")) {
if (!listener->ext_redial || strcmp(value,listener->ext_redial)) {
listener->ext_redial = switch_core_strdup(profile->pool, value);
}
} else if (!strcasecmp(name, "ext-meetme")) {
if (!listener->ext_meetme || strcmp(value,listener->ext_meetme)) {
listener->ext_meetme = switch_core_strdup(profile->pool, value);
}
}
}
}
@ -1267,7 +1279,8 @@ switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_mess
switch(request->data.stimulus.instance_type) {
case SKINNY_BUTTON_LAST_NUMBER_REDIAL:
skinny_create_incoming_session(listener, &line_instance, &session);
skinny_session_process_dest(session, listener, line_instance, listener->profile->ext_redial, '\0', 0);
skinny_session_process_dest(session, listener, line_instance,
empty_null2(listener->ext_redial,listener->profile->ext_redial), '\0', 0);
break;
case SKINNY_BUTTON_SPEED_DIAL:
skinny_speed_dial_get(listener, request->data.stimulus.instance, &button_speed_dial);
@ -1296,7 +1309,8 @@ switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_mess
break;
case SKINNY_BUTTON_VOICEMAIL:
skinny_create_incoming_session(listener, &line_instance, &session);
skinny_session_process_dest(session, listener, line_instance, listener->profile->ext_voicemail, '\0', 0);
skinny_session_process_dest(session, listener, line_instance,
empty_null2(listener->ext_voicemail, listener->profile->ext_voicemail), '\0', 0);
break;
case SKINNY_BUTTON_LINE:
@ -1871,7 +1885,8 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn
switch(request->data.soft_key_event.event) {
case SOFTKEY_REDIAL:
status = skinny_create_incoming_session(listener, &line_instance, &session);
skinny_session_process_dest(session, listener, line_instance, listener->profile->ext_redial, '\0', 0);
skinny_session_process_dest(session, listener, line_instance,
empty_null2(listener->ext_redial,listener->profile->ext_redial), '\0', 0);
break;
case SOFTKEY_NEWCALL:
status = skinny_create_incoming_session(listener, &line_instance, &session);
@ -1931,7 +1946,8 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn
break;
case SOFTKEY_MEETME:
skinny_create_incoming_session(listener, &line_instance, &session);
skinny_session_process_dest(session, listener, line_instance, listener->profile->ext_meetme, '\0', 0);
skinny_session_process_dest(session, listener, line_instance,
empty_null2(listener->ext_meetme, listener->profile->ext_meetme), '\0', 0);
break;
default:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,