如何使用虹吸作为会议PJSIP添加新呼叫

时间:2016-01-08 18:07:32

标签: ios objective-c

我的项目是什么。

  1. 语音通话。
  2. 我项目中的图书馆。

    1. Asterisk服务器(版本11.0)
    2. pjsip 2.5.1
    3. 用于UI的虹吸
    4. 我的成就

      1. 一对一通话工作正常
      2. 我的问题: -

        我需要实施添加新的好友功能,以便我们可以进行会议。

        我的问题是什么

        1. 我无法接听会议语音电话。场景是A调用B语音工作正常,但当B添加新好友C然后B和C通信但A和C无法通信。
        2. 这是我用来调用One-toOne的代码

          if (([[_label text] length] > 0) &&
                          ([phoneCallDelegate respondsToSelector:@selector(dialup:number:)]))
                      {
                          _lastNumber = [[NSString alloc] initWithString: [_label text]];
                          [_label setText:@""];
                      }
                      else
                      {
                          _lcd.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"lcd_top_simple.png"]];
                          [_label setText:_lastNumber];
                          [_lastNumber release];
                      }
          
                  }
          
          Call.m file  calling this below method . 
          
          status = pjsua_call_make_call(acc_id, &pj_uri, 0, NULL, NULL, call_id);
            if (status != PJ_SUCCESS)
            {
              pjsua_perror(THIS_FILE, "Error making call", status);
            }
          

2 个答案:

答案 0 :(得分:1)

缺少一些来自" PJSIP"图书馆。请包括" PJSIP"编译后的库,或者你可以从这个link下载项目,这个项目编译了#34; PJSIP"包括在内。

答案 1 :(得分:0)

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.
   */
  if (ci.media_status == PJSUA_CALL_MEDIA_ACTIVE ||
      ci.media_status == 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);
  }


    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;


        int max=pjsua_call_get_count();
        if (max==2) {
            mergeCalls=true;
        }

        if (mergeCalls == true) {
            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);
    }

}