From 253ac1d66977ce03b5e1450b21c4a22305e2b5de Mon Sep 17 00:00:00 2001 From: Eddie Fiorentine Date: Thu, 14 Nov 2024 09:59:20 -0500 Subject: [PATCH 1/2] rtpengine: add pause recording as an exported function. --- modules/rtpengine/doc/rtpengine_admin.xml | 33 +++++++++++++++++++++++ modules/rtpengine/rtpengine.c | 16 ++++++++++- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/modules/rtpengine/doc/rtpengine_admin.xml b/modules/rtpengine/doc/rtpengine_admin.xml index 72fa0e8c41..4777d5554a 100644 --- a/modules/rtpengine/doc/rtpengine_admin.xml +++ b/modules/rtpengine/doc/rtpengine_admin.xml @@ -1026,6 +1026,39 @@ rtpengine_stop_recording(); +
+ + <function moreinfo="none">rtpengine_pause_recording([flags [, sock_var]])</function> + + + This function will send a signal to the &rtp; proxy to pause + recording the RTP stream on the &rtp; proxy. + + Meaning of the parameters is as follows: + + + flags(string, optional) - flags used to change the behavior + of the recorder. An importat value to set is the call-id + value, which can be used to start recording a different call than the requested one. + + + sock_var(var, optional) - variable used to store the rtpengine + socket chosen for this call. + + + + This function can be used from any route. + + + <function>rtpengine_pause_recording</function> usage + +... +rtpengine_stop_recording(); +... + + +
+
<function moreinfo="none">rtpengine_play_media(flags, [duration_spec[, sock_var[, sockvar]]])</function> diff --git a/modules/rtpengine/rtpengine.c b/modules/rtpengine/rtpengine.c index 824542441d..d8f5c1f656 100644 --- a/modules/rtpengine/rtpengine.c +++ b/modules/rtpengine/rtpengine.c @@ -152,6 +152,7 @@ enum rtpe_operation { OP_DELETE, OP_START_RECORDING, OP_STOP_RECORDING, + OP_PAUSE_RECORDING, OP_QUERY, OP_START_MEDIA, OP_STOP_MEDIA, @@ -233,6 +234,7 @@ static const char *command_strings[] = { [OP_DELETE] = "delete", [OP_START_RECORDING] = "start recording", [OP_STOP_RECORDING] = "stop recording", + [OP_PAUSE_RECORDING] = "pause recording", [OP_QUERY] = "query", [OP_START_MEDIA]= "play media", [OP_STOP_MEDIA] = "stop media", @@ -275,6 +277,8 @@ static char *gencookie(); static int rtpe_test(struct rtpe_node*, int, int); static int start_recording_f(struct sip_msg* msg, str *flags, pv_spec_t *spvar); static int stop_recording_f(struct sip_msg* msg, str *flags, pv_spec_t *spvar); +static int pause_recording_f(struct sip_msg* msg, str *flags, pv_spec_t *spvar); +static int start_recording_f(struct sip_msg* msg, str *flags, pv_spec_t *spvar); static int rtpengine_offer_f(struct sip_msg *msg, str *flags, pv_spec_t *spvar, pv_spec_t *bpvar, str *body); static int rtpengine_answer_f(struct sip_msg *msg, str *flags, pv_spec_t *spvar, @@ -445,6 +449,10 @@ static const cmd_export_t cmds[] = { {CMD_PARAM_STR | CMD_PARAM_OPT, 0, 0}, {CMD_PARAM_VAR | CMD_PARAM_OPT, 0, 0}, {0,0,0}}, ALL_ROUTES}, + {"rtpengine_pause_recording", (cmd_function)pause_recording_f, { + {CMD_PARAM_STR | CMD_PARAM_OPT, 0, 0}, + {CMD_PARAM_VAR | CMD_PARAM_OPT, 0, 0}, {0,0,0}}, + ALL_ROUTES}, {"rtpengine_offer", (cmd_function)rtpengine_offer_f, { {CMD_PARAM_STR | CMD_PARAM_OPT, 0, 0}, {CMD_PARAM_VAR | CMD_PARAM_OPT, 0, 0}, @@ -2998,7 +3006,7 @@ rtpe_test(struct rtpe_node *node, int isdisabled, int force) } if (isdisabled) - LM_INFO("rtp proxy <%s> found, support for it %senabled\n", + LM_DBG("rtp proxy <%s> found, support for it %senabled\n", node->rn_url.s, force == 0 ? "re-" : ""); bencode_buffer_free(&bencbuf); @@ -3521,6 +3529,12 @@ stop_recording_f(struct sip_msg* msg, str *flags, pv_spec_t *spvar) return rtpe_function_call_simple(msg, OP_STOP_RECORDING, flags, NULL, NULL, spvar); } +static int +pause_recording_f(struct sip_msg* msg, str *flags, pv_spec_t *spvar) +{ + return rtpe_function_call_simple(msg, OP_PAUSE_RECORDING, flags, NULL, NULL, spvar); +} + /** * Gets the rtp stats and tries to store them in a context, if that's possible * Returns: From 5474d490fdcc1046a8a3513bebd09e2f950cf58e Mon Sep 17 00:00:00 2001 From: Eddie Fiorentine <eddie@planet.net> Date: Thu, 14 Nov 2024 10:09:41 -0500 Subject: [PATCH 2/2] rtpengine: update doc for rtpengine_pause_recording function --- modules/rtpengine/doc/rtpengine_admin.xml | 6 ++++-- modules/rtpengine/rtpengine.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/rtpengine/doc/rtpengine_admin.xml b/modules/rtpengine/doc/rtpengine_admin.xml index 4777d5554a..d60d534b69 100644 --- a/modules/rtpengine/doc/rtpengine_admin.xml +++ b/modules/rtpengine/doc/rtpengine_admin.xml @@ -1026,13 +1026,15 @@ rtpengine_stop_recording(); </example> </section> - <section id="func_rtpengine_stop_recording" xreflabel="rtpengine_pause_recording()"> + <section id="func_rtpengine_pause_recording" xreflabel="rtpengine_pause_recording()"> <title> <function moreinfo="none">rtpengine_pause_recording([flags [, sock_var]])</function> This function will send a signal to the &rtp; proxy to pause - recording the RTP stream on the &rtp; proxy. + recording the RTP stream on the &rtp; proxy. Identical to stop recording except that it + instructs the recording daemon not to close the recording file, but instead leave it open + so that recording can later be resumed via another start recording message. Meaning of the parameters is as follows: diff --git a/modules/rtpengine/rtpengine.c b/modules/rtpengine/rtpengine.c index d8f5c1f656..43dbee1e28 100644 --- a/modules/rtpengine/rtpengine.c +++ b/modules/rtpengine/rtpengine.c @@ -3006,7 +3006,7 @@ rtpe_test(struct rtpe_node *node, int isdisabled, int force) } if (isdisabled) - LM_DBG("rtp proxy <%s> found, support for it %senabled\n", + LM_INFO("rtp proxy <%s> found, support for it %senabled\n", node->rn_url.s, force == 0 ? "re-" : ""); bencode_buffer_free(&bencbuf);