Index: pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
===================================================================
--- pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c	(revision 5833)
+++ pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c	(revision 5834)
@@ -340,92 +340,4 @@
 }
 
-/*
- * Handler when a transaction within a call has changed state.
- */
-static void on_call_tsx_state(pjsua_call_id call_id,
-			      pjsip_transaction *tsx,
-			      pjsip_event *e)
-{
-    const pjsip_method info_method = 
-    {
-	PJSIP_OTHER_METHOD,
-	{ "INFO", 4 }
-    };
-
-    if (pjsip_method_cmp(&tsx->method, &info_method)==0) {
-	/*
-	 * Handle INFO method.
-	 */
-	const pj_str_t STR_APPLICATION = { "application", 11};
-	const pj_str_t STR_DTMF_RELAY  = { "dtmf-relay", 10 };
-	pjsip_msg_body *body = NULL;
-	pj_bool_t dtmf_info = PJ_FALSE;
-	
-	if (tsx->role == PJSIP_ROLE_UAC) {
-	    if (e->body.tsx_state.type == PJSIP_EVENT_TX_MSG)
-		body = e->body.tsx_state.src.tdata->msg->body;
-	    else
-		body = e->body.tsx_state.tsx->last_tx->msg->body;
-	} else {
-	    if (e->body.tsx_state.type == PJSIP_EVENT_RX_MSG)
-		body = e->body.tsx_state.src.rdata->msg_info.msg->body;
-	}
-	
-	/* Check DTMF content in the INFO message */
-	if (body && body->len &&
-	    pj_stricmp(&body->content_type.type, &STR_APPLICATION)==0 &&
-	    pj_stricmp(&body->content_type.subtype, &STR_DTMF_RELAY)==0)
-	{
-	    dtmf_info = PJ_TRUE;
-	}
-
-	if (dtmf_info && tsx->role == PJSIP_ROLE_UAC && 
-	    (tsx->state == PJSIP_TSX_STATE_COMPLETED ||
-	       (tsx->state == PJSIP_TSX_STATE_TERMINATED &&
-	        e->body.tsx_state.prev_state != PJSIP_TSX_STATE_COMPLETED))) 
-	{
-	    /* Status of outgoing INFO request */
-	    if (tsx->status_code >= 200 && tsx->status_code < 300) {
-		PJ_LOG(4,(THIS_FILE, 
-			  "Call %d: DTMF sent successfully with INFO",
-			  call_id));
-	    } else if (tsx->status_code >= 300) {
-		PJ_LOG(4,(THIS_FILE, 
-			  "Call %d: Failed to send DTMF with INFO: %d/%.*s",
-			  call_id,
-		          tsx->status_code,
-			  (int)tsx->status_text.slen,
-			  tsx->status_text.ptr));
-	    }
-	} else if (dtmf_info && tsx->role == PJSIP_ROLE_UAS &&
-		   tsx->state == PJSIP_TSX_STATE_TRYING)
-	{
-	    /* Answer incoming INFO with 200/OK */
-	    pjsip_rx_data *rdata;
-	    pjsip_tx_data *tdata;
-	    pj_status_t status;
-
-	    rdata = e->body.tsx_state.src.rdata;
-
-	    if (rdata->msg_info.msg->body) {
-		status = pjsip_endpt_create_response(tsx->endpt, rdata,
-						     200, NULL, &tdata);
-		if (status == PJ_SUCCESS)
-		    status = pjsip_tsx_send_msg(tsx, tdata);
-
-		PJ_LOG(3,(THIS_FILE, "Call %d: incoming INFO:\n%.*s", 
-			  call_id,
-			  (int)rdata->msg_info.msg->body->len,
-			  rdata->msg_info.msg->body->data));
-	    } else {
-		status = pjsip_endpt_create_response(tsx->endpt, rdata,
-						     400, NULL, &tdata);
-		if (status == PJ_SUCCESS)
-		    status = pjsip_tsx_send_msg(tsx, tdata);
-	    }
-	}
-    }
-}
-
 /* General processing for media state. "mi" is the media index */
 static void on_call_generic_media_state(pjsua_call_info *ci, unsigned mi,
@@ -623,4 +535,26 @@
 {
     PJ_LOG(3,(THIS_FILE, "Incoming DTMF on call %d: %c", call_id, dtmf));
+}
+
+static void call_on_dtmf_callback2(pjsua_call_id call_id, 
+				   const pjsua_dtmf_info *info)
+{    
+    char duration[16];
+    char method[16];
+
+    duration[0] = '\0';
+
+    switch (info->method) {
+    case PJSUA_DTMF_METHOD_RFC2833:
+	pj_ansi_snprintf(method, sizeof(method), "RFC2833");
+	break;
+    case PJSUA_DTMF_METHOD_SIP_INFO:
+	pj_ansi_snprintf(method, sizeof(method), "SIP INFO");
+	pj_ansi_snprintf(duration, sizeof(duration), ":duration(%d)", 
+			 info->duration);
+	break;
+    };    
+    PJ_LOG(3,(THIS_FILE, "Incoming DTMF on call %d: %c%s, using %s method", 
+	   call_id, info->digit, duration, method));
 }
 
@@ -1329,6 +1263,5 @@
     app_config.cfg.cb.on_call_media_state = &on_call_media_state;
     app_config.cfg.cb.on_incoming_call = &on_incoming_call;
-    app_config.cfg.cb.on_call_tsx_state = &on_call_tsx_state;
-    app_config.cfg.cb.on_dtmf_digit = &call_on_dtmf_callback;
+    app_config.cfg.cb.on_dtmf_digit2 = &call_on_dtmf_callback2;
     app_config.cfg.cb.on_call_redirected = &call_on_redirected;
     app_config.cfg.cb.on_reg_state = &on_reg_state;
