From: Steven S. <ss...@so...> - 2004-01-13 17:54:06
|
I have narrowed the section of the code where the inbound call messages are being lost to a particular sub-section of the Ok. I have narrowed the iax_header_to_event function. My simple logging seems to have trapped where the error is occurring. Now, I need somebody with more experience to help me figure out WHY we are getting these errors. [FYI - I DO have the latest version of the code with all of Steve Underwood's changes] Here is my trace: 7897468 Log Message-> Processing Message... 7897484 Log Message-> Packet arrived out of order (expecting 2, got 0) (frametype = 6, subclass = 1) 7897500 Log Message-> Sending Ack Anyway! 7897500 Log Message-> Returning Null! Exiting In ReSend Section! 7899468 Log Message-> Processing Message... 7899484 Log Message-> Packet arrived out of order (expecting 2, got 0) (frametype = 6, subclass = 1) 7899484 Log Message-> Sending Ack Anyway! 7899500 Log Message-> Returning Null! Exiting In ReSend Section! 7904203 Log Message-> Processing Message... 7904218 Log Message-> Packet arrived out of order (expecting 2, got 1) (frametype = 6, subclass = 5) 7904234 Log Message-> Sending Ack Anyway! 7904234 Log Message-> Returning Null! Exiting In ReSend Section! [FYI - The numbers to the left of the trace are approximate ms since bootup from the GetTickCount() Win32 function.] This is coming in the iax_header_to_event function in a section with a comment that says "Check where we are". It appears to be validating the packet arrival sequence. The above trace shows an out-of-order arrival of two IAX_COMMAND_NEW messages, and an IAX_COMMAND_HANGUP message when the non-working call is abandoned at the far end. [See below for a copy of the code as I am using it...] Can anybody tell me what would cause the parser to view the incoming COMMAND_NEW messages as out-of-order. The "expecting 2, got 0" makes it look like it was expecting some kind of confirmation for a previous action or message? Can we safely bypass this? Steve, Steve, Michael, Dan - do you guys know what the preceding message and why we failed to receive it? Thanks! Steve Sokol Sokol & Associates, LLC [My Code Including The Debugging. Attached is the iax.c file from my system.] /* Check where we are */ if (ntohs(fh->dcallno) & IAX_FLAG_RETRANS) updatehistory = 0; if ((session->iseqno != fh->oseqno) && (session->iseqno || ((subclass != IAX_COMMAND_TXCNT) && (subclass != IAX_COMMAND_TXACC)) || (subclass != AST_FRAME_IAX))) { if ( ((subclass != IAX_COMMAND_ACK) && (subclass != IAX_COMMAND_INVAL) && (subclass != IAX_COMMAND_TXCNT) && (subclass != IAX_COMMAND_TXACC) && (subclass != IAX_COMMAND_VNAK)) || (fh->type != AST_FRAME_IAX)) { /* If it's not an ACK packet, it's out of order. */ DEBU(G "Packet arrived out of order (expecting %d, got %d) (frametype = %d, subclass = %d)\n", session->iseqno, fh->oseqno, fh->type, subclass); char Error[200]; sprintf(Error, "Packet arrived out of order (expecting %d, got %d) (frametype = %d, subclass = %d)\n", session->iseqno, fh->oseqno, fh->type, subclass); iax_debug_log((LPCSTR) Error); if (session->iseqno > fh->oseqno) { /* If we've already seen it, ack it XXX There's a border condition here XXX */ if ((fh->type != AST_FRAME_IAX) || ((subclass != IAX_COMMAND_ACK) && (subclass != IAX_COMMAND_INVAL))) { DEBU(G "Acking anyway\n"); iax_debug_log("Sending Ack Anyway!"); /* XXX Maybe we should handle its ack to us, but then again, it's probably outdated anyway, and if we have anything to send, we'll retransmit and get an ACK back anyway XXX */ send_command_immediate(session, AST_FRAME_IAX, IAX_COMMAND_ACK, ts, NULL, 0,fh->iseqno); } else { iax_debug_log("Sending Absolutely Nothing..."); } } else { /* Send a VNAK requesting retransmission */ iax_debug_log("Sending Vnak!"); iax2_vnak(session); } iax_debug_log("Returning Null! Exiting In ReSend Section!"); return NULL; //****** THIS IS WHERE WE EXIT WITH NO EVENT BEING GENERATED!!! } } else { /* Increment unless it's an ACK or VNAK */ if (((subclass != IAX_COMMAND_ACK) && (subclass != IAX_COMMAND_INVAL) && (subclass != IAX_COMMAND_TXCNT) && (subclass != IAX_COMMAND_TXACC) && (subclass != IAX_COMMAND_VNAK)) || (fh->type != AST_FRAME_IAX)) session->iseqno++; } |