gpt4 book ai didi

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

转载 作者:搜寻专家 更新时间:2023-10-30 20:24:28 26 4
gpt4 key购买 nike

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

最佳答案

这段代码对我来说工作正常,只需要合并 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);
}

}

关于ios - 如何使用 Asterisk iOS 进行 PJSIP 电话 session (在电话 session 中添加新成员)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37564000/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com