Add a sip header from module

Hi, please let me know if I’m posting this in the wrong place.

I am trying to develop a module that will contain functions that can be called from within the a dial plan. One of the things I want to do within one of my functions is add/modify the diversion sip header and then make a call. I can make a call using ast_call() in channel.h but I can’t seem to figure out how to add the sip header. I would have thought the function to do this would be in channel.h.

I realize that this is easy to do within the dial plan itself using SipAddHeader() but running doing this within the dial plan isn’t feasible for the deployment I am setting up. I apologize if this is a newbie question, I’m fairly new to asterisk development and module development in particular.

This is a developer question being asked on an end user discussion forum. Non developer support questions should go on a Support forum and developer questions should go on the developer mailing list or IRC channel.

You will need to see if chan_sip.c exports the add header low level function. If not you will have to use the internal set variable API to call the existing function in set mode.

you could add sip header from add_supported_header() function in chan_sip.c.
for example:
res = add_header(req, “Supported”, “replaces, timer”);
res = add_header(req, “Supported”, “replaces”);
with Regards.Mojtaba

I think that is declared static, so not available to other modules.

What is your minds? Excuse me but i do’nt understand your minds in your reply.
May you explain more details? please

yes, that is declared statis function in chan_sip.c file, so not available to other modules.
the only way is that call it’s functions in new module from chan_sip.c file, but it may be critical