Andreas Wehrmann
2018-10-30 21:50:31 UTC
Hello folks,
I'm currently writing a module for Asterisk
to make it divert a video stream to an external videoserver.
The scenario is this:
- some external participant is calling into Asterisk (offering audio+video)
- using SIP session supplements: in the incoming (INVITE) message callback,
a video session is set up on the videoserver (actually: this happens always, regardless of what is offered)
- using the dialplan, the call is routed to another PBX supporting audio only
(but video codecs are enabled on our side, so video will be offered by Asterisk)
- when the other PBX answers, I'm using SIP session supplements to determine whether the call answered by the other PBX supports video
-- if video is supported, my module does nothing
-- if video is rejected, I manipulate the SDP inside to make it seem to Asterisk
as if video actually was supported by inserting connection info pointing to the video server
What I've just described does work.
The SIP supplement is registered with a response priority of AST_SIP_SESSION_BEFORE_MEDIA
and handles the INVITE method only.
However, what doesn't work is if the external participant initially calls in
with audio only and enables video later by sending a reINVITE.
I do not get a callback from my already registered SIP supplement when the other PBX
responds to the reINVITE in order to give me a chance to manipulate the SDP.
I guess this is because the session was already active and thus "AFTER_MEDIA".
When I register a SIP supplement with "AST_SIP_SESSION_AFTER_MEDIA",
I do indeed get a callback for the reINVITE response,
but that happens too late, since SDP negotiation inside Asterisk has already happened.
I then tried to register an SDP handler (just to see what callbacks I get and whether they might be useful).
The only callback I receive is defer_incoming_sdp_stream() for the reINVITE that my Asterisk receives
which doesn't seem too useful for what I'm trying to do.
Since I had no more ideas left, I then tried to hook into PJSIP directly
by providing a pjsip_module that implements the on_rx_response() callback.
That doesn't really work either, because the callback never fired.
After I played around with module priority the callback eventually fired but I was unable to get the TSX and dialog references from PJ
(probably because the module got called too early?).
However I need those to get the corresponding ast_sip_session.
At this point, I don't know how to proceed.
Is there a way to hook into reINVITE responses to achieve what I'm trying to do?
Best regards,
Andreas
I'm currently writing a module for Asterisk
to make it divert a video stream to an external videoserver.
The scenario is this:
- some external participant is calling into Asterisk (offering audio+video)
- using SIP session supplements: in the incoming (INVITE) message callback,
a video session is set up on the videoserver (actually: this happens always, regardless of what is offered)
- using the dialplan, the call is routed to another PBX supporting audio only
(but video codecs are enabled on our side, so video will be offered by Asterisk)
- when the other PBX answers, I'm using SIP session supplements to determine whether the call answered by the other PBX supports video
-- if video is supported, my module does nothing
-- if video is rejected, I manipulate the SDP inside to make it seem to Asterisk
as if video actually was supported by inserting connection info pointing to the video server
What I've just described does work.
The SIP supplement is registered with a response priority of AST_SIP_SESSION_BEFORE_MEDIA
and handles the INVITE method only.
However, what doesn't work is if the external participant initially calls in
with audio only and enables video later by sending a reINVITE.
I do not get a callback from my already registered SIP supplement when the other PBX
responds to the reINVITE in order to give me a chance to manipulate the SDP.
I guess this is because the session was already active and thus "AFTER_MEDIA".
When I register a SIP supplement with "AST_SIP_SESSION_AFTER_MEDIA",
I do indeed get a callback for the reINVITE response,
but that happens too late, since SDP negotiation inside Asterisk has already happened.
I then tried to register an SDP handler (just to see what callbacks I get and whether they might be useful).
The only callback I receive is defer_incoming_sdp_stream() for the reINVITE that my Asterisk receives
which doesn't seem too useful for what I'm trying to do.
Since I had no more ideas left, I then tried to hook into PJSIP directly
by providing a pjsip_module that implements the on_rx_response() callback.
That doesn't really work either, because the callback never fired.
After I played around with module priority the callback eventually fired but I was unable to get the TSX and dialog references from PJ
(probably because the module got called too early?).
However I need those to get the corresponding ast_sip_session.
At this point, I don't know how to proceed.
Is there a way to hook into reINVITE responses to achieve what I'm trying to do?
Best regards,
Andreas
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
Astricon is coming up October 9-11! Signup is available at: https://www.asterisk.org/community/astricon-user-conference
asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
Astricon is coming up October 9-11! Signup is available at: https://www.asterisk.org/community/astricon-user-conference
asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk