如何使用Asterisk iOS进行电话会议PJSIP(在电话会议中添加新成员)?

时间:2016-06-01 08:59:26

标签: ios objective-c asterisk voip pjsip

我正在使用PJSIP 2.0,Xcode 7.3和ios 9.2.1, 假设我们有3个用户A,B& C用户。
什么时候A呼叫B(工作正常)但是当A在呼叫中添加成员C(作为电话会议)时,A& B可以与C通信,但C从不从B获得语音。(C& A沟通正常)。那么如何管理C& C之间的通信。 B。

2 个答案:

答案 0 :(得分:1)

这段代码对我来说很好,只需要合并pjsua_conf_connect()插槽号0 1,这是我们的要求。

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);
        }

    }

答案 1 :(得分:0)

您可以使用pjsip ios library 2.5最新版本和另一个调用。其次是使用webservice来发起呼叫和重定向信道,以便将星号作为sip服务器进行confbridge。

如果您正在使用其他媒体服务器,请分享详细信息。