I haven't looked at the code, but probably the function doesn't accept variable for the matching regular expression.
If the IP/port of asterisk are not changed, you can try:
#!substdef "/ASTERISKIP/127.0.0.1/" #!substdef "/ASTERISKPORT/5080/"
asterisk.bindip = "ASTERISKIP" ... asterisk.bindport = ASTERISKPORT ...
subst_hf("Contact", "/ASTERISKIP:ASTERISKPORT/$td/", "a");
Cheers, Daniel
On 08/08/14 23:38, Alex Villacís Lasso wrote:
Consider the following snippet:
if (is_present_hf("Contact")) { xlog("L_ALERT", "===== reply to SUBSCRIBE has Contact: $ct\n"); xlog("L_ALERT", "===== want to replace with $td\n"); xlog("L_ALERT", "===== regexp to use is /$sel(cfg_get.asterisk.bindip):$sel(cfg_get.asterisk.bindport)/$td/\n"); if (subst_hf("Contact", "/127.0.0.1:5080/$td/", "a")) { xlog("L_ALERT", "===== reply had Contact modified\n"); } }
If I use the hardcoded regexp "/127.0.0.1:5080/$td/", subst_hf() replaces the Contact value correctly.
However, if I use "/$sel(cfg_get.asterisk.bindip):$sel(cfg_get.asterisk.bindport)/$td/" (where asterisk.bindip and asterisk.bindport are the supposed values 127.0.0.1 and 5080), subst_hf() fails to replace the Contact value.
How do I make use of the existing configuration variables in order to substitute in the Contact header?
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users