[Freeswitch-svn] [commit] r3330 - in freeswitch/branches/knhor/trunk/src: . include mod/applications/mod_conference
Freeswitch SVN
knhor at freeswitch.org
Sun Nov 12 11:52:15 EST 2006
Author: knhor
Date: Sun Nov 12 11:52:15 2006
New Revision: 3330
Modified:
freeswitch/branches/knhor/trunk/src/include/switch_ivr.h
freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c
freeswitch/branches/knhor/trunk/src/switch_ivr.c
Log:
change digit action from type int to type void*
Modified: freeswitch/branches/knhor/trunk/src/include/switch_ivr.h
==============================================================================
--- freeswitch/branches/knhor/trunk/src/include/switch_ivr.h (original)
+++ freeswitch/branches/knhor/trunk/src/include/switch_ivr.h Sun Nov 12 11:52:15 2006
@@ -424,10 +424,10 @@
\brief Set a digit string to action mapping
\param parser a pointer to the parser object created by switch_ivr_digit_stream_parser_new
\param digits a string of digits to associate with an action
- \param action the action to signal when the digit string is matched
+ \param data consumer data attached to this digit string
\return SWITCH_STATUS_SUCCESS if all is well
*/
-SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_event(switch_ivr_digit_stream_parser_t *parser, char *digits, int action);
+SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_event(switch_ivr_digit_stream_parser_t *parser, char *digits, void *data);
/*!
\brief Delete a string to action mapping
@@ -441,9 +441,9 @@
\brief Create a digit stream parser object
\param parser a pointer to the parser object created by switch_ivr_digit_stream_parser_new
\param digit a digit to collect and test against the map of digit strings
- \return 0 if no match found or non-zero action that was associated with a given digit string when matched
+ \return NULL if no match found or consumer data that was associated with a given digit string when matched
*/
-SWITCH_DECLARE(int) switch_ivr_digit_stream_parser_feed(switch_ivr_digit_stream_parser_t *parser, char digit);
+SWITCH_DECLARE(void *) switch_ivr_digit_stream_parser_feed(switch_ivr_digit_stream_parser_t *parser, char digit);
/*!
\brief Reset the collected digit stream to nothing
Modified: freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c Sun Nov 12 11:52:15 2006
@@ -1019,7 +1019,7 @@
if(member->conference->dtmf_parser != NULL) {
for (digit = dtmf; *digit; digit++) {
- switch(switch_ivr_digit_stream_parser_feed(member->conference->dtmf_parser, *digit)) {
+ switch((int)switch_ivr_digit_stream_parser_feed(member->conference->dtmf_parser, *digit)) {
case CALLER_CONTROL_NOEVENT:
// the digit string collected so far has not been recognized
break;
@@ -3475,7 +3475,7 @@
// map in the default control handler strings only if the profile has no caller control definitions
if (i == 0) {
for(i=0,status=SWITCH_STATUS_SUCCESS; status == SWITCH_STATUS_SUCCESS && i<ccds_qty; i++) {
- status = switch_ivr_digit_stream_parser_set_event(conference->dtmf_parser,ccds[i].digits,ccds[i].action);
+ status = switch_ivr_digit_stream_parser_set_event(conference->dtmf_parser,ccds[i].digits,(void *)ccds[i].action);
}
}
@@ -3490,7 +3490,7 @@
// stop scanning the table, and go to the next xml kvp.
for(i=0,status=SWITCH_STATUS_NOOP; i<ccds_qty && status == SWITCH_STATUS_NOOP; i++) {
if(strcasecmp(ccds[i].key,key) == 0) {
- status = switch_ivr_digit_stream_parser_set_event(conference->dtmf_parser,val,ccds[i].action);
+ status = switch_ivr_digit_stream_parser_set_event(conference->dtmf_parser,val,(void *)ccds[i].action);
}
}
if(status == SWITCH_STATUS_NOOP) {
Modified: freeswitch/branches/knhor/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/switch_ivr.c (original)
+++ freeswitch/branches/knhor/trunk/src/switch_ivr.c Sun Nov 12 11:52:15 2006
@@ -3303,19 +3303,19 @@
return status;
}
-SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_event(switch_ivr_digit_stream_parser_t *parser, char *digits, int action)
+SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_event(switch_ivr_digit_stream_parser_t *parser, char *digits, void *data)
{ switch_status_t status = SWITCH_STATUS_FALSE;
if (parser != NULL && digits != NULL && *digits && parser->hash != NULL) {
int len;
- status = switch_core_hash_insert_dup(parser->hash,digits,(void *)action);
+ status = switch_core_hash_insert_dup(parser->hash,digits,data);
if (status == SWITCH_STATUS_SUCCESS && parser->terminator == '\0' && (len = strlen(digits)) > parser->maxlen) {
parser->maxlen = len;
}
}
if (status != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unable to add hash for '%s' action: %d\n",digits,action);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unable to add hash for '%s'\n",digits);
}
return status;
@@ -3335,8 +3335,8 @@
return status;
}
-SWITCH_DECLARE(int) switch_ivr_digit_stream_parser_feed(switch_ivr_digit_stream_parser_t *parser, char digit)
-{ int result = 0;
+SWITCH_DECLARE(void *) switch_ivr_digit_stream_parser_feed(switch_ivr_digit_stream_parser_t *parser, char digit)
+{ void *result = NULL;
if (parser != NULL && digit != '\0') {
size_t len = (parser->digits != NULL ? strlen(parser->digits) : 0);
@@ -3362,10 +3362,10 @@
// if we have digits to test
if (len) {
- result = (int)switch_core_hash_find(parser->hash,parser->digits);
+ result = switch_core_hash_find(parser->hash,parser->digits);
// if we matched the digit string, or this digit is the terminator
// reset the collected digits for next digit string
- if (result != 0 || parser->terminator == digit) {
+ if (result != NULL || parser->terminator == digit) {
free(parser->digits);
parser->digits = NULL;
}
More information about the Freeswitch-svn
mailing list