Combine Audio And Video From Two Different Sources

Home » Asterisk Users » Combine Audio And Video From Two Different Sources
Asterisk Users 3 Comments

I’m trying to combine audio and video from two different sources. The application is a door intercom system with a separate RTSP video camera. I’d like the door intercom to be able to call an extension and that receiving extension will show the video and have two-way audio. Also it would be nice to be able to call the door intercom as the answering device and show the video as well.

I have this working when the door intercom is the answering device. I’ve found some source code which bridges an RTSP stream to an Asterisk channel. Using this I have a working solution with this dialplan:

[from-internal-custom] ; Doorbell video bridge exten => doorbell_rtsp,1,Answer() same => n,RTSP-SIP(rtsp://
admin:12345@192.168.24.53:554/live/sub,0,asterisk,5060)
; Doorbell combined video/audio incoming exten => 762,1,Answer() same =>
n,Page(PJSIP/805&Local/doorbell_rtsp@from-internal-custom,qd)

The problem comes when I try to get the door intercom to call an extension. Because the calling device (door intercom) does not include video, the video capability is not added to the ConfBridge and therefore when I bridge in the RTSP-SIP channel it does not connect. When I tried to use Originate it had the same problem, no video codec was offered.

Is there some way I can create a ConfBridge and force a video codec? Or use Originate with a video codec?

I see that Asterisk has included Streams for a while now. Maybe this is the best way forward but I’m not sure this is something I can easily configure without writing a bunch of new code.

Thanks, Ryan

3 thoughts on - Combine Audio And Video From Two Different Sources

  • Le 30/06/2021 à 16:10, Ryan Press a écrit :
    Hello,

    Did you try to use ARI’s “originate” function with the “format”
    parameter containing a video codec ?

  • Thanks very much for the help! The originate from the ARI is working much better, I can now add RTSP-SIP channel with video to the bridge.

    I have made a Python script here:
    https://pastebin.com/iyWPdNJp

    There is one last problem though, it seems that the video does not connect right away, it is only a black screen. If I press “hold” on then off with videophone or if I stop/start video (also from videophone) then the video starts working. I think the key here is a re-INVITE. I looked at the SIP
    packets and the initial INVITE looks okay, so I am thinking something is not quite right with Asterisk and it needs a little kick?

    Here are the packets showing first and second INVITE:
    https://pastebin.com/xKwNb1nt

    I have found this here, maybe related?
    https://community.asterisk.org/t/ari-add-channels-to-a-bridge-with-video-source/88959

    Is there some way to execute re-INVITE from ARI?

    Thanks, Ryan

  • Le 06/07/2021 à 21:40, Ryan Press a écrit :
    At first glance I thought it was not possible, but maybe you can try to hold/unhold the channel. No idea if it will actually work.