XMPP does not support group chat with many localized services,
Solve the problem by developing plug-ins for openfire:
Message extension:
Message videomsg = new message ();
Videochatrtp videoxml = new videochatrtp ();
// Extension type
Videoxml. setvideotype (videomediatype. request );
// Request type
Videoxml. setaddress (Address );
// Address
Videomsg. setto (receive );
Videomsg. addextension (videoxml );
// Message Extension
Xmppconnection conn = baseservice. getinstance (). getconnection ();
Conn. sendpacket (videomsg );
The extension class must inherit packetextension.
The following is a simple example:
Public class videochatrtp implements packetextension {
Private videomediatype videotype;
Private string address;
Public String getaddress (){
Return address;
}
Public void setaddress (string address ){
This. Address = address;
}
Public videomediatype getvideotype (){
Return videotype;
}
Public void setvideotype (videomediatype videotype ){
This. videotype = videotype;
}
Public static final string name = "Jingle ";
Public static final string name_space = "com: Roger: video ";
Public videochatrtp (){
Super ();
}
@ Override
Public String getelementname (){
Return name;
}
@ Override
Public String getnamespace (){
Return name_space;
}
@ Override
Public String toxml (){
Stringbuffer sb = new stringbuffer ();
SB. append ("<jingle"). append ("xmlns = \" "). append (name_space). append (" \ "> ");
SB. append ("<type>"). append (videotype). append ("</type> ");
SB. append ("<IPaddress>"). append (Address). append ("</IPaddress> ");
SB. append ("</jingle> ");
Return sb. tostring ();
}
}
Method for listening to extended types:
Providermanager. getinstance (). addextensionprovider (videochatrtp. Name, videochatrtp. name_space, new videochatreceive ());
Extended type processing class (which implements the packetextensionprovider Interface ):
Public class videochatreceive implements packetextensionprovider {
/**
* Processing video extended message
* @ Author bin. Xiao
* @ Since 2013-04-12
**/
@ Override
Public packetextension parseextension (xmlpullparser parser)
Throws exception {
Boolean done = false;
String requesttype = "asdasd ";
String IPaddress = "asdasd ";
While (! Done ){
Int eventtype = parser. Next ();
String name = parser. getname ();
// XML Tab
If (eventtype = xmlpullparser. start_tag ){
If (name. Equals ("type ")){
Requesttype = parser. nexttext ();
}
If (name. Equals ("IPaddress ")){
IPaddress = parser. nexttext ();
}
}
If (eventtype = xmlpullparser. end_tag ){
If (name. Equals ("Jingle ")){
Done = true;
}
}
}
Videochatrtp videortp = new videochatrtp ();
Videortp. setvideotype (videomediatype. valueof (requesttype ));
// String to Enumeration
Videortp. setaddress (IPaddress );
Return videortp;
}
}