<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body 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<br>
<br>
<br>
<div class="moz-cite-prefix">On 07/10/14 23:06, Errol Samuels wrote:<br>
</div>
<blockquote
cite="mid:CAJvCycfMkPNpLKXWi0_-Lpo+gQE2zZHPX8DyfHSaY0H3jSN8aA@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
<div>
<div>Hi Sammy,<br>
<br>
</div>
Thanks for your response and the clarification.<br>
<br>
</div>
What I am actually trying to do is to pass the real User-Agent
info for each device as the Registration is fowarded to
Freeswitch so using your code as an example instead of
hardcoding the custom "User-Agent: My Server SIP Server" which
will show up in Freeswitch for ALL users I want to do
something like <font face="courier new, monospace">user_agent_header="User-Agent:
$ua" ;</font><br>
<br>
</div>
Where $ua as you are aware would be the Real User-Agent of the
actual user who registration is being forwarded to Freeswitch.<br>
<div><br>
<div><font face="courier new, monospace">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>
event_route [tm:local-request] { # Handle locally
generated requests<br>
xlog("L_INFO", "Routing locally generated $rm to
<$ru> + Modify the User-Agent Header \n");<br>
user_agent_header="User-Agent: $ua" ;<br>
}<br>
<br>
uac_req_send();<br>
exit;<br>
</font><br>
<div><font face="courier new, monospace"><br>
</font></div>
I tried to add that code just before the "uac_req_send()"
but I get errors when starting Kamailio, Is this compatible
with Kamailio 4.0.6?<br>
<br>
0(44073) : <core> [cfg.y:3567]: yyerror_at(): parse
error in config file /etc/kamailio/kamailio.cfg, line 1034,
column 2-12: syntax error<br>
0(44073) : <core> [cfg.y:3567]: yyerror_at(): parse
error in config file /etc/kamailio/kamailio.cfg, line 1034,
column 2-12: bad command<br>
0(44073) : <core> [cfg.y:3567]: yyerror_at(): parse
error in config file /etc/kamailio/kamailio.cfg, line 1034,
column 2-12: bad command<br>
0(44073) : <core> [cfg.y:3570]: yyerror_at(): parse
error in config file /etc/kamailio/kamailio.cfg, line 1034,
column 14: bad command<br>
0(44073) : <core> [cfg.y:3567]: yyerror_at(): parse
error in config file /etc/kamailio/kamailio.cfg, line 1034,
column 15-30: bad command<br>
0(44073) : <core> [cfg.y:3570]: yyerror_at(): parse
error in config file /etc/kamailio/kamailio.cfg, line 1034,
column 31: bad command<br>
0(44073) : <core> [cfg.y:3570]: yyerror_at(): parse
error in config file /etc/kamailio/kamailio.cfg, line 1034,
column 33: bad command<br>
<br>
</div>
</div>
<div>regards,<br>
<br>
</div>
<div>Errol<br>
<br>
</div>
<div>
<div>
<div>
<div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Oct 7, 2014 at 9:28
PM, SamyGo <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:govoiper@gmail.com" target="_blank">govoiper@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 dir="ltr">Hey Errol,
<div><br>
</div>
<div>What I get from Daniel's email is that you
only need to add this route in your script and
it will trigger itself automatically when
"uac_req_send()" function is executed.</div>
<div><br>
</div>
<div>
<div><font face="courier new, monospace">event_route
[tm:local-request] { # Handle locally
generated requests</font></div>
<div><font face="courier new, monospace">
xlog("L_INFO", "Routing locally generated
$rm to <$ru> + Modify the User-Agent
Header \n");</font></div>
<div><font face="courier new, monospace">
user_agent_header="User-Agent: My Super
SIP Server" ;</font></div>
<div><font face="courier new, monospace">}</font></div>
</div>
<div><br>
</div>
<div>Reference: <a moz-do-not-send="true"
href="http://www.kamailio.org/wiki/cookbooks/4.1.x/core?s[]=event&s[]=route#event_route"
target="_blank">http://www.kamailio.org/wiki/cookbooks/4.1.x/core?s[]=event&s[]=route#event_route</a><br>
</div>
<div><br>
</div>
<div>BR,</div>
<div>Sammy</div>
<div>
<div class="h5">
<div><br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Oct 7,
2014 at 11:20 AM, Errol Samuels <span
dir="ltr"><<a
moz-do-not-send="true"
href="mailto:ewsamuels@gmail.com"
target="_blank">ewsamuels@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 dir="ltr">
<div>Thanks for your input Daniel
but pardon my ignorance as I am
not 100% clear where I need to add
that
event_route[tm:local-request]. <br>
<br>
Here is the point where the
REGISTER is being sent to
Freeswitch. So are you able to
provide an example of where I send
the real User-Agent of the device
to Freeswitch?<br>
<br>
# Forward REGISTER to FreeSwitch<span><br>
route[REGFWD] {<br>
<br>
if(!is_method("REGISTER"))<br>
{<br>
return;<br>
}<br>
<br>
</span> 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_send();<br>
exit;<br>
}<br>
<br>
</div>
Thanks<span><font color="#888888"><br>
<br>
Errol<br>
<br>
<div><br>
</div>
</font></span></div>
<div>
<div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue,
Oct 7, 2014 at 9:07 AM,
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"> You have
to use
event_route[tm:local-request]
if you use uac module to
send out new REGISTER.<br>
<br>
Cheers,<br>
Daniel
<div>
<div><br>
<br>
<div>On 03/10/14
18:32, Errol Samuels
wrote:<br>
</div>
<blockquote
type="cite">
<div dir="ltr">
<div>
<div>I also
tried your
last
suggestion at
the point when
the registeris
being
forwarded to
FS but it had
no effect<br>
<br>
# Forward
REGISTER to
Freeswitch<br>
route[REGFWD]
{<br>
if(!is_method("REGISTER"))<br>
{<br>
return;<br>
}<br>
<br>
#if (
is_present_hf("User-Agent"))
{<br>
<b>
remove_hf("User-Agent");<br>
append_hf("User-Agent:
$ua\r\n");</b><br>
#}<br>
<br>
</div>
BR<br>
<br>
</div>
Errol<br>
<div>
<div><br>
</div>
</div>
</div>
<div
class="gmail_extra"><br>
<div
class="gmail_quote">On
Fri, Oct 3, 2014
at 5:08 PM,
Rainer Piper <span
dir="ltr"><<a
moz-do-not-send="true" href="mailto:rainer.piper@soho-piper.de"
target="_blank">rainer.piper@soho-piper.de</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">
<div>Am
03.10.2014 um
17:52 schrieb
Errol Samuels:<br>
</div>
<span>
<blockquote
type="cite">
<div dir="ltr">
<div>
<div>
<div>Hi
Rainer,<br>
<br>
</div>
Yes I did try
user_agent_header
= "User-Agent:
$ua"; but it
just passes
"$ua" to
Freeswitch
rather than
the value of
$ua.<br>
<br>
</div>
regards,<br>
<br>
</div>
Errol<br>
<br>
<div>
<div><br>
<div>
<div>
<div
class="gmail_extra"><br>
<div
class="gmail_quote">On
Fri, Oct 3,
2014 at 4:32
PM, Rainer
Piper <span
dir="ltr"><<a
moz-do-not-send="true" href="mailto:rainer.piper@soho-piper.de"
target="_blank">rainer.piper@soho-piper.de</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">
<div>Am
03.10.2014 um
17:04 schrieb
Errol Samuels:<br>
</div>
<span>
<blockquote
type="cite">
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>
<div>Hello
All,<br>
<br>
</div>
I am using
Kamailio in
front of
Freeswitch and
Kamailio is
handling the
registrations
then
forwarding to
Freeswitch and
everything is
working for
the most part.<br>
<br>
However, there
is niggling
pain in the
neck issue
where the
user's
User-Agent
shows in
Freeswitch as
kamailio
(4.0.6
(x86_64/linux))
instead of the
user's Real
User-Agent I
am trying to
get Kamailio
to pass the
real
User-Agent of
the user
without
success.<br>
<br>
</div>
I am able to
set a static
User-Agent by
doing this in
the global
section.<br>
<br>
<b>user_agent_header
=
"User-Agent:
We love beer";</b><br>
<br>
</div>
However, I am
unable to set
it dynamically
for example:<br>
<br>
<b>user_agent_header
= "User-Agent:
" + $ua;<br>
</b></div>
</div>
</div>
</div>
</blockquote>
</span><b>have
you tried ...<br>
<br>
</b><b>user_agent_header
= "User-Agent:
$ua";<br>
<br>
?<br>
</b></div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</span><b>Have
you tried to
remove the
original hf
(User-Agent)
and set the
new one like:<br>
<br>
remove_hf("User-Agent");<br>
append_hf("User-Agent:
$ua\r\n");<br>
</b>
<div>
<div><b><br>
?<br>
<br>
</b>
<blockquote
type="cite">
<div dir="ltr">
<div>
<div>
<div>
<div>
<div
class="gmail_extra">
<div
class="gmail_quote">
<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"><b>
</b>
<blockquote
type="cite"><span>
<div dir="ltr">
<div>
<div>
<div><b><br>
</b></div>
<div>With is
one Kamailio
doesn't even
start so my
syntax is
probably
wrong.<br>
</div>
<br>
I also tried
playing around
with the
textops module
so I have ran
out of ideas<br>
</div>
<div><br>
Any ideas?<b><br>
<br>
</b></div>
Thanks in
advance.<b><br>
<br>
</b></div>
regards,<br>
<br>
Errol<br>
<b><br>
</b>
<div><b><br>
<br>
</b>
<div>
<div><b><br>
<br>
<br>
</b>
<div><br>
<br>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset></fieldset>
<br>
</span>
<pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a moz-do-not-send="true" href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a>
<a moz-do-not-send="true" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><span><font color="#888888">
</font></span></pre>
<span><font
color="#888888">
</font></span></blockquote>
<span><font
color="#888888">
<br>
<br>
<div>-- <br>
<b>Rainer
Piper</b> <br>
Integration
engineer <br>
Koeslinstr. 56
<br>
53123 BONN <br>
GERMANY <br>
Phone: <a
moz-do-not-send="true"
href="tel:%2B49%20228%2097167161" value="+4922897167161" target="_blank">+49
228 97167161</a>
<br>
P2P: <a
moz-do-not-send="true">sip:rainer@sip.soho-piper.de:5072</a>
(pjsip-test) <br>
XMPP: <a
moz-do-not-send="true"
href="mailto:rainer@xmpp.soho-piper.de" target="_blank">rainer@xmpp.soho-piper.de</a></div>
</font></span></div>
<br>
_______________________________________________<br>
SIP Express
Router (SER)
and Kamailio
(OpenSER) -
sr-users
mailing list<br>
<a
moz-do-not-send="true"
href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
<a
moz-do-not-send="true"
href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a moz-do-not-send="true" href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a>
<a moz-do-not-send="true" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
</blockquote>
<br>
<br>
<div>-- <br>
<b>Rainer
Piper</b> <br>
Integration
engineer <br>
Koeslinstr. 56
<br>
53123 BONN <br>
GERMANY <br>
Phone: <a
moz-do-not-send="true"
href="tel:%2B49%20228%2097167161" value="+4922897167161" target="_blank">+49
228 97167161</a>
<br>
P2P: <a
moz-do-not-send="true">sip:rainer@sip.soho-piper.de:5072</a>
(pjsip-test) <br>
XMPP: <a
moz-do-not-send="true"
href="mailto:rainer@xmpp.soho-piper.de" target="_blank">rainer@xmpp.soho-piper.de</a></div>
</div>
</div>
</div>
<br>
_______________________________________________<br>
SIP Express
Router (SER)
and Kamailio
(OpenSER) -
sr-users
mailing list<br>
<a
moz-do-not-send="true"
href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
<a
moz-do-not-send="true"
href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
<br>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a moz-do-not-send="true" href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a>
<a moz-do-not-send="true" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
</blockquote>
<br>
</div>
</div>
<span><font
color="#888888">
<pre cols="72">--
Daniel-Constantin Mierla
<a moz-do-not-send="true" href="http://twitter.com/#%21/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a moz-do-not-send="true" href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a></pre>
</font></span></div>
<br>
_______________________________________________<br>
SIP Express Router (SER) and
Kamailio (OpenSER) -
sr-users mailing list<br>
<a moz-do-not-send="true"
href="mailto:sr-users@lists.sip-router.org"
target="_blank">sr-users@lists.sip-router.org</a><br>
<a moz-do-not-send="true"
href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
<br>
_______________________________________________<br>
SIP Express Router (SER) and Kamailio
(OpenSER) - sr-users mailing list<br>
<a moz-do-not-send="true"
href="mailto:sr-users@lists.sip-router.org"
target="_blank">sr-users@lists.sip-router.org</a><br>
<a moz-do-not-send="true"
href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
<br>
_______________________________________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) -
sr-users mailing list<br>
<a moz-do-not-send="true"
href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
<a moz-do-not-send="true"
href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
</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>