Revision
15173
Author
anthm
Date
2009-10-16 17:32:44 -0500 (Fri, 16 Oct 2009)

Log Message

minor tweak to valet

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/applications/mod_valet_parking/mod_valet_parking.c (15172 => 15173)


--- freeswitch/trunk/src/mod/applications/mod_valet_parking/mod_valet_parking.c	2009-10-16 19:51:32 UTC (rev 15172)
+++ freeswitch/trunk/src/mod/applications/mod_valet_parking/mod_valet_parking.c	2009-10-16 22:32:44 UTC (rev 15173)
@@ -113,6 +113,7 @@
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_event_t *event;
 	char dtmf_buf[128] = "";
+	int is_auto = 0;
 
 	if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
 		&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 2) {
@@ -139,6 +140,7 @@
 			if (io) {
 				if (!strcasecmp(io, "in")) {
 					in = 1;
+					is_auto = 1;
 				} else if (!strcasecmp(io, "out")) {
 					in = 0;
 				}
@@ -228,26 +230,24 @@
 		dest = switch_core_session_sprintf(session, "sleep:1000,valet_park:%s %s", lot_name, ext);
 		switch_channel_set_variable(channel, "inline_destination", dest);
 
-		if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
-			switch_core_session_t *b_session;
+		if (is_auto) {
 			char tmp[512] = "";
-			
-			if ((b_session = switch_core_session_locate(uuid))) {
-				const char *lang = switch_channel_get_variable(channel, "language");
-				if (!lang) {
-					lang = "en";
+			switch_snprintf(tmp, sizeof(tmp), "%s:%s", lot_name, ext);
+
+			if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
+				switch_core_session_t *b_session;
+				
+				if ((b_session = switch_core_session_locate(uuid))) {
+					switch_ivr_phrase_macro(session, "valet_announce_ext", tmp, NULL, NULL);
+					switch_ivr_session_transfer(b_session, dest, "inline", NULL);
+					switch_mutex_unlock(lot->mutex);
+					switch_core_session_rwunlock(b_session);
+					switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+					return;
 				}
-				
-				switch_ivr_session_transfer(b_session, dest, "inline", NULL);
-				switch_mutex_unlock(lot->mutex);
-				switch_core_session_rwunlock(b_session);
-				//maybe a phrase here for more flexibility
-				switch_snprintf(tmp, sizeof(tmp), "%s:%s", lot_name, ext);
-				switch_ivr_phrase_macro(session, "valet_announce_ext", tmp, NULL, NULL);
-				//switch_ivr_say(session, ext, lang, "name_spelled", "pronounced", NULL);
-				switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
-				return;
 			}
+
+			switch_ivr_phrase_macro(session, "valet_announce_ext", tmp, NULL, NULL);
 		}