[sr-dev] git:master: modules_k/dialog: Provider helper get_valid_msg() to retrieve

Daniel-Constantin Mierla miconda at gmail.com
Wed Aug 17 14:24:23 CEST 2011


Hello,

if I havent missed something, at the first sight (including your next 
commit), since the other modules do not link directly against dialog module:
- either make the get_valid_msg() inline and put it all in dlg_cb.h
- or export it through dialog inter module API and use it from there in 
the other modules

As personal preference, at least for first case, I would prefix it with 
dlg_, like dlg_get_valid_msg() -- more suggestive about its origin and 
higher chances to avoid naming conflicts.

Cheers,
Daniel

On 8/17/11 1:15 PM, Timo Reimann wrote:
> Module: sip-router
> Branch: master
> Commit: a5498b52e9a3bbef63e4ce4212cc05124f428cd2
> URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a5498b52e9a3bbef63e4ce4212cc05124f428cd2
>
> Author: Timo Reimann<timo.reimann at 1und1.de>
> Committer: Timo Reimann<timo.reimann at 1und1.de>
> Date:   Wed Aug 17 13:12:24 2011 +0200
>
> modules_k/dialog: Provider helper get_valid_msg() to retrieve
> valid SIP message from given dialog callback parameter structure.
> (Useful due to interface change committed in c02155941.)
>
> ---
>
>   modules_k/dialog/dlg_cb.c |   21 +++++++++++++++++++++
>   modules_k/dialog/dlg_cb.h |    7 +++++++
>   2 files changed, 28 insertions(+), 0 deletions(-)
>
> diff --git a/modules_k/dialog/dlg_cb.c b/modules_k/dialog/dlg_cb.c
> index 3f2f2cd..df8c3cb 100644
> --- a/modules_k/dialog/dlg_cb.c
> +++ b/modules_k/dialog/dlg_cb.c
> @@ -260,3 +260,24 @@ void run_dlg_callbacks( int type ,
>   	}
>   	return;
>   }
> +
> +
> +struct sip_msg *get_valid_msg(struct dlg_cb_params *cb_params)
> +{
> +	struct sip_msg *msg;
> +
> +	if (cb_params == NULL) {
> +		LM_ERR("no dialog parameters given\n");
> +		return NULL;
> +	}
> +
> +	msg = cb_params->req;
> +	if (msg == NULL) {
> +		msg = cb_params->rpl;
> +		if (msg == NULL || msg == FAKED_REPLY) {
> +			return NULL;
> +		}
> +	}
> +
> +	return msg;
> +}
> diff --git a/modules_k/dialog/dlg_cb.h b/modules_k/dialog/dlg_cb.h
> index 80eae7b..f8bcadc 100644
> --- a/modules_k/dialog/dlg_cb.h
> +++ b/modules_k/dialog/dlg_cb.h
> @@ -111,4 +111,11 @@ void run_dlg_callbacks( int type ,
>   void run_load_callbacks( void );
>
>
> +/*!
> + * \brief Function that returns valid SIP message from given dialog callback parameter struct
> + * \param cb_params dialog callback parameter struct
> + * \return pointer to valid SIP message if existent, NULL otherwise
> + */
> +struct sip_msg *get_valid_msg(struct dlg_cb_params *cb_params);
> +
>   #endif
>
>
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

-- 
Daniel-Constantin Mierla -- http://www.asipto.com
Kamailio Advanced Training, Oct 10-13, Berlin: http://asipto.com/u/kat
http://linkedin.com/in/miconda -- http://twitter.com/miconda




More information about the sr-dev mailing list