Ticket #370: Implemented callback notification to application when ICE negotiation fails (via on_call_media_state callback)

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@1435 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjsip-apps/src/pjsua/pjsua_app.c b/pjsip-apps/src/pjsua/pjsua_app.c
index a586b4d..13f1dbd 100644
--- a/pjsip-apps/src/pjsua/pjsua_app.c
+++ b/pjsip-apps/src/pjsua/pjsua_app.c
@@ -1675,6 +1675,14 @@
 	PJ_LOG(3,(THIS_FILE, 
 		  "Media for call %d is suspended (hold) by remote",
 		  call_id));
+    } else if (call_info.media_status == PJSUA_CALL_MEDIA_ERROR) {
+	pj_str_t reason = pj_str("ICE negotiation failed");
+
+	PJ_LOG(1,(THIS_FILE,
+		  "Media has reported error, disconnecting call"));
+
+	pjsua_call_hangup(call_id, 500, &reason, NULL);
+
     } else {
 	PJ_LOG(3,(THIS_FILE, 
 		  "Media for call %d is inactive",