tommyjlong / app_rtsp_sip

Asterisk Application - Two-way audio with your Camera using RTSP and SIP to an Asterisk Channel
23 stars 10 forks source link

ERROR[630][C-00000001]: app_rtsp_sip.c:2748 main_loop: -No Authenticate header found #2

Closed pergolafabio closed 2 years ago

pergolafabio commented 2 years ago

Hey @tommyjlong ,

Can you give me a quick help, i was testing your app, i was able to compile it succesfull, the .so loads.... But it gives me error:

[Apr 27 16:28:41] ERROR[630][C-00000001]: app_rtsp_sip.c:2748 main_loop: -No Authenticate header found

I think the .sh script doesnt work, in your .sh file all the files listed there, i dont see them when i extract asterisk

Actually the complete "source" dir is missing there?

image

What am i missing? I'm using this Asterisk-Addon for HA, in dockerfile there is also:

    ./configure \
        --with-pjproject-bundled \

https://github.com/TECH7Fox/asterisk-hass-addons/blob/main/asterisk/Dockerfile

I'm testing my own local version , if it works, we will merge this new app of yours, added this to dockerfile:

## Install app_rtsp_sip
WORKDIR /usr/src/asterisk
COPY patches/rtsp_sip_links.sh /usr/src/asterisk
RUN ./rtsp_sip_links.sh
COPY patches/app_rtsp_sip.c /usr/src/asterisk/apps

thnx, appreciated!!

tommyjlong commented 2 years ago

Its possible that asterisk version 18.x reorganized where it put the pjproject source files. However since the app_rtsp_sip compiled and ran, they may have changed the pjproject include files to where the apps can get to them directly, so it looks like the .sh file may not be needed anymore.

The error itself indicates that it received an RTSP response from a device, but the device didn't provide any authentication information, or more likely, it didn't provide authentication information with the expected formatted string, as I have found that this string format may be device dependent.

pergolafabio commented 2 years ago

Ah, I can try indeed a different rtsp url, this was I used was from camera , I can test from my Synology too

pergolafabio commented 2 years ago

I tried another stream, this time the one from my synology, but same error

how can i check/validate that header, to see the kind of authentication?

tommyjlong commented 2 years ago

Take a look at the first paragraph here concerning setting the debug level in Asterisk. In the debug output, look for something regarding the RTSP "Describe" message. In a response from the device, there should be an authorization header that looks like WWW-Authenticate: xxxxx where xxxx suggests what kind of authentication is to be used.

pergolafabio commented 2 years ago

Ok, gonna debug it later, but according to google, seems mine camera have 2 headers in the challenge, both basic and digest... I also see that in a wireshark trace... I think it needs digest, but your script tries basic first...

What do I need to modify in your script, do that it tried digest first? Or I'd there a way to force it?

Thnx

pergolafabio commented 2 years ago

here is the debug,

i use this in dialplan (asterisk runs on port 5050)

same = n,RTSP-SIP(rtsp://admin:XXXX@192.168.0.70:554/Streaming/Channels/102,0,Hikvision,5050)


[Apr 28 08:02:06] DEBUG[641][C-00000001]: pbx.c:2936 pbx_extension_helper: Launching 'RTSP-SIP'
[Apr 28 08:02:06]     -- Executing [999@default:3] RTSP-SIP("PJSIP/6000-00000000", "rtsp://admin:XXXXX@192.168.0.70:554/Streaming/Channels/102,0,Hikvision,5050") in new stack
[Apr 28 08:02:06] DEBUG[641][C-00000001]: app_rtsp_sip.c:4039 app_rtsp_sip: ARGs: RTSP URI rtsp://admin:XXXX@192.168.0.70:554/Streaming/Channels/102. SIP Realm Hikvision SIP Listen Port 5050
[Apr 28 08:02:06] DEBUG[641][C-00000001]: app_rtsp_sip.c:4143 app_rtsp_sip: IP: 192.168.0.70 RTSP port: 554 Username: admin Passwd: XXXXX URL_Path: /Streaming/Channels/102 isIPv6: 0, SIP Enable: 0, SIP Realm: Hikvision, port: 5050
[Apr 28 08:02:06] NOTICE[641][C-00000001]: app_rtsp_sip.c:2432 main_loop: >rtsp-sip main loop
[Apr 28 08:02:06] DEBUG[641][C-00000001]: app_rtsp_sip.c:821 GetUdpPorts: -GetUdpPorts final [38838,38839]
[Apr 28 08:02:06] DEBUG[641][C-00000001]: app_rtsp_sip.c:821 GetUdpPorts: -GetUdpPorts final [50898,50899]
[Apr 28 08:02:06] DEBUG[641][C-00000001]: app_rtsp_sip.c:942 RtspPlayerConnect: Local Ctrl IP: 192.168.0.17, Port: 43298
[Apr 28 08:02:06] DEBUG[641][C-00000001]: app_rtsp_sip.c:1179 RtspPlayerDescribe: >DESCRIBE [/Streaming/Channels/102]
[Apr 28 08:02:06] DEBUG[641][C-00000001]: app_rtsp_sip.c:1213 RtspPlayerDescribe: <DESCRIBE [/Streaming/Channels/102]
[Apr 28 08:02:06] DEBUG[641][C-00000001]: app_rtsp_sip.c:2529 main_loop: -rtsp play loop [0]
[Apr 28 08:02:06] DEBUG[641][C-00000001]: app_rtsp_sip.c:2716 main_loop: -receiving describe
[Apr 28 08:02:06] DEBUG[641][C-00000001]: app_rtsp_sip.c:2726 main_loop: -Describe response code [401]
[Apr 28 08:02:06] ERROR[641][C-00000001]: app_rtsp_sip.c:2749 main_loop: -No Authenticate header found
[Apr 28 08:02:06] DEBUG[641][C-00000001]: app_rtsp_sip.c:3737 main_loop: -rtsp_play end loop [0]
[Apr 28 08:02:06] DEBUG[641][C-00000001]: app_rtsp_sip.c:3803 main_loop: -sip tx vf count pre:0 post:0 error:0
[Apr 28 08:02:06] NOTICE[641][C-00000001]: app_rtsp_sip.c:3830 main_loop: <rtsp-sip main loop
[Apr 28 08:02:06] DEBUG[641][C-00000001]: pbx.c:2936 pbx_extension_helper: Launching 'Wait'
pergolafabio commented 2 years ago

in a wireshark i saw this before, as you can see basic/digest in the auth , i also receive a 401 there, but it actually uses "digest" further:

DESCRIBE rtsp://192.168.0.70/streaming/channels/101 RTSP/1.0
CSeq: 2
Accept: application/sdp
User-Agent: HIKVISION player NVR

RTSP/1.0 401 Unauthorized
CSeq: 2
WWW-Authenticate: Digest realm="Hikvision", nonce="5aba96f3f85851767b43ad32a0871ae6", random="+462w9mVKGL+MpScHTtAHnUz0v2OqIBWK69eQZlKqyX7ypxIT3K5fZHItr4Y22mW", stale="FALSE"
WWW-Authenticate: Basic realm="Hikvision"
Date:  Tue, Dec 28 2021 12:29:27 GMT

DESCRIBE rtsp://192.168.0.70/streaming/channels/101 RTSP/1.0
CSeq: 3
Accept: application/sdp
Authorization: Digest username="10010110001", realm="Hikvision", nonce="5aba96f3f85851767b43ad32a0871ae6", uri="/streaming/channels/101", response="4cbe56474115bd9a5e7c6d668bcd5743"
User-Agent: HIKVISION player NVR

RTSP/1.0 200 OK
CSeq: 3
Content-Type: application/sdp
Content-Length: 445
pergolafabio commented 2 years ago

Ok, now trying my RTSP stream from synology, wireshark only provides digest challenge, so no basic+digest like hikvision:

DESCRIBE rtsp://192.168.0.14:554/Sms=24.unicast RTSP/1.0
CSeq: 3
User-Agent: LibVLC/3.0.11 (LIVE555 Streaming Media v2016.11.28)
Accept: application/sdp

RTSP/1.0 401 Unauthorized
CSeq: 3
Date: Thu, Apr 28 2022 12:28:19 GMT
WWW-Authenticate: Digest realm="LIVE555 Streaming Media", nonce="6ec91188931388351c2308a1c71d5e80"

DESCRIBE rtsp://192.168.0.14:554/Sms=24.unicast RTSP/1.0
CSeq: 4
Authorization: Digest username="syno", realm="LIVE555 Streaming Media", nonce="6ec91188931388351c2308a1c71d5e80", uri="rtsp://192.168.0.14:554/Sms=24.unicast", response="525ecbdbb01a9a33beb08988faf88c72"
User-Agent: LibVLC/3.0.11 (LIVE555 Streaming Media v2016.11.28)
Accept: application/sdp

RTSP/1.0 200 OK
CSeq: 4
Date: Thu, Apr 28 2022 12:28:19 GMT
Content-Base: rtsp://192.168.0.14/devType=1&devId=24/1,24_medium.unicast/
Content-Type: application/sdp
Content-Length: 379

for test used this dialplan:

exten = 999,1,Answer()
same = n,Wait(1)
same = n,RTSP-SIP(rtsp://syno:XXX@192.168.0.14:554/Sms=24.unicast,0,"LIVE555 Streaming Media",5060)
same = n,Wait(10)
same = n,Hangup()

But still same error?


[Apr 28 14:45:54] DEBUG[641][C-00000001]: pbx.c:2936 pbx_extension_helper: Launching 'RTSP-SIP'
[Apr 28 14:45:54]     -- Executing [999@default:3] RTSP-SIP("PJSIP/6000-00000000", "rtsp://syno:XXXXX@192.168.0.14:554/Sms=24.unicast,0,LIVE555 Streaming Media,5060") in new stack
[Apr 28 14:45:54] DEBUG[641][C-00000001]: app_rtsp_sip.c:4039 app_rtsp_sip: ARGs: RTSP URI rtsp://syno:XXXXX@192.168.0.14:554/Sms=24.unicast. SIP Realm LIVE555 Streaming Media SIP Listen Port 5060
[Apr 28 14:45:54] DEBUG[641][C-00000001]: app_rtsp_sip.c:4143 app_rtsp_sip: IP: 192.168.0.14 RTSP port: 554 Username: syno Passwd: XXXXXURL_Path: /Sms=24.unicast isIPv6: 0, SIP Enable: 0, SIP Realm: LIVE555 Streaming Media, port: 5060
[Apr 28 14:45:54] NOTICE[641][C-00000001]: app_rtsp_sip.c:2432 main_loop: >rtsp-sip main loop
[Apr 28 14:45:54] DEBUG[641][C-00000001]: app_rtsp_sip.c:821 GetUdpPorts: -GetUdpPorts final [42182,42183]
[Apr 28 14:45:54] DEBUG[641][C-00000001]: app_rtsp_sip.c:821 GetUdpPorts: -GetUdpPorts final [59664,59665]
[Apr 28 14:45:54] DEBUG[641][C-00000001]: app_rtsp_sip.c:942 RtspPlayerConnect: Local Ctrl IP: 192.168.0.17, Port: 37602
[Apr 28 14:45:54] DEBUG[641][C-00000001]: app_rtsp_sip.c:1179 RtspPlayerDescribe: >DESCRIBE [/Sms=24.unicast]
[Apr 28 14:45:54] DEBUG[641][C-00000001]: app_rtsp_sip.c:1213 RtspPlayerDescribe: <DESCRIBE [/Sms=24.unicast]
[Apr 28 14:45:54] DEBUG[641][C-00000001]: app_rtsp_sip.c:2529 main_loop: -rtsp play loop [0]
[Apr 28 14:45:54] DEBUG[641][C-00000001]: app_rtsp_sip.c:2716 main_loop: -receiving describe
[Apr 28 14:45:54] DEBUG[641][C-00000001]: app_rtsp_sip.c:2726 main_loop: -Describe response code [401]
[Apr 28 14:45:54] ERROR[641][C-00000001]: app_rtsp_sip.c:2749 main_loop: -No Authenticate header found
[Apr 28 14:45:54] DEBUG[641][C-00000001]: app_rtsp_sip.c:3737 main_loop: -rtsp_play end loop [0]
[Apr 28 14:45:54] DEBUG[641][C-00000001]: app_rtsp_sip.c:3803 main_loop: -sip tx vf count pre:0 post:0 error:0
[Apr 28 14:45:54] NOTICE[641][C-00000001]: app_rtsp_sip.c:3830 main_loop: <rtsp-sip main loop
[Apr 28 14:45:54] DEBUG[641][C-00000001]: pbx.c:2936 pbx_extension_helper: Launching 'Wait'
[Apr 28 14:45:54]     -- Executing [999@default:4] Wait("PJSIP/6000-00000000", "10") in new stack

What am i missing?

pergolafabio commented 2 years ago

Looks like its always trying the basic authenticate, according to line 2737

pergolafabio commented 2 years ago

next test, this time i setup VLC as streaming server, ir provides me then a RTSP without auth: rtsp://192.168.0.232:8554/vlc From another PC i can open that stream, no issue

exten = 999,1,Answer()
same = n,Wait(1)
same = n,RTSP-SIP(rtsp://192.168.0.232:8554/vlc,0,blabla,5060)
same = n,Wait(10)
same = n,Hangup()

When i call 999 from linphone/softphone/... tried some softphone apps, i dont see any video?

What am i missing? H264 is enabled in softphone as codec

[Apr 28 15:33:52]     -- Executing [999@default:1] Answer("PJSIP/6000-00000000", "") in new stack
[Apr 28 15:33:53]     -- Executing [999@default:2] Wait("PJSIP/6000-00000000", "1") in new stack
[Apr 28 15:33:54]     -- Executing [999@default:3] RTSP-SIP("PJSIP/6000-00000000", "rtsp://192.168.0.232:8554/vlc,0,asterisk,5050") in new stack
[Apr 28 15:33:54] NOTICE[630][C-00000001]: app_rtsp_sip.c:2432 main_loop: >rtsp-sip main loop
[Apr 28 15:33:54] NOTICE[630][C-00000001]: app_rtsp_sip.c:3830 main_loop: <rtsp-sip main loop
[Apr 28 15:33:54]     -- Executing [999@default:4] Wait("PJSIP/6000-00000000", "10") in new stack
[Apr 28 15:34:04]     -- Executing [999@default:5] Hangup("PJSIP/6000-00000000", "") in new stack
[Apr 28 15:34:04]   == Spawn extension (default, 999, 5) exited non-zero on 'PJSIP/6000-00000000'
pergolafabio commented 2 years ago

next step, i found this cool addon : i provides me a new proxy stream, also no auth needed : https://github.com/alex-savin/hassio-addons/tree/master/live555

RTSP stream, proxying the stream "rtsp://admin:XXXX@192.168.0.70:554/Streaming/Channels/102"
    Play this stream using the URL: rtsp://172.30.33.5/stream
(We use port 80 for optional RTSP-over-HTTP tunneling.)

When i use that, i get another error:

[Apr 28 16:35:20]     -- Executing [doorbell_rtsp@from-internal-custom:2] RTSP-SIP("Local/doorbell_rtsp@from-internal-custom-00000000;2", "rtsp://172.30.33.5:554/stream,0,asterisk,5050") in new stack
[Apr 28 16:35:20] NOTICE[632][C-00000002]: app_rtsp_sip.c:2432 main_loop: >rtsp-sip main loop
[Apr 28 16:35:20] WARNING[632][C-00000002]: app_rtsp_sip.c:1882 CreateSDP:     peer rtp port is not provided
[Apr 28 16:35:20] WARNING[632][C-00000002]: app_rtsp_sip.c:1882 CreateSDP:     peer rtp port is not provided
[Apr 28 16:35:20] WARNING[633][C-00000002]: translate.c:423 framein: Out of buffer space

What do i need todo here? where can i provide RTP port?

tommyjlong commented 2 years ago

WWW-Authenticate: Digest realm="Hikvision", nonce="5aba96f3f85851767b43ad32a0871ae6", random="+462w9mVKGL+MpScHTtAHnUz0v2OqIBWK69eQZlKqyX7ypxIT3K5fZHItr4Y22mW", stale="FALSE" WWW-Authenticate: Basic realm="Hikvision"

The CheckHeaderValue function that is used came with the original code. It searches until it finds the first match (in this case WWW-Authenticate:) and then looks to see if the Value (in this case Basic realm=) matches and returns (in this case returns false). I think it would be possible to change this code to continue searching for another instance of Header and check its Value.

Looks like its always trying the basic authenticate, according to line 2737

Correct. The original code only supported Basic authentication for RTSP and I never got around to adding Digest to the original code. In contrast, my video doorbell's SIP protocol only handled Digest Authentication which I added, but never got around to adding Basic Authentication for the SIP protocol,.

When i call 999 from linphone/softphone/... tried some softphone apps, i dont see any video? app_rtsp_sip code only extracts the audio from the RTSP stream and injects it into the Asterisk Channel. It does not extract the RTSP video. My use case was to send the RTSP video directly to Home Assistant for viewing.

I would actually like to go back and try add the RTSP video into an Asterisk channel for delivering over WebRTC.

What do i need todo here? where can i provide RTP port?

I don't know anything about this live555 proxy.

Probably the overall easiest thing for you to do is change the line 2737 from Basic to Digest, which will allow the RTSP code to continue running but will still run Basic RTSP authentication with your Hikvision.

As for me making updates, it is something I would like to do, I just don't know yet when I will get around to it.

pergolafabio commented 2 years ago

Ok, thnx , i will change that line and see whats happens

I dont think the camera doesnt support basic authentication at all, and if the script doesnt work well, i want to use the proxy to strip the auth completely, but then i receive error below... what does that mean?

[Apr 28 16:35:20] WARNING[632][C-00000002]: app_rtsp_sip.c:1882 CreateSDP:     peer rtp port is not provided
[Apr 28 16:35:20] WARNING[632][C-00000002]: app_rtsp_sip.c:1882 CreateSDP:     peer rtp port is not provided
[Apr 28 16:35:20] WARNING[633][C-00000002]: translate.c:423 framein: Out of buffer space

Another proxy gives me this:

[Apr 28 19:14:03] NOTICE[628][C-00000001]: app_rtsp_sip.c:2432 main_loop: >rtsp-sip main loop
[Apr 28 19:14:03] WARNING[628][C-00000001]: app_rtsp_sip.c:1882 CreateSDP:     peer rtp port is not provided
[Apr 28 19:14:03] WARNING[628][C-00000001]: app_rtsp_sip.c:1882 CreateSDP:     peer rtp port is not provided
[Apr 28 19:14:13] ERROR[628][C-00000001]: app_rtsp_sip.c:2339 RecvResponse: Error receiving response [-1,111].Connection refused
[Apr 28 19:14:13] WARNING[628][C-00000001]: app_rtsp_sip.c:3397 main_loop: -Error reading rtcp from [31]
[Apr 28 19:14:13] NOTICE[628][C-00000001]: app_rtsp_sip.c:3830 main_loop: <rtsp-sip main loop

if i open same rtsp url in VLC to test, then it works

pergolafabio commented 2 years ago

so i think i'm almost there :-)

pergolafabio commented 2 years ago

I added a generic camera in HA , and choose basic authentication, seems my hikvision is supporting it :-)

so i changed that line 2737, compiling now again, lets see what happens next ...

pergolafabio commented 2 years ago

aha, succes now, i have video , seems it needed basis auth, without auth (proxy method), it doesnt work...

pergolafabio commented 2 years ago

Now i only need this, it must be possible, looks so simple:

https://community.asterisk.org/t/dialplan-invite-an-rtsp-stream-extension/92474

_Hi, i’m running an extra app apprtsp, it injects an rtsp stream, so when i call 666 with dialplan below, i can see the actual RTSP stream!! working great , to actual view cameras from a softphone…

exten = 666,1,Answer()
same = n,Wait(1)
same = n,RTSP-SIP(rtsp://admin:xxxx@192.168.0.70:554/Streaming/Channels/102,0,Hikvision,5060)
same = n,Wait(10)
same = n,Hangup()

_Now, what i want to accomplish I have user 6000 and 6001 When user 6000 calls to 6001 , when 6001 picksup, 6001 needs to see the RTSP stream… Is that possible?

Thnx in advance_

tommyjlong commented 2 years ago

aha, succes now, i have video ,

Sounds good (I think) ....but what do you mean you have video? app_rtsp_sip doesn't handle video

pergolafabio commented 2 years ago

I mean by video, that I can see the rtsp stream (video) on my sofphone , when I call that ghost extension

pergolafabio commented 2 years ago

What's also strange, if I call from linphone on desktop, I can see the rtsp, if I install linphone on android, then I don't see the rtsp, I can only hear the audio... While same h264 is enabled... Other softphone on android, like acrobits, that works fine... But linphone doesn't... Any idea? Maybe a resolution issue or something?

tommyjlong commented 2 years ago

I am puzzled, how are you getting video to your softphone since app_rtsp_sip is not passing RTSP video to Asterisk?

pergolafabio commented 2 years ago

i was just following your examle code code, so if i call that nr 101 , i can see the RTSP video on my softphone?

[from-internal]
;Doorbell 2-way
exten = 101,1,Answer()
same = n,Wait(1)
same = n,RTSP-SIP(rtsp://DOORBELL_PHONE_EXTENSION:DOORBELL_USER_PASSWORD@IP_ADDRESS:554/live.sdp,1,streaming_server,5060)
same = n,Wait(5)
same = n,Hangup()

I'm now trying to add more people to he call, maybe i can then join a softphone to the conf, when the doorstation is making the call to : 888 , so page in this case the doorbell_rtsp user, if that works, i can Page more people to the call but for some reason, if i do below, i dont see the RTSP

ex:

exten => 888,1,Answer()
same => n,Page(Local/doorbell_rtsp@from-internal-custom,qd)

[from-internal-custom]
exten => doorbell_rtsp,1,Answer()
same => n,RTSP-SIP(rtsp://admin:XXX@192.168.0.70:554/Streaming/Channels/102,0,Hikvision,5060)
tommyjlong commented 2 years ago

Well.... I guess I'm mistaken. I took a look at the code, and it looks like the video code does the same codec negotiation with Asterisk as the audio code, and similarly the video code is writing a video frame to the asterisk channel, similarly to the audio code. So yeah sending video may actually work, I just never tested it.

pergolafabio commented 2 years ago

Yes indeed, I just need a working dialplan

pergolafabio commented 2 years ago

For info, i removed the check "CheckHeaderValue " completely, on that 401 function I tested also another camera, only with Digest, and it worked too, so basic + digest is working!

tommyjlong commented 2 years ago

For info, i removed the check "CheckHeaderValue " completely, on that 401 function I tested also another camera, only with Digest, and it worked too, so basic + digest is working!

Looking at the code, I don't see any place that Digest Authentication is being called for use with RTSP. So removing a CheckHeaderValue check would still not cause Digest Authentication to be used for RTSP..... unless you added/changed code to do it :)

pergolafabio commented 2 years ago

Hmm, strange, if I look in wireshark, the rtsp from Synology, there is only digest there...

FrancescoTalotta commented 1 month ago

Hello @pergolafabio ,

I'm having the same No Authenticate header found issue with a Hikvision doorbell, how did you solve in the end?

Thank you

Francesco

pergolafabio commented 1 month ago

Yeah, we removed that check, see here... https://github.com/TECH7Fox/asterisk-hass-addons/tree/main/asterisk/patches

FrancescoTalotta commented 1 month ago

Thank you very much for your reply,

I tried that and now I have no errors, but I see nothing when I try to get the video on my linphone. This is the asterisk output:

Connected to Asterisk 20.8.1 currently running on openhabian (pid = 20254)
  == Using SIP VIDEO CoS mark 6
  == Using SIP RTP CoS mark 5
       > 0xf4725fb0 -- Strict RTP learning after remote address set to: 192.168.1.122:7078
       > 0xf4728a68 -- Strict RTP learning after remote address set to: 192.168.1.122:9078
    -- Executing [555@phones:1] Answer("SIP/ciccio-0000000c", "") in new stack
       > 0xf4725fb0 -- Strict RTP switching to RTP target address 192.168.1.122:7078 as source
    -- Executing [555@phones:2] Wait("SIP/ciccio-0000000c", "1") in new stack
    -- Executing [555@phones:3] RTSP-SIP("SIP/ciccio-0000000c", "rtsp://admin:passwd!@192.168.1.4:554/Streaming/Channels/102,0,Hikvision,5060") in new stack
[Aug 29 13:28:16] NOTICE[30127][C-00000008]: app_rtsp_sip.c:2436 main_loop: >rtsp-sip main loop
[Aug 29 13:28:16] NOTICE[30127][C-00000008]: app_rtsp_sip.c:3833 main_loop: <rtsp-sip main loop
    -- Executing [555@phones:4] Wait("SIP/ciccio-0000000c", "10") in new stack
       > 0xf4728a68 -- Strict RTP switching to RTP target address 192.168.1.122:9078 as source
       > 0xf4725fb0 -- Strict RTP learning complete - Locking on source address 192.168.1.122:7078
       > 0xf4728a68 -- Strict RTP learning complete - Locking on source address 192.168.1.122:9078
    -- Executing [555@phones:5] Hangup("SIP/ciccio-0000000c", "") in new stack
  == Spawn extension (phones, 555, 5) exited non-zero on 'SIP/ciccio-0000000c'

and this is the extension I have:

exten = 555,1,Answer()
same = n,Wait(1)
same = n,RTSP-SIP(rtsp://admin:passwd!@192.168.1.4:554/Streaming/Channels/102,0,Hikvision,5060)
same = n,Wait(10)
same = n,Hangup()

Do I have to set something in the sip.conf file?

Thank you

pergolafabio commented 1 month ago

Make sure to enable h264 codec on your sip config , also enable video on your linphone clients

FrancescoTalotta commented 1 month ago

It's enabled already on my linphone terminal, as I already use video calls between terminals:

[ciccio]
        type=friend
        context=phones
        allow=ulaw,alaw,h264
        secret=passwd
        host=dynamic

it's also enabled on the doorbell:

[1000]
        type=friend
        context=doorbell_out
        allow=ulaw,alaw,h264
        secret=passwd
        host=dynamic

I don't understand why I get a black screen. Is RTSP-SIP(rtsp://admin:passwd!@192.168.1.4:554/Streaming/Channels/102,0,Hikvision,5060) right?

Thank you

pergolafabio commented 1 month ago

I need to check later when I'm home

pergolafabio commented 1 month ago

Also make sure to run latest SDK. I also had the black screen, they fixed it I a newer version, see below...

https://github.com/BelledonneCommunications/linphone-android/issues/1665

FrancescoTalotta commented 1 month ago

Thank you very much for your reply. It looks like it's an android linphone. I'm currently using the one for mac os x. I also tried with a office video phone that I regularly use to call Linphone terminals, but I also get the same black screen.

FrancescoTalotta commented 1 month ago

@pergolafabio I forgot to mention that the Asterisk server runs on a Raspberry pi 5

pergolafabio commented 1 month ago

That doesn't matter :-)

FrancescoTalotta commented 1 month ago

I finally figured out what was my problem..I did not apply the patch properly. Now I can see the hikvision camera input, although I have a warnings and an error when I try to close the call:

  == Using SIP VIDEO CoS mark 6
  == Using SIP RTP CoS mark 5
       > 0xf48133c8 -- Strict RTP learning after remote address set to: 192.168.1.12:10134
       > 0xf4815e80 -- Strict RTP learning after remote address set to: 192.168.1.12:10136
    -- Executing [555@phones:1] Answer("SIP/soggiorno-00000001", "") in new stack
       > 0xf48133c8 -- Strict RTP switching to RTP target address 192.168.1.12:10134 as source
    -- Executing [555@phones:2] Wait("SIP/soggiorno-00000001", "1") in new stack
       > 0xf4815e80 -- Strict RTP switching to RTP target address 192.168.1.12:10136 as source
    -- Executing [555@phones:3] RTSP-SIP("SIP/soggiorno-00000001", "rtsp://admin:passwd@192.168.1.4:554/Streaming/Channels/102,0,Hikvision,5060") in new stack
[Aug 30 15:48:54] NOTICE[11294][C-00000002]: app_rtsp_sip.c:2435 main_loop: >rtsp-sip main loop
[Aug 30 15:48:54] WARNING[11294][C-00000002]: app_rtsp_sip.c:1885 CreateSDP:     peer rtp port is not provided
       > 0xf48133c8 -- Strict RTP learning complete - Locking on source address 192.168.1.12:10134
       > 0xf4815e80 -- Strict RTP learning complete - Locking on source address 192.168.1.12:10136
[Aug 30 15:49:45] ERROR[11294][C-00000002]: app_rtsp_sip.c:2585 main_loop: ast_read() failed. Bail out!
[Aug 30 15:49:45] NOTICE[11294][C-00000002]: app_rtsp_sip.c:3840 main_loop: <rtsp-sip main loop

Now I have to figure out how to setup a conference call to gather the two way audio and the video at the same time.

Thank you for your help :))

Francesco

pergolafabio commented 1 month ago

Look here:

https://github.com/pergolafabio/Hikvision-Addons/blob/main/asterisk/asterisk.as.indoor.md