more changes to properly copy the call token and a small code optimization
authorJeremy McNamara <jj@nufone.net>
Wed, 21 Jul 2004 16:36:10 +0000 (16:36 +0000)
committerJeremy McNamara <jj@nufone.net>
Wed, 21 Jul 2004 16:36:10 +0000 (16:36 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3489 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/h323/ast_h323.cpp

index 0e52068..85b4e98 100755 (executable)
@@ -566,7 +566,9 @@ BOOL MyH323Connection::OnReceivedSignalSetup(const H323SignalPDU & setupPDU)
 
 
        cd.call_reference = GetCallReference();
+       Lock();
        cd.call_token = strdup((const char *)GetCallToken());
+       Unlock();
        cd.call_source_aliases  =  strdup((const char *)sourceAliases);
        cd.call_dest_alias = strdup((const char *)destAliases);
        cd.call_source_e164 = strdup((const char *)sourceE164);
@@ -617,12 +619,14 @@ BOOL MyH323Connection::OnSendSignalSetup(H323SignalPDU & setupPDU)
        if ((s1 = strchr(destAliases, '\t')) != NULL)
                *s1 = '\0';
 
-       cd.call_reference               = GetCallReference();
-       cd.call_token                   = strdup((const char *)GetCallToken());
-       cd.call_source_aliases          = strdup((const char *)sourceAliases);
-       cd.call_dest_alias              = strdup((const char *)destAliases);
-       cd.call_source_e164             = strdup((const char *)sourceE164);
-       cd.call_dest_e164               = strdup((const char *)destE164);
+       cd.call_reference = GetCallReference();
+       Lock();
+       cd.call_token = strdup((const char *)GetCallToken());
+       Unlock();
+       cd.call_source_aliases = strdup((const char *)sourceAliases);
+       cd.call_dest_alias = strdup((const char *)destAliases);
+       cd.call_source_e164 = strdup((const char *)sourceE164);
+       cd.call_dest_e164 = strdup((const char *)destE164);
 
        int res = on_outgoing_call(cd); 
                
@@ -1181,15 +1185,12 @@ int h323_answering_call(const char *token, int busy)
                return -1;
        }
 
-       if (!busy){
+       if (!busy) {
                connection->AnsweringCall(H323Connection::AnswerCallNow);
-               connection->Unlock();
-
        } else {
                connection->AnsweringCall(H323Connection::AnswerCallDenied);
-               connection->Unlock();
-       };
-
+       }
+       connection->Unlock();
        return 0;
 }