diff --git a/daemon/src/preferences.cpp b/daemon/src/preferences.cpp
index caa7623b7ea86f25f262ec4ebdbc8e689537e511..75b26b2eb9560132a71f9284092bc39732f93069 100644
--- a/daemon/src/preferences.cpp
+++ b/daemon/src/preferences.cpp
@@ -34,6 +34,7 @@
 #include "config/yamlemitter.h"
 #include "config/yamlnode.h"
 #include "hooks/urlhook.h"
+#include "sip/sip_utils.h"
 #include <sstream>
 #include "global.h"
 #include <cassert>
@@ -275,9 +276,12 @@ void HookPreference::unserialize(const Conf::MappingNode *map)
     map->getValue(urlSipFieldKey, &urlSipField_);
 }
 
-void HookPreference::run(const std::string &header)
+void HookPreference::runHook(pjsip_msg *msg)
 {
-    UrlHook::runAction(urlCommand_, header);
+    if (sipEnabled_) {
+        std::string header(sip_utils::fetchHeaderValue(msg, urlSipField_));
+        UrlHook::runAction(urlCommand_, header);
+    }
 }
 
 AudioPreference::AudioPreference() :
diff --git a/daemon/src/preferences.h b/daemon/src/preferences.h
index 24d15a524e17a27429f6473a1debbcb6eb8bdd2c..4772671b8e2ca4970912399a6a4fcf9e1801211f 100644
--- a/daemon/src/preferences.h
+++ b/daemon/src/preferences.h
@@ -328,10 +328,11 @@ class AddressbookPreference : public Serializable {
         bool business_;
         bool home_;
         bool mobile_;
-
 };
 
 
+class pjsip_msg;
+
 class HookPreference : public Serializable {
     public:
         HookPreference();
@@ -349,9 +350,7 @@ class HookPreference : public Serializable {
         }
 
         std::map<std::string, std::string> toMap() const;
-        bool getSipEnabled() const { return sipEnabled_; }
-        std::string getUrlSipField() const { return urlSipField_; }
-        void run(const std::string &header);
+        void runHook(pjsip_msg *msg);
 
     private:
         bool iax2Enabled_;
diff --git a/daemon/src/sip/Makefile.am b/daemon/src/sip/Makefile.am
index 539a041feb29a3b10efcf1f47980c79c501b4482..bc3fdf7ba2af29002cd881ea2d2ee02a32d88a87 100644
--- a/daemon/src/sip/Makefile.am
+++ b/daemon/src/sip/Makefile.am
@@ -14,7 +14,9 @@ libsiplink_la_SOURCES = \
 		sdp.h \
 		sipaccount.h \
 		sipcall.h \
-		sipvoiplink.h
+		sipvoiplink.h \
+		sip_utils.cpp \
+		sip_utils.h
 
 libsiplink_la_CXXFLAGS = \
 		@PCRE_LIBS@
diff --git a/daemon/src/sip/sip_utils.cpp b/daemon/src/sip/sip_utils.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..8b98f0c44967b399ef4b7c1cb985b5321fdea296
--- /dev/null
+++ b/daemon/src/sip/sip_utils.cpp
@@ -0,0 +1,53 @@
+/*
+ *  Copyright (C) 2004-2012 Savoir-Faire Linux Inc.
+ *
+ *  Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *  Additional permission under GNU GPL version 3 section 7:
+ *
+ *  If you modify this program, or any covered work, by linking or
+ *  combining it with the OpenSSL project's OpenSSL library (or a
+ *  modified version of that library), containing parts covered by the
+ *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
+ *  grants you additional permission to convey the resulting work.
+ *  Corresponding Source for a non-source form of such a combination
+ *  shall include the source code for the parts of OpenSSL used as well
+ *  as that of the covered work.
+ */
+
+#include "sip_utils.h"
+#include "pj/string.h"
+#include "pjsip/sip_msg.h"
+
+std::string
+sip_utils::fetchHeaderValue(pjsip_msg *msg, const std::string &field)
+{
+    pj_str_t name = pj_str((char*) field.c_str());
+    pjsip_generic_string_hdr *hdr = static_cast<pjsip_generic_string_hdr*>(pjsip_msg_find_hdr_by_name(msg, &name, NULL));
+
+    if (!hdr)
+        return "";
+
+    std::string value(hdr->hvalue.ptr, hdr->hvalue.slen);
+
+    size_t pos = value.find("\n");
+
+    if (pos != std::string::npos)
+        return value.substr(0, pos);
+    else
+        return "";
+}
diff --git a/daemon/src/sip/sip_utils.h b/daemon/src/sip/sip_utils.h
new file mode 100644
index 0000000000000000000000000000000000000000..1a8d8bff4200e02312286fd8cad5e3dedfa01e84
--- /dev/null
+++ b/daemon/src/sip/sip_utils.h
@@ -0,0 +1,47 @@
+/*
+ *  Copyright (C) 2004-2012 Savoir-Faire Linux Inc.
+ *
+ *  Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *  Additional permission under GNU GPL version 3 section 7:
+ *
+ *  If you modify this program, or any covered work, by linking or
+ *  combining it with the OpenSSL project's OpenSSL library (or a
+ *  modified version of that library), containing parts covered by the
+ *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
+ *  grants you additional permission to convey the resulting work.
+ *  Corresponding Source for a non-source form of such a combination
+ *  shall include the source code for the parts of OpenSSL used as well
+ *  as that of the covered work.
+ */
+
+#ifndef SIP_UTILS_H_
+#define SIP_UTILS_H_
+
+#include <string>
+
+class pjsip_msg;
+
+namespace sip_utils {
+    /**
+     * Helper function to parser header from incoming sip messages
+     * @return Header from SIP message
+     */
+    std::string fetchHeaderValue(pjsip_msg *msg, const std::string &field);
+}
+
+#endif // SIP_UTILS_H_
diff --git a/daemon/src/sip/sipvoiplink.cpp b/daemon/src/sip/sipvoiplink.cpp
index 0e3a318d43605ea786e05ea6adf1df8c9fa56f4a..fd7e7f729123cffa137030f7f1f9ffdbdfd09489 100644
--- a/daemon/src/sip/sipvoiplink.cpp
+++ b/daemon/src/sip/sipvoiplink.cpp
@@ -89,11 +89,6 @@ static std::map<std::string, std::string> transferCallID;
  */
 void setCallMediaLocal(SIPCall* call, const std::string &localIP);
 
-/**
- * Helper function to parser header from incoming sip messages
- */
-std::string fetchHeaderValue(pjsip_msg *msg, const std::string &field);
-
 static pj_caching_pool pool_cache, *cp_ = &pool_cache;
 static pj_pool_t *pool_;
 static pjsip_endpoint *endpt_;
@@ -306,10 +301,7 @@ pj_bool_t transaction_request_cb(pjsip_rx_data *rdata)
         return true;
     }
 
-    if (Manager::instance().hookPreference.getSipEnabled()) {
-        std::string header_value(fetchHeaderValue(rdata->msg_info.msg, Manager::instance().hookPreference.getUrlSipField()));
-        Manager::instance().hookPreference.run(header_value);
-    }
+    Manager::instance().hookPreference.runHook(rdata->msg_info.msg);
 
     SIPCall* call = new SIPCall(Manager::instance().getNewCallID(), Call::INCOMING, cp_);
     Manager::instance().associateCallToAccount(call->getCallId(), account_id);
@@ -2113,25 +2105,6 @@ void setCallMediaLocal(SIPCall* call, const std::string &localIP)
     call->setLocalAudioPort(callLocalAudioPort);
     call->getLocalSDP()->setLocalPublishedAudioPort(callLocalExternAudioPort);
 }
-
-std::string fetchHeaderValue(pjsip_msg *msg, const std::string &field)
-{
-    pj_str_t name = pj_str((char*) field.c_str());
-
-    pjsip_generic_string_hdr *hdr = static_cast<pjsip_generic_string_hdr*>(pjsip_msg_find_hdr_by_name(msg, &name, NULL));
-
-    if (!hdr)
-        return "";
-
-    std::string value(hdr->hvalue.ptr, hdr->hvalue.slen);
-
-    size_t pos = value.find("\n");
-
-    if (pos != std::string::npos)
-        return value.substr(0, pos);
-    else
-        return "";
-}
 } // end anonymous namespace
 
 std::vector<std::string> SIPVoIPLink::getAllIpInterfaceByName()