2016-06-01 26 views

Antwort

0

Sie können pjsip ios library 2.5 neueste Build und einen weiteren Aufruf verwenden. Zweitens wird der Webservice verwendet, um Anruf- und Umleitungskanäle für asterisk als Sip-Server zu erstellen.

Wenn Sie einen anderen Medienserver verwenden, geben Sie auch die Details ein.

0

Dieser Code funktioniert gut für mich, nur müssen pjsua_conf_connect() Steckplatz Nummer 0 1 zusammenführen, und das ist unsere Anforderung.

static void on_call_media_state(pjsua_call_id call_id) 
    { 
     pjsua_call_info ci; 
     SiphonApplication *app = (SiphonApplication *)[SiphonApplication sharedApplication]; 

     pjsua_call_get_info(call_id, &ci); 
    // PJ_LOG(3,(THIS_FILE,"on_call_media_state status %d count %d", 
    //  ci.media_status 
    //  pjmedia_conf_get_connect_count())); 

     /* FIXME: Stop ringback */ 
     sip_ring_stop([app pjsipConfig]); 

     /* Connect ports appropriately when media status is ACTIVE or REMOTE HOLD, 
     * otherwise we should NOT connect the ports. 
     */ 

     pjsua_call_media_status slotOne = ci.media_status; 
     if (slotOne == PJSUA_CALL_MEDIA_ACTIVE || 
      slotOne == PJSUA_CALL_MEDIA_REMOTE_HOLD) 
     { 
     // When media is active, connect call to sound device. 
     pjsua_conf_connect(ci.conf_slot, 0); 
     pjsua_conf_connect(0, ci.conf_slot); 

     pjsua_conf_adjust_rx_level(0, 3.0); 
     pjsua_conf_adjust_tx_level(0, 5.0); 


     } 


      [[NSUserDefaults standardUserDefaults] setObject: @"CallIsRunning"forKey:@"CallIsRunning"]; 
     if (ci.media_status == PJSUA_CALL_MEDIA_ACTIVE) { // When media is active, connect call to sound device. 
      pjsua_conf_port_id slotOne = ci.conf_slot; 
      //  pjsua_conf_connect(slotOne, 0); 
      //  pjsua_conf_connect(0, slotOne); 
      //mergeCalls=true; 

      mergeCalls=false; 

      int max=pjsua_call_get_count(); 
      if (max==2) { 

       [[NSUserDefaults standardUserDefaults] setInteger:pjsua_call_get_count() forKey:@"callCountForCalling"]; 
       mergeCalls=true; 
      } 


      NSString *grpID= [[NSUserDefaults standardUserDefaults] objectForKey:@"callerTypegroup"]; 
      // if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"callerTypegroup"] length]>1) 

      if (mergeCalls == true && grpID.length==0) { 

       pjsua_conf_port_id slotTwo = pjsua_call_get_conf_port(activeCallID); 
       pjsua_conf_connect(slotOne, slotTwo); 
       pjsua_conf_connect(slotTwo, slotOne); 

       // since the "activeCallID" is already talking, its conf_port is already connected to "0" (and vice versa) ... 

      } else { 
       activeCallID = call_id; 
      } 
     } else if (ci.media_status == PJSUA_CALL_MEDIA_LOCAL_HOLD) { 
      // … callSuspended(callID); 
     } 

    }