Combining audio and video streams from different extensions

I’m working on a solution for my home door intercom. I would like to combine the RTSP video (from surveillance camera) with SIP audio (from intercom unit). I’m using this custom app (it needed a few bug fixes) here:

GitHub - tommyjlong/app_rtsp_sip: Asterisk Application - Two-way audio with your Camera using RTSP and SIP to an Asterisk Channel.

I didn’t need to use the SIP connection part of that app, it is meant for audio to the intercom but I have that working instead with the Page/ConfBridge.

I can successfully dial into the intercom and view the video from my video phone with this dialplan. This works great! 805 is the intercom.

[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)

Now I am trying to get the opposite to work where the intercom can dial the phone and the phone can watch the video. 701 is my phone.

[add-video]
exten => s,1,Set(PJSIP_MEDIA_OFFER(video)=h264)
same => n,Set(PJSIP_SEND_SESSION_REFRESH()=invite)
same => n,Return()
[from-internal-custom]
; Doorbell combined video/audio to 701
exten => 763,1,Answer()
same => n,Page(PJSIP/701&Local/doorbell_rtsp@from-internal-custom,qdB(add-video^s^1))

These are my three problems with this:

  1. The phone and RTSP-SIP aren’t offered the h264 codec so the video does not work
  2. The intercom will connect regardless of if the phone picks up
  3. The intercom won’t disconnect when the phone hangs up

I also tried playing around with ConfBridge and Originate and I couldn’t make it any better. Originate does not have any ability to offer video codecs.

I can probably figure out 2 & 3 but 1 I’m not sure. I’m guessing that unless the intercom actually connects with h264, the Page/ConfBridge will not offer it to the phone and RTSP-SIP.

Maybe I’m really close? Or maybe very far! :smiley: Anyone have ideas? Thanks!