[sr-dev] git:master:3585f802: dialog: added dlg.briefing rpc command

Henning Westerholt hw at skalatan.de
Fri Nov 1 18:23:32 CET 2019


Hi Daniel,

great addition, thank you.

One remark/question about the name of the new command - I know/use 
"briefing" as description for a meeting or something like this.

Maybe using something like "dlg.summary" would be easier for the users? 
I can do the rename if you agree, no problem.

Cheers,

Henning

Am 01.11.19 um 10:29 schrieb Daniel-Constantin Mierla:
> Module: kamailio
> Branch: master
> Commit: 3585f802b3beada38b24e1daa72dc527c1d86535
> URL: https://github.com/kamailio/kamailio/commit/3585f802b3beada38b24e1daa72dc527c1d86535
>
> Author: Daniel-Constantin Mierla <miconda at gmail.com>
> Committer: Daniel-Constantin Mierla <miconda at gmail.com>
> Date: 2019-11-01T10:23:35+01:00
>
> dialog: added dlg.briefing rpc command
>
> - list fewer details for the dialog records in memory
>
> ---
>
> Modified: src/modules/dialog/dialog.c
>
> ---
>
> Diff:  https://github.com/kamailio/kamailio/commit/3585f802b3beada38b24e1daa72dc527c1d86535.diff
> Patch: https://github.com/kamailio/kamailio/commit/3585f802b3beada38b24e1daa72dc527c1d86535.patch
>
> ---
>
> diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c
> index a5f0e56b39..dd41ddf756 100644
> --- a/src/modules/dialog/dialog.c
> +++ b/src/modules/dialog/dialog.c
> @@ -2837,7 +2837,46 @@ static void rpc_dlg_list_match_ctx(rpc_t *rpc, void *c)
>   	rpc_dlg_list_match_ex(rpc, c, 1);
>   }
>   
> +static const char *rpc_dlg_briefing_doc[2] = {
> +	"List the summary of dialog records in memory", 0
> +};
> +
> +/*!
> + * \brief List summary of active calls
> + */
> +static void rpc_dlg_briefing(rpc_t *rpc, void *c)
> +{
> +	dlg_cell_t *dlg;
> +	unsigned int i;
> +	void *h;
> +
> +	for( i=0 ; i<d_table->size ; i++ ) {
> +		dlg_lock( d_table, &(d_table->entries[i]) );
> +		for( dlg=d_table->entries[i].first ; dlg ; dlg=dlg->next ) {
> +			if (rpc->add(c, "{", &h) < 0) {
> +				rpc->fault(c, 500, "Failed to create the structure");
> +				return;
> +			}
> +			if(rpc->struct_add(h, "ddSSSSSd",
> +					"h_entry", dlg->h_entry,
> +					"h_id", dlg->h_id,
> +					"from_uri", &dlg->from_uri,
> +					"to_uri", &dlg->to_uri,
> +					"call-id", &dlg->callid,
> +					"from_tag", &dlg->tag[DLG_CALLER_LEG],
> +					"to_tag", &dlg->tag[DLG_CALLER_LEG],
> +					"state", dlg->state) < 0) {
> +				rpc->fault(c, 500, "Failed to add fields");
> +				return;
> +
> +			}
> +		}
> +		dlg_unlock( d_table, &(d_table->entries[i]) );
> +	}
> +}
> +
>   static rpc_export_t rpc_methods[] = {
> +	{"dlg.briefing", rpc_dlg_briefing, rpc_dlg_briefing_doc, RET_ARRAY},
>   	{"dlg.list", rpc_print_dlgs, rpc_print_dlgs_doc, RET_ARRAY},
>   	{"dlg.list_ctx", rpc_print_dlgs_ctx, rpc_print_dlgs_ctx_doc, RET_ARRAY},
>   	{"dlg.list_match", rpc_dlg_list_match, rpc_dlg_list_match_doc, RET_ARRAY},
>
>
> _______________________________________________
> Kamailio (SER) - Development Mailing List
> sr-dev at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

-- 
Kamailio Merchandising - https://skalatan.de/merchandising/
Kamailio services - https://skalatan.de/services
Henning Westerholt - https://skalatan.de/blog/



More information about the sr-dev mailing list