notification_center.post_notification('SIPConferenceDidNotAddParticipant', sender=self.session, data=NotificationData(participant=self.participant_uri, code=0, reason='remote endpoint is not a focus'))
else:
notification_center.post_notification('SIPConferenceDidNotRemoveParticipant', sender=self.session, data=NotificationData(participant=self.participant_uri, code=0, reason='remote endpoint is not a focus'))
# Because we only allow the remote tag to be optional, it can only match established dialogs and early outgoing dialogs, but not early incoming dialogs,
# which according to RFC3891 should be rejected with 481 (which will happen automatically by never matching them).
if replaces_header.early_only or replaces_header.from_tag == '0':
replaced_session = next(session for session in session_manager.sessions if session.dialog_id == replaced_dialog_id)
except StopIteration:
invitation.send_response(481)
return
else:
# Any matched dialog at this point is either established, terminated or early outgoing.
if replaced_session.state in ('terminating', 'terminated'):
invitation.send_response(603)
return
elif replaced_session.dialog_id.remote_tag is not None and replaces_header.early_only: # The replaced dialog is established, but the early-only flag is set
# the only reason for which this error can be thrown is if invitation.send_response was called after the INVITE session was cancelled by the remote party
# the only reason for which this error can be thrown is if invitation.send_response was called after the INVITE session was cancelled by the remote party
hold_supported_streams = (stream for stream in self.streams if stream.hold_supported)
notification_center.post_notification('SIPSessionDidChangeHoldState', self, NotificationData(originator='local', on_hold=True, partial=any(not stream.on_hold_by_local for stream in hold_supported_streams)))
if added_media_indexes | reused_media_indexes and removed_media_indexes:
engine = Engine()
self._invitation.send_response(488, extra_headers=[WarningHeader(399, engine.user_agent, 'Both removing AND adding a media stream is currently not supported')])