<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<div class="moz-cite-prefix">On 08/10/14 19:25, Errol Samuels wrote:<br>
</div>
<blockquote
cite="mid:CAJvCyccoh-rY0msf-q1JFzw=btqr89scimWwuVX16G9_jpzD5A@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>I followed Daniel's instructions and made some progress but
not 100% there yet.<br>
<br>
-------[Global section]----------<br>
<br>
user_agent_header=""<br>
<br>
-------[Main Routing Logic]-------<br>
<br>
# handle registrations<br>
if (is_method("REGISTER"))<br>
{ <br>
$avp(new_user_agent) = $ua;<br>
}<br>
route(REGISTRAR);<br>
.<br>
.<br>
<br>
# Forward REGISTER to Freeswitch<br>
route[REGFWD] {<br>
<br>
if(!is_method("REGISTER"))<br>
{<br>
return;<br>
}<br>
route(DISPATCH);<br>
$uac_req(method)="REGISTER";<br>
$uac_req(ruri)=$du;<br>
$uac_req(furi)=$fn + "<sip:" + $au + "@" + $ar +
">";<br>
$uac_req(turi)=$tn + "<sip:" + $au + "@" + $ar +
">";<br>
$uac_req(hdrs)="Contact: <sip:" + $au + "@"<br>
+ $ar<br>
+ ";fs_path=sip:"<br>
+
$sel(cfg_get.kamailio.bindip)<br>
+ ":" +
$sel(cfg_get.kamailio.bindport)<br>
+ ">"<br>
+ "\r\n";<br>
if($sel(contact.expires) != $null)<br>
$uac_req(hdrs)= $uac_req(hdrs) + "Expires: " +
$sel(contact.expires) + "\r\n";<br>
else<br>
$uac_req(hdrs)= $uac_req(hdrs) + "Expires: " +
$hdr(Expires) + "\r\n";<br>
$uac_req(hdrs)= $uac_req(hdrs) + "User-Agent: " +
$avp(new_user_agent) + "\r\n";<br>
uac_req_send();<br>
exit;<br>
}<br>
#!endif<br>
<br>
------------<br>
<br>
Now the correct User-Agent appears in the REGISTER message but
in Freeswitch it shows as unknown.<br>
<br>
U 184.xx.xx.208:5060 -> 184.xx.xx.198:6060<br>
REGISTER <a class="moz-txt-link-freetext" href="sip:184.x.x.198:6060">sip:184.x.x.198:6060</a> SIP/2.0.<br>
Via: SIP/2.0/UDP 184.xx.xx.208;branch=z9hG4bKa764.668d6dc7.0.<br>
To: <<a moz-do-not-send="true"
href="mailto:sip%3A1001@pbx.mydomain.com">sip:1001@pbx.mydomain.com</a>>.<br>
From: <<a moz-do-not-send="true"
href="mailto:sip%3A1001@pbx.mydomain.com">sip:1001@pbx.mydomain.com</a>>;tag=6f72f76f3402bf7cf11f6917529ca761-2ceb.<br>
CSeq: 10 REGISTER.<br>
Call-ID: <a class="moz-txt-link-abbreviated" href="mailto:4570a277563cdffc-61869@184.xx.xx.208">4570a277563cdffc-61869@184.xx.xx.208</a>.<br>
Max-Forwards: 70.<br>
Content-Length: 0.<br>
.<br>
Contact: <<a moz-do-not-send="true"
href="mailto:sip%3A1001@pbx.mydomain.com">sip:1001@pbx.mydomain.com</a>;fs_path=<a class="moz-txt-link-freetext" href="sip:184.xx.xx.208:5060">sip:184.xx.xx.208:5060</a>>.<br>
Expires: 120.<br>
User-Agent: Yealink SIP-T46G 28.72.0.26.<br>
.<br>
----------------<br>
<br>
Got some extra dots in there but not sure why they are there
and how they got there.<br>
Any ideas? Anything I missed?<br>
</div>
</div>
</blockquote>
<br>
Apparently by setting an empty user-agent header value in kamailio
config file results in an empty line in headers, which means end of
headers. So it kind of breaks the headers -- I will fix that in
kamailio.<br>
<br>
A solution for now will be to use:<br>
<br>
user_agent_header = "X-Proxy: abc"<br>
<br>
Or, in other words, set the value of the parameter to something that
doesn't include User-Agent: as header name.<br>
<br>
Cheers,<br>
Daniel<br>
<br>
<blockquote
cite="mid:CAJvCyccoh-rY0msf-q1JFzw=btqr89scimWwuVX16G9_jpzD5A@mail.gmail.com"
type="cite">
<div dir="ltr">
<div><br>
BR<br>
<br>
</div>
Errol<br>
<br>
<div><br>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Wed, Oct 8, 2014 at 12:34 PM,
Daniel-Constantin Mierla <span dir="ltr"><<a
moz-do-not-send="true" href="mailto:miconda@gmail.com"
target="_blank">miconda@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> Perhaps you can
get it with adding User-Agent header to
$uac_req(hdrs):<br>
<br>
$uac_req(hdrs)= $uac_req(hdrs) + "User-Agent: " + $ua
+ "\r\n";<br>
<br>
And sent the global parameter:<br>
<br>
user_agent_header=""<br>
<br>
But then no local generated request has user agent,
which probably is ok for you.<br>
<br>
There are still ways to use
event_route[tm:local-request] to set a custom user
agent header, but would require something like:<br>
- add $us in $uac_req(hdrs) as X-UA header<br>
- in event_route[tm:local-request], remove User-Agent
and X-UA headers and add again User-Agent taking the
value from X-UA<br>
<br>
Cheers,<br>
Daniel
<div>
<div class="h5"><br>
<br>
<br>
</div>
</div>
</div>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a></pre>
</body>
</html>