[Serusers] How to use avps in subst

Roger Lewau roger.lewau at serverhallen.com
Mon Jul 16 15:46:40 CEST 2007


Hello
 
I am running version 0.9.6 and have a situation where I want to change
the remote-party-id of a forwarded call so that when the call reach the
destination the forwarding users number is avertised. It is necessary to
change it becaus if I dont change this header the first number of the
trunk is shown, which almost everytime is another customer than the
forwarder.
 
I have experimented with avpops and subst but can not get the avp part
to translate into the value in the resulting string.
This is the code I am using for unconditional forwarding
 
 
       if (avp_db_load("$ruri/username", "s:cfwd")) {
                setflag(22);
                revert_uri();
                avp_write("$ruri/username","s:calledno");
                subst('/^Remote-Party-ID:(.*)>(.*)$/Remote-Party-ID:
"$avp(calledno)" <sip:$avp(calledno)>\2/i');
                avp_delete("s:calledno");
                avp_pushto("$ruri/username", "s:cfwd");
                prefix("01");  #use interface 1 on Vegastream Gate
                route(5);
                route(4);     
                break;   
        };

The resulting header looks like this:
 
Remote-Party-ID: "$avp(rpid)"
<sip:$avp(rpid)>;party=calling;screen=no;privacy=off.


Is it not possible to use avpops in subst?
Any other idea on how to change the header in 0.9.6.


Kind regards
Roger Lewau




More information about the sr-users mailing list