[SR-Users] modify To header, prefix + ip, using dispacher module.

Helena Garcia-Nieto helena.gnieto at morodo.co.uk
Wed Feb 12 17:37:46 CET 2014


Hey,

Thank you in advanced for the time taken on my question!

I have an environment phone---sbc---kamailio---gw1, gw2

I am using kamailio 4.2.0, quite basic config, using dispatcher module to
route to the gw and to monitor them with options. I have a file
dispatcher.list with the two gw ips:
# $Id$
# dispatcher destination sets
#

# line format
# setit(int) destination(sip uri) flags(int,opt) priority(int,opt)
attributes(str,opt)

# gateways
1 sip:10.X.X.38:5060 IP
1 sip:10.X.X.39:5060 AP

I have to modify the TO header, it must be prefixed and gw ip must be placed
there (gw requirements)

I use on the routing function
ds_select_domain("1", "8")
t_on_failure("RTF_DISPATCH");

and just before the ROUTE(RELAY) I have:

       # Add profix to gw: 0199
        subst_uri('/^sip:(.*)/sip:0199\1/i'); # add prefix to RURI
        subst_hf("To", "/(.*):(.*)@(.*)$/\1:0199\2@$rd>/", "a"); #add prefix
to TO, modify ip on TO use ruri ip

It works fine if the first gw is available, but if the first option (which
is the last gw on the list) is not accessible, it waits for the 30s and then
tries the second one, but the ip on the TO header is not correct anymore,
since it is the first gw and not the second.

Question: why does it wait until the timeout if it is monitoring it with
option and seeing it is not reachable?

I tried modifying again the TO header with:
subst_hf("To", "/(.*)@(.*)$/\1@$rd>/", "a")

before the route(relay) on the failure routine, but it does not work
properly, I am getting strange TO header like:

To: <sip:0199XXXX at 10.X.X.39> <sip:XXXXXX at 10.X.X.38>

It looks like it is not parsing the to header it has before but adding a
parsed version of the original header at the end of the other one....
I tried with subst as well but the result is more or less the same.

Probably there is a better way to set the prefix and the correct IP on the
to header... I'll appreciate any help with this issue.

Thanks again for your time

Helena




Helena Garcia-Nieto de Mir
Morodo Group VoIP Department
E-mail: helena.gnieto at morodo.co.uk
Morodo Limited
 voip at morodo.co.uk / www.mo-call.com 
Place of Registration: Companies House, England & Wales / Registered Office:
7 Breasy Place, 9 Burroughs Gardens Hendon, London NW4 4AU





More information about the sr-users mailing list