[OpenSIPS-Users] remove_hf() doesn't always work

Richard Revels rrevels at bandwidth.com
Wed Mar 11 03:08:49 CET 2009


The branch routes in the config files are simply blocks of code that  
get hit as the message leaves the door.  In your config instead of  
inserting the header in one of your routes use t_on_branch("1").  Then  
in the branch route look at the request domain and insert your header  
as needed.  The t_on_branch arms which branch gets hit so you can set  
one branch for a call going out initially and another for calls that  
go out from failure routes.  Or not.  Whatever works best.  I'm  
putting a sample below that assumes you have built the avp named cpid  
and removed any headers from the initial invite that you desire.  You  
might have to play with this a little.  For instance I can't remember  
if the module parameter is needed to insure the avp is available in  
the branch route after a failure response or not.  They can get a  
little more involved if you do parallel forking but that doesn't seem  
to be the case here.

#this might be needed
modparam("tm", "onreply_avp_mode", 1)

....

branch_route[1]
{
	if( is_gflag("0") )
		xlog("L_INFO", "In branch route 1 - request domain is $rd \n");
         switch($rd)
	{
		case "1.2.3.4": #carrier-1
		case "5.6.7.8": #carrier-1
			insert_hf("P-Charge-Info: $avp(s:cpid)\r\n", "CALL-ID");
			return;
			break;
		case "2.3.4.5": #carrier2
		case "6.7.8.9": #carrier2
			append_hf("P-Asserted-Identity: <$avp(s:cpid)>\r\n");
			return;
			break;
		default:
			#dont bother with headers
	}
	return;
}


On Mar 7, 2009, at 3:33 PM, Jeff Pyle wrote:

> Richard,
>
> Branch routing is something I've never been able to completely wrap  
> my mind
> around.  I'm not using any branch routing in my current  
> configuration, at
> least to the best of my knowledge.  I'll read up on the different  
> types of
> routes to see if I can figure this one out.  Do you have any quick
> suggestions on how to adapt a branch-less config into something  
> where I can
> add and delete the headers I need to?
>
>
> Thanks,
> Jeff
>
>
>
>
> On 3/7/09 11:25 AM, "Richard Revels" <rrevels at bandwidth.com> wrote:
>
>> Add the headers in branch routes.  Headers added in primary routing
>> can't be removed in later processing.
>




More information about the Users mailing list