Index: pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
===================================================================
--- pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h	(revision 3848)
+++ pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h	(revision 3849)
@@ -564,5 +564,5 @@
 {
     /**
-     * Notify application when invite state has changed.
+     * Notify application when call state has changed.
      * Application may then query the call info to get the
      * detail call states by calling  pjsua_call_get_info() function.
Index: pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c	(revision 3848)
+++ pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c	(revision 3849)
@@ -465,4 +465,7 @@
 
 on_error:
+    if (inv == NULL && call_id != -1 && pjsua_var.ua_cfg.cb.on_call_state)
+        (*pjsua_var.ua_cfg.cb.on_call_state)(call_id, NULL);
+
     if (dlg) {
 	/* This may destroy the dialog */
@@ -1402,4 +1405,5 @@
 {
     pjsua_call *call;
+    pjsip_dialog *dlg;
     unsigned mi;
 
@@ -1415,6 +1419,6 @@
 
     call = &pjsua_var.calls[call_id];
-
-    if (!call->inv) {
+    dlg = (call->inv ? call->inv->dlg : call->async_call.dlg);
+    if (!dlg) {
 	PJSUA_UNLOCK();
 	return PJSIP_ESESSIONTERMINATED;
@@ -1423,10 +1427,10 @@
     /* id and role */
     info->id = call_id;
-    info->role = call->inv->role;
+    info->role = dlg->role;
     info->acc_id = call->acc_id;
 
     /* local info */
     info->local_info.ptr = info->buf_.local_info;
-    pj_strncpy(&info->local_info, &call->inv->dlg->local.info_str,
+    pj_strncpy(&info->local_info, &dlg->local.info_str,
 	       sizeof(info->buf_.local_info));
 
@@ -1434,5 +1438,5 @@
     info->local_contact.ptr = info->buf_.local_contact;
     info->local_contact.slen = pjsip_uri_print(PJSIP_URI_IN_CONTACT_HDR,
-					       call->inv->dlg->local.contact->uri,
+					       dlg->local.contact->uri,
 					       info->local_contact.ptr,
 					       sizeof(info->buf_.local_contact));
@@ -1440,13 +1444,13 @@
     /* remote info */
     info->remote_info.ptr = info->buf_.remote_info;
-    pj_strncpy(&info->remote_info, &call->inv->dlg->remote.info_str,
+    pj_strncpy(&info->remote_info, &dlg->remote.info_str,
 	       sizeof(info->buf_.remote_info));
 
     /* remote contact */
-    if (call->inv->dlg->remote.contact) {
+    if (dlg->remote.contact) {
 	int len;
 	info->remote_contact.ptr = info->buf_.remote_contact;
 	len = pjsip_uri_print(PJSIP_URI_IN_CONTACT_HDR,
-			      call->inv->dlg->remote.contact->uri,
+			      dlg->remote.contact->uri,
 			      info->remote_contact.ptr,
 			      sizeof(info->buf_.remote_contact));
@@ -1459,13 +1463,13 @@
     /* call id */
     info->call_id.ptr = info->buf_.call_id;
-    pj_strncpy(&info->call_id, &call->inv->dlg->call_id->id,
+    pj_strncpy(&info->call_id, &dlg->call_id->id,
 	       sizeof(info->buf_.call_id));
 
     /* state, state_text */
-    info->state = call->inv->state;
+    info->state = (call->inv? call->inv->state: PJSIP_INV_STATE_DISCONNECTED);
     info->state_text = pj_str((char*)pjsip_inv_state_name(info->state));
 
     /* If call is disconnected, set the last_status from the cause code */
-    if (call->inv->state >= PJSIP_INV_STATE_DISCONNECTED) {
+    if (call->inv && call->inv->state >= PJSIP_INV_STATE_DISCONNECTED) {
 	/* last_status, last_status_text */
 	info->last_status = call->inv->cause;
Index: pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c	(revision 3848)
+++ pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c	(revision 3849)
@@ -778,8 +778,10 @@
     switch (op) {
     case PJ_ICE_STRANS_OP_INIT:
+        PJSUA_LOCK();
         call_med->tp_ready = result;
         if (call_med->med_create_cb)
             (*call_med->med_create_cb)(call_med, result,
                                        call_med->call->secure_level, NULL);
+        PJSUA_UNLOCK();
 	break;
     case PJ_ICE_STRANS_OP_NEGOTIATION:
@@ -1420,22 +1422,13 @@
         set_media_tp_state(call_med, PJSUA_MED_TP_CREATING);
 
-        if (async) {
-            call_med->med_create_cb = &call_media_init_cb;
-            call_med->med_init_cb = cb;
-        }
-
 	if (pjsua_var.media_cfg.enable_ice) {
 	    status = create_ice_media_transport(tcfg, call_med, async);
-	    if (async && status == PJ_SUCCESS) {
-		/* Callback has been called. */
-		call_med->med_init_cb = NULL;
-		/* We cannot return PJ_SUCCESS here since we already call
-		 * the callback.
-		 */
-		return PJ_EPENDING;
-	    } else if (async && status == PJ_EPENDING) {
+            if (async && status == PJ_EPENDING) {
 	        /* We will resume call media initialization in the
 	         * on_ice_complete() callback.
 	         */
+                call_med->med_create_cb = &call_media_init_cb;
+                call_med->med_init_cb = cb;
+
 	        return PJ_EPENDING;
 	    }
