For outgoing [client] invites the invite should have the local tag already and is put in the map using the localtag. For incoming [server] invites, we add the call dialog initially without the local tag, then later add the localtag to the key when we get the ACK.
| 153 | // For incoming [server] invites, we add the call dialog initially without the local tag, then later add the localtag to the key |
| 154 | // when we get the ACK. |
| 155 | void SipDialogMap::dmAddCallDialog(SipDialog*dialog) |
| 156 | { |
| 157 | string callid = dialog->callId(); |
| 158 | string key = makeTagKey(callid, dialog->dgIsServer() ? string("") : dialog->dsLocalTag()); |
| 159 | //SipDialog *previous = mDialogMap.read(key,2000); // why was this blocking? |
| 160 | SipDialog *previous = mDialogMap.readNoBlock(key); |
| 161 | LOG(DEBUG) <<LOGVAR(key); |
| 162 | if (previous) { |
| 163 | dmRemoveDialog(previous); |
| 164 | if (dialog->mIsHandover) { |
| 165 | // What happened is the dialog went to another BTS and is now coming back before |
| 166 | // the previous dialog has completely timed out. We must destroy the old dialog immediately. |
| 167 | } else { |
| 168 | LOG(ERR) << "Adding duplicate dialog."<<LOGVAR(previous)<<LOGVAR(dialog); |
| 169 | } |
| 170 | } |
| 171 | mDialogMap.write(key,dialog); |
| 172 | } |
| 173 | |
| 174 | |
| 175 | #if UNUSED |
no test coverage detected