cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
560
Views
0
Helpful
1
Replies
Emad Wahba
Enthusiast

Posting message to persistent chat room

We are trying to automate some tasks by scripting message post to IM&P server (ver 11.0.1), we are able to send to individual users, and it pops up ok in their Jabber GUI, but when we try to do the same for persistent chat room JID, the message does not show up in Jabber client, however we can verify that the message was posted in the archive database ok.

Script details:

Python version and xmpppy version.

Python 2.7.3 -- EPD 7.3-2 (64-bit)

xmpppy 0.5.0rc1-1 opt/epd/epd-7.3-2

#!/opt/epd/current/bin/python

import argparse

import re

import base64

import datetime

import os

import xmpp

import time

import sys

  1. sys.path.append('/engineering/scripts/englib/')

from util import mylogger

from util.ssh import SSH

import site

  1. site.addsitedir('/engineering/scripts/lib/python2.7/site-packages')

import paramiko

import smtplib

   

-------------------------------------------------------------------------------------------------------

Send to single client:

------------------------------------------------------------------------------------------------------

Below codes would  send to single id, example: ‘someid@global.com’,  the destination client sees message on the gui client.

def SendJabber(JabberDest,JabberMsg, jidparams, jabber_server):

    for mandatory in ['jid','password']:

        if mandatory not in jidparams.keys():

print 'ERROR:  valid JID is needed for sending messages.'

    jid=xmpp.protocol.JID(jidparams['jid'])

    cl=xmpp.Client(jid.getDomain(),debug=[])

    con=cl.connect(server=(str(jabber_server),'5222'))

    if not con:

        print 'ERROR: could not connect to jabber server!'

    else:

auth=cl.auth(jid.getNode(),jidparams['password'],resource=jid.getResource())

        if not auth:

print 'ERROR: could not authenticate to jabber server!'

        else:

print "connected"

id=cl.send(xmpp.protocol.Message(JabberDest,JabberMsg))

time.sleep(1)

cl.disconnect()

--------------------------------------------------------------------------

send to chatroom:

Below codes would  send to chat room, example: ‘chatgroup278691918619186@us-primary-chat-server.global.com’, the chat room do not see the message on the gui.

-------------------------------------------------------------------------

def SendJabber(JabberDest,JabberMsg, jidparams, jabber_server):

    for mandatory in ['jid','password']:

        if mandatory not in jidparams.keys():

print 'ERROR: Please populate ~/.xsend config file with valid JID for sending messages.'

    jid=xmpp.protocol.JID(jidparams['jid'])

    cl=xmpp.Client(jid.getDomain(),debug=[])

    con=cl.connect(server=(str(jabber_server),'5222'))

    if not con:

        print 'ERROR: could not connect to jabber server!'

    else:

auth=cl.auth(jid.getNode(),jidparams['password'],resource=jid.getResource())

        if not auth:

print 'ERROR: could not authenticate to jabber server!'

        else:

print "connected"

room='chatgroup278691918619186@us-primary-chat-server.global.com'

nickname='testgroupchat'

cl.send(xmpp.Presence(to="%s/%s" % (room, nickname)))

msg= xmpp.protocol.Message(body=JabberMsg)

msg.setTo(room)

msg.setType('groupchat')

cl.send(msg)

time.sleep(1)

cl.disconnect()

1 REPLY 1

Hello,

I have exactly the same issue.

Did you figure out how to solve this or do you know if it's a Cisco Jabber limitation?

Best regards,

Create
Recognize Your Peers
Content for Community-Ad