diff --git a/daemon/src/iax/iaxvoiplink.cpp b/daemon/src/iax/iaxvoiplink.cpp
index aaf1333cf26eb123af2f7ba986d1cb7af55a72fe..12e4a95d012804c26fb4ae178d395f53a7f651dd 100644
--- a/daemon/src/iax/iaxvoiplink.cpp
+++ b/daemon/src/iax/iaxvoiplink.cpp
@@ -288,7 +288,7 @@ IAXVoIPLink::answer(Call *call)
 }
 
 void
-IAXVoIPLink::hangup(const std::string& id)
+IAXVoIPLink::hangup(const std::string& id, int reason UNUSED)
 {
     IAXCall* call = getIAXCall(id);
 
diff --git a/daemon/src/iax/iaxvoiplink.h b/daemon/src/iax/iaxvoiplink.h
index d7b53d9f9c9de019df9355882ade5aa0d643acbc..0d37b89b1fedfa6f6ae5e70d4eb523a30edf0dbb 100644
--- a/daemon/src/iax/iaxvoiplink.h
+++ b/daemon/src/iax/iaxvoiplink.h
@@ -121,7 +121,7 @@ class IAXVoIPLink : public VoIPLink {
          * Hangup a call
          * @param id The ID of the call
          */
-        virtual void hangup(const std::string& id);
+        virtual void hangup(const std::string& id, int reason);
 
         /**
          * Peer Hungup a call
diff --git a/daemon/src/managerimpl.cpp b/daemon/src/managerimpl.cpp
index ca8cc995a177d2bad7b129f6145e20d7f5aeb657..ebf59ebfb1aeb342f7d0535e64a300c09e5f7c8f 100644
--- a/daemon/src/managerimpl.cpp
+++ b/daemon/src/managerimpl.cpp
@@ -395,7 +395,7 @@ void ManagerImpl::hangupCall(const std::string& callId)
             Call * call = SIPVoIPLink::instance()->getSipCall(callId);
             if (call) {
                 history_.addCall(call, preferences.getHistoryLimit());
-                SIPVoIPLink::instance()->hangup(callId);
+                SIPVoIPLink::instance()->hangup(callId, 0);
                 saveHistory();
             }
         } catch (const VoipLinkException &e) {
@@ -407,7 +407,7 @@ void ManagerImpl::hangupCall(const std::string& callId)
         if (call) {
             history_.addCall(call, preferences.getHistoryLimit());
             VoIPLink *link = getAccountLink(accountId);
-            link->hangup(callId);
+            link->hangup(callId, 0);
             removeCallAccount(callId);
             saveHistory();
         }
@@ -1588,7 +1588,7 @@ void ManagerImpl::peerHungupCall(const std::string& call_id)
     if (isIPToIP(call_id)) {
         Call * call = SIPVoIPLink::instance()->getSipCall(call_id);
         history_.addCall(call, preferences.getHistoryLimit());
-        SIPVoIPLink::instance()->hangup(call_id);
+        SIPVoIPLink::instance()->hangup(call_id, 0);
         saveHistory();
     } else {
         const std::string account_id(getAccountFromCall(call_id));
diff --git a/daemon/src/sip/sipvoiplink.cpp b/daemon/src/sip/sipvoiplink.cpp
index 3f37a8d1c53e6a751b1a90bb9ea2c586af282dfc..6569ecf54e0bbb34a1302d02985ad6790cdc3f2e 100644
--- a/daemon/src/sip/sipvoiplink.cpp
+++ b/daemon/src/sip/sipvoiplink.cpp
@@ -941,7 +941,7 @@ void stopRtpIfCurrent(const std::string &id, SIPCall &call)
 }
 
 void
-SIPVoIPLink::hangup(const std::string& id)
+SIPVoIPLink::hangup(const std::string& id, int reason)
 {
     SIPCall* call = getSIPCall(id);
 
@@ -969,13 +969,12 @@ SIPVoIPLink::hangup(const std::string& id)
 
     pjsip_tx_data *tdata = NULL;
 
-    const int status =
+    const int status = reason ? reason :
         inv->state <= PJSIP_INV_STATE_EARLY and inv->role != PJSIP_ROLE_UAC ?
                       PJSIP_SC_CALL_TSX_DOES_NOT_EXIST :
         inv->state >= PJSIP_INV_STATE_DISCONNECTED ? PJSIP_SC_DECLINE :
         0;
 
-
     // User hangup current call. Notify peer
     if (pjsip_inv_end_session(inv, status, NULL, &tdata) != PJ_SUCCESS || !tdata)
         return;
@@ -1671,9 +1670,13 @@ void sdp_media_update_cb(pjsip_inv_session *inv, pj_status_t status)
     }
 
     if (status != PJ_SUCCESS) {
+        const int reason = inv->state != PJSIP_INV_STATE_NULL and
+            inv->state != PJSIP_INV_STATE_CONFIRMED ?
+            PJSIP_SC_UNSUPPORTED_MEDIA_TYPE : 0;
+
         WARN("Could not negotiate offer");
         const std::string callID(call->getCallId());
-        SIPVoIPLink::instance()->hangup(callID);
+        SIPVoIPLink::instance()->hangup(callID, reason);
         // call is now a dangling pointer after calling hangup
         call = 0;
         Manager::instance().callFailure(callID);
diff --git a/daemon/src/sip/sipvoiplink.h b/daemon/src/sip/sipvoiplink.h
index d525a1c04c0b18ce967df003231884f93d1d7f3a..83107eaeac0f9cb8f2e05c734f862e468696c8f3 100644
--- a/daemon/src/sip/sipvoiplink.h
+++ b/daemon/src/sip/sipvoiplink.h
@@ -153,7 +153,7 @@ class SIPVoIPLink : public VoIPLink {
          * Hang up the call
          * @param id The call identifier
          */
-        virtual void hangup(const std::string& id);
+        virtual void hangup(const std::string& id, int reason);
 
         /**
          * Hang up the call
diff --git a/daemon/src/voiplink.h b/daemon/src/voiplink.h
index 841eb7679b228c165e5652536fb0487638365118..8f53edaec7f9ea8b9aa10b8168cb4ac0ca202fcb 100644
--- a/daemon/src/voiplink.h
+++ b/daemon/src/voiplink.h
@@ -92,7 +92,7 @@ class VoIPLink {
          * Hang up a call
          * @param id The call identifier
          */
-        virtual void hangup(const std::string &id) = 0;
+        virtual void hangup(const std::string &id, int reason) = 0;
 
         /**
         * Peer Hung up a call