MUC in iOS using robbiehanson XMPPframework - ios

What is the step by step procedure to implement MUC in iOS using robbiehanson XMPPframework?
I tried allocating the room, then activating the stream and joining the room.
But I got a response as follows:
<iq xmlns="jabber:client" from="room#XXXXX.com" to="user#XXXXX.com/34633017701337944885586135" type="error" id="4DD4A6E2-E24F-4D38-AD87-15070B6AD90E"><query xmlns="http://jabber.org/protocol/muc#owner"><x xmlns="jabber:x:data" type="submit"/></query><error code="503" type="cancel"><service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></iq>
Also received an iq : xmppStream:didReceiveIQ: - 4DD4A6E2-E24F-4D38-AD87-15070B6AD90E

Finally I figured it out. It may help someone. While creating or joining the room, the format should be yourRoomName#conference.YourDomainName.com. The conference is the keyword here.

Related

XMPP: Performance Degradation List of Chats

We are facing performance degradation in iOS mobile app, which uses XMPPFramework
So literally after authentication we have 2 screens: (list of chats, and if chat from list is pressed - just real chat ).
After user authorised we starts chats’s sync process.
During sync process if I open any chat and trying to send some message or if I am at top of the chart and retrieve previous history page from archive then such requests are executed for a long time.
If syntonisation has finished the requests in such case execute in a short period of time.
But if there are some “scheduled” requests (IQs) for XMPP then on chat screen there is a big gap in receiving previous pages from MAM, or sending messages to the XMPP server.
Not sure what causes XMPP’s slow responsiveness: seems that XMPP executes sequentially requests from input stream.
How can we accelerate XMPP’s responsiveness in such case? Kind of request priority is needed :)
If number of chats is low (less than 10), then we don't see big delay, but if # is around 50 then we observe described above issue.
Should we use extra stream, when an user opens chat? Can it be easily done?
Stream authorisation can't be eliminated if I am not mistaken.
Technical details:
Stream has the following Info:
<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" id="5454829587182882369" version="1.0" stream1:lang="en" from="xx.com"/>
RECV:
<stream:features xmlns:stream="http://etherx.jabber.org/streams">
<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"/>
<session xmlns="urn:ietf:params:xml:ns:xmpp-session">
<optional/>
</session>
<c xmlns="http://jabber.org/protocol/caps" ver="Sd=" node="http://www.process-one.net/en/ejabberd/" hash="sha-1"/>
<sm xmlns="urn:xmpp:sm:2"/>
<sm xmlns="urn:xmpp:sm:3"/>
<csi xmlns="urn:xmpp:csi:0"/>
</stream:features>
Session’s configuration: (2 duration minutes, keepAlive - 120 seconds)
<iq type="set" id="302D4903-9EA7-4AF1-A070-0362B18D69BE">
<push xmlns="p1:push" apns-sandbox="true">
<appid>xxt</appid>
<keepalive max="120"/>
<session duration="2"/>
<body send="all" groupchat="true" from="none"/>
<status type="xa">Text Message when in push mode</status>
<offline>true</offline>
<notification>
<type>applepush</type>
<id>fafa</id>
</notification>
</push>
</iq>
Sync process:
From our backend we get list of conversations, & contacts.
For each chat if it’s MUC we subscribe to it (muc PubSub).
<iq type="set" to="439f1818257dc7eda13a#muc.staging.chat.fitgrid.com" id="BFA024EB-0291-4207-84CC-BD3469568FFE">
<subscribe xmlns="urn:xmpp:mucsub:0" nick="1686a817de5fc4240270#sxx.com">
<event node="urn:xmpp:mucsub:nodes:messages"/>
</subscribe>
</iq>
To get the latest message for each chat we retrieve the latest message from MAM (archive):
<iq type="set" id="6EEB490A-D421-4007-9DA8-E9D2E54DC268" to="ca65cc04b8b8995961f3#muc.xx.com">
<query xmlns="urn:xmpp:mam:2" queryid="15E9F8CC-1FBE-4DCD-982C-8440E0597BFF">
<x xmlns="jabber:x:data" type="submit">
<field var="FORM_TYPE" type="hidden">
<value>urn:xmpp:mam:2</value>
</field>
</x>
<set xmlns="http://jabber.org/protocol/rsm">
<max>1</max>
<before/>
</set>
</query>
</iq>
After messages are received we store them to our local DBs.
We are tracking status of message (sent, read and so on), by using chart markers.
Also there is a small number of Group Rosters’ subscription - it shouldn’t be critical point…
Apparently, we use different threads for processing, we don’t block UI (main) thread.
Any ideas?
P.S. attempt to establish extra stream on selected chat led to the following error (RECV):
<stream:error xmlns:stream="http://etherx.jabber.org/streams">
<conflict xmlns="urn:ietf:params:xml:ns:xmpp-streams" />
<text xmlns="urn:ietf:params:xml:ns:xmpp-streams" lang="en">Replaced by new connection</text>
</stream:error>
But this because of server configuration (in-order processing) https://xmpp.org/rfcs/rfc6120.html#rules-order
Default port is 5222 for TCP connection, seems that extra port should be enabled.

Real time transcription | Twilio Agent Conference

I am referrring to the demo Kris gives here, especially the separate active transcriptions that show up for Stuart and Kris. I am familiar with conference, gather, dial but I am not able to replicate the entire architecture. I am interested in placing 2 people on a conference and somehow receive their transcriptions in real-time as the wonderful demo shows. I have enabled Agent-Conference tried the coach feature, but still can't figure out how to use Gather with conference participants. If I put a participant in Gather mode the other participant can't hear her. Can anyone please throw some pointers, I am sure I'm missing something basic here.
Till now I have tried:
Call call1 = Call.creator(new PhoneNumber("MyNumber"), new PhoneNumber("VerifiedTwilioNumber"),
new URI("https://mywebsite/gather.xml")).create();
https://mywebsite/gather.xml returns
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Gather input="speech" speechTimeout="auto" partialResultCallback="https://mywebsite/gather_twilio_webhook_servlet">
</Gather>
</Response>
Using this I speak to no-one but whatever I speak gets shown real-time on my gather_twilio_webhook_servlet.
I have also made conferences using :
Call call1 = Call.creator(new PhoneNumber("MyNumber"), new PhoneNumber("VerifiedTwilioNumber"),
new URI("https://mywebsite/conf.xml")).create();
Call call2 = Call.creator(new PhoneNumber("MyFriendsNumber"), new PhoneNumber("VerifiedTwilioNumber"),
new URI("https://mywebsite/conf.xml")).create();
https://mywebsite/conf.xml returns:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial>
<Conference startConferenceOnEnter="true" endConferenceOnExit="true">Room 123</Conference>
</Dial>
</Response>
I am trying combinations thereof but not able to find a documentation to replicate Kris's exact use case. Any help will be much appreciated. Thanks!
Update, more trials:
If I try something like:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Gather input="speech" speechTimeout="auto" partialResultCallback="https://mywebsite/gather_twilio_webhook_servlet" language="en-IN">
<Dial>
<Conference record="record-from-start">room-2</Conference>
</Dial>
</Gather>
</Response>
I get ErrorCode "13320" Msg "Gather: Invalid nested verb"
Twilio developer evangelist here.
The demo Kris showed is not available right now to use publicly. I know it was a while back, but bringing it to market was not as high a priority as other things we have launched since.
If you are interested in features like this, I recommend you get in touch with sales and discuss what you would like to use it for.
This is probably late now. But, you can check out these apps if it helps -
Video Conferencing built using Twilio Video SDK with live captions - https://github.com/symblai/symbl-twilio-video-react
Twilio Media Streams Integration - https://github.com/symblai/symbl-twilio-media-streams-integration

Twilio: Get parameters from outbound calls from recordings

I have a TwiMl like this in a Bin:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say voice="alice">Hello {{Name}}. You have ticket number {{TicketNum}} so please solve it.</Say>
</Response>
Then I use hmac authentication and launch the script to make the call using the following TWIML Bin url with query strings attached:
twiml_link="https://handler.twilio.com/twiml/EHxxxxxxxxxxx?Name=Bob&TicketNum=45"
I get the call with Bob and Ticket 45. After that I need to alert our incident tracking system that Bob has acknowledge the ticket 45 and is "on it." I can't because of architecture send something back to my system. I need to go out and query twilio again.
So I wrote this python snippet to hit the Twilio API to find all completed calls. :
from twilio.rest import Client
import sys, os
# Your Account Sid and Auth Token from twilio.com/console
account_sid = os.environ['TWILIO_ACCOUNT_SID']
auth_token = os.environ['TWILIO_AUTH_TOKEN']
client = Client(account_sid, auth_token)
calls = client.calls.list(status=completed)
for call in calls:
print(call.sid)
print(call.to)
print(call.status)
print(call.start_time)
print(call.duration)
print(call.annotation)
print(call.uri)
None of these commands can print Bob or the ticket number or the Twiml Bin URL or the query strings I used. Any tips? Thanks in Advance!
That approach isn't a reliable way to determine if the intended party answered the phone and acknowledge the message without "Human Detection". You can find more details here.
Alternative to AMD - "Human Detection"
https://support.twilio.com/hc/en-us/articles/223132567-Can-Twilio-tell-whether-a-call-was-answered-by-a-human-or-machine-#alternatives-to-amd
The dialed party could be a voicemail system, so querying the REST API to see if the call status was completed will provide misleading results if your goal is to determine the person acknowledged the ticket.
You could use a Twilio Function, https://support.twilio.com/hc/en-us/articles/115007737928-Building-apps-with-Twilio-Functions, to collect the result of the
Alan

XMPPFramework : Only occupants are allowed to send messages to the conference xmpp ios

why I am getting this error when try to send message in a group created in xmpp muc.
this is message packet that I am receiving
<message xmlns="jabber:client" from="testgrp#conference.localhost" to="7023651847#localhost/787052459360862999820058" type="error"><body>hiiii</body><error code="406" type="modify"><not-acceptable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"></not-acceptable><text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">Only occupants are allowed to send messages to the conference</text></error></message>
error text : Only occupants are allowed to send messages to the conference
method that I am using to create group is : XMPPFramework - How to create a MUC room and invite users?
The error message seems self explanatory: You are not an occupant (as define in XEP-0045 = you did not join the room) and as such you cannot send messages.
You can check role privileges in XEP-0045 for reference: http://xmpp.org/extensions/xep-0045.html#roles-priv
Only participants can send messages to all.

Make the server not send me same messages when i enter a chat room many times?

If I enter into a chat room, I will receive some messages.Then I sign out my account.Of course, I exit the chat room too.But I enter into the same chat room next time, I receive the same messages also.I mean, when I enter into a chat room many times, the server should not send me the same messages,the server should send me messages which I have never received.What should I do??
There is an option in ejabberd.cfg,"history_size",but it does not meet my needs.
Section 7.2.15 of XEP-0045 specifies how you can ask to limit the amount of message history you get when entering the room. When reentering the room, your client could note the timestamp of the last message it got, and ask to get only messages after that time:
<presence
from='hag66#shakespeare.lit/pda'
id='n13mt3l'
to='coven#chat.shakespeare.lit/thirdwitch'>
<x xmlns='http://jabber.org/protocol/muc'>
<history since='1970-01-01T00:00:00Z'/>
</x>
</presence>

Resources