diff --git a/specification/20_events.rst b/specification/20_events.rst index 6916e793d..dcd203b78 100644 --- a/specification/20_events.rst +++ b/specification/20_events.rst @@ -259,85 +259,7 @@ Call events are sent to a room, like any other event. This means that clients must only send call events to rooms with exactly two participants as currently the WebRTC standard is based around two-party communication. -Events -~~~~~~ -``m.call.invite`` -This event is sent by the caller when they wish to establish a call. - - Required keys: - - ``call_id`` : "string" - A unique identifier for the call - - ``offer`` : "offer object" - The session description - - ``version`` : "integer" - The version of the VoIP specification this - message adheres to. This specification is version 0. - - ``lifetime`` : "integer" - The time in milliseconds that the invite is - valid for. Once the invite age exceeds this value, clients should discard - it. They should also no longer show the call as awaiting an answer in the - UI. - - Optional keys: - None. - - Example:: - - { - "version" : 0, - "call_id": "12345", - "offer": { - "type" : "offer", - "sdp" : "v=0\r\no=- 6584580628695956864 2 IN IP4 127.0.0.1[...]" - } - } - -``Offer Object`` - Required keys: - - ``type`` : "string" - The type of session description, in this case - 'offer' - - ``sdp`` : "string" - The SDP text of the session description - -``m.call.candidates`` -This event is sent by callers after sending an invite and by the callee after -answering. Its purpose is to give the other party additional ICE candidates to -try using to communicate. - - Required keys: - - ``call_id`` : "string" - The ID of the call this event relates to - - ``version`` : "integer" - The version of the VoIP specification this - messages adheres to. his specification is version 0. - - ``candidates`` : "array of candidate objects" - Array of object - describing the candidates. - -``Candidate Object`` - - Required Keys: - - ``sdpMid`` : "string" - The SDP media type this candidate is intended - for. - - ``sdpMLineIndex`` : "integer" - The index of the SDP 'm' line this - candidate is intended for - - ``candidate`` : "string" - The SDP 'a' line of the candidate - -``m.call.answer`` - - Required keys: - - ``call_id`` : "string" - The ID of the call this event relates to - - ``version`` : "integer" - The version of the VoIP specification this - messages - - ``answer`` : "answer object" - Object giving the SDP answer - -``Answer Object`` - - Required keys: - - ``type`` : "string" - The type of session description. 'answer' in this - case. - - ``sdp`` : "string" - The SDP text of the session description - -``m.call.hangup`` -Sent by either party to signal their termination of the call. This can be sent -either once the call has has been established or before to abort the call. - - Required keys: - - ``call_id`` : "string" - The ID of the call this event relates to - - ``version`` : "integer" - The version of the VoIP specification this - messages +{{voip_events}} Message Exchange ~~~~~~~~~~~~~~~~ diff --git a/templating/build.py b/templating/build.py index 444dd9e25..dadf91ce5 100755 --- a/templating/build.py +++ b/templating/build.py @@ -105,7 +105,14 @@ def main(input_module, file_stream=None, out_dir=None, verbose=False): if not file_stream: print "\nValid template variables:" for key in sections.keys(): + sec_text = "" if (len(sections[key]) > 75) else ( + "(Value: '%s')" % sections[key] + ) + sec_info = "%s characters" % len(sections[key]) + if sections[key].count("\n") > 0: + sec_info += ", %s lines" % sections[key].count("\n") print " %s" % key + print " %s %s" % (sec_info, sec_text) return # check the input files and substitute in sections where required diff --git a/templating/matrix_templates/sections.py b/templating/matrix_templates/sections.py index 6d7831e45..e42bdf7bc 100644 --- a/templating/matrix_templates/sections.py +++ b/templating/matrix_templates/sections.py @@ -7,6 +7,13 @@ import os class MatrixSections(Sections): + # pass through git ver so it'll be dropped in the input file + def render_git_version(self): + return self.units.get("git_version") + + def render_spec_version(self): + return "0.1.0" + def render_room_events(self): template = self.env.get_template("events.tmpl") examples = self.units.get("event_examples") @@ -21,12 +28,19 @@ class MatrixSections(Sections): )) return "\n\n".join(sections) - # pass through git ver so it'll be dropped in the input file - def render_git_version(self): - return self.units.get("git_version") - - def render_spec_version(self): - return "0.1.0" + def render_voip_events(self): + template = self.env.get_template("events.tmpl") + examples = self.units.get("event_examples") + schemas = self.units.get("event_schemas") + sections = [] + for event_name in sorted(schemas): + if not event_name.startswith("m.call"): + continue + sections.append(template.render( + example=examples[event_name], + event=schemas[event_name] + )) + return "\n\n".join(sections) def _render_ce_type(self, type): template = self.env.get_template("common-event-fields.tmpl") diff --git a/templating/matrix_templates/templates/events.tmpl b/templating/matrix_templates/templates/events.tmpl index f3c20affc..862210409 100644 --- a/templating/matrix_templates/templates/events.tmpl +++ b/templating/matrix_templates/templates/events.tmpl @@ -4,8 +4,8 @@ {{event.typeof_info}} {{event.desc | wrap(80)}} -{% for table in event.content_fields %} -{{"``"+table.title+"``" if table.title else "" -}} +{% for table in event.content_fields -%} +{{"``"+table.title+"``" if table.title else "" }} ================== ================= =========================================== {{table.title or "Content"}} Key Type Description