Find a dialog from an incoming Message. An outgoing INVITE has a local tag immediately, which is returned by the peer. An incoming INVITE does not have a local tag yet until the ACK is received, so ACK must be handled specially.
| 98 | // An outgoing INVITE has a local tag immediately, which is returned by the peer. |
| 99 | // An incoming INVITE does not have a local tag yet until the ACK is received, so ACK must be handled specially. |
| 100 | SipDialog *SipDialogMap::findDialogByMsg(SipMessage *msg) |
| 101 | { |
| 102 | // This is an incoming message, so if there is a code then it is a reply so the Dialog was outbound. |
| 103 | string callid = msg->smGetCallId(), localtag = msg->smGetLocalTag(); |
| 104 | string key = makeTagKey(callid,localtag); |
| 105 | SipDialog *dialog = mDialogMap.readNoBlock(key); |
| 106 | if (! dialog && msg->isACK()) { |
| 107 | // For ACK try without the local tag. |
| 108 | // The ACK and all subsequent messages from the peer include our local tag that it regurgitates. |
| 109 | key = makeTagKey(callid,""); |
| 110 | dialog = mDialogMap.readNoBlock(key); |
| 111 | } |
| 112 | return dialog; |
| 113 | } |
| 114 | |
| 115 | // Add the local tag to the lookup key for this dialog. |
| 116 | void SipDialogMap::dmAddLocalTag(SipDialog *dialog) |
nothing calls this directly
no test coverage detected