# Sip呼叫

# 邀请 Sip 用户

sip 呼叫用于对接 Polycom 会议。

/**
 * @brief           邀请Sip用户,一般用于对接落地网关等
 *
 * @param sipParam  邀请sip用户入会的配置参数
 * @return          成功返回值大于等于0,返回-1表示接口调用失败,与 onInviteSipUserResult 回调中的 operationId 对应
 */
-(int)inviteSipUser:(JCConferenceSipInviteInfo*)sipParam;

其中 JCConferenceSipInviteInfo (opens new window) 类有如下属性:

/**
 *  @brief 一般为号码(必填)
 */
@property (nonatomic, copy) NSString* userId;

/**
 *  @brief sip用户加入会议后的昵称
 */
@property (nonatomic, copy) NSString* displayName;

/**
 *  @brief UserId是号码设false,是sipUri设true
 */
@property (nonatomic) bool isSipUri;

/**
 *  @brief 是否视频接入
 */
@property (nonatomic) bool isVideo;

示例代码:

JCConferenceSipInviteInfo *sipInfo = [[JCConferenceSipInviteInfo alloc] init];
sipInfo.userId = @"13586556568";
sipInfo.displayName = @"ceshi"
sipInfo.isSipUri = false;
sipInfo.isVideo = true;
int operationId = [conference inviteSipUser:sipInfo];

调用该方法后会收到 onInviteSipUserResult (opens new window) 回调,当接收到的参数 resulttrue 时,表示邀请 Sip 用户成功,否则邀请失败;operationId 对应调用 inviteSipUser 后返回的 operationId

/**
 * @brief 邀请Sip用户操作结果回调,成功后会触发 onParticipantJoin
 *
 * @param operationId 操作id对应调用 inviteSipUser 后返回的 operationId
 * @param result 操作结果 true表示成功,false表示失败
 * @param reason 操作原因
 */
-(void)onInviteSipUserResult:(int)operationId result:(bool)result reason:(int)reason;

# 对接 Polycom 会议

JCConferenceSipInviteInfo inviteInfo = [[JCConferenceSipInviteInfo alloc] init];
inviteInfo.userId = "sip:xxx@xconf.china.com";
inviteInfo.displayName = "显示名";
inviteInfo.dtmfPassword = "yyy";
inviteInfo.isVideo = true;
inviteInfo.isMcu = true;
inviteInfo.coreNetwork = "zh_polycom";
inviteInfo.isRoute = false;
inviteInfo.sipUri = true;