Warning: This assumes the cause message is a SIP request, not a SIP response.
| 445 | |
| 446 | // Warning: This assumes the cause message is a SIP request, not a SIP response. |
| 447 | void SipInterface::newSendEarlyError(SipMessage *cause, int code, const char * reason) |
| 448 | { |
| 449 | // If the message that caused the error is a 400 class error response, we must not send |
| 450 | // a response error to prevent a fast infinite message loop with the peer. |
| 451 | // In fact, we will ignore any response, and only return errors to requests. |
| 452 | if (cause->smGetCode() != 0) { return; } // Ignore responses. |
| 453 | |
| 454 | IPAddressSpec peer; |
| 455 | if (! peer.ipSet(cause->smGetProxy(),"incoming SIP message")) { |
| 456 | return; // If the peer address is invalid, not much else we can do about it. |
| 457 | } |
| 458 | SipMessageReply err(cause,code,string(reason),NULL); |
| 459 | siWrite(&peer.mipSockAddr,&err); |
| 460 | } |
| 461 | |
| 462 | |
| 463 |
nothing calls this directly
no test coverage detected