Hello All,
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.
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.
I am able to set a static User-Agent by doing this in the global section.
*user_agent_header = "User-Agent: We love beer";*
However, I am unable to set it dynamically for example:
*user_agent_header = "User-Agent: " + $ua;*
With is one Kamailio doesn't even start so my syntax is probably wrong.
I also tried playing around with the textops module so I have ran out of ideas
Any ideas?
Thanks in advance.
regards,
Errol
Am 03.10.2014 um 17:04 schrieb Errol Samuels:
Hello All,
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.
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.
I am able to set a static User-Agent by doing this in the global section.
*user_agent_header = "User-Agent: We love beer";*
However, I am unable to set it dynamically for example:
*user_agent_header = "User-Agent: " + $ua;
*have you tried ...
**user_agent_header = "User-Agent: $ua";
? *
With is one Kamailio doesn't even start so my syntax is probably wrong.
I also tried playing around with the textops module so I have ran out of ideas
Any ideas?*
Thanks in advance.*
regards,
Errol
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
Hi Rainer,
Yes I did try user_agent_header = "User-Agent: $ua"; but it just passes "$ua" to Freeswitch rather than the value of $ua.
regards,
Errol
On Fri, Oct 3, 2014 at 4:32 PM, Rainer Piper rainer.piper@soho-piper.de wrote:
Am 03.10.2014 um 17:04 schrieb Errol Samuels:
Hello All,
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.
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.
I am able to set a static User-Agent by doing this in the global section.
*user_agent_header = "User-Agent: We love beer";*
However, I am unable to set it dynamically for example:
*user_agent_header = "User-Agent: " + $ua; *
*have you tried ... *
*user_agent_header = "User-Agent: $ua"; ? *
With is one Kamailio doesn't even start so my syntax is probably wrong.
I also tried playing around with the textops module so I have ran out of ideas
Any ideas?
Thanks in advance.
regards,
Errol
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users@lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- *Rainer Piper* Integration engineer Koeslinstr. 56 53123 BONN GERMANY Phone: +49 228 97167161 P2P: sip:rainer@sip.soho-piper.de:5072 (pjsip-test) XMPP: rainer@xmpp.soho-piper.de
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
Am 03.10.2014 um 17:52 schrieb Errol Samuels:
Hi Rainer,
Yes I did try user_agent_header = "User-Agent: $ua"; but it just passes "$ua" to Freeswitch rather than the value of $ua.
regards,
Errol
On Fri, Oct 3, 2014 at 4:32 PM, Rainer Piper <rainer.piper@soho-piper.de mailto:rainer.piper@soho-piper.de> wrote:
Am 03.10.2014 um 17:04 schrieb Errol Samuels:
Hello All, 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. 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. I am able to set a static User-Agent by doing this in the global section. *user_agent_header = "User-Agent: We love beer";* However, I am unable to set it dynamically for example: *user_agent_header = "User-Agent: " + $ua; *
*have you tried ... **user_agent_header = "User-Agent: $ua"; ? *
*Have you tried to remove the original hf (User-Agent) and set the new one like:
remove_hf("User-Agent"); append_hf("User-Agent: $ua\r\n"); ** ?
*
**
* * With is one Kamailio doesn't even start so my syntax is probably wrong. I also tried playing around with the textops module so I have ran out of ideas Any ideas?* * Thanks in advance.* * regards, Errol * * * * * * _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org <mailto:sr-users@lists.sip-router.org> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- *Rainer Piper* Integration engineer Koeslinstr. 56 53123 BONN GERMANY Phone: +49 228 97167161 <tel:%2B49%20228%2097167161> P2P: sip:rainer@sip.soho-piper.de:5072 (pjsip-test) XMPP: rainer@xmpp.soho-piper.de <mailto:rainer@xmpp.soho-piper.de> _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org <mailto:sr-users@lists.sip-router.org> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
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
I also tried your last suggestion at the point when the registeris being forwarded to FS but it had no effect
# Forward REGISTER to Freeswitch route[REGFWD] { if(!is_method("REGISTER")) { return; }
#if ( is_present_hf("User-Agent")) {
* remove_hf("User-Agent"); append_hf("User-Agent: $ua\r\n");* #}
BR
Errol
On Fri, Oct 3, 2014 at 5:08 PM, Rainer Piper rainer.piper@soho-piper.de wrote:
Am 03.10.2014 um 17:52 schrieb Errol Samuels:
Hi Rainer,
Yes I did try user_agent_header = "User-Agent: $ua"; but it just passes "$ua" to Freeswitch rather than the value of $ua.
regards,
Errol
On Fri, Oct 3, 2014 at 4:32 PM, Rainer Piper rainer.piper@soho-piper.de wrote:
Am 03.10.2014 um 17:04 schrieb Errol Samuels:
Hello All,
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.
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.
I am able to set a static User-Agent by doing this in the global section.
*user_agent_header = "User-Agent: We love beer";*
However, I am unable to set it dynamically for example:
*user_agent_header = "User-Agent: " + $ua; *
*have you tried ... *
*user_agent_header = "User-Agent: $ua"; ? *
*Have you tried to remove the original hf (User-Agent) and set the new one like: remove_hf("User-Agent"); append_hf("User-Agent: $ua\r\n"); *
- ? *
With is one Kamailio doesn't even start so my syntax is probably wrong.
I also tried playing around with the textops module so I have ran out of ideas
Any ideas?
Thanks in advance.
regards,
Errol
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users@lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- *Rainer Piper* Integration engineer Koeslinstr. 56 53123 BONN GERMANY Phone: +49 228 97167161 <%2B49%20228%2097167161> P2P: sip:rainer@sip.soho-piper.de:5072 (pjsip-test) XMPP: rainer@xmpp.soho-piper.de
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
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users@lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- *Rainer Piper* Integration engineer Koeslinstr. 56 53123 BONN GERMANY Phone: +49 228 97167161 P2P: sip:rainer@sip.soho-piper.de:5072 (pjsip-test) XMPP: rainer@xmpp.soho-piper.de
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
You have to use event_route[tm:local-request] if you use uac module to send out new REGISTER.
Cheers, Daniel
On 03/10/14 18:32, Errol Samuels wrote:
I also tried your last suggestion at the point when the registeris being forwarded to FS but it had no effect
# Forward REGISTER to Freeswitch route[REGFWD] { if(!is_method("REGISTER")) { return; }
#if ( is_present_hf("User-Agent")) {
*remove_hf("User-Agent"); append_hf("User-Agent: $ua\r\n");* #}
BR
Errol
On Fri, Oct 3, 2014 at 5:08 PM, Rainer Piper <rainer.piper@soho-piper.de mailto:rainer.piper@soho-piper.de> wrote:
Am 03.10.2014 um 17:52 schrieb Errol Samuels:
Hi Rainer, Yes I did try user_agent_header = "User-Agent: $ua"; but it just passes "$ua" to Freeswitch rather than the value of $ua. regards, Errol On Fri, Oct 3, 2014 at 4:32 PM, Rainer Piper <rainer.piper@soho-piper.de <mailto:rainer.piper@soho-piper.de>> wrote: Am 03.10.2014 um 17:04 schrieb Errol Samuels:
Hello All, 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. 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. I am able to set a static User-Agent by doing this in the global section. *user_agent_header = "User-Agent: We love beer";* However, I am unable to set it dynamically for example: *user_agent_header = "User-Agent: " + $ua; *
*have you tried ... **user_agent_header = "User-Agent: $ua"; ? *
*Have you tried to remove the original hf (User-Agent) and set the new one like: remove_hf("User-Agent"); append_hf("User-Agent: $ua\r\n"); * * ? *
**
* * With is one Kamailio doesn't even start so my syntax is probably wrong. I also tried playing around with the textops module so I have ran out of ideas Any ideas?* * Thanks in advance.* * regards, Errol * * * * * * _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org <mailto:sr-users@lists.sip-router.org> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- *Rainer Piper* Integration engineer Koeslinstr. 56 53123 BONN GERMANY Phone: +49 228 97167161 <tel:%2B49%20228%2097167161> P2P: sip:rainer@sip.soho-piper.de:5072 (pjsip-test) XMPP: rainer@xmpp.soho-piper.de <mailto:rainer@xmpp.soho-piper.de> _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org <mailto:sr-users@lists.sip-router.org> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org <mailto:sr-users@lists.sip-router.org> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- *Rainer Piper* Integration engineer Koeslinstr. 56 53123 BONN GERMANY Phone: +49 228 97167161 <tel:%2B49%20228%2097167161> P2P: sip:rainer@sip.soho-piper.de:5072 (pjsip-test) XMPP: rainer@xmpp.soho-piper.de <mailto:rainer@xmpp.soho-piper.de> _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org <mailto:sr-users@lists.sip-router.org> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
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
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].
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?
# Forward REGISTER to FreeSwitch route[REGFWD] {
if(!is_method("REGISTER")) { return; }
route(DISPATCH); $uac_req(method)="REGISTER"; $uac_req(ruri)=$du; $uac_req(furi)=$fn + "<sip:" + $au + "@" + $ar + ">"; $uac_req(turi)=$tn + "<sip:" + $au + "@" + $ar + ">"; $uac_req(hdrs)="Contact: <sip:" + $au + "@" + $ar + ";fs_path=sip:" + $sel(cfg_get.kamailio.bindip) + ":" + $sel(cfg_get.kamailio.bindport) + ">" + "\r\n"; if($sel(contact.expires) != $null) $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $sel(contact.expires) + "\r\n"; else $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $hdr(Expires) + "\r\n"; uac_req_send(); exit; }
Thanks
Errol
On Tue, Oct 7, 2014 at 9:07 AM, Daniel-Constantin Mierla miconda@gmail.com wrote:
You have to use event_route[tm:local-request] if you use uac module to send out new REGISTER.
Cheers, Daniel
On 03/10/14 18:32, Errol Samuels wrote:
I also tried your last suggestion at the point when the registeris being forwarded to FS but it had no effect
# Forward REGISTER to Freeswitch route[REGFWD] { if(!is_method("REGISTER")) { return; }
#if ( is_present_hf("User-Agent")) {
- remove_hf("User-Agent"); append_hf("User-Agent: $ua\r\n");* #}
BR
Errol
On Fri, Oct 3, 2014 at 5:08 PM, Rainer Piper rainer.piper@soho-piper.de wrote:
Am 03.10.2014 um 17:52 schrieb Errol Samuels:
Hi Rainer,
Yes I did try user_agent_header = "User-Agent: $ua"; but it just passes "$ua" to Freeswitch rather than the value of $ua.
regards,
Errol
On Fri, Oct 3, 2014 at 4:32 PM, Rainer Piper rainer.piper@soho-piper.de wrote:
Am 03.10.2014 um 17:04 schrieb Errol Samuels:
Hello All,
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.
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.
I am able to set a static User-Agent by doing this in the global section.
*user_agent_header = "User-Agent: We love beer";*
However, I am unable to set it dynamically for example:
*user_agent_header = "User-Agent: " + $ua; *
*have you tried ... *
*user_agent_header = "User-Agent: $ua"; ? *
*Have you tried to remove the original hf (User-Agent) and set the new one like: remove_hf("User-Agent"); append_hf("User-Agent: $ua\r\n"); *
- ? *
With is one Kamailio doesn't even start so my syntax is probably wrong.
I also tried playing around with the textops module so I have ran out of ideas
Any ideas?
Thanks in advance.
regards,
Errol
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users@lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- *Rainer Piper* Integration engineer Koeslinstr. 56 53123 BONN GERMANY Phone: +49 228 97167161 <%2B49%20228%2097167161> P2P: sip:rainer@sip.soho-piper.de:5072 (pjsip-test) XMPP: rainer@xmpp.soho-piper.de
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
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users@lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- *Rainer Piper* Integration engineer Koeslinstr. 56 53123 BONN GERMANY Phone: +49 228 97167161 <%2B49%20228%2097167161> P2P: sip:rainer@sip.soho-piper.de:5072 (pjsip-test) XMPP: rainer@xmpp.soho-piper.de
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
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users@lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierlahttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
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
Hey Errol,
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.
event_route [tm:local-request] { # Handle locally generated requests xlog("L_INFO", "Routing locally generated $rm to <$ru> + Modify the User-Agent Header \n"); user_agent_header="User-Agent: My Super SIP Server" ; }
Reference: http://www.kamailio.org/wiki/cookbooks/4.1.x/core?s%5B%5D=event&s%5B%5D=...
BR, Sammy
On Tue, Oct 7, 2014 at 11:20 AM, Errol Samuels ewsamuels@gmail.com wrote:
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].
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?
# Forward REGISTER to FreeSwitch route[REGFWD] {
if(!is_method("REGISTER")) { return; } route(DISPATCH); $uac_req(method)="REGISTER"; $uac_req(ruri)=$du; $uac_req(furi)=$fn + "<sip:" + $au + "@" + $ar + ">"; $uac_req(turi)=$tn + "<sip:" + $au + "@" + $ar + ">"; $uac_req(hdrs)="Contact: <sip:" + $au + "@" + $ar + ";fs_path=sip:" + $sel(cfg_get.kamailio.bindip) + ":" + $sel(cfg_get.kamailio.bindport) + ">" + "\r\n"; if($sel(contact.expires) != $null) $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " +
$sel(contact.expires) + "\r\n"; else $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $hdr(Expires) + "\r\n"; uac_req_send(); exit; }
Thanks
Errol
On Tue, Oct 7, 2014 at 9:07 AM, Daniel-Constantin Mierla < miconda@gmail.com> wrote:
You have to use event_route[tm:local-request] if you use uac module to send out new REGISTER.
Cheers, Daniel
On 03/10/14 18:32, Errol Samuels wrote:
I also tried your last suggestion at the point when the registeris being forwarded to FS but it had no effect
# Forward REGISTER to Freeswitch route[REGFWD] { if(!is_method("REGISTER")) { return; }
#if ( is_present_hf("User-Agent")) {
- remove_hf("User-Agent"); append_hf("User-Agent: $ua\r\n");* #}
BR
Errol
On Fri, Oct 3, 2014 at 5:08 PM, Rainer Piper rainer.piper@soho-piper.de wrote:
Am 03.10.2014 um 17:52 schrieb Errol Samuels:
Hi Rainer,
Yes I did try user_agent_header = "User-Agent: $ua"; but it just passes "$ua" to Freeswitch rather than the value of $ua.
regards,
Errol
On Fri, Oct 3, 2014 at 4:32 PM, Rainer Piper <rainer.piper@soho-piper.de
wrote:
Am 03.10.2014 um 17:04 schrieb Errol Samuels:
Hello All,
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.
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.
I am able to set a static User-Agent by doing this in the global section.
*user_agent_header = "User-Agent: We love beer";*
However, I am unable to set it dynamically for example:
*user_agent_header = "User-Agent: " + $ua; *
*have you tried ... *
*user_agent_header = "User-Agent: $ua"; ? *
*Have you tried to remove the original hf (User-Agent) and set the new one like: remove_hf("User-Agent"); append_hf("User-Agent: $ua\r\n"); *
- ? *
With is one Kamailio doesn't even start so my syntax is probably wrong.
I also tried playing around with the textops module so I have ran out of ideas
Any ideas?
Thanks in advance.
regards,
Errol
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users@lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- *Rainer Piper* Integration engineer Koeslinstr. 56 53123 BONN GERMANY Phone: +49 228 97167161 <%2B49%20228%2097167161> P2P: sip:rainer@sip.soho-piper.de:5072 (pjsip-test) XMPP: rainer@xmpp.soho-piper.de
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
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users@lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- *Rainer Piper* Integration engineer Koeslinstr. 56 53123 BONN GERMANY Phone: +49 228 97167161 <%2B49%20228%2097167161> P2P: sip:rainer@sip.soho-piper.de:5072 (pjsip-test) XMPP: rainer@xmpp.soho-piper.de
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
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users@lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierlahttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
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
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
Hi Sammy,
Thanks for your response and the clarification.
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 user_agent_header="User-Agent: $ua" ;
Where $ua as you are aware would be the Real User-Agent of the actual user who registration is being forwarded to Freeswitch.
if($sel(contact.expires) != $null) $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $sel(contact.expires) + "\r\n"; else $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $hdr(Expires) + "\r\n"; event_route [tm:local-request] { # Handle locally generated requests xlog("L_INFO", "Routing locally generated $rm to <$ru> + Modify the User-Agent Header \n"); user_agent_header="User-Agent: $ua" ; }
uac_req_send(); exit;
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?
0(44073) : <core> [cfg.y:3567]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 1034, column 2-12: syntax error 0(44073) : <core> [cfg.y:3567]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 1034, column 2-12: bad command 0(44073) : <core> [cfg.y:3567]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 1034, column 2-12: bad command 0(44073) : <core> [cfg.y:3570]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 1034, column 14: bad command 0(44073) : <core> [cfg.y:3567]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 1034, column 15-30: bad command 0(44073) : <core> [cfg.y:3570]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 1034, column 31: bad command 0(44073) : <core> [cfg.y:3570]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 1034, column 33: bad command
regards,
Errol
On Tue, Oct 7, 2014 at 9:28 PM, SamyGo govoiper@gmail.com wrote:
Hey Errol,
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.
event_route [tm:local-request] { # Handle locally generated requests xlog("L_INFO", "Routing locally generated $rm to <$ru> + Modify the User-Agent Header \n"); user_agent_header="User-Agent: My Super SIP Server" ; }
Reference: http://www.kamailio.org/wiki/cookbooks/4.1.x/core?s%5B%5D=event&s%5B%5D=...
BR, Sammy
On Tue, Oct 7, 2014 at 11:20 AM, Errol Samuels ewsamuels@gmail.com wrote:
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].
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?
# Forward REGISTER to FreeSwitch route[REGFWD] {
if(!is_method("REGISTER")) { return; } route(DISPATCH); $uac_req(method)="REGISTER"; $uac_req(ruri)=$du; $uac_req(furi)=$fn + "<sip:" + $au + "@" + $ar + ">"; $uac_req(turi)=$tn + "<sip:" + $au + "@" + $ar + ">"; $uac_req(hdrs)="Contact: <sip:" + $au + "@" + $ar + ";fs_path=sip:" + $sel(cfg_get.kamailio.bindip) + ":" + $sel(cfg_get.kamailio.bindport) + ">" + "\r\n"; if($sel(contact.expires) != $null) $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " +
$sel(contact.expires) + "\r\n"; else $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $hdr(Expires) + "\r\n"; uac_req_send(); exit; }
Thanks
Errol
On Tue, Oct 7, 2014 at 9:07 AM, Daniel-Constantin Mierla < miconda@gmail.com> wrote:
You have to use event_route[tm:local-request] if you use uac module to send out new REGISTER.
Cheers, Daniel
On 03/10/14 18:32, Errol Samuels wrote:
I also tried your last suggestion at the point when the registeris being forwarded to FS but it had no effect
# Forward REGISTER to Freeswitch route[REGFWD] { if(!is_method("REGISTER")) { return; }
#if ( is_present_hf("User-Agent")) {
- remove_hf("User-Agent"); append_hf("User-Agent: $ua\r\n");* #}
BR
Errol
On Fri, Oct 3, 2014 at 5:08 PM, Rainer Piper <rainer.piper@soho-piper.de
wrote:
Am 03.10.2014 um 17:52 schrieb Errol Samuels:
Hi Rainer,
Yes I did try user_agent_header = "User-Agent: $ua"; but it just passes "$ua" to Freeswitch rather than the value of $ua.
regards,
Errol
On Fri, Oct 3, 2014 at 4:32 PM, Rainer Piper < rainer.piper@soho-piper.de> wrote:
Am 03.10.2014 um 17:04 schrieb Errol Samuels:
Hello All,
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.
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.
I am able to set a static User-Agent by doing this in the global section.
*user_agent_header = "User-Agent: We love beer";*
However, I am unable to set it dynamically for example:
*user_agent_header = "User-Agent: " + $ua; *
*have you tried ... *
*user_agent_header = "User-Agent: $ua"; ? *
*Have you tried to remove the original hf (User-Agent) and set the new one like: remove_hf("User-Agent"); append_hf("User-Agent: $ua\r\n"); *
- ? *
With is one Kamailio doesn't even start so my syntax is probably wrong.
I also tried playing around with the textops module so I have ran out of ideas
Any ideas?
Thanks in advance.
regards,
Errol
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users@lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- *Rainer Piper* Integration engineer Koeslinstr. 56 53123 BONN GERMANY Phone: +49 228 97167161 <%2B49%20228%2097167161> P2P: sip:rainer@sip.soho-piper.de:5072 (pjsip-test) XMPP: rainer@xmpp.soho-piper.de
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
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users@lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- *Rainer Piper* Integration engineer Koeslinstr. 56 53123 BONN GERMANY Phone: +49 228 97167161 <%2B49%20228%2097167161> P2P: sip:rainer@sip.soho-piper.de:5072 (pjsip-test) XMPP: rainer@xmpp.soho-piper.de
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
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users@lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierlahttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
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
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
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
No no, not like that, its a separate route and needs to be placed outside the other route[] { ... }
On Tue, Oct 7, 2014 at 4:06 PM, Errol Samuels ewsamuels@gmail.com wrote:
Hi Sammy,
Thanks for your response and the clarification.
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 user_agent_header="User-Agent: $ua" ;
Where $ua as you are aware would be the Real User-Agent of the actual user who registration is being forwarded to Freeswitch.
if($sel(contact.expires) != $null) $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $sel(contact.expires) + "\r\n"; else $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $hdr(Expires) + "\r\n"; event_route [tm:local-request] { # Handle locally generated requests xlog("L_INFO", "Routing locally generated $rm to <$ru> + Modify the User-Agent Header \n"); user_agent_header="User-Agent: $ua" ; }
uac_req_send(); exit;
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?
0(44073) : <core> [cfg.y:3567]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 1034, column 2-12: syntax error 0(44073) : <core> [cfg.y:3567]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 1034, column 2-12: bad command 0(44073) : <core> [cfg.y:3567]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 1034, column 2-12: bad command 0(44073) : <core> [cfg.y:3570]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 1034, column 14: bad command 0(44073) : <core> [cfg.y:3567]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 1034, column 15-30: bad command 0(44073) : <core> [cfg.y:3570]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 1034, column 31: bad command 0(44073) : <core> [cfg.y:3570]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 1034, column 33: bad command
regards,
Errol
On Tue, Oct 7, 2014 at 9:28 PM, SamyGo govoiper@gmail.com wrote:
Hey Errol,
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.
event_route [tm:local-request] { # Handle locally generated requests xlog("L_INFO", "Routing locally generated $rm to <$ru> + Modify the User-Agent Header \n"); user_agent_header="User-Agent: My Super SIP Server" ; }
Reference: http://www.kamailio.org/wiki/cookbooks/4.1.x/core?s%5B%5D=event&s%5B%5D=...
BR, Sammy
On Tue, Oct 7, 2014 at 11:20 AM, Errol Samuels ewsamuels@gmail.com wrote:
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].
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?
# Forward REGISTER to FreeSwitch route[REGFWD] {
if(!is_method("REGISTER")) { return; } route(DISPATCH); $uac_req(method)="REGISTER"; $uac_req(ruri)=$du; $uac_req(furi)=$fn + "<sip:" + $au + "@" + $ar + ">"; $uac_req(turi)=$tn + "<sip:" + $au + "@" + $ar + ">"; $uac_req(hdrs)="Contact: <sip:" + $au + "@" + $ar + ";fs_path=sip:" + $sel(cfg_get.kamailio.bindip) + ":" + $sel(cfg_get.kamailio.bindport) + ">" + "\r\n"; if($sel(contact.expires) != $null) $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " +
$sel(contact.expires) + "\r\n"; else $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $hdr(Expires) + "\r\n"; uac_req_send(); exit; }
Thanks
Errol
On Tue, Oct 7, 2014 at 9:07 AM, Daniel-Constantin Mierla < miconda@gmail.com> wrote:
You have to use event_route[tm:local-request] if you use uac module to send out new REGISTER.
Cheers, Daniel
On 03/10/14 18:32, Errol Samuels wrote:
I also tried your last suggestion at the point when the registeris being forwarded to FS but it had no effect
# Forward REGISTER to Freeswitch route[REGFWD] { if(!is_method("REGISTER")) { return; }
#if ( is_present_hf("User-Agent")) {
- remove_hf("User-Agent"); append_hf("User-Agent: $ua\r\n");* #}
BR
Errol
On Fri, Oct 3, 2014 at 5:08 PM, Rainer Piper < rainer.piper@soho-piper.de> wrote:
Am 03.10.2014 um 17:52 schrieb Errol Samuels:
Hi Rainer,
Yes I did try user_agent_header = "User-Agent: $ua"; but it just passes "$ua" to Freeswitch rather than the value of $ua.
regards,
Errol
On Fri, Oct 3, 2014 at 4:32 PM, Rainer Piper < rainer.piper@soho-piper.de> wrote:
Am 03.10.2014 um 17:04 schrieb Errol Samuels:
Hello All,
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.
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.
I am able to set a static User-Agent by doing this in the global section.
*user_agent_header = "User-Agent: We love beer";*
However, I am unable to set it dynamically for example:
*user_agent_header = "User-Agent: " + $ua; *
*have you tried ... *
*user_agent_header = "User-Agent: $ua"; ? *
*Have you tried to remove the original hf (User-Agent) and set the new one like: remove_hf("User-Agent"); append_hf("User-Agent: $ua\r\n"); *
- ? *
With is one Kamailio doesn't even start so my syntax is probably wrong.
I also tried playing around with the textops module so I have ran out of ideas
Any ideas?
Thanks in advance.
regards,
Errol
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users@lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- *Rainer Piper* Integration engineer Koeslinstr. 56 53123 BONN GERMANY Phone: +49 228 97167161 <%2B49%20228%2097167161> P2P: sip:rainer@sip.soho-piper.de:5072 (pjsip-test) XMPP: rainer@xmpp.soho-piper.de
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
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users@lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- *Rainer Piper* Integration engineer Koeslinstr. 56 53123 BONN GERMANY Phone: +49 228 97167161 <%2B49%20228%2097167161> P2P: sip:rainer@sip.soho-piper.de:5072 (pjsip-test) XMPP: rainer@xmpp.soho-piper.de
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
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users@lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierlahttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
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
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
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
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
Perhaps you can get it with adding User-Agent header to $uac_req(hdrs):
$uac_req(hdrs)= $uac_req(hdrs) + "User-Agent: " + $ua + "\r\n";
And sent the global parameter:
user_agent_header=""
But then no local generated request has user agent, which probably is ok for you.
There are still ways to use event_route[tm:local-request] to set a custom user agent header, but would require something like: - add $us in $uac_req(hdrs) as X-UA header - in event_route[tm:local-request], remove User-Agent and X-UA headers and add again User-Agent taking the value from X-UA
Cheers, Daniel
On 07/10/14 23:06, Errol Samuels wrote:
Hi Sammy,
Thanks for your response and the clarification.
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 user_agent_header="User-Agent: $ua" ;
Where $ua as you are aware would be the Real User-Agent of the actual user who registration is being forwarded to Freeswitch.
if($sel(contact.expires) != $null) $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $sel(contact.expires) + "\r\n"; else $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $hdr(Expires) + "\r\n"; event_route [tm:local-request] { # Handle locally generated requests xlog("L_INFO", "Routing locally generated $rm to <$ru> + Modify the User-Agent Header \n"); user_agent_header="User-Agent: $ua" ; }
uac_req_send(); exit;
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?
0(44073) : <core> [cfg.y:3567]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 1034, column 2-12: syntax error 0(44073) : <core> [cfg.y:3567]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 1034, column 2-12: bad command 0(44073) : <core> [cfg.y:3567]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 1034, column 2-12: bad command 0(44073) : <core> [cfg.y:3570]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 1034, column 14: bad command 0(44073) : <core> [cfg.y:3567]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 1034, column 15-30: bad command 0(44073) : <core> [cfg.y:3570]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 1034, column 31: bad command 0(44073) : <core> [cfg.y:3570]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 1034, column 33: bad command
regards,
Errol
On Tue, Oct 7, 2014 at 9:28 PM, SamyGo <govoiper@gmail.com mailto:govoiper@gmail.com> wrote:
Hey Errol, 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. event_route [tm:local-request] { # Handle locally generated requests xlog("L_INFO", "Routing locally generated $rm to <$ru> + Modify the User-Agent Header \n"); user_agent_header="User-Agent: My Super SIP Server" ; } Reference: http://www.kamailio.org/wiki/cookbooks/4.1.x/core?s[]=event&s[]=route#event_route BR, Sammy On Tue, Oct 7, 2014 at 11:20 AM, Errol Samuels <ewsamuels@gmail.com <mailto:ewsamuels@gmail.com>> wrote: 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]. 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? # Forward REGISTER to FreeSwitch route[REGFWD] { if(!is_method("REGISTER")) { return; } route(DISPATCH); $uac_req(method)="REGISTER"; $uac_req(ruri)=$du; $uac_req(furi)=$fn + "<sip:" + $au + "@" + $ar + ">"; $uac_req(turi)=$tn + "<sip:" + $au + "@" + $ar + ">"; $uac_req(hdrs)="Contact: <sip:" + $au + "@" + $ar + ";fs_path=sip:" + $sel(cfg_get.kamailio.bindip) + ":" + $sel(cfg_get.kamailio.bindport) + ">" + "\r\n"; if($sel(contact.expires) != $null) $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $sel(contact.expires) + "\r\n"; else $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $hdr(Expires) + "\r\n"; uac_req_send(); exit; } Thanks Errol On Tue, Oct 7, 2014 at 9:07 AM, Daniel-Constantin Mierla <miconda@gmail.com <mailto:miconda@gmail.com>> wrote: You have to use event_route[tm:local-request] if you use uac module to send out new REGISTER. Cheers, Daniel On 03/10/14 18:32, Errol Samuels wrote:
I also tried your last suggestion at the point when the registeris being forwarded to FS but it had no effect # Forward REGISTER to Freeswitch route[REGFWD] { if(!is_method("REGISTER")) { return; } #if ( is_present_hf("User-Agent")) { *remove_hf("User-Agent"); append_hf("User-Agent: $ua\r\n");* #} BR Errol On Fri, Oct 3, 2014 at 5:08 PM, Rainer Piper <rainer.piper@soho-piper.de <mailto:rainer.piper@soho-piper.de>> wrote: Am 03.10.2014 um 17:52 schrieb Errol Samuels:
Hi Rainer, Yes I did try user_agent_header = "User-Agent: $ua"; but it just passes "$ua" to Freeswitch rather than the value of $ua. regards, Errol On Fri, Oct 3, 2014 at 4:32 PM, Rainer Piper <rainer.piper@soho-piper.de <mailto:rainer.piper@soho-piper.de>> wrote: Am 03.10.2014 um 17:04 schrieb Errol Samuels:
Hello All, 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. 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. I am able to set a static User-Agent by doing this in the global section. *user_agent_header = "User-Agent: We love beer";* However, I am unable to set it dynamically for example: *user_agent_header = "User-Agent: " + $ua; *
*have you tried ... **user_agent_header = "User-Agent: $ua"; ? *
*Have you tried to remove the original hf (User-Agent) and set the new one like: remove_hf("User-Agent"); append_hf("User-Agent: $ua\r\n"); * * ? *
**
* * With is one Kamailio doesn't even start so my syntax is probably wrong. I also tried playing around with the textops module so I have ran out of ideas Any ideas?* * Thanks in advance.* * regards, Errol * * * * * * _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org <mailto:sr-users@lists.sip-router.org> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- *Rainer Piper* Integration engineer Koeslinstr. 56 53123 BONN GERMANY Phone: +49 228 97167161 <tel:%2B49%20228%2097167161> P2P: sip:rainer@sip.soho-piper.de:5072 (pjsip-test) XMPP: rainer@xmpp.soho-piper.de <mailto:rainer@xmpp.soho-piper.de> _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org <mailto:sr-users@lists.sip-router.org> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org <mailto:sr-users@lists.sip-router.org> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- *Rainer Piper* Integration engineer Koeslinstr. 56 53123 BONN GERMANY Phone: +49 228 97167161 <tel:%2B49%20228%2097167161> P2P: sip:rainer@sip.soho-piper.de:5072 (pjsip-test) XMPP: rainer@xmpp.soho-piper.de <mailto:rainer@xmpp.soho-piper.de> _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org <mailto:sr-users@lists.sip-router.org> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org <mailto:sr-users@lists.sip-router.org> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla http://twitter.com/#!/miconda <http://twitter.com/#%21/miconda> -http://www.linkedin.com/in/miconda _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org <mailto:sr-users@lists.sip-router.org> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org <mailto:sr-users@lists.sip-router.org> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org <mailto:sr-users@lists.sip-router.org> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
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
I followed Daniel's instructions and made some progress but not 100% there yet.
-------[Global section]----------
user_agent_header=""
-------[Main Routing Logic]-------
# handle registrations if (is_method("REGISTER")) { $avp(new_user_agent) = $ua; } route(REGISTRAR); . .
# Forward REGISTER to Freeswitch route[REGFWD] {
if(!is_method("REGISTER")) { return; } route(DISPATCH); $uac_req(method)="REGISTER"; $uac_req(ruri)=$du; $uac_req(furi)=$fn + "<sip:" + $au + "@" + $ar + ">"; $uac_req(turi)=$tn + "<sip:" + $au + "@" + $ar + ">"; $uac_req(hdrs)="Contact: <sip:" + $au + "@" + $ar + ";fs_path=sip:" + $sel(cfg_get.kamailio.bindip) + ":" + $sel(cfg_get.kamailio.bindport) + ">" + "\r\n"; if($sel(contact.expires) != $null) $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $sel(contact.expires) + "\r\n"; else $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $hdr(Expires) + "\r\n"; $uac_req(hdrs)= $uac_req(hdrs) + "User-Agent: " + $avp(new_user_agent) + "\r\n"; uac_req_send(); exit; } #!endif
------------
Now the correct User-Agent appears in the REGISTER message but in Freeswitch it shows as unknown.
U 184.xx.xx.208:5060 -> 184.xx.xx.198:6060 REGISTER sip:184.x.x.198:6060 SIP/2.0. Via: SIP/2.0/UDP 184.xx.xx.208;branch=z9hG4bKa764.668d6dc7.0. To: sip:1001@pbx.mydomain.com. From: sip:1001@pbx.mydomain.com;tag=6f72f76f3402bf7cf11f6917529ca761-2ceb. CSeq: 10 REGISTER. Call-ID: 4570a277563cdffc-61869@184.xx.xx.208. Max-Forwards: 70. Content-Length: 0. . Contact: sip:1001@pbx.mydomain.com;fs_path=sip:184.xx.xx.208:5060. Expires: 120. User-Agent: Yealink SIP-T46G 28.72.0.26. . ----------------
Got some extra dots in there but not sure why they are there and how they got there. Any ideas? Anything I missed?
BR
Errol
On Wed, Oct 8, 2014 at 12:34 PM, Daniel-Constantin Mierla <miconda@gmail.com
wrote:
Perhaps you can get it with adding User-Agent header to $uac_req(hdrs):
$uac_req(hdrs)= $uac_req(hdrs) + "User-Agent: " + $ua + "\r\n";
And sent the global parameter:
user_agent_header=""
But then no local generated request has user agent, which probably is ok for you.
There are still ways to use event_route[tm:local-request] to set a custom user agent header, but would require something like:
- add $us in $uac_req(hdrs) as X-UA header
- in event_route[tm:local-request], remove User-Agent and X-UA headers and
add again User-Agent taking the value from X-UA
Cheers, Daniel
Just found something interesting.
I just commented out the "user_agent_header" in the Global section and restarted kamailio and now the REGISTER message seems to be completely intact but now we have two occurrences of the User-Agent. I tried doing the remove_hf("User-Agent) but it doesn't seem to have any effect.
U 184.xx.xx.208:5060 -> 184.xx.xx.198:6060 REGISTER sip:184.xx.xx.198:6060 SIP/2.0. Via: SIP/2.0/UDP 184.154.215.238;branch=z9hG4bK323.a0452631.0. To: sip:205@pbx.mydomain.com. From: sip:205@pbx.mydomain.com;tag=6f72f76f3402bf7cf11f6917529ca761-b489. CSeq: 10 REGISTER. Call-ID: 6ac0486a044f66e5-62858@184.xx.xx.208. Max-Forwards: 70. Content-Length: 0. *User-Agent: kamailio (4.0.6 (x86_64/linux)).* Contact: sip:205@pbx.mydomain.com;fs_path=sip:184.xx.xx.208:5060. *User-Agent: Yealink SIP-T46G 28.72.0.26.* Expires: 120. .
Any ideas?
BR
Errol
On Wed, Oct 8, 2014 at 6:25 PM, Errol Samuels ewsamuels@gmail.com wrote:
I followed Daniel's instructions and made some progress but not 100% there yet.
-------[Global section]----------
user_agent_header=""
-------[Main Routing Logic]-------
# handle registrations if (is_method("REGISTER")) { $avp(new_user_agent) = $ua; } route(REGISTRAR); . .
# Forward REGISTER to Freeswitch route[REGFWD] {
if(!is_method("REGISTER")) { return; } route(DISPATCH); $uac_req(method)="REGISTER"; $uac_req(ruri)=$du; $uac_req(furi)=$fn + "<sip:" + $au + "@" + $ar + ">"; $uac_req(turi)=$tn + "<sip:" + $au + "@" + $ar + ">"; $uac_req(hdrs)="Contact: <sip:" + $au + "@" + $ar + ";fs_path=sip:" + $sel(cfg_get.kamailio.bindip) + ":" + $sel(cfg_get.kamailio.bindport) + ">" + "\r\n"; if($sel(contact.expires) != $null) $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " +
$sel(contact.expires) + "\r\n"; else $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $hdr(Expires) + "\r\n"; $uac_req(hdrs)= $uac_req(hdrs) + "User-Agent: " + $avp(new_user_agent) + "\r\n"; uac_req_send(); exit; } #!endif
Now the correct User-Agent appears in the REGISTER message but in Freeswitch it shows as unknown.
U 184.xx.xx.208:5060 -> 184.xx.xx.198:6060 REGISTER sip:184.x.x.198:6060 SIP/2.0. Via: SIP/2.0/UDP 184.xx.xx.208;branch=z9hG4bKa764.668d6dc7.0. To: sip:1001@pbx.mydomain.com. From: <sip:1001@pbx.mydomain.com
;tag=6f72f76f3402bf7cf11f6917529ca761-2ceb.
CSeq: 10 REGISTER. Call-ID: 4570a277563cdffc-61869@184.xx.xx.208. Max-Forwards: 70. Content-Length: 0. . Contact: sip:1001@pbx.mydomain.com;fs_path=sip:184.xx.xx.208:5060. Expires: 120. User-Agent: Yealink SIP-T46G 28.72.0.26. .
Got some extra dots in there but not sure why they are there and how they got there. Any ideas? Anything I missed?
BR
Errol
On Wed, Oct 8, 2014 at 12:34 PM, Daniel-Constantin Mierla < miconda@gmail.com> wrote:
Perhaps you can get it with adding User-Agent header to $uac_req(hdrs):
$uac_req(hdrs)= $uac_req(hdrs) + "User-Agent: " + $ua + "\r\n";
And sent the global parameter:
user_agent_header=""
But then no local generated request has user agent, which probably is ok for you.
There are still ways to use event_route[tm:local-request] to set a custom user agent header, but would require something like:
- add $us in $uac_req(hdrs) as X-UA header
- in event_route[tm:local-request], remove User-Agent and X-UA headers
and add again User-Agent taking the value from X-UA
Cheers, Daniel
I just commented on the other email you send, try with something like:
user_agent_header="X-Proxy: xyz"
Cheers, Daniel
On 09/10/14 12:08, Errol Samuels wrote:
Just found something interesting.
I just commented out the "user_agent_header" in the Global section and restarted kamailio and now the REGISTER message seems to be completely intact but now we have two occurrences of the User-Agent. I tried doing the remove_hf("User-Agent) but it doesn't seem to have any effect.
U 184.xx.xx.208:5060 -> 184.xx.xx.198:6060 REGISTER sip:184.xx.xx.198:6060 SIP/2.0. Via: SIP/2.0/UDP 184.154.215.238;branch=z9hG4bK323.a0452631.0. To: <sip:205@pbx.mydomain.com mailto:sip%3A205@pbx.mydomain.com>. From: <sip:205@pbx.mydomain.com mailto:sip%3A205@pbx.mydomain.com>;tag=6f72f76f3402bf7cf11f6917529ca761-b489. CSeq: 10 REGISTER. Call-ID: 6ac0486a044f66e5-62858@184.xx.xx.208. Max-Forwards: 70. Content-Length: 0. *User-Agent: kamailio (4.0.6 (x86_64/linux)).* Contact: <sip:205@pbx.mydomain.com mailto:sip%3A205@pbx.mydomain.com;fs_path=sip:184.xx.xx.208:5060>. *User-Agent: Yealink SIP-T46G 28.72.0.26.* Expires: 120. .
Any ideas?
BR
Errol
On Wed, Oct 8, 2014 at 6:25 PM, Errol Samuels <ewsamuels@gmail.com mailto:ewsamuels@gmail.com> wrote:
I followed Daniel's instructions and made some progress but not 100% there yet. -------[Global section]---------- user_agent_header="" -------[Main Routing Logic]------- # handle registrations if (is_method("REGISTER")) { $avp(new_user_agent) = $ua; } route(REGISTRAR); . . # Forward REGISTER to Freeswitch route[REGFWD] { if(!is_method("REGISTER")) { return; } route(DISPATCH); $uac_req(method)="REGISTER"; $uac_req(ruri)=$du; $uac_req(furi)=$fn + "<sip:" + $au + "@" + $ar + ">"; $uac_req(turi)=$tn + "<sip:" + $au + "@" + $ar + ">"; $uac_req(hdrs)="Contact: <sip:" + $au + "@" + $ar + ";fs_path=sip:" + $sel(cfg_get.kamailio.bindip) + ":" + $sel(cfg_get.kamailio.bindport) + ">" + "\r\n"; if($sel(contact.expires) != $null) $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $sel(contact.expires) + "\r\n"; else $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $hdr(Expires) + "\r\n"; $uac_req(hdrs)= $uac_req(hdrs) + "User-Agent: " + $avp(new_user_agent) + "\r\n"; uac_req_send(); exit; } #!endif ------------ Now the correct User-Agent appears in the REGISTER message but in Freeswitch it shows as unknown. U 184.xx.xx.208:5060 -> 184.xx.xx.198:6060 REGISTER sip:184.x.x.198:6060 SIP/2.0. Via: SIP/2.0/UDP 184.xx.xx.208;branch=z9hG4bKa764.668d6dc7.0. To: <sip:1001@pbx.mydomain.com <mailto:sip%3A1001@pbx.mydomain.com>>. From: <sip:1001@pbx.mydomain.com <mailto:sip%3A1001@pbx.mydomain.com>>;tag=6f72f76f3402bf7cf11f6917529ca761-2ceb. CSeq: 10 REGISTER. Call-ID: 4570a277563cdffc-61869@184.xx.xx.208. Max-Forwards: 70. Content-Length: 0. . Contact: <sip:1001@pbx.mydomain.com <mailto:sip%3A1001@pbx.mydomain.com>;fs_path=sip:184.xx.xx.208:5060>. Expires: 120. User-Agent: Yealink SIP-T46G 28.72.0.26. . ---------------- Got some extra dots in there but not sure why they are there and how they got there. Any ideas? Anything I missed? BR Errol On Wed, Oct 8, 2014 at 12:34 PM, Daniel-Constantin Mierla <miconda@gmail.com <mailto:miconda@gmail.com>> wrote: Perhaps you can get it with adding User-Agent header to $uac_req(hdrs): $uac_req(hdrs)= $uac_req(hdrs) + "User-Agent: " + $ua + "\r\n"; And sent the global parameter: user_agent_header="" But then no local generated request has user agent, which probably is ok for you. There are still ways to use event_route[tm:local-request] to set a custom user agent header, but would require something like: - add $us in $uac_req(hdrs) as X-UA header - in event_route[tm:local-request], remove User-Agent and X-UA headers and add again User-Agent taking the value from X-UA Cheers, Daniel
On 08/10/14 19:25, Errol Samuels wrote:
I followed Daniel's instructions and made some progress but not 100% there yet.
-------[Global section]----------
user_agent_header=""
-------[Main Routing Logic]-------
# handle registrations if (is_method("REGISTER")) { $avp(new_user_agent) = $ua; } route(REGISTRAR); . .
# Forward REGISTER to Freeswitch route[REGFWD] {
if(!is_method("REGISTER")) { return; } route(DISPATCH); $uac_req(method)="REGISTER"; $uac_req(ruri)=$du; $uac_req(furi)=$fn + "<sip:" + $au + "@" + $ar + ">"; $uac_req(turi)=$tn + "<sip:" + $au + "@" + $ar + ">"; $uac_req(hdrs)="Contact: <sip:" + $au + "@" + $ar + ";fs_path=sip:" + $sel(cfg_get.kamailio.bindip) + ":" + $sel(cfg_get.kamailio.bindport) + ">" + "\r\n"; if($sel(contact.expires) != $null) $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " +
$sel(contact.expires) + "\r\n"; else $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $hdr(Expires) + "\r\n"; $uac_req(hdrs)= $uac_req(hdrs) + "User-Agent: " + $avp(new_user_agent) + "\r\n"; uac_req_send(); exit; } #!endif
Now the correct User-Agent appears in the REGISTER message but in Freeswitch it shows as unknown.
U 184.xx.xx.208:5060 -> 184.xx.xx.198:6060 REGISTER sip:184.x.x.198:6060 SIP/2.0. Via: SIP/2.0/UDP 184.xx.xx.208;branch=z9hG4bKa764.668d6dc7.0. To: <sip:1001@pbx.mydomain.com mailto:sip%3A1001@pbx.mydomain.com>. From: <sip:1001@pbx.mydomain.com mailto:sip%3A1001@pbx.mydomain.com>;tag=6f72f76f3402bf7cf11f6917529ca761-2ceb. CSeq: 10 REGISTER. Call-ID: 4570a277563cdffc-61869@184.xx.xx.208. Max-Forwards: 70. Content-Length: 0. . Contact: <sip:1001@pbx.mydomain.com mailto:sip%3A1001@pbx.mydomain.com;fs_path=sip:184.xx.xx.208:5060>. Expires: 120. User-Agent: Yealink SIP-T46G 28.72.0.26. .
Got some extra dots in there but not sure why they are there and how they got there. Any ideas? Anything I missed?
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.
A solution for now will be to use:
user_agent_header = "X-Proxy: abc"
Or, in other words, set the value of the parameter to something that doesn't include User-Agent: as header name.
Cheers, Daniel
BR
Errol
On Wed, Oct 8, 2014 at 12:34 PM, Daniel-Constantin Mierla <miconda@gmail.com mailto:miconda@gmail.com> wrote:
Perhaps you can get it with adding User-Agent header to $uac_req(hdrs): $uac_req(hdrs)= $uac_req(hdrs) + "User-Agent: " + $ua + "\r\n"; And sent the global parameter: user_agent_header="" But then no local generated request has user agent, which probably is ok for you. There are still ways to use event_route[tm:local-request] to set a custom user agent header, but would require something like: - add $us in $uac_req(hdrs) as X-UA header - in event_route[tm:local-request], remove User-Agent and X-UA headers and add again User-Agent taking the value from X-UA Cheers, Daniel
HI Daniel,
Thanks for that.
In my case I would need to use something like:
user_agent_header = "X-Proxy: $ua"
since we don't what to hardcode a specific value which would affect every device that is registering but rather $ua which would set the real UA of the device that is registering at that time.
Does that make sense?
regards,
Errol
On Thu, Oct 9, 2014 at 12:09 PM, Daniel-Constantin Mierla <miconda@gmail.com
wrote:
On 08/10/14 19:25, Errol Samuels wrote:
I followed Daniel's instructions and made some progress but not 100% there yet.
-------[Global section]----------
user_agent_header=""
-------[Main Routing Logic]-------
# handle registrations if (is_method("REGISTER")) { $avp(new_user_agent) = $ua; } route(REGISTRAR); . .
# Forward REGISTER to Freeswitch route[REGFWD] {
if(!is_method("REGISTER")) { return; } route(DISPATCH); $uac_req(method)="REGISTER"; $uac_req(ruri)=$du; $uac_req(furi)=$fn + "<sip:" + $au + "@" + $ar + ">"; $uac_req(turi)=$tn + "<sip:" + $au + "@" + $ar + ">"; $uac_req(hdrs)="Contact: <sip:" + $au + "@" + $ar + ";fs_path=sip:" + $sel(cfg_get.kamailio.bindip) + ":" + $sel(cfg_get.kamailio.bindport) + ">" + "\r\n"; if($sel(contact.expires) != $null) $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " +
$sel(contact.expires) + "\r\n"; else $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $hdr(Expires) + "\r\n"; $uac_req(hdrs)= $uac_req(hdrs) + "User-Agent: " + $avp(new_user_agent) + "\r\n"; uac_req_send(); exit; } #!endif
Now the correct User-Agent appears in the REGISTER message but in Freeswitch it shows as unknown.
U 184.xx.xx.208:5060 -> 184.xx.xx.198:6060 REGISTER sip:184.x.x.198:6060 SIP/2.0. Via: SIP/2.0/UDP 184.xx.xx.208;branch=z9hG4bKa764.668d6dc7.0. To: sip:1001@pbx.mydomain.com. From: <sip:1001@pbx.mydomain.com
;tag=6f72f76f3402bf7cf11f6917529ca761-2ceb.
CSeq: 10 REGISTER. Call-ID: 4570a277563cdffc-61869@184.xx.xx.208. Max-Forwards: 70. Content-Length: 0. . Contact: sip:1001@pbx.mydomain.com;fs_path=sip:184.xx.xx.208:5060. Expires: 120. User-Agent: Yealink SIP-T46G 28.72.0.26. .
Got some extra dots in there but not sure why they are there and how they got there. Any ideas? Anything I missed?
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.
A solution for now will be to use:
user_agent_header = "X-Proxy: abc"
Or, in other words, set the value of the parameter to something that doesn't include User-Agent: as header name.
Cheers, Daniel
BR
Errol
On Wed, Oct 8, 2014 at 12:34 PM, Daniel-Constantin Mierla < miconda@gmail.com> wrote:
Perhaps you can get it with adding User-Agent header to $uac_req(hdrs):
$uac_req(hdrs)= $uac_req(hdrs) + "User-Agent: " + $ua + "\r\n";
And sent the global parameter:
user_agent_header=""
But then no local generated request has user agent, which probably is ok for you.
There are still ways to use event_route[tm:local-request] to set a custom user agent header, but would require something like:
- add $us in $uac_req(hdrs) as X-UA header
- in event_route[tm:local-request], remove User-Agent and X-UA headers
and add again User-Agent taking the value from X-UA
Cheers, Daniel
-- Daniel-Constantin Mierlahttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Hello,
On 09/10/14 13:19, Errol Samuels wrote:
HI Daniel,
Thanks for that.
In my case I would need to use something like:
user_agent_header = "X-Proxy: $ua"
The only purpose of the above line is that Kamailio doesn't add an User-Agent header by itself, but this X-Proxy (which you can change as well).
Then you still add User-Agent in $uac_req(hdrs), but you don't end up with two User-Agent headers anymore.
Hope is more clear now the purpose of X-Proxy header.
Cheers, Daniel
since we don't what to hardcode a specific value which would affect every device that is registering but rather $ua which would set the real UA of the device that is registering at that time.
Does that make sense?
regards,
Errol
On Thu, Oct 9, 2014 at 12:09 PM, Daniel-Constantin Mierla <miconda@gmail.com mailto:miconda@gmail.com> wrote:
On 08/10/14 19:25, Errol Samuels wrote:
I followed Daniel's instructions and made some progress but not 100% there yet. -------[Global section]---------- user_agent_header="" -------[Main Routing Logic]------- # handle registrations if (is_method("REGISTER")) { $avp(new_user_agent) = $ua; } route(REGISTRAR); . . # Forward REGISTER to Freeswitch route[REGFWD] { if(!is_method("REGISTER")) { return; } route(DISPATCH); $uac_req(method)="REGISTER"; $uac_req(ruri)=$du; $uac_req(furi)=$fn + "<sip:" + $au + "@" + $ar + ">"; $uac_req(turi)=$tn + "<sip:" + $au + "@" + $ar + ">"; $uac_req(hdrs)="Contact: <sip:" + $au + "@" + $ar + ";fs_path=sip:" + $sel(cfg_get.kamailio.bindip) + ":" + $sel(cfg_get.kamailio.bindport) + ">" + "\r\n"; if($sel(contact.expires) != $null) $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $sel(contact.expires) + "\r\n"; else $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $hdr(Expires) + "\r\n"; $uac_req(hdrs)= $uac_req(hdrs) + "User-Agent: " + $avp(new_user_agent) + "\r\n"; uac_req_send(); exit; } #!endif ------------ Now the correct User-Agent appears in the REGISTER message but in Freeswitch it shows as unknown. U 184.xx.xx.208:5060 -> 184.xx.xx.198:6060 REGISTER sip:184.x.x.198:6060 SIP/2.0. Via: SIP/2.0/UDP 184.xx.xx.208;branch=z9hG4bKa764.668d6dc7.0. To: <sip:1001@pbx.mydomain.com <mailto:sip%3A1001@pbx.mydomain.com>>. From: <sip:1001@pbx.mydomain.com <mailto:sip%3A1001@pbx.mydomain.com>>;tag=6f72f76f3402bf7cf11f6917529ca761-2ceb. CSeq: 10 REGISTER. Call-ID: 4570a277563cdffc-61869@184.xx.xx.208 <mailto:4570a277563cdffc-61869@184.xx.xx.208>. Max-Forwards: 70. Content-Length: 0. . Contact: <sip:1001@pbx.mydomain.com <mailto:sip%3A1001@pbx.mydomain.com>;fs_path=sip:184.xx.xx.208:5060>. Expires: 120. User-Agent: Yealink SIP-T46G 28.72.0.26. . ---------------- Got some extra dots in there but not sure why they are there and how they got there. Any ideas? Anything I missed?
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. A solution for now will be to use: user_agent_header = "X-Proxy: abc" Or, in other words, set the value of the parameter to something that doesn't include User-Agent: as header name. Cheers, Daniel
BR Errol On Wed, Oct 8, 2014 at 12:34 PM, Daniel-Constantin Mierla <miconda@gmail.com <mailto:miconda@gmail.com>> wrote: Perhaps you can get it with adding User-Agent header to $uac_req(hdrs): $uac_req(hdrs)= $uac_req(hdrs) + "User-Agent: " + $ua + "\r\n"; And sent the global parameter: user_agent_header="" But then no local generated request has user agent, which probably is ok for you. There are still ways to use event_route[tm:local-request] to set a custom user agent header, but would require something like: - add $us in $uac_req(hdrs) as X-UA header - in event_route[tm:local-request], remove User-Agent and X-UA headers and add again User-Agent taking the value from X-UA Cheers, Daniel
-- Daniel-Constantin Mierla http://twitter.com/#!/miconda <http://twitter.com/#%21/miconda> -http://www.linkedin.com/in/miconda
Btw, there is a global parameter to disable server signatures:
- http://www.kamailio.org/wiki/cookbooks/devel/core#server_signature
According to the code, it affect USER-Agent when generating a request and Server header for replies.
Turn it of and can get rid of the workaround with custom header name.
Cheers, Daniel
On 09/10/14 13:52, Daniel-Constantin Mierla wrote:
Hello,
On 09/10/14 13:19, Errol Samuels wrote:
HI Daniel,
Thanks for that.
In my case I would need to use something like:
user_agent_header = "X-Proxy: $ua"
The only purpose of the above line is that Kamailio doesn't add an User-Agent header by itself, but this X-Proxy (which you can change as well).
Then you still add User-Agent in $uac_req(hdrs), but you don't end up with two User-Agent headers anymore.
Hope is more clear now the purpose of X-Proxy header.
Cheers, Daniel
since we don't what to hardcode a specific value which would affect every device that is registering but rather $ua which would set the real UA of the device that is registering at that time.
Does that make sense?
regards,
Errol
On Thu, Oct 9, 2014 at 12:09 PM, Daniel-Constantin Mierla <miconda@gmail.com mailto:miconda@gmail.com> wrote:
On 08/10/14 19:25, Errol Samuels wrote:
I followed Daniel's instructions and made some progress but not 100% there yet. -------[Global section]---------- user_agent_header="" -------[Main Routing Logic]------- # handle registrations if (is_method("REGISTER")) { $avp(new_user_agent) = $ua; } route(REGISTRAR); . . # Forward REGISTER to Freeswitch route[REGFWD] { if(!is_method("REGISTER")) { return; } route(DISPATCH); $uac_req(method)="REGISTER"; $uac_req(ruri)=$du; $uac_req(furi)=$fn + "<sip:" + $au + "@" + $ar + ">"; $uac_req(turi)=$tn + "<sip:" + $au + "@" + $ar + ">"; $uac_req(hdrs)="Contact: <sip:" + $au + "@" + $ar + ";fs_path=sip:" + $sel(cfg_get.kamailio.bindip) + ":" + $sel(cfg_get.kamailio.bindport) + ">" + "\r\n"; if($sel(contact.expires) != $null) $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $sel(contact.expires) + "\r\n"; else $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $hdr(Expires) + "\r\n"; $uac_req(hdrs)= $uac_req(hdrs) + "User-Agent: " + $avp(new_user_agent) + "\r\n"; uac_req_send(); exit; } #!endif ------------ Now the correct User-Agent appears in the REGISTER message but in Freeswitch it shows as unknown. U 184.xx.xx.208:5060 -> 184.xx.xx.198:6060 REGISTER sip:184.x.x.198:6060 SIP/2.0. Via: SIP/2.0/UDP 184.xx.xx.208;branch=z9hG4bKa764.668d6dc7.0. To: <sip:1001@pbx.mydomain.com <mailto:sip%3A1001@pbx.mydomain.com>>. From: <sip:1001@pbx.mydomain.com <mailto:sip%3A1001@pbx.mydomain.com>>;tag=6f72f76f3402bf7cf11f6917529ca761-2ceb. CSeq: 10 REGISTER. Call-ID: 4570a277563cdffc-61869@184.xx.xx.208 <mailto:4570a277563cdffc-61869@184.xx.xx.208>. Max-Forwards: 70. Content-Length: 0. . Contact: <sip:1001@pbx.mydomain.com <mailto:sip%3A1001@pbx.mydomain.com>;fs_path=sip:184.xx.xx.208:5060>. Expires: 120. User-Agent: Yealink SIP-T46G 28.72.0.26. . ---------------- Got some extra dots in there but not sure why they are there and how they got there. Any ideas? Anything I missed?
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. A solution for now will be to use: user_agent_header = "X-Proxy: abc" Or, in other words, set the value of the parameter to something that doesn't include User-Agent: as header name. Cheers, Daniel
BR Errol On Wed, Oct 8, 2014 at 12:34 PM, Daniel-Constantin Mierla <miconda@gmail.com <mailto:miconda@gmail.com>> wrote: Perhaps you can get it with adding User-Agent header to $uac_req(hdrs): $uac_req(hdrs)= $uac_req(hdrs) + "User-Agent: " + $ua + "\r\n"; And sent the global parameter: user_agent_header="" But then no local generated request has user agent, which probably is ok for you. There are still ways to use event_route[tm:local-request] to set a custom user agent header, but would require something like: - add $us in $uac_req(hdrs) as X-UA header - in event_route[tm:local-request], remove User-Agent and X-UA headers and add again User-Agent taking the value from X-UA Cheers, Daniel
-- Daniel-Constantin Mierla http://twitter.com/#!/miconda <http://twitter.com/#%21/miconda> -http://www.linkedin.com/in/miconda
-- Daniel-Constantin Mierla http://twitter.com/#!/miconda -http://www.linkedin.com/in/miconda