[SOLVED] HOW TO Insert customer IP Address into Ticket Information OTRS 3.6

Moderator: crythias

Post Reply
PriteshP23
Znuny newbie
Posts: 98
Joined: 02 Sep 2014, 23:01
Znuny Version: 4.0.9-02

[SOLVED] HOW TO Insert customer IP Address into Ticket Information OTRS 3.6

Post by PriteshP23 »

Hello,
I would like to add IP Address of customer in Ticket Information section, to see when we do AgentTicketZoom. Problem is that it shows "SAME ip" value for all tickets. I hope i am clear.
I added IP label to file AgentTicketZoom.dtl.

Code: Select all

/opt/otrs/Kernel/Output/HTML/Standard/AgentTicketZoom.dtl
<label>IP Addrs : </label><a href="https://www.abc.com/ip?ip_addr=$Env{"REMOTE_ADDR"}" target="_blank" class="DynamicFieldLink" > $Env{"REMOTE_ADDR"} </a>
</label>
Kernel/Output/HTML/Standard/CustomerTicketMessage.dtl
Near the very bottom of the file, there's a <script> tag that runs the "Core.Customer.InitFocus();" function. Right beneath that line, i add the following:

Code: Select all

document.getElementById('ipaddr').style.display = 'none';
document.getElementById('IP').style.display = 'none';
document.getElementById("ipaddr").value = "$Env{"REMOTE_ADDR"}";
Result:
It make same IP Address for ALL tickets.
IP Addrs : 192.169.159.38

Did i miss something? Any idea ? Please let me know if you have any suggestion or need more problem information.

Many Thanks in advanced for your time and input !
Last edited by PriteshP23 on 04 May 2015, 10:51, edited 1 time in total.
OTRS 4.0.10-02 PostgreSQL 9.3.5
Perl 5.10.1 (linux) is used.
OS: Cent OS 6.5
eandrex
Znuny expert
Posts: 213
Joined: 04 Nov 2012, 23:58
Znuny Version: OTRS 4.x
Real Name: Esteban
Company: NORTON DE COLOMBIA

Re: HOW TO Insert customer IP Address into Ticket Information OTRS 3.6

Post by eandrex »

Is there a proxy behind? if so, try using: HTTP_FORWARDED_FOR

and i think it is not necesary to edit AgentTicketZoom.dtl.

Just create a dynamicfield (i guess you already did so) and modify that value in CustomerTicketMessage.dtl. Now enable that dynamicifield in your AgentTicketZoom (Sysconfig).
PriteshP23
Znuny newbie
Posts: 98
Joined: 02 Sep 2014, 23:01
Znuny Version: 4.0.9-02

Re: HOW TO Insert customer IP Address into Ticket Information OTRS 3.6

Post by PriteshP23 »

@eandrex
First of all Thanks for quick response.
I am not sure for proxy-behind but still i tried your trick. Its not working in my case.

Yes, i have already created dynamicfield and also activated in sysconfig. Just to make sure i need to enable by writing fieldname in sysconfig, not by label name, right? I put value 1 to enable it.
OTRS 4.0.10-02 PostgreSQL 9.3.5
Perl 5.10.1 (linux) is used.
OS: Cent OS 6.5
PriteshP23
Znuny newbie
Posts: 98
Joined: 02 Sep 2014, 23:01
Znuny Version: 4.0.9-02

Re: HOW TO Insert customer IP Address into Ticket Information OTRS 3.6

Post by PriteshP23 »

Its showing my IP address instead of customer's IP. Any idea ?
thanks !
OTRS 4.0.10-02 PostgreSQL 9.3.5
Perl 5.10.1 (linux) is used.
OS: Cent OS 6.5
PriteshP23
Znuny newbie
Posts: 98
Joined: 02 Sep 2014, 23:01
Znuny Version: 4.0.9-02

Re: HOW TO Insert customer IP Address into Ticket Information OTRS 3.6

Post by PriteshP23 »

@eandrex

I added in Plain Format "X-Me-Ip" to get the real IP of client. Its working. But how to show it in Ticket Information ? I modify AgentTicketZoom.dtl file but its not showing X-Me-Ip value from header.

@crythias
Any idea to get IP value from header?

Many Thanks !
OTRS 4.0.10-02 PostgreSQL 9.3.5
Perl 5.10.1 (linux) is used.
OS: Cent OS 6.5
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: HOW TO Insert customer IP Address into Ticket Information OTRS 3.6

Post by crythias »

Yes, but I don't trust it. viewtopic.php?t=8933
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
PriteshP23
Znuny newbie
Posts: 98
Joined: 02 Sep 2014, 23:01
Znuny Version: 4.0.9-02

Re: HOW TO Insert customer IP Address into Ticket Information OTRS 3.6

Post by PriteshP23 »

@crythias
Yes, but I don't trust it.
Thanks ! As you can see my comment on that topic, i already tried but didnt work in my case.

I am trying to get value of X-Me-Ip from header of mail. When we click on "Plain Format", i can see real value of IP in this tag. Basically i need to copy it and show it in Ticket Information via AgentTicketZoom.dtl file.

I hope i am clear.
OTRS 4.0.10-02 PostgreSQL 9.3.5
Perl 5.10.1 (linux) is used.
OS: Cent OS 6.5
jojo
Znuny guru
Posts: 15019
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: HOW TO Insert customer IP Address into Ticket Information OTRS 3.6

Post by jojo »

1. revert you code changes
2. create a dynamic field eg. CustomerIP
3. create a postmaster filter which copies the content of the X Header from the mail to the dynamic field (Admin interface)
4. configure ticket zoom to display the dynamic field
5. buy professional services instead digging in the dark...
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
PriteshP23
Znuny newbie
Posts: 98
Joined: 02 Sep 2014, 23:01
Znuny Version: 4.0.9-02

Re: HOW TO Insert customer IP Address into Ticket Information OTRS 3.6

Post by PriteshP23 »

@jojo

Thats sounds great. For 3rd step, i did this but not able to copie the value:

Code: Select all

Filter Condition
Header1: X-OTRS-DynamicField-ipaddr Value 1: ??

Set Email Headers
Header1: X-OTRS-DynamicField-ipaddr Value 1: [***]
Do i need to use regex for ip? \b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b

In addition, its for all tickets, i cant add only one Queue for filter.

Many Thanks !
OTRS 4.0.10-02 PostgreSQL 9.3.5
Perl 5.10.1 (linux) is used.
OS: Cent OS 6.5
jojo
Znuny guru
Posts: 15019
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: HOW TO Insert customer IP Address into Ticket Information OTRS 3.6

Post by jojo »

try (.*)
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
PriteshP23
Znuny newbie
Posts: 98
Joined: 02 Sep 2014, 23:01
Znuny Version: 4.0.9-02

Re: HOW TO Insert customer IP Address into Ticket Information OTRS 3.6

Post by PriteshP23 »

@jojo
Did you mean to say like this ?

Filter Condition
Header1: X-OTRS-DynamicField-ipaddr Value 1: (.*)
Set Email Headers
Header1: X-OTRS-DynamicField-ipaddr Value 1: (.*)

Main problem is to know how it will copies the content ?
OTRS 4.0.10-02 PostgreSQL 9.3.5
Perl 5.10.1 (linux) is used.
OS: Cent OS 6.5
jojo
Znuny guru
Posts: 15019
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: HOW TO Insert customer IP Address into Ticket Information OTRS 3.6

Post by jojo »

Filter Condition
Header1: X-Me-Ipr Value 1: (.*)
Set Email Headers
Header1: X-OTRS-DynamicField-ipaddr Value 1: [***]
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
PriteshP23
Znuny newbie
Posts: 98
Joined: 02 Sep 2014, 23:01
Znuny Version: 4.0.9-02

Re: HOW TO Insert customer IP Address into Ticket Information OTRS 3.6

Post by PriteshP23 »

@jojo
Filter Condition
Header1: X-Me-Ipr Value 1: (.*)
I found it from admin manual. Thanks. Ticket -> Core::PostMaster => PostmasterX-Header

Any idea how to save this value in url link ? So, when we click it goes to other page.
OTRS 4.0.10-02 PostgreSQL 9.3.5
Perl 5.10.1 (linux) is used.
OS: Cent OS 6.5
PriteshP23
Znuny newbie
Posts: 98
Joined: 02 Sep 2014, 23:01
Znuny Version: 4.0.9-02

Re: HOW TO Insert customer IP Address into Ticket Information OTRS 3.6

Post by PriteshP23 »

@jojo
4. configure ticket zoom to display the dynamic field
When you say Step 4. configure ticket zoom to display the dynamic field => Ticket -> Frontend::Agent::Ticket::ViewZoom , added in Ticket::Frontend::AgentTicketZoom###DynamicField : Key= ipaddr, Content=1
Nothing else to do, am i right?

We are very close to the solution.

Any help ?
OTRS 4.0.10-02 PostgreSQL 9.3.5
Perl 5.10.1 (linux) is used.
OS: Cent OS 6.5
PriteshP23
Znuny newbie
Posts: 98
Joined: 02 Sep 2014, 23:01
Znuny Version: 4.0.9-02

[SOLVED] HOW TO Insert customer IP Address into Ticket Information OTRS 3.6

Post by PriteshP23 »

@eandrex @jojo @crythias

Finally, its SOLVED !! The only misunderstanding was "X-Me-Ip" via sysConfig. I wrote "X-Me-Ipr" as you wrote in filter condition and later i changed to "X-Me-Ip" to make it working.

So, i did:
1. create a dynamic field eg. Lable: CustomerIP, Key: ipaddr
2. create a postmaster filter which copies the content of the X Header from the mail to the dynamic field (Admin interface). You should have "X-Me-Ip" tag in your header of mail.
Filter Condition
Header1: "X-Me-Ip" Value 1: (.*)
Set Email Headers
Header1: X-OTRS-DynamicField-ipaddr Value 1: [***]
3. configure ticket zoom to display the dynamic field via SysConfig

Once again Thanks a lot !!
OTRS 4.0.10-02 PostgreSQL 9.3.5
Perl 5.10.1 (linux) is used.
OS: Cent OS 6.5
Post Reply