Fixes instances where an array should have been deleted but wasn't.
From: Erik Hovland <erik@hovland.org>
---
mythplugins/mythphone/mythphone/phoneui.cpp | 4 -
mythplugins/mythphone/mythphone/sipfsm.cpp | 140 ++++++++++++++++-----------
2 files changed, 87 insertions(+), 57 deletions(-)
diff --git a/mythplugins/mythphone/mythphone/phoneui.cpp b/mythplugins/mythphone/mythphone/phoneui.cpp
index 58ca079..3c502ef 100644
a
|
b
|
void PhoneUIBox::menuHistorySave(void) |
1389 | 1389 | CallRecord *crEntry = |
1390 | 1390 | DirContainer->fetchCallRecordById(Current->getAttribute(1)); |
1391 | 1391 | |
1392 | | DirEntry *entry = |
1393 | | DirContainer->FindMatchingDirectoryEntry(crEntry->getUri()); |
1394 | 1392 | |
1395 | 1393 | if (crEntry != 0) |
1396 | 1394 | { |
| 1395 | DirEntry *entry = |
| 1396 | DirContainer->FindMatchingDirectoryEntry(crEntry->getUri()); |
1397 | 1397 | if (entry != 0) |
1398 | 1398 | { |
1399 | 1399 | // Tell the user one exists |
diff --git a/mythplugins/mythphone/mythphone/sipfsm.cpp b/mythplugins/mythphone/mythphone/sipfsm.cpp
index 6ea457a..61ad11f 100644
a
|
b
|
int SipCall::FSM(int Event, SipMsg *sipMsg, void *Value) |
1731 | 1731 | switch (Event | State) |
1732 | 1732 | { |
1733 | 1733 | case SIP_IDLE_BYE: |
1734 | | BuildSendStatus(481, "BYE", sipMsg->getCSeqValue()); |
| 1734 | if (sipMsg != 0) |
| 1735 | BuildSendStatus(481, "BYE", sipMsg->getCSeqValue()); |
1735 | 1736 | //481 Call/Transaction does not exist |
1736 | 1737 | State = SIP_IDLE; |
1737 | 1738 | break; |
… |
… |
int SipCall::FSM(int Event, SipMsg *sipMsg, void *Value) |
1739 | 1740 | case SIP_IDLE_INVITESTATUS_2xx: |
1740 | 1741 | case SIP_IDLE_INVITESTATUS_3456: |
1741 | 1742 | // Check if we are being a proxy |
1742 | | if (sipMsg->getViaIp() == sipLocalIP) |
| 1743 | if (sipMsg != 0 && sipMsg->getViaIp() == sipLocalIP) |
1743 | 1744 | { |
1744 | 1745 | ForwardMessage(sipMsg); |
1745 | 1746 | State = SIP_IDLE; |
… |
… |
int SipCall::FSM(int Event, SipMsg *sipMsg, void *Value) |
1772 | 1773 | State = SIP_OCONNECTING1; |
1773 | 1774 | break; |
1774 | 1775 | case SIP_IDLE_INVITE: |
1775 | | cseq = sipMsg->getCSeqValue(); |
| 1776 | if (sipMsg != 0) |
| 1777 | cseq = sipMsg->getCSeqValue(); |
1776 | 1778 | #ifdef SIPREGISTRAR |
1777 | | if ((toUrl->getUser() == sipUsername)) && |
| 1779 | if ((toUrl->getUser() == sipUsername) && |
1778 | 1780 | (toUrl->getHost() == "Volkaerts")) |
1779 | 1781 | #endif |
1780 | 1782 | { |
… |
… |
int SipCall::FSM(int Event, SipMsg *sipMsg, void *Value) |
1782 | 1784 | if (parent->numCalls() > 1) |
1783 | 1785 | { |
1784 | 1786 | // 486 Busy Here |
1785 | | BuildSendStatus(486, "INVITE", sipMsg->getCSeqValue()); |
| 1787 | if (sipMsg != 0) |
| 1788 | BuildSendStatus(486, "INVITE", sipMsg->getCSeqValue()); |
| 1789 | |
1786 | 1790 | State = SIP_DISCONNECTING; |
1787 | 1791 | } |
1788 | 1792 | else |
1789 | 1793 | { |
1790 | | GetSDPInfo(sipMsg); |
1791 | | // INVITE had a codec we support; proces |
1792 | | if (audioPayloadIdx != -1) |
1793 | | { |
1794 | | AlertUser(sipMsg); |
1795 | | BuildSendStatus(100, "INVITE", sipMsg->getCSeqValue(), |
1796 | | SIP_OPT_CONTACT | SIP_OPT_TIMESTAMP); |
1797 | | // 100 Trying |
1798 | | BuildSendStatus(180, "INVITE", sipMsg->getCSeqValue(), |
1799 | | SIP_OPT_CONTACT); //180 Ringing |
1800 | | State = SIP_ICONNECTING; |
1801 | | } |
1802 | | else |
| 1794 | if (sipMsg != 0) |
1803 | 1795 | { |
1804 | | BuildSendStatus(488, "INVITE", sipMsg->getCSeqValue()); |
1805 | | // 488 Not Acceptable Here |
1806 | | State = SIP_DISCONNECTING; |
| 1796 | GetSDPInfo(sipMsg); |
| 1797 | |
| 1798 | // INVITE had a codec we support; proces |
| 1799 | if (audioPayloadIdx != -1) |
| 1800 | { |
| 1801 | AlertUser(sipMsg); |
| 1802 | BuildSendStatus(100, "INVITE", sipMsg->getCSeqValue(), |
| 1803 | SIP_OPT_CONTACT | SIP_OPT_TIMESTAMP); |
| 1804 | // 100 Trying |
| 1805 | BuildSendStatus(180, "INVITE", sipMsg->getCSeqValue(), |
| 1806 | SIP_OPT_CONTACT); //180 Ringing |
| 1807 | State = SIP_ICONNECTING; |
| 1808 | } |
| 1809 | else |
| 1810 | { |
| 1811 | BuildSendStatus(488, "INVITE", sipMsg->getCSeqValue()); |
| 1812 | // 488 Not Acceptable Here |
| 1813 | State = SIP_DISCONNECTING; |
| 1814 | } |
1807 | 1815 | } |
1808 | 1816 | } |
1809 | 1817 | } |
… |
… |
int SipCall::FSM(int Event, SipMsg *sipMsg, void *Value) |
1826 | 1834 | break; |
1827 | 1835 | case SIP_OCONNECTING1_INVITESTATUS_1xx: |
1828 | 1836 | (parent->Timer())->Stop(this, SIP_RETX); |
1829 | | if ((sipMsg->getStatusCode() == 180) && (eventWindow)) |
1830 | | QApplication::postEvent( |
1831 | | eventWindow, new SipEvent(SipEvent::SipRingbackTone)); |
1832 | | parent->SetNotification( |
1833 | | "CALLSTATUS", "", QString::number(sipMsg->getStatusCode()), |
1834 | | sipMsg->getReasonPhrase()); |
| 1837 | if (sipMsg != 0) |
| 1838 | { |
| 1839 | if ((sipMsg->getStatusCode() == 180) && (eventWindow)) |
| 1840 | QApplication::postEvent( |
| 1841 | eventWindow, new SipEvent(SipEvent::SipRingbackTone)); |
| 1842 | |
| 1843 | parent->SetNotification( |
| 1844 | "CALLSTATUS", "", QString::number(sipMsg->getStatusCode()), |
| 1845 | sipMsg->getReasonPhrase()); |
| 1846 | } |
1835 | 1847 | State = SIP_OCONNECTING2; |
1836 | 1848 | break; |
1837 | 1849 | case SIP_OCONNECTING1_INVITESTATUS_3456: |
1838 | 1850 | (parent->Timer())->Stop(this, SIP_RETX); |
1839 | | parent->SetNotification( |
1840 | | "CALLSTATUS", "", QString::number(sipMsg->getStatusCode()), |
1841 | | sipMsg->getReasonPhrase()); |
| 1851 | if (sipMsg != 0) |
| 1852 | parent->SetNotification( |
| 1853 | "CALLSTATUS", "", QString::number(sipMsg->getStatusCode()), |
| 1854 | sipMsg->getReasonPhrase()); |
1842 | 1855 | // Fall through |
1843 | 1856 | case SIP_OCONNECTING2_INVITESTATUS_3456: |
1844 | | if (((sipMsg->getStatusCode() == 407) || |
1845 | | (sipMsg->getStatusCode() == 401)) && |
| 1857 | if (sipMsg != 0 && ((sipMsg->getStatusCode() == 407) || |
| 1858 | (sipMsg->getStatusCode() == 401)) && |
1846 | 1859 | (viaRegProxy != 0) && (viaRegProxy->isRegistered())) |
1847 | 1860 | { |
1848 | 1861 | // Authentication Required |
… |
… |
int SipCall::FSM(int Event, SipMsg *sipMsg, void *Value) |
1862 | 1875 | break; |
1863 | 1876 | |
1864 | 1877 | case SIP_OCONNECTING2_INVITESTATUS_1xx: |
1865 | | if ((sipMsg->getStatusCode() == 180) && (eventWindow)) |
1866 | | QApplication::postEvent( |
1867 | | eventWindow, new SipEvent(SipEvent::SipRingbackTone)); |
1868 | | parent->SetNotification( |
1869 | | "CALLSTATUS", "", QString::number(sipMsg->getStatusCode()), |
1870 | | sipMsg->getReasonPhrase()); |
| 1878 | if (sipMsg != 0) |
| 1879 | { |
| 1880 | if ((sipMsg->getStatusCode() == 180) && (eventWindow)) |
| 1881 | QApplication::postEvent( |
| 1882 | eventWindow, new SipEvent(SipEvent::SipRingbackTone)); |
| 1883 | |
| 1884 | parent->SetNotification( |
| 1885 | "CALLSTATUS", "", QString::number(sipMsg->getStatusCode()), |
| 1886 | sipMsg->getReasonPhrase()); |
| 1887 | } |
1871 | 1888 | break; |
1872 | 1889 | |
1873 | 1890 | case SIP_OCONNECTING1_INVITESTATUS_2xx: |
1874 | 1891 | (parent->Timer())->Stop(this, SIP_RETX); |
1875 | 1892 | // Fall through |
1876 | 1893 | case SIP_OCONNECTING2_INVITESTATUS_2xx: |
1877 | | GetSDPInfo(sipMsg); |
| 1894 | if (sipMsg != 0) |
| 1895 | GetSDPInfo(sipMsg); |
| 1896 | |
1878 | 1897 | if (audioPayloadIdx != -1) // INVITE had a codec we support; proces |
1879 | 1898 | { |
1880 | 1899 | BuildSendAck(); |
… |
… |
int SipCall::FSM(int Event, SipMsg *sipMsg, void *Value) |
1956 | 1975 | State = SIP_DISCONNECTING; |
1957 | 1976 | break; |
1958 | 1977 | case SIP_ICONNECTING_INVITE: |
1959 | | BuildSendStatus(180, "INVITE", sipMsg->getCSeqValue(), |
1960 | | SIP_OPT_CONTACT); // Retxed INVITE, resend 180 Ringing |
| 1978 | if (sipMsg != 0) |
| 1979 | BuildSendStatus(180, "INVITE", sipMsg->getCSeqValue(), |
| 1980 | SIP_OPT_CONTACT); // Retxed INVITE, resend 180 Ringing |
1961 | 1981 | break; |
1962 | 1982 | case SIP_ICONNECTING_ANSWER: |
1963 | 1983 | BuildSendStatus(200, "INVITE", cseq, SIP_OPT_SDP | SIP_OPT_CONTACT, |
… |
… |
int SipCall::FSM(int Event, SipMsg *sipMsg, void *Value) |
1976 | 1996 | eventWindow, new SipEvent(SipEvent::SipCeaseAlertUser)); |
1977 | 1997 | } |
1978 | 1998 | case SIP_ICONNECTING_WAITACK_CANCEL: |
1979 | | BuildSendStatus(200, "CANCEL", sipMsg->getCSeqValue()); // 200 Ok |
| 1999 | if (sipMsg != 0) |
| 2000 | BuildSendStatus(200, "CANCEL", sipMsg->getCSeqValue()); // 200 Ok |
| 2001 | |
1980 | 2002 | State = SIP_IDLE; |
1981 | 2003 | break; |
1982 | 2004 | case SIP_ICONNECTING_WAITACK_ACK: |
… |
… |
int SipCall::FSM(int Event, SipMsg *sipMsg, void *Value) |
2028 | 2050 | break; |
2029 | 2051 | case SIP_CONNECTED_BYE: |
2030 | 2052 | (parent->Timer())->Stop(this, SIP_RETX); |
2031 | | if (sipMsg->getCSeqValue() > cseq) |
| 2053 | if (sipMsg != 0 && sipMsg->getCSeqValue() > cseq) |
2032 | 2054 | { |
2033 | 2055 | cseq = sipMsg->getCSeqValue(); |
2034 | 2056 | BuildSendStatus(200, "BYE", cseq); // 200 Ok |
… |
… |
int SipCall::FSM(int Event, SipMsg *sipMsg, void *Value) |
2039 | 2061 | } |
2040 | 2062 | State = SIP_IDLE; |
2041 | 2063 | } |
2042 | | else |
| 2064 | else if (sipMsg != 0) |
2043 | 2065 | { |
2044 | 2066 | // 400 Bad Request |
2045 | 2067 | BuildSendStatus(400, "BYE", sipMsg->getCSeqValue()); |
… |
… |
int SipCall::FSM(int Event, SipMsg *sipMsg, void *Value) |
2066 | 2088 | break; |
2067 | 2089 | case SIP_DISCONNECTING_CANCEL: |
2068 | 2090 | (parent->Timer())->Stop(this, SIP_RETX); |
2069 | | BuildSendStatus(200, "CANCEL", sipMsg->getCSeqValue()); //200 Ok |
| 2091 | if (sipMsg != 0) |
| 2092 | BuildSendStatus(200, "CANCEL", sipMsg->getCSeqValue()); //200 Ok |
| 2093 | |
2070 | 2094 | State = SIP_IDLE; |
2071 | 2095 | break; |
2072 | 2096 | case SIP_DISCONNECTING_BYESTATUS: |
2073 | 2097 | (parent->Timer())->Stop(this, SIP_RETX); |
2074 | | if (((sipMsg->getStatusCode() == 407) || |
2075 | | (sipMsg->getStatusCode() == 401)) && |
| 2098 | if (sipMsg != 0 && ((sipMsg->getStatusCode() == 407) || |
| 2099 | (sipMsg->getStatusCode() == 401)) && |
2076 | 2100 | (viaRegProxy != 0) && (viaRegProxy->isRegistered())) |
2077 | 2101 | { |
2078 | 2102 | // Authentication Required |
… |
… |
int SipCall::FSM(int Event, SipMsg *sipMsg, void *Value) |
2084 | 2108 | break; |
2085 | 2109 | case SIP_DISCONNECTING_CANCELSTATUS: |
2086 | 2110 | (parent->Timer())->Stop(this, SIP_RETX); |
2087 | | if (((sipMsg->getStatusCode() == 407) || |
2088 | | (sipMsg->getStatusCode() == 401)) && |
| 2111 | if (sipMsg != 0 && ((sipMsg->getStatusCode() == 407) || |
| 2112 | (sipMsg->getStatusCode() == 401)) && |
2089 | 2113 | (viaRegProxy != 0) && (viaRegProxy->isRegistered())) |
2090 | 2114 | { |
2091 | 2115 | // Authentication Required |
… |
… |
int SipCall::FSM(int Event, SipMsg *sipMsg, void *Value) |
2097 | 2121 | break; |
2098 | 2122 | case SIP_DISCONNECTING_BYE: |
2099 | 2123 | (parent->Timer())->Stop(this, SIP_RETX); |
2100 | | BuildSendStatus(200, "BYE", sipMsg->getCSeqValue()); //200 Ok |
| 2124 | if (sipMsg != 0) |
| 2125 | BuildSendStatus(200, "BYE", sipMsg->getCSeqValue()); //200 Ok |
| 2126 | |
2101 | 2127 | State = SIP_IDLE; |
2102 | 2128 | break; |
2103 | 2129 | |
… |
… |
int SipCall::FSM(int Event, SipMsg *sipMsg, void *Value) |
2107 | 2133 | State = SIP_CONNECT_MODIFYING1; |
2108 | 2134 | break; |
2109 | 2135 | case SIP_CONNECTED_INVITE: |
2110 | | GetSDPInfo(sipMsg); |
| 2136 | if (sipMsg != 0) |
| 2137 | GetSDPInfo(sipMsg); |
| 2138 | |
2111 | 2139 | if (audioPayloadIdx != -1) // INVITE had a codec we support; proces |
2112 | 2140 | { |
2113 | 2141 | BuildSendStatus(200, "INVITE", cseq, |
… |
… |
int SipCall::FSM(int Event, SipMsg *sipMsg, void *Value) |
2115 | 2143 | BuildSdpResponse()); |
2116 | 2144 | State = SIP_CONNECT_MODIFYING2; |
2117 | 2145 | } |
2118 | | else |
| 2146 | else if (sipMsg != 0) |
2119 | 2147 | { |
2120 | 2148 | BuildSendStatus(488, "INVITE", sipMsg->getCSeqValue()); |
2121 | 2149 | // 488 Not Acceptable Here |
… |
… |
int SipCall::FSM(int Event, SipMsg *sipMsg, void *Value) |
2126 | 2154 | break; |
2127 | 2155 | case SIP_CONNMOD1_INVITESTATUS_2xx: |
2128 | 2156 | (parent->Timer())->Stop(this, SIP_RETX); |
2129 | | GetSDPInfo(sipMsg); |
| 2157 | if (sipMsg != 0) |
| 2158 | GetSDPInfo(sipMsg); |
| 2159 | |
2130 | 2160 | if (audioPayloadIdx != -1) // INVITE had a codec we support; proces |
2131 | 2161 | { |
2132 | 2162 | BuildSendAck(); |
… |
… |
int SipCall::FSM(int Event, SipMsg *sipMsg, void *Value) |
2157 | 2187 | break; |
2158 | 2188 | case SIP_CONNMOD1_INVITESTATUS_3456: |
2159 | 2189 | (parent->Timer())->Stop(this, SIP_RETX); |
2160 | | if (((sipMsg->getStatusCode() == 407) || |
2161 | | (sipMsg->getStatusCode() == 401)) && |
| 2190 | if (sipMsg != 0 && ((sipMsg->getStatusCode() == 407) || |
| 2191 | (sipMsg->getStatusCode() == 401)) && |
2162 | 2192 | (viaRegProxy != 0) && (viaRegProxy->isRegistered())) |
2163 | 2193 | { |
2164 | 2194 | // Authentication Required |