| 1694 | } |
| 1695 | |
| 1696 | void call::terminate(CStat::E_Action reason) |
| 1697 | { |
| 1698 | char reason_str[100]; |
| 1699 | |
| 1700 | stopListening(); |
| 1701 | |
| 1702 | // Call end -> was it successful? |
| 1703 | if(call::last_action_result != call::E_AR_NO_ERROR) { |
| 1704 | switch(call::last_action_result) { |
| 1705 | case call::E_AR_REGEXP_DOESNT_MATCH: |
| 1706 | computeStat(CStat::E_CALL_FAILED); |
| 1707 | computeStat(CStat::E_FAILED_REGEXP_DOESNT_MATCH); |
| 1708 | if (deadcall_wait && !initCall) { |
| 1709 | sprintf(reason_str, "regexp match failure at index %d", msg_index); |
| 1710 | new deadcall(id, reason_str); |
| 1711 | } |
| 1712 | break; |
| 1713 | case call::E_AR_REGEXP_SHOULDNT_MATCH: |
| 1714 | computeStat(CStat::E_CALL_FAILED); |
| 1715 | computeStat(CStat::E_FAILED_REGEXP_SHOULDNT_MATCH); |
| 1716 | if (deadcall_wait && !initCall) { |
| 1717 | sprintf(reason_str, "regexp matched, but shouldn't at index %d", msg_index); |
| 1718 | new deadcall(id, reason_str); |
| 1719 | } |
| 1720 | break; |
| 1721 | case call::E_AR_HDR_NOT_FOUND: |
| 1722 | computeStat(CStat::E_CALL_FAILED); |
| 1723 | computeStat(CStat::E_FAILED_REGEXP_HDR_NOT_FOUND); |
| 1724 | if (deadcall_wait && !initCall) { |
| 1725 | sprintf(reason_str, "regexp header not found at index %d", msg_index); |
| 1726 | new deadcall(id, reason_str); |
| 1727 | } |
| 1728 | break; |
| 1729 | case E_AR_CONNECT_FAILED: |
| 1730 | computeStat(CStat::E_CALL_FAILED); |
| 1731 | computeStat(CStat::E_FAILED_TCP_CONNECT); |
| 1732 | if (deadcall_wait && !initCall) { |
| 1733 | sprintf(reason_str, "connection failed %d", msg_index); |
| 1734 | new deadcall(id, reason_str); |
| 1735 | } |
| 1736 | break; |
| 1737 | case E_AR_RTPECHO_ERROR: |
| 1738 | computeStat(CStat::E_CALL_FAILED); |
| 1739 | setRtpEchoErrors(1); |
| 1740 | if (deadcall_wait && !initCall) { |
| 1741 | sprintf(reason_str, "rtp echo error %d", msg_index); |
| 1742 | new deadcall(id, reason_str); |
| 1743 | } |
| 1744 | break; |
| 1745 | case call::E_AR_NO_ERROR: |
| 1746 | case call::E_AR_STOP_CALL: |
| 1747 | /* Do nothing. */ |
| 1748 | break; |
| 1749 | case call::E_AR_TEST_DOESNT_MATCH: |
| 1750 | computeStat(CStat::E_CALL_FAILED); |
| 1751 | computeStat(CStat::E_FAILED_TEST_DOESNT_MATCH); |
| 1752 | if (deadcall_wait && !initCall) { |
| 1753 | sprintf(reason_str, "test failure at index %d", msg_index); |
nothing calls this directly
no outgoing calls
no test coverage detected