[asterisk-dev] Hi Need Help on using module to access the sip request for validation... Thanks

fofo don fofodon at gmail.com
Wed Apr 15 16:41:13 CDT 2009


Hello Everyone,

I am a newbie to module level programming on asterisk (apps). I
realize you have to call load and unload module in ur modules.
Here is the rest of the stuff

1) I have to to validation on SIP messages. In the module how do i
access the data. All the module function have (ast_channel *chan, char
*data), Will data give me the sip message thats currently in progress.
(INVITE ,BYE, CANCEL etc...). I am more looking towards getting the
sip_request structure from data.

2) in extensions.conf how do i call my function sipvalid_exec
is it exten => 8600,1,sipvalid_exec(1234)

Some code below

Thanks for all your help. Much appreciated.

Thanks,
Fofo

static int sipvalid_exec(struct ast_channel *chan, void *data)
{
	//how do i retrieve the sip message here
//so that i can get the SIP request data (ex invite cancel message) etc
// and then i can validate the various parameters associated with the message


	return 0;
}


static int unload_module(void)
{
	return ast_unregister_application(sip_app);
}

static int load_module(void)
{
	if (ast_register_application_xml(sip_app, sipvalid_exec))
		return AST_MODULE_LOAD_FAILURE;
	return AST_MODULE_LOAD_SUCCESS;
}

AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "validate the sip");



More information about the asterisk-dev mailing list