Revision
16494
Author
gmaruzz
Date
2010-01-24 05:04:07 -0600 (Sun, 24 Jan 2010)

Log Message

gsmopen: asterisk, let's break out of a loop in case we cannot send a signal (particularly in case an 'ATH' is not answered by an 'OK' but by a 'NO CARRIER'

Modified Paths

Diff

Modified: freeswitch/branches/gmaruzz/mod_gsmopen/asterisk/celliax_additional.c (16493 => 16494)


--- freeswitch/branches/gmaruzz/mod_gsmopen/asterisk/celliax_additional.c	2010-01-24 09:06:20 UTC (rev 16493)
+++ freeswitch/branches/gmaruzz/mod_gsmopen/asterisk/celliax_additional.c	2010-01-24 11:04:07 UTC (rev 16494)
@@ -1487,6 +1487,8 @@
         if (option_debug > 1)
           DEBUGA_AT("|%s| CALLFLOW_CALL_NOCARRIER\n", CELLIAX_P_LOG,
                     p->line_array.result[i]);
+	p->control_to_send = 0;
+	usleep(20000);
         if (p->interface_state != AST_STATE_DOWN && p->owner) {
           p->owner->hangupcause = AST_CAUSE_FAILURE;
           celliax_queue_control(p->owner, AST_CONTROL_HANGUP);
@@ -2160,7 +2162,8 @@
           at_ack = AT_OK;
         }
       } else {
-        if ((strcmp(p->line_array.result[i], "OK") == 0)) {
+        //if ((strcmp(p->line_array.result[i], "OK") == 0)) {
+        if ((strcmp(p->line_array.result[i], "OK") == 0) || (strcmp(p->line_array.result[i], "NO CARRIER") == 0) ) {
           if (option_debug > 1)
             DEBUGA_AT("got OK\n", CELLIAX_P_LOG);
           at_ack = AT_OK;

Modified: freeswitch/branches/gmaruzz/mod_gsmopen/asterisk/chan_celliax.c (16493 => 16494)


--- freeswitch/branches/gmaruzz/mod_gsmopen/asterisk/chan_celliax.c	2010-01-24 09:06:20 UTC (rev 16493)
+++ freeswitch/branches/gmaruzz/mod_gsmopen/asterisk/chan_celliax.c	2010-01-24 11:04:07 UTC (rev 16494)
@@ -454,6 +454,7 @@
 int celliax_queue_control(struct ast_channel *c, int control)
 {
   struct celliax_pvt *p = c->tech_pvt;
+  int times;
 
 /* queue the frame */
   if (p)
@@ -463,8 +464,15 @@
   DEBUGA_PBX("Queued CONTROL FRAME %d\n", CELLIAX_P_LOG, control);
 
 /* wait for the frame to be sent */
-  while (p->control_to_send)
-    usleep(1);
+  while (p->control_to_send){
+    usleep(1000);
+    times++;
+    if(times == 1000){
+	    ERRORA("Queued CONTROL FRAME %d FAILED to be sent\n", CELLIAX_P_LOG, control);
+	    p->control_to_send = 0;
+	    break;
+    }
+  }
 
   return 0;
 }