No subject


Thu Jul 12 09:23:04 CDT 2007


........

................
r79109 | qwell | 2007-08-10 15:29:31 -0600 (Fri, 10 Aug 2007) | 4 lines

Use localized softkey labels.

Add some information about localization "codes".

................

Modified:
    team/group/CDRfix5/   (props changed)
    team/group/CDRfix5/channels/chan_skinny.c
    team/group/CDRfix5/funcs/func_devstate.c
    team/group/CDRfix5/include/asterisk/channel.h
    team/group/CDRfix5/main/cdr.c
    team/group/CDRfix5/main/channel.c
    team/group/CDRfix5/main/dial.c
    team/group/CDRfix5/pbx/pbx_spool.c

Propchange: team/group/CDRfix5/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/group/CDRfix5/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Aug 10 17:37:25 2007
@@ -1,1 +1,1 @@
-/trunk:1-79029
+/trunk:1-79130

Modified: team/group/CDRfix5/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/team/group/CDRfix5/channels/chan_skinny.c?view=diff&rev=79136&r1=79135&r2=79136
==============================================================================
--- team/group/CDRfix5/channels/chan_skinny.c (original)
+++ team/group/CDRfix5/channels/chan_skinny.c Fri Aug 10 17:37:25 2007
@@ -552,25 +552,159 @@
 #define SOFTKEY_GPICKUP			0x12
 
 struct soft_key_template_definition soft_key_template_default[] = {
-	{ "Redial",	 	0x01 },
-	{ "NewCall",	 	0x02 },
-	{ "Hold",	 	0x03 },
-	{ "Trnsfer",	 	0x04 },
-	{ "CFwdAll",	 	0x05 },
-	{ "CFwdBusy",	 	0x06 },
-	{ "CFwdNoAnswer",	0x07 },
-	{ "<<",		 	0x08 },
-	{ "EndCall",	 	0x09 },
-	{ "Resume",		0x0A },
-	{ "Answer",		0x0B },
-	{ "Info",		0x0C },
-	{ "Confrn",		0x0D },
-	{ "Park",		0x0E },
-	{ "Join",		0x0F },
-	{ "MeetMe",		0x10 },
-	{ "PickUp",		0x11 },
-	{ "GPickUp",		0x12 },
-};
+	{ "\200\001", 		SOFTKEY_REDIAL },
+	{ "\200\002", 		SOFTKEY_NEWCALL },
+	{ "\200\003", 		SOFTKEY_HOLD },
+	{ "\200\004", 		SOFTKEY_TRNSFER },
+	{ "\200\005", 		SOFTKEY_CFWDALL },
+	{ "\200\006", 		SOFTKEY_CFWDBUSY },
+	{ "\200\007", 		SOFTKEY_CFWDNOANSWER },
+	{ "\200\010", 		SOFTKEY_BKSPC },
+	{ "\200\011", 		SOFTKEY_ENDCALL },
+	{ "\200\012", 		SOFTKEY_RESUME },
+	{ "\200\013", 		SOFTKEY_ANSWER },
+	{ "\200\014", 		SOFTKEY_INFO },
+	{ "\200\015", 		SOFTKEY_CONFRN },
+	{ "\200\016", 		SOFTKEY_PARK },
+	{ "\200\017", 		SOFTKEY_JOIN },
+	{ "\200\020", 		SOFTKEY_MEETME },
+	{ "\200\021", 		SOFTKEY_PICKUP },
+	{ "\200\022", 		SOFTKEY_GPICKUP },
+};
+
+/* Localized message "codes" (in octal)
+   Below is en_US (taken from a 7970)
+
+   \200\xxx
+       \000: ???
+       \001: Redial
+       \002: New Call
+       \003: Hold
+       \004: Transfer
+       \005: CFwdALL
+       \006: CFwdBusy
+       \007: CFwdNoAnswer
+       \010: <<
+       \011: EndCall
+       \012: Resume
+       \013: Answer
+       \014: Info
+       \015: Confrn
+       \016: Park
+       \017: Join
+       \020: MeetMe
+       \021: PickUp
+       \022: GPickUp
+       \023: Your current options
+       \024: Off Hook
+       \025: On Hook
+       \026: Ring out
+       \027: From
+       \030: Connected
+       \031: Busy
+       \032: Line In Use
+       \033: Call Waiting
+       \034: Call Transfer
+       \035: Call Park
+       \036: Call Proceed
+       \037: In Use Remote
+       \040: Enter number
+       \041: Call park At
+       \042: Primary Only
+       \043: Temp Fail
+       \044: You Have VoiceMail
+       \045: Forwarded to
+       \046: Can Not Complete Conference
+       \047: No Conference Bridge
+       \050: Can Not Hold Primary Control
+       \051: Invalid Conference Participant
+       \052: In Conference Already
+       \053: No Participant Info
+       \054: Exceed Maximum Parties
+       \055: Key Is Not Active
+       \056: Error No License
+       \057: Error DBConfig
+       \060: Error Database
+       \061: Error Pass Limit
+       \062: Error Unknown
+       \063: Error Mismatch
+       \064: Conference
+       \065: Park Number
+       \066: Private
+       \067: Not Enough Bandwidth
+       \070: Unknown Number
+       \071: RmLstC
+       \072: Voicemail
+       \073: ImmDiv
+       \074: Intrcpt
+       \075: SetWtch
+       \076: TrnsfVM
+       \077: DND
+       \100: DivAll
+       \101: CallBack
+       \102: Network congestion,rerouting
+       \103: Barge
+       \104: Failed to setup Barge
+       \105: Another Barge exists
+       \106: Incompatible device type
+       \107: No Park Number Available
+       \110: CallPark Reversion
+       \111: Service is not Active
+       \112: High Traffic Try Again Later
+       \113: QRT
+       \114: MCID
+       \115: DirTrfr
+       \116: Select
+       \117: ConfList
+       \120: iDivert
+       \121: cBarge
+       \122: Can Not Complete Transfer
+       \123: Can Not Join Calls
+       \124: Mcid Successful
+       \125: Number Not Configured
+       \126: Security Error
+       \127: Video Bandwidth Unavailable
+       \130: VidMode
+       \131: Max Call Duration Timeout
+       \132: Max Hold Duration Timeout
+       \133: OPickUp
+       \134: ???
+       \135: ???
+       \136: ???
+       \137: ???
+       \140: ???
+       \141: External Transfer Restricted
+       \142: ???
+       \143: ???
+       \144: ???
+       \145: Mac Address
+       \146: Host Name
+       \147: Domain Name
+       \150: IP Address
+       \151: Subnet Mask
+       \152: TFTP Server 1
+       \153: Default Router 1
+       \154: Default Router 2
+       \155: Default Router 3
+       \156: Default Router 4
+       \157: Default Router 5
+       \160: DNS Server 1
+       \161: DNS Server 2
+       \162: DNS Server 3
+       \163: DNS Server 4
+       \164: DNS Server 5
+       \165: Operational VLAN Id
+       \166: Admin. VLAN Id
+       \167: CallManager 1
+       \170: CallManager 2
+       \171: CallManager 3
+       \172: CallManager 4
+       \173: CallManager 5
+       \174: Information URL
+       \175: Directories URL
+       \176: Messages URL
+       \177: Services URL
+ */
 
 struct soft_key_definitions {
 	const uint8_t mode;

Modified: team/group/CDRfix5/funcs/func_devstate.c
URL: http://svn.digium.com/view/asterisk/team/group/CDRfix5/funcs/func_devstate.c?view=diff&rev=79136&r1=79135&r2=79136
==============================================================================
--- team/group/CDRfix5/funcs/func_devstate.c (original)
+++ team/group/CDRfix5/funcs/func_devstate.c Fri Aug 10 17:37:25 2007
@@ -41,14 +41,9 @@
 #include "asterisk/linkedlists.h"
 #include "asterisk/devicestate.h"
 #include "asterisk/cli.h"
+#include "asterisk/astdb.h"
 
-struct custom_device {
-	int state;
-	AST_RWLIST_ENTRY(custom_device) entry;
-	char name[1];
-};
-
-static AST_RWLIST_HEAD_STATIC(custom_devices, custom_device);
+static const char astdb_family[] = "CustomDevstate";
 
 static int devstate_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
 {
@@ -59,8 +54,7 @@
 
 static int devstate_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
 {
-	struct custom_device *dev;
-	int len = strlen("Custom:");
+	size_t len = strlen("Custom:");
 
 	if (strncasecmp(data, "Custom:", len)) {
 		ast_log(LOG_WARNING, "The DEVSTATE function can only be used to set 'Custom:' device state!\n");
@@ -72,46 +66,25 @@
 		return -1;
 	}
 
-	AST_RWLIST_WRLOCK(&custom_devices);
-	AST_RWLIST_TRAVERSE(&custom_devices, dev, entry) {
-		if (!strcasecmp(dev->name, data))
-			break;
-	}
-	if (!dev) {
-		if (!(dev = ast_calloc(1, sizeof(*dev) + strlen(data) + 1))) {
-			AST_RWLIST_UNLOCK(&custom_devices);
-			return -1;
-		}
-		strcpy(dev->name, data);
-		AST_RWLIST_INSERT_HEAD(&custom_devices, dev, entry);
-	}
-	dev->state = ast_devstate_val(value);
-	ast_devstate_changed(dev->state, "Custom:%s", dev->name);
-	AST_RWLIST_UNLOCK(&custom_devices);
+	ast_db_put(astdb_family, data, value);
+
+	ast_devstate_changed(ast_devstate_val(value), "Custom:%s", data);
 
 	return 0;
 }
 
 static enum ast_device_state custom_devstate_callback(const char *data)
 {
-	struct custom_device *dev;
-	enum ast_device_state state = AST_DEVICE_UNKNOWN;
+	char buf[256] = "";
 
-	AST_RWLIST_RDLOCK(&custom_devices);
-	AST_RWLIST_TRAVERSE(&custom_devices, dev, entry) {
-		if (!strcasecmp(dev->name, data)) {
-			state = dev->state;	
-			break;
-		}
-	}
-	AST_RWLIST_UNLOCK(&custom_devices);
+	ast_db_get(astdb_family, data, buf, sizeof(buf));
 
-	return state;
+	return ast_devstate_val(buf);
 }
 
 static char *cli_funcdevstate_list(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
-	struct custom_device *dev;
+	struct ast_db_entry *db_entry, *db_tree;
 
 	switch (cmd) {
 	case CLI_INIT:
@@ -133,12 +106,18 @@
 	        "--- Custom Device States --------------------------------------------\n"
 	        "---------------------------------------------------------------------\n"
 	        "---\n");
-	AST_RWLIST_RDLOCK(&custom_devices);
-	AST_RWLIST_TRAVERSE(&custom_devices, dev, entry) {
+
+	db_entry = db_tree = ast_db_gettree(astdb_family, NULL);
+	for (; db_entry; db_entry = db_entry->next) {
+		const char *dev_name = strrchr(db_entry->key, '/') + 1;
+		if (dev_name <= (const char *) 1)
+			continue;
 		ast_cli(a->fd, "--- Name: 'Custom:%s'  State: '%s'\n"
-		               "---\n", dev->name, ast_devstate_str(dev->state));
+		               "---\n", dev_name, db_entry->data);
 	}
-	AST_RWLIST_UNLOCK(&custom_devices);
+	ast_db_freetree(db_tree);
+	db_tree = NULL;
+
 	ast_cli(a->fd,
 	        "---------------------------------------------------------------------\n"
 	        "---------------------------------------------------------------------\n"
@@ -178,17 +157,11 @@
 
 static int unload_module(void)
 {
-	struct custom_device *dev;
 	int res = 0;
 
 	res |= ast_custom_function_unregister(&devstate_function);
 	res |= ast_devstate_prov_del("Custom");
 	res |= ast_cli_unregister_multiple(cli_funcdevstate, ARRAY_LEN(cli_funcdevstate));
-
-	AST_RWLIST_WRLOCK(&custom_devices);
-	while ((dev = AST_RWLIST_REMOVE_HEAD(&custom_devices, entry)))
-		ast_free(dev);
-	AST_RWLIST_UNLOCK(&custom_devices);
 
 	return res;
 }
@@ -196,6 +169,20 @@
 static int load_module(void)
 {
 	int res = 0;
+	struct ast_db_entry *db_entry, *db_tree;
+
+	/* Populate the device state cache on the system with all of the currently
+	 * known custom device states. */
+	db_entry = db_tree = ast_db_gettree(astdb_family, NULL);
+	for (; db_entry; db_entry = db_entry->next) {
+		const char *dev_name = strrchr(db_entry->key, '/') + 1;
+		if (dev_name <= (const char *) 1)
+			continue;
+		ast_devstate_changed(ast_devstate_val(db_entry->data),
+			"Custom:%s\n", dev_name);
+	}
+	ast_db_freetree(db_tree);
+	db_tree = NULL;
 
 	res |= ast_custom_function_register(&devstate_function);
 	res |= ast_devstate_prov_add("Custom", custom_devstate_callback);

Modified: team/group/CDRfix5/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/team/group/CDRfix5/include/asterisk/channel.h?view=diff&rev=79136&r1=79135&r2=79136
==============================================================================
--- team/group/CDRfix5/include/asterisk/channel.h (original)
+++ team/group/CDRfix5/include/asterisk/channel.h Fri Aug 10 17:37:25 2007
@@ -1459,6 +1459,16 @@
  */
 void ast_channel_whisper_stop(struct ast_channel *chan);
 
+
+
+/*!
+  \brief return an english explanation of the code returned thru __ast_request_and_dial's 'outstate' argument
+  \param reason  The integer argument, usually taken from AST_CONTROL_ macros
+  \return char pointer explaining the code
+ */
+char *ast_channel_reason2str(int reason);
+
+
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif

Modified: team/group/CDRfix5/main/cdr.c
URL: http://svn.digium.com/view/asterisk/team/group/CDRfix5/main/cdr.c?view=diff&rev=79136&r1=79135&r2=79136
==============================================================================
--- team/group/CDRfix5/main/cdr.c (original)
+++ team/group/CDRfix5/main/cdr.c Fri Aug 10 17:37:25 2007
@@ -499,6 +499,7 @@
 		ast_cdr_busy(cdr);
 		break;
 	case AST_CAUSE_FAILURE:
+	case AST_CAUSE_NORMAL_CIRCUIT_CONGESTION:
 		ast_cdr_failed(cdr);
 		break;
 	case AST_CAUSE_NORMAL:

Modified: team/group/CDRfix5/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/group/CDRfix5/main/channel.c?view=diff&rev=79136&r1=79135&r2=79136
==============================================================================
--- team/group/CDRfix5/main/channel.c (original)
+++ team/group/CDRfix5/main/channel.c Fri Aug 10 17:37:25 2007
@@ -2902,6 +2902,29 @@
 			  &chan->writetrans, 1);
 }
 
+char *ast_channel_reason2str(int reason)
+{
+	switch (reason) /* the following appear to be the only ones actually returned by request_and_dial */
+	{
+	case 0:
+		return "Call Failure (not BUSY, and not NO_ANSWER, maybe Circuit busy or down?)";
+	case AST_CONTROL_HANGUP:
+		return "Hangup";
+	case AST_CONTROL_RING:
+		return "Local Ring";
+	case AST_CONTROL_RINGING:
+		return "Remote end Ringing";
+	case AST_CONTROL_ANSWER:
+		return "Remote end has Answered";
+	case AST_CONTROL_BUSY:
+		return "Remote end is Busy";
+	case AST_CONTROL_CONGESTION:
+		return "Congestion (circuits busy)";
+	default:
+		return "Unknown Reason!!";
+	}
+}
+
 struct ast_channel *__ast_request_and_dial(const char *type, int format, void *data, int timeout, int *outstate, const char *cid_num, const char *cid_name, struct outgoing_helper *oh)
 {
 	int dummy_outstate;

Modified: team/group/CDRfix5/main/dial.c
URL: http://svn.digium.com/view/asterisk/team/group/CDRfix5/main/dial.c?view=diff&rev=79136&r1=79135&r2=79136
==============================================================================
--- team/group/CDRfix5/main/dial.c (original)
+++ team/group/CDRfix5/main/dial.c Fri Aug 10 17:37:25 2007
@@ -289,6 +289,8 @@
 		ast_hangup(channel->owner);
 		channel->owner = NULL;
 	} else {
+		if (chan)
+			ast_poll_channel_add(chan, channel->owner);
 		res = 1;
 		ast_verb(3, "Called %s\n", numsubst);
 	}
@@ -595,6 +597,8 @@
 				set_state(dial, AST_DIAL_RESULT_HANGUP);
 				break;
 			}
+			if (chan)
+				ast_poll_channel_del(chan, channel->owner);
 			ast_hangup(who);
 			channel->owner = NULL;
 			continue;
@@ -616,6 +620,8 @@
 		AST_LIST_TRAVERSE(&dial->channels, channel, list) {
 			if (!channel->owner || channel->owner == who)
 				continue;
+			if (chan)
+				ast_poll_channel_del(chan, channel->owner);
 			ast_hangup(channel->owner);
 			channel->owner = NULL;
 		}
@@ -632,6 +638,8 @@
 		AST_LIST_TRAVERSE(&dial->channels, channel, list) {
 			if (!channel->owner)
 				continue;
+			if (chan)
+				ast_poll_channel_del(chan, channel->owner);
 			ast_hangup(channel->owner);
 			channel->owner = NULL;
 		}

Modified: team/group/CDRfix5/pbx/pbx_spool.c
URL: http://svn.digium.com/view/asterisk/team/group/CDRfix5/pbx/pbx_spool.c?view=diff&rev=79136&r1=79135&r2=79136
==============================================================================
--- team/group/CDRfix5/pbx/pbx_spool.c (original)
+++ team/group/CDRfix5/pbx/pbx_spool.c Fri Aug 10 17:37:25 2007
@@ -336,7 +336,7 @@
 		res = ast_pbx_outgoing_exten(o->tech, AST_FORMAT_SLINEAR, o->dest, o->waittime * 1000, o->context, o->exten, o->priority, &reason, 2 /* wait to finish */, o->cid_num, o->cid_name, o->vars, o->account, NULL);
 	}
 	if (res) {
-		ast_log(LOG_NOTICE, "Call failed to go through, reason %d\n", reason);
+		ast_log(LOG_NOTICE, "Call failed to go through, reason (%d) %s\n", reason, ast_channel_reason2str(reason));
 		if (o->retries >= o->maxretries + 1) {
 			/* Max retries exceeded */
 			ast_log(LOG_EVENT, "Queued call to %s/%s expired without completion after %d attempt%s\n", o->tech, o->dest, o->retries - 1, ((o->retries - 1) != 1) ? "s" : "");




More information about the asterisk-commits mailing list