Hi,

i'm using freeswitch / php esl to make some tests against a sip system.

when using the deflect api, the Referred-By Header is always just the ip of freeswitch server and i expected to be the contact of the gateway i'm using as endpoint.

   ------------------------------------------------------------------------
send 747 bytes to udp/[10.0.0.4]:5060 at 17:05:21.010061:
   ------------------------------------------------------------------------
   REFER sip:mod_sofia@10.0.0.7:11000 SIP/2.0
   Via: SIP/2.0/UDP 10.0.0.18;rport;branch=z9hG4bKej34QSpeaBS2p
   Route: <sip:10.0.0.4;r2=on;lr=on;ftag=FXajgSNDr2Kgj>
   Route: <sip:10.0.0.4:7000;r2=on;lr=on;ftag=FXajgSNDr2Kgj>
   Max-Forwards: 70
   From: <sip:ParkingTestCase_2@3lHj.admin>;tag=08BXDaFZgp2vQ
   To: "Internal ParkingTestCase DV 3" <sip:0000@3lHj.admin>;tag=FXajgSNDr2Kgj
   Call-ID: eb606910-de48-4545-85bb-8f00d2253a34
   CSeq: 117681896 REFER
   Contact: <sip:ParkingTestCase_2@10.0.0.18:5060;transport=udp>
   User-Agent: Testing
   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
   Supported: path, replaces
   Refer-To: <sip:*3101@kamailio>
   Referred-By: <sip:10.0.0.18>
   Content-Length: 0


following the code, it ends in mod_sofia sending calling the nua_refer.
however, i don't see anywhere in the code where tech_pvt->contact_url is initialized/used
i set the sip_h_referred-by value before calling the deflect and was expecting it would be used, but the code below explicitly sets the header. my problem is that i can't find anywhere where its initialized/used/updated so a second pair of eyes is much appreciated.

thanks

switch (msg->message_id) {

case SWITCH_MESSAGE_INDICATE_DEFLECT: {

char *extra_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_HEADER_PREFIX);
char ref_to[1024] = "";
const char *var;

if (!strcasecmp(msg->string_arg, "sip:")) {
const char *format = strchr(tech_pvt->profile->sipip, ':') ? "sip:%s@[%s]" : "sip:%s@%s";

switch_snprintf(ref_to, sizeof(ref_to), format, msg->string_arg, tech_pvt->profile->sipip);
} else {
switch_set_string(ref_to, msg->string_arg);
}

nua_refer(tech_pvt->nh, SIPTAG_REFER_TO_STR(ref_to), SIPTAG_REFERRED_BY_STR(tech_pvt->contact_url),
  TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
  TAG_END());