openmeeting是一个开源的基于web视频会议系统,项目中有视频会议需求,自己开发从成本和时间都不允许。
正好同事是个开源达人,有很多的开源搭建经验辅助我搭建了好了openmeeting。
测试一切正常,也满足项目需求。想把它无缝集成到自己的项目中,参考了它wiik给出的解决方案免登陆直接打开视频房间,安装流程逐步测试都可以成功运行,但是最后关联生产的hash码,进入系统报“未知错误”。
从它提供的api中查找其它的替代方案,在“RoomService中发现了“getInvitationHash”的方法
以下是API的解释
Method: public String getInvitationHash(String SID, String username, Long room_id, Boolean isPasswordProtected, String invitationpass, Integer valid, String validFromDate, String validFromTime, String validToDate, String validToTime)
Create a Invitation hash the From to Date is as String as some SOAP libraries do not accept Date Objects in SOAP Calls Date is parsed as dd.mm.yyyy, time as hh:mm (don't forget the leading zero's)
Returns a HASH value that can be made into a URL with http://$OPENMEETINGS_HOST:$PORT/openmeetings/?invitationHash=$invitationsHash;
available since Issue 1154
Params:
type | name | description |
String | SID | The SID of the User. This SID must be marked as Loggedin |
String | username | the username of the User that he will get |
Long | room_id | the username of the User that he will get |
Boolean | isPasswordProtected | if the invitation is password protected |
String | invitationpass | the password for accessing the conference room via the invitation hash |
Integer | valid | the type of validation for the hash 1: endless, 2: from-to period, 3: one-time |
String | validFromDate | Date in Format of dd.mm.yyyy only of interest if valid is type 2 |
String | validFromTime | time in Format of hh:mm only of interest if valid is type 2 |
String | validToDate | Date in Format of dd.mm.yyyy only of interest if valid is type 2 |
String | validToTime | time in Format of hh:mm only of interest if valid is type 2 |
我以.NET为例进行项目集成登录代码
cls.opMeeting opModel = new opMeeting();
opModel = (opMeeting)JsonConvert.DeserializeObject(jsonStr, typeof(opMeeting));
openMeetings.UserServicePortTypeClient opClient = new openMeetings.UserServicePortTypeClient();
openMeetings.Sessiondata session = opClient.getSession();
long lg = opClient.loginUser(session.session_id, "administrator", "123456");
openMeetingsRS.RoomServicePortTypeClient rsClient = new openMeetingsRS.RoomServicePortTypeClient();
DateTime dTimeFrom = DateTime.Now;
DateTime dTimeTo = dTimeFrom.AddDays(1);
string timeFrom = dTimeFrom.Day.ToString() + "." + dTimeFrom.Month.ToString() + "." + dTimeFrom.Year.ToString();
string timeTo = dTimeTo.Day.ToString() + "." + dTimeTo.Month.ToString() + "." + dTimeTo.Year.ToString();
string invitationHash = rsClient.getInvitationHash(session.session_id, cls.ECLic.DESDecrypt(opModel.username.Replace(' ', '+')), opModel.roomId, false, "123456", 2, timeFrom, "00.00", timeTo, "00.00");
string invitationHashUrl = "http://192.168.0.84:5080/openmeetings/?invitationHash=" + invitationHash + "&language=11" ;
注意:language=11参数是会议室的语音种类为“中文”
opClient.loginUser(session.session_id, "administrator", "123456");
其中的用户必须具备管理员权限的用户,否则返回-26的错误代码。
参考官方 API
”