[Kamailio-Users] custom routing

Klaus Darilion klaus.mailinglists at pernau.at
Fri Sep 5 08:23:03 CEST 2008



toly schrieb:
> Greetings,
> 
> Suppose I need to do custom routing for outbound calls from UA - softphone.
> 
> Each user account may have the following info attached to it:
> 
> 1:provider_a:2:provider_b:3:provider_c
> which means: 
> forward call to provider_a,
> if failed forward call to provider_b
> if failed forward call to provider_c
> if failed send response back to UA
> 
> I do database lookup based on from, and get above string.
> Suppose I wrote my own dispatcher module which initially gets set to above
> string:
> 1:provider_a:2:provider_b:3:provider_c
> 
> and forwards to first provider, then on failure_route I call next_provider
> and so on.

Such things are usually done in the following way:
- in the routing module: push the destination URIs into the AVPs with 
the same name e.g. in your case write the 3 destinations into AVPs (if 
you define an AVP 3 times, you will have 3 AVPs with the same name)


- in the config script main route: check if this certain AVP is defined, 
if yes activate a failure route, copy the AVP into $ru, delete the AVP, 
t_relay

- in the failure route: check if this certain AVP is still defined, if 
yes activate the same failure route again, copy the AVP into $ru, delete 
the AVP, t_relay. if no, send an error response back to the caller.

> Will it work across multiple messages?  Will it work correctly for each
> child - I mean joe at domain and 
> paul at domain should be handled according their own providers?
> 
> Any other suggestions?

maybe you can use the carrierroute module.


klaus




More information about the Users mailing list