Re #1266:

 * Make sure that all media transports are already created and completed to fix the assertion when making call using ICE.

 * Change the callback pjsua_med_tp_state_cb to return pj_status_t (instead of void)



git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@3796 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjsip/src/pjsua-lib/pjsua_media.c b/pjsip/src/pjsua-lib/pjsua_media.c
index 876f26b..e774365 100644
--- a/pjsip/src/pjsua-lib/pjsua_media.c
+++ b/pjsip/src/pjsua-lib/pjsua_media.c
@@ -1481,7 +1481,9 @@
         for (mi=0; mi < call->med_cnt; ++mi) {
             pjsua_call_media *call_med = &call->media[mi];
 
-            if (call_med->med_init_cb) {
+            if (call_med->med_init_cb ||
+                call_med->tp_st == PJSUA_MED_TP_NULL)
+            {
                 pj_mutex_unlock(call->med_ch_mutex);
                 return PJ_SUCCESS;
             }
@@ -1697,8 +1699,8 @@
 	                                   &acc->cfg.rtp_cfg,
 					   security_level, sip_err_code,
                                            async,
-                                           (async? (pjsua_med_tp_state_cb)
-                                           &media_channel_init_cb: NULL));
+                                           (async? &media_channel_init_cb:
+                                            NULL));
             if (status == PJ_EPENDING) {
                 pending_med_tp = PJ_TRUE;
             } else if (status != PJ_SUCCESS) {