From 8571e4ffdeed85194ebcab9e4ee1ba1d7b526aa5 Mon Sep 17 00:00:00 2001 From: Wenpeng Song <wenpeng.song@iopsys.eu> Date: Mon, 18 Dec 2023 14:44:32 +0100 Subject: [PATCH] update --- codecs-sync-design.md | 51 ++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/codecs-sync-design.md b/codecs-sync-design.md index f41a9fc..c88864e 100644 --- a/codecs-sync-design.md +++ b/codecs-sync-design.md @@ -7,13 +7,13 @@ sequenceDiagram participant B as voicemngr participant C as chan-voicemngr alt is fxs - Note over B: update request cap with fxs cap <br/> --------------------------------------------- + Note over B: update out_request_cap with fxs cap <br/> --------------------------------------------------- else is dect - Note over A: update request cap with enpt cap <br/> ----------------------------------------------- + Note over A: update out_request_cap with enpt cap <br/> ----------------------------------------------------- A->>B: new call end B->>C: init call - Note over C: chan_voicemngr_start_calling<br/>/chan_voicemngr_new: <br/> sem_wait() <br/> Read request cap from shared memory <br/> sem_post() <br/> update cap and continue with outgoing process <br/> ------------------------------------------------------------------ + Note over C: chan_voicemngr_start_calling<br/>/chan_voicemngr_new: <br/> sem_wait() <br/> Read out_request_cap from shared memory <br/> sem_post() <br/> update cap and continue with outgoing process <br/> ------------------------------------------------------------------ ``` #### incoming calls @@ -26,44 +26,45 @@ sequenceDiagram Note left of A : Incoming call Note over A: incoming codec offer negotiation with pjsip cap <br/> and keep the list <br/>which used for calling chan_voicemngr <br/> ------------------------------------------------------------------ A->>B: chan_voicemngr_new(..., codec_list) - Note over B: chan_voicemngr_new: <br/> require and wait for endpoint cap by <br/> sem_wait() <br/> Read extension cap from shared memory <br/> update request cap to shared memory <br/> sem_post() <br/> update cap and continue with incoming process <br/> hangup chan if no shared cap <br/> ------------------------------------------------------------------ + Note over B: chan_voicemngr_new: <br/> sem_wait() <br/> Read extension_cap from shared memory <br/> update in_request_cap to shared memory <br/> sem_post() <br/> update cap and continue with incoming process <br/> hangup chan if no shared cap <br/> ------------------------------------------------------------------ B->>A: cap update and continue with incoming process A->>C: indicate RINGING alt is fxs answered - Note over C: update answered cap with fxs cap <br/> ------------------------------------------------ + Note over C: update answered_cap <br/> combined with <br/> in_request_cap and fxs cap <br/> ---------------------------------------- else is dect answered - Note over D: update answered cap with enpt cap <br/> -------------------------------------------------- + Note over D: update answered_cap <br/> combined with <br/> in_request_cap and enpt cap <br/> ------------------------------------------ end C->>A: Answered - Note over A: pjsip/res_pjsip_sdp_rtp.c: <br/> update cap with answered cap. <br/> -------------------------------------------- + Note over A: pjsip/res_pjsip_sdp_rtp.c: <br/> update cap with answered_cap. <br/> -------------------------------------------- Note left of A: 200OK ``` ### Tasks need to be done #### shared memory among voicemngr/dectmngr/chan-voicemngr - - extension cap, cap list for each extension - - endpt cap, cap list for each handset - - request cap, the cap list of the initiator for the ongoing request. - - answered cap, the cap list of the answered handset. + - extension_cap: cap list for each extension; R/W dectmngr, voicemngr; R chan-voicemngr. + - out_request_cap: the cap list of the initiator for the outgoing request; R/W voicemngr,dectmngr; R chan-voicemngr. + - in_request_cap: the cap list of the initiator for the incoming request; W/R chan-voicemngr; R voicemngr,dectmngr + - answered_cap: the cap list available of the answered handset combine with in_request_cap; R/W voicemngr,dectmngr; R asterisk/pjsip #### dectmngr - attach/detach the shared memory when process start/exit - - update dect cap while handset register/un-register - - update extension cap combine with extension mapping while handset register/un-register - - update shared memory of the extension cap (sem_wait, sem_post) while handset register/un-register - - While incoming call: read the request cap (sem_wait, sem_post) and ring handset only when the cap available; update answered cap(sem_wait, sem_post) with endpt cap if a handset answered. - - While outgoing call: update the request cap (sem_wait, sem_post) then start the call. + - update dect endpt_cap while handset register/un-register + - update extension_cap combine with extension mapping while handset register/un-register + - update shared memory of the extension_cap (sem_wait, sem_post) while handset register/un-register + - While incoming call: read the in_request_cap (sem_wait, sem_post) and ring handset only when the cap available; update answered_cap(sem_wait, sem_post) with combined result of in_request_cap and endpt_cap if a handset answered. + - While outgoing call: update the out_request_cap (sem_wait, sem_post) with endpt_cap then start the call. #### voicemngr - create,attach/detach,remove shared memory when process start/exit - sem_init/sem_destory when process start/exit - - FXS cap init with process start, and update the shared memory(sem_wait,sem_post). - - update request cap to shared memory(sem_wait,sem_post) when FXS init a call(outgoing). - - update answered cap with fxs cap to shared memory(sem_wait,sem_post) when FXS answered a call(incoming). + - FXS cap init with process start, and update the shared memory of the extension_cap(sem_wait,sem_post). + - update out_request_cap to shared memory(sem_wait,sem_post) with FXS cap when FXS init a call(outgoing). + - update answered_cap with fxs cap to shared memory(sem_wait,sem_post) with combined result of in_request_cap and FXS cap when FXS answered a call(incoming). #### chan-voicemngr - attach/detach the shared memory when process start/exit - - get terminal cap while creating new call + - check extension_cap and update in_request_cap while incoming call + - read and use out_request_cap while outgoing call ``` chan_voicemngr_new(..., struct ast_format_cap *format){ ... @@ -71,13 +72,13 @@ chan_voicemngr_new(..., struct ast_format_cap *format){ if (format) { - ast_format_cap_append_from_cap(caps, format, AST_MEDIA_TYPE_UNKNOWN); + incoming call: -+ sem_wait, read shared memory for extension cap, update request cap, sem_post -+ check with the endpoint codec cap and update the incoming cap, hangup chan if no shared cap. ++ sem_wait, read shared memory for extension_cap, update in_request_cap, sem_post ++ check with the extension codec cap and update the incoming cap, hangup chan if no shared cap. } else { - ast_format_cap_append_from_cap(caps, default_cap, AST_MEDIA_TYPE_UNKNOWN); + outgoing call: -+ sem_wait, read shared memory for request cap, sem_post -+ using the endpoint codec cap instead of default_cap ++ sem_wait, read shared memory for out_request cap, sem_post ++ using the out_request_cap instead of default_cap } ... } @@ -86,4 +87,4 @@ chan_voicemngr_new(..., struct ast_format_cap *format){ #### asterisk/pjsip - keep incoming codecs offer list(only first in the list is kept at the moment) after negotiation with pjsip codec config(pjsip_endpoint.conf `incoming_call_offer_pref = remote_merge`, uci sip_service_provider.codec_list) and call chan_voicemngr_new with the cap_list - - update this part with the answered cap https://dev.iopsys.eu/voice/asterisk/-/blob/devel/res/res_pjsip_sdp_rtp.c#L2193-2205 and make sure that updated cap is ready before 200OK response, and has been used in the 200OK correctly. \ No newline at end of file + - update this part with the answered_cap https://dev.iopsys.eu/voice/asterisk/-/blob/devel/res/res_pjsip_sdp_rtp.c#L2193-2205 and make sure that updated cap is ready before 200OK response, and has been used in the 200OK correctly. \ No newline at end of file -- GitLab