From 2a3f0441688ec79c87a28d8526d6d59668497ebd Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 10 Aug 2022 11:21:34 +0300 Subject: Jabber: Jingle DROP command support --- protocols/JabberG/src/jabber_proto.h | 2 +- protocols/JabberG/src/jabber_thread.cpp | 4 +--- protocols/JabberG/src/jabber_voip.cpp | 12 +++++++++++- 3 files changed, 13 insertions(+), 5 deletions(-) (limited to 'protocols/JabberG/src') diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index dc31a60dd2..d01ed55d6b 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -897,7 +897,7 @@ struct CJabberProto : public PROTO, public IJabberInterface bool OnICECandidate(const TiXmlElement *Node, const char *from); bool OnRTPDescription(const TiXmlElement *Node); bool VOIPCreatePipeline(); - bool VOIPTerminateSession(); + bool VOIPTerminateSession(const char *reason = "cancel"); bool VOIPCallAccept(const TiXmlElement *jingleNode, const char *from); bool VOIPCallIinitiate(MCONTACT hContact); diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index bfe3fa8c97..7870c6f7ba 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -1860,9 +1860,7 @@ bool CJabberProto::OnProcessJingle(const TiXmlElement *node) vc.state = VOICE_STATE_ENDED; NotifyEventHooks(m_hVoiceEvent, WPARAM(&vc), 0); - VOIPTerminateSession(); - m_voipSession.Empty(); - m_voipPeerJid.Empty(); + VOIPTerminateSession(nullptr); return true; } } diff --git a/protocols/JabberG/src/jabber_voip.cpp b/protocols/JabberG/src/jabber_voip.cpp index a982f86066..2262466334 100644 --- a/protocols/JabberG/src/jabber_voip.cpp +++ b/protocols/JabberG/src/jabber_voip.cpp @@ -348,7 +348,7 @@ err: return FALSE; } -bool CJabberProto::VOIPTerminateSession() +bool CJabberProto::VOIPTerminateSession(const char *reason) { if (m_pipe1) { gst_element_set_state(GST_ELEMENT(m_pipe1), GST_STATE_NULL); @@ -357,6 +357,16 @@ bool CJabberProto::VOIPTerminateSession() gst_print("Pipeline stopped\n"); } + if (reason && !m_voipSession.IsEmpty() && !m_voipPeerJid.IsEmpty()) { + XmlNodeIq iq("set", SerialNext(), m_voipPeerJid); + TiXmlElement *jingleNode = iq << XCHILDNS("jingle", JABBER_FEAT_JINGLE); + jingleNode << XATTR("action", "session-terminate") << XATTR("sid", m_voipSession); + jingleNode << XATTR("initiator", m_isOutgoing ? m_ThreadInfo->fullJID : m_voipPeerJid); + jingleNode << XCHILD("reason") << XCHILD(reason); + + m_ThreadInfo->send(iq); + } + m_voipICEPwd.Empty(); m_voipICEUfrag.Empty(); m_medianame.Empty(); -- cgit v1.2.3