If you have a table of transactions by transaction keys (To, From, Call-ID, CSeq), you should be sure to have the direction of the request (sent or received) as part of the key, or use separate transaction tables even for incoming and outgoing requests.
If you have a table of calls by Call-ID only, you will run into problems as you may think this is a re-INVITE for the same call. You really want the incoming and outgoing messages to be associated with totally different calls. It can be distinguished as a separate call if, again, you allow for direction in your lookups. There are many ways to do this; the easiest is to include your local address as part of the call key. For incoming requests, the key is callID + from, for outgoing, callID+ to.
|