Sorry, another update.. after tinkering with the SIP headers, we found that we're able to pass any user/host along in an INVITE, and this is passed onto mod_xml_curl.<div><br></div><div>To fix this particular part of the problem, we enabled auth_calls and this gives us correct/clean variables we can trust, specifically;</div>
<div><br></div><div><div> u'variable_sip_auth_username': u'2000',</div><div> u'variable_user_name': u'2000',</div><div><br></div><div>However, when attempting to do the blind transfer again, this variables are all missing.</div>
<div><br></div><div>At this point I'm convinced that attempting to extract the user/domain from the Refer headers is probably not the right thing to do... But I'm still no closer to figuring out what the correct approach should be to expose the authenticated user/domain to mod_xml_curl.</div>
<div><br></div><div>Cal</div><div><br></div><div><br><div class="gmail_quote">On Mon, Nov 19, 2012 at 4:58 AM, Cal Leeming [Simplicity Media Ltd] <span dir="ltr"><<a href="mailto:cal.leeming@simplicitymedialtd.co.uk" target="_blank">cal.leeming@simplicitymedialtd.co.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Another quick update on this before I pass out from lack of sleep..!<div><br></div><div>Just had a look through the mod_sofia.c/h source and found the following;</div>
<div><br></div><div><div>mod_sofia.c/mod_sofia.h</div><div>
#define SOFIA_REFER_TO_VARIABLE "sip_refer_to"</div><div>if (!zstr(full_ref_by)) {</div><div><span style="white-space:pre-wrap">        </span>switch_channel_set_variable(t_channel, SOFIA_SIP_HEADER_PREFIX "Referred-By", full_ref_by);</div>
<div>}</div><div>if (!zstr(full_ref_to)) {</div><div><span style="white-space:pre-wrap">        </span>switch_channel_set_variable(t_channel, SOFIA_REFER_TO_VARIABLE, full_ref_to);</div><div>}</div><div>if (!zstr(full_ref_to)) {</div>
<div><span style="white-space:pre-wrap">        </span>switch_channel_set_variable(t_channel, SOFIA_REFER_TO_VARIABLE, full_ref_to);</div><div>}</div><div>switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Process REFER to [%s@%s]\n", exten, (char *) refer_to->r_url->url_host);</div>
<div><br></div><div>If the correct approach is deemed to be patching code, then I figured it could be as simple as this;</div><div><br></div><div><div>switch_channel_set_variable(t_channel, "Referred-By-User", exten);</div>
<div>switch_channel_set_variable(t_channel, "Referred-By-Domain", (char *) refer_to->r_url->url_host);</div></div><div><br></div><div>This is pretty much where my knowledge of C ends, I can (just about) read and copy chunks of C code, but that's about it :)</div>
<span class="HOEnZb"><font color="#888888">
<div><br></div><div>Cal</div></font></span><div><div class="h5"><br><div class="gmail_quote">On Mon, Nov 19, 2012 at 4:38 AM, Cal Leeming [Simplicity Media Ltd] <span dir="ltr"><<a href="mailto:cal.leeming@simplicitymedialtd.co.uk" target="_blank">cal.leeming@simplicitymedialtd.co.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Not sure if this is relevant but thought I'd point it out.<div><br></div><div>The following field seems to contain the IP of the domain we were expecting ('<a href="http://c1881.voiceflare.co.uk/" target="_blank">c1881.voiceflare.co.uk</a>')</div>
<div><br></div><div><div> u'variable_sip_from_host': u'89.238.182.137',</div><div><br></div><div>Normally, this field would contain the hostname and not the IP.</div><span><font color="#888888"><div>
<br></div><div>Cal</div></font></span><div><div><br><div class="gmail_quote">
On Mon, Nov 19, 2012 at 4:34 AM, Cal Leeming [Simplicity Media Ltd] <span dir="ltr"><<a href="mailto:cal.leeming@simplicitymedialtd.co.uk" target="_blank">cal.leeming@simplicitymedialtd.co.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi guys,<div><br></div><div>In a nut shell, it appears that when attempting to perform a blind transfer under certain conditions (explained below), mod_xml_curl does not expose the originating domain in a clean format.</div>
<div><div><br></div><div><div>My initial plan was to find the point where these variable were being generated, look at what was available, then add an extra variable for the domain and submit a patch.</div></div><div><br>
</div><div>Sadly my C isn't great and I hit a brick wall, so if anyone can help out, I will ensure the mod_xml_curl documentation is updated and/or assist with any patching/testing required.</div><div><div><br></div>
</div>
<div>Please take the following scenario;</div><div><br></div><div>* Extension 2000 calls an external number via a gateway (i.e. bridge sofia/gateway/name/e164_number_here).</div><div>* Call connects fine, audio stays good, no disconnection problems etc.</div>
<div>* Call is blind transferred to another extension</div><div><br></div><div>As a result, the following is determined;</div><div><br></div><div>* User initiating the blind transfer is 2000</div><div>* Domain initiating the blind transfer is <a href="http://c1881.voiceflare.co.uk" target="_blank">c1881.voiceflare.co.uk</a></div>
<div>* Destination number of the call is 447866123456</div><div>* Number to blind transfer to is 2001</div><div>* Call to mod_xml_curl is made</div><div><br></div><div>It makes reference to the User in the following 'clean' variables (by clean, I mean variables that just contain 2000 and don't require mangling to extract the info);</div>
<div><br></div><div><div> u'Caller-ANI': u'2000',</div></div><div><div> u'Caller-Username': u'2000',</div></div><div><div> u'Caller-Caller-ID-Number': u'2000',</div></div><div>
<div> u'Hunt-ANI': u'2000',</div></div><div><div> u'Hunt-Caller-ID-Number': u'2000',</div></div><div><div> u'Hunt-Username': u'2000',</div></div><div><div> u'variable_last_sent_callee_id_number': u'2000',</div>
</div><div><div><div> u'variable_sip_from_user': u'2000',</div><div></div></div><div><br></div><div>It also has the User in the following unclean variables;</div><div><br></div><div> u'variable_bridge_channel': u'sofia/external/<a href="http://2000@c1881.voiceflare.co.uk:5060" target="_blank">2000@c1881.voiceflare.co.uk:5060</a>',</div>
<div></div></div><div><div> u'variable_sip_from_uri': <a href="mailto:u%272000@89.238.182.137" target="_blank">u'2000@89.238.182.137</a>',</div><div> u'variable_sip_full_from': u'"foxx" <<a href="mailto:sip%3A2000@89.238.182.137" target="_blank">sip:2000@89.238.182.137</a>>;tag=XryjFQp3rB2NF',</div>
</div><div><div> u'variable_sip_h_Referred-By': u'"foxx" <<a href="http://sip:2000@c1881.voiceflare.co.uk:5060" target="_blank">sip:2000@c1881.voiceflare.co.uk:5060</a>>',</div></div><div>
<br></div><div>However, it only references the domain in the following unclean variables;</div>
<div><br></div><div> u'variable_bridge_channel': u'sofia/external/<a href="http://2000@c1881.voiceflare.co.uk:5060" target="_blank">2000@c1881.voiceflare.co.uk:5060</a>',</div><div> u'variable_sip_h_Referred-By': u'"foxx" <<a href="http://sip:2000@c1881.voiceflare.co.uk:5060" target="_blank">sip:2000@c1881.voiceflare.co.uk:5060</a>>',</div>
<div> u'variable_sip_refer_to': u'<<a href="http://sip:2001@c1881.voiceflare.co.uk:5060" target="_blank">sip:2001@c1881.voiceflare.co.uk:5060</a>>',</div><div><br></div><div>Lets say that we want to determine the user/domain that has initiated this transfer, doing so would mean mangling with one of those above variables, which seems a bit dirty (plus it is not clear which is the correct one to use).</div>
<div><br></div><div>I have attached the SIP trace of the entire blind transfer event, and the full mod_xml_curl request being sent.</div><div><br></div><div><div>If anyone could answer the following, it'd be much appreciated;</div>
<div><br></div><div>* Should there be an improvement patch that exposes the domain of the user that originated the blind transfer?</div><div>* Are there better/alternative ways to extracting the domain of the user that originated the blind transfer?</div>
</div><div><br></div><div>Many thanks</div><span><font color="#888888"><div><br>Cal</div><div><br></div></font></span></div>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div></div>