[Asterisk-cvs] asterisk/channels chan_mgcp.c,1.61,1.62

markster at lists.digium.com markster at lists.digium.com
Sat Jul 24 21:34:16 CDT 2004


Update of /usr/cvsroot/asterisk/channels
In directory localhost.localdomain:/tmp/cvs-serv15167/channels

Modified Files:
	chan_mgcp.c 
Log Message:
Create one generally useful runtime option and one compile time option to work around bugs in the DPH100M phone (bug #2122)


Index: chan_mgcp.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_mgcp.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- chan_mgcp.c	17 Jul 2004 20:58:00 -0000	1.61
+++ chan_mgcp.c	25 Jul 2004 01:20:15 -0000	1.62
@@ -93,6 +93,12 @@
 #define IPTOS_MINCOST 0x02
 #endif
 
+/*
+ * Define to work around buggy dlink MGCP phone firmware which
+ * appears not to know that "rt" is part of the "G" package.
+ */
+/* #define DLINK_BUGGY_FIRMWARE	 */
+
 #define MGCPDUMPER
 #define DEFAULT_EXPIREY 120
 #define MAX_EXPIREY     3600
@@ -174,6 +180,8 @@
 
 static int callreturn = 0;
 
+static int slowsequence = 0;
+
 static int threewaycalling = 0;
 
 /* This is for flashhook transfers */
@@ -363,6 +371,7 @@
 	int dtmfinband;
 	int amaflags;
 	int type;
+	int slowsequence;				  /* MS: Sequence the endpoint as a whole */
 	int group;
 	int iseq; /* Not used? */
 	int lastout; /* tracking this on the subchannels.  Is it needed here? */
@@ -703,6 +712,12 @@
 	char iabuf[INET_ADDRSTRLEN];
     ast_mutex_t *l;
 
+	ast_log(LOG_DEBUG, "Slow sequence is %d\n", p->slowsequence);
+	if (p->slowsequence) {
+		queue = &p->cmd_queue;
+		l = &p->cmd_queue_lock;
+		ast_mutex_lock(l);
+	} else
     switch (req->cmd) {
         case MGCP_CMD_DLCX:
             queue = &sub->cx_queue;
@@ -1181,7 +1196,11 @@
     }
 	switch(ind) {
 	case AST_CONTROL_RINGING:
+#ifdef DLINK_BUGGY_FIRMWARE	
+		transmit_notify_request(sub, "rt");
+#else
 		transmit_notify_request(sub, "G/rt");
+#endif		
 		break;
 	case AST_CONTROL_BUSY:
 		transmit_notify_request(sub, "L/bz");
@@ -2209,7 +2228,9 @@
         return;
     }
 
-    if (sub)
+	if (p->slowsequence) 
+		req = find_command(p, sub, &p->cmd_queue, &p->cmd_queue_lock, ident);
+	else if (sub)
         req = find_command(p, sub, &sub->cx_queue, &sub->cx_queue_lock, ident);
     else if (!(req = find_command(p, sub, &p->rqnt_queue, &p->rqnt_queue_lock, ident)))
         req = find_command(p, sub, &p->cmd_queue, &p->cmd_queue_lock, ident);
@@ -2746,7 +2767,11 @@
             }
             if (p->immediate) {
                 /* The channel is immediately up.  Start right away */
-                transmit_notify_request(sub, "G/rt");
+#ifdef DLINK_BUGGY_FIRMWARE	
+				transmit_notify_request(sub, "rt");
+#else
+				transmit_notify_request(sub, "G/rt");
+#endif		
                 c = mgcp_new(sub, AST_STATE_RING);
                 if (!c) {
                     ast_log(LOG_WARNING, "Unable to start PBX on channel %s@%s\n", p->name, p->parent->name);
@@ -3465,6 +3490,8 @@
                 immediate = ast_true(v->value);
             } else if (!strcasecmp(v->name, "callwaiting")) {
                 callwaiting = ast_true(v->value);
+            } else if (!strcasecmp(v->name, "slowsequence")) {
+                slowsequence = ast_true(v->value);
             } else if (!strcasecmp(v->name, "transfer")) {
                 transfer = ast_true(v->value);
             } else if (!strcasecmp(v->name, "threewaycalling")) {
@@ -3518,6 +3545,7 @@
             		e->cancallforward = cancallforward;
             		e->canreinvite = canreinvite;
             		e->callwaiting = callwaiting;
+            		e->slowsequence = slowsequence;
             		e->transfer = transfer;
             		e->threewaycalling = threewaycalling;
             		e->onhooktime = time(NULL);
@@ -3615,6 +3643,7 @@
                     e->cancallforward = cancallforward;
                     e->canreinvite = canreinvite;
                     e->callwaiting = callwaiting;
+            		e->slowsequence = slowsequence;
                     e->transfer = transfer;
                     e->threewaycalling = threewaycalling;
                     if (!ep_reload) {




More information about the svn-commits mailing list