]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix double alerting, add forced alerting before answer
authorAlexandr Anikin <may@telecom-service.ru>
Wed, 1 Jun 2011 10:40:19 +0000 (10:40 +0000)
committerAlexandr Anikin <may@telecom-service.ru>
Wed, 1 Jun 2011 10:40:19 +0000 (10:40 +0000)
Fix double alerting (it wasn't fixed here by issue #18542)
Add forced alerting before connect (if it wasn't before)
Try to send all packets from outgoing queue rather than one only
Call goes into clearing state when disconnect command is received

(closes issue #19361)
Reported by: vmikhelson
Patches:
      issue19361-3.patch uploaded by may213 (license 454)
Tested by: vmikhelson

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@321528 65c4cc65-6c06-0410-ace0-fbb531ad65f3

addons/chan_ooh323.c
addons/ooh323c/src/oochannels.c
addons/ooh323c/src/ooh245.c

index 9e933fd2d05ce6956ce19247c90ca2104078ee51..5116ade9663baf63b8576b53e6fd4d08614152c1 100644 (file)
@@ -1079,6 +1079,7 @@ static int ooh323_hangup(struct ast_channel *ast)
 static int ooh323_answer(struct ast_channel *ast)
 {
        struct ooh323_pvt *p = ast->tech_pvt;
+       char *callToken = (char *)NULL;
 
        if (gH323Debug)
                ast_verbose("--- ooh323_answer\n");
@@ -1086,8 +1087,18 @@ static int ooh323_answer(struct ast_channel *ast)
        if (p) {
 
                ast_mutex_lock(&p->lock);
+               callToken = (p->callToken ? strdup(p->callToken) : NULL);
                if (ast->_state != AST_STATE_UP) {
                        ast_channel_lock(ast);
+                       if (!p->alertsent) {
+                               if (gH323Debug) {
+                                       ast_debug(1, "Sending forced ringback for %s, res = %d\n", 
+                                               callToken, ooManualRingback(callToken));
+                               } else {
+                                       ooManualRingback(callToken);
+                               }
+                               p->alertsent = 1;
+                       }
                        ast_setstate(ast, AST_STATE_UP);
                        if (option_debug)
                                ast_debug(1, "ooh323_answer(%s)\n", ast->name);
@@ -1252,6 +1263,7 @@ static int ooh323_indicate(struct ast_channel *ast, int condition, const void *d
                        } else {
                                        ooManualRingback(callToken);
                        }
+                       p->alertsent = 1;
                }
            }
         break;
index e16fdcc06572af1b5a67336fc7d1ff36d695fcc3..8fa8510c3f88b1b10c18dc5b34a0fb5519a21610 100644 (file)
@@ -671,10 +671,11 @@ int ooProcessCallFDSETsAndTimers
 
     if (0 != call->pH245Channel && 0 != call->pH245Channel->sock)
     {
-     if(call->pH245Channel->outQueue.count>0)
-     {                           
-      if(ooPDWrite(pfds, nfds, call->pH245Channel->sock))
-       ooSendMsg(call, OOH245MSG);
+     if(ooPDWrite(pfds, nfds, call->pH245Channel->sock)) {
+      while (call->pH245Channel->outQueue.count>0) {
+       if (ooSendMsg(call, OOH245MSG) != OO_OK)
+       break;
+      }
      }
     }
     else if(call->h245listener)
@@ -691,20 +692,23 @@ int ooProcessCallFDSETsAndTimers
     {
      if(ooPDWrite(pfds, nfds, call->pH225Channel->sock))
      {
-      if(call->pH225Channel->outQueue.count>0)
+      while (call->pH225Channel->outQueue.count>0)
       {
        OOTRACEDBGC3("Sending H225 message (%s, %s)\n", 
                         call->callType, call->callToken);
-       ooSendMsg(call, OOQ931MSG);
+       if (ooSendMsg(call, OOQ931MSG) != OO_OK)
+       break;
       }
       if(call->pH245Channel && 
          call->pH245Channel->outQueue.count>0 && 
-        OO_TESTFLAG (call->flags, OO_M_TUNNELING))
-      {
+        OO_TESTFLAG (call->flags, OO_M_TUNNELING)) {
+       while (call->pH245Channel->outQueue.count>0) {
         OOTRACEDBGC3("H245 message needs to be tunneled. "
                           "(%s, %s)\n", call->callType, 
                                call->callToken);
-        ooSendMsg(call, OOH245MSG);
+        if (ooSendMsg(call, OOH245MSG) != OO_OK)
+        break;
+       }
       }
      }                                
     }
@@ -1319,7 +1323,7 @@ int ooSendMsg(OOH323CallData *call, int type)
    {
       OOTRACEDBGA3("Warning:Call marked for cleanup. Can not send message."
                    "(%s, %s)\n", call->callType, call->callToken);
-      return OO_OK;
+      return OO_FAILED;
    }
 
    if(type == OOQ931MSG)
index 687e07eb53f71cccb7d0558458554f7194f177e5..ec7951e013f796f37271ebe778ab69556147a0b4 100644 (file)
@@ -2074,6 +2074,8 @@ int ooHandleH245Command(OOH323CallData *call,
                ooClearAllLogicalChannels(call);
             }
             ooSendEndSessionCommand(call);
+           if (call->callState < OO_CALL_CLEAR)
+               call->callState = OO_CALL_CLEAR;
          }