diff --git a/sflphone-client-gnome/pixmaps/Makefile.am b/sflphone-client-gnome/pixmaps/Makefile.am
index 19b166b39662b2acca08edf04b288487321d5a47..ee8fcf97c525a23827e41726a12ebd2bd6be4534 100644
--- a/sflphone-client-gnome/pixmaps/Makefile.am
+++ b/sflphone-client-gnome/pixmaps/Makefile.am
@@ -26,6 +26,7 @@ buttons_DATA = current.svg \
 				sflphone.svg \
 				sflphone_small.svg \
 				sflphone_notif.svg \
+				sflphone_offline.svg \
 				stock_person.svg \
 				icon_rec.svg \
 				rec_call.svg \
diff --git a/sflphone-client-gnome/pixmaps/sflphone_offline.svg b/sflphone-client-gnome/pixmaps/sflphone_offline.svg
new file mode 100644
index 0000000000000000000000000000000000000000..6cff90be09b24776d8cab50f5508796c0befd08a
--- /dev/null
+++ b/sflphone-client-gnome/pixmaps/sflphone_offline.svg
@@ -0,0 +1,415 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="120"
+   height="120"
+   id="svg5875"
+   sodipodi:version="0.32"
+   inkscape:version="0.47pre4 r22446"
+   version="1.0"
+   sodipodi:docname="sflphone_offline.svg"
+   inkscape:output_extension="org.inkscape.output.svg.inkscape">
+  <defs
+     id="defs5877">
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient3803">
+      <stop
+         style="stop-color:#ffffff;stop-opacity:1;"
+         offset="0"
+         id="stop3805" />
+      <stop
+         style="stop-color:#ffffff;stop-opacity:0;"
+         offset="1"
+         id="stop3807" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient4684">
+      <stop
+         style="stop-color:#ffffff;stop-opacity:1;"
+         offset="0"
+         id="stop4686" />
+      <stop
+         style="stop-color:#ffffff;stop-opacity:0;"
+         offset="1"
+         id="stop4688" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient4669">
+      <stop
+         style="stop-color:#ffffff;stop-opacity:1;"
+         offset="0"
+         id="stop4671" />
+      <stop
+         style="stop-color:#ffffff;stop-opacity:0;"
+         offset="1"
+         id="stop4673" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient3859">
+      <stop
+         style="stop-color:#ffffff;stop-opacity:1;"
+         offset="0"
+         id="stop3861" />
+      <stop
+         style="stop-color:#ffffff;stop-opacity:0;"
+         offset="1"
+         id="stop3863" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient5850">
+      <stop
+         style="stop-color:#ffffff;stop-opacity:1;"
+         offset="0"
+         id="stop5852" />
+      <stop
+         style="stop-color:#ffffff;stop-opacity:0;"
+         offset="1"
+         id="stop5854" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient5850"
+       id="linearGradient5856"
+       x1="476.3125"
+       y1="439.0293"
+       x2="477.3125"
+       y2="514.42188"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient4999">
+      <stop
+         style="stop-color:#ffffff;stop-opacity:1;"
+         offset="0"
+         id="stop5001" />
+      <stop
+         style="stop-color:#ffffff;stop-opacity:0;"
+         offset="1"
+         id="stop5003" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4999"
+       id="linearGradient5862"
+       gradientUnits="userSpaceOnUse"
+       x1="698.38525"
+       y1="245.5472"
+       x2="702.81964"
+       y2="977.78302" />
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient4991">
+      <stop
+         style="stop-color:#ffffff;stop-opacity:1;"
+         offset="0"
+         id="stop4993" />
+      <stop
+         style="stop-color:#ffffff;stop-opacity:0;"
+         offset="1"
+         id="stop4995" />
+    </linearGradient>
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4991"
+       id="radialGradient4997"
+       cx="736.5"
+       cy="640.93073"
+       fx="736.5"
+       fy="640.93073"
+       r="91.964203"
+       gradientTransform="matrix(1,0,0,0.8097086,0,99.14184)"
+       gradientUnits="userSpaceOnUse" />
+    <inkscape:perspective
+       sodipodi:type="inkscape:persp3d"
+       inkscape:vp_x="0 : 526.18109 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_z="744.09448 : 526.18109 : 1"
+       inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+       id="perspective5883" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3859"
+       id="linearGradient3873"
+       x1="352.19498"
+       y1="451.55289"
+       x2="106.34038"
+       y2="658.39594"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="translate(-3.8268196,-1.7394634)" />
+    <inkscape:perspective
+       id="perspective2422"
+       inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+       inkscape:vp_z="744.09448 : 526.18109 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_x="0 : 526.18109 : 1"
+       sodipodi:type="inkscape:persp3d" />
+    <inkscape:perspective
+       id="perspective2437"
+       inkscape:persp3d-origin="168.5 : 109.33333 : 1"
+       inkscape:vp_z="337 : 164 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_x="0 : 164 : 1"
+       sodipodi:type="inkscape:persp3d" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4669"
+       id="linearGradient4675"
+       x1="-20.657925"
+       y1="-244.41351"
+       x2="184.57913"
+       y2="789.61469"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="pad" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4684"
+       id="linearGradient4690"
+       x1="52.987782"
+       y1="-84.148399"
+       x2="127.02813"
+       y2="99.500687"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4669"
+       id="linearGradient5149"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="pad"
+       x1="-20.657925"
+       y1="-244.41351"
+       x2="184.57913"
+       y2="789.61469" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4991"
+       id="radialGradient5297"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1,0,0,0.8097086,0,99.14184)"
+       cx="736.5"
+       cy="640.93073"
+       fx="736.5"
+       fy="640.93073"
+       r="91.964203" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4999"
+       id="linearGradient5299"
+       gradientUnits="userSpaceOnUse"
+       x1="698.38525"
+       y1="245.5472"
+       x2="702.81964"
+       y2="977.78302" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4684"
+       id="linearGradient5301"
+       gradientUnits="userSpaceOnUse"
+       x1="52.987782"
+       y1="-84.148399"
+       x2="127.02813"
+       y2="99.500687" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4684"
+       id="linearGradient5308"
+       gradientUnits="userSpaceOnUse"
+       x1="52.987782"
+       y1="-84.148399"
+       x2="127.02813"
+       y2="99.500687"
+       gradientTransform="matrix(0.6453907,0,0,0.6453907,0.8651337,0.4352828)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3803"
+       id="linearGradient3809"
+       x1="12.663443"
+       y1="8.5301828"
+       x2="41.858654"
+       y2="57.533279"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.0054518,0,0,1.0054518,-4.7165106e-3,-0.4345682)" />
+    <inkscape:perspective
+       id="perspective2881"
+       inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+       inkscape:vp_z="1 : 0.5 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_x="0 : 0.5 : 1"
+       sodipodi:type="inkscape:persp3d" />
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     gridtolerance="10000"
+     guidetolerance="10"
+     objecttolerance="10"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="4.6527672"
+     inkscape:cx="71.125906"
+     inkscape:cy="59.641316"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer2"
+     showgrid="false"
+     inkscape:window-width="1910"
+     inkscape:window-height="1068"
+     inkscape:window-x="47"
+     inkscape:window-y="41"
+     showguides="true"
+     inkscape:guide-bbox="true"
+     inkscape:window-maximized="0" />
+  <metadata
+     id="metadata5880">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title>Icône SFL</dc:title>
+        <dc:date>2009-04-29</dc:date>
+        <dc:creator>
+          <cc:Agent>
+            <dc:title>Jérôme Oufella</dc:title>
+          </cc:Agent>
+        </dc:creator>
+        <dc:rights>
+          <cc:Agent>
+            <dc:title>(c) 2009 Savoir-faire Linux inc.</dc:title>
+          </cc:Agent>
+        </dc:rights>
+        <dc:subject>
+          <rdf:Bag>
+            <rdf:li>sfl icon</rdf:li>
+          </rdf:Bag>
+        </dc:subject>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Circle"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(-182.15973,-428.80763)"
+     style="display:inline">
+    <g
+       style="display:inline"
+       id="g5868"
+       transform="matrix(0.6453907,0,0,0.6453907,-86.103074,148.01517)">
+      <path
+         transform="matrix(0.9959566,0,0,1.2202117,1.6861043,-136.53125)"
+         d="m 602,544.5 c 0,41.6975 -41.41366,75.5 -92.5,75.5 -51.08634,0 -92.5,-33.8025 -92.5,-75.5 0,-41.6975 41.41366,-75.5 92.5,-75.5 51.08634,0 92.5,33.8025 92.5,75.5 z"
+         sodipodi:ry="75.5"
+         sodipodi:rx="92.5"
+         sodipodi:cy="544.5"
+         sodipodi:cx="509.5"
+         id="path4987"
+         style="fill:#00252b;fill-opacity:1;fill-rule:evenodd"
+         sodipodi:type="arc" />
+      <path
+         transform="matrix(0.9200853,0,0,1.1406537,-168.51683,-66.406557)"
+         d="m 827,521 c 0,40.31679 -40.51823,73 -90.5,73 -49.98177,0 -90.5,-32.68321 -90.5,-73 0,-40.31679 40.51823,-73 90.5,-73 49.98177,0 90.5,32.68321 90.5,73 z"
+         sodipodi:ry="73"
+         sodipodi:rx="90.5"
+         sodipodi:cy="521"
+         sodipodi:cx="736.5"
+         id="path4989"
+         style="opacity:0.83064515;fill:url(#radialGradient5297);fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient5299);stroke-width:2.92839932;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         sodipodi:type="arc" />
+    </g>
+  </g>
+  <g
+     inkscape:groupmode="layer"
+     id="layer3"
+     inkscape:label="Bg logo"
+     style="display:inline">
+    <path
+       style="opacity:1;fill:#006f82;fill-opacity:0;fill-rule:evenodd;stroke:#006f82;stroke-width:1.04566979;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline"
+       d="M 10.55114,62.033695 L 10.545872,59.631821 L 11.329656,63.53366 L 11.321088,59.630621 L 12.621458,63.431585 L 12.611584,58.928074 L 13.657722,64.630914 L 13.897019,55.923735 L 14.696183,66.831029 L 15.959008,53.518653 L 16.252311,69.430662 L 17.258279,56.819227 L 18.052818,65.624884 L 18.551844,57.51777 L 19.347918,67.023975 L 19.833546,52.812112 L 21.424823,71.42421 L 20.85641,47.906685 L 23.760575,76.024188 L 22.924102,48.103639 L 25.312097,76.522171 L 24.213925,47.100857 L 25.814204,69.816155 L 26.299177,55.304046 L 27.10579,69.613998 L 28.100546,51.898595 L 28.133486,66.910282 L 29.383802,47.893475 L 29.17479,70.411424 L 30.42269,50.293743 L 30.995926,76.012977 L 32.479618,45.586876 L 32.810259,78.51213 L 34.022583,42.181821 L 34.623699,80.610954 L 35.567529,39.677469 L 36.17744,82.1097 L 36.856708,38.374457 L 38.250165,84.608465 L 38.159277,43.176196 L 39.275226,80.703832 L 39.72003,47.877458 L 40.557601,76.298395 L 41.022589,52.6792 L 42.361163,73.89372 L 42.575221,53.677574 L 43.394126,73.59189 L 44.128072,54.776031 L 45.197477,71.087148 L 44.64642,55.475777 L 46.746157,70.284115 L 46.201462,57.575013 L 47.766387,64.177753 L 48.157374,33.559644 L 49.574786,63.974798 L 49.737044,29.057192 L 50.608848,64.173352 L 52.072146,33.362224 L 52.237957,82.20545 L 53.618404,31.455993 L 54.269604,83.80121 L 54.704307,28.546169 L 56.569731,89.992521 L 56.233651,27.84325 L 58.106058,92.475088 L 58.237615,25.734393 L 59.462018,94.871346 L 59.308802,25.029251 L 60.997751,97.080654 L 60.859237,25.026847 L 63.348005,99.381156 L 63.493128,47.740542 L 64.432585,95.86912 L 64.276032,51.242071 L 66.685102,98.180342 L 65.570911,52.541084 L 66.563781,98.275324 L 64.993727,25.020443 L 69.064999,96.16276 L 66.029984,26.219775 L 70.373503,94.756118 L 68.436272,27.318084 L 72.677618,93.850086 L 72.234352,27.4111 C 72.234352,27.4111 73.940422,98.363981 74.456142,97.862784 C 74.971847,97.361592 75.595153,28.106441 75.595153,28.106441 L 75.739811,94.046666 L 76.890923,29.805765 L 77.049624,93.24225 L 78.18426,30.404231 L 78.338812,91.945712 L 80.000344,33.704002 L 80.38199,89.886658 L 82.071758,35.602278 L 82.1985,84.464362 L 83.409266,38.505999 L 84.494194,70.81025 L 85.482229,41.108345 L 86.300623,69.703651 L 88.312822,44.609637 L 89.401506,78.617548 L 89.890557,48.126952 L 91.245045,76.60551 L 91.663323,49.515327 L 93.046215,73.100561 L 93.514555,51.012458 L 95.564594,69.900023 L 95.350428,54.413452 L 97.176303,71.094351 L 97.42119,56.012671 L 100.17281,68.095581 L 100.26537,56.803022 L 102.33474,68.598489 L 102.41415,58.300276 L 104.15368,64.27997 L 104.55185,54.777789 L 105.28904,66.085499 L 105.9731,60.189794 C 105.9731,60.189794 107.07326,63.772713 107.07216,63.272322 C 107.07105,62.771937 108.5787,61.082943 108.31828,60.182636 C 108.05791,59.282342 109.41561,62.475103 109.41561,62.475103"
+       id="path4922"
+       sodipodi:nodetypes="ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccscccccccccccccccccccccccccccccccccccc" />
+  </g>
+  <g
+     inkscape:groupmode="layer"
+     id="layer2"
+     inkscape:label="Handset"
+     style="display:inline">
+    <path
+       style="opacity:0.07000002;fill:url(#linearGradient5308);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:12.29699993;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline"
+       d="M 59.151985,7.5345809 C 30.967536,8.249433 8.3274641,31.354675 8.3274641,59.710388 C 8.3274641,68.222065 10.375495,76.246983 13.994802,83.347823 C 13.107834,79.536662 12.643515,75.568677 12.643515,71.488769 C 12.643515,42.682964 36.013519,19.292793 64.819322,19.292793 C 85.110516,19.292792 102.69706,30.904841 111.32779,47.831165 C 105.9454,24.743656 85.222311,7.5345809 60.503272,7.5345809 C 60.05318,7.5345809 59.599356,7.5232342 59.151985,7.5345809 z"
+       id="path4679" />
+    <path
+       id="path3760"
+       d="M 88.906874,94.063359 C 88.559935,94.977556 84.966023,98.376 83.289215,99.375481 L 81.43556,100.48037 L 73.808785,90.541207 L 66.182003,80.602053 L 67.494791,79.241241 C 68.779544,77.909476 72.634516,75.322497 73.887671,74.951128 C 74.431745,74.789888 75.528139,76.078361 81.782999,84.229651 C 85.777928,89.435809 88.983679,93.860981 88.906874,94.063359 z M 50.73329,44.477271 C 50.446627,45.232636 45.91138,49.09897 44.433331,49.848034 L 43.090474,50.528569 L 35.573545,40.555914 L 28.056608,30.583254 L 30.64475,28.448397 C 32.068233,27.274223 33.934924,26.023758 34.792949,25.669578 L 36.352996,25.025619 L 43.633459,34.513458 C 48.514886,40.874896 50.854403,44.158138 50.73329,44.477271 z M 80.086522,101.40574 C 80.038294,101.53261 79.197946,102.04305 78.219084,102.54005 C 70.526609,106.44583 58.163118,101.84815 46.523718,90.753346 C 42.403963,86.826338 33.905571,76.306559 30.548319,70.978095 C 24.069511,60.695264 21.022718,52.062253 21.112522,44.242002 C 21.168568,39.361513 22.770354,35.243539 25.642678,32.595536 L 26.627564,31.687563 L 34.18264,41.386253 L 41.737722,51.084944 L 41.126672,52.143343 C 40.282652,53.605243 40.435321,55.522605 41.628037,58.4399 C 43.124949,62.101227 55.001116,77.570343 58.187294,80.008903 C 60.691108,81.925211 62.231437,82.484651 64.082727,82.150099 L 65.393673,81.913192 L 72.783941,91.544137 C 76.848589,96.841159 80.134755,101.27887 80.086522,101.40574 z"
+       style="opacity:0.32000002;fill:#000000;fill-opacity:1" />
+    <path
+       style="fill:#dfdfdf;fill-opacity:1"
+       d="M 92.518066,90.452167 C 92.171127,91.366364 88.577215,94.764808 86.900407,95.764289 L 85.046752,96.869181 L 77.419976,86.930015 L 69.793194,76.990861 L 71.105983,75.63005 C 72.390736,74.298285 76.245707,71.711305 77.498862,71.339937 C 78.042936,71.178697 79.13933,72.46717 85.394191,80.61846 C 89.389119,85.824618 92.59487,90.24979 92.518066,90.452167 z M 54.344481,40.86608 C 54.057819,41.621444 49.522571,45.487778 48.044523,46.236842 L 46.701666,46.917377 L 39.184735,36.944723 L 31.6678,26.972063 L 34.255941,24.837205 C 35.679425,23.663032 37.546115,22.412566 38.404141,22.058387 L 39.964188,21.414427 L 47.24465,30.902267 C 52.126078,37.263706 54.465594,40.546946 54.344481,40.86608 z M 83.697713,97.79455 C 83.649486,97.921417 82.809137,98.431852 81.830276,98.928861 C 74.137801,102.83464 61.774308,98.236957 50.134909,87.142154 C 46.015154,83.215146 37.516762,72.695367 34.159511,67.366904 C 27.680702,57.084073 24.63391,48.451062 24.723714,40.63081 C 24.77976,35.750321 26.381546,31.632348 29.253869,28.984346 L 30.238755,28.076371 L 37.793832,37.775063 L 45.348913,47.473754 L 44.737863,48.532152 C 43.893844,49.994052 44.046513,51.911414 45.239229,54.828709 C 46.73614,58.490035 58.612307,73.959152 61.798485,76.397711 C 64.3023,78.31402 65.842629,78.87346 67.693918,78.538907 L 69.004865,78.302 L 76.395132,87.932945 C 80.459781,93.229968 83.745947,97.667682 83.697713,97.79455 z"
+       id="path3218" />
+    <g
+       transform="matrix(0.6018652,0,0,0.6018652,-106.46243,-252.67476)"
+       id="g3787"
+       style="fill:#ffffff;fill-opacity:0">
+      <path
+         id="path3789"
+         d="M 324.6064,576.10592 C 324.02996,577.62486 318.05867,583.27138 315.27265,584.93202 L 312.1928,586.7678 L 299.5209,570.25386 L 286.84899,553.73994 L 289.03019,551.47895 C 291.16481,549.26622 297.56985,544.96795 299.65197,544.35092 C 300.55595,544.08302 302.37761,546.22382 312.77007,559.7672 C 319.40765,568.41724 324.73401,575.76967 324.6064,576.10592 z M 261.18093,493.71856 C 260.70464,494.9736 253.16932,501.39752 250.71354,502.64209 L 248.48238,503.7728 L 235.99299,487.20322 L 223.50359,470.63363 L 227.80379,467.08656 C 230.16891,465.13567 233.27042,463.05802 234.69603,462.46955 L 237.28805,461.39961 L 249.38455,477.16367 C 257.49505,487.73321 261.38216,493.18832 261.18093,493.71856 z M 309.95137,588.3053 C 309.87124,588.51609 308.475,589.36418 306.84862,590.18996 C 294.06756,596.67941 273.5256,589.04036 254.18672,570.60633 C 247.34174,564.0816 233.22165,546.60297 227.64357,537.74972 C 216.87902,520.66478 211.81677,506.32102 211.96598,493.32766 C 212.0591,485.21872 214.72047,478.3767 219.49284,473.97704 L 221.12923,472.46844 L 233.682,488.58283 L 246.23478,504.69722 L 245.21952,506.45575 C 243.81718,508.8847 244.07084,512.0704 246.05254,516.91749 C 248.53966,523.00079 268.27193,548.70275 273.56577,552.75442 C 277.72586,555.93837 280.28512,556.86788 283.36104,556.31202 L 285.53918,555.9184 L 297.81812,571.92023 C 304.57154,580.72124 310.03151,588.09451 309.95137,588.3053 z"
+         style="opacity:0.32000002;fill:#ffffff;fill-opacity:0" />
+      <path
+         style="fill:#ffffff;fill-opacity:0"
+         d="M 330.6064,570.10592 C 330.02996,571.62486 324.05867,577.27138 321.27265,578.93202 L 318.1928,580.7678 L 305.5209,564.25386 L 292.84899,547.73994 L 295.03019,545.47895 C 297.16481,543.26622 303.56985,538.96795 305.65197,538.35092 C 306.55595,538.08302 308.37761,540.22382 318.77007,553.7672 C 325.40765,562.41724 330.73401,569.76967 330.6064,570.10592 z M 267.18093,487.71856 C 266.70464,488.9736 259.16932,495.39752 256.71354,496.64209 L 254.48238,497.7728 L 241.99299,481.20322 L 229.50359,464.63363 L 233.80379,461.08656 C 236.16891,459.13567 239.27042,457.05802 240.69603,456.46955 L 243.28805,455.39961 L 255.38455,471.16367 C 263.49505,481.73321 267.38216,487.18832 267.18093,487.71856 z M 315.95137,582.3053 C 315.87124,582.51609 314.475,583.36418 312.84862,584.18996 C 300.06756,590.67941 279.5256,583.04036 260.18672,564.60633 C 253.34174,558.0816 239.22165,540.60297 233.64357,531.74972 C 222.87902,514.66478 217.81677,500.32102 217.96598,487.32766 C 218.0591,479.21872 220.72047,472.3767 225.49284,467.97704 L 227.12923,466.46844 L 239.682,482.58283 L 252.23478,498.69722 L 251.21952,500.45575 C 249.81718,502.8847 250.07084,506.0704 252.05254,510.91749 C 254.53966,517.00079 274.27193,542.70275 279.56577,546.75442 C 283.72586,549.93837 286.28512,550.86788 289.36104,550.31202 L 291.53918,549.9184 L 303.81812,565.92023 C 310.57154,574.72124 316.03151,582.09451 315.95137,582.3053 z"
+         id="path3791" />
+    </g>
+    <path
+       style="fill:url(#linearGradient3809);fill-opacity:1;stroke:none"
+       d="M 39.961991,21.402587 L 38.390972,22.062415 C 37.532947,22.416594 35.666967,23.653234 34.243484,24.827407 L 31.667014,26.963992 L 39.176482,36.955669 L 43.166868,42.23429 C 44.833493,39.007648 46.844812,36.037923 49.105318,33.342326 C 48.501731,32.545758 47.962788,31.818462 47.251516,30.891538 L 39.961991,21.402587 z M 30.253097,28.063705 L 29.247645,28.974895 C 26.375322,31.622897 24.779157,35.751365 24.723113,40.631852 C 24.633309,48.452104 27.670415,57.087755 34.149223,67.370584 C 35.036506,68.778836 36.301396,70.544757 37.731145,72.460684 C 37.518951,70.51226 37.385521,68.535071 37.385521,66.522234 C 37.385521,58.29228 39.192461,50.526372 42.412779,43.742468 L 37.793985,37.772598 L 30.253097,28.063705 z"
+       id="path3798" />
+    <g
+       id="g3398"
+       transform="matrix(7.5387238,0,0,7.5387238,1.1454138,0.16950363)">
+      <rect
+         ry="0.82081318"
+         rx="0.82081318"
+         inkscape:r_cy="true"
+         inkscape:r_cx="true"
+         y="8.6409912"
+         x="8.1562767"
+         height="7.0576959"
+         width="7.4291534"
+         id="rect1686"
+         style="color:#000000;fill:#a40000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.37145764;marker:none;visibility:visible;display:inline;overflow:visible" />
+      <g
+         inkscape:r_cy="true"
+         inkscape:r_cx="true"
+         transform="matrix(0.4225522,0,0,0.4225522,6.497738,-3.4645944)"
+         id="g2254">
+        <path
+           style="color:#000000;fill:none;stroke:#ffffff;stroke-width:2.56729817;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible"
+           d="M 8,32 18,42"
+           id="path1377"
+           inkscape:r_cx="true"
+           inkscape:r_cy="true" />
+        <path
+           inkscape:r_cy="true"
+           inkscape:r_cx="true"
+           id="path2252"
+           d="M 18,32 8,42"
+           style="color:#000000;fill:none;stroke:#ffffff;stroke-width:2.56729817;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" />
+      </g>
+    </g>
+  </g>
+</svg>
diff --git a/sflphone-client-gnome/src/actions.c b/sflphone-client-gnome/src/actions.c
index 829160960eb63eee6a1e402b69486882ec54012b..28db999a2deeda2e6d1066634148b465b2d4443e 100644
--- a/sflphone-client-gnome/src/actions.c
+++ b/sflphone-client-gnome/src/actions.c
@@ -94,6 +94,7 @@ status_bar_display_account ()
 
     acc = account_list_get_current ();
     if(acc){
+	status_tray_icon_online(TRUE);
         msg = g_markup_printf_escaped("%s %s (%s)" ,
                 _("Using account"),
                 (gchar*)g_hash_table_lookup( acc->properties , ACCOUNT_ALIAS),
@@ -101,6 +102,7 @@ status_bar_display_account ()
     }
     else
     {
+	status_tray_icon_online(FALSE);
         msg = g_markup_printf_escaped(_("No registered accounts"));
     }
     statusbar_push_message( msg , __MSG_ACCOUNT_DEFAULT);
diff --git a/sflphone-client-gnome/src/sflphone_const.h b/sflphone-client-gnome/src/sflphone_const.h
index d76373fd71bba4c63cd2d8b69fbcbe3d8df2e9b7..b63a3e17e17b6dd1d1515266277215bf7c09bac4 100644
--- a/sflphone-client-gnome/src/sflphone_const.h
+++ b/sflphone-client-gnome/src/sflphone_const.h
@@ -29,7 +29,8 @@
  */
 
 #define LOGO                ICONS_DIR "/sflphone.svg"
-#define LOGO_NOTIF			ICONS_DIR "/sflphone_notif.svg"
+#define LOGO_NOTIF          ICONS_DIR "/sflphone_notif.svg"
+#define LOGO_OFFLINE        ICONS_DIR "/sflphone_offline.svg"
 #define LOGO_SMALL          ICONS_DIR "/sflphone_small.svg"
 
 #define CURRENT_CALLS       "current_calls"
diff --git a/sflphone-client-gnome/src/statusicon.c b/sflphone-client-gnome/src/statusicon.c
index 99b8dcc2c6ccec24d66d924fe44b11a4cea5adcd..47e9d4a855517764dc2380834bc76d20ff3f1489 100644
--- a/sflphone-client-gnome/src/statusicon.c
+++ b/sflphone-client-gnome/src/statusicon.c
@@ -138,9 +138,12 @@ void status_tray_icon_blink (gboolean active)
 {
 	// Set a different icon to notify of an event
 	active ? gtk_status_icon_set_from_file (status, LOGO_NOTIF) : gtk_status_icon_set_from_file (status, LOGO);
-	// Do not blink anymore ...
-	// gtk_status_icon_set_blinking (status, active);
+}
 
+void status_tray_icon_online (gboolean online)
+{
+	// Set a different icon to notify of an event
+	online ? gtk_status_icon_set_from_file (status, LOGO) : gtk_status_icon_set_from_file (status, LOGO_OFFLINE);
 }
 
 GtkStatusIcon* 
diff --git a/sflphone-common/configure.ac b/sflphone-common/configure.ac
index 8ea46baa20c58530f23655ea5e79219ee206178f..e3c869ac137efc92d95629e957910492f57c93b6 100644
--- a/sflphone-common/configure.ac
+++ b/sflphone-common/configure.ac
@@ -1,5 +1,6 @@
 dnl SFLPhone - configure.ac for automake 1.9 and autoconf 2.59
 dnl
+
 	dnl Process this file with autoconf to produce a configure script.
 	AC_PREREQ(2.59)
 	AC_INIT([sflphone],[0.9.7~beta],[sflphoneteam@savoirfairelinux.com],[sflphone])
@@ -8,14 +9,17 @@ AC_REVISION([$Revision$])
 
 	AC_CANONICAL_SYSTEM
 
-	AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
+	PACKAGE=SFLphone
+	VERSION=`cat VERSION`
+
+	AM_INIT_AUTOMAKE($NAME, $VERSION)
 AM_CONFIG_HEADER([config.h])
 
 # Silent build by default. Use make V=1 to increase verbosity
 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
 
 	dnl Use this variable in the program
-AC_SUBST(PACKAGE_VERSION)
+	AC_SUBST(PACKAGE_VERSION)
 
 	AM_PROG_LIBTOOL
 
@@ -378,6 +382,15 @@ AC_ARG_WITH([iax2],
 AC_DEFINE([HAVE_IAX], test "x$with_iax2" = "xyes", [Define if you have libiax2])
 AM_CONDITIONAL(USE_IAX, test "x$with_iax2" = "xyes" )
 
+	dnl Check for network-manager
+AC_ARG_WITH([networkmanager],
+		[AS_HELP_STRING([--without-networkmanager],
+			[disable support for network-manager events])],
+		[],
+		[with_networkmanager=yes])
+
+AM_CONDITIONAL(USE_NETWORKMANAGER, test "x$with_networkmanager" = "xyes" )
+
 # check for doxygen, mostly stolen from http://log4cpp.sourceforge.net/
 # ----------------------------------------------------------------------------
 AC_DEFUN([BB_ENABLE_DOXYGEN],
diff --git a/sflphone-common/globals.mak b/sflphone-common/globals.mak
index b1bc9a5c11b88bb2d152e862d90c89dba4e5a6d8..bcbb63eb257e6d4e7aaac61e40ba22f8639f5592 100644
--- a/sflphone-common/globals.mak
+++ b/sflphone-common/globals.mak
@@ -61,6 +61,5 @@ AM_CPPFLAGS = \
 	-DCODECS_DIR=\""$(sflcodecdir)"\" \
 	-DPLUGINS_DIR=\""$(sflplugindir)"\" \
 	-DENABLE_TRACE \
-	-DSFLDEBUG \
          $(SPEEXCODEC) \
          $(GSMCODEC)
diff --git a/sflphone-common/src/Makefile.am b/sflphone-common/src/Makefile.am
index faf3560fa0ba95a74db3b27735edf5283ed8f5a3..0d2b2da9cc12f78d4bf4898061de9359e26a5da6 100644
--- a/sflphone-common/src/Makefile.am
+++ b/sflphone-common/src/Makefile.am
@@ -11,11 +11,13 @@ sflphoned_SOURCES = \
 		voiplink.cpp \
 		main.cpp \
 		managerimpl.cpp \
+		managerimpl_registration.cpp \
 		observer.cpp \
 		eventthread.cpp \
 		accountcreator.cpp \
 		call.cpp \
 		account.cpp \
+		logger.cpp \
 		numbercleaner.cpp 
 
 # Redefine the USE_IAX variable here, so that it could be used in managerimpl
@@ -27,8 +29,15 @@ IAX_CXXFLAG=
 IAX_LIB=
 endif
 
+if USE_NETWORKMANAGER
+NETWORKMANAGER=-DUSE_NETWORKMANAGER
+else
+NETWORKMANAGER=
+endif
+
 sflphoned_CXXFLAGS = \
-		-DPREFIX=\"$(prefix)\" -DPROGSHAREDIR=\"${datadir}/sflphone\" $(IAX_CXXFLAG)\
+		-DPREFIX=\"$(prefix)\" -DPROGSHAREDIR=\"${datadir}/sflphone\" $(IAX_CXXFLAG) $(NETWORKMANAGER) \
+		-DVERSION=\"$(VERSION)\" \
 		@ZRTPCPP_CFLAGS@ \
 		@libssl_CFLAGS@
 
@@ -63,6 +72,7 @@ noinst_HEADERS = \
 		account.h \
 		accountcreator.h \
 		call.h \
+		logger.h \
 		numbercleaner.h
 
 libsflphone_la_LIBADD = \
diff --git a/sflphone-common/src/account.cpp b/sflphone-common/src/account.cpp
index f5b542f57f34a97b02a1133a674aaa2c1b94bac6..e916ac6875c8c3ce94d1b949fcbd91b4c277e900 100644
--- a/sflphone-common/src/account.cpp
+++ b/sflphone-common/src/account.cpp
@@ -56,7 +56,7 @@ void Account::setRegistrationState (RegistrationState state)
 {
 
     if (state != _registrationState) {
-        _debug ("Account::setRegistrationState\n");
+        _debug ("Account::setRegistrationState");
         _registrationState = state;
 
         // Notify the client
diff --git a/sflphone-common/src/audio/alsa/alsalayer.cpp b/sflphone-common/src/audio/alsa/alsalayer.cpp
index bdbc27ed2d8964c1522d7ca58820f0b5cda6065c..920ab666b3be0e2e0824f8130dc4943e722b0542 100644
--- a/sflphone-common/src/audio/alsa/alsalayer.cpp
+++ b/sflphone-common/src/audio/alsa/alsalayer.cpp
@@ -41,7 +41,7 @@ AlsaLayer::AlsaLayer (ManagerImpl* manager)
         , _audioThread (NULL)
 
 {
-    _debug (" Constructor of AlsaLayer called\n");
+    _debug (" Constructor of AlsaLayer called");
     /* Instanciate the audio thread */
     // _audioThread = new AudioThread (this);
     // _audioThread = NULL;
@@ -53,7 +53,7 @@ AlsaLayer::AlsaLayer (ManagerImpl* manager)
 // Destructor
 AlsaLayer::~AlsaLayer (void)
 {
-    _debug ("Destructor of AlsaLayer called\n");
+    _debug ("Destructor of AlsaLayer called");
     closeLayer();
 
     if (_converter) {
@@ -70,17 +70,17 @@ AlsaLayer::~AlsaLayer (void)
 bool
 AlsaLayer::closeLayer()
 {
-    _debugAlsa ("Close ALSA streams\n");
+    _debugAlsa ("Close ALSA streams");
 
     try {
         /* Stop the audio thread first */
         if (_audioThread) {
-            _debug ("Stop Audio Thread\n");
+            _debug ("Stop Audio Thread");
             delete _audioThread;
             _audioThread=NULL;
         }
     } catch (...) {
-        _debugException ("! ARTP Exception: when stopping audiortp\n");
+        _debugException ("! ARTP Exception: when stopping audiortp");
         throw;
     }
 
@@ -119,13 +119,13 @@ AlsaLayer::openDevice (int indexIn, int indexOut, int sampleRate, int frameSize,
 
     _audioPlugin = std::string (plugin);
 
-    _debugAlsa (" Setting AlsaLayer: device     in=%2d, out=%2d\n", _indexIn, _indexOut);
+    _debugAlsa (" Setting AlsaLayer: device     in=%2d, out=%2d", _indexIn, _indexOut);
 
-    _debugAlsa ("                   : alsa plugin=%s\n", _audioPlugin.c_str());
+    _debugAlsa ("                   : alsa plugin=%s", _audioPlugin.c_str());
 
-    _debugAlsa ("                   : nb channel in=%2d, out=%2d\n", _inChannel, _outChannel);
+    _debugAlsa ("                   : nb channel in=%2d, out=%2d", _inChannel, _outChannel);
 
-    _debugAlsa ("                   : sample rate=%5d, format=%s\n", _audioSampleRate, SFLDataFormatString);
+    _debugAlsa ("                   : sample rate=%5d, format=%s", _audioSampleRate, SFLDataFormatString);
 
     _audioThread = NULL;
 
@@ -144,7 +144,7 @@ AlsaLayer::openDevice (int indexIn, int indexOut, int sampleRate, int frameSize,
 void
 AlsaLayer::startStream (void)
 {
-    _debug ("AlsaLayer:: startStream\n");
+    _debug ("AlsaLayer:: startStream");
 
     std::string pcmp = buildDeviceTopo (_audioPlugin, _indexOut, 0);
     std::string pcmc = buildDeviceTopo (_audioPlugin, _indexIn, 0);
@@ -171,11 +171,11 @@ AlsaLayer::startStream (void)
 
     if (_audioThread == NULL) {
         try {
-            _debug ("Start Audio Thread\n");
+            _debug ("Start Audio Thread");
             _audioThread = new AudioThread (this);
             _audioThread->start();
         } catch (...) {
-            _debugException ("Fail to start audio thread\n");
+            _debugException ("Fail to start audio thread");
         }
     }
 
@@ -184,17 +184,17 @@ AlsaLayer::startStream (void)
 void
 AlsaLayer::stopStream (void)
 {
-    _debug ("AlsaLayer:: stopStream\n");
+    _debug ("AlsaLayer:: stopStream");
 
     try {
         /* Stop the audio thread first */
         if (_audioThread) {
-            _debug ("Stop Audio Thread\n");
+            _debug ("Stop Audio Thread");
             delete _audioThread;
             _audioThread=NULL;
         }
     } catch (...) {
-        _debugException ("! ARTP Exception: when stopping audiortp\n");
+        _debugException ("! ARTP Exception: when stopping audiortp");
         throw;
     }
 
@@ -228,10 +228,10 @@ void AlsaLayer::stopCaptureStream (void)
     int err;
 
     if (_CaptureHandle) {
-        _debug ("AlsaLayer:: stop Alsa capture\n");
+        _debug ("AlsaLayer:: stop Alsa capture");
 
         if ( (err = snd_pcm_drop (_CaptureHandle)) < 0)
-            _debug ("AlsaLayer:: Error stopping ALSA capture: %s\n", snd_strerror (err));
+            _debug ("AlsaLayer:: Error stopping ALSA capture: %s", snd_strerror (err));
         else
             stop_capture ();
 
@@ -246,10 +246,10 @@ void AlsaLayer::closeCaptureStream (void)
         stopCaptureStream ();
 
     if (is_capture_open()) {
-        _debug ("AlsaLayer:: close ALSA capture\n");
+        _debug ("AlsaLayer:: close ALSA capture");
 
         if ( (err = snd_pcm_close (_CaptureHandle)) < 0)
-            _debug ("Error closing ALSA capture: %s\n", snd_strerror (err));
+            _debug ("Error closing ALSA capture: %s", snd_strerror (err));
         else
             close_capture ();
     }
@@ -260,10 +260,10 @@ void AlsaLayer::startCaptureStream (void)
     int err;
 
     if (_CaptureHandle && !is_capture_running()) {
-        _debug ("AlsaLayer:: start ALSA capture\n");
+        _debug ("AlsaLayer:: start ALSA capture");
 
         if ( (err = snd_pcm_start (_CaptureHandle)) < 0)
-            _debug ("Error starting ALSA capture: %s\n",  snd_strerror (err));
+            _debug ("Error starting ALSA capture: %s",  snd_strerror (err));
         else
             start_capture();
     }
@@ -274,10 +274,10 @@ void AlsaLayer::prepareCaptureStream (void)
     int err;
 
     if (is_capture_open() && !is_capture_prepared()) {
-        _debug ("AlsaLayer:: prepare ALSA capture\n");
+        _debug ("AlsaLayer:: prepare ALSA capture");
 
         if ( (err = snd_pcm_prepare (_CaptureHandle)) < 0)
-            _debug ("Error preparing ALSA capture: %s\n", snd_strerror (err));
+            _debug ("Error preparing ALSA capture: %s", snd_strerror (err));
         else
             prepare_capture ();
     }
@@ -288,10 +288,10 @@ void AlsaLayer::stopPlaybackStream (void)
     int err;
 
     if (_PlaybackHandle && is_playback_running()) {
-        _debug ("AlsaLayer:: stop ALSA playback\n");
+        _debug ("AlsaLayer:: stop ALSA playback");
 
         if ( (err = snd_pcm_drop (_PlaybackHandle)) < 0)
-            _debug ("Error stopping ALSA playback: %s\n", snd_strerror (err));
+            _debug ("Error stopping ALSA playback: %s", snd_strerror (err));
         else
             stop_playback ();
     }
@@ -306,10 +306,10 @@ void AlsaLayer::closePlaybackStream (void)
         stopPlaybackStream ();
 
     if (is_playback_open()) {
-        _debug ("AlsaLayer:: close ALSA playback\n");
+        _debug ("AlsaLayer:: close ALSA playback");
 
         if ( (err = snd_pcm_close (_PlaybackHandle)) < 0)
-            _debug ("Error closing ALSA playback: %s\n", snd_strerror (err));
+            _debug ("Error closing ALSA playback: %s", snd_strerror (err));
         else
             close_playback ();
     }
@@ -320,10 +320,10 @@ void AlsaLayer::startPlaybackStream (void)
     int err;
 
     if (_PlaybackHandle && !is_playback_running()) {
-        _debug ("AlsaLayer:: start ALSA playback\n");
+        _debug ("AlsaLayer:: start ALSA playback");
 
         if ( (err = snd_pcm_start (_PlaybackHandle)) < 0)
-            _debug ("Error starting ALSA playback: %s\n", snd_strerror (err));
+            _debug ("Error starting ALSA playback: %s", snd_strerror (err));
         else
             start_playback();
     }
@@ -334,10 +334,10 @@ void AlsaLayer::preparePlaybackStream (void)
     int err;
 
     if (is_playback_open() && !is_playback_prepared()) {
-        _debug ("AlsaLayer:: prepare playback stream\n");
+        _debug ("AlsaLayer:: prepare playback stream");
 
         if ( (err = snd_pcm_prepare (_PlaybackHandle)) < 0)
-            _debug ("Error preparing the device: %s\n", snd_strerror (err));
+            _debug ("Error preparing the device: %s", snd_strerror (err));
         else
             prepare_playback ();
     }
@@ -350,9 +350,9 @@ void AlsaLayer::recoverPlaybackStream(int error)
     int err;
 
     if (is_playback_open() && is_playback_running()) {
-	_debug("AlsaLayer:: recover playback stream\n");
+	_debug("AlsaLayer:: recover playback stream");
 	if((err = snd_pcm_recover(_PlaybackHandle, error, 0)) < 0 )
-	    _debug("Error recovering the device: %s\n", snd_strerror(err));
+	    _debug("Error recovering the device: %s", snd_strerror(err));
     }
 }
 */
@@ -364,9 +364,9 @@ void AlsaLayer::recoverPlaybackStream(int error)
     int err;
 
     if (is_capture_open() && is_capture_running()) {
-	_debug("AlsaLayer:: recover capture stream\n");
+	_debug("AlsaLayer:: recover capture stream");
 	if((err = snd_pcm_recover(_PlaybackHandle, error, 0)) < 0 )
-	    _debug("Error recovering the device: %s\n", snd_strerror(err));
+	    _debug("Error recovering the device: %s", snd_strerror(err));
     }
 }
 */
@@ -392,12 +392,12 @@ bool AlsaLayer::alsa_set_params (snd_pcm_t *pcm_handle, int type, int rate)
     /* Full configuration space */
 
     if ( (err = snd_pcm_hw_params_any (pcm_handle, hwparams)) < 0) {
-        _debugAlsa (" Cannot initialize hardware parameter structure (%s)\n", snd_strerror (err));
+        _debugAlsa (" Cannot initialize hardware parameter structure (%s)", snd_strerror (err));
         return false;
     }
 
     if ( (err = snd_pcm_hw_params_set_access (pcm_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) {
-        _debugAlsa (" Cannot set access type (%s)\n", snd_strerror (err));
+        _debugAlsa (" Cannot set access type (%s)", snd_strerror (err));
         return false;
     }
 
@@ -405,7 +405,7 @@ bool AlsaLayer::alsa_set_params (snd_pcm_t *pcm_handle, int type, int rate)
     format = SND_PCM_FORMAT_S16_LE;
 
     if ( (err = snd_pcm_hw_params_set_format (pcm_handle, hwparams, (snd_pcm_format_t) format)) < 0) {
-        _debugAlsa (" Cannot set sample format (%s)\n", snd_strerror (err));
+        _debugAlsa (" Cannot set sample format (%s)", snd_strerror (err));
         return false;
     }
 
@@ -417,17 +417,17 @@ bool AlsaLayer::alsa_set_params (snd_pcm_t *pcm_handle, int type, int rate)
     exact_ivalue = rate;
 
     if ( (err = snd_pcm_hw_params_set_rate_near (pcm_handle, hwparams, &exact_ivalue, &dir) < 0)) {
-        _debugAlsa (" Cannot set sample rate (%s)\n", snd_strerror (err));
+        _debugAlsa (" Cannot set sample rate (%s)", snd_strerror (err));
         return false;
     }
 
     if (dir!= 0) {
-        _debugAlsa (" (%i) The choosen rate %d Hz is not supported by your hardware.\nUsing %d Hz instead.\n ",type ,rate, exact_ivalue);
+        _debugAlsa (" (%i) The choosen rate %d Hz is not supported by your hardware.Using %d Hz instead. ",type ,rate, exact_ivalue);
     }
 
     /* Set the number of channels */
     if ( (err = snd_pcm_hw_params_set_channels (pcm_handle, hwparams, 1)) < 0) {
-        _debugAlsa (" Cannot set channel count (%s)\n", snd_strerror (err));
+        _debugAlsa (" Cannot set channel count (%s)", snd_strerror (err));
         return false;
     }
 
@@ -437,12 +437,12 @@ bool AlsaLayer::alsa_set_params (snd_pcm_t *pcm_handle, int type, int rate)
     dir=0;
 
     if ( (err = snd_pcm_hw_params_set_period_size_near (pcm_handle, hwparams, &exact_lvalue , &dir)) < 0) {
-        _debugAlsa (" Cannot set period time (%s)\n", snd_strerror (err));
+        _debugAlsa (" Cannot set period time (%s)", snd_strerror (err));
         return false;
     }
 
     if (dir!=0) {
-        _debugAlsa ("(%i) The choosen period size %d bytes is not supported by your hardware.\nUsing %d instead.\n ", type, (int) periodsize, (int) exact_lvalue);
+        _debugAlsa ("(%i) The choosen period size %d bytes is not supported by your hardware.Using %d instead. ", type, (int) periodsize, (int) exact_lvalue);
     }
 
     periodsize = exact_lvalue;
@@ -453,12 +453,12 @@ bool AlsaLayer::alsa_set_params (snd_pcm_t *pcm_handle, int type, int rate)
     dir=0;
 
     if ( (err = snd_pcm_hw_params_set_periods_near (pcm_handle, hwparams, &exact_ivalue, &dir)) < 0) {
-        _debugAlsa (" Cannot set periods number (%s)\n", snd_strerror (err));
+        _debugAlsa (" Cannot set periods number (%s)", snd_strerror (err));
         return false;
     }
 
     if (dir!=0) {
-        _debugAlsa (" The choosen period number %i bytes is not supported by your hardware.\nUsing %i instead.\n ", periods, exact_ivalue);
+        _debugAlsa (" The choosen period number %i bytes is not supported by your hardware.Using %i instead. ", periods, exact_ivalue);
     }
 
     periods=exact_ivalue;
@@ -466,7 +466,7 @@ bool AlsaLayer::alsa_set_params (snd_pcm_t *pcm_handle, int type, int rate)
     /* Set the hw parameters */
 
     if ( (err = snd_pcm_hw_params (pcm_handle, hwparams)) < 0) {
-        _debugAlsa (" Cannot set hw parameters (%s)\n", snd_strerror (err));
+        _debugAlsa (" Cannot set hw parameters (%s)", snd_strerror (err));
         return false;
     }
 
@@ -479,12 +479,12 @@ bool AlsaLayer::alsa_set_params (snd_pcm_t *pcm_handle, int type, int rate)
     /* Set the start threshold */
 
     if ( (err = snd_pcm_sw_params_set_start_threshold (pcm_handle, swparams, 2700 /*periodsize*2*/)) < 0) {
-        _debugAlsa (" Cannot set start threshold (%s)\n", snd_strerror (err));
+        _debugAlsa (" Cannot set start threshold (%s)", snd_strerror (err));
         return false;
     }
 
     if ( (err = snd_pcm_sw_params (pcm_handle, swparams)) < 0) {
-        _debugAlsa (" Cannot set sw parameters (%s)\n", snd_strerror (err));
+        _debugAlsa (" Cannot set sw parameters (%s)", snd_strerror (err));
         return false;
     }
 
@@ -503,18 +503,18 @@ AlsaLayer::open_device (std::string pcm_p, std::string pcm_c, int flag)
 
     if (flag == SFL_PCM_BOTH || flag == SFL_PCM_PLAYBACK) {
 
-        _debug ("AlsaLayer:: open playback device\n");
+        _debug ("AlsaLayer:: open playback device");
         // if((err = snd_pcm_open(&_PlaybackHandle, pcm_p.c_str(),  SND_PCM_STREAM_PLAYBACK, 0 )) < 0){
 
         if ( (err = snd_pcm_open (&_PlaybackHandle, pcm_p.c_str(),  SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
-            _debugAlsa ("Error while opening playback device %s\n",  pcm_p.c_str());
+            _debugAlsa ("Error while opening playback device %s",  pcm_p.c_str());
             setErrorMessage (ALSA_PLAYBACK_DEVICE);
             close_playback ();
             return false;
         }
 
         if (!alsa_set_params (_PlaybackHandle, 1, getSampleRate())) {
-            _debug ("playback failed\n");
+            _debug ("playback failed");
             snd_pcm_close (_PlaybackHandle);
             close_playback ();
             return false;
@@ -525,17 +525,17 @@ AlsaLayer::open_device (std::string pcm_p, std::string pcm_c, int flag)
 
     if (flag == SFL_PCM_BOTH || flag == SFL_PCM_CAPTURE) {
 
-        _debug ("AlsaLayer:: open capture device\n");
+        _debug ("AlsaLayer:: open capture device");
 
         if ( (err = snd_pcm_open (&_CaptureHandle,  pcm_c.c_str(),  SND_PCM_STREAM_CAPTURE, 0)) < 0) {
-            _debugAlsa ("Error while opening capture device %s\n",  pcm_c.c_str());
+            _debugAlsa ("Error while opening capture device %s",  pcm_c.c_str());
             setErrorMessage (ALSA_CAPTURE_DEVICE);
             close_capture ();
             return false;
         }
 
         if (!alsa_set_params (_CaptureHandle, 0, 8000)) {
-            _debug ("capture failed\n");
+            _debug ("capture failed");
             snd_pcm_close (_CaptureHandle);
             close_capture ();
             return false;
@@ -551,7 +551,7 @@ AlsaLayer::open_device (std::string pcm_p, std::string pcm_c, int flag)
     try {
         _audioThread->start();
     } catch (...) {
-        _debugException ("Fail to start audio thread\n");
+        _debugException ("Fail to start audio thread");
     }
     */
 
@@ -579,18 +579,18 @@ AlsaLayer::write (void* buffer, int length)
             case -ESTRPIPE:
 
             case -EIO:
-                //_debugAlsa(" XRUN playback ignored (%s)\n", snd_strerror(err));
+                //_debugAlsa(" XRUN playback ignored (%s)", snd_strerror(err));
                 handle_xrun_playback();
 
                 if (snd_pcm_writei (_PlaybackHandle , buffer , frames) <0)
-                    _debugAlsa ("XRUN handling failed\n");
+                    _debugAlsa ("XRUN handling failed");
 
                 _trigger_request = true;
 
                 break;
 
             default:
-                _debugAlsa ("Write error unknown - dropping frames **********************************: %s\n", snd_strerror (err));
+                _debugAlsa ("Write error unknown - dropping frames **********************************: %s", snd_strerror (err));
 
                 stopPlaybackStream ();
 
@@ -623,20 +623,20 @@ AlsaLayer::read (void* buffer, int toCopy)
             case -ESTRPIPE:
 
             case -EIO:
-                _debugAlsa (" XRUN capture ignored (%s)\n", snd_strerror (samples));
+                _debugAlsa (" XRUN capture ignored (%s)", snd_strerror (samples));
                 handle_xrun_capture();
                 //samples = snd_pcm_readi( _CaptureHandle, buffer, frames);
                 //if (samples<0)  samples=0;
                 break;
 
             case EPERM:
-                _debugAlsa (" Capture EPERM (%s)\n", snd_strerror (samples));
+                _debugAlsa (" Capture EPERM (%s)", snd_strerror (samples));
                 prepareCaptureStream ();
                 startCaptureStream ();
                 break;
 
             default:
-                //_debugAlsa("%s\n", snd_strerror(samples));
+                //_debugAlsa("%s", snd_strerror(samples));
                 break;
         }
 
@@ -650,7 +650,7 @@ AlsaLayer::read (void* buffer, int toCopy)
 void
 AlsaLayer::handle_xrun_capture (void)
 {
-    _debugAlsa ("handle_xrun_capture\n");
+    _debugAlsa ("handle_xrun_capture");
 
     snd_pcm_status_t* status;
     snd_pcm_status_alloca (&status);
@@ -664,19 +664,19 @@ AlsaLayer::handle_xrun_capture (void)
             startCaptureStream ();
         }
     } else
-        _debugAlsa (" Get status failed\n");
+        _debugAlsa (" Get status failed");
 }
 
 void
 AlsaLayer::handle_xrun_playback (void)
 {
-    _debugAlsa ("AlsaLayer:: handle_xrun_playback\n");
+    _debugAlsa ("AlsaLayer:: handle_xrun_playback");
 
     int state;
     snd_pcm_status_t* status;
     snd_pcm_status_alloca (&status);
 
-    if ( (state = snd_pcm_status (_PlaybackHandle, status)) < 0)   _debugAlsa (" Error: Cannot get playback handle status (%s)\n" , snd_strerror (state));
+    if ( (state = snd_pcm_status (_PlaybackHandle, status)) < 0)   _debugAlsa (" Error: Cannot get playback handle status (%s)" , snd_strerror (state));
     else {
         state = snd_pcm_status_get_state (status);
 
@@ -743,9 +743,9 @@ AlsaLayer::getSoundCardsInfo (int stream)
                 snd_pcm_info_set_device (pcminfo , 0);
                 snd_pcm_info_set_stream (pcminfo, (stream == SFL_PCM_CAPTURE) ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK);
 
-                if (snd_ctl_pcm_info (handle ,pcminfo) < 0) _debugAlsa (" Cannot get info\n");
+                if (snd_ctl_pcm_info (handle ,pcminfo) < 0) _debugAlsa (" Cannot get info");
                 else {
-                    _debugAlsa ("card %i : %s [%s]\n",
+                    _debugAlsa ("card %i : %s [%s]",
                                 numCard,
                                 snd_ctl_card_info_get_id (info),
                                 snd_ctl_card_info_get_name (info));
@@ -825,7 +825,7 @@ void AlsaLayer::audioCallback (void)
 
     /*
     int writeableSize = snd_pcm_avail_update(_PlaybackHandle);
-    _debug("writeableSize %i\n", writeableSize);
+    _debug("writeableSize %i", writeableSize);
     */
 
     // AvailForGet tell the number of chars inside the buffer
@@ -970,7 +970,7 @@ void AlsaLayer::audioCallback (void)
     if (is_capture_running()) {
 
         micAvailBytes = snd_pcm_avail_update (_CaptureHandle);
-        // _debug("micAvailBytes %i\n", micAvailBytes);
+        // _debug("micAvailBytes %i", micAvailBytes);
 
         if (micAvailBytes > 0) {
             micAvailPut = getMainBuffer()->availForPut();
@@ -990,7 +990,7 @@ void AlsaLayer::audioCallback (void)
                     int nbSample = toPut / sizeof (SFLDataFormat);
                     int nb_sample_up = nbSample;
 
-                    // _debug("nb_sample_up %i\n", nb_sample_up);
+                    // _debug("nb_sample_up %i", nb_sample_up);
                     nbSample = _converter->downsampleData ( (SFLDataFormat*) in, rsmpl_out, _mainBufferSampleRate, _audioSampleRate, nb_sample_up);
 
                     dcblocker->filter_signal (rsmpl_out, nbSample);
@@ -1010,7 +1010,7 @@ void AlsaLayer::audioCallback (void)
 
             in=0;
         } else if (micAvailBytes < 0) {
-            _debug ("AlsaLayer::audioCallback (mic): error: %s\n", snd_strerror (micAvailBytes));
+            _debug ("AlsaLayer::audioCallback (mic): error: %s", snd_strerror (micAvailBytes));
         }
 
     }
diff --git a/sflphone-common/src/audio/audiolayer.cpp b/sflphone-common/src/audio/audiolayer.cpp
index ceabb38f1d5337fda2a6a0f8af1925df8711c4f9..e0a84d48481a1514b163a5824840f442517ffdbc 100644
--- a/sflphone-common/src/audio/audiolayer.cpp
+++ b/sflphone-common/src/audio/audiolayer.cpp
@@ -40,7 +40,7 @@ void AudioLayer::flushUrgent (void)
 
 int AudioLayer::putUrgent (void* buffer, int toCopy)
 {
-    // _debug ("------------------- AudioLayer::putUrgent --------------------\n");
+    _debug ("------------------- AudioLayer::putUrgent --------------------");
     int a;
 
     ost::MutexLock guard (_mutex);
@@ -65,7 +65,7 @@ int AudioLayer::putMain (void *buffer, int toCopy, CallID call_id)
     if (a >= toCopy) {
         return getMainBuffer()->putData (buffer, toCopy, _defaultVolume, call_id);
     } else {
-        _debug ("Chopping sound, Ouch! RingBuffer full ?\n");
+        _debug ("Chopping sound, Ouch! RingBuffer full ?");
         return getMainBuffer()->putData (buffer, a, _defaultVolume, call_id);
     }
 
diff --git a/sflphone-common/src/audio/audiortp.cpp b/sflphone-common/src/audio/audiortp.cpp
index 3887a21f63d18b7f8a5647526fa4efaadef3e942..26615888a789d5b863c2a3e9f284fca381e2b458 100644
--- a/sflphone-common/src/audio/audiortp.cpp
+++ b/sflphone-common/src/audio/audiortp.cpp
@@ -68,14 +68,14 @@ AudioRtp::createNewSession (SIPCall *ca)
 
     ost::MutexLock m (_rtpMutex);
 
-    _debug ("AudioRtp::Create new rtp session\n");
+    _debug ("AudioRtp::Create new rtp session");
 
     // something should stop the thread before...
 
     if (_RTXThread != 0) {
-        _debug ("**********************************************************\n");
-        _debug ("! ARTP Failure: Thread already exists..., stopping it\n");
-        _debug ("**********************************************************\n");
+        _debug ("**********************************************************");
+        _debug ("! ARTP Failure: Thread already exists..., stopping it");
+        _debug ("**********************************************************");
         delete _RTXThread;
         _RTXThread = 0;
     }
@@ -93,14 +93,14 @@ AudioRtp::start (void)
     ost::MutexLock m (_rtpMutex);
 
     if (_RTXThread == 0) {
-        _debug ("! ARTP Failure: Cannot start audiortp thread since not yet created\n");
+        _debug ("! ARTP Failure: Cannot start audiortp thread since not yet created");
         throw AudioRtpException();
     }
 
 
     try {
         if (_RTXThread->start() != 0) {
-            _debug ("! ARTP Failure: unable to start RTX Thread\n");
+            _debug ("! ARTP Failure: unable to start RTX Thread");
             return -1;
         }
     } catch (...) {
@@ -118,7 +118,7 @@ AudioRtp::closeRtpSession ()
 
     ost::MutexLock m (_rtpMutex);
     // This will make RTP threads finish.
-    _debug ("AudioRtp::Stopping rtp session\n");
+    _debug ("AudioRtp::Stopping rtp session");
 
     try {
         if (_RTXThread != 0) {
@@ -126,11 +126,11 @@ AudioRtp::closeRtpSession ()
             _RTXThread = 0;
         }
     } catch (...) {
-        _debugException ("! ARTP Exception: when stopping audiortp\n");
+        _debugException ("! ARTP Exception: when stopping audiortp");
         throw;
     }
 
-    _debug ("AudioRtp::Audio rtp stopped\n");
+    _debug ("AudioRtp::Audio rtp stopped");
 
     return true;
 }
@@ -140,7 +140,7 @@ void
 AudioRtp::setRecording()
 {
 
-    _debug ("AudioRtp::setRecording\n");
+    _debug ("AudioRtp::setRecording");
     _RTXThread->_ca->setRecording();
 
 }
@@ -161,7 +161,7 @@ AudioRtpRTX::AudioRtpRTX (SIPCall *sipcall, bool sym) : time (new ost::Time()),
     std::string localipConfig = _ca->getLocalIp(); // _ca->getLocalIp();
     ost::InetHostAddress local_ip (localipConfig.c_str());
 
-    _debug ("%i\n", _ca->getLocalAudioPort());
+    _debug ("%i", _ca->getLocalAudioPort());
     _session = new ost::SymmetricRTPSession (local_ip, _ca->getLocalAudioPort());
     // _session = new ost::RTPSessionBase(local_ip, _ca->getLocalAudioPort());
     _sessionRecv = NULL;
@@ -209,7 +209,7 @@ AudioRtpRTX::~AudioRtpRTX ()
 
     ost::MutexLock m (_rtpRtxMutex);
 
-    _debug ("Delete AudioRtpRTX instance in callid %s\n", _ca->getCallId().c_str());
+    _debug ("Delete AudioRtpRTX instance in callid %s", _ca->getCallId().c_str());
 
     try {
         this->terminate();
@@ -218,12 +218,12 @@ AudioRtpRTX::~AudioRtpRTX ()
         throw;
     }
 
-    _debug ("Remove audio stream for call id %s\n", _ca->getCallId().c_str());
+    _debug ("Remove audio stream for call id %s", _ca->getCallId().c_str());
 
     _audiolayer->getMainBuffer()->unBindAll (_ca->getCallId());
     // Manager::instance().removeStream(_ca->getCallId());
 
-    _debug ("DELETE print micData address %p\n", micData);
+    _debug ("DELETE print micData address %p", micData);
     delete [] micData;
     micData = NULL;
     delete [] micDataConverted;
@@ -248,7 +248,7 @@ AudioRtpRTX::~AudioRtpRTX ()
     delete _session;
     _session = NULL;
 
-    _debug ("AudioRtpRTX instance deleted\n");
+    _debug ("AudioRtpRTX instance deleted");
 
     rtp_input_rec->close();
     rtp_output_rec->close();
@@ -261,17 +261,17 @@ AudioRtpRTX::initBuffers()
 {
     ost::MutexLock m (_rtpRtxMutex);
 
-    _debug ("AudioRtpRTX::initBuffers Init RTP buffers for %s\n", _ca->getCallId().c_str());
+    _debug ("AudioRtpRTX::initBuffers Init RTP buffers for %s", _ca->getCallId().c_str());
 
     converter = new SamplerateConverter (_layerSampleRate , _layerFrameSize);
 
     nbSamplesMax = (int) (_layerSampleRate * _layerFrameSize /1000);
 
 
-    _debug ("AudioRtpRTX::initBuffers NBSAMPLEMAX %i\n", nbSamplesMax);
+    _debug ("AudioRtpRTX::initBuffers NBSAMPLEMAX %i", nbSamplesMax);
 
     micData = new SFLDataFormat[nbSamplesMax];
-    _debug ("CREATE print micData address %p\n", micData);
+    _debug ("CREATE print micData address %p", micData);
     micDataConverted = new SFLDataFormat[nbSamplesMax];
     micDataEncoded = new unsigned char[nbSamplesMax];
 
@@ -305,7 +305,7 @@ AudioRtpRTX::setRtpSessionMedia (void)
 {
 
     if (_ca == 0) {
-        _debug (" !ARTP: No call, can't init RTP media\n");
+        _debug (" !ARTP: No call, can't init RTP media");
         return;
     }
 
@@ -314,11 +314,11 @@ AudioRtpRTX::setRtpSessionMedia (void)
     _audiocodec = Manager::instance().getCodecDescriptorMap().instantiateCodec (pl);
 
     if (_audiocodec == NULL) {
-        _debug (" !ARTP: No audiocodec, can't init RTP media\n");
+        _debug (" !ARTP: No audiocodec, can't init RTP media");
         return;
     }
 
-    _debug ("Init audio RTP session: codec payload %i\n", _audiocodec->getPayload());
+    _debug ("Init audio RTP session: codec payload %i", _audiocodec->getPayload());
 
     // _audioCodecInstance = *_audiocodec;
 
@@ -344,34 +344,34 @@ AudioRtpRTX::setRtpSessionRemoteIp (void)
 
     if (!_remoteIpIsSet) {
 
-        _debug ("++++++++++++++++++++++++++ SET IP ADDRESS ++++++++++++++++++++++++++++\n");
+        _debug ("++++++++++++++++++++++++++ SET IP ADDRESS ++++++++++++++++++++++++++++");
 
         if (_ca == 0) {
-            _debug (" !ARTP: No call, can't init RTP media \n");
+            _debug (" !ARTP: No call, can't init RTP media ");
             return;
         }
 
         ost::InetHostAddress remote_ip (_ca->getLocalSDP()->get_remote_ip().c_str());
 
-        _debug ("Init audio RTP session: remote ip %s\n", _ca->getLocalSDP()->get_remote_ip().data());
+        _debug ("Init audio RTP session: remote ip %s", _ca->getLocalSDP()->get_remote_ip().data());
 
         if (!remote_ip) {
-            _debug (" !ARTP Thread Error: Target IP address [%s] is not correct!\n", _ca->getLocalSDP()->get_remote_ip().data());
+            _debug (" !ARTP Thread Error: Target IP address [%s] is not correct!", _ca->getLocalSDP()->get_remote_ip().data());
             return;
         }
 
-        _debug ("++++Address: %s, audioport: %d\n", _ca->getLocalSDP()->get_remote_ip().c_str(), _ca->getLocalSDP()->get_remote_audio_port());
+        _debug ("++++Address: %s, audioport: %d", _ca->getLocalSDP()->get_remote_ip().c_str(), _ca->getLocalSDP()->get_remote_audio_port());
 
-        _debug ("++++Audioport: %d\n", (int) _ca->getLocalSDP()->get_remote_audio_port());
+        _debug ("++++Audioport: %d", (int) _ca->getLocalSDP()->get_remote_audio_port());
 
         if (!_session->addDestination (remote_ip, (unsigned short) _ca->getLocalSDP()->get_remote_audio_port())) {
-            _debug (" !ARTP Thread Error: can't add destination to session!\n");
+            _debug (" !ARTP Thread Error: can't add destination to session!");
             return;
         }
 
         _remoteIpIsSet = true;
     } else {
-        _debug ("+++++++++++++++++++++++ IP ADDRESS ALREADY SET ++++++++++++++++++++++++\n");
+        _debug ("+++++++++++++++++++++++ IP ADDRESS ALREADY SET ++++++++++++++++++++++++");
     }
 
 }
@@ -404,23 +404,23 @@ AudioRtpRTX::processDataEncode()
     // available bytes inside ringbuffer
     int availBytesFromMic = _audiolayer->getMainBuffer()->availForGet (_ca->getCallId());
 
-    // _debug("AudioRtpRTX::processDataEncode() callid: %s availBytesFromMic %i\n", _ca->getCallId().c_str(), availBytesFromMic);
+    // _debug("AudioRtpRTX::processDataEncode() callid: %s availBytesFromMic %i", _ca->getCallId().c_str(), availBytesFromMic);
 
-    // _debug("AudioRtpRTX::processDataEncode: availBytesFromMic: %i\n", availBytesFromMic);
+    // _debug("AudioRtpRTX::processDataEncode: availBytesFromMic: %i", availBytesFromMic);
     // set available byte to maxByteToGet
     int bytesAvail = (availBytesFromMic < maxBytesToGet) ? availBytesFromMic : maxBytesToGet;
-    // _debug("bytesAvail %i\n", bytesAvail);
+    // _debug("bytesAvail %i", bytesAvail);
 
     if (bytesAvail == 0)
         return 0;
 
-    // _debug("AudioRtpRTX::processDataEncode: bytesAvail: %i\n", bytesAvail);
+    // _debug("AudioRtpRTX::processDataEncode: bytesAvail: %i", bytesAvail);
     // Get bytes from micRingBuffer to data_from_mic
     int nbSample = _audiolayer->getMainBuffer()->getData (micData , bytesAvail, 100, _ca->getCallId()) / sizeof (SFLDataFormat);
 
     rtp_output_rec->write ( (char*) micData, bytesAvail);
 
-    // _debug("AudioRtpRTX::processDataEncode: nbSample: %i\n", nbSample);
+    // _debug("AudioRtpRTX::processDataEncode: nbSample: %i", nbSample);
 
     // nb bytes to be sent over RTP
     int compSize = 0;
@@ -429,7 +429,7 @@ AudioRtpRTX::processDataEncode()
     if (_audiocodec->getClockRate() != _layerSampleRate) {
 
         int nb_sample_up = nbSample;
-        //_debug("_nbSample audiolayer->getMic(): %i \n", nbSample);
+        //_debug("_nbSample audiolayer->getMic(): %i ", nbSample);
 
         // Store the length of the mic buffer in samples for recording
         _nSamplesMic = nbSample;
@@ -514,18 +514,18 @@ AudioRtpRTX::sendSessionFromMic (int timestamp)
     // no call, so we do nothing
 
     if (_ca==0) {
-        _debug (" !ARTP: No call associated (mic)\n");
+        _debug (" !ARTP: No call associated (mic)");
         return;
     }
 
     // AudioLayer* audiolayer = Manager::instance().getAudioDriver();
     if (!_audiolayer) {
-        _debug (" !ARTP: No audiolayer available for MIC\n");
+        _debug (" !ARTP: No audiolayer available for MIC");
         return;
     }
 
     if (!_audiocodec) {
-        _debug (" !ARTP: No audiocodec available for MIC\n");
+        _debug (" !ARTP: No audiocodec available for MIC");
         return;
     }
 
@@ -534,7 +534,7 @@ AudioRtpRTX::sendSessionFromMic (int timestamp)
     int compSize = processDataEncode();
 
     // putData put the data on RTP queue, sendImmediate bypass this queue
-    // _debug("AudioRtpRTX::sendSessionFromMic: timestamp: %i, compsize: %i\n", timestamp, compSize);
+    // _debug("AudioRtpRTX::sendSessionFromMic: timestamp: %i, compsize: %i", timestamp, compSize);
 
     if ( (compSize != 0) && (micDataEncoded != NULL))
         _session->putData (timestamp, micDataEncoded, compSize);
@@ -554,12 +554,12 @@ AudioRtpRTX::receiveSessionForSpkr (int& countTime)
     }
 
     if (!_audiolayer) {
-        _debug (" !ARTP: No audiolayer available for SPEAKER\n");
+        _debug (" !ARTP: No audiolayer available for SPEAKER");
         return;
     }
 
     if (!_audiocodec) {
-        _debug (" !ARTP: No audiocodec available for SPEAKER\n");
+        _debug (" !ARTP: No audiocodec available for SPEAKER");
         return;
     }
 
@@ -638,12 +638,12 @@ AudioRtpRTX::run ()
 
     int timestamp = _session->getCurrentTimestamp(); // for mic
 
-    _debug ("- ARTP Action: Start call %s\n",_ca->getCallId().c_str());
+    _debug ("- ARTP Action: Start call %s",_ca->getCallId().c_str());
 
     while (!testCancel()) {
 
 
-        // _debug("Main while loop for call: %s\n", _ca->getCallId().c_str());
+        // _debug("Main while loop for call: %s", _ca->getCallId().c_str());
         // Send session
         sessionWaiting = _session->isWaiting();
 
@@ -676,7 +676,7 @@ AudioRtpRTX::run ()
     }
 
     // _audiolayer->stopStream();
-    _debug ("- ARTP Action: Stop call %s\n",_ca->getCallId().c_str());
+    _debug ("- ARTP Action: Stop call %s",_ca->getCallId().c_str());
 
 
 }
diff --git a/sflphone-common/src/audio/audiortp/AudioRtpFactory.cpp b/sflphone-common/src/audio/audiortp/AudioRtpFactory.cpp
index 6785f286e9710b79535442be38f9462dbd954203..bf9a9bf6c8c1da002985e772557db9f8f5852cba 100644
--- a/sflphone-common/src/audio/audiortp/AudioRtpFactory.cpp
+++ b/sflphone-common/src/audio/audiortp/AudioRtpFactory.cpp
@@ -60,7 +60,7 @@ void AudioRtpFactory::initAudioRtpSession (SIPCall * ca)
 
     if (_rtpSession != NULL) {
         _debugException ("An audio rtp thread was already created but not" \
-                         "destroyed. Forcing it before continuing.\n");
+                         "destroyed. Forcing it before continuing.");
         stop();
     }
 
@@ -75,16 +75,16 @@ void AudioRtpFactory::initAudioRtpSession (SIPCall * ca)
     if (accountId == AccountNULL) {
         srtpEnabled = Manager::instance().getConfigBool (IP2IP_PROFILE, SRTP_ENABLE);
         keyExchangeProtocol = Manager::instance().getConfigInt (IP2IP_PROFILE, SRTP_KEY_EXCHANGE);
-        _debug ("Ip-to-ip profile selected with key exchange protocol number %d\n", keyExchangeProtocol);
+        _debug ("Ip-to-ip profile selected with key exchange protocol number %d", keyExchangeProtocol);
         helloHashEnabled = Manager::instance().getConfigBool (IP2IP_PROFILE, ZRTP_HELLO_HASH);
     } else {
         srtpEnabled = Manager::instance().getConfigBool (accountId, SRTP_ENABLE);
         keyExchangeProtocol = Manager::instance().getConfigInt (accountId, SRTP_KEY_EXCHANGE);
-        _debug ("Registered account %s profile selected with key exchange protocol number %d\n", accountId.c_str(), keyExchangeProtocol);
+        _debug ("Registered account %s profile selected with key exchange protocol number %d", accountId.c_str(), keyExchangeProtocol);
         helloHashEnabled = Manager::instance().getConfigBool (accountId, ZRTP_HELLO_HASH);
     }
 
-    _debug ("Srtp enable: %d \n", srtpEnabled);
+    _debug ("Srtp enable: %d ", srtpEnabled);
 
     if (srtpEnabled) {
         std::string zidFilename (Manager::instance().getConfigString (SIGNALISATION, ZRTP_ZIDFILE));
@@ -99,7 +99,7 @@ void AudioRtpFactory::initAudioRtpSession (SIPCall * ca)
                     // TODO: be careful with that. The hello hash is computed asynchronously. Maybe it's
                     // not even available at that point.
                     ca->getLocalSDP()->set_zrtp_hash (static_cast<AudioZrtpSession *> (_rtpSession)->getHelloHash());
-                    _debug ("Zrtp hello hash fed to SDP\n");
+                    _debug ("Zrtp hello hash fed to SDP");
                 }
 
                 break;
@@ -112,7 +112,7 @@ void AudioRtpFactory::initAudioRtpSession (SIPCall * ca)
     } else {
         _rtpSessionType = Symmetric;
         _rtpSession = new AudioSymmetricRtpSession (&Manager::instance(), ca);
-        _debug ("Starting a symmetric unencrypted rtp session\n");
+        _debug ("Starting a symmetric unencrypted rtp session");
     }
 }
 
@@ -127,7 +127,7 @@ void AudioRtpFactory::start (void)
         case Sdes:
 
         case Symmetric:
-            _debug ("Starting symmetric rtp thread\n");
+            _debug ("Starting symmetric rtp thread");
 
             if (static_cast<AudioSymmetricRtpSession *> (_rtpSession)->startRtpThread() != 0) {
                 throw AudioRtpFactoryException ("Failed to start AudioSymmetricRtpSession thread");
@@ -148,7 +148,7 @@ void AudioRtpFactory::start (void)
 void AudioRtpFactory::stop (void)
 {
     ost::MutexLock mutex (_audioRtpThreadMutex);
-    _debug ("Stopping audio rtp session\n");
+    _debug ("Stopping audio rtp session");
 
     if (_rtpSession == NULL) {
         _debugException ("_rtpSession is null when trying to stop. Returning.");
@@ -171,7 +171,7 @@ void AudioRtpFactory::stop (void)
 
         _rtpSession = NULL;
     } catch (...) {
-        _debugException ("Exception caught when stopping the audio rtp session\n");
+        _debugException ("Exception caught when stopping the audio rtp session");
         throw AudioRtpFactoryException();
     }
 }
diff --git a/sflphone-common/src/audio/audiortp/AudioZrtpSession.cpp b/sflphone-common/src/audio/audiortp/AudioZrtpSession.cpp
index cec4dd3ff75d4d06e74bb157b4b54a4e0a971c60..cdd2a118214f2d23c1409b6797a2226fac74101e 100644
--- a/sflphone-common/src/audio/audiortp/AudioZrtpSession.cpp
+++ b/sflphone-common/src/audio/audiortp/AudioZrtpSession.cpp
@@ -36,7 +36,7 @@ AudioZrtpSession::AudioZrtpSession (ManagerImpl * manager, SIPCall * sipcall, co
         AudioRtpSession<AudioZrtpSession> (manager, sipcall),
         _zidFilename (zidFilename)
 {
-    _debug ("AudioZrtpSession initialized\n");
+    _debug ("AudioZrtpSession initialized");
     initializeZid();
     startZrtp();
 }
@@ -54,24 +54,24 @@ void AudioZrtpSession::initializeZid (void)
 
     std::string xdg_config = std::string (HOMEDIR) + DIR_SEPARATOR_STR + ".cache" + DIR_SEPARATOR_STR + PROGDIR + "/" + _zidFilename;
 
-    _debug ("    xdg_config %s\n", xdg_config.c_str());
+    _debug ("    xdg_config %s", xdg_config.c_str());
 
     if (XDG_CACHE_HOME != NULL) {
         std::string xdg_env = std::string (XDG_CACHE_HOME) + _zidFilename;
-        _debug ("    xdg_env %s\n", xdg_env.c_str());
+        _debug ("    xdg_env %s", xdg_env.c_str());
         (xdg_env.length() > 0) ? zidCompleteFilename = xdg_env : zidCompleteFilename = xdg_config;
     } else
         zidCompleteFilename = xdg_config;
 
 
     if (initialize (zidCompleteFilename.c_str()) >= 0) {
-        _debug ("Register callbacks\n");
+        _debug ("Register callbacks");
         setEnableZrtp (true);
         setUserCallback (new ZrtpSessionCallback (_ca));
         return;
     }
 
-    _debug ("Initialization from ZID file failed. Trying to remove...\n");
+    _debug ("Initialization from ZID file failed. Trying to remove...");
 
     if (remove (zidCompleteFilename.c_str()) !=0) {
         _debug ("Failed to remove zid file because of: %s", strerror (errno));
@@ -79,7 +79,7 @@ void AudioZrtpSession::initializeZid (void)
     }
 
     if (initialize (zidCompleteFilename.c_str()) < 0) {
-        _debug ("ZRTP initialization failed\n");
+        _debug ("ZRTP initialization failed");
         throw ZrtpZidException();
     }
 
diff --git a/sflphone-common/src/audio/audiortp/ZrtpSessionCallback.cpp b/sflphone-common/src/audio/audiortp/ZrtpSessionCallback.cpp
index 1648112382c5a2ee5f5da5e847c2df0868143509..ebdcd8f95e277e0d8de0628045cb3bc6a03ee212 100644
--- a/sflphone-common/src/audio/audiortp/ZrtpSessionCallback.cpp
+++ b/sflphone-common/src/audio/audiortp/ZrtpSessionCallback.cpp
@@ -44,7 +44,7 @@ ZrtpSessionCallback::ZrtpSessionCallback (SIPCall *sipcall) :
         return;
     }
 
-    _debug ("Initialize callbacks\n");
+    _debug ("Initialize callbacks");
 
     /**
      * Information Map
@@ -114,28 +114,28 @@ ZrtpSessionCallback::ZrtpSessionCallback (SIPCall *sipcall) :
 void
 ZrtpSessionCallback::secureOn (std::string cipher)
 {
-    _debug ("Secure mode is on with cipher %s\n", cipher.c_str());
+    _debug ("Secure mode is on with cipher %s", cipher.c_str());
     DBusManager::instance().getCallManager()->secureOn (_sipcall->getCallId(), cipher);
 }
 
 void
 ZrtpSessionCallback::secureOff (void)
 {
-    _debug ("Secure mode is off\n");
+    _debug ("Secure mode is off");
     DBusManager::instance().getCallManager()->secureOff (_sipcall->getCallId());
 }
 
 void
 ZrtpSessionCallback::showSAS (std::string sas, bool verified)
 {
-    _debug ("SAS is: %s\n", sas.c_str());
+    _debug ("SAS is: %s", sas.c_str());
     DBusManager::instance().getCallManager()->showSAS (_sipcall->getCallId(), sas, verified);
 }
 
 void
 ZrtpSessionCallback::zrtpNotSuppOther()
 {
-    _debug ("Callee does not support ZRTP\n");
+    _debug ("Callee does not support ZRTP");
     DBusManager::instance().getCallManager()->zrtpNotSuppOther (_sipcall->getCallId());
 }
 
@@ -148,7 +148,7 @@ ZrtpSessionCallback::showMessage (GnuZrtpCodes::MessageSeverity sev, int32_t sub
         msg = _infoMap[subCode];
 
         if (msg != NULL) {
-            _debug ("ZRTP Debug:\n");
+            _debug ("ZRTP Debug:");
         }
     }
 
@@ -156,7 +156,7 @@ ZrtpSessionCallback::showMessage (GnuZrtpCodes::MessageSeverity sev, int32_t sub
         msg = _warningMap[subCode];
 
         if (msg != NULL) {
-            _debug ("ZRTP Debug:\n");
+            _debug ("ZRTP Debug:");
         }
     }
 
@@ -164,22 +164,22 @@ ZrtpSessionCallback::showMessage (GnuZrtpCodes::MessageSeverity sev, int32_t sub
         msg = _severeMap[subCode];
 
         if (msg != NULL) {
-            _debug ("ZRTP Debug:\n");
+            _debug ("ZRTP Debug:");
         }
     }
 
     if (sev == ZrtpError) {
         if (subCode < 0) {  // received an error packet from peer
             subCode *= -1;
-            _debug ("Received an error packet from peer:\n");
+            _debug ("Received an error packet from peer:");
         } else {
-            _debug ("Sent error packet to peer:\n");
+            _debug ("Sent error packet to peer:");
         }
 
         msg = _zrtpMap[subCode];
 
         if (msg != NULL) {
-            _debug ("ZRTP Debug: %s\n", msg->c_str());
+            _debug ("ZRTP Debug: %s", msg->c_str());
         }
     }
 }
@@ -192,20 +192,20 @@ ZrtpSessionCallback::zrtpNegotiationFailed (MessageSeverity severity, int subCod
     if (severity == ZrtpError) {
         if (subCode < 0) {  // received an error packet from peer
             subCode *= -1;
-            _debug ("Received error packet: \n");
+            _debug ("Received error packet: ");
         } else {
-            _debug ("Sent error packet: \n");
+            _debug ("Sent error packet: ");
         }
 
         msg = _zrtpMap[subCode];
 
         if (msg != NULL) {
-            _debug ("%s\n", msg->c_str());
+            _debug ("%s", msg->c_str());
             DBusManager::instance().getCallManager()->zrtpNegotiationFailed (_sipcall->getCallId(), *msg, "ZRTP");
         }
     } else {
         msg = _severeMap[subCode];
-        _debug ("%s\n", msg->c_str());
+        _debug ("%s", msg->c_str());
         DBusManager::instance().getCallManager()->zrtpNegotiationFailed (_sipcall->getCallId(), *msg, "severe");
     }
 }
@@ -213,7 +213,7 @@ ZrtpSessionCallback::zrtpNegotiationFailed (MessageSeverity severity, int subCod
 void
 ZrtpSessionCallback::confirmGoClear()
 {
-    _debug ("Received go clear message. Until confirmation, ZRTP won't send any data\n");
+    _debug ("Received go clear message. Until confirmation, ZRTP won't send any data");
     DBusManager::instance().getCallManager()->zrtpNotSuppOther (_sipcall->getCallId());
 }
 
diff --git a/sflphone-common/src/audio/codecs/alaw.cpp b/sflphone-common/src/audio/codecs/alaw.cpp
index e8a3928a7283e620b2dc2341cc0ea5df429f3bb7..9ed3cd56dedfd19cab165897048012f2b49212ca 100644
--- a/sflphone-common/src/audio/codecs/alaw.cpp
+++ b/sflphone-common/src/audio/codecs/alaw.cpp
@@ -38,7 +38,7 @@ class Alaw : public AudioCodec
         virtual ~Alaw() {}
 
         virtual int codecDecode (short *dst, unsigned char *src, unsigned int size) {
-            // _debug("Decoded by alaw \n");
+            // _debug("Decoded by alaw ");
             int16* end = dst+size;
 
             while (dst<end)
@@ -48,7 +48,7 @@ class Alaw : public AudioCodec
         }
 
         virtual int codecEncode (unsigned char *dst, short *src, unsigned int size) {
-            // _debug("Encoded by alaw \n");
+            // _debug("Encoded by alaw ");
             size >>= 1;
             uint8* end = dst+size;
 
diff --git a/sflphone-common/src/audio/codecs/celtcodec.cpp b/sflphone-common/src/audio/codecs/celtcodec.cpp
index 93cf4470d4aac4bb97b56105395db0c5b5f66a3c..8787bd6b6b3f7c8bfeec6fbf31464de24e31816c 100644
--- a/sflphone-common/src/audio/codecs/celtcodec.cpp
+++ b/sflphone-common/src/audio/codecs/celtcodec.cpp
@@ -46,13 +46,13 @@ class Celt : public AudioCodec
             // celt_mode_info(mode, CELT_GET_LOOKAHEAD, &skip);
 
             if (mode == NULL) {
-                printf ("failed to create a mode\n");
+                printf ("failed to create a mode");
             }
 
             // bytes_per_packet = 1024;
             // if (bytes_per_packet < 0 || bytes_per_packet > MAX_PACKET)
             // {
-            //     printf ("bytes per packet must be between 0 and %d\n");
+            //     printf ("bytes per packet must be between 0 and %d");
             // }
 
             // celt_mode_info(mode, CELT_GET_FRAME_SIZE, &frame_size);
diff --git a/sflphone-common/src/audio/codecs/codecDescriptor.cpp b/sflphone-common/src/audio/codecs/codecDescriptor.cpp
index 8c9ca56006cc214451d3e26381521a933218a833..87a3c8c3d300791c0b89415ea8bf806c71f0e57e 100644
--- a/sflphone-common/src/audio/codecs/codecDescriptor.cpp
+++ b/sflphone-common/src/audio/codecs/codecDescriptor.cpp
@@ -51,14 +51,14 @@ CodecDescriptor::init()
     _nbCodecs = CodecDynamicList.size();
 
     if (_nbCodecs <= 0) {
-        _debug (" Error - No codecs available in directory %s\n" , CODECS_DIR);
+        _debug (" Error - No codecs available in directory %s" , CODECS_DIR);
     }
 
     int i;
 
     for (i = 0 ; i < _nbCodecs ; i++) {
         _CodecsMap[ (AudioCodecType) CodecDynamicList[i]->getPayload() ] = CodecDynamicList[i];
-        _debug ("%s\n" , CodecDynamicList[i]->getCodecName().c_str());
+        _debug ("%s" , CodecDynamicList[i]->getCodecName().c_str());
     }
 }
 
@@ -94,11 +94,11 @@ CodecDescriptor::getCodec (AudioCodecType payload)
     CodecsMap::iterator iter = _CodecsMap.find (payload);
 
     if (iter!=_CodecsMap.end()) {
-        // _debug("Found codec %i _CodecsMap from codec descriptor\n", payload);
+        // _debug("Found codec %i _CodecsMap from codec descriptor", payload);
         return (iter->second);
     }
 
-    _debug ("Error cannont found codec %i in _CodecsMap from codec descriptor\n", payload);
+    _debug ("Error cannont found codec %i in _CodecsMap from codec descriptor", payload);
 
     return NULL;
 }
@@ -207,7 +207,7 @@ CodecDescriptor::scanCodecDirectory (void)
 
     for (i = 0 ; (unsigned int) i < dirToScan.size() ; i++) {
         std::string dirStr = dirToScan[i];
-        _debug ("Scanning %s to find audio codecs....\n",  dirStr.c_str());
+        _debug ("Scanning %s to find audio codecs....",  dirStr.c_str());
         DIR *dir = opendir (dirStr.c_str());
         AudioCodec* audioCodec;
 
@@ -218,7 +218,7 @@ CodecDescriptor::scanCodecDirectory (void)
                 tmp =  dirStruct -> d_name ;
                 if (tmp == CURRENT_DIR || tmp == PARENT_DIR) {} else {
                     if (seemsValid (tmp) && !alreadyInCache (tmp)) {
-                        //_debug("Codec : %s\n", tmp.c_str());
+                        //_debug("Codec : %s", tmp.c_str());
                         _Cache.push_back (tmp);
                         audioCodec = loadCodec (dirStr.append (tmp));
                         codecs.push_back (audioCodec);
@@ -237,7 +237,7 @@ CodecDescriptor::scanCodecDirectory (void)
 AudioCodec*
 CodecDescriptor::loadCodec (std::string path)
 {
-    //_debug("Load path %s\n", path.c_str());
+    //_debug("Load path %s", path.c_str());
     CodecHandlePointer p;
     using std::cerr;
     void * codecHandle = dlopen (path.c_str() , RTLD_LAZY);
@@ -265,7 +265,7 @@ CodecDescriptor::loadCodec (std::string path)
 void
 CodecDescriptor::unloadCodec (CodecHandlePointer p)
 {
-    // _debug("Unload codec %s\n", p.first->getCodecName().c_str());
+    // _debug("Unload codec %s", p.first->getCodecName().c_str());
     using std::cerr;
     destroy_t* destroyCodec = (destroy_t*) dlsym (p.second , "destroy");
 
diff --git a/sflphone-common/src/audio/codecs/gsmcodec.cpp b/sflphone-common/src/audio/codecs/gsmcodec.cpp
index 8543dec2b59ed44e86766565444406fc2663de46..9116d76a94a713e8ac7be356902a358b5b6c9386 100644
--- a/sflphone-common/src/audio/codecs/gsmcodec.cpp
+++ b/sflphone-common/src/audio/codecs/gsmcodec.cpp
@@ -42,10 +42,10 @@ class Gsm : public AudioCodec
             _bandwidth = 29.2;
 
             if (! (_decode_gsmhandle = gsm_create()))
-                printf ("ERROR: decode_gsm_create\n");
+                printf ("ERROR: decode_gsm_create");
 
             if (! (_encode_gsmhandle = gsm_create()))
-                printf ("AudioCodec: ERROR: encode_gsm_create\n");
+                printf ("AudioCodec: ERROR: encode_gsm_create");
         }
 
         Gsm (const Gsm&);
@@ -58,18 +58,18 @@ class Gsm : public AudioCodec
         }
 
         virtual int	codecDecode	(short * dst, unsigned char * src, unsigned int size) {
-            // _debug("Decoded by gsm \n");
+            // _debug("Decoded by gsm ");
             (void) size;
 
             if (gsm_decode (_decode_gsmhandle, (gsm_byte*) src, (gsm_signal*) dst) < 0)
-                printf ("ERROR: gsm_decode\n");
+                printf ("ERROR: gsm_decode");
 
             return 320;
         }
 
         virtual int	codecEncode	(unsigned char * dst, short * src, unsigned int size) {
 
-            // _debug("Encoded by gsm \n");
+            // _debug("Encoded by gsm ");
             (void) size;
             gsm_encode (_encode_gsmhandle, (gsm_signal*) src, (gsm_byte*) dst);
             return 33;
diff --git a/sflphone-common/src/audio/mainbuffer.cpp b/sflphone-common/src/audio/mainbuffer.cpp
index 3f2751b6ba8b03eef708411b09ed0d24bd41a874..052e729259131da39342e252bc9214a5a9ca1f8d 100644
--- a/sflphone-common/src/audio/mainbuffer.cpp
+++ b/sflphone-common/src/audio/mainbuffer.cpp
@@ -63,7 +63,7 @@ CallIDSet* MainBuffer::getCallIDSet (CallID call_id)
 
 bool MainBuffer::createCallIDSet (CallID set_id)
 {
-    _debug ("---- MainBuffer::createCallIDSet %s\n", set_id.c_str());
+    _debug ("---- MainBuffer::createCallIDSet %s", set_id.c_str());
 
     CallIDSet* newCallIDSet = new CallIDSet;
 
@@ -77,21 +77,21 @@ bool MainBuffer::createCallIDSet (CallID set_id)
 bool MainBuffer::removeCallIDSet (CallID set_id)
 {
 
-    _debug ("---- MainBuffer::removeCallIDSet %s\n", set_id.c_str());
+    _debug ("---- MainBuffer::removeCallIDSet %s", set_id.c_str());
 
 
     CallIDSet* callid_set = getCallIDSet (set_id);
 
     if (callid_set != NULL) {
         if (_callIDMap.erase (set_id) != 0) {
-            _debug ("          callid set %s erased!\n", set_id.c_str());
+            _debug ("          callid set %s erased!", set_id.c_str());
             return true;
         } else {
-            _debug ("          error while removing callid set %s!\n", set_id.c_str());
+            _debug ("          error while removing callid set %s!", set_id.c_str());
             return false;
         }
     } else {
-        _debug ("          callid set %s does not exist!\n", set_id.c_str());
+        _debug ("          callid set %s does not exist!", set_id.c_str());
         return false;
     }
 
@@ -99,7 +99,7 @@ bool MainBuffer::removeCallIDSet (CallID set_id)
 
 void MainBuffer::addCallIDtoSet (CallID set_id, CallID call_id)
 {
-    _debug ("---- MainBuffer::addCallIDtoSet %s in %s\n", set_id.c_str(), call_id.c_str());
+    _debug ("---- MainBuffer::addCallIDtoSet %s in %s", set_id.c_str(), call_id.c_str());
 
     CallIDSet* callid_set = getCallIDSet (set_id);
     callid_set->insert (call_id);
@@ -108,18 +108,18 @@ void MainBuffer::addCallIDtoSet (CallID set_id, CallID call_id)
 
 void MainBuffer::removeCallIDfromSet (CallID set_id, CallID call_id)
 {
-    _debug ("---- MainBuffer::removeCallIDfromSet element %s from %s\n", call_id.c_str(), set_id.c_str());
+    _debug ("---- MainBuffer::removeCallIDfromSet element %s from %s", call_id.c_str(), set_id.c_str());
 
     CallIDSet* callid_set = getCallIDSet (set_id);
 
     if (callid_set != NULL) {
         if (callid_set->erase (call_id) != 0) {
-            _debug ("          callid %s erased from set %s!\n", call_id.c_str(), set_id.c_str());
+            _debug ("          callid %s erased from set %s!", call_id.c_str(), set_id.c_str());
         } else {
-            _debug ("          error while removing callid %s from set %s!\n", call_id.c_str(), set_id.c_str());
+            _debug ("          error while removing callid %s from set %s!", call_id.c_str(), set_id.c_str());
         }
     } else {
-        _debug ("          callid set %s does not exist!\n", set_id.c_str());
+        _debug ("          callid set %s does not exist!", set_id.c_str());
     }
 }
 
@@ -130,7 +130,7 @@ RingBuffer* MainBuffer::getRingBuffer (CallID call_id)
     RingBufferMap::iterator iter = _ringBufferMap.find (call_id);
 
     if (iter == _ringBufferMap.end()) {
-        // _debug("ringBuffer with ID: \"%s\" doesn't exist! \n", call_id.c_str());
+        // _debug("ringBuffer with ID: \"%s\" doesn't exist! ", call_id.c_str());
         return NULL;
     } else
         return iter->second;
@@ -140,7 +140,7 @@ RingBuffer* MainBuffer::getRingBuffer (CallID call_id)
 RingBuffer* MainBuffer::createRingBuffer (CallID call_id)
 {
 
-    _debug ("---- MainBuffer::createRingBuffer callid %s\n", call_id.c_str());
+    _debug ("---- MainBuffer::createRingBuffer callid %s", call_id.c_str());
 
     RingBuffer* newRingBuffer = new RingBuffer (SIZEBUF, call_id);
 
@@ -153,20 +153,20 @@ RingBuffer* MainBuffer::createRingBuffer (CallID call_id)
 bool MainBuffer::removeRingBuffer (CallID call_id)
 {
 
-    _debug ("---- MainBuffer::removeRingBuffer call_id %s\n", call_id.c_str());
+    _debug ("---- MainBuffer::removeRingBuffer call_id %s", call_id.c_str());
 
     RingBuffer* ring_buffer = getRingBuffer (call_id);
 
     if (ring_buffer != NULL) {
         if (_ringBufferMap.erase (call_id) != 0) {
-            _debug ("          ringbuffer %s removed!\n", call_id.c_str());
+            _debug ("          ringbuffer %s removed!", call_id.c_str());
             return true;
         } else {
-            _debug ("          error while deleting ringbuffer %s!\n", call_id.c_str());
+            _debug ("          error while deleting ringbuffer %s!", call_id.c_str());
             return false;
         }
     } else {
-        _debug ("          error ringbuffer %s does not exist!\n", call_id.c_str());
+        _debug ("          error ringbuffer %s does not exist!", call_id.c_str());
         return true;
     }
 }
@@ -177,7 +177,7 @@ void MainBuffer::bindCallID (CallID call_id1, CallID call_id2)
 
     ost::MutexLock guard (_mutex);
 
-    _debug ("---- MainBuffer::bindCallID %s and callid %s\n", call_id1.c_str(), call_id2.c_str());
+    _debug ("---- MainBuffer::bindCallID %s and callid %s", call_id1.c_str(), call_id2.c_str());
 
     RingBuffer* ring_buffer;
     CallIDSet* callid_set;
@@ -210,7 +210,7 @@ void MainBuffer::unBindCallID (CallID call_id1, CallID call_id2)
 
     ost::MutexLock guard (_mutex);
 
-    _debug ("---- MainBuffer::unBindCallID %s and callid %s\n", call_id1.c_str(), call_id2.c_str());
+    _debug ("---- MainBuffer::unBindCallID %s and callid %s", call_id1.c_str(), call_id2.c_str());
 
     removeCallIDfromSet (call_id1, call_id2);
     removeCallIDfromSet (call_id2, call_id1);
@@ -261,7 +261,7 @@ void MainBuffer::unBindAll (CallID call_id)
 
     CallIDSet::iterator iter_set = temp_set.begin();
 
-    _debug ("MainBuffer::unBindAll\n");
+    _debug ("MainBuffer::unBindAll");
 
     while (iter_set != temp_set.end()) {
         CallID call_id_in_set = *iter_set;
@@ -369,12 +369,12 @@ int MainBuffer::getData (void *buffer, int toCopy, unsigned short volume, CallID
 int MainBuffer::getDataByID (void *buffer, int toCopy, unsigned short volume, CallID call_id, CallID reader_id)
 {
 
-    // _debug("MainBuffer::getDataByID in buffer %s by %s \n", call_id.c_str(), reader_id.c_str());
+    // _debug("MainBuffer::getDataByID in buffer %s by %s ", call_id.c_str(), reader_id.c_str());
 
     RingBuffer* ring_buffer = getRingBuffer (call_id);
 
     if (ring_buffer == NULL) {
-        // _debug("Output RingBuffer ID: \"%s\" does not exist!\n", call_id.c_str());
+        // _debug("Output RingBuffer ID: \"%s\" does not exist!", call_id.c_str());
         return 0;
     }
 
@@ -396,22 +396,22 @@ int MainBuffer::availForGet (CallID call_id)
         return 0;
 
     if (callid_set->empty()) {
-        _debug ("CallIDSet with ID: \"%s\" is empty!\n", call_id.c_str());
+        _debug ("CallIDSet with ID: \"%s\" is empty!", call_id.c_str());
         return 0;
     }
 
     if (callid_set->size() == 1) {
         CallIDSet::iterator iter_id = callid_set->begin();
-        // _debug("MainBuffer::availForGet availForGetByID(%s,%s)\n", (*iter_id).c_str(), call_id.c_str());
+        // _debug("MainBuffer::availForGet availForGetByID(%s,%s)", (*iter_id).c_str(), call_id.c_str());
 
         if ( (call_id != default_id) && (*iter_id == call_id)) {
-            _debug ("This problem should not occur since we have %i element\n", (int) callid_set->size());
+            _debug ("This problem should not occur since we have %i element", (int) callid_set->size());
         }
 
         // else
         return availForGetByID (*iter_id, call_id);
     } else {
-        // _debug("CallIDSet with ID: \"%s\" is a conference!\n", call_id.c_str());
+        // _debug("CallIDSet with ID: \"%s\" is a conference!", call_id.c_str());
         int avail_bytes = 99999;
         int nb_bytes;
         CallIDSet::iterator iter_id = callid_set->begin();
@@ -433,14 +433,14 @@ int MainBuffer::availForGetByID (CallID call_id, CallID reader_id)
 {
 
     if ( (call_id != default_id) && (reader_id == call_id)) {
-        _debug ("**********************************************************************\n");
-        _debug ("Error an RTP session ring buffer is not supposed to have a readpointer on tiself\n");
+        _debug ("**********************************************************************");
+        _debug ("Error an RTP session ring buffer is not supposed to have a readpointer on tiself");
     }
 
     RingBuffer* ringbuffer = getRingBuffer (call_id);
 
     if (ringbuffer == NULL) {
-        _debug ("Error: ring buffer does not exist\n");
+        _debug ("Error: ring buffer does not exist");
         return 0;
     } else
         return ringbuffer->AvailForGet (reader_id);
@@ -450,7 +450,7 @@ int MainBuffer::availForGetByID (CallID call_id, CallID reader_id)
 
 int MainBuffer::discard (int toDiscard, CallID call_id)
 {
-    // _debug("MainBuffer::discard\n");
+    // _debug("MainBuffer::discard");
 
     ost::MutexLock guard (_mutex);
 
@@ -460,17 +460,17 @@ int MainBuffer::discard (int toDiscard, CallID call_id)
         return 0;
 
     if (callid_set->empty()) {
-        // _debug("CallIDSet with ID: \"%s\" is empty!\n", call_id.c_str());
+        // _debug("CallIDSet with ID: \"%s\" is empty!", call_id.c_str());
         return 0;
     }
 
 
     if (callid_set->size() == 1) {
         CallIDSet::iterator iter_id = callid_set->begin();
-        // _debug("Discard Data in \"%s\" RingBuffer for \"%s\" ReaderPointer\n",(*iter_id).c_str(),call_id.c_str());
+        // _debug("Discard Data in \"%s\" RingBuffer for \"%s\" ReaderPointer",(*iter_id).c_str(),call_id.c_str());
         return discardByID (toDiscard, *iter_id, call_id);
     } else {
-        // _debug("CallIDSet with ID: \"%s\" is a conference!\n", call_id.c_str());
+        // _debug("CallIDSet with ID: \"%s\" is a conference!", call_id.c_str());
         CallIDSet::iterator iter_id;
 
         for (iter_id = callid_set->begin(); iter_id != callid_set->end(); iter_id++) {
@@ -501,7 +501,7 @@ void MainBuffer::flush (CallID call_id)
 {
     ost::MutexLock guard (_mutex);
 
-    // _debug("MainBuffer::flush\n");
+    // _debug("MainBuffer::flush");
 
     CallIDSet* callid_set = getCallIDSet (call_id);
 
@@ -509,14 +509,14 @@ void MainBuffer::flush (CallID call_id)
         return;
 
     if (callid_set->empty()) {
-        // _debug("CallIDSet with ID: \"%s\" is empty!\n", call_id.c_str());
+        // _debug("CallIDSet with ID: \"%s\" is empty!", call_id.c_str());
     }
 
     if (callid_set->size() == 1) {
         CallIDSet::iterator iter_id = callid_set->begin();
         flushByID (*iter_id, call_id);
     } else {
-        // _debug("CallIDSet with ID: \"%s\" is a conference!\n", call_id.c_str());
+        // _debug("CallIDSet with ID: \"%s\" is a conference!", call_id.c_str());
         CallIDSet::iterator iter_id;
 
         for (iter_id = callid_set->begin(); iter_id != callid_set->end(); iter_id++) {
@@ -548,12 +548,12 @@ void MainBuffer::flushByID (CallID call_id, CallID reader_id)
 void MainBuffer::flushAllBuffers()
 {
 
-    // _debug("-------------------------- flushAllBuffers()\n");
+    // _debug("-------------------------- flushAllBuffers()");
 
     RingBufferMap::iterator iter_buffer = _ringBufferMap.begin();
 
     while (iter_buffer != _ringBufferMap.end()) {
-        // _debug("--------------------------    flushing: %s\n",iter_buffer->second->getBufferId().c_str());
+        // _debug("--------------------------    flushing: %s",iter_buffer->second->getBufferId().c_str());
 
         iter_buffer->second->flushAll();
 
@@ -564,7 +564,7 @@ void MainBuffer::flushAllBuffers()
 
 void MainBuffer::stateInfo()
 {
-    _debug ("MainBuffer state info\n");
+    _debug ("MainBuffer state info");
 
     CallIDMap::iterator iter_map = _callIDMap.begin();
 
@@ -585,7 +585,7 @@ void MainBuffer::stateInfo()
             }
         }
 
-        _debug ("%s\n", dbg_str.c_str());
+        _debug ("%s", dbg_str.c_str());
 
         iter_map++;
     }
diff --git a/sflphone-common/src/audio/pulseaudio/audiostream.cpp b/sflphone-common/src/audio/pulseaudio/audiostream.cpp
index f63390969bc6b6f421ab5c779f67f394b1cfd26e..d98251075a8bcfc241979556d433f4fb664c61d8 100644
--- a/sflphone-common/src/audio/pulseaudio/audiostream.cpp
+++ b/sflphone-common/src/audio/pulseaudio/audiostream.cpp
@@ -73,7 +73,7 @@ bool
 AudioStream::drainStream (void)
 {
     if (_audiostream) {
-        _debug ("Draining stream\n");
+        _debug ("Draining stream");
         pa_operation * operation;
 
         pa_threaded_mainloop_lock (_mainloop);
@@ -81,7 +81,7 @@ AudioStream::drainStream (void)
         if ( (operation = pa_stream_drain (_audiostream, success_cb, _mainloop))) {
             while (pa_operation_get_state (operation) != PA_OPERATION_DONE) {
                 if (!_context || pa_context_get_state (_context) != PA_CONTEXT_READY || !_audiostream || pa_stream_get_state (_audiostream) != PA_STREAM_READY) {
-                    _debug ("Connection died: %s\n", _context ? pa_strerror (pa_context_errno (_context)) : "NULL");
+                    _debug ("Connection died: %s", _context ? pa_strerror (pa_context_errno (_context)) : "NULL");
                     pa_operation_unref (operation);
                     break;
                 } else {
@@ -99,7 +99,7 @@ AudioStream::drainStream (void)
 bool
 AudioStream::disconnectStream (void)
 {
-    _debug ("Destroy audio streams\n");
+    _debug ("Destroy audio streams");
 
     pa_threaded_mainloop_lock (_mainloop);
 
@@ -128,7 +128,7 @@ AudioStream::stream_state_callback (pa_stream* s, void* user_data)
 {
     pa_threaded_mainloop *m;
 
-    _debug ("AudioStream::stream_state_callback :: The state of the stream changed\n");
+    _debug ("AudioStream::stream_state_callback :: The state of the stream changed");
     assert (s);
 
     m = (pa_threaded_mainloop*) user_data;
@@ -137,26 +137,26 @@ AudioStream::stream_state_callback (pa_stream* s, void* user_data)
     switch (pa_stream_get_state (s)) {
 
         case PA_STREAM_CREATING:
-            _debug ("Stream is creating...\n");
+            _debug ("Stream is creating...");
             break;
 
         case PA_STREAM_TERMINATED:
-            _debug ("Stream is terminating...\n");
+            _debug ("Stream is terminating...");
             break;
 
         case PA_STREAM_READY:
-            _debug ("Stream successfully created, connected to %s\n", pa_stream_get_device_name (s));
+            _debug ("Stream successfully created, connected to %s", pa_stream_get_device_name (s));
             // pa_stream_cork( s, 0, NULL, NULL);
             break;
 
         case PA_STREAM_UNCONNECTED:
-            _debug ("Stream unconnected\n");
+            _debug ("Stream unconnected");
             break;
 
         case PA_STREAM_FAILED:
 
         default:
-            _debug ("Stream error - Sink/Source doesn't exists: %s\n" , pa_strerror (pa_context_errno (pa_stream_get_context (s))));
+            _debug ("Stream error - Sink/Source doesn't exists: %s" , pa_strerror (pa_context_errno (pa_stream_get_context (s))));
             exit (0);
             break;
     }
@@ -192,7 +192,7 @@ AudioStream::createStream (pa_context* c)
     pa_buffer_attr* attributes = (pa_buffer_attr*) malloc (sizeof (pa_buffer_attr));
 
     if (! (s = pa_stream_new (c, _streamDescription.c_str() , &sample_spec, &channel_map)))
-        _debug ("%s: pa_stream_new() failed : %s\n" , _streamDescription.c_str(), pa_strerror (pa_context_errno (c)));
+        _debug ("%s: pa_stream_new() failed : %s" , _streamDescription.c_str(), pa_strerror (pa_context_errno (c)));
 
     assert (s);
 
@@ -223,7 +223,7 @@ AudioStream::createStream (pa_context* c)
     } else if (_streamType == UPLOAD_STREAM) {
         pa_stream_connect_upload (s , 1024);
     } else {
-        _debug ("Stream type unknown \n");
+        _debug ("Stream type unknown ");
     }
 
     pa_stream_set_state_callback (s , stream_state_callback, _mainloop);
diff --git a/sflphone-common/src/audio/pulseaudio/pulselayer.cpp b/sflphone-common/src/audio/pulseaudio/pulselayer.cpp
index 906ba0a541a8ee50575087c0679bea536ec0d177..046d81cec1bc871f172e34182b2d7c9878cc8159 100644
--- a/sflphone-common/src/audio/pulseaudio/pulselayer.cpp
+++ b/sflphone-common/src/audio/pulseaudio/pulselayer.cpp
@@ -25,7 +25,7 @@ int framesPerBuffer = 2048;
 
 static  void playback_callback (pa_stream* s, size_t bytes, void* userdata)
 {
-    // _debug("playback_callback\n");
+    // _debug("playback_callback");
 
     assert (s && bytes);
     assert (bytes > 0);
@@ -35,7 +35,7 @@ static  void playback_callback (pa_stream* s, size_t bytes, void* userdata)
 
 static void capture_callback (pa_stream* s, size_t bytes, void* userdata)
 {
-    // _debug("capture_callback\n");
+    // _debug("capture_callback");
 
     assert (s && bytes);
     assert (bytes > 0);
@@ -46,25 +46,25 @@ static void capture_callback (pa_stream* s, size_t bytes, void* userdata)
 /*
 static void stream_suspended_callback (pa_stream *s UNUSED, void *userdata UNUSED)
 {
-    _debug("PulseLayer::Stream Suspended\n");
+    _debug("PulseLayer::Stream Suspended");
 }
 */
 
 /*
 static void stream_moved_callback(pa_stream *s UNUSED, void *userdata UNUSED)
 {
-    _debug("PulseLayer::Stream Moved\n");
+    _debug("PulseLayer::Stream Moved");
 }
 */
 
 static void playback_underflow_callback (pa_stream* s,  void* userdata UNUSED)
 {
-    _debug ("PulseLayer::Buffer Underflow\n");
+    _debug ("PulseLayer::Buffer Underflow");
     // const pa_timing_info* info = pa_stream_get_timing_info(s);
-    // _debug("         pa write_index: %l\n", (long)(info->write_index));
-    // _debug("         pa write_index_corupt (if not 0): %i\n",  info->write_index_corrupt);
-    // _debug("         pa read_index: %l\n", (long)(info->read_index));
-    // _debug("         pa read_index_corrupt (if not 0): %i\n", info->read_index_corrupt);
+    // _debug("         pa write_index: %l", (long)(info->write_index));
+    // _debug("         pa write_index_corupt (if not 0): %i",  info->write_index_corrupt);
+    // _debug("         pa read_index: %l", (long)(info->read_index));
+    // _debug("         pa read_index_corrupt (if not 0): %i", info->read_index_corrupt);
 
 
     // fill in audio buffer twice the prebuffering value to restart playback
@@ -77,7 +77,7 @@ static void playback_underflow_callback (pa_stream* s,  void* userdata UNUSED)
 
 static void playback_overflow_callback (pa_stream* s UNUSED, void* userdata UNUSED)
 {
-    _debug ("PulseLayer::Buffer OverFlow\n");
+    _debug ("PulseLayer::Buffer OverFlow");
     //PulseLayer* pulse = (PulseLayer*) userdata;
     // pa_stream_drop (s);
     // pa_stream_trigger (s, NULL, NULL);
@@ -91,7 +91,7 @@ PulseLayer::PulseLayer (ManagerImpl* manager)
         , playback()
         , record()
 {
-    _debug ("PulseLayer::Pulse audio constructor: Create context\n");
+    _debug ("PulseLayer::Pulse audio constructor: Create context");
 
     _urgentRingBuffer.createReadPointer();
     dcblocker = new DcBlocker();
@@ -116,7 +116,7 @@ PulseLayer::~PulseLayer (void)
 bool
 PulseLayer::closeLayer (void)
 {
-    _debug ("PulseLayer::closeLayer :: Destroy pulselayer\n");
+    _debug ("PulseLayer::closeLayer :: Destroy pulselayer");
 
     // Commenting the line below will make the
     // PulseLayer to close immediately, not
@@ -153,7 +153,7 @@ PulseLayer::closeLayer (void)
 void
 PulseLayer::connectPulseAudioServer (void)
 {
-    _debug ("PulseLayer::connectPulseAudioServer \n");
+    _debug ("PulseLayer::connectPulseAudioServer ");
 
     setenv ("PULSE_PROP_media.role", "phone", 1);
 
@@ -161,7 +161,7 @@ PulseLayer::connectPulseAudioServer (void)
 
     pa_threaded_mainloop_lock (m);
 
-    _debug ("Connect the context to the server\n");
+    _debug ("Connect the context to the server");
     pa_context_connect (context, NULL , flag , NULL);
 
     pa_context_set_state_callback (context, context_state_callback, this);
@@ -170,7 +170,7 @@ PulseLayer::connectPulseAudioServer (void)
     // Run the main loop
 
     if (pa_context_get_state (context) != PA_CONTEXT_READY) {
-        _debug ("Error connecting to pulse audio server\n");
+        _debug ("Error connecting to pulse audio server");
         // pa_threaded_mainloop_unlock (m);
     }
 
@@ -178,13 +178,13 @@ PulseLayer::connectPulseAudioServer (void)
 
     //serverinfo();
     //muteAudioApps(99);
-    _debug ("Context creation done\n");
+    _debug ("Context creation done");
 
 }
 
 void PulseLayer::context_state_callback (pa_context* c, void* user_data)
 {
-    _debug ("PulseLayer::context_state_callback ::The state of the context changed\n");
+    _debug ("PulseLayer::context_state_callback ::The state of the context changed");
     PulseLayer* pulse = (PulseLayer*) user_data;
     assert (c && pulse->m);
 
@@ -195,22 +195,22 @@ void PulseLayer::context_state_callback (pa_context* c, void* user_data)
         case PA_CONTEXT_AUTHORIZING:
 
         case PA_CONTEXT_SETTING_NAME:
-            _debug ("Waiting....\n");
+            _debug ("Waiting....");
             break;
 
         case PA_CONTEXT_READY:
             pulse->createStreams (c);
-            _debug ("Connection to PulseAudio server established\n");
+            _debug ("Connection to PulseAudio server established");
             break;
 
         case PA_CONTEXT_TERMINATED:
-            _debug ("Context terminated\n");
+            _debug ("Context terminated");
             break;
 
         case PA_CONTEXT_FAILED:
 
         default:
-            _debug (" Error : %s\n" , pa_strerror (pa_context_errno (c)));
+            _debug (" Error : %s" , pa_strerror (pa_context_errno (c)));
             pulse->disconnectAudioStream();
             exit (0);
             break;
@@ -219,7 +219,7 @@ void PulseLayer::context_state_callback (pa_context* c, void* user_data)
 
 bool PulseLayer::disconnectAudioStream (void)
 {
-    _debug ("PulseLayer::disconnectAudioStream( void ) \n");
+    _debug (" PulseLayer::disconnectAudioStream( void ) ");
 
     closePlaybackStream();
 
@@ -234,7 +234,7 @@ bool PulseLayer::disconnectAudioStream (void)
 
 bool PulseLayer::createStreams (pa_context* c)
 {
-    _debug ("PulseLayer::createStreams\n");
+    _debug ("PulseLayer::createStreams");
 
     PulseLayerType * playbackParam = new PulseLayerType();
     playbackParam->context = c;
@@ -330,27 +330,27 @@ void PulseLayer::startStream (void)
 
     if (!is_started) {
 
-        _debug ("PulseLayer::Start Stream\n");
+        _debug ("PulseLayer::Start Stream");
 
         if (!m) {
 
-            _debug ("Creating PulseAudio MainLoop\n");
+            _debug ("Creating PulseAudio MainLoop");
             m = pa_threaded_mainloop_new();
             assert (m);
 
             if (pa_threaded_mainloop_start (m) < 0) {
-                _debug ("Failed starting the mainloop\n");
+                _debug ("Failed starting the mainloop");
             }
         }
 
         if (!context) {
 
-            _debug ("Creating new PulseAudio Context\n");
+            _debug ("Creating new PulseAudio Context");
             pa_threaded_mainloop_lock (m);
             // Instanciate a context
 
             if (! (context = pa_context_new (pa_threaded_mainloop_get_api (m) , "SFLphone")))
-                _debug ("Error while creating the context\n");
+                _debug ("Error while creating the context");
 
             pa_threaded_mainloop_unlock (m);
 
@@ -377,7 +377,7 @@ PulseLayer::stopStream (void)
 
     if (is_started) {
 
-        _debug ("PulseLayer::Stop Audio Stream\n");
+        _debug ("PulseLayer::Stop Audio Stream");
         pa_stream_flush (playback->pulseStream(), NULL, NULL);
         pa_stream_flush (record->pulseStream(), NULL, NULL);
 
@@ -387,7 +387,7 @@ PulseLayer::stopStream (void)
 
         disconnectAudioStream();
 
-        _debug ("Disconnecting PulseAudio context\n");
+        _debug ("Disconnecting PulseAudio context");
 
         if (context) {
 
@@ -398,7 +398,7 @@ PulseLayer::stopStream (void)
             context = NULL;
         }
 
-        _debug ("Freeing Pulseaudio mainloop\n");
+        _debug ("Freeing Pulseaudio mainloop");
 
         if (m) {
             pa_threaded_mainloop_free (m);
@@ -416,7 +416,7 @@ PulseLayer::stopStream (void)
 
 // void PulseLayer::underflow (pa_stream* s UNUSED,  void* userdata UNUSED)
 //{
-//    _debug ("PulseLayer::Buffer Underflow\n");
+//    _debug ("PulseLayer::Buffer Underflow");
 //}
 
 /*
@@ -434,7 +434,7 @@ void PulseLayer::processPlaybackData (void)
     // Handle the data for the speakers
     if (playback && (playback->pulseStream()) && (pa_stream_get_state (playback->pulseStream()) == PA_STREAM_READY)) {
 
-        // _debug("PulseLayer::processPlaybackData()\n");
+        // _debug("PulseLayer::processPlaybackData()");
 
         // If the playback buffer is full, we don't overflow it; wait for it to have free space
         if (pa_stream_writable_size (playback->pulseStream()) == 0)
@@ -463,7 +463,7 @@ void PulseLayer::processData (void)
     // Handle the data for the speakers
     if (playback && (playback->pulseStream()) && (pa_stream_get_state (playback->pulseStream()) == PA_STREAM_READY)) {
 
-        // _debug("PulseLayer::processPlaybackData()\n");
+        // _debug("PulseLayer::processPlaybackData()");
 
         // If the playback buffer is full, we don't overflow it; wait for it to have free space
         if (pa_stream_writable_size (playback->pulseStream()) == 0)
@@ -495,17 +495,17 @@ void PulseLayer::writeToSpeaker (void)
 
 
     int writeableSize = pa_stream_writable_size (playback->pulseStream());
-    // _debug("PulseLayer writablesize : %i\n", writeableSize);
+    // _debug("PulseLayer writablesize : %i", writeableSize);
 
     if (writeableSize < 0)
-        _debug ("PulseLayer playback error : %s\n", pa_strerror (writeableSize));
+        _debug ("PulseLayer playback error : %s", pa_strerror (writeableSize));
 
 
     if (urgentAvailBytes > writeableSize) {
 
-        // _debug("urgentAvailBytes: %i\n", urgentAvailBytes);
+        // _debug("urgentAvailBytes: %i", urgentAvailBytes);
 
-        // _debug("Play Urgent!\n");
+        // _debug("Play Urgent!");
 
         out = (SFLDataFormat*) pa_xmalloc (writeableSize);
         _urgentRingBuffer.Get (out, writeableSize, 100);
@@ -529,11 +529,11 @@ void PulseLayer::writeToSpeaker (void)
 
         if (tone != 0) {
 
-            // _debug("PlayTone writeableSize: %i\n", writeableSize);
+            // _debug("PlayTone writeableSize: %i", writeableSize);
 
             if (playback->getStreamState() == PA_STREAM_READY) {
 
-                // _debug("Play Sine Tone!\n");
+                // _debug("Play Sine Tone!");
 
                 out = (SFLDataFormat*) pa_xmalloc (writeableSize);
                 int copied = tone->getNext (out, writeableSize / sizeof (SFLDataFormat), 100);
@@ -549,7 +549,7 @@ void PulseLayer::writeToSpeaker (void)
         else if (file_tone != 0) {
 
             if (playback->getStreamState() == PA_STREAM_READY) {
-                // _debug("Play File Tone!\n");
+                // _debug("Play File Tone!");
 
                 out = (SFLDataFormat*) pa_xmalloc (writeableSize);
                 int copied = file_tone->getNext (out, writeableSize / sizeof (SFLDataFormat), 100);
@@ -610,7 +610,7 @@ void PulseLayer::writeToSpeaker (void)
                     int nbSample = _converter->upsampleData ( (SFLDataFormat*) out, rsmpl_out, _mainBufferSampleRate, _audioSampleRate, nb_sample_down);
 
                     if ( (nbSample*sizeof (SFLDataFormat)) > (unsigned int) writeableSize)
-                        _debug ("Error: nbsbyte exceed buffer length\n");
+                        _debug ("Error: nbsbyte exceed buffer length");
 
                     // pa_threaded_mainloop_lock (m);
                     pa_stream_write (playback->pulseStream(), rsmpl_out, nbSample*sizeof (SFLDataFormat), NULL, 0, PA_SEEK_RELATIVE);
@@ -661,10 +661,10 @@ void PulseLayer::readFromMic (void)
 
     int readableSize = pa_stream_readable_size (record->pulseStream());
 
-    // _debug("readableSize: %i\n", readableSize);
+    // _debug("readableSize: %i", readableSize);
 
     if (pa_stream_peek (record->pulseStream() , (const void**) &data , &r) < 0 || !data) {
-        _debug ("pa_stream_peek() failed: %s\n" , pa_strerror (pa_context_errno (context)));
+        _debug ("pa_stream_peek() failed: %s" , pa_strerror (pa_context_errno (context)));
     }
 
 
@@ -679,7 +679,7 @@ void PulseLayer::readFromMic (void)
 
 
             SFLDataFormat* rsmpl_out = (SFLDataFormat*) pa_xmalloc (readableSize);
-            // _debug("Byte read: %i\n", r);
+            // _debug("Byte read: %i", r);
             int nbSample = r / sizeof (SFLDataFormat);
 
             int nb_sample_up = nbSample;
@@ -705,7 +705,7 @@ void PulseLayer::readFromMic (void)
     }
 
     if (pa_stream_drop (record->pulseStream()) < 0) {
-        //_debug("pa_stream_drop() failed: %s\n" , pa_strerror( pa_context_errno( context) ));
+        //_debug("pa_stream_drop() failed: %s" , pa_strerror( pa_context_errno( context) ));
     }
 
     // pa_threaded_mainloop_unlock (m);
@@ -713,10 +713,10 @@ void PulseLayer::readFromMic (void)
 
 static void retrieve_server_info (pa_context *c UNUSED, const pa_server_info *i, void *userdata UNUSED)
 {
-    _debug ("Server Info: Process owner : %s\n" , i->user_name);
-    _debug ("\t\tServer name : %s - Server version = %s\n" , i->server_name, i->server_version);
-    _debug ("\t\tDefault sink name : %s\n" , i->default_sink_name);
-    _debug ("\t\tDefault source name : %s\n" , i->default_source_name);
+    _debug ("Server Info: Process owner : %s" , i->user_name);
+    _debug ("\t\tServer name : %s - Server version = %s" , i->server_name, i->server_version);
+    _debug ("\t\tDefault sink name : %s" , i->default_sink_name);
+    _debug ("\t\tDefault source name : %s" , i->default_source_name);
 }
 
 static void reduce_sink_list_cb (pa_context *c UNUSED, const pa_sink_input_info *i, int eol, void *userdata)
@@ -724,10 +724,10 @@ static void reduce_sink_list_cb (pa_context *c UNUSED, const pa_sink_input_info
     PulseLayer* pulse = (PulseLayer*) userdata;
 
     if (!eol) {
-        //_debug("Sink Info: index : %i\n" , i->index);
-        //_debug("\t\tClient : %i\n" , i->client);
-        //_debug("\t\tVolume : %i\n" , i->volume.values[0]);
-        //_debug("\t\tChannels : %i\n" , i->volume.channels);
+        //_debug("Sink Info: index : %i" , i->index);
+        //_debug("\t\tClient : %i" , i->client);
+        //_debug("\t\tVolume : %i" , i->volume.values[0]);
+        //_debug("\t\tChannels : %i" , i->volume.channels);
         if (strcmp (i->name , PLAYBACK_STREAM_NAME) != 0)
             pulse->setSinkVolume (i->index , i->volume.channels, 10);
     }
@@ -738,11 +738,11 @@ static void restore_sink_list_cb (pa_context *c UNUSED, const pa_sink_input_info
     PulseLayer* pulse = (PulseLayer*) userdata;
 
     if (!eol) {
-        //_debug("Sink Info: index : %i\n" , i->index);
-        //_debug("\t\tSink name : -%s-\n" , i->name);
-        //_debug("\t\tClient : %i\n" , i->client);
-        //_debug("\t\tVolume : %i\n" , i->volume.values[0]);
-        //_debug("\t\tChannels : %i\n" , i->volume.channels);
+        //_debug("Sink Info: index : %i" , i->index);
+        //_debug("\t\tSink name : -%s-" , i->name);
+        //_debug("\t\tClient : %i" , i->client);
+        //_debug("\t\tVolume : %i" , i->volume.values[0]);
+        //_debug("\t\tChannels : %i" , i->volume.channels);
         if (strcmp (i->name , PLAYBACK_STREAM_NAME) != 0)
             pulse->setSinkVolume (i->index , i->volume.channels, 100);
     }
@@ -802,7 +802,7 @@ void PulseLayer::setSinkVolume (int index, int channels, int volume)
     pa_volume_t vol = PA_VOLUME_NORM * ( (double) volume / 100) ;
 
     pa_cvolume_set (&cvolume , channels , vol);
-    _debug ("Set sink volume of index %i\n" , index);
+    _debug ("Set sink volume of index %i" , index);
     pa_context_set_sink_input_volume (context, index, &cvolume, NULL, NULL) ;
 
 }
@@ -814,7 +814,7 @@ void PulseLayer::setSourceVolume (int index, int channels, int volume)
     pa_volume_t vol = PA_VOLUME_NORM * ( (double) volume / 100) ;
 
     pa_cvolume_set (&cvolume , channels , vol);
-    _debug ("Set source volume of index %i\n" , index);
+    _debug ("Set source volume of index %i" , index);
     pa_context_set_source_volume_by_index (context, index, &cvolume, NULL, NULL);
 
 }
diff --git a/sflphone-common/src/audio/ringbuffer.cpp b/sflphone-common/src/audio/ringbuffer.cpp
index 0eb146f397cb03b7d377aa39b2122466ff18cb6c..6e08859c70c796367a8b68ad13750043b22afb34 100644
--- a/sflphone-common/src/audio/ringbuffer.cpp
+++ b/sflphone-common/src/audio/ringbuffer.cpp
@@ -54,7 +54,7 @@ RingBuffer::~RingBuffer()
 void
 RingBuffer::flush (CallID call_id)
 {
-    _debug ("flush: reinit \"%s\" readpointer in \"%s\" ringbuffer\n", call_id.c_str(), buffer_id.c_str());
+    _debug ("flush: reinit \"%s\" readpointer in \"%s\" ringbuffer", call_id.c_str(), buffer_id.c_str());
     storeReadPointer (mEnd, call_id);
 }
 
@@ -62,14 +62,14 @@ RingBuffer::flush (CallID call_id)
 void
 RingBuffer::flushAll ()
 {
-    // _debug("flushall: reinit all readpointer in \"%s\" ringbuffer\n", buffer_id.c_str());
+    // _debug("flushall: reinit all readpointer in \"%s\" ringbuffer", buffer_id.c_str());
 
-    // _debug("------------------------------ flushAll() in \"%s\" ringbuffer\n", buffer_id.c_str());
+    // _debug("------------------------------ flushAll() in \"%s\" ringbuffer", buffer_id.c_str());
 
     ReadPointer::iterator iter_pointer = _readpointer.begin();
 
     while (iter_pointer != _readpointer.end()) {
-        // _debug("------------------------------     reinit readpointer %s\n", iter_pointer->first.c_str());
+        // _debug("------------------------------     reinit readpointer %s", iter_pointer->first.c_str());
         iter_pointer->second = mEnd;
 
         iter_pointer++;
@@ -89,8 +89,8 @@ RingBuffer::putLen()
 
     int length = (mEnd + mBufferSize - mStart) % mBufferSize;
 
-    // _debug("RingBuffer::putLen length %i\n", length);
-    // _debug("    *RingBuffer::putLen: buffer_id %s, mStart %i, mEnd %i, length %i, buffersie %i\n", buffer_id.c_str(), mStart, mEnd, length, mBufferSize);
+    // _debug("RingBuffer::putLen length %i", length);
+    // _debug("    *RingBuffer::putLen: buffer_id %s, mStart %i, mEnd %i, length %i, buffersie %i", buffer_id.c_str(), mStart, mEnd, length, mBufferSize);
     return length;
 }
 
@@ -101,7 +101,7 @@ RingBuffer::getLen (CallID call_id)
     int mStart = getReadPointer (call_id);
 
     int length = (mEnd + mBufferSize - mStart) % mBufferSize;
-    // _debug("    *RingBuffer::getLen: buffer_id %s, call_id %s, mStart %i, mEnd %i, length %i, buffersie %i\n", buffer_id.c_str(), call_id.c_str(), mStart, mEnd, length, mBufferSize);
+    // _debug("    *RingBuffer::getLen: buffer_id %s, call_id %s, mStart %i, mEnd %i, length %i, buffersie %i", buffer_id.c_str(), call_id.c_str(), mStart, mEnd, length, mBufferSize);
     return length;
 
 }
@@ -111,7 +111,7 @@ RingBuffer::debug()
 {
     int mStart = getSmallestReadPointer();
 
-    _debug ("Start=%d; End=%d; BufferSize=%d\n", mStart, mEnd, mBufferSize);
+    _debug ("Start=%d; End=%d; BufferSize=%d", mStart, mEnd, mBufferSize);
 }
 
 int
@@ -121,17 +121,17 @@ RingBuffer::getReadPointer (CallID call_id)
     if (getNbReadPointer() == 0)
         return 0;
 
-    // _debug("RingBuffer::getReadPointer() id %s\n", call_id.c_str());
+    // _debug("RingBuffer::getReadPointer() id %s", call_id.c_str());
 
     ReadPointer::iterator iter = _readpointer.find (call_id);
 
     if (iter == _readpointer.end()) {
-        // _debug("                RingBuffer::getReadPointer Error read pointer size: %i\n", _readpointer.size());
-        // _debug("                RingBuffer::getReadPointer Error read pointer \"%s\" is null\n", call_id.c_str());
+        // _debug("                RingBuffer::getReadPointer Error read pointer size: %i", _readpointer.size());
+        // _debug("                RingBuffer::getReadPointer Error read pointer \"%s\" is null", call_id.c_str());
         ReadPointer::iterator iter2;
 
         for (iter2 = _readpointer.begin(); iter2 != _readpointer.end(); iter2++) {
-            // x_debug("                RingBuffer::getReadPointer list avail pointer \"%s\"\n", iter2->first.c_str());
+            // x_debug("                RingBuffer::getReadPointer list avail pointer \"%s\"", iter2->first.c_str());
         }
 
         return 0;
@@ -169,9 +169,9 @@ RingBuffer::storeReadPointer (int pointer_value, CallID call_id)
 
     if (iter != _readpointer.end()) {
         iter->second = pointer_value;
-        // _debug("store read pointer call_id %s, size: %i \n",call_id.c_str(), _readpointer.size());
+        // _debug("store read pointer call_id %s, size: %i ",call_id.c_str(), _readpointer.size());
     } else {
-        _debug ("storeReadPointer: Cannot find \"%s\" readPointer in \"%s\" ringbuffer\n", call_id.c_str(), buffer_id.c_str());
+        _debug ("storeReadPointer: Cannot find \"%s\" readPointer in \"%s\" ringbuffer", call_id.c_str(), buffer_id.c_str());
     }
 
 }
@@ -181,10 +181,10 @@ void
 RingBuffer::createReadPointer (CallID call_id)
 {
 
-    _debug ("---- createReadPointer ringbuffer_id %s, call_id %s\n", buffer_id.c_str(), call_id.c_str());
+    _debug ("---- createReadPointer ringbuffer_id %s, call_id %s", buffer_id.c_str(), call_id.c_str());
 
     _readpointer.insert (pair<CallID, int> (call_id, mEnd));
-    _debug ("---- createReadPointer ringbuffer_id %s, size %i\n", buffer_id.c_str(), (int) _readpointer.size());
+    _debug ("---- createReadPointer ringbuffer_id %s, size %i", buffer_id.c_str(), (int) _readpointer.size());
 
 }
 
@@ -193,10 +193,10 @@ void
 RingBuffer::removeReadPointer (CallID call_id)
 {
 
-    _debug ("---- removeReadPointer ringbuffer_id %s, call_id %s\n", buffer_id.c_str(), call_id.c_str());
+    _debug ("---- removeReadPointer ringbuffer_id %s, call_id %s", buffer_id.c_str(), call_id.c_str());
 
     _readpointer.erase (call_id);
-    _debug ("---- removeReadPointer ringbuffer_id %s, size %i\n", buffer_id.c_str(), (int) _readpointer.size());
+    _debug ("---- removeReadPointer ringbuffer_id %s, size %i", buffer_id.c_str(), (int) _readpointer.size());
 
 }
 
@@ -227,8 +227,8 @@ int
 RingBuffer::AvailForPut()
 {
     // Always keep 4 bytes safe (?)
-    // z_debug("RingBuffer::AvailForPut: putLen %i\n", putLen());
-    // _debug("RingBuffer::AvailForPut %s --------------------\n", buffer_id.c_str());
+    // z_debug("RingBuffer::AvailForPut: putLen %i", putLen());
+    // _debug("RingBuffer::AvailForPut %s --------------------", buffer_id.c_str());
     return (mBufferSize-4) - putLen();
 }
 
@@ -241,9 +241,9 @@ RingBuffer::Put (void* buffer, int toCopy, unsigned short volume)
     int block;
     int copied;
     int pos;
-    // _debug("RingBuffer::Put buffer_id %s, call_id %s --------------------\n", buffer_id.c_str(), call_id.c_str());
+    // _debug("RingBuffer::Put buffer_id %s, call_id %s --------------------", buffer_id.c_str(), call_id.c_str());
     int len = putLen();
-    // _debug("    RingBuffer::Put bufferid %s, putlen %i\n", buffer_id.c_str(), len);
+    // _debug("    RingBuffer::Put bufferid %s, putlen %i", buffer_id.c_str(), len);
 
     if (toCopy > (mBufferSize-4) - len)
         toCopy = (mBufferSize-4) - len;
@@ -302,7 +302,7 @@ int
 RingBuffer::AvailForGet (CallID call_id)
 {
     // Used space
-    // _debug("RingBuffer::AvailForGet buffer_id %s, call_id %s --------------------\n", buffer_id.c_str(), call_id.c_str());
+    // _debug("RingBuffer::AvailForGet buffer_id %s, call_id %s --------------------", buffer_id.c_str(), call_id.c_str());
     return getLen (call_id);
 }
 
@@ -323,10 +323,10 @@ RingBuffer::Get (void *buffer, int toCopy, unsigned short volume, CallID call_id
 
     int copied;
 
-    // _debug("RingBuffer::Get buffer_id %s, call_id %s --------------------\n", buffer_id.c_str(), call_id.c_str());
+    // _debug("RingBuffer::Get buffer_id %s, call_id %s --------------------", buffer_id.c_str(), call_id.c_str());
     int len = getLen (call_id);
 
-    // _debug("    RingBuffer::Get bufferid %s, getlen %i\n", buffer_id.c_str(), len);
+    // _debug("    RingBuffer::Get bufferid %s, getlen %i", buffer_id.c_str(), len);
 
     if (toCopy > len)
         toCopy = len;
@@ -375,7 +375,7 @@ RingBuffer::Get (void *buffer, int toCopy, unsigned short volume, CallID call_id
 int
 RingBuffer::Discard (int toDiscard, CallID call_id)
 {
-    // _debug("RingBuffer::Discard buffer_id %s, call_id %s --------------------\n", buffer_id.c_str(), call_id.c_str());
+    // _debug("RingBuffer::Discard buffer_id %s, call_id %s --------------------", buffer_id.c_str(), call_id.c_str());
     int len = getLen (call_id);
 
     int mStart = getReadPointer (call_id);
diff --git a/sflphone-common/src/audio/samplerateconverter.cpp b/sflphone-common/src/audio/samplerateconverter.cpp
index 29a3cc286bb27a2da04c38b1087309fd00495fc1..8d115a25560149e1a0b73c54f91d7fea26ace8a3 100644
--- a/sflphone-common/src/audio/samplerateconverter.cpp
+++ b/sflphone-common/src/audio/samplerateconverter.cpp
@@ -104,7 +104,7 @@ int SamplerateConverter::upsampleData (SFLDataFormat* dataIn , SFLDataFormat* da
 {
 
     double upsampleFactor = (double) samplerate2 / samplerate1 ;
-    //_debug("factor = %f\n" , upsampleFactor);
+    //_debug("factor = %f" , upsampleFactor);
     int nbSamplesMax = (int) (samplerate2 * getFramesize() / 1000);
     nbSamplesMax = nbSamplesMax*4;
 
@@ -116,16 +116,16 @@ int SamplerateConverter::upsampleData (SFLDataFormat* dataIn , SFLDataFormat* da
         src_data.output_frames = (int) floor (upsampleFactor * nbSamples);
         src_data.src_ratio = upsampleFactor;
         src_data.end_of_input = 0; // More data will come
-        // _debug("    upsample %d %d %f %d\n" , src_data.input_frames , src_data.output_frames, src_data.src_ratio , nbSamples);
+        // _debug("    upsample %d %d %f %d" , src_data.input_frames , src_data.output_frames, src_data.src_ratio , nbSamples);
         // Override libsamplerate conversion function
         Short2FloatArray (dataIn , _floatBufferDownSpkr, nbSamples);
         //src_short_to_float_array (dataIn , _floatBufferDownSpkr, nbSamples);
-        //_debug("upsample %d %f %d\n" ,  src_data.output_frames, src_data.src_ratio , nbSamples);
+        //_debug("upsample %d %f %d" ,  src_data.output_frames, src_data.src_ratio , nbSamples);
         src_process (_src_state_spkr, &src_data);
-        // _debug("    upsample %d %d %d\n" , samplerate1, samplerate2 , nbSamples);
+        // _debug("    upsample %d %d %d" , samplerate1, samplerate2 , nbSamples);
         nbSamples  = (src_data.output_frames_gen > nbSamplesMax) ? nbSamplesMax : src_data.output_frames_gen;
         src_float_to_short_array (_floatBufferUpSpkr, dataOut, nbSamples);
-        //_debug("upsample %d %d %d\n" , samplerate1, samplerate2 , nbSamples);
+        //_debug("upsample %d %d %d" , samplerate1, samplerate2 , nbSamples);
     }
 
     return nbSamples;
@@ -136,7 +136,7 @@ int SamplerateConverter::downsampleData (SFLDataFormat* dataIn , SFLDataFormat*
 {
 
     double downsampleFactor = (double) samplerate1 / samplerate2;
-    //_debug("factor = %f\n" , downsampleFactor);
+    //_debug("factor = %f" , downsampleFactor);
     int nbSamplesMax = (int) (samplerate1 * getFramesize() / 1000);
 
     nbSamplesMax = nbSamplesMax*4;
@@ -149,15 +149,15 @@ int SamplerateConverter::downsampleData (SFLDataFormat* dataIn , SFLDataFormat*
         src_data.output_frames = (int) floor (downsampleFactor * nbSamples);
         src_data.src_ratio = downsampleFactor;
         src_data.end_of_input = 0; // More data will come
-        //_debug("downsample %d %f %d\n" ,  src_data.output_frames, src_data.src_ratio , nbSamples);
+        //_debug("downsample %d %f %d" ,  src_data.output_frames, src_data.src_ratio , nbSamples);
         // Override libsamplerate conversion function
         Short2FloatArray (dataIn , _floatBufferUpMic, nbSamples);
         //src_short_to_float_array (dataIn, _floatBufferUpMic, nbSamples);
-        //_debug("downsample %d %f %d\n" ,  src_data.output_frames, src_data.src_ratio , nbSamples);
+        //_debug("downsample %d %f %d" ,  src_data.output_frames, src_data.src_ratio , nbSamples);
         src_process (_src_state_mic, &src_data);
-        //_debug("downsample %d %f %d\n" ,  src_data.output_frames, src_data.src_ratio , nbSamples);
+        //_debug("downsample %d %f %d" ,  src_data.output_frames, src_data.src_ratio , nbSamples);
         nbSamples  = (src_data.output_frames_gen > nbSamplesMax) ? nbSamplesMax : src_data.output_frames_gen;
-        //_debug("downsample %d %f %d\n" ,  src_data.output_frames, src_data.src_ratio , nbSamples);
+        //_debug("downsample %d %f %d" ,  src_data.output_frames, src_data.src_ratio , nbSamples);
         src_float_to_short_array (_floatBufferDownMic , dataOut , nbSamples);
     }
 
diff --git a/sflphone-common/src/audio/sound/audiofile.cpp b/sflphone-common/src/audio/sound/audiofile.cpp
index 136938a1a5644f3f56dde8d3933ed6c89feff393..f11b43cbe634026c17109769bd71f6fff15ad5f9 100644
--- a/sflphone-common/src/audio/sound/audiofile.cpp
+++ b/sflphone-common/src/audio/sound/audiofile.cpp
@@ -63,7 +63,7 @@ AudioFile::loadFile (const std::string& filename, AudioCodec* codec , unsigned i
 
     // no filename to load
     if (filename.empty()) {
-        _debug ("Unable to open audio file: filename is empty\n");
+        _debug ("Unable to open audio file: filename is empty");
         return false;
     }
 
@@ -73,7 +73,7 @@ AudioFile::loadFile (const std::string& filename, AudioCodec* codec , unsigned i
 
     if (!file.is_open()) {
         // unable to load the file
-        _debug ("Unable to open audio file %s\n", filename.c_str());
+        _debug ("Unable to open audio file %s", filename.c_str());
         return false;
     }
 
diff --git a/sflphone-common/src/conference.cpp b/sflphone-common/src/conference.cpp
index 6266a30323c8d47f695e03eccd57c774634290cd..667664dfb6ff7bc66ead16cd08a5c353f5d882a8 100644
--- a/sflphone-common/src/conference.cpp
+++ b/sflphone-common/src/conference.cpp
@@ -71,7 +71,7 @@ void Conference::setState (ConferenceState state)
 void Conference::add (CallID participant_id)
 {
 
-    _debug ("---- Conference:: add participant %s\n", participant_id.c_str());
+    _debug ("---- Conference:: add participant %s", participant_id.c_str());
 
     _participants.insert (participant_id);
 
@@ -82,7 +82,7 @@ void Conference::add (CallID participant_id)
 void Conference::remove (CallID participant_id)
 {
 
-    _debug ("---- Conference::remove participant %s\n", participant_id.c_str());
+    _debug ("---- Conference::remove participant %s", participant_id.c_str());
 
     _participants.erase (participant_id);
 
@@ -100,7 +100,7 @@ void Conference::bindParticipant (CallID participant_id)
 
             if (participant_id != (*iter)) {
 
-                _debug ("---- Conference:: bind callid %s with %s in conference add\n", participant_id.c_str(), (*iter).c_str());
+                _debug ("---- Conference:: bind callid %s with %s in conference add", participant_id.c_str(), (*iter).c_str());
                 Manager::instance().getAudioDriver()->getMainBuffer()->bindCallID (participant_id, *iter);
             }
 
@@ -109,7 +109,7 @@ void Conference::bindParticipant (CallID participant_id)
 
     }
 
-    _debug ("---- Conference::bind callid %s with default_id in conference add\n", participant_id.c_str());
+    _debug ("---- Conference::bind callid %s with default_id in conference add", participant_id.c_str());
 
     Manager::instance().getAudioDriver()->getMainBuffer()->bindCallID (participant_id);
 
diff --git a/sflphone-common/src/config/config.cpp b/sflphone-common/src/config/config.cpp
index ec3f7bab8d0aef52ccd09d720cf020b1c3ce558e..e1565119515e2f34d8c92664b4ed204439186295 100644
--- a/sflphone-common/src/config/config.cpp
+++ b/sflphone-common/src/config/config.cpp
@@ -26,6 +26,7 @@
 #include <sys/stat.h>
 #include <errno.h>
 #include <iostream>
+#include <string.h>
 
 namespace Conf
 {
@@ -59,7 +60,6 @@ void ConfigTree::addDefaultValue (const std::pair<std::string, std::string>& tok
 
 std::string ConfigTree::getDefaultValue (const std::string& key)
 {
-    _debug ("Getting default value for %s\n", key.c_str());
     std::map<std::string, std::string>::iterator it;
     it = _defaultValueMap.find (key);
 
@@ -147,8 +147,6 @@ ConfigTree::getConfigTreeItemValue (const std::string& section, const std::strin
         return item->getValue();
     }
 
-    _debug ("Option doesn't exist: [%s] %s\n", section.c_str(), itemName.c_str());
-
     return getDefaultValue (itemName);
 }
 
@@ -292,7 +290,7 @@ ConfigTree::saveConfigTree (const std::string& fileName)
     file.close();
 
     if (chmod (fileName.c_str(), S_IRUSR | S_IWUSR)) {
-        _debug ("Failed to set permission on configuration file because: %s\n",strerror (errno));
+        _debug ("Failed to set permission on configuration file because: %s",strerror (errno));
     }
 
     return true;
@@ -373,7 +371,7 @@ ConfigTree::populateFromFile (const std::string& fileName)
     file.close();
 
     if (chmod (fileName.c_str(), S_IRUSR | S_IWUSR)) {
-        _debug ("Failed to set permission on configuration file because: %s\n",strerror (errno));
+        _debug ("Failed to set permission on configuration file because: %s",strerror (errno));
     }
 
     return 1;
diff --git a/sflphone-common/src/dbus/Makefile.am b/sflphone-common/src/dbus/Makefile.am
index 5ca2e42eeb78da476df2e00f775a9dfae787cdeb..a3c5dbbf0c81d5e11e84f0ec676aaebc8f036be9 100644
--- a/sflphone-common/src/dbus/Makefile.am
+++ b/sflphone-common/src/dbus/Makefile.am
@@ -17,9 +17,16 @@ libdbus_la_SOURCES = \
     callmanager.cpp \
     configurationmanager.cpp  \
     instance.cpp  \
-    dbusmanagerimpl.cpp
+    dbusmanagerimpl.cpp  \
+    networkmanager.cpp
 
-libdbus_la_CXXFLAGS = -DPREFIX=\"$(prefix)\" -DPROGSHAREDIR=\"${datadir}/sflphone\"
+if USE_NETWORKMANAGER
+NETWORKMANAGER=-DUSE_NETWORKMANAGER
+else
+NETWORKMANAGER=
+endif
+
+libdbus_la_CXXFLAGS = -DPREFIX=\"$(prefix)\" -DPROGSHAREDIR=\"${datadir}/sflphone\" $(NETWORKMANAGER)
 
 libdbus_la_LIBADD = $(top_srcdir)/libs/dbus-c++/src/libdbus-c++-1.la
 
@@ -29,6 +36,8 @@ noinst_HEADERS =            \
     instance.h              \
     dbusmanager.h           \
     dbusmanagerimpl.h       \
+    networkmanager_proxy.h  \
+    networkmanager.h        \
     $(BUILT_SOURCES)
 
 # Dbus service file
diff --git a/sflphone-common/src/dbus/callmanager.cpp b/sflphone-common/src/dbus/callmanager.cpp
index 7cb135ff384cfddcdd268426d4bd23aae1ab21bc..3c3306fda8106fe19caf2479ce509c0346e3591c 100644
--- a/sflphone-common/src/dbus/callmanager.cpp
+++ b/sflphone-common/src/dbus/callmanager.cpp
@@ -39,31 +39,31 @@ CallManager::placeCall (const std::string& accountID,
                         const std::string& callID,
                         const std::string& to)
 {
-    _debug ("CallManager::placeCall received\n");
+    _debug ("CallManager::placeCall received");
     // Check if a destination number is available
 
-    if (to == "")   _debug ("No number entered - Call stopped\n");
+    if (to == "")   _debug ("No number entered - Call stopped");
     else            Manager::instance().outgoingCall (accountID, callID, to);
 }
 
 void
 CallManager::refuse (const std::string& callID)
 {
-    _debug ("CallManager::refuse received\n");
+    _debug ("CallManager::refuse received");
     Manager::instance().refuseCall (callID);
 }
 
 void
 CallManager::accept (const std::string& callID)
 {
-    _debug ("CallManager::accept received\n");
+    _debug ("CallManager::accept received");
     Manager::instance().answerCall (callID);
 }
 
 void
 CallManager::hangUp (const std::string& callID)
 {
-    _debug ("CallManager::hangUp received %s\n", callID.c_str());
+    _debug ("CallManager::hangUp received %s", callID.c_str());
     Manager::instance().hangupCall (callID);
 
 }
@@ -71,7 +71,7 @@ CallManager::hangUp (const std::string& callID)
 void
 CallManager::hangUpConference (const std::string& confID)
 {
-    _debug ("CallManager::hangUpConference received %s\n", confID.c_str());
+    _debug ("CallManager::hangUpConference received %s", confID.c_str());
     Manager::instance().hangupConference (confID);
 
 }
@@ -80,7 +80,7 @@ CallManager::hangUpConference (const std::string& confID)
 void
 CallManager::hold (const std::string& callID)
 {
-    _debug ("CallManager::hold received %s\n", callID.c_str());
+    _debug ("CallManager::hold received %s", callID.c_str());
     Manager::instance().onHoldCall (callID);
 
 }
@@ -88,14 +88,14 @@ CallManager::hold (const std::string& callID)
 void
 CallManager::unhold (const std::string& callID)
 {
-    _debug ("CallManager::unhold received %s\n", callID.c_str());
+    _debug ("CallManager::unhold received %s", callID.c_str());
     Manager::instance().offHoldCall (callID);
 }
 
 void
 CallManager::transfert (const std::string& callID, const std::string& to)
 {
-    _debug ("CallManager::transfert received\n");
+    _debug ("CallManager::transfert received");
     Manager::instance().transferCall (callID, to);
 }
 
@@ -104,7 +104,7 @@ CallManager::transfert (const std::string& callID, const std::string& to)
 void
 CallManager::setVolume (const std::string& device, const double& value)
 {
-    _debug ("CallManager::setVolume received\n");
+    _debug ("CallManager::setVolume received");
 
     if (device == "speaker") {
         Manager::instance().setSpkrVolume ( (int) (value*100.0));
@@ -118,13 +118,13 @@ CallManager::setVolume (const std::string& device, const double& value)
 double
 CallManager::getVolume (const std::string& device)
 {
-    _debug ("CallManager::getVolume received \n");
+    _debug ("CallManager::getVolume received ");
 
     if (device == "speaker") {
-        _debug ("Current speaker = %d\n", Manager::instance().getSpkrVolume());
+        _debug ("Current speaker = %d", Manager::instance().getSpkrVolume());
         return Manager::instance().getSpkrVolume() /100.0;
     } else if (device == "mic") {
-        _debug ("Current mic = %d\n", Manager::instance().getMicVolume());
+        _debug ("Current mic = %d", Manager::instance().getMicVolume());
         return Manager::instance().getMicVolume() /100.0;
     }
 
@@ -134,63 +134,63 @@ CallManager::getVolume (const std::string& device)
 void
 CallManager::joinParticipant (const std::string& sel_callID, const std::string& drag_callID)
 {
-    _debug ("CallManager::joinParticipant received %s, %s\n", sel_callID.c_str(), drag_callID.c_str());
+    _debug ("CallManager::joinParticipant received %s, %s", sel_callID.c_str(), drag_callID.c_str());
     Manager::instance().joinParticipant (sel_callID, drag_callID);
 }
 
 void
 CallManager::addParticipant (const std::string& callID, const std::string& confID)
 {
-    _debug ("CallManager::addParticipant received %s, %s\n", callID.c_str(), confID.c_str());
+    _debug ("CallManager::addParticipant received %s, %s", callID.c_str(), confID.c_str());
     Manager::instance().addParticipant (callID, confID);
 }
 
 void
 CallManager::addMainParticipant (const std::string& confID)
 {
-    _debug ("CallManager::addMainParticipant received %s\n", confID.c_str());
+    _debug ("CallManager::addMainParticipant received %s", confID.c_str());
     Manager::instance().addMainParticipant (confID);
 }
 
 void
 CallManager::detachParticipant (const std::string& callID)
 {
-    _debug ("CallManager::detachParticipant received %s\n", callID.c_str());
+    _debug ("CallManager::detachParticipant received %s", callID.c_str());
     Manager::instance().detachParticipant (callID, "");
 }
 
 void
 CallManager::joinConference (const std::string& sel_confID, const std::string& drag_confID)
 {
-    _debug ("CallManager::joinConference received %s, %s\n", sel_confID.c_str(), drag_confID.c_str());
+    _debug ("CallManager::joinConference received %s, %s", sel_confID.c_str(), drag_confID.c_str());
     Manager::instance().joinConference (sel_confID, drag_confID);
 }
 
 void
 CallManager::holdConference (const std::string& confID)
 {
-    _debug ("CallManager::holdConference received %s\n", confID.c_str());
+    _debug ("CallManager::holdConference received %s", confID.c_str());
     Manager::instance().holdConference (confID);
 }
 
 void
 CallManager::unholdConference (const std::string& confID)
 {
-    _debug ("CallManager::unHoldConference received %s\n", confID.c_str());
+    _debug ("CallManager::unHoldConference received %s", confID.c_str());
     Manager::instance().unHoldConference (confID);
 }
 
 std::map< std::string, std::string >
 CallManager::getConferenceDetails (const std::string& callID)
 {
-    _debug ("CallManager::getCallDetails received\n");
+    _debug ("CallManager::getCallDetails received");
     return Manager::instance().getConferenceDetails (callID);
 }
 
 std::vector< std::string >
 CallManager::getConferenceList (void)
 {
-    _debug ("CallManager::getConferenceList\n");
+    _debug ("CallManager::getConferenceList");
     return Manager::instance().getConferenceList();
 }
 
@@ -203,14 +203,14 @@ CallManager::getParticipantList (const std::string& confID)
 void
 CallManager::setRecording (const std::string& callID)
 {
-    _debug ("CallManager::setRecording received\n");
+    _debug ("CallManager::setRecording received");
     Manager::instance().setRecordingCall (callID);
 }
 
 bool
 CallManager::getIsRecording (const std::string& callID)
 {
-    _debug ("CallManager::getIsRecording received \n");
+    _debug ("CallManager::getIsRecording received ");
     return Manager::instance().isRecording (callID);
 }
 
@@ -218,7 +218,7 @@ CallManager::getIsRecording (const std::string& callID)
 std::string
 CallManager::getCurrentCodecName (const std::string& callID)
 {
-    _debug ("CallManager::getCurrentCodecName received %s \n",Manager::instance().getCurrentCodecName (callID).c_str());
+    _debug ("CallManager::getCurrentCodecName received %s ",Manager::instance().getCurrentCodecName (callID).c_str());
     return Manager::instance().getCurrentCodecName (callID).c_str();
 }
 
@@ -226,7 +226,7 @@ CallManager::getCurrentCodecName (const std::string& callID)
 std::map< std::string, std::string >
 CallManager::getCallDetails (const std::string& callID)
 {
-    _debug ("CallManager::getCallDetails received\n");
+    _debug ("CallManager::getCallDetails received");
     return Manager::instance().getCallDetails (callID);
 }
 
@@ -239,7 +239,7 @@ CallManager::getCallList (void)
 std::string
 CallManager::getCurrentCallID()
 {
-    _debug ("CallManager::getCurrentCallID received\n");
+    _debug ("CallManager::getCurrentCallID received");
     return Manager::instance().getCurrentCallId();
 }
 
@@ -271,7 +271,7 @@ sfl::AudioZrtpSession * CallManager::getAudioZrtpSession (const std::string& cal
     link = dynamic_cast<SIPVoIPLink *> (Manager::instance().getAccountLink (AccountNULL));
 
     if (link == NULL) {
-        _debug ("Failed to get sip link\n");
+        _debug ("Failed to get sip link");
         throw CallManagerException();
     }
 
@@ -281,7 +281,7 @@ sfl::AudioZrtpSession * CallManager::getAudioZrtpSession (const std::string& cal
     audioRtp = call->getAudioRtp();
 
     if (audioRtp == NULL) {
-        _debug ("Failed to get AudioRtpFactory\n");
+        _debug ("Failed to get AudioRtpFactory");
         throw CallManagerException();
     }
 
@@ -290,7 +290,7 @@ sfl::AudioZrtpSession * CallManager::getAudioZrtpSession (const std::string& cal
     zSession = audioRtp->getAudioZrtpSession();
 
     if (zSession == NULL) {
-        _debug ("Failed to get AudioZrtpSession\n");
+        _debug ("Failed to get AudioZrtpSession");
         throw CallManagerException();
     }
 
@@ -300,7 +300,7 @@ sfl::AudioZrtpSession * CallManager::getAudioZrtpSession (const std::string& cal
 void
 CallManager::setSASVerified (const std::string& callID)
 {
-    _debug ("CallManager::setSASVerified received for account %s\n", callID.c_str());
+    _debug ("CallManager::setSASVerified received for account %s", callID.c_str());
 
     try {
         sfl::AudioZrtpSession * zSession;
@@ -315,7 +315,7 @@ CallManager::setSASVerified (const std::string& callID)
 void
 CallManager::resetSASVerified (const std::string& callID)
 {
-    _debug ("CallManager::resetSASVerified received for account %s\n", callID.c_str());
+    _debug ("CallManager::resetSASVerified received for account %s", callID.c_str());
 
     try {
         sfl::AudioZrtpSession * zSession;
@@ -330,7 +330,7 @@ CallManager::resetSASVerified (const std::string& callID)
 void
 CallManager::setConfirmGoClear (const std::string& callID)
 {
-    _debug ("CallManager::setConfirmGoClear received for account %s\n", callID.c_str());
+    _debug ("CallManager::setConfirmGoClear received for account %s", callID.c_str());
 
     try {
         sfl::AudioZrtpSession * zSession;
@@ -345,7 +345,7 @@ CallManager::setConfirmGoClear (const std::string& callID)
 void
 CallManager::requestGoClear (const std::string& callID)
 {
-    _debug ("CallManager::requestGoClear received for account %s\n", callID.c_str());
+    _debug ("CallManager::requestGoClear received for account %s", callID.c_str());
 
     try {
         sfl::AudioZrtpSession * zSession;
@@ -361,7 +361,7 @@ void
 CallManager::acceptEnrollment (const std::string& callID, const bool& accepted)
 {
 
-    _debug ("CallManager::acceptEnrollment received for account %s\n", callID.c_str());
+    _debug ("CallManager::acceptEnrollment received for account %s", callID.c_str());
 
     try {
         sfl::AudioZrtpSession * zSession;
@@ -377,7 +377,7 @@ void
 CallManager::setPBXEnrollment (const std::string& callID, const bool& yesNo)
 {
 
-    _debug ("CallManager::setPBXEnrollment received for account %s\n", callID.c_str());
+    _debug ("CallManager::setPBXEnrollment received for account %s", callID.c_str());
 
     try {
         sfl::AudioZrtpSession * zSession;
diff --git a/sflphone-common/src/dbus/configurationmanager.cpp b/sflphone-common/src/dbus/configurationmanager.cpp
index 8b36efbca5fb58833aa10c7e6ad31aeb1f9b84d8..e381e6d13d91cd1a7c3bb8854a967e9dc74e286e 100644
--- a/sflphone-common/src/dbus/configurationmanager.cpp
+++ b/sflphone-common/src/dbus/configurationmanager.cpp
@@ -38,14 +38,14 @@ ConfigurationManager::ConfigurationManager (DBus::Connection& connection)
 std::map< std::string, std::string >
 ConfigurationManager::getAccountDetails (const std::string& accountID)
 {
-    _debug ("ConfigurationManager::getAccountDetails\n");
+    _debug ("ConfigurationManager::getAccountDetails");
     return Manager::instance().getAccountDetails (accountID);
 }
 
 std::map< std::string, std::string >
 ConfigurationManager::getTlsSettingsDefault (void)
 {
-    _debug ("ConfigurationManager::getTlsDefaultSettings\n");
+    _debug ("ConfigurationManager::getTlsDefaultSettings");
 
     std::map<std::string, std::string> tlsSettingsDefault;
     tlsSettingsDefault.insert (std::pair<std::string, std::string> (TLS_CA_LIST_FILE, ""));
@@ -272,7 +272,7 @@ ConfigurationManager::setTlsSettings (const std::string& section, const std::map
 std::map< std::string, std::string >
 ConfigurationManager::getCredential (const std::string& accountID, const int32_t& index)
 {
-    _debug ("ConfigurationManager::getCredential number %i for accountID %s\n", index, accountID.c_str());
+    _debug ("ConfigurationManager::getCredential number %i for accountID %s", index, accountID.c_str());
 
     std::string credentialIndex;
     std::stringstream streamOut;
@@ -296,7 +296,7 @@ ConfigurationManager::getCredential (const std::string& accountID, const int32_t
 int32_t
 ConfigurationManager::getNumberOfCredential (const std::string& accountID)
 {
-    _debug ("ConfigurationManager::getNumberOfCredential\n");
+    _debug ("ConfigurationManager::getNumberOfCredential");
     return Manager::instance().getConfigInt (accountID, CONFIG_CREDENTIAL_NUMBER);
 }
 
@@ -312,14 +312,14 @@ void
 ConfigurationManager::setCredential (const std::string& accountID, const int32_t& index,
                                      const std::map< std::string, std::string >& details)
 {
-    _debug ("ConfigurationManager::setCredential received\n");
+    _debug ("ConfigurationManager::setCredential received");
     Manager::instance().setCredential (accountID, index, details);
 }
 
 void
 ConfigurationManager::deleteAllCredential (const std::string& accountID)
 {
-    _debug ("ConfigurationManager::deleteAllCredential received\n");
+    _debug ("ConfigurationManager::deleteAllCredential received");
     Manager::instance().deleteAllCredential (accountID);
 }
 
@@ -327,21 +327,21 @@ void
 ConfigurationManager::setAccountDetails (const std::string& accountID,
         const std::map< std::string, std::string >& details)
 {
-    _debug ("ConfigurationManager::setAccountDetails received\n");
+    _debug ("ConfigurationManager::setAccountDetails received");
     Manager::instance().setAccountDetails (accountID, details);
 }
 
 void
 ConfigurationManager::sendRegister (const std::string& accountID, const int32_t& expire)
 {
-    _debug ("ConfigurationManager::sendRegister received\n");
+    _debug ("ConfigurationManager::sendRegister received");
     Manager::instance().sendRegister (accountID, expire);
 }
 
 std::string
 ConfigurationManager::addAccount (const std::map< std::string, std::string >& details)
 {
-    _debug ("ConfigurationManager::addAccount received\n");
+    _debug ("ConfigurationManager::addAccount received");
     return Manager::instance().addAccount (details);
 }
 
@@ -349,14 +349,14 @@ ConfigurationManager::addAccount (const std::map< std::string, std::string >& de
 void
 ConfigurationManager::removeAccount (const std::string& accoundID)
 {
-    _debug ("ConfigurationManager::removeAccount received\n");
+    _debug ("ConfigurationManager::removeAccount received");
     return Manager::instance().removeAccount (accoundID);
 }
 
 std::vector< std::string >
 ConfigurationManager::getAccountList()
 {
-    _debug ("ConfigurationManager::getAccountList received\n");
+    _debug ("ConfigurationManager::getAccountList received");
     return Manager::instance().getAccountList();
 }
 
@@ -365,7 +365,7 @@ std::vector< std::string >
 ConfigurationManager::getToneLocaleList()
 {
     std::vector< std::string > ret;
-    _debug ("ConfigurationManager::getToneLocaleList received\n");
+    _debug ("ConfigurationManager::getToneLocaleList received");
     return ret;
 }
 
@@ -374,7 +374,7 @@ std::string
 ConfigurationManager::getVersion()
 {
     std::string ret ("");
-    _debug ("ConfigurationManager::getVersion received\n");
+    _debug ("ConfigurationManager::getVersion received");
     return ret;
 }
 
@@ -383,7 +383,7 @@ std::vector< std::string >
 ConfigurationManager::getRingtoneList()
 {
     std::vector< std::string >  ret;
-    _debug ("ConfigurationManager::getRingtoneList received\n");
+    _debug ("ConfigurationManager::getRingtoneList received");
     return ret;
 }
 
@@ -392,14 +392,14 @@ ConfigurationManager::getRingtoneList()
 std::vector< std::string  >
 ConfigurationManager::getCodecList (void)
 {
-    _debug ("ConfigurationManager::getCodecList received\n");
+    _debug ("ConfigurationManager::getCodecList received");
     return Manager::instance().getCodecList();
 }
 
 std::vector<std::string>
 ConfigurationManager::getSupportedTlsMethod (void)
 {
-    _debug ("ConfigurationManager::getSupportedTlsMethod received\n");
+    _debug ("ConfigurationManager::getSupportedTlsMethod received");
     std::vector<std::string> method;
     method.push_back ("Default");
     method.push_back ("TLSv1");
@@ -412,21 +412,21 @@ ConfigurationManager::getSupportedTlsMethod (void)
 std::vector< std::string >
 ConfigurationManager::getCodecDetails (const int32_t& payload)
 {
-    _debug ("ConfigurationManager::getCodecDetails received\n");
+    _debug ("ConfigurationManager::getCodecDetails received");
     return Manager::instance().getCodecDetails (payload);
 }
 
 std::vector< std::string >
 ConfigurationManager::getActiveCodecList()
 {
-    _debug ("ConfigurationManager::getActiveCodecList received\n");
+    _debug ("ConfigurationManager::getActiveCodecList received");
     return Manager::instance().getActiveCodecList();
 }
 
 void
 ConfigurationManager::setActiveCodecList (const std::vector< std::string >& list)
 {
-    _debug ("ConfigurationManager::setActiveCodecList received\n");
+    _debug ("ConfigurationManager::setActiveCodecList received");
     Manager::instance().setActiveCodecList (list);
 }
 
@@ -434,77 +434,77 @@ ConfigurationManager::setActiveCodecList (const std::vector< std::string >& list
 std::vector< std::string >
 ConfigurationManager::getInputAudioPluginList()
 {
-    _debug ("ConfigurationManager::getInputAudioPluginList received\n");
+    _debug ("ConfigurationManager::getInputAudioPluginList received");
     return Manager::instance().getInputAudioPluginList();
 }
 
 std::vector< std::string >
 ConfigurationManager::getOutputAudioPluginList()
 {
-    _debug ("ConfigurationManager::getOutputAudioPluginList received\n");
+    _debug ("ConfigurationManager::getOutputAudioPluginList received");
     return Manager::instance().getOutputAudioPluginList();
 }
 
 void
 ConfigurationManager::setInputAudioPlugin (const std::string& audioPlugin)
 {
-    _debug ("ConfigurationManager::setInputAudioPlugin received\n");
+    _debug ("ConfigurationManager::setInputAudioPlugin received");
     return Manager::instance().setInputAudioPlugin (audioPlugin);
 }
 
 void
 ConfigurationManager::setOutputAudioPlugin (const std::string& audioPlugin)
 {
-    _debug ("ConfigurationManager::setOutputAudioPlugin received\n");
+    _debug ("ConfigurationManager::setOutputAudioPlugin received");
     return Manager::instance().setOutputAudioPlugin (audioPlugin);
 }
 
 std::vector< std::string >
 ConfigurationManager::getAudioOutputDeviceList()
 {
-    _debug ("ConfigurationManager::getAudioOutputDeviceList received\n");
+    _debug ("ConfigurationManager::getAudioOutputDeviceList received");
     return Manager::instance().getAudioOutputDeviceList();
 }
 
 void
 ConfigurationManager::setAudioOutputDevice (const int32_t& index)
 {
-    _debug ("ConfigurationManager::setAudioOutputDevice received\n");
+    _debug ("ConfigurationManager::setAudioOutputDevice received");
     return Manager::instance().setAudioOutputDevice (index);
 }
 
 std::vector< std::string >
 ConfigurationManager::getAudioInputDeviceList()
 {
-    _debug ("ConfigurationManager::getAudioInputDeviceList received\n");
+    _debug ("ConfigurationManager::getAudioInputDeviceList received");
     return Manager::instance().getAudioInputDeviceList();
 }
 
 void
 ConfigurationManager::setAudioInputDevice (const int32_t& index)
 {
-    _debug ("ConfigurationManager::setAudioInputDevice received\n");
+    _debug ("ConfigurationManager::setAudioInputDevice received");
     return Manager::instance().setAudioInputDevice (index);
 }
 
 std::vector< std::string >
 ConfigurationManager::getCurrentAudioDevicesIndex()
 {
-    _debug ("ConfigurationManager::getCurrentAudioDeviceIndex received\n");
+    _debug ("ConfigurationManager::getCurrentAudioDeviceIndex received");
     return Manager::instance().getCurrentAudioDevicesIndex();
 }
 
 int32_t
 ConfigurationManager::getAudioDeviceIndex (const std::string& name)
 {
-    _debug ("ConfigurationManager::getAudioDeviceIndex received\n");
+    _debug ("ConfigurationManager::getAudioDeviceIndex received");
     return Manager::instance().getAudioDeviceIndex (name);
 }
 
 std::string
 ConfigurationManager::getCurrentAudioOutputPlugin (void)
 {
-    _debug ("ConfigurationManager::getCurrentAudioOutputPlugin received\n");
+    _debug ("ConfigurationManager::getCurrentAudioOutputPlugin received");
     return Manager::instance().getCurrentAudioOutputPlugin();
 }
 
@@ -513,7 +513,7 @@ std::vector< std::string >
 ConfigurationManager::getPlaybackDeviceList()
 {
     std::vector< std::string >  ret;
-    _debug ("ConfigurationManager::getPlaybackDeviceList received\n");
+    _debug ("ConfigurationManager::getPlaybackDeviceList received");
     return ret;
 }
 
@@ -521,7 +521,7 @@ std::vector< std::string >
 ConfigurationManager::getRecordDeviceList()
 {
     std::vector< std::string >  ret;
-    _debug ("ConfigurationManager::getRecordDeviceList received\n");
+    _debug ("ConfigurationManager::getRecordDeviceList received");
     return ret;
 
 }
@@ -647,70 +647,70 @@ std::string ConfigurationManager::getHistoryEnabled (void)
 void
 ConfigurationManager::startHidden (void)
 {
-    _debug ("Manager received startHidden\n");
+    _debug ("Manager received startHidden");
     Manager::instance().startHidden();
 }
 
 int32_t
 ConfigurationManager::isStartHidden (void)
 {
-    _debug ("Manager received isStartHidden\n");
+    _debug ("Manager received isStartHidden");
     return Manager::instance().isStartHidden();
 }
 
 void
 ConfigurationManager::switchPopupMode (void)
 {
-    _debug ("Manager received switchPopupMode\n");
+    _debug ("Manager received switchPopupMode");
     Manager::instance().switchPopupMode();
 }
 
 int32_t
 ConfigurationManager::popupMode (void)
 {
-    _debug ("Manager received popupMode\n");
+    _debug ("Manager received popupMode");
     return Manager::instance().popupMode();
 }
 
 void
 ConfigurationManager::setNotify (void)
 {
-    _debug ("Manager received setNotify\n");
+    _debug ("Manager received setNotify");
     Manager::instance().setNotify();
 }
 
 int32_t
 ConfigurationManager::getNotify (void)
 {
-    _debug ("Manager received getNotify\n");
+    _debug ("Manager received getNotify");
     return Manager::instance().getNotify();
 }
 
 void
 ConfigurationManager::setAudioManager (const int32_t& api)
 {
-    _debug ("Manager received setAudioManager\n");
+    _debug ("Manager received setAudioManager");
     Manager::instance().setAudioManager (api);
 }
 
 int32_t
 ConfigurationManager::getAudioManager (void)
 {
-    _debug ("Manager received getAudioManager\n");
+    _debug ("Manager received getAudioManager");
     return Manager::instance().getAudioManager();
 }
 
 void
 ConfigurationManager::setMailNotify (void)
 {
-    _debug ("Manager received setMailNotify\n");
+    _debug ("Manager received setMailNotify");
     Manager::instance().setMailNotify();
 }
 
 int32_t
 ConfigurationManager::getMailNotify (void)
 {
-    _debug ("Manager received getMailNotify\n");
+    _debug ("Manager received getMailNotify");
     return Manager::instance().getMailNotify();
 }
 
@@ -725,7 +725,7 @@ ConfigurationManager::getSipAddress (void)
 void
 ConfigurationManager::setSipAddress (const std::string& address)
 {
-    _debug ("Manager received setSipAddress: %s\n", address.c_str());
+    _debug ("Manager received setSipAddress: %s", address.c_str());
     Manager::instance().setLocalIp2IpInfo (address);
 }
 
@@ -746,7 +746,7 @@ std::vector< std::string > ConfigurationManager::getAddressbookList (void)
 
 void ConfigurationManager::setAddressbookList (const std::vector< std::string >& list)
 {
-    _debug ("Manager received setAddressbookList\n") ;
+    _debug ("Manager received setAddressbookList") ;
     Manager::instance().setAddressbookList (list);
 }
 
@@ -777,7 +777,7 @@ void ConfigurationManager::setHistory (const std::map <std::string, std::string>
 
 std::vector<std::string> ConfigurationManager::getAllIpInterface (void)
 {
-    _debug ("ConfigurationManager::getAllIpInterface received\n");
+    _debug ("ConfigurationManager::getAllIpInterface received");
 
     std::vector<std::string> vector;
     SIPVoIPLink * sipLink = NULL;
diff --git a/sflphone-common/src/dbus/dbusmanagerimpl.cpp b/sflphone-common/src/dbus/dbusmanagerimpl.cpp
index e87c1001f0f7513b873061c1daecce2122eef7f4..bfcc237ca369d02225fefb68023f0a62bc2877cc 100644
--- a/sflphone-common/src/dbus/dbusmanagerimpl.cpp
+++ b/sflphone-common/src/dbus/dbusmanagerimpl.cpp
@@ -23,6 +23,7 @@
 
 #include "callmanager.h"
 #include "configurationmanager.h"
+#include "networkmanager.h"
 
 const char* DBusManagerImpl::SERVER_NAME = "org.sflphone.SFLphone";
 
@@ -32,17 +33,22 @@ DBusManagerImpl::exec()
 
     DBus::default_dispatcher = &_dispatcher;
 
-    DBus::Connection conn = DBus::Connection::SessionBus();
-    conn.request_name (SERVER_NAME);
+    DBus::Connection sessionConnection = DBus::Connection::SessionBus();
+    DBus::Connection systemConnection = DBus::Connection::SystemBus();
+    sessionConnection.request_name (SERVER_NAME);
 
-    _callManager = new CallManager (conn);
-    _configurationManager = new ConfigurationManager (conn);
-    _instanceManager = new Instance (conn);
+    _callManager = new CallManager (sessionConnection);
+    _configurationManager = new ConfigurationManager (sessionConnection);
+    _instanceManager = new Instance (sessionConnection);
+
+#ifdef USE_NETWORKMANAGER
+    _networkManager = new NetworkManager(systemConnection, "/org/freedesktop/NetworkManager", "");
+#endif
 
     // Register accounts
     Manager::instance().initRegisterAccounts(); //getEvents();
 
-    _debug ("Starting DBus event loop\n");
+    _debug ("Starting DBus event loop");
     _dispatcher.enter();
 
     return 1;
diff --git a/sflphone-common/src/dbus/dbusmanagerimpl.h b/sflphone-common/src/dbus/dbusmanagerimpl.h
index 157b8118cef5d5410d5a49594e785c6c836b1639..c68d440fa375f9951f877c8d44443bc7a24b451c 100644
--- a/sflphone-common/src/dbus/dbusmanagerimpl.h
+++ b/sflphone-common/src/dbus/dbusmanagerimpl.h
@@ -24,6 +24,7 @@
 
 class ConfigurationManager;
 class CallManager;
+class NetworkManager;
 
 class DBusManagerImpl {
     public:
@@ -38,6 +39,7 @@ class DBusManagerImpl {
         ConfigurationManager* _configurationManager;
         Instance*             _instanceManager;
         DBus::BusDispatcher   _dispatcher;
+	NetworkManager* _networkManager;
 };
 
 #endif
diff --git a/sflphone-common/src/dbus/instance.cpp b/sflphone-common/src/dbus/instance.cpp
index 233978ae630d03f1425977a42a3ba1a1b309389c..e70322d6fc19c5426cd8037f4942a4c975a3a616 100644
--- a/sflphone-common/src/dbus/instance.cpp
+++ b/sflphone-common/src/dbus/instance.cpp
@@ -32,7 +32,7 @@ void
 Instance::Register (const int32_t& pid UNUSED,
                     const std::string& name UNUSED)
 {
-    _debug ("Instance::register received\n");
+    _debug ("Instance::register received");
     count++;
 }
 
@@ -40,7 +40,7 @@ Instance::Register (const int32_t& pid UNUSED,
 void
 Instance::Unregister (const int32_t& pid UNUSED)
 {
-    _debug ("Instance::unregister received\n");
+    _debug ("Instance::unregister received");
     count --;
 
     if (count <= 0) {
diff --git a/sflphone-common/src/dbus/networkmanager.cpp b/sflphone-common/src/dbus/networkmanager.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4b1f0b2a50c48e66beaccba0270e0175ae5f17a4
--- /dev/null
+++ b/sflphone-common/src/dbus/networkmanager.cpp
@@ -0,0 +1,80 @@
+/*
+ *  Copyright (C) 2004-2009 Savoir-Faire Linux inc.
+ *  Author: Julien Bonjean <julien.bonjean@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.
+ */
+
+#ifdef USE_NETWORKMANAGER
+
+#include <global.h>
+#include "networkmanager.h"
+#include <iostream>
+#include <instance.h>
+#include "../manager.h"
+
+using namespace std;
+
+const string NetworkManager::statesString[5] = {"unknown", "asleep", "connecting", "connected", "disconnected"};
+
+string NetworkManager::stateAsString(const uint32_t& state)
+{
+	return statesString[state];
+}
+
+void NetworkManager::StateChanged(const uint32_t& state)
+{
+	_warn("Network state changed: %s", stateAsString(state).c_str());
+}
+
+void NetworkManager::PropertiesChanged(const std::map< std::string, ::DBus::Variant >& argin0)
+{
+	const map< string, ::DBus::Variant >::const_iterator iter = argin0.begin();
+
+	string message = iter->first;
+
+	_warn("Properties changed: %s", iter->first.c_str());
+/*
+	DBus::Variant variant = iter->second;
+	DBus::MessageIter i = variant.reader();
+	cout << i.type() << endl;// 97
+	cout << (char )i.type() << endl;
+	cout << (char)i.array_type() << endl;
+
+	cout << i.is_array() << endl;// 1
+	cout << i.is_dict() << endl;// 0
+	cout << i.array_type() << endl;// 111
+
+	int size;
+	::DBus::Path* value = new ::DBus::Path[10];
+	size = i.get_array(value);
+	cout << "length: " << size << endl;
+
+	while (!i.at_end())
+	{
+		char **array = new char*[2];
+		size_t length = i.get_array(&array);
+		cout << "length: " << length << endl;
+		i = i.recurse();
+	}
+*/
+	Manager::instance().registerAccounts();
+}
+
+NetworkManager::NetworkManager(DBus::Connection& connection, const DBus::Path& path, const char* destination): DBus::ObjectProxy (connection, path, destination)
+{
+}
+
+#endif
diff --git a/sflphone-common/src/dbus/networkmanager.h b/sflphone-common/src/dbus/networkmanager.h
new file mode 100644
index 0000000000000000000000000000000000000000..bf18e15c6319a5bd66d9bb271ee333749395393c
--- /dev/null
+++ b/sflphone-common/src/dbus/networkmanager.h
@@ -0,0 +1,51 @@
+/*
+ *  Copyright (C) 2004-2009 Savoir-Faire Linux inc.
+ *  Author: Julien Bonjean <julien.bonjean@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.
+ */
+
+#ifndef NETWORKMANAGER_H
+#define NETWORKMANAGER_H
+
+#include "networkmanager_proxy.h"
+
+using namespace std;
+
+class NetworkManager
+: public org::freedesktop::NetworkManager_proxy,
+  public DBus::IntrospectableProxy,
+  public DBus::ObjectProxy
+{
+public:
+
+    NetworkManager(DBus::Connection&, const DBus::Path&, const char*);
+    void StateChanged(const uint32_t& state);
+    void PropertiesChanged(const std::map< std::string, ::DBus::Variant >& argin0);
+    string stateAsString(const uint32_t& state);
+
+    enum NMState
+    {
+        NM_STATE_UNKNOWN = 0,
+        NM_STATE_ASLEEP,
+        NM_STATE_CONNECTING,
+        NM_STATE_CONNECTED,
+        NM_STATE_DISCONNECTED
+    };
+
+   static const string statesString[5];
+};
+#endif
+
diff --git a/sflphone-common/src/dbus/networkmanager_proxy.h b/sflphone-common/src/dbus/networkmanager_proxy.h
new file mode 100644
index 0000000000000000000000000000000000000000..078925ceff22c9e0ebd0e21cf90868ab4b2da370
--- /dev/null
+++ b/sflphone-common/src/dbus/networkmanager_proxy.h
@@ -0,0 +1,78 @@
+
+/*
+ *	This file was automatically generated by dbusxx-xml2cpp; DO NOT EDIT!
+ */
+
+#ifndef __dbusxx__networkmanager_proxy_h__PROXY_MARSHAL_H
+#define __dbusxx__networkmanager_proxy_h__PROXY_MARSHAL_H
+
+#include <dbus-c++/dbus.h>
+#include <cassert>
+
+namespace org {
+namespace freedesktop {
+
+class NetworkManager_proxy
+: public ::DBus::InterfaceProxy
+{
+public:
+
+    NetworkManager_proxy()
+    : ::DBus::InterfaceProxy("org.freedesktop.NetworkManager")
+    {
+        connect_signal(NetworkManager_proxy, StateChanged, _StateChanged_stub);
+        connect_signal(NetworkManager_proxy, PropertiesChanged, _PropertiesChanged_stub);
+    }
+
+public:
+
+    /* properties exported by this interface */
+public:
+
+    /* methods exported by this interface,
+     * this functions will invoke the corresponding methods on the remote objects
+     */
+    std::vector< ::DBus::Path > GetDevices()
+    {
+        ::DBus::CallMessage call;
+        call.member("GetDevices");
+        ::DBus::Message ret = invoke_method (call);
+        ::DBus::MessageIter ri = ret.reader();
+
+        std::vector< ::DBus::Path > argout;
+        ri >> argout;
+        return argout;
+    }
+
+
+public:
+
+    /* signal handlers for this interface
+     */
+    virtual void StateChanged(const uint32_t& argin0) = 0;
+    virtual void PropertiesChanged(const std::map< std::string, ::DBus::Variant >& argin0) = 0;
+
+private:
+
+    /* unmarshalers (to unpack the DBus message before calling the actual signal handler)
+     */
+    void _StateChanged_stub(const ::DBus::SignalMessage &sig)
+    {
+        ::DBus::MessageIter ri = sig.reader();
+
+        uint32_t arg0;
+        ri >> arg0;
+        StateChanged(arg0);
+    }
+    void _PropertiesChanged_stub(const ::DBus::SignalMessage &sig)
+    {
+        ::DBus::MessageIter ri = sig.reader();
+
+        std::map< std::string, ::DBus::Variant > arg0;
+        ri >> arg0;
+        PropertiesChanged(arg0);
+    }
+};
+
+} } 
+#endif //__dbusxx__networkmanager_proxy_h__PROXY_MARSHAL_H
diff --git a/sflphone-common/src/dbus/org.freedesktop.NetworkManager.xml b/sflphone-common/src/dbus/org.freedesktop.NetworkManager.xml
new file mode 100644
index 0000000000000000000000000000000000000000..591fb7b8edb61bbf3dd0ac5bdad85ae338fda3ee
--- /dev/null
+++ b/sflphone-common/src/dbus/org.freedesktop.NetworkManager.xml
@@ -0,0 +1,16 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+  <interface name="org.freedesktop.NetworkManager">
+    <method name="GetDevices">
+      <arg name="devices" type="ao" direction="out"/>
+    </method>
+    <signal name="StateChanged">
+      <arg type="u"/>
+    </signal>
+    <signal name="PropertiesChanged">
+      <arg type="a{sv}"/>
+    </signal>
+  </interface>
+</node>
+
diff --git a/sflphone-common/src/global.h b/sflphone-common/src/global.h
index 12529fe3ef86a7f11f055cee864452d9425e06b2..474d08b0f39087de2e815f95f1aeaecef47c7040 100644
--- a/sflphone-common/src/global.h
+++ b/sflphone-common/src/global.h
@@ -31,6 +31,7 @@
 #include <sstream>
 #include <map>
 #include <vector>
+#include "logger.h"
 
 #define SFLPHONED_VERSION "0.9.6"		/** Version number */
 
@@ -72,18 +73,6 @@ static const SOUND_FORMAT INT32 = 0x8;
 #define SFLDataAmplitude (32767 >> 4)
 #endif
 
-#ifdef SFLDEBUG
-  #define _debug(...)          fprintf(stderr, "[sfl-debug] " __VA_ARGS__)
-  #define _debugException(...) fprintf(stderr, "[sfl-excep] " __VA_ARGS__ "\n")
-  #define _debugInit(...)      fprintf(stderr, "[sfl-init] " __VA_ARGS__ "\n")
-  #define _debugAlsa(...)      fprintf(stderr, "[alsa-debug] " __VA_ARGS__ )
-#else
-  #define _debug(...)
-  #define _debugException(...)
-  #define _debugInit(...)
-  #define _debugAlsa(...)
-#endif
-
 #define PROGNAME         "sflphoned"		/** Binary name */
 #define PROGDIR          "sflphone"		/** Program directory */
 #define RINGDIR          "ringtones"		/** Ringtones directory */
diff --git a/sflphone-common/src/history/historymanager.cpp b/sflphone-common/src/history/historymanager.cpp
index d56d3f67155aa3cd67a2b4bc380a3bf7c3f50170..9ea8f933d35495dedaaf444c24642ee18520ac18 100644
--- a/sflphone-common/src/history/historymanager.cpp
+++ b/sflphone-common/src/history/historymanager.cpp
@@ -109,7 +109,7 @@ int HistoryManager::load_history_items_map (Conf::ConfigTree *history_list, int
 
 bool HistoryManager::save_history_to_file (Conf::ConfigTree *history_list)
 {
-    _debug ("Saving history in XDG directory: %s\n", _history_path.data());
+    _debug ("Saving history in XDG directory: %s", _history_path.data());
     return  history_list->saveConfigTree (_history_path.data());
 }
 
@@ -165,7 +165,7 @@ int HistoryManager::create_history_path (std::string path)
         if (mkdir (userdata.data(), 0755) != 0) {
             // If directory	creation failed
             if (errno != EEXIST) {
-                _debug ("Cannot create directory: %s\n", strerror (errno));
+                _debug ("Cannot create directory: %s", strerror (errno));
                 return -1;
             }
         }
diff --git a/sflphone-common/src/iax/iaxcall.cpp b/sflphone-common/src/iax/iaxcall.cpp
index 93ecdcdfdb26cc88876e73f06360ba0b817323b1..d276abee64103b7ebed163633033c2e456bf1d7b 100644
--- a/sflphone-common/src/iax/iaxcall.cpp
+++ b/sflphone-common/src/iax/iaxcall.cpp
@@ -35,42 +35,40 @@ IAXCall::setFormat (int format)
 {
     _format = format;
 
-    _debug ("IAX set supported format: ");
+    _info ("IAX set supported format: ");
 
     switch (format) {
 
         case AST_FORMAT_ULAW:
-            printf ("PCMU\n");
+            _info("PCMU");
             setAudioCodec (PAYLOAD_CODEC_ULAW);
             break;
 
         case AST_FORMAT_GSM:
-            printf ("GSM\n");
+            _info ("GSM");
             setAudioCodec (PAYLOAD_CODEC_GSM);
             break;
 
         case AST_FORMAT_ALAW:
-            printf ("ALAW\n");
+            _info ("ALAW");
             setAudioCodec (PAYLOAD_CODEC_ALAW);
             break;
 
         case AST_FORMAT_ILBC:
-            printf ("ILBC\n");
+            _info ("ILBC");
             setAudioCodec (PAYLOAD_CODEC_ILBC_20);
             break;
 
         case AST_FORMAT_SPEEX:
-            printf ("SPEEX\n");
+            _info ("SPEEX");
             setAudioCodec (PAYLOAD_CODEC_SPEEX_8000);
             break;
 
         default:
-            printf ("Error audio codec type %i not supported!\n", format);
+            _info ("Error audio codec type %i not supported!", format);
             setAudioCodec ( (AudioCodecType) -1);
             break;
     }
-
-    printf ("\n");
 }
 
 
@@ -81,7 +79,7 @@ IAXCall::getSupportedFormat()
     int format = 0;
     unsigned int iter;
 
-    _debug ("IAX get supported format: ");
+    _info ("IAX get supported format: ");
 
     map = getCodecMap().getActiveCodecs();
 
@@ -89,27 +87,27 @@ IAXCall::getSupportedFormat()
         switch (map[iter]) {
 
             case PAYLOAD_CODEC_ULAW:
-                printf ("PCMU ");
+                _info ("PCMU ");
                 format |= AST_FORMAT_ULAW;
                 break;
 
             case PAYLOAD_CODEC_GSM:
-                printf ("GSM ");
+                _info ("GSM ");
                 format |= AST_FORMAT_GSM;
                 break;
 
             case PAYLOAD_CODEC_ALAW:
-                printf ("PCMA ");
+                _info ("PCMA ");
                 format |= AST_FORMAT_ALAW;
                 break;
 
             case PAYLOAD_CODEC_ILBC_20:
-                printf ("ILBC ");
+                _info ("ILBC ");
                 format |= AST_FORMAT_ILBC;
                 break;
 
             case PAYLOAD_CODEC_SPEEX_8000:
-                printf ("SPEEX ");
+                _info ("SPEEX ");
                 format |= AST_FORMAT_SPEEX;
                 break;
 
@@ -118,8 +116,6 @@ IAXCall::getSupportedFormat()
         }
     }
 
-    printf ("\n");
-
     return format;
 
 }
@@ -137,27 +133,27 @@ IAXCall::getFirstMatchingFormat (int needles)
         switch (map[iter]) {
 
             case PAYLOAD_CODEC_ULAW:
-                printf ("PCMU\n");
+                _debug ("PCMU");
                 format = AST_FORMAT_ULAW;
                 break;
 
             case PAYLOAD_CODEC_GSM:
-                printf ("GSM\n");
+                _debug ("GSM");
                 format = AST_FORMAT_GSM;
                 break;
 
             case PAYLOAD_CODEC_ALAW:
-                printf ("PCMA\n");
+                _debug ("PCMA");
                 format = AST_FORMAT_ALAW;
                 break;
 
             case PAYLOAD_CODEC_ILBC_20:
-                printf ("ILBC\n");
+                _debug ("ILBC");
                 format = AST_FORMAT_ILBC;
                 break;
 
             case PAYLOAD_CODEC_SPEEX_8000:
-                printf ("SPEEX\n");
+                _debug ("SPEEX");
                 format = AST_FORMAT_SPEEX;
                 break;
 
@@ -171,8 +167,6 @@ IAXCall::getFirstMatchingFormat (int needles)
 
     }
 
-    printf ("\n");
-
     return 0;
 }
 
diff --git a/sflphone-common/src/iax/iaxvoiplink.cpp b/sflphone-common/src/iax/iaxvoiplink.cpp
index b6377ea7f4cec4aee220e81afcc3ce8528742f69..342c9e3faf00d2ba6ac7cea14996fd339654af59 100644
--- a/sflphone-common/src/iax/iaxvoiplink.cpp
+++ b/sflphone-common/src/iax/iaxvoiplink.cpp
@@ -37,13 +37,13 @@
 
 #define MUSIC_ONHOLD true
 
-#define CHK_VALID_CALL   if (call == NULL) { _debug("IAX: Call doesn't exists\n"); \
+#define CHK_VALID_CALL   if (call == NULL) { _debug("IAX: Call doesn't exists"); \
 	return false; }
 
 IAXVoIPLink::IAXVoIPLink (const AccountID& accountID)
         : VoIPLink (accountID)
 {
-    // _debug("IAXVoIPLink::IAXVoIPLink : creating eventhread \n ");
+    // _debug("IAXVoIPLink::IAXVoIPLink : creating eventhread  ");
     _evThread = new EventThread (this);
     _regSession = NULL;
     _nextRefreshStamp = 0;
@@ -116,13 +116,13 @@ IAXVoIPLink::init()
         port = iax_init (port);
 
         if (port < 0) {
-            _debug ("IAX Warning: already initialize on port %d\n", last_port);
+            _debug ("IAX Warning: already initialize on port %d", last_port);
             port = RANDOM_IAX_PORT;
         } else if (port == IAX_FAILURE) {
             _debug ("IAX Fail to start on port %d", last_port);
             port = RANDOM_IAX_PORT;
         } else {
-            _debug ("IAX Info: listening on port %d\n", last_port);
+            _debug ("IAX Info: listening on port %d", last_port);
             _localPort = last_port;
             returnValue = true;
             _evThread->start();
@@ -141,7 +141,7 @@ IAXVoIPLink::init()
     }
 
     if (port == IAX_FAILURE || nbTry==0) {
-        _debug ("Fail to initialize iax\n");
+        _debug ("Fail to initialize iax");
 
         initDone (false);
     }
@@ -195,7 +195,7 @@ void IAXVoIPLink::terminateOneCall (const CallID& id)
     IAXCall* call = getIAXCall (id);
 
     if (call) {
-        _debug ("IAXVoIPLink::terminateOneCall()::the call is deleted, should close recording file \n");
+        _debug ("IAXVoIPLink::terminateOneCall()::the call is deleted, should close recording file ");
         delete call;
         call = 0;
     }
@@ -218,7 +218,7 @@ IAXVoIPLink::getEvent()
             continue;
         }
 
-        //_debug ("Receive IAX Event: %d (0x%x)\n", event->etype, event->etype);
+        //_debug ("Receive IAX Event: %d (0x%x)", event->etype, event->etype);
 
         call = iaxFindCallBySession (event->session);
 
@@ -234,7 +234,7 @@ IAXVoIPLink::getEvent()
             iaxHandlePrecallEvent (event);
         }
 
-        // _debug("IAXVoIPLink::getEvent() : timestamp %i \n",event->ts);
+        // _debug("IAXVoIPLink::getEvent() : timestamp %i ",event->ts);
 
         iax_event_free (event);
     }
@@ -263,8 +263,8 @@ IAXVoIPLink::getEvent()
     if ( (Manager::instance().incomingCallWaiting() > 0) && Manager::instance().hasCurrentCall()) {
 
         int countTime_modulo = countTime % 4000;
-        // _debug("countTime: %i\n", countTime);
-        // _debug("countTime_modulo: %i\n", countTime_modulo);
+        // _debug("countTime: %i", countTime);
+        // _debug("countTime_modulo: %i", countTime_modulo);
 
         if ( (countTime_modulo - countTime) < 0) {
             Manager::instance().notificationIncomingCall();
@@ -317,7 +317,7 @@ IAXVoIPLink::sendAudioFromMic (void)
 
                 if (ac && audiolayer) {
 
-                    // _debug("Send sound\n");
+                    // _debug("Send sound");
                     // audiolayer->getMainBuffer()->flush(currentCall->getCallId());
 
                     audiolayer->getMainBuffer()->setInternalSamplingRate (ac->getClockRate());
@@ -366,7 +366,7 @@ IAXVoIPLink::sendAudioFromMic (void)
                         // Make sure the session and the call still exists.
                         if (currentCall->getSession() && (micDataEncoded != NULL) && (nbSample_ > 0)) {
                             if (iax_send_voice (currentCall->getSession(), currentCall->getFormat(), micDataEncoded, compSize, nbSample_) == -1) {
-                                _debug ("IAX: Error sending voice data.\n");
+                                _debug ("IAX: Error sending voice data.");
                             }
                         }
 
@@ -426,9 +426,9 @@ IAXVoIPLink::sendRegister (AccountID id)
     if (!_regSession) {
         _debug ("Error when generating new session for register");
     } else {
-        _debug ("IAX Sending registration to %s with user %s\n", account->getHostname().c_str() , account->getUsername().c_str());
+        _debug ("IAX Sending registration to %s with user %s", account->getHostname().c_str() , account->getUsername().c_str());
         int val = iax_register (_regSession, account->getHostname().data(), account->getUsername().data(), account->getPassword().data(), 120);
-        _debug ("Return value: %d\n", val);
+        _debug ("Return value: %d", val);
         // set the time-out to 15 seconds, after that, resend a registration request.
         // until we unregister.
         _nextRefreshStamp = time (NULL) + 10;
@@ -466,7 +466,7 @@ IAXVoIPLink::sendUnregister (AccountID id)
 
     _nextRefreshStamp = 0;
 
-    _debug ("IAX2 send unregister\n");
+    _debug ("IAX2 send unregister");
     account->setRegistrationState (Unregistered);
 
     return SUCCESS;
@@ -522,7 +522,7 @@ IAXVoIPLink::answer (const CallID& id)
 bool
 IAXVoIPLink::hangup (const CallID& id)
 {
-    _debug ("IAXVoIPLink::hangup() : function called once hangup \n");
+    _debug ("IAXVoIPLink::hangup() : function called once hangup ");
     IAXCall* call = getIAXCall (id);
     std::string reason = "Dumped Call";
     CHK_VALID_CALL;
@@ -550,7 +550,7 @@ IAXVoIPLink::hangup (const CallID& id)
 bool
 IAXVoIPLink::peerHungup (const CallID& id)
 {
-    _debug ("IAXVoIPLink::peerHangup() : function called once hangup \n");
+    _debug ("IAXVoIPLink::peerHangup() : function called once hangup ");
     IAXCall* call = getIAXCall (id);
     std::string reason = "Dumped Call";
     CHK_VALID_CALL;
@@ -584,7 +584,7 @@ IAXVoIPLink::onhold (const CallID& id)
 
     audiolayer->getMainBuffer()->unBindAll (call->getCallId());
 
-    //if (call->getState() == Call::Hold) { _debug("Call is already on hold\n"); return false; }
+    //if (call->getState() == Call::Hold) { _debug("Call is already on hold"); return false; }
 
     _mutexIAX.enterMutex();
     iax_quelch_moh (call->getSession() , MUSIC_ONHOLD);
@@ -603,7 +603,7 @@ IAXVoIPLink::offhold (const CallID& id)
 
     Manager::instance().addStream (call->getCallId());
 
-    //if (call->getState() == Call::Active) { _debug("Call is already active\n"); return false; }
+    //if (call->getState() == Call::Active) { _debug("Call is already active"); return false; }
     _mutexIAX.enterMutex();
     iax_unquelch (call->getSession());
     _mutexIAX.leaveMutex();
@@ -700,7 +700,7 @@ IAXVoIPLink::iaxOutgoingInvite (IAXCall* call)
     newsession = iax_session_new();
 
     if (!newsession) {
-        _debug ("IAX Error: Can't make new session for a new call\n");
+        _debug ("IAX Error: Can't make new session for a new call");
         return false;
     }
 
@@ -715,7 +715,7 @@ IAXVoIPLink::iaxOutgoingInvite (IAXCall* call)
     audio_format_preferred =  call->getFirstMatchingFormat (call->getSupportedFormat());
     audio_format_capability = call->getSupportedFormat();
 
-    _debug ("IAX New call: %s\n", strNum.c_str());
+    _debug ("IAX New call: %s", strNum.c_str());
     iax_call (newsession, username.c_str(), username.c_str(), strNum.c_str(), lang, wait, audio_format_preferred, audio_format_capability);
 
     return true;
@@ -798,10 +798,10 @@ IAXVoIPLink::iaxHandleCallEvent (iax_event* event, IAXCall* call)
             _debug ("IAX_EVENT_ACCEPT: codec format: ");
 
             if (event->ies.format) {
-                printf ("%i\n", event->ies.format);
+                printf ("%i", event->ies.format);
                 call->setFormat (event->ies.format);
             } else {
-                printf ("no codec format\n");
+                printf ("no codec format");
             }
 
             break;
@@ -820,12 +820,12 @@ IAXVoIPLink::iaxHandleCallEvent (iax_event* event, IAXCall* call)
 
                 if (event->ies.format) {
                     // Should not get here, should have been set in EVENT_ACCEPT
-                    printf ("%i\n", event->ies.format);
+                    printf ("%i", event->ies.format);
                     call->setFormat (event->ies.format);
                 }
 
                 {
-                    printf ("no codec format\n");
+                    printf ("no codec format");
                 }
 
                 Manager::instance().peerAnsweredCall (id);
@@ -850,7 +850,7 @@ IAXVoIPLink::iaxHandleCallEvent (iax_event* event, IAXCall* call)
         case IAX_EVENT_VOICE:
             //if (!audiolayer->isCaptureActive ())
             //  audiolayer->startStream ();
-            // _debug("IAX_EVENT_VOICE: \n");
+            // _debug("IAX_EVENT_VOICE: ");
             iaxHandleVoiceEvent (event, call);
             break;
 
@@ -872,7 +872,7 @@ IAXVoIPLink::iaxHandleCallEvent (iax_event* event, IAXCall* call)
 
             if (Manager::instance().getConfigString (HOOKS, URLHOOK_IAX2_ENABLED) == "1") {
                 if (strcmp ( (char*) event->data, "") != 0) {
-                    _debug ("> IAX_EVENT_URL received: %s\n", event->data);
+                    _debug ("> IAX_EVENT_URL received: %s", event->data);
                     urlhook->addAction ( (char*) event->data, Manager::instance().getConfigString (HOOKS, URLHOOK_COMMAND));
                 }
             }
@@ -886,7 +886,7 @@ IAXVoIPLink::iaxHandleCallEvent (iax_event* event, IAXCall* call)
             break;
 
         default:
-            _debug ("iaxHandleCallEvent: Unknown event type (in call event): %d\n", event->etype);
+            _debug ("iaxHandleCallEvent: Unknown event type (in call event): %d", event->etype);
 
     }
 }
@@ -907,7 +907,7 @@ IAXVoIPLink::iaxHandleVoiceEvent (iax_event* event, IAXCall* call)
 
     if (!event->datalen) {
         // Skip this empty packet.
-        //_debug("IAX: Skipping empty jitter-buffer interpolated packet\n");
+        //_debug("IAX: Skipping empty jitter-buffer interpolated packet");
         return;
     }
 
@@ -930,11 +930,11 @@ IAXVoIPLink::iaxHandleVoiceEvent (iax_event* event, IAXCall* call)
         // - subclass holds the voiceformat property.
 
         if (event->subclass && event->subclass != call->getFormat()) {
-            _debug ("iaxHandleVoiceEvent: no format found in call setting it to %i\n", event->subclass);
+            _debug ("iaxHandleVoiceEvent: no format found in call setting it to %i", event->subclass);
             call->setFormat (event->subclass);
         }
 
-        //_debug("Receive: len=%d, format=%d, _receiveDataDecoded=%p\n", event->datalen, call->getFormat(), _receiveDataDecoded);
+        //_debug("Receive: len=%d, format=%d, _receiveDataDecoded=%p", event->datalen, call->getFormat(), _receiveDataDecoded);
         // ac = call->getCodecMap().getCodec (call -> getAudioCodec());
 
         data = (unsigned char*) event->data;
@@ -945,7 +945,7 @@ IAXVoIPLink::iaxHandleVoiceEvent (iax_event* event, IAXCall* call)
         max = (int) (ac->getClockRate() * audiolayer->getFrameSize() / 1000);
 
         if (size > max) {
-            _debug ("The size %d is bigger than expected %d. Packet cropped. Ouch!\n", size, max);
+            _debug ("The size %d is bigger than expected %d. Packet cropped. Ouch!", size, max);
             size = max;
         }
 
@@ -954,7 +954,7 @@ IAXVoIPLink::iaxHandleVoiceEvent (iax_event* event, IAXCall* call)
         nbInt16      = expandedSize/sizeof (int16);
 
         if (nbInt16 > max) {
-            _debug ("We have decoded an IAX VOICE packet larger than expected: %i VS %i. Cropping.\n", nbInt16, max);
+            _debug ("We have decoded an IAX VOICE packet larger than expected: %i VS %i. Cropping.", nbInt16, max);
             nbInt16 = max;
         }
 
@@ -1013,7 +1013,7 @@ IAXVoIPLink::iaxHandleRegReply (iax_event* event)
         // Looking for the voicemail information
         //if( event->ies != 0 )
         //new_voicemails = processIAXMsgCount(event->ies.msgcount);
-        //_debug("iax voicemail number notification: %i\n", new_voicemails);
+        //_debug("iax voicemail number notification: %i", new_voicemails);
         // Notify the client if new voicemail waiting for the current account
         //account_id = getAccountID();
         //Manager::instance().startVoiceMessageNotification(account_id.c_str(), new_voicemails);
@@ -1063,18 +1063,18 @@ IAXVoIPLink::iaxHandlePrecallEvent (iax_event* event)
         case IAX_EVENT_REGACK:
 
         case IAX_EVENT_REGREJ:
-            _debug ("IAX Registration Event in a pre-call setup\n");
+            _debug ("IAX Registration Event in a pre-call setup");
             break;
 
         case IAX_EVENT_REGREQ:
             // Received when someone wants to register to us!?!
             // Asterisk receives and answers to that, not us, we're a phone.
-            _debug ("Registration by a peer, don't allow it\n");
+            _debug ("Registration by a peer, don't allow it");
             break;
 
         case IAX_EVENT_CONNECT:
             // We've got an incoming call! Yikes!
-            _debug ("> IAX_EVENT_CONNECT (receive)\n");
+            _debug ("> IAX_EVENT_CONNECT (receive)");
 
             id = Manager::instance().getNewCallID();
 
@@ -1153,11 +1153,11 @@ IAXVoIPLink::iaxHandlePrecallEvent (iax_event* event)
             break;
 
         case IAX_IE_MSGCOUNT:
-            //_debug("messssssssssssssssssssssssssssssssssssssssssssssssages\n");
+            //_debug("messssssssssssssssssssssssssssssssssssssssssssssssages");
             break;
 
         default:
-            _debug ("IAXVoIPLink::iaxHandlePrecallEvent: Unknown event type (in precall): %d\n", event->etype);
+            _debug ("IAXVoIPLink::iaxHandlePrecallEvent: Unknown event type (in precall): %d", event->etype);
     }
 
 }
diff --git a/sflphone-common/src/logger.cpp b/sflphone-common/src/logger.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..b7966beea56bad89712608d4f810714b3c3c3fc5
--- /dev/null
+++ b/sflphone-common/src/logger.cpp
@@ -0,0 +1,99 @@
+/*
+ *  Copyright (C) 2004-2009 Savoir-Faire Linux inc.
+ *  Author: Julien Bonjean <julien.bonjean@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.
+ */
+
+#include "logger.h"
+#include <stdarg.h>
+#include <string>
+#include <stdio.h>
+
+using namespace std;
+
+namespace Logger
+{
+
+bool consoleLog = false;
+bool debugMode = false;
+
+void log(const int level, const char* format, ...)
+{
+	if(!debugMode && level == LOG_DEBUG)
+		return;
+
+	va_list ap;
+	string prefix = "<> ";
+	char buffer[1024];
+	string message = "";
+	string color_prefix = "";
+
+	switch(level)
+	{
+		case LOG_ERR:
+		{
+			prefix = "<error> ";
+			color_prefix = RED;
+			break;
+		}
+		case LOG_WARNING:
+		{
+			prefix = "<warning> ";
+			color_prefix = LIGHT_RED;
+			break;
+		}
+		case LOG_INFO:
+		{
+			prefix = "<info> ";
+			color_prefix = "";
+			break;
+		}
+		case LOG_DEBUG:
+		{
+			prefix = "<debug> ";
+			color_prefix = "";
+			break;
+		}
+	}
+	
+	va_start(ap, format);
+	vsprintf(buffer, format, ap);
+	va_end(ap);
+
+	message = buffer;
+	message = prefix + message;
+
+	syslog(level, message.c_str());
+
+	if(consoleLog)
+	{
+		message = color_prefix + message + END_COLOR + "\n";
+		fprintf(stderr, message.c_str());
+	}
+}
+
+void setConsoleLog(bool c)
+{
+	Logger::consoleLog = c;
+}
+
+void setDebugMode(bool d)
+{
+	Logger::debugMode = d;
+}
+
+}
+
diff --git a/sflphone-common/src/logger.h b/sflphone-common/src/logger.h
new file mode 100644
index 0000000000000000000000000000000000000000..b8a3b77b4cb27b426208aef5afd61e9b4c7aa312
--- /dev/null
+++ b/sflphone-common/src/logger.h
@@ -0,0 +1,61 @@
+/*
+ *  Copyright (C) 2004-2009 Savoir-Faire Linux inc.
+ *  Author: Julien Bonjean <julien.bonjean@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.
+ */
+
+#ifndef __LOGGER_H__
+#define __LOGGER_H__
+
+#include <syslog.h>
+
+namespace Logger
+{
+	void log(const int, const char*, ...);
+
+	void setConsoleLog(bool);
+	void setDebugMode(bool);
+};
+
+#define _error(...)	Logger::log(LOG_ERROR, __VA_ARGS__)
+#define _warn(...)	Logger::log(LOG_WARNING, __VA_ARGS__)
+#define _info(...)	Logger::log(LOG_INFO, __VA_ARGS__)
+#define _debug(...)	Logger::log(LOG_DEBUG, __VA_ARGS__)
+
+#define _debugException(...)	Logger::log(LOG_DEBUG, __VA_ARGS__)
+#define _debugInit(...)		Logger::log(LOG_DEBUG, __VA_ARGS__)
+#define _debugAlsa(...)		Logger::log(LOG_DEBUG, __VA_ARGS__)
+
+#define BLACK "\033[22;30m"
+#define RED "\033[22;31m"
+#define GREEN "\033[22;32m"
+#define BROWN "\033[22;33m"
+#define BLUE "\033[22;34m"
+#define MAGENTA "\033[22;35m"
+#define CYAN "\033[22;36m"
+#define GREY "\033[22;37m"
+#define DARK_GREY "\033[01;30m"
+#define LIGHT_RED "\033[01;31m"
+#define LIGHT_SCREEN "\033[01;32m"
+#define YELLOW "\033[01;33m"
+#define LIGHT_BLUE "\033[01;34m"
+#define LIGHT_MAGENTA "\033[01;35m"
+#define LIGHT_CYAN "\033[01;36m"
+#define WHITE "\033[01;37m"
+#define END_COLOR "\033[0m"
+
+#endif
+
diff --git a/sflphone-common/src/main.cpp b/sflphone-common/src/main.cpp
index d023997021f9fc7d892ce88346a161ce1b940622..6f2d05cfe73e9dcc393235620bff131986218ed8 100644
--- a/sflphone-common/src/main.cpp
+++ b/sflphone-common/src/main.cpp
@@ -25,7 +25,7 @@
 #include <string>
 #include <dirent.h>
 #include <sys/stat.h>
-//#include "config.h"
+#include <cc++/common.h>
 #include "global.h"
 
 #include "user_cfg.h"
@@ -34,25 +34,63 @@
 
 #include "audio/audiolayer.h"
 
+using namespace std;
+using namespace ost;
+
+CommandOptionArg	level(
+        "log-level", "l", "Log level (not yet implemented)"
+);
+
+CommandOptionNoArg	console(
+        "console", "c", "Log in console (instead of syslog)"
+);
+
+CommandOptionNoArg	debug(
+        "debug", "d", "Debug mode (more verbose)"
+);
+
+CommandOptionNoArg	help(
+        "help", "h", "Print help"
+);
+
 int
 main (int argc, char **argv)
 {
-    int exit_code = 0;
+	int exit_code = 0;
+
+	Logger::setConsoleLog(false);
+	Logger::setDebugMode(false);
 
-    //setlocale (LC_ALL, "");
-    //bindtextdomain (PACKAGE, LOCALEDIR);
-    //textdomain (PACKAGE);
+	CommandOptionParse * args = makeCommandOptionParse(argc, argv, "");
+
+	printf ("SFLphone Daemon %s, by Savoir-Faire Linux 2004-2009\n", VERSION);
+        printf ("http://www.sflphone.org/\n");
+
+        if ( help.numSet ) {
+                cerr << args->printUsage();
+		::exit(0);
+        }
+
+        if ( args->argsHaveError() ) {
+                cerr << args->printErrors();
+                cerr << args->printUsage();
+                ::exit(1);
+        }
 
-    if (argc == 2 && strcmp (argv[1], "--help") == 0) {
+	if( console.numSet )
+	{
+		_info("Console logging activated");
+		Logger::setConsoleLog(true);
+	}
 
+	if( debug.numSet )
+	{
+		_info("Debug mode activated");
+		Logger::setDebugMode(true);
+	}
 
-        printf ("%1$s Daemon %2$s, by Savoir-Faire Linux 2004-2009\n\n",
-                PROGNAME,
-                SFLPHONED_VERSION);
-        printf ("USAGE: sflphoned [--help]\nParameters: \n  --help\tfor this message\n\n  --port=3999\tchange the session port\n\n");
-        printf ("See http://www.sflphone.org/ for more information\n");
+        delete args;
 
-    } else {
         FILE *fp;
         char homepid[128];
         char sfldir[128];
@@ -84,7 +122,7 @@ main (int argc, char **argv)
             if ( (dir = opendir (sfldir)) == NULL) {
                 //Create it
                 if (mkdir (sfldir, 0755) != 0) {
-                    fprintf (stderr, "Creating directory %s failed. Exited.\n", sfldir);
+                    fprintf (stderr, "Creating directory %s failed. Exited.", sfldir);
                     exit (-1);
                 }
             }
@@ -95,14 +133,14 @@ main (int argc, char **argv)
             if ( (dir = opendir (sfldir)) == NULL) {
                 //Create it
                 if (mkdir (sfldir, 0755) != 0) {
-                    fprintf (stderr, "Creating directory %s failed. Exited.\n", sfldir);
+                    fprintf (stderr, "Creating directory %s failed. Exited.", sfldir);
                     exit (-1);
                 }
             }
 
             // PID file doesn't exists, create and write pid in it
             if ( (fp = fopen (homepid,"w")) == NULL) {
-                fprintf (stderr, "Creating PID file %s failed. Exited.\n", homepid);
+                fprintf (stderr, "Creating PID file %s failed. Exited.", homepid);
                 exit (-1);
             } else {
                 fputs (cPid , fp);
@@ -119,11 +157,11 @@ main (int argc, char **argv)
                 fclose (fp);
 
                 if (kill (atoi (cOldPid), 0) == SUCCESS) {
-                    fprintf (stderr, "There is already a sflphoned daemon running in the system. Starting Failed.\n");
+                    fprintf (stderr, "There is already a sflphoned daemon running in the system. Starting Failed.");
                     exit (-1);
                 } else {
                     if ( (fp = fopen (homepid,"w")) == NULL) {
-                        fprintf (stderr, "Writing to PID file %s failed. Exited.\n", homepid);
+                        fprintf (stderr, "Writing to PID file %s failed. Exited.", homepid);
                         exit (-1);
                     } else {
                         fputs (cPid , fp);
@@ -155,7 +193,7 @@ main (int argc, char **argv)
             std::cerr << e.what() << std::endl;
             exit_code = -1;
         } catch (...) {
-            fprintf (stderr, "An exception occured when initializing the system.\n");
+            fprintf (stderr, "An exception occured when initializing the system.");
             exit_code = -1;
         }
 
@@ -163,7 +201,6 @@ main (int argc, char **argv)
             Manager::instance().setDBusManager (&DBusManager::instance());
             exit_code = DBusManager::instance().exec();  // UI Loop
         }
-    }
 
     return exit_code;
 }
diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp
index 464c079ba679ef0cbb61d1a17be5ceecf38a424d..6b1d15aa1e61d9b901d0a557c39d1c70d63599e8 100644
--- a/sflphone-common/src/managerimpl.cpp
+++ b/sflphone-common/src/managerimpl.cpp
@@ -114,7 +114,7 @@ ManagerImpl::~ManagerImpl (void)
     // terminate();
     delete _cleaner;
     _cleaner=0;
-    _debug ("%s stop correctly.\n", PROGNAME);
+    _debug ("%s stop correctly.", PROGNAME);
 }
 
 void
@@ -126,7 +126,7 @@ ManagerImpl::init()
     initVolume();
 
     if (_exist == 0) {
-        _debug ("Cannot create config file in your home directory\n");
+        _debug ("Cannot create config file in your home directory");
     }
 
     initAudioDriver();
@@ -159,23 +159,23 @@ ManagerImpl::init()
 
 void ManagerImpl::terminate()
 {
-    _debug ("ManagerImpl::terminate \n");
+    _debug ("ManagerImpl::terminate ");
     saveConfig();
 
     unloadAccountMap();
 
-    _debug ("Unload DTMF Key \n");
+    _debug ("Unload DTMF Key ");
     delete _dtmfKey;
 
-    _debug ("Unload Audio Driver \n");
+    _debug ("Unload Audio Driver ");
     delete _audiodriver;
     _audiodriver = NULL;
 
-    _debug ("Unload Telephone Tone \n");
+    _debug ("Unload Telephone Tone ");
     delete _telephoneTone;
     _telephoneTone = NULL;
 
-    _debug ("Unload Audio Codecs \n");
+    _debug ("Unload Audio Codecs ");
     _codecDescriptorMap.deleteHandlePointer();
 
 }
@@ -189,7 +189,7 @@ ManagerImpl::isCurrentCall (const CallID& callId)
 bool
 ManagerImpl::hasCurrentCall()
 {
-    // _debug ("ManagerImpl::hasCurrentCall current call ID = %s\n", _currentCallId2.c_str());
+    // _debug ("ManagerImpl::hasCurrentCall current call ID = %s", _currentCallId2.c_str());
 
     if (_currentCallId2 != "") {
         return true;
@@ -208,7 +208,7 @@ void
 ManagerImpl::switchCall (const CallID& id)
 {
     ost::MutexLock m (_currentCallMutex);
-    _debug ("----- Switch current call id to %s -----\n", id.c_str());
+    _debug ("----- Switch current call id to %s -----", id.c_str());
     _currentCallId2 = id;
 
     /*
@@ -223,7 +223,7 @@ ManagerImpl::switchCall (const CallID& id)
         ConferenceMap::iterator iter = _conferencemap.find(id);
         if(iter != _conferencemap.end())
         {
-    	_debug("    set call recordable in audio layer\n");
+    	_debug("    set call recordable in audio layer");
     	conf = iter->second;
     	al->setRecorderInstance((Recordable*)conf);
         }
@@ -237,7 +237,7 @@ ManagerImpl::switchCall (const CallID& id)
         Call *call = NULL;
         call = getAccountLink (account_id)->getCall(id);
 
-        _debug("    set call recordable in audio layer\n");
+        _debug("    set call recordable in audio layer");
         al->setRecorderInstance((Recordable*)call);
     }
     }
@@ -257,7 +257,7 @@ ManagerImpl::outgoingCall (const std::string& account_id, const CallID& call_id,
     Call::CallConfiguration callConfig;
     SIPVoIPLink *siplink;
 
-    _debug ("ManagerImpl::outgoingCall(%s)\n", call_id.c_str());
+    _debug ("ManagerImpl::outgoingCall(%s)", call_id.c_str());
 
     CallID current_call_id = getCurrentCallId();
 
@@ -274,21 +274,21 @@ ManagerImpl::outgoingCall (const std::string& account_id, const CallID& call_id,
     // in any cases we have to detach from current communication
     if (hasCurrentCall()) {
 
-        _debug ("    outgoingCall: Has current call (%s) put it onhold\n", current_call_id.c_str());
+        _debug ("    outgoingCall: Has current call (%s) put it onhold", current_call_id.c_str());
 
         // if this is not a conferenceand this and is not a conference participant
 
         if (!isConference (current_call_id) && !participToConference (current_call_id)) {
-            _debug ("    outgoingCall: Put the current call (%s) on hold\n", current_call_id.c_str());
+            _debug ("    outgoingCall: Put the current call (%s) on hold", current_call_id.c_str());
             onHoldCall (current_call_id);
         } else if (isConference (current_call_id) && !participToConference (call_id)) {
-            _debug ("    outgoingCall: detach main participant from conference\n");
+            _debug ("    outgoingCall: detach main participant from conference");
             detachParticipant (default_id, current_call_id);
         }
     }
 
     if (callConfig == Call::IPtoIP) {
-        _debug ("    outgoingCall: Start IP to IP call\n");
+        _debug ("    outgoingCall: Start IP to IP call");
         /* We need to retrieve the sip voiplink instance */
         siplink = SIPVoIPLink::instance ("");
 
@@ -303,17 +303,17 @@ ManagerImpl::outgoingCall (const std::string& account_id, const CallID& call_id,
     }
 
     if (!accountExists (account_id)) {
-        _debug ("! Manager Error: Outgoing Call: account doesn't exist\n");
+        _debug ("! Manager Error: Outgoing Call: account doesn't exist");
         return false;
     }
 
     if (getAccountFromCall (call_id) != AccountNULL) {
-        _debug ("! Manager Error: Outgoing Call: call id already exists\n");
+        _debug ("! Manager Error: Outgoing Call: call id already exists");
         return false;
     }
 
 
-    _debug ("- Manager Action: Adding Outgoing Call %s on account %s\n", call_id.data(), account_id.data());
+    _debug ("- Manager Action: Adding Outgoing Call %s on account %s", call_id.data(), account_id.data());
 
     associateCallToAccount (call_id, account_id);
 
@@ -322,7 +322,7 @@ ManagerImpl::outgoingCall (const std::string& account_id, const CallID& call_id,
         return true;
     } else {
         callFailure (call_id);
-        _debug ("! Manager Error: An error occur, the call was not created\n");
+        _debug ("! Manager Error: An error occur, the call was not created");
     }
 
     return false;
@@ -333,7 +333,7 @@ bool
 ManagerImpl::answerCall (const CallID& call_id)
 {
 
-    _debug ("ManagerImpl::answerCall(%s)\n", call_id.c_str());
+    _debug ("ManagerImpl::answerCall(%s)", call_id.c_str());
 
     stopTone ();
 
@@ -343,7 +343,7 @@ ManagerImpl::answerCall (const CallID& call_id)
     AccountID account_id = getAccountFromCall (call_id);
 
     if (account_id == AccountNULL) {
-        _debug ("    answerCall: AccountId is null\n");
+        _debug ("    answerCall: AccountId is null");
     }
 
     Call* call = NULL;
@@ -351,23 +351,23 @@ ManagerImpl::answerCall (const CallID& call_id)
     call = getAccountLink (account_id)->getCall (call_id);
 
     if (call == NULL) {
-        _debug ("    answerCall: Call is null\n");
+        _debug ("    answerCall: Call is null");
     }
 
     // in any cases we have to detach from current communication
     if (hasCurrentCall()) {
 
-        _debug ("    answerCall: Currently conversing with %s\n", current_call_id.c_str());
+        _debug ("    answerCall: Currently conversing with %s", current_call_id.c_str());
         // if it is not a conference and is not a conference participant
 
         if (!isConference (current_call_id) && !participToConference (current_call_id)) {
-            _debug ("    answerCall: Put the current call (%s) on hold\n", current_call_id.c_str());
+            _debug ("    answerCall: Put the current call (%s) on hold", current_call_id.c_str());
             onHoldCall (current_call_id);
         }
 
         // if we are talking to a conference and we are answering an incoming call
         else if (isConference (current_call_id) && !participToConference (call_id)) {
-            _debug ("    answerCall: Detach main participant from conference\n");
+            _debug ("    answerCall: Detach main participant from conference");
             detachParticipant (default_id, current_call_id);
         }
 
@@ -409,7 +409,7 @@ ManagerImpl::answerCall (const CallID& call_id)
 bool
 ManagerImpl::hangupCall (const CallID& call_id)
 {
-    _debug ("ManagerImpl::hangupCall(%s)\n", call_id.c_str());
+    _debug ("ManagerImpl::hangupCall(%s)", call_id.c_str());
     PulseLayer *pulselayer;
     AccountID account_id;
     bool returnValue;
@@ -421,7 +421,7 @@ ManagerImpl::hangupCall (const CallID& call_id)
     stopTone ();
 
     /* Broadcast a signal over DBus */
-    _debug ("    hangupCall: Send DBUS call state change (HUNGUP) for id %s\n", call_id.c_str());
+    _debug ("    hangupCall: Send DBUS call state change (HUNGUP) for id %s", call_id.c_str());
 
     if (_dbus) _dbus->getCallManager()->callStateChanged (call_id, "HUNGUP");
 
@@ -431,7 +431,7 @@ ManagerImpl::hangupCall (const CallID& call_id)
 
     // stop streams
     if (audiolayer && (nbCalls <= 1)) {
-        _debug ("    hangupCall: stop audio stream, ther is only %i call(s) remaining\n", nbCalls);
+        _debug ("    hangupCall: stop audio stream, ther is only %i call(s) remaining", nbCalls);
         audiolayer->stopStream();
     }
 
@@ -463,7 +463,7 @@ ManagerImpl::hangupCall (const CallID& call_id)
         account_id = getAccountFromCall (call_id);
 
         if (account_id == AccountNULL) {
-            _debug ("! Manager Hangup Call: Call doesn't exists\n");
+            _debug ("! Manager Hangup Call: Call doesn't exists");
             return false;
         }
 
@@ -483,7 +483,7 @@ ManagerImpl::hangupCall (const CallID& call_id)
 bool
 ManagerImpl::hangupConference (const ConfID& id)
 {
-    _debug ("ManagerImpl::hangupConference()\n");
+    _debug ("ManagerImpl::hangupConference()");
 
     Conference *conf;
     ConferenceMap::iterator iter_conf = _conferencemap.find (id);
@@ -500,7 +500,7 @@ ManagerImpl::hangupConference (const ConfID& id)
         ParticipantSet::iterator iter_participant = participants.begin();
 
         while (iter_participant != participants.end()) {
-            _debug ("ManagerImpl::hangupConference participant %s\n", (*iter_participant).c_str());
+            _debug ("ManagerImpl::hangupConference participant %s", (*iter_participant).c_str());
 
             hangupCall (*iter_participant);
 
@@ -536,7 +536,7 @@ ManagerImpl::cancelCall (const CallID& id)
         accountid = getAccountFromCall (id);
 
         if (accountid == AccountNULL) {
-            _debug ("! Manager Cancel Call: Call doesn't exists\n");
+            _debug ("! Manager Cancel Call: Call doesn't exists");
             return false;
         }
 
@@ -560,13 +560,13 @@ ManagerImpl::onHoldCall (const CallID& call_id)
     AccountID account_id;
     bool returnValue;
 
-    _debug ("ManagerImpl::onHoldCall(%s)\n", call_id.c_str());
+    _debug ("ManagerImpl::onHoldCall(%s)", call_id.c_str());
 
     stopTone ();
 
     CallID current_call_id = getCurrentCallId();
 
-    _debug ("    onHoldCall: try to put call %s on hold\n", call_id.c_str());
+    _debug ("    onHoldCall: try to put call %s on hold", call_id.c_str());
 
     /* Direct IP to IP call */
 
@@ -579,7 +579,7 @@ ManagerImpl::onHoldCall (const CallID& call_id)
         account_id = getAccountFromCall (call_id);
 
         if (account_id == AccountNULL) {
-            _debug ("    onHoldCall: Account ID %s or callid %s doesn't exists\n", account_id.c_str(), call_id.c_str());
+            _debug ("    onHoldCall: Account ID %s or callid %s doesn't exists", account_id.c_str(), call_id.c_str());
             return false;
         }
 
@@ -611,7 +611,7 @@ ManagerImpl::offHoldCall (const CallID& call_id)
 
     is_rec = false;
 
-    _debug ("ManagerImpl::offHoldCall(%s)\n", call_id.c_str());
+    _debug ("ManagerImpl::offHoldCall(%s)", call_id.c_str());
 
     stopTone ();
 
@@ -622,10 +622,10 @@ ManagerImpl::offHoldCall (const CallID& call_id)
     if (hasCurrentCall()) {
         // if this is not a conferenceand this and is not a conference participant
         if (!isConference (current_call_id) && !participToConference (current_call_id)) {
-            _debug ("    offHoldCall: put current call (%s) on hold\n", current_call_id.c_str());
+            _debug ("    offHoldCall: put current call (%s) on hold", current_call_id.c_str());
             onHoldCall (current_call_id);
         } else if (isConference (current_call_id) && !participToConference (call_id)) {
-            _debug ("    offHoldCall Put current conference (%s) on hold\n", current_call_id.c_str());
+            _debug ("    offHoldCall Put current conference (%s) on hold", current_call_id.c_str());
             detachParticipant (default_id, current_call_id);
         }
     }
@@ -644,11 +644,11 @@ ManagerImpl::offHoldCall (const CallID& call_id)
         account_id = getAccountFromCall (call_id);
 
         if (account_id == AccountNULL) {
-            _debug ("Manager OffHold Call: Call doesn't exists\n");
+            _debug ("Manager OffHold Call: Call doesn't exists");
             return false;
         }
 
-        _debug ("Setting OFFHOLD, Account %s, callid %s\n", account_id.c_str(), call_id.c_str());
+        _debug ("Setting OFFHOLD, Account %s, callid %s", account_id.c_str(), call_id.c_str());
 
         is_rec = getAccountLink (account_id)->getCall (call_id)->isRecording();
         returnValue = getAccountLink (account_id)->offhold (call_id);
@@ -680,7 +680,7 @@ ManagerImpl::offHoldCall (const CallID& call_id)
 
 
     // codecName = getCurrentCodecName (call_id);
-    // _debug("ManagerImpl::hangupCall(): broadcast codec name %s \n",codecName.c_str());
+    // _debug("ManagerImpl::hangupCall(): broadcast codec name %s ",codecName.c_str());
 
     // if (_dbus) _dbus->getCallManager()->currentSelectedCodec (call_id,codecName.c_str());
 
@@ -710,7 +710,7 @@ ManagerImpl::transferCall (const CallID& call_id, const std::string& to)
         accountid = getAccountFromCall (call_id);
 
         if (accountid == AccountNULL) {
-            _debug ("! Manager Transfer Call: Call doesn't exists\n");
+            _debug ("! Manager Transfer Call: Call doesn't exists");
             return false;
         }
 
@@ -771,7 +771,7 @@ ManagerImpl::refuseCall (const CallID& id)
     // AudioLayer* audiolayer = getAudioDriver();
 
     if (nbCalls <= 1) {
-        _debug ("    hangupCall: stop audio stream, ther is only %i call(s) remaining\n", nbCalls);
+        _debug ("    hangupCall: stop audio stream, ther is only %i call(s) remaining", nbCalls);
 
         AudioLayer* audiolayer = getAudioDriver();
         audiolayer->stopStream();
@@ -788,7 +788,7 @@ ManagerImpl::refuseCall (const CallID& id)
         accountid = getAccountFromCall (id);
 
         if (accountid == AccountNULL) {
-            _debug ("! Manager OffHold Call: Call doesn't exists\n");
+            _debug ("! Manager OffHold Call: Call doesn't exists");
             return false;
         }
 
@@ -817,7 +817,7 @@ ManagerImpl::refuseCall (const CallID& id)
 Conference*
 ManagerImpl::createConference (const CallID& id1, const CallID& id2)
 {
-    _debug ("ManagerImpl::createConference()\n");
+    _debug ("ManagerImpl::createConference()");
 
     Conference* conf = new Conference();
 
@@ -838,21 +838,21 @@ void
 ManagerImpl::removeConference (const ConfID& conference_id)
 {
 
-    _debug ("ManagerImpl::removeConference(%s)\n", conference_id.c_str());
+    _debug ("ManagerImpl::removeConference(%s)", conference_id.c_str());
 
     Conference* conf = NULL;
 
-    _debug ("    removeConference: _conferencemap.size: %i\n", (int) _conferencemap.size());
+    _debug ("    removeConference: _conferencemap.size: %i", (int) _conferencemap.size());
     ConferenceMap::iterator iter = _conferencemap.find (conference_id);
 
     if (iter != _conferencemap.end()) {
-        _debug ("    removeConference: Found conference id %s in conferencemap\n", conference_id.c_str());
+        _debug ("    removeConference: Found conference id %s in conferencemap", conference_id.c_str());
         conf = iter->second;
     }
 
     if (conf == NULL) {
 
-        _debug ("    removeConference: Error conference not found\n");
+        _debug ("    removeConference: Error conference not found");
         return;
     }
 
@@ -875,15 +875,15 @@ ManagerImpl::removeConference (const ConfID& conference_id)
     }
 
     // Then remove the conference from the conference map
-    _debug ("ManagerImpl:: remove conference %s\n", conference_id.c_str());
+    _debug ("ManagerImpl:: remove conference %s", conference_id.c_str());
 
     if (_conferencemap.erase (conference_id) == 1)
-        _debug ("ManagerImpl:: conference %s removed succesfully\n", conference_id.c_str());
+        _debug ("ManagerImpl:: conference %s removed succesfully", conference_id.c_str());
     else
-        _debug ("ManagerImpl:: error cannot remove conference id: %s\n", conference_id.c_str());
+        _debug ("ManagerImpl:: error cannot remove conference id: %s", conference_id.c_str());
 
     // broadcast a signal over dbus
-    _debug ("ManagerImpl::removeConference broadcast call removed on dbus: %s\n", conference_id.c_str());
+    _debug ("ManagerImpl::removeConference broadcast call removed on dbus: %s", conference_id.c_str());
 
     _dbus->getCallManager()->conferenceRemoved (conference_id);
 
@@ -911,7 +911,7 @@ ManagerImpl::getConferenceFromCallID (const CallID& call_id)
 void
 ManagerImpl::holdConference (const CallID& id)
 {
-    _debug ("ManagerImpl::holdConference()\n");
+    _debug ("ManagerImpl::holdConference()");
 
     Conference *conf;
     ConferenceMap::iterator iter_conf = _conferencemap.find (id);
@@ -927,7 +927,7 @@ ManagerImpl::holdConference (const CallID& id)
         ParticipantSet::iterator iter_participant = participants.begin();
 
         while (iter_participant != participants.end()) {
-            _debug ("    holdConference: participant %s\n", (*iter_participant).c_str());
+            _debug ("    holdConference: participant %s", (*iter_participant).c_str());
             currentAccountId = getAccountFromCall (*iter_participant);
             call = getAccountLink (currentAccountId)->getCall (*iter_participant);
 
@@ -954,7 +954,7 @@ void
 ManagerImpl::unHoldConference (const CallID& id)
 {
 
-    _debug ("ManagerImpl::unHoldConference()\n");
+    _debug ("ManagerImpl::unHoldConference()");
 
     Conference *conf;
     ConferenceMap::iterator iter_conf = _conferencemap.find (id);
@@ -970,7 +970,7 @@ ManagerImpl::unHoldConference (const CallID& id)
         ParticipantSet::iterator iter_participant = participants.begin();
 
         while (iter_participant != participants.end()) {
-            _debug ("    unholdConference: participant %s\n", (*iter_participant).c_str());
+            _debug ("    unholdConference: participant %s", (*iter_participant).c_str());
             currentAccountId = getAccountFromCall (*iter_participant);
             call = getAccountLink (currentAccountId)->getCall (*iter_participant);
 
@@ -1025,7 +1025,7 @@ ManagerImpl::participToConference (const CallID& call_id)
 void
 ManagerImpl::addParticipant (const CallID& call_id, const CallID& conference_id)
 {
-    _debug ("ManagerImpl::addParticipant(%s, %s)\n", call_id.c_str(), conference_id.c_str());
+    _debug ("ManagerImpl::addParticipant(%s, %s)", call_id.c_str(), conference_id.c_str());
 
     std::map<std::string, std::string> call_details = getCallDetails (call_id);
 
@@ -1051,7 +1051,7 @@ ManagerImpl::addParticipant (const CallID& call_id, const CallID& conference_id)
 
     addMainParticipant (conference_id);
 
-    _debug ("    addParticipant: enter main process\n");
+    _debug ("    addParticipant: enter main process");
 
     if (iter != _conferencemap.end()) {
 
@@ -1069,15 +1069,15 @@ ManagerImpl::addParticipant (const CallID& call_id, const CallID& conference_id)
 
         iter_details = call_details.find ("CALL_STATE");
 
-        _debug ("    addParticipant: call state: %s\n", iter_details->second.c_str());
+        _debug ("    addParticipant: call state: %s", iter_details->second.c_str());
 
         if (iter_details->second == "HOLD") {
-            _debug ("    OFFHOLD %s\n", call_id.c_str());
+            _debug ("    OFFHOLD %s", call_id.c_str());
 
             // offHoldCall create a new rtp session which use addStream to bind participant
             offHoldCall (call_id);
         } else if (iter_details->second == "INCOMING") {
-            _debug ("    ANSWER %s\n", call_id.c_str());
+            _debug ("    ANSWER %s", call_id.c_str());
             // answerCall create a new rtp session which use addStream to bind participant
             answerCall (call_id);
         } else if (iter_details->second == "CURRENT") {
@@ -1103,7 +1103,7 @@ ManagerImpl::addParticipant (const CallID& call_id, const CallID& conference_id)
 
         _audiodriver->getMainBuffer()->flush (default_id);
     } else {
-        _debug ("    addParticipant: Error, conference %s conference_id not found!\n", conference_id.c_str());
+        _debug ("    addParticipant: Error, conference %s conference_id not found!", conference_id.c_str());
     }
 
 }
@@ -1162,8 +1162,8 @@ ManagerImpl::addMainParticipant (const CallID& conference_id)
 void
 ManagerImpl::joinParticipant (const CallID& call_id1, const CallID& call_id2)
 {
-    _debug ("ManagerImpl::joinParticipant(%s, %s)\n", call_id1.c_str(), call_id2.c_str());
-    // _debug("    Current call ID %s\n", getCurrentCallId().c_str());
+    _debug ("ManagerImpl::joinParticipant(%s, %s)", call_id1.c_str(), call_id2.c_str());
+    // _debug("    Current call ID %s", getCurrentCallId().c_str());
 
     std::map<std::string, std::string> call1_details = getCallDetails (call_id1);
     std::map<std::string, std::string> call2_details = getCallDetails (call_id2);
@@ -1174,7 +1174,7 @@ ManagerImpl::joinParticipant (const CallID& call_id1, const CallID& call_id2)
     Call* call = NULL;
 
     CallID current_call_id = getCurrentCallId();
-    _debug ("    joinParticipant: current_call_id %s\n", current_call_id.c_str());
+    _debug ("    joinParticipant: current_call_id %s", current_call_id.c_str());
 
 
     // detach from the conference and switch to this conference
@@ -1186,7 +1186,7 @@ ManagerImpl::joinParticipant (const CallID& call_id1, const CallID& call_id2)
             onHoldCall (current_call_id);
     }
 
-    _debug ("    joinParticipant: create a conference\n");
+    _debug ("    joinParticipant: create a conference");
 
     Conference *conf = createConference (call_id1, call_id2);
     switchCall (conf->getConfID());
@@ -1196,23 +1196,23 @@ ManagerImpl::joinParticipant (const CallID& call_id1, const CallID& call_id2)
     call->setConfId (conf->getConfID());
 
     iter_details = call1_details.find ("CALL_STATE");
-    _debug ("    joinParticipant: call1 %s state: %s\n", call_id1.c_str(), iter_details->second.c_str());
+    _debug ("    joinParticipant: call1 %s state: %s", call_id1.c_str(), iter_details->second.c_str());
 
     if (iter_details->second == "HOLD") {
-        _debug ("    OFFHOLD %s\n", call_id1.c_str());
+        _debug ("    OFFHOLD %s", call_id1.c_str());
         offHoldCall (call_id1);
     } else if (iter_details->second == "INCOMING") {
-        _debug ("    ANSWER %s\n", call_id1.c_str());
+        _debug ("    ANSWER %s", call_id1.c_str());
         answerCall (call_id1);
     } else if (iter_details->second == "CURRENT") {
-        _debug ("    CURRENT %s\n", call_id1.c_str());
+        _debug ("    CURRENT %s", call_id1.c_str());
         _audiodriver->getMainBuffer()->unBindAll (call_id1);
         conf->bindParticipant (call_id1);
     } else if (iter_details->second == "INACTIVE") {
-        _debug ("    INACTIVE %s\n", call_id1.c_str());
+        _debug ("    INACTIVE %s", call_id1.c_str());
         answerCall (call_id1);
     } else {
-        _debug ("    CAll State not recognized\n");
+        _debug ("    CAll State not recognized");
     }
 
     currentAccountId = getAccountFromCall (call_id2);
@@ -1221,23 +1221,23 @@ ManagerImpl::joinParticipant (const CallID& call_id1, const CallID& call_id2)
     call->setConfId (conf->getConfID());
 
     iter_details = call2_details.find ("CALL_STATE");
-    _debug ("    joinParticipant: call2 %s state: %s\n", call_id2.c_str(), iter_details->second.c_str());
+    _debug ("    joinParticipant: call2 %s state: %s", call_id2.c_str(), iter_details->second.c_str());
 
     if (iter_details->second == "HOLD") {
-        _debug ("    OFFHOLD %s\n", call_id2.c_str());
+        _debug ("    OFFHOLD %s", call_id2.c_str());
         offHoldCall (call_id2);
     } else if (iter_details->second == "INCOMING") {
-        _debug ("    ANSWER %s\n", call_id2.c_str());
+        _debug ("    ANSWER %s", call_id2.c_str());
         answerCall (call_id2);
     } else if (iter_details->second == "CURRENT") {
-        _debug ("    CURRENT %s\n", call_id2.c_str());
+        _debug ("    CURRENT %s", call_id2.c_str());
         _audiodriver->getMainBuffer()->unBindAll (call_id2);
         conf->bindParticipant (call_id2);
     } else if (iter_details->second == "INACTIVE") {
-        _debug ("    INACTIVE %s\n", call_id2.c_str());
+        _debug ("    INACTIVE %s", call_id2.c_str());
         answerCall (call_id2);
     } else {
-        _debug ("    CAll State not recognized\n");
+        _debug ("    CAll State not recognized");
     }
 
     // finally bind main participant to conference
@@ -1252,7 +1252,7 @@ ManagerImpl::joinParticipant (const CallID& call_id1, const CallID& call_id2)
 void
 ManagerImpl::detachParticipant (const CallID& call_id, const CallID& current_id)
 {
-    _debug ("ManagerImpl::detachParticipant(%s)\n", call_id.c_str());
+    _debug ("ManagerImpl::detachParticipant(%s)", call_id.c_str());
 
     CallID current_call_id = current_id;
 
@@ -1272,7 +1272,7 @@ ManagerImpl::detachParticipant (const CallID& call_id, const CallID& current_id)
 
         if (conf != NULL) {
 
-            _debug ("    detachParticipant: detaching participant %s\n", call_id.c_str());
+            _debug ("    detachParticipant: detaching participant %s", call_id.c_str());
 
             std::map<std::string, std::string> call_details = getCallDetails (call_id);
             std::map<std::string, std::string>::iterator iter_details;
@@ -1282,7 +1282,7 @@ ManagerImpl::detachParticipant (const CallID& call_id, const CallID& current_id)
             if (iter_details->second == "RINGING") {
                 removeParticipant (call_id);
             } else {
-                _debug ("    ONHOLD %s\n", call_id.c_str());
+                _debug ("    ONHOLD %s", call_id.c_str());
                 onHoldCall (call_id);
 
                 removeParticipant (call_id);
@@ -1292,11 +1292,11 @@ ManagerImpl::detachParticipant (const CallID& call_id, const CallID& current_id)
         } else {
 
 
-            _debug ("    detachParticipant: call is not conferencing, cannot detach\n");
+            _debug ("    detachParticipant: call is not conferencing, cannot detach");
 
         }
     } else {
-        _debug ("    detachParticipant: unbind main participant from all\n");
+        _debug ("    detachParticipant: unbind main participant from all");
         _audiodriver->getMainBuffer()->unBindAll (default_id);
 
         if (isConference (current_call_id)) {
@@ -1319,7 +1319,7 @@ ManagerImpl::detachParticipant (const CallID& call_id, const CallID& current_id)
 void
 ManagerImpl::removeParticipant (const CallID& call_id)
 {
-    _debug ("ManagerImpl::removeParticipant(%s)\n", call_id.c_str());
+    _debug ("ManagerImpl::removeParticipant(%s)", call_id.c_str());
 
     // TODO: add conference_id as a second parameter
     Conference* conf;
@@ -1335,12 +1335,12 @@ ManagerImpl::removeParticipant (const CallID& call_id)
     ConferenceMap::iterator iter = conf_map.find (call->getConfId());
 
     if (iter == conf_map.end()) {
-        _debug ("    no conference created, cannot remove participant \n");
+        _debug ("    no conference created, cannot remove participant ");
     } else {
 
         conf = iter->second;
 
-        _debug ("    removeParticipant %s\n", call_id.c_str());
+        _debug ("    removeParticipant %s", call_id.c_str());
         conf->remove (call_id);
         call->setConfId ("");
 
@@ -1353,7 +1353,7 @@ void
 ManagerImpl::processRemainingParticipant (CallID current_call_id, Conference *conf)
 {
 
-    _debug ("ManagerImpl::processRemainingParticipant()\n");
+    _debug ("ManagerImpl::processRemainingParticipant()");
 
     if (conf->getNbParticipants() > 1) {
 
@@ -1408,7 +1408,7 @@ ManagerImpl::processRemainingParticipant (CallID current_call_id, Conference *co
 void
 ManagerImpl::joinConference (const CallID& conf_id1, const CallID& conf_id2)
 {
-    _debug ("ManagerImpl::joinConference(%s, %s)\n", conf_id1.c_str(), conf_id2.c_str());
+    _debug ("ManagerImpl::joinConference(%s, %s)", conf_id1.c_str(), conf_id2.c_str());
 
     ConferenceMap::iterator iter;
 
@@ -1443,7 +1443,7 @@ ManagerImpl::joinConference (const CallID& conf_id1, const CallID& conf_id2)
 void
 ManagerImpl::addStream (const CallID& call_id)
 {
-    _debug ("ManagerImpl::addStream %s\n", call_id.c_str());
+    _debug ("ManagerImpl::addStream %s", call_id.c_str());
 
     AccountID currentAccountId;
     Call* call = NULL;
@@ -1459,7 +1459,7 @@ ManagerImpl::addStream (const CallID& call_id)
         if (iter != _conferencemap.end()) {
             Conference* conf = iter->second;
 
-            _debug ("    addStream: bind call %s to conference %s\n", call_id.c_str(), conf->getConfID().c_str());
+            _debug ("    addStream: bind call %s to conference %s", call_id.c_str(), conf->getConfID().c_str());
 
             conf->bindParticipant (call_id);
 
@@ -1481,7 +1481,7 @@ ManagerImpl::addStream (const CallID& call_id)
 
     } else {
 
-        _debug ("    addStream: bind call %s to main\n", call_id.c_str());
+        _debug ("    addStream: bind call %s to main", call_id.c_str());
 
         // bind to main
         getAudioDriver()->getMainBuffer()->bindCallID (call_id);
@@ -1496,7 +1496,7 @@ ManagerImpl::addStream (const CallID& call_id)
 void
 ManagerImpl::removeStream (const CallID& call_id)
 {
-    _debug ("ManagerImpl::removeStream %s\n", call_id.c_str());
+    _debug ("ManagerImpl::removeStream %s", call_id.c_str());
 
     getAudioDriver()->getMainBuffer()->unBindAll (call_id);
 
@@ -1510,7 +1510,7 @@ ManagerImpl::removeStream (const CallID& call_id)
 bool
 ManagerImpl::saveConfig (void)
 {
-    _debug ("Saving Configuration to XDG directory %s ... \n", _path.c_str());
+    _debug ("Saving Configuration to XDG directory %s ... ", _path.c_str());
     setConfig (AUDIO, VOLUME_SPKR, getSpkrVolume());
     setConfig (AUDIO, VOLUME_MICRO, getMicVolume());
 
@@ -1518,45 +1518,6 @@ ManagerImpl::saveConfig (void)
     return _setupLoaded;
 }
 
-//THREAD=Main
-int
-ManagerImpl::initRegisterAccounts()
-{
-    int status;
-    bool flag = true;
-    AccountMap::iterator iter;
-
-    _debugInit ("Initiate VoIP Links Registration");
-    iter = _accountMap.begin();
-
-    /* Loop on the account map previously loaded */
-
-    while (iter != _accountMap.end()) {
-        if (iter->second) {
-            iter->second->loadConfig();
-            /* If the account is set as enabled, try to register */
-
-            if (iter->second->isEnabled()) {
-                status = iter->second->registerVoIPLink();
-
-                if (status != SUCCESS) {
-                    flag = false;
-                }
-            }
-        }
-
-        iter++;
-    }
-
-    // calls the client notification here in case of errors at startup...
-    if (_audiodriver -> getErrorMessage() != -1)
-        notifyErrClient (_audiodriver -> getErrorMessage());
-
-    ASSERT (flag, true);
-
-    return SUCCESS;
-}
-
 //THREAD=Main
 bool
 ManagerImpl::sendDtmf (const CallID& id, char code)
@@ -1601,14 +1562,14 @@ ManagerImpl::playDtmf (char code)
     AudioLayer *audiolayer;
     SFLDataFormat *buf;
 
-    _debug ("ManagerImpl::playDtmf\n");
+    _debug ("ManagerImpl::playDtmf");
 
     stopTone ();
 
     bool hasToPlayTone = getConfigBool (SIGNALISATION, PLAY_DTMF);
 
     if (!hasToPlayTone) {
-        _debug ("    playDtmf: Do not have to play a tone...\n");
+        _debug ("    playDtmf: Do not have to play a tone...");
         return false;
     }
 
@@ -1616,7 +1577,7 @@ ManagerImpl::playDtmf (char code)
     pulselen = getConfigInt (SIGNALISATION, PULSE_LENGTH);
 
     if (!pulselen) {
-        _debug ("    playDtmf: Pulse length is not set...\n");
+        _debug ("    playDtmf: Pulse length is not set...");
         return false;
     }
 
@@ -1628,7 +1589,7 @@ ManagerImpl::playDtmf (char code)
 
     // fast return, no sound, so no dtmf
     if (audiolayer==0 || _dtmfKey == 0) {
-        _debug ("    playDtmf: Error no audio layer...\n");
+        _debug ("    playDtmf: Error no audio layer...");
         return false;
     }
 
@@ -1638,9 +1599,9 @@ ManagerImpl::playDtmf (char code)
     //                            ms/s
     size = (int) ( (pulselen * (float) audiolayer->getSampleRate()) / 1000);
 
-    _debug ("DTMF pulselen: %i\n", pulselen);
+    _debug ("DTMF pulselen: %i", pulselen);
 
-    _debug ("DTMF size: %i\n", size);
+    _debug ("DTMF size: %i", size);
 
     // this buffer is for mono
     // TODO <-- this should be global and hide if same size
@@ -1658,7 +1619,7 @@ ManagerImpl::playDtmf (char code)
         audiolayer->startStream();
         audiolayer->putUrgent (buf, size * sizeof (SFLDataFormat));
     } else {
-        _debug ("    playDtmf: Error cannot play dtmf\n");
+        _debug ("    playDtmf: Error cannot play dtmf");
     }
 
     ret = true;
@@ -1721,7 +1682,7 @@ ManagerImpl::incomingCall (Call* call, const AccountID& accountId)
 
     stopTone ();
 
-    _debug ("Incoming call %s for account %s\n", call->getCallId().data(), accountId.c_str());
+    _debug ("Incoming call %s for account %s", call->getCallId().data(), accountId.c_str());
 
     associateCallToAccount (call->getCallId(), accountId);
 
@@ -1746,7 +1707,7 @@ ManagerImpl::incomingCall (Call* call, const AccountID& accountId)
 
     }
 
-    _debug ("ManagerImpl::incomingCall :: hasCurrentCall() %i \n", hasCurrentCall());
+    _debug ("ManagerImpl::incomingCall :: hasCurrentCall() %i ", hasCurrentCall());
 
     if (!hasCurrentCall()) {
 
@@ -1770,7 +1731,7 @@ ManagerImpl::incomingCall (Call* call, const AccountID& accountId)
 
     display_name = call->getDisplayName();
 
-    // _debug(    "incomingCall from: %s, number: %s, display_name: %s\n", from.c_str(), number.c_str(), display_name.c_str());
+    // _debug(    "incomingCall from: %s, number: %s, display_name: %s", from.c_str(), number.c_str(), display_name.c_str());
 
     if (from != "" && number != "") {
         from.append (" <");
@@ -1786,13 +1747,13 @@ ManagerImpl::incomingCall (Call* call, const AccountID& accountId)
     CallIDSet::iterator iter = _waitingCall.begin();
     while (iter != _waitingCall.end()) {
         CallID ident = *iter;
-        _debug("ManagerImpl::incomingCall :: CALL iteration: %s \n",ident.c_str());
+        _debug("ManagerImpl::incomingCall :: CALL iteration: %s ",ident.c_str());
         ++iter;
     }
     */
 
     /* Broadcast a signal over DBus */
-    _debug ("From: %s, Number: %s, DisplayName: %s\n", from.c_str(), number.c_str(), display_name.c_str());
+    _debug ("From: %s, Number: %s, DisplayName: %s", from.c_str(), number.c_str(), display_name.c_str());
 
     display = display_name;
 
@@ -1834,7 +1795,7 @@ ManagerImpl::peerAnsweredCall (const CallID& id)
 
     // std::string codecName = getCurrentCodecName (id);
 
-    // _debug("ManagerImpl::hangupCall(): broadcast codec name %s \n",codecName.c_str());
+    // _debug("ManagerImpl::hangupCall(): broadcast codec name %s ",codecName.c_str());
     // if (_dbus) _dbus->getCallManager()->currentSelectedCodec (id,codecName.c_str());
 
     // Required if there have been no sip reinvite, in this case we must reinit buffers since the
@@ -1862,7 +1823,7 @@ ManagerImpl::peerHungupCall (const CallID& call_id)
     AccountID account_id;
     bool returnValue;
 
-    _debug ("ManagerImpl::peerHungupCall(%s)\n", call_id.c_str());
+    _debug ("ManagerImpl::peerHungupCall(%s)", call_id.c_str());
 
     // store the current call id
     CallID current_call_id = getCurrentCallId();
@@ -1891,7 +1852,7 @@ ManagerImpl::peerHungupCall (const CallID& call_id)
     // stop streams
 
     if (nbCalls <= 1) {
-        _debug ("    hangupCall: stop audio stream, ther is only %i call(s) remaining\n", nbCalls);
+        _debug ("    hangupCall: stop audio stream, ther is only %i call(s) remaining", nbCalls);
 
         AudioLayer* audiolayer = getAudioDriver();
         audiolayer->stopStream();
@@ -1907,7 +1868,7 @@ ManagerImpl::peerHungupCall (const CallID& call_id)
         account_id = getAccountFromCall (call_id);
 
         if (account_id == AccountNULL) {
-            _debug ("peerHungupCall: Call doesn't exists\n");
+            _debug ("peerHungupCall: Call doesn't exists");
             return;
         }
 
@@ -1930,7 +1891,7 @@ ManagerImpl::peerHungupCall (const CallID& call_id)
 void
 ManagerImpl::callBusy (const CallID& id)
 {
-    _debug ("Call busy\n");
+    _debug ("Call busy");
 
     if (_dbus) _dbus->getCallManager()->callStateChanged (id, "BUSY");
 
@@ -2002,7 +1963,7 @@ bool ManagerImpl::playATone (Tone::TONEID toneId)
     AudioLayer *audiolayer;
     // unsigned int nbSamples;
 
-    _debug ("ManagerImpl::playATone\n");
+    _debug ("ManagerImpl::playATone");
 
     hasToPlayTone = getConfigBool (SIGNALISATION, PLAY_TONES);
 
@@ -2045,7 +2006,7 @@ void ManagerImpl::stopTone ()
 {
     bool hasToPlayTone;
 
-    _debug ("ManagerImpl::stopTone\n");
+    _debug ("ManagerImpl::stopTone");
 
     hasToPlayTone = getConfigBool (SIGNALISATION, PLAY_TONES);
 
@@ -2101,7 +2062,7 @@ ManagerImpl::congestion ()
 void
 ManagerImpl::ringback ()
 {
-    _debug ("ManagerImpl::ringback\n");
+    _debug ("ManagerImpl::ringback");
 
     playATone (Tone::TONE_RINGTONE);
 }
@@ -2112,7 +2073,7 @@ ManagerImpl::ringback ()
 void
 ManagerImpl::ringtone()
 {
-    _debug ("ManagerImpl::ringtone\n");
+    _debug ("ManagerImpl::ringtone");
     std::string ringchoice;
     AudioLayer *audiolayer;
     AudioCodec *codecForTone;
@@ -2121,7 +2082,7 @@ ManagerImpl::ringtone()
 
     if (isRingtoneEnabled()) {
 
-        _debug ("  Tone is enabled\n");
+        _debug ("  Tone is enabled");
         //TODO Comment this because it makes the daemon crashes since the main thread
         //synchronizes the ringtone thread.
 
@@ -2172,7 +2133,7 @@ ManagerImpl::ringtone()
 AudioLoop*
 ManagerImpl::getTelephoneTone()
 {
-    // _debug("ManagerImpl::getTelephoneTone()\n");
+    // _debug("ManagerImpl::getTelephoneTone()");
     if (_telephoneTone != 0) {
         ost::MutexLock m (_toneMutex);
         return _telephoneTone->getCurrentTone();
@@ -2184,7 +2145,7 @@ ManagerImpl::getTelephoneTone()
 AudioLoop*
 ManagerImpl::getTelephoneFile()
 {
-    // _debug("ManagerImpl::getTelephoneFile()\n");
+    // _debug("ManagerImpl::getTelephoneFile()");
     ost::MutexLock m (_toneMutex);
 
     if (_audiofile.isStarted()) {
@@ -2202,7 +2163,7 @@ void ManagerImpl::notificationIncomingCall (void)
 
     audiolayer = getAudioDriver();
 
-    _debug ("ManagerImpl::notificationIncomingCall\n");
+    _debug ("ManagerImpl::notificationIncomingCall");
 
     if (audiolayer != 0) {
         samplerate = audiolayer->getSampleRate();
@@ -2232,7 +2193,7 @@ ManagerImpl::createSettingsPath (void)
 
     std::string xdg_config, xdg_env;
 
-    _debug ("XDG_CONFIG_HOME: %s\n", XDG_CONFIG_HOME);
+    _debug ("XDG_CONFIG_HOME: %s", XDG_CONFIG_HOME);
 
     xdg_config = std::string (HOMEDIR) + DIR_SEPARATOR_STR + ".config" + DIR_SEPARATOR_STR + PROGDIR;
 
@@ -2246,7 +2207,7 @@ ManagerImpl::createSettingsPath (void)
     if (mkdir (_path.data(), 0700) != 0) {
         // If directory	creation failed
         if (errno != EEXIST) {
-            _debug ("Cannot create directory: %s\n", strerror (errno));
+            _debug ("Cannot create directory: %s", strerror (errno));
             return -1;
         }
     }
@@ -2263,7 +2224,7 @@ ManagerImpl::createSettingsPath (void)
 void
 ManagerImpl::initConfigFile (bool load_user_value, std::string alternate)
 {
-    _debug ("ManagerImpl::InitConfigFile\n");
+    _debug ("ManagerImpl::InitConfigFile");
 
     // Default values, that will be overwritten by the call to
     // 'populateFromFile' below.
@@ -2425,11 +2386,11 @@ ManagerImpl::initAudioCodec (void)
 void
 ManagerImpl::setActiveCodecList (const std::vector<  std::string >& list)
 {
-    _debug ("Set active codecs list\n");
+    _debug ("Set active codecs list");
     _codecDescriptorMap.saveActiveCodecs (list);
     // setConfig
     std::string s = serialize (list);
-    _debug ("Setting codec with payload number %s to the active list\n", s.c_str());
+    _debug ("Setting codec with payload number %s to the active list", s.c_str());
     setConfig ("Audio", "ActiveCodecs", s);
 }
 
@@ -2474,7 +2435,7 @@ ManagerImpl::serialize (std::vector<std::string> v)
 std::vector <std::string>
 ManagerImpl::getActiveCodecList (void)
 {
-    _debug ("ManagerImpl::getActiveCodecList\n");
+    _debug ("ManagerImpl::getActiveCodecList");
     std::vector< std::string > v;
     CodecOrder active = _codecDescriptorMap.getActiveCodecs();
     unsigned int i=0;
@@ -2484,7 +2445,7 @@ ManagerImpl::getActiveCodecList (void)
         std::stringstream ss;
         ss << active[i];
         v.push_back ( (ss.str()).data());
-        _debug ("Codec with payload number %s is active\n", ss.str().data());
+        _debug ("Codec with payload number %s is active", ss.str().data());
         i++;
     }
 
@@ -2563,7 +2524,7 @@ std::vector<std::string>
 ManagerImpl::getInputAudioPluginList (void)
 {
     std::vector<std::string> v;
-    _debug ("Get input audio plugin list\n");
+    _debug ("Get input audio plugin list");
 
     v.push_back ("default");
     v.push_back ("surround40");
@@ -2579,7 +2540,7 @@ std::vector<std::string>
 ManagerImpl::getOutputAudioPluginList (void)
 {
     std::vector<std::string> v;
-    _debug ("Get output audio plugin list\n");
+    _debug ("Get output audio plugin list");
 
     v.push_back (PCM_DEFAULT);
     v.push_back (PCM_DMIX);
@@ -2596,7 +2557,7 @@ ManagerImpl::setInputAudioPlugin (const std::string& audioPlugin)
     int layer = _audiodriver -> getLayerType();
 
     if (CHECK_INTERFACE (layer , ALSA)) {
-        _debug ("Set input audio plugin\n");
+        _debug ("Set input audio plugin");
         _audiodriver -> setErrorMessage (-1);
         _audiodriver -> openDevice (_audiodriver -> getIndexIn(),
                                     _audiodriver -> getIndexOut(),
@@ -2620,7 +2581,7 @@ ManagerImpl::setOutputAudioPlugin (const std::string& audioPlugin)
 
     int res;
 
-    _debug ("Set output audio plugin\n");
+    _debug ("Set output audio plugin");
     _audiodriver -> setErrorMessage (-1);
     res = _audiodriver -> openDevice (_audiodriver -> getIndexIn(),
                                       _audiodriver -> getIndexOut(),
@@ -2642,7 +2603,7 @@ ManagerImpl::setOutputAudioPlugin (const std::string& audioPlugin)
 std::vector<std::string>
 ManagerImpl::getAudioOutputDeviceList (void)
 {
-    _debug ("Get audio output device list\n");
+    _debug ("Get audio output device list");
     AlsaLayer *layer;
     std::vector <std::string> devices;
 
@@ -2662,14 +2623,14 @@ ManagerImpl::setAudioOutputDevice (const int index)
 {
     AlsaLayer *alsalayer;
     std::string alsaplugin;
-    _debug ("Set audio output device: %i\n", index);
+    _debug ("Set audio output device: %i", index);
 
     _audiodriver -> setErrorMessage (-1);
 
     alsalayer = dynamic_cast<AlsaLayer*> (getAudioDriver ());
     alsaplugin = alsalayer->getAudioPlugin ();
 
-    _debug ("  set output plugin: %s\n", alsaplugin.c_str());
+    _debug ("  set output plugin: %s", alsaplugin.c_str());
 
     _audiodriver->openDevice (_audiodriver->getIndexIn(), index, _audiodriver->getSampleRate(), _audiodriver->getFrameSize(), SFL_PCM_PLAYBACK, alsaplugin);
 
@@ -2707,14 +2668,14 @@ ManagerImpl::setAudioInputDevice (const int index)
     AlsaLayer *alsalayer;
     std::string alsaplugin;
 
-    _debug ("Set audio input device %i\n", index);
+    _debug ("Set audio input device %i", index);
 
     _audiodriver -> setErrorMessage (-1);
 
     alsalayer = dynamic_cast<AlsaLayer*> (getAudioDriver ());
     alsaplugin = alsalayer->getAudioPlugin ();
 
-    _debug ("  set input plugin: %s\n", alsaplugin.c_str());
+    _debug ("  set input plugin: %s", alsaplugin.c_str());
 
     _audiodriver->openDevice (index, _audiodriver->getIndexOut(), _audiodriver->getSampleRate(), _audiodriver->getFrameSize(), SFL_PCM_CAPTURE, alsaplugin);
 
@@ -2731,7 +2692,7 @@ ManagerImpl::setAudioInputDevice (const int index)
 std::vector<std::string>
 ManagerImpl::getCurrentAudioDevicesIndex()
 {
-    _debug ("Get current audio devices index\n");
+    _debug ("Get current audio devices index");
     std::vector<std::string> v;
     std::stringstream ssi , sso;
     sso << _audiodriver->getIndexOut();
@@ -2778,7 +2739,7 @@ ManagerImpl::getRingtoneChoice (void)
         tone_path = tone_name ;
     }
 
-    _debug ("%s\n", tone_path.c_str());
+    _debug ("%s", tone_path.c_str());
 
     return tone_path;
 }
@@ -2799,7 +2760,7 @@ ManagerImpl::getRecordPath (void)
 void
 ManagerImpl::setRecordPath (const std::string& recPath)
 {
-    _debug ("ManagerImpl::setRecordPath(%s)! \n", recPath.c_str());
+    _debug ("ManagerImpl::setRecordPath(%s)! ", recPath.c_str());
     setConfig (AUDIO, RECORD_PATH, recPath);
 }
 
@@ -2860,7 +2821,7 @@ void
 ManagerImpl::setRecordingCall (const CallID& id)
 {
     /*
-    _debug ("ManagerImpl::setRecording()! \n");
+    _debug ("ManagerImpl::setRecording()! ");
     AccountID accountid = getAccountFromCall (id);
 
     getAccountLink (accountid)->setRecording (id);
@@ -2875,7 +2836,7 @@ bool
 ManagerImpl::isRecording (const CallID& id)
 {
     /*
-    _debug ("ManagerImpl::isRecording()! \n");
+    _debug ("ManagerImpl::isRecording()! ");
     AccountID accountid = getAccountFromCall (id);
 
     return getAccountLink (accountid)->isRecording (id);
@@ -2967,7 +2928,7 @@ void ManagerImpl::setAudioManager (const int32_t& api)
     int type;
     std::string alsaPlugin;
 
-    _debug ("Setting audio manager \n");
+    _debug ("Setting audio manager ");
 
     if (!_audiodriver)
         return;
@@ -2975,7 +2936,7 @@ void ManagerImpl::setAudioManager (const int32_t& api)
     type = _audiodriver->getLayerType();
 
     if (type == api) {
-        _debug ("Audio manager chosen already in use. No changes made. \n");
+        _debug ("Audio manager chosen already in use. No changes made. ");
         return;
     }
 
@@ -3002,7 +2963,7 @@ void
 ManagerImpl::notifyErrClient (const int32_t& errCode)
 {
     if (_dbus) {
-        _debug ("NOTIFY ERR NUMBER %i\n" , errCode);
+        _debug ("NOTIFY ERR NUMBER %i" , errCode);
         _dbus -> getConfigurationManager() -> errorAlert (errCode);
     }
 }
@@ -3012,7 +2973,7 @@ ManagerImpl::getAudioDeviceIndex (const std::string name)
 {
     AlsaLayer *alsalayer;
 
-    _debug ("Get audio device index\n");
+    _debug ("Get audio device index");
 
     alsalayer = dynamic_cast<AlsaLayer *> (getAudioDriver());
 
@@ -3027,7 +2988,7 @@ ManagerImpl::getCurrentAudioOutputPlugin (void)
 {
     AlsaLayer *alsalayer;
 
-    _debug ("Get alsa plugin\n");
+    _debug ("Get alsa plugin");
 
     alsalayer = dynamic_cast<AlsaLayer *> (getAudioDriver());
 
@@ -3068,16 +3029,16 @@ ManagerImpl::initAudioDriver (void)
             _audiodriver->setMainBuffer (&_mainBuffer);
         }
     } else
-        _debug ("Error - Audio API unknown\n");
+        _debug ("Error - Audio API unknown");
 
     if (_audiodriver == 0) {
-        _debug ("Init audio driver error\n");
+        _debug ("Init audio driver error");
         return false;
     } else {
         error = getAudioDriver()->getErrorMessage();
 
         if (error == -1) {
-            _debug ("Init audio driver: %i\n", error);
+            _debug ("Init audio driver: %i", error);
             return false;
         }
     }
@@ -3097,7 +3058,7 @@ ManagerImpl::selectAudioDriver (void)
     AlsaLayer *alsalayer;
 
     layer = _audiodriver->getLayerType();
-    _debug ("Audio layer type: %i\n" , layer);
+    _debug ("Audio layer type: %i" , layer);
 
     /* Retrieve the global devices info from the user config */
     alsaPlugin = getConfigString (AUDIO , ALSA_PLUGIN);
@@ -3117,13 +3078,13 @@ ManagerImpl::selectAudioDriver (void)
         alsalayer = dynamic_cast<AlsaLayer*> (getAudioDriver ());
 
         if (!alsalayer -> soundCardIndexExist (numCardIn , SFL_PCM_CAPTURE)) {
-            _debug (" Card with index %i doesn't exist or cannot capture. Switch to 0.\n", numCardIn);
+            _debug (" Card with index %i doesn't exist or cannot capture. Switch to 0.", numCardIn);
             numCardIn = ALSA_DFT_CARD_ID ;
             setConfig (AUDIO , ALSA_CARD_ID_IN , ALSA_DFT_CARD_ID);
         }
 
         if (!alsalayer -> soundCardIndexExist (numCardOut , SFL_PCM_PLAYBACK)) {
-            _debug (" Card with index %i doesn't exist or cannot playback . Switch to 0.\n", numCardOut);
+            _debug (" Card with index %i doesn't exist or cannot playback . Switch to 0.", numCardOut);
             numCardOut = ALSA_DFT_CARD_ID ;
             setConfig (AUDIO , ALSA_CARD_ID_OUT , ALSA_DFT_CARD_ID);
         }
@@ -3145,7 +3106,7 @@ void ManagerImpl::switchAudioManager (void)
     int type, samplerate, framesize, numCardIn, numCardOut;
     std::string alsaPlugin;
 
-    _debug ("Switching audio manager \n");
+    _debug ("Switching audio manager ");
 
     if (!_audiodriver)
         return;
@@ -3164,7 +3125,7 @@ void ManagerImpl::switchAudioManager (void)
 
     numCardOut = getConfigInt (AUDIO , ALSA_CARD_ID_OUT);
 
-    _debug ("Deleting current layer... \n");
+    _debug ("Deleting current layer... ");
 
     // _audiodriver->closeLayer();
     delete _audiodriver;
@@ -3174,19 +3135,19 @@ void ManagerImpl::switchAudioManager (void)
     switch (type) {
 
         case ALSA:
-            _debug ("Creating Pulseaudio layer...\n");
+            _debug ("Creating Pulseaudio layer...");
             _audiodriver = new PulseLayer (this);
             _audiodriver->setMainBuffer (&_mainBuffer);
             break;
 
         case PULSEAUDIO:
-            _debug ("Creating ALSA layer...\n");
+            _debug ("Creating ALSA layer...");
             _audiodriver = new AlsaLayer (this);
             _audiodriver->setMainBuffer (&_mainBuffer);
             break;
 
         default:
-            _debug ("Error: audio layer unknown\n");
+            _debug ("Error: audio layer unknown");
             break;
     }
 
@@ -3197,9 +3158,9 @@ void ManagerImpl::switchAudioManager (void)
     if (_audiodriver -> getErrorMessage() != -1)
         notifyErrClient (_audiodriver -> getErrorMessage());
 
-    _debug ("Current device: %i \n", type);
+    _debug ("Current device: %i ", type);
 
-    _debug ("has current call: %i \n", hasCurrentCall());
+    _debug ("has current call: %i ", hasCurrentCall());
 
     if (hasCurrentCall())
         _audiodriver->startStream();
@@ -3207,7 +3168,7 @@ void ManagerImpl::switchAudioManager (void)
 
     // need to stop audio streams if there is currently no call
     // if ( (type != PULSEAUDIO) && (!hasCurrentCall())) {
-    // _debug("There is currently a call!!\n");
+    // _debug("There is currently a call!!");
     // _audiodriver->stopStream();
 
     // }
@@ -3255,7 +3216,6 @@ void ManagerImpl::setMicVolume (unsigned short mic_vol)
 
 void ManagerImpl::setLocalIp2IpInfo (const std::string& address)
 {
-
     std::string ip_address = std::string (address);
 
     int index = ip_address.find_first_of (":");
@@ -3264,7 +3224,7 @@ void ManagerImpl::setLocalIp2IpInfo (const std::string& address)
     std::string local_port = ip_address.substr (index+1);
     int newPort = atoi (local_port.c_str());
 
-    _debug ("Setting new address %s and port %s for default account (ip to ip calls)\n", local_address.c_str(), local_port.c_str());
+    _debug ("Setting new address %s and port %s for default account (ip to ip calls)", local_address.c_str(), local_port.c_str());
 
     int prevPort = getConfigInt (IP2IP_PROFILE, LOCAL_PORT);
     std::string prevAddress  = getConfigString (IP2IP_PROFILE, LOCAL_ADDRESS);
@@ -3294,9 +3254,8 @@ void ManagerImpl::setLocalIp2IpInfo (const std::string& address)
 
 int ManagerImpl::getLocalIp2IpPort (void)
 {
-
     /* The SIP port used for default account (IP to IP) calls */
-    _debug ("Default account port %i\n", getConfigInt (IP2IP_PROFILE, LOCAL_PORT));
+    _debug ("Default account port %i", getConfigInt (IP2IP_PROFILE, LOCAL_PORT));
 
     return getConfigInt (IP2IP_PROFILE, LOCAL_PORT);
 
@@ -3467,7 +3426,7 @@ ManagerImpl::getConfigString (const std::string& section, const std::string&
 bool
 ManagerImpl::setConfig (const std::string& section, const std::string& name, const std::string& value)
 {
-    _debug ("ManagerImpl::setConfig %s %s %s\n", section.c_str(), name.c_str(), value.c_str());
+    _debug ("ManagerImpl::setConfig %s %s %s", section.c_str(), name.c_str(), value.c_str());
     return _config.setConfigTreeItem (section, name, value);
 }
 
@@ -3482,7 +3441,7 @@ ManagerImpl::setConfig (const std::string& section, const std::string& name, int
 
 void ManagerImpl::setAccountsOrder (const std::string& order)
 {
-    _debug ("Setcreate accounts order : %s\n", order.c_str());
+    _debug ("Setcreate accounts order : %s", order.c_str());
     // Set the new config
     setConfig (PREFERENCES, CONFIG_ACCOUNTS_ORDER, order);
 }
@@ -3505,7 +3464,7 @@ ManagerImpl::getAccountList()
 
         while (iter != _accountMap.end()) {
             if (iter->second != NULL) {
-                //_debug("PUSHING BACK %s\n", iter->first.c_str());
+                //_debug("PUSHING BACK %s", iter->first.c_str());
                 v.push_back (iter->first.data());
             }
 
@@ -3540,7 +3499,7 @@ std::map< std::string, std::string > ManagerImpl::getAccountDetails (const Accou
     Account * account = _accountMap[accountID];
 
     if (account == NULL) {
-        _debug ("Cannot getAccountDetails on a non-existing accountID %s. Defaults will be used.\n", accountID.c_str());
+        _debug ("Cannot getAccountDetails on a non-existing accountID %s. Defaults will be used.", accountID.c_str());
     }
 
     a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_ALIAS, getConfigString (accountID, CONFIG_ACCOUNT_ALIAS)));
@@ -3666,7 +3625,7 @@ void ManagerImpl::setCredential (const std::string& accountID, const int32_t& in
 
     std::string section = "Credential" + std::string (":") + accountID + std::string (":") + credentialIndex;
 
-    _debug ("Setting credential in section %s\n", section.c_str());
+    _debug ("Setting credential in section %s", section.c_str());
 
     it = credentialInformation.find (USERNAME);
     std::string username;
@@ -3766,7 +3725,7 @@ void ManagerImpl::setAccountDetails (const std::string& accountID, const std::ma
         // it is already saved as a MD5 Hash.
         // TODO: This test is weak. Fix this.
         if ( (password.compare (getConfigString (accountID, PASSWORD)) != 0)) {
-            _debug ("Password sent and password from config are different. Re-hashing\n");
+            _debug ("Password sent and password from config are different. Re-hashing");
             std::string hash;
 
             if (authenticationName.empty()) {
@@ -4007,7 +3966,7 @@ void ManagerImpl::setAccountDetails (const std::string& accountID, const std::ma
             acc->unregisterVoIPLink();
         }
     } else {
-        _debug ("ManagerImpl::setAccountDetails: account is NULL\n");
+        _debug ("ManagerImpl::setAccountDetails: account is NULL");
     }
 
     // Update account details to the client side
@@ -4015,30 +3974,6 @@ void ManagerImpl::setAccountDetails (const std::string& accountID, const std::ma
 
 }
 
-void
-ManagerImpl::sendRegister (const std::string& accountID , const int32_t& enable)
-{
-
-    // Update the active field
-    setConfig (accountID, CONFIG_ACCOUNT_ENABLE, (enable == 1) ? TRUE_STR:FALSE_STR);
-
-    Account* acc = getAccount (accountID);
-    acc->loadConfig();
-
-    // Test on the freshly updated value
-
-    if (acc->isEnabled()) {
-        // Verify we aren't already registered, then register
-        _debug ("Send register for account %s\n" , accountID.c_str());
-        acc->registerVoIPLink();
-    } else {
-        // Verify we are already registered, then unregister
-        _debug ("Send unregister for account %s\n" , accountID.c_str());
-        acc->unregisterVoIPLink();
-    }
-
-}
-
 std::string
 ManagerImpl::addAccount (const std::map< std::string, std::string >& details)
 {
@@ -4055,7 +3990,7 @@ ManagerImpl::addAccount (const std::map< std::string, std::string >& details)
     // Get the type
     accountType = (*details.find (CONFIG_ACCOUNT_TYPE)).second;
 
-    _debug ("%s\n", newAccountID.c_str());
+    _debug ("%s", newAccountID.c_str());
 
     /** @todo Verify the uniqueness, in case a program adds accounts, two in a row. */
 
@@ -4064,7 +3999,7 @@ ManagerImpl::addAccount (const std::map< std::string, std::string >& details)
     } else if (accountType == "IAX") {
         newAccount = AccountCreator::createAccount (AccountCreator::IAX_ACCOUNT, newAccountID);
     } else {
-        _debug ("Unknown %s param when calling addAccount(): %s\n", CONFIG_ACCOUNT_TYPE, accountType.c_str());
+        _debug ("Unknown %s param when calling addAccount(): %s", CONFIG_ACCOUNT_TYPE, accountType.c_str());
         return "";
     }
 
@@ -4129,7 +4064,7 @@ ManagerImpl::removeAccount (const AccountID& accountID)
 
     saveConfig();
 
-    _debug ("REMOVE ACCOUNT\n");
+    _debug ("REMOVE ACCOUNT");
 
     if (_dbus) _dbus->getConfigurationManager()->accountsChanged();
 
@@ -4143,7 +4078,7 @@ ManagerImpl::associateCallToAccount (const CallID& callID, const AccountID& acco
         if (accountExists (accountID)) {    // account id exist in AccountMap
             ost::MutexLock m (_callAccountMapMutex);
             _callAccountMap[callID] = accountID;
-            _debug ("Associate Call %s with Account %s\n", callID.data(), accountID.data());
+            _debug ("Associate Call %s with Account %s", callID.data(), accountID.data());
             return true;
         } else {
             return false;
@@ -4258,11 +4193,11 @@ ManagerImpl::loadAccountMap()
         }
 
         else {
-            _debug ("Unknown %s param in config file (%s)\n", CONFIG_ACCOUNT_TYPE, accountType.c_str());
+            _debug ("Unknown %s param in config file (%s)", CONFIG_ACCOUNT_TYPE, accountType.c_str());
         }
 
         if (tmpAccount != NULL) {
-            _debug ("Loading account %s \n", iter->c_str());
+            _debug ("Loading account %s ", iter->c_str());
             _accountMap[iter->c_str() ] = tmpAccount;
             nbAccount++;
         }
@@ -4272,17 +4207,17 @@ ManagerImpl::loadAccountMap()
 
     /*
     if (_directIpAccount == NULL) {
-        _debug ("Failed to create direct ip calls \"account\"\n");
+        _debug ("Failed to create direct ip calls \"account\"");
     } else {
         // Force the options to be loaded
         // No registration in the sense of
         // the REGISTER method is performed.
-        _debug ("Succeed to create direct ip calls \"account\"\n");
+        _debug ("Succeed to create direct ip calls \"account\"");
         _directIpAccount->registerVoIPLink();
     _accountMap[IP2IP_PROFILE] = _directIpAccount;
     }
     */
-    _debug ("nbAccount loaded %i \n", nbAccount);
+    _debug ("nbAccount loaded %i", nbAccount);
 
     return nbAccount;
 }
@@ -4295,7 +4230,7 @@ ManagerImpl::unloadAccountMap()
 
     while (iter != _accountMap.end()) {
 
-        _debug ("-> Unloading account %s\n", iter->first.c_str());
+        _debug ("-> Unloading account %s", iter->first.c_str());
         delete iter->second;
         iter->second = 0;
 
@@ -4323,7 +4258,7 @@ ManagerImpl::getAccount (const AccountID& accountID)
     // In our definition,
     // this is the "direct ip calls account"
     if (accountID == AccountNULL) {
-        _debug ("Returns the direct IP account\n");
+        _debug ("Returns the direct IP account");
         return _directIpAccount;
     }
 
@@ -4341,16 +4276,16 @@ ManagerImpl::getAccountIdFromNameAndServer (const std::string& userName, const s
 {
     AccountMap::iterator iter;
     SIPAccount *account;
-    _debug ("getAccountIdFromNameAndServer : username = %s , server = %s\n", userName.c_str(), server.c_str());
+    _debug ("getAccountIdFromNameAndServer : username = %s , server = %s", userName.c_str(), server.c_str());
     // Try to find the account id from username and server name by full match
 
     for (iter = _accountMap.begin(); iter != _accountMap.end(); ++iter) {
-        _debug ("for : account = %s\n", iter->first.c_str());
+        _debug ("for : account = %s", iter->first.c_str());
         account = dynamic_cast<SIPAccount *> (iter->second);
 
         if (account != NULL) {
             if (account->fullMatch (userName, server)) {
-                _debug ("Matching accountId in request is a fullmatch\n");
+                _debug ("Matching accountId in request is a fullmatch");
                 return iter->first;
             }
         }
@@ -4362,7 +4297,7 @@ ManagerImpl::getAccountIdFromNameAndServer (const std::string& userName, const s
 
         if (account != NULL) {
             if (account->hostnameMatch (server)) {
-                _debug ("Matching accountId in request with hostname\n");
+                _debug ("Matching accountId in request with hostname");
                 return iter->first;
             }
         }
@@ -4374,7 +4309,7 @@ ManagerImpl::getAccountIdFromNameAndServer (const std::string& userName, const s
 
         if (account != NULL) {
             if (account->userMatch (userName)) {
-                _debug ("Matching accountId in request with username\n");
+                _debug ("Matching accountId in request with username");
                 return iter->first;
             }
         }
@@ -4384,124 +4319,6 @@ ManagerImpl::getAccountIdFromNameAndServer (const std::string& userName, const s
     return AccountNULL;
 }
 
-void ManagerImpl::restartPJSIP (void)
-{
-    _debug ("ManagerImpl::restartPJSIP\n");
-    VoIPLink *link = getSIPAccountLink();
-    SIPVoIPLink *siplink = NULL;
-
-    if (link) {
-        siplink = dynamic_cast<SIPVoIPLink*> (getSIPAccountLink ());
-    }
-
-    _debug ("ManagerImpl::unregister sip account\n");
-
-    this->unregisterCurSIPAccounts();
-    /* Terminate and initialize the PJSIP library */
-
-    if (siplink) {
-        _debug ("ManagerImpl::Terminate sip\n");
-        siplink->terminate ();
-        siplink = SIPVoIPLink::instance ("");
-        _debug ("ManagerImpl::Init new sip\n");
-        siplink->init ();
-    }
-
-    _debug ("ManagerImpl::register sip account\n");
-
-    /* Then register all enabled SIP accounts */
-    this->registerCurSIPAccounts ();
-}
-
-VoIPLink* ManagerImpl::getAccountLink (const AccountID& accountID)
-{
-    if (accountID!=AccountNULL) {
-        Account* acc = getAccount (accountID);
-
-        if (acc) {
-            return acc->getVoIPLink();
-        }
-
-        return 0;
-    } else
-        return SIPVoIPLink::instance ("");
-}
-
-VoIPLink* ManagerImpl::getSIPAccountLink()
-{
-    /* We are looking for the first SIP account we met because all the SIP accounts have the same voiplink */
-    Account *account;
-    AccountMap::iterator iter = _accountMap.begin();
-
-    while (iter != _accountMap.end()) {
-
-        account = iter->second;
-
-        if (account->getType() == "sip") {
-            return account->getVoIPLink();
-        }
-
-        ++iter;
-    }
-
-    return NULL;
-}
-
-
-
-
-pjsip_regc *getSipRegcFromID (const AccountID& id UNUSED)
-{
-    /*SIPAccount *tmp = dynamic_cast<SIPAccount *>getAccount(id);
-    if(tmp != NULL)
-      return tmp->getSipRegc();
-    else*/
-    return NULL;
-}
-
-void ManagerImpl::unregisterCurSIPAccounts()
-{
-    Account *current;
-
-    AccountMap::iterator iter = _accountMap.begin();
-
-    while (iter != _accountMap.end()) {
-        current = iter->second;
-
-        if (current) {
-            if (current->isEnabled() && current->getType() == "sip") {
-                current->unregisterVoIPLink();
-            }
-        }
-
-        iter++;
-    }
-}
-
-void ManagerImpl::registerCurSIPAccounts (void)
-{
-
-    Account *current;
-
-    AccountMap::iterator iter = _accountMap.begin();
-
-    while (iter != _accountMap.end()) {
-        current = iter->second;
-
-        if (current) {
-            if (current->isEnabled() && current->getType() == "sip") {
-                //current->setVoIPLink(link);
-                current->registerVoIPLink();
-            }
-        }
-
-        current = NULL;
-
-        iter++;
-    }
-}
-
-
 std::map<std::string, int32_t> ManagerImpl::getAddressbookSettings ()
 {
 
@@ -4581,7 +4398,7 @@ void ManagerImpl::check_call_configuration (const CallID& id, const std::string
     Call::CallConfiguration config;
 
     if (to.find (SIP_SCHEME) == 0 || to.find (SIPS_SCHEME) == 0) {
-        _debug ("Sending Sip Call \n");
+        _debug ("Sending Sip Call ");
         config = Call::IPtoIP;
     } else {
         config = Call::Classic;
@@ -4598,7 +4415,7 @@ bool ManagerImpl::associateConfigToCall (const CallID& callID, Call::CallConfigu
 
     if (getConfigFromCall (callID) == CallConfigNULL) { // nothing with the same ID
         _callConfigMap[callID] = config;
-        _debug ("Associate Call %s with config %i\n", callID.data(), config);
+        _debug ("Associate Call %s with config %i", callID.data(), config);
         return true;
     } else {
         return false;
@@ -4644,7 +4461,7 @@ std::map< std::string, std::string > ManagerImpl::getCallDetails (const CallID&
 
     // So first we fetch the account
     accountid = getAccountFromCall (callID);
-    _debug ("%s\n",callID.c_str());
+    _debug ("%s",callID.c_str());
     // Then the VoIP link this account is linked with (IAX2 or SIP)
 
     if ( (account=getAccount (accountid)) != 0) {
@@ -4664,7 +4481,7 @@ std::map< std::string, std::string > ManagerImpl::getCallDetails (const CallID&
         call_details.insert (std::pair<std::string, std::string> ("CALL_STATE", call->getStateStr ()));
         call_details.insert (std::pair<std::string, std::string> ("CALL_TYPE", type.str ()));
     } else {
-        _debug ("Error: Managerimpl - getCallDetails ()\n");
+        _debug ("Error: Managerimpl - getCallDetails ()");
         call_details.insert (std::pair<std::string, std::string> ("ACCOUNTID", AccountNULL));
         call_details.insert (std::pair<std::string, std::string> ("PEER_NUMBER", "Unknown"));
         call_details.insert (std::pair<std::string, std::string> ("PEER_NAME", "Unknown"));
@@ -4729,7 +4546,7 @@ ManagerImpl::getConferenceDetails (const ConfID& confID)
 std::vector< std::string >
 ManagerImpl::getConferenceList (void)
 {
-    _debug ("ManagerImpl::getConferenceList\n");
+    _debug ("ManagerImpl::getConferenceList");
     std::vector< std::string > v;
 
     ConferenceMap::iterator iter = _conferencemap.begin();
@@ -4746,7 +4563,7 @@ ManagerImpl::getConferenceList (void)
 std::vector< std::string >
 ManagerImpl::getParticipantList (const std::string& confID)
 {
-    _debug ("ManagerImpl::getParticipantList\n");
+    _debug ("ManagerImpl::getParticipantList");
     std::vector< std::string > v;
 
     ConferenceMap::iterator iter_conf = _conferencemap.find (confID);
diff --git a/sflphone-common/src/managerimpl.h b/sflphone-common/src/managerimpl.h
index 627170e88f5ea80012b414b881f395fc70253e7b..f173539d258e36e3c0ea25bd1e11198d83c09f3c 100644
--- a/sflphone-common/src/managerimpl.h
+++ b/sflphone-common/src/managerimpl.h
@@ -1027,6 +1027,14 @@ class ManagerImpl {
      */
     bool isCurrentCall(const CallID& callId);
 
+
+    /**
+     * Send registration to all enabled accounts
+     * @return 0 on registration success
+     *          1 otherelse
+     */
+    int registerAccounts();
+
     /**
      * Restart PJSIP
      * @param void
diff --git a/sflphone-common/src/managerimpl_registration.cpp b/sflphone-common/src/managerimpl_registration.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5e535e4b25b55e746916431e38564a26335f85a1
--- /dev/null
+++ b/sflphone-common/src/managerimpl_registration.cpp
@@ -0,0 +1,258 @@
+/*
+ *  Copyright (C) 2004-2007 Savoir-Faire Linux inc.
+ *  Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com>
+ *  Author: Yan Morin <yan.morin@savoirfairelinux.com>
+ *  Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
+ *  Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
+ *  Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
+ *  Author: Guillaume Carmel-Archambault <guillaume.carmel-archambault@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.
+ */
+
+#include "managerimpl.h"
+
+#include "account.h"
+#include "dbus/callmanager.h"
+#include "user_cfg.h"
+#include "global.h"
+#include "sip/sipaccount.h"
+
+#include "audio/audiolayer.h"
+#include "sip/sipvoiplink.h"
+#include "manager.h"
+#include "dbus/configurationmanager.h"
+
+#include "conference.h"
+
+#include <errno.h>
+#include <cstdlib>
+
+int
+ManagerImpl::registerAccounts()
+{
+    int status;
+    bool flag = true;
+    AccountMap::iterator iter;
+
+    _debugInit ("Initiate VoIP Links Registration");
+    iter = _accountMap.begin();
+
+    /* Loop on the account map previously loaded */
+
+    while (iter != _accountMap.end()) {
+        if (iter->second) {
+
+            if (iter->second->isEnabled()) {
+
+		_debug("Register account %s", iter->first.c_str());
+		
+                status = iter->second->registerVoIPLink();
+
+                if (status != SUCCESS) {
+                    flag = false;
+                }
+            }
+        }
+
+        iter++;
+    }
+
+    // calls the client notification here in case of errors at startup...
+    if (_audiodriver -> getErrorMessage() != -1)
+        notifyErrClient (_audiodriver -> getErrorMessage());
+
+    ASSERT (flag, true);
+
+    return SUCCESS;
+}
+
+//THREAD=Main
+int
+ManagerImpl::initRegisterAccounts()
+{
+    int status;
+    bool flag = true;
+    AccountMap::iterator iter;
+
+    _debugInit ("Initiate VoIP Links Registration");
+    iter = _accountMap.begin();
+
+    /* Loop on the account map previously loaded */
+
+    while (iter != _accountMap.end()) {
+        if (iter->second) {
+            iter->second->loadConfig();
+            /* If the account is set as enabled, try to register */
+
+            if (iter->second->isEnabled()) {
+                status = iter->second->registerVoIPLink();
+
+                if (status != SUCCESS) {
+                    flag = false;
+                }
+            }
+        }
+
+        iter++;
+    }
+
+    // calls the client notification here in case of errors at startup...
+    if (_audiodriver -> getErrorMessage() != -1)
+        notifyErrClient (_audiodriver -> getErrorMessage());
+
+    ASSERT (flag, true);
+
+    return SUCCESS;
+}
+
+void ManagerImpl::restartPJSIP (void)
+{
+    _debug ("ManagerImpl::restartPJSIP\n");
+    VoIPLink *link = getSIPAccountLink();
+    SIPVoIPLink *siplink = NULL;
+
+    if (link) {
+        siplink = dynamic_cast<SIPVoIPLink*> (getSIPAccountLink ());
+    }
+
+    _debug ("ManagerImpl::unregister sip account\n");
+
+    this->unregisterCurSIPAccounts();
+    /* Terminate and initialize the PJSIP library */
+
+    if (siplink) {
+        _debug ("ManagerImpl::Terminate sip\n");
+        siplink->terminate ();
+        siplink = SIPVoIPLink::instance ("");
+        _debug ("ManagerImpl::Init new sip\n");
+        siplink->init ();
+    }
+
+    _debug ("ManagerImpl::register sip account\n");
+
+    /* Then register all enabled SIP accounts */
+    this->registerCurSIPAccounts ();
+}
+
+VoIPLink* ManagerImpl::getAccountLink (const AccountID& accountID)
+{
+    if (accountID!=AccountNULL) {
+        Account* acc = getAccount (accountID);
+
+        if (acc) {
+            return acc->getVoIPLink();
+        }
+
+        return 0;
+    } else
+        return SIPVoIPLink::instance ("");
+}
+
+VoIPLink* ManagerImpl::getSIPAccountLink()
+{
+    /* We are looking for the first SIP account we met because all the SIP accounts have the same voiplink */
+    Account *account;
+    AccountMap::iterator iter = _accountMap.begin();
+
+    while (iter != _accountMap.end()) {
+
+        account = iter->second;
+
+        if (account->getType() == "sip") {
+            return account->getVoIPLink();
+        }
+
+        ++iter;
+    }
+
+    return NULL;
+}
+
+pjsip_regc *getSipRegcFromID (const AccountID& id UNUSED)
+{
+    /*SIPAccount *tmp = dynamic_cast<SIPAccount *>getAccount(id);
+    if(tmp != NULL)
+      return tmp->getSipRegc();
+    else*/
+    return NULL;
+}
+
+void ManagerImpl::unregisterCurSIPAccounts()
+{
+    Account *current;
+
+    AccountMap::iterator iter = _accountMap.begin();
+
+    while (iter != _accountMap.end()) {
+        current = iter->second;
+
+        if (current) {
+            if (current->isEnabled() && current->getType() == "sip") {
+                current->unregisterVoIPLink();
+            }
+        }
+
+        iter++;
+    }
+}
+
+void ManagerImpl::registerCurSIPAccounts (void)
+{
+
+    Account *current;
+
+    AccountMap::iterator iter = _accountMap.begin();
+
+    while (iter != _accountMap.end()) {
+        current = iter->second;
+
+        if (current) {
+            if (current->isEnabled() && current->getType() == "sip") {
+                //current->setVoIPLink(link);
+                current->registerVoIPLink();
+            }
+        }
+
+        current = NULL;
+
+        iter++;
+    }
+}
+
+void
+ManagerImpl::sendRegister (const std::string& accountID , const int32_t& enable)
+{
+
+    // Update the active field
+    setConfig (accountID, CONFIG_ACCOUNT_ENABLE, (enable == 1) ? TRUE_STR:FALSE_STR);
+
+    Account* acc = getAccount (accountID);
+    acc->loadConfig();
+
+    // Test on the freshly updated value
+
+    if (acc->isEnabled()) {
+        // Verify we aren't already registered, then register
+        _debug ("Send register for account %s\n" , accountID.c_str());
+        acc->registerVoIPLink();
+    } else {
+        // Verify we are already registered, then unregister
+        _debug ("Send unregister for account %s\n" , accountID.c_str());
+        acc->unregisterVoIPLink();
+    }
+
+}
+
diff --git a/sflphone-common/src/plug-in/audiorecorder/audiodsp.cpp b/sflphone-common/src/plug-in/audiorecorder/audiodsp.cpp
index 49ea4417cce81a6ee9e15193960b88b6804bba7f..f9b5c014ef5c7c4e5976946afb08ac2df028051c 100644
--- a/sflphone-common/src/plug-in/audiorecorder/audiodsp.cpp
+++ b/sflphone-common/src/plug-in/audiorecorder/audiodsp.cpp
@@ -39,8 +39,8 @@ AudioDSP::~AudioDSP()
 
 float AudioDSP::getRMS (int data)
 {
-    // printf("AudioDSP::getRMS() : bufPointer_ %i \n ", bufPointer_);
-    printf ("AudioDSP::getRMS() : %i \n", data);
+    // printf("AudioDSP::getRMS() : bufPointer_ %i  ", bufPointer_);
+    printf ("AudioDSP::getRMS() : %i ", data);
     circBuffer_[bufPointer_++] = (float) data;
 
     if (bufPointer_ >= bufferLength_)
@@ -57,13 +57,13 @@ float AudioDSP::computeRMS()
 
 
     for (int i = 0; i < bufferLength_; i++) {
-        // printf("AudioDSP::computeRMS() : i_ %i \n ", i);
+        // printf("AudioDSP::computeRMS() : i_ %i  ", i);
         rms += (float) (circBuffer_[i]*circBuffer_[i]);
     }
 
     rms = sqrt (rms / (float) bufferLength_);
 
-    // printf("AudioDSP::computeRMS() : RMS VALUE: %f \n", rms);
+    // printf("AudioDSP::computeRMS() : RMS VALUE: %f ", rms);
     return rms;
 
 }
diff --git a/sflphone-common/src/plug-in/audiorecorder/audiorecord.cpp b/sflphone-common/src/plug-in/audiorecorder/audiorecord.cpp
index 9b265de0ee33c9f53f73026cb14c676f949948a4..4ab7c6c9708ac4a4d2143ee410ebec482dfce5f1 100644
--- a/sflphone-common/src/plug-in/audiorecorder/audiorecord.cpp
+++ b/sflphone-common/src/plug-in/audiorecorder/audiorecord.cpp
@@ -93,12 +93,12 @@ void AudioRecord::initFileName (std::string peerNumber)
 
     if (fileType_ == FILE_RAW) {
         if (strstr (fileName_, ".raw") == NULL) {
-            printf ("AudioRecord::openFile::concatenate .raw file extension: name : %s \n", fileName_);
+            printf ("AudioRecord::openFile::concatenate .raw file extension: name : %s ", fileName_);
             fName.append (".raw");
         }
     } else if (fileType_ == FILE_WAV) {
         if (strstr (fileName_, ".wav") == NULL) {
-            printf ("AudioRecord::openFile::concatenate .wav file extension: name : %s \n", fileName_);
+            printf ("AudioRecord::openFile::concatenate .wav file extension: name : %s ", fileName_);
             fName.append (".wav");
         }
     }
@@ -110,14 +110,14 @@ void AudioRecord::openFile()
 {
 
 
-    _debug ("AudioRecord::openFile()\n");
+    _debug ("AudioRecord::openFile()");
 
     bool result = false;
 
-    _debug ("AudioRecord::openFile()\n");
+    _debug ("AudioRecord::openFile()");
 
     if (isFileExist()) {
-        _debug ("AudioRecord::Filename does not exist, creating one \n");
+        _debug ("AudioRecord::Filename does not exist, creating one ");
         byteCounter_ = 0;
 
         if (fileType_ == FILE_RAW) {
@@ -126,7 +126,7 @@ void AudioRecord::openFile()
             result = setWavFile();
         }
     } else {
-        _debug ("AudioRecord::Filename already exist opening it \n");
+        _debug ("AudioRecord::Filename already exist opening it ");
 
         if (fileType_ == FILE_RAW) {
             result = openExistingRawFile();
@@ -156,10 +156,10 @@ bool AudioRecord::isOpenFile()
 {
 
     if (fp) {
-        _debug ("AudioRecord::isOpenFile(): file already openend\n");
+        _debug ("AudioRecord::isOpenFile(): file already openend");
         return true;
     } else {
-        _debug ("AudioRecord::isOpenFIle(): file not openend \n");
+        _debug ("AudioRecord::isOpenFIle(): file not openend ");
         return false;
     }
 }
@@ -167,7 +167,7 @@ bool AudioRecord::isOpenFile()
 
 bool AudioRecord::isFileExist()
 {
-    _debug ("AudioRecord::isFileExist(): try to open name : %s \n", fileName_);
+    _debug ("AudioRecord::isFileExist(): try to open name : %s ", fileName_);
 
     if (fopen (fileName_,"rb") ==0) {
         return true;
@@ -178,7 +178,7 @@ bool AudioRecord::isFileExist()
 
 bool AudioRecord::isRecording()
 {
-    _debug ("AudioRecording::isRecording() %i \n", recordingEnabled_);
+    _debug ("AudioRecording::isRecording() %i ", recordingEnabled_);
 
 
     if (recordingEnabled_)
@@ -190,17 +190,17 @@ bool AudioRecord::isRecording()
 
 bool AudioRecord::setRecording()
 {
-    _debug ("AudioRecord::setRecording() \n");
+    _debug ("AudioRecord::setRecording() ");
 
     if (isOpenFile()) {
-        _debug ("AudioRecord::setRecording()::file already opened \n");
+        _debug ("AudioRecord::setRecording()::file already opened ");
 
         if (!recordingEnabled_)
             recordingEnabled_ = true;
         else
             recordingEnabled_ = false;
     } else {
-        _debug ("AudioRecord::setRecording():Opening the wave file in call during call instantiation \n");
+        _debug ("AudioRecord::setRecording():Opening the wave file in call during call instantiation ");
         openFile();
 
         recordingEnabled_ = true; // once opend file, start recording
@@ -213,7 +213,7 @@ bool AudioRecord::setRecording()
 
 void AudioRecord::stopRecording()
 {
-    _debug ("AudioRecording::stopRecording() \n");
+    _debug ("AudioRecording::stopRecording() ");
 
     if (recordingEnabled_)
         recordingEnabled_ = false;
@@ -270,7 +270,7 @@ void AudioRecord::createFilename()
     // fileName_ = out.str();
     strncpy (fileName_, out.str().c_str(), 8192);
 
-    printf ("AudioRecord::createFilename::filename for this call %s \n",fileName_);
+    printf ("AudioRecord::createFilename::filename for this call %s ",fileName_);
 }
 
 bool AudioRecord::setRawFile()
@@ -279,16 +279,16 @@ bool AudioRecord::setRawFile()
     fp = fopen (savePath_.c_str(), "wb");
 
     if (!fp) {
-        _debug ("AudioRecord::setRawFile() : could not create RAW file!\n");
+        _debug ("AudioRecord::setRawFile() : could not create RAW file!");
         return false;
     }
 
     if (sndFormat_ != INT16) {   // TODO need to change INT16 to SINT16
         sndFormat_ = INT16;
-        _debug ("AudioRecord::setRawFile() : using 16-bit signed integer data format for file.\n");
+        _debug ("AudioRecord::setRawFile() : using 16-bit signed integer data format for file.");
     }
 
-    _debug ("AudioRecord:setRawFile() : created RAW file.\n");
+    _debug ("AudioRecord:setRawFile() : created RAW file.");
 
     return true;
 }
@@ -300,7 +300,7 @@ bool AudioRecord::setWavFile()
     fp = fopen (savePath_.c_str(), "wb");
 
     if (!fp) {
-        _debug ("AudioRecord::setWavFile() : could not create WAV file.\n");
+        _debug ("AudioRecord::setWavFile() : could not create WAV file.");
         return false;
     }
 
@@ -328,11 +328,11 @@ bool AudioRecord::setWavFile()
 
 
     if (fwrite (&hdr, 4, 11, fp) != 11) {
-        _debug ("AudioRecord::setWavFile() : could not write WAV header for file. \n");
+        _debug ("AudioRecord::setWavFile() : could not write WAV header for file. ");
         return false;
     }
 
-    _debug ("AudioRecord::setWavFile() : created WAV file. \n");
+    _debug ("AudioRecord::setWavFile() : created WAV file. ");
 
     return true;
 }
@@ -343,7 +343,7 @@ bool AudioRecord::openExistingRawFile()
     fp = fopen (fileName_, "ab+");
 
     if (!fp) {
-        _debug ("AudioRecord::openExistingRawFile() : could not create RAW file!\n");
+        _debug ("AudioRecord::openExistingRawFile() : could not create RAW file!");
         return false;
     }
 
@@ -353,42 +353,42 @@ bool AudioRecord::openExistingRawFile()
 
 bool AudioRecord::openExistingWavFile()
 {
-    _debug ("AudioRecord::openExistingWavFile() \n");
+    _debug ("AudioRecord::openExistingWavFile() ");
 
     fp = fopen (fileName_, "rb+");
 
     if (!fp) {
-        _debug ("AudioRecord::openExistingWavFile() : could not open WAV file rb+!\n");
+        _debug ("AudioRecord::openExistingWavFile() : could not open WAV file rb+!");
         return false;
     }
 
-    printf ("AudioRecord::openExistingWavFile()::Tried to open %s \n",fileName_);
+    printf ("AudioRecord::openExistingWavFile()::Tried to open %s ",fileName_);
 
     if (fseek (fp, 40, SEEK_SET) != 0) // jump to data length
-        _debug ("AudioRecord::OpenExistingWavFile: 1.Couldn't seek offset 40 in the file \n");
+        _debug ("AudioRecord::OpenExistingWavFile: 1.Couldn't seek offset 40 in the file ");
 
     if (fread (&byteCounter_, 4, 1, fp))
-        _debug ("AudioRecord::OpenExistingWavFile : bytecounter Read successfully \n");
+        _debug ("AudioRecord::OpenExistingWavFile : bytecounter Read successfully ");
 
     if (fseek (fp, 0 , SEEK_END) != 0)
-        _debug ("AudioRecors::OpenExistingWavFile : 2.Couldn't seek at the en of the file \n");
+        _debug ("AudioRecors::OpenExistingWavFile : 2.Couldn't seek at the en of the file ");
 
-    printf ("AudioRecord::OpenExistingWavFile : Byte counter after oppening : %d \n", (int) byteCounter_);
+    printf ("AudioRecord::OpenExistingWavFile : Byte counter after oppening : %d ", (int) byteCounter_);
 
     if (fclose (fp) != 0)
-        _debug ("AudioRecord::openExistingWavFile()::ERROR: can't close file r+ \n");
+        _debug ("AudioRecord::openExistingWavFile()::ERROR: can't close file r+ ");
 
 
 
     fp = fopen (fileName_, "ab+");
 
     if (!fp) {
-        _debug ("AudioRecord::openExistingWavFile() : could not createopen WAV file ab+!\n");
+        _debug ("AudioRecord::openExistingWavFile() : could not createopen WAV file ab+!");
         return false;
     }
 
     if (fseek (fp, 4 , SEEK_END) != 0)
-        _debug ("AudioRecors::OpenExistingWavFile : 2.Couldn't seek at the en of the file \n");
+        _debug ("AudioRecors::OpenExistingWavFile : 2.Couldn't seek at the en of the file ");
 
     return true;
 
@@ -398,7 +398,7 @@ bool AudioRecord::openExistingWavFile()
 void AudioRecord::closeWavFile()
 {
     if (fp == 0) {
-        _debug ("AudioRecord:: Can't closeWavFile, a file has not yet been opened!\n");
+        _debug ("AudioRecord:: Can't closeWavFile, a file has not yet been opened!");
         return;
     }
 
@@ -407,28 +407,28 @@ void AudioRecord::closeWavFile()
 
     fseek (fp, 40, SEEK_SET); // jump to data length
 
-    if (ferror (fp)) perror ("AudioRecord::closeWavFile()::ERROR: can't reach offset 40\n");
+    if (ferror (fp)) perror ("AudioRecord::closeWavFile()::ERROR: can't reach offset 40");
 
     fwrite (&bytes, sizeof (SINT32), 1, fp);
 
-    if (ferror (fp)) perror ("AudioRecord::closeWavFile()::ERROR: can't write bytes for data length \n");
+    if (ferror (fp)) perror ("AudioRecord::closeWavFile()::ERROR: can't write bytes for data length ");
 
-    printf ("AudioRecord::closeWavFile : data bytes: %i \n", (int) bytes);
+    printf ("AudioRecord::closeWavFile : data bytes: %i ", (int) bytes);
 
     bytes = byteCounter_ * channels_ + 44; // + 44 for the wave header
 
     fseek (fp, 4, SEEK_SET); // jump to file size
 
-    if (ferror (fp)) perror ("AudioRecord::closeWavFile()::ERROR: can't reach offset 4\n");
+    if (ferror (fp)) perror ("AudioRecord::closeWavFile()::ERROR: can't reach offset 4");
 
     fwrite (&bytes, 4, 1, fp);
 
-    if (ferror (fp)) perror ("AudioRecord::closeWavFile()::ERROR: can't reach offset 4\n");
+    if (ferror (fp)) perror ("AudioRecord::closeWavFile()::ERROR: can't reach offset 4");
 
-    printf ("AudioRecord::closeWavFile : bytes : %i \n", (int) bytes);
+    printf ("AudioRecord::closeWavFile : bytes : %i ", (int) bytes);
 
     if (fclose (fp) != 0)
-        _debug ("AudioRecord::closeWavFile()::ERROR: can't close file\n");
+        _debug ("AudioRecord::closeWavFile()::ERROR: can't close file");
 
 
 }
@@ -470,7 +470,7 @@ void AudioRecord::recData (SFLDataFormat* buffer, int nSamples)
     if (recordingEnabled_) {
 
         if (fp == 0) {
-            _debug ("AudioRecord: Can't record data, a file has not yet been opened!\n");
+            _debug ("AudioRecord: Can't record data, a file has not yet been opened!");
             return;
         }
 
@@ -478,7 +478,7 @@ void AudioRecord::recData (SFLDataFormat* buffer, int nSamples)
 
         if (sndFormat_ == INT16) {   // TODO change INT16 to SINT16
             if (fwrite (buffer, sizeof (SFLDataFormat), nSamples, fp) != (unsigned int) nSamples)
-                _debug ("AudioRecord: Could not record data! \n");
+                _debug ("AudioRecord: Could not record data! ");
             else {
                 fflush (fp);
                 byteCounter_ += (unsigned long) (nSamples*sizeof (SFLDataFormat));
@@ -496,7 +496,7 @@ void AudioRecord::recData (SFLDataFormat* buffer_1, SFLDataFormat* buffer_2, int
     if (recordingEnabled_) {
 
         if (fp == 0) {
-            _debug ("AudioRecord: Can't record data, a file has not yet been opened!\n");
+            _debug ("AudioRecord: Can't record data, a file has not yet been opened!");
             return;
         }
 
@@ -508,7 +508,7 @@ void AudioRecord::recData (SFLDataFormat* buffer_1, SFLDataFormat* buffer_2, int
 
 
                 if (fwrite (&mixBuffer_[k], 2, 1, fp) != 1)
-                    _debug ("AudioRecord: Could not record data!\n");
+                    _debug ("AudioRecord: Could not record data!");
                 else {
                     fflush (fp);
                 }
diff --git a/sflphone-common/src/plug-in/librarymanager.cpp b/sflphone-common/src/plug-in/librarymanager.cpp
index 24b8396469149d224db7999b28d923cb132ea103..f4fba8683bfd985075e7ede79cba759e535d23eb 100644
--- a/sflphone-common/src/plug-in/librarymanager.cpp
+++ b/sflphone-common/src/plug-in/librarymanager.cpp
@@ -36,14 +36,14 @@ LibraryManager::LibraryHandle LibraryManager::loadLibrary (const std::string &fi
     LibraryHandle pluginHandlePtr = NULL;
     const char *error;
 
-    _debug ("Loading dynamic library %s\n", filename.c_str());
+    _debug ("Loading dynamic library %s", filename.c_str());
 
     /* Load the library */
     pluginHandlePtr = dlopen (filename.c_str(), RTLD_LAZY);
 
     if (!pluginHandlePtr) {
         error = dlerror();
-        _debug ("Error while opening plug-in: %s\n", error);
+        _debug ("Error while opening plug-in: %s", error);
         return NULL;
     }
 
@@ -57,12 +57,12 @@ int LibraryManager::unloadLibrary ()
     if (_handlePtr == NULL)
         return 1;
 
-    _debug ("Unloading dynamic library ...\n");
+    _debug ("Unloading dynamic library ...");
 
     dlclose (_handlePtr);
 
     if (dlerror()) {
-        _debug ("Error unloading the library : %s\n...", dlerror());
+        _debug ("Error unloading the library : %s...", dlerror());
         return 1;
     }
 
@@ -96,7 +96,7 @@ LibraryManagerException::LibraryManagerException (const std::string &libraryName
 
 {
     if (_reason == loadingFailed)
-        _details = "Error when loading " + libraryName + "\n" + details;
+        _details = "Error when loading " + libraryName + "" + details;
     else
         _details = "Error when resolving symbol " + details + " in " + libraryName;
 }
diff --git a/sflphone-common/src/plug-in/pluginmanager.cpp b/sflphone-common/src/plug-in/pluginmanager.cpp
index 80197f6ccef529d2b0d19ef4a415d251923c3858..431f3eb8744bc2ea02b4ed9f37fa1908844abcd4 100644
--- a/sflphone-common/src/plug-in/pluginmanager.cpp
+++ b/sflphone-common/src/plug-in/pluginmanager.cpp
@@ -59,7 +59,7 @@ PluginManager::loadPlugins (const std::string &path)
 
     /* The directory in which plugins are dropped. Default: /usr/lib/sflphone/plugins/ */
     (path == "") ? pluginDir = std::string (PLUGINS_DIR).append ("/") :pluginDir = path;
-    _debug ("Loading plugins from %s...\n", pluginDir.c_str());
+    _debug ("Loading plugins from %s...", pluginDir.c_str());
 
     dir = opendir (pluginDir.c_str());
     /* Test if the directory exists or is readable */
@@ -79,13 +79,13 @@ PluginManager::loadPlugins (const std::string &path)
                 /* Instanciate the plugin object */
 
                 if (instanciatePlugin (library, &plugin) != 0) {
-                    _debug ("Error instanciating the plugin ...\n");
+                    _debug ("Error instanciating the plugin ...");
                     return 1;
                 }
 
                 /* Regitering the current plugin */
                 if (registerPlugin (plugin, library) != 0) {
-                    _debug ("Error registering the plugin ...\n");
+                    _debug ("Error registering the plugin ...");
                     return 1;
                 }
             }
@@ -115,14 +115,14 @@ PluginManager::unloadPlugins (void)
         info = iter->second;
 
         if (deletePlugin (info) != 0) {
-            _debug ("Error deleting the plugin ... \n");
+            _debug ("Error deleting the plugin ... ");
             return 1;
         }
 
         unloadDynamicLibrary (info->_libraryPtr);
 
         if (unregisterPlugin (info) != 0) {
-            _debug ("Error unregistering the plugin ... \n");
+            _debug ("Error unregistering the plugin ... ");
             return 1;
         }
 
@@ -161,7 +161,7 @@ PluginManager::loadDynamicLibrary (const std::string& filename)
 int
 PluginManager::unloadDynamicLibrary (LibraryManager *libraryPtr)
 {
-    _debug ("Unloading dynamic library ...\n");
+    _debug ("Unloading dynamic library ...");
     /* Close it */
     return libraryPtr->unloadLibrary ();
 }
diff --git a/sflphone-common/src/sip/sdp.cpp b/sflphone-common/src/sip/sdp.cpp
index 942da7db35588c36871dc10e1133bb42bcd3c35e..c9cf1b6e97bf2d281f2d207cc7bbb54f567e71e5 100644
--- a/sflphone-common/src/sip/sdp.cpp
+++ b/sflphone-common/src/sip/sdp.cpp
@@ -91,7 +91,7 @@ void Sdp::set_media_descriptor_line (sdpMedia *media, pjmedia_sdp_media** p_med)
     for (i=0; i<count; i++) {
         codec = media->get_media_codec_list() [i];
         tmp = this->convert_int_to_string (codec->getPayload ());
-        _debug ("%s\n", tmp.c_str());
+        _debug ("%s", tmp.c_str());
         pj_strdup2 (_pool, &med->desc.fmt[i], tmp.c_str());
 
         // Add a rtpmap field for each codec
@@ -127,7 +127,7 @@ void Sdp::set_media_descriptor_line (sdpMedia *media, pjmedia_sdp_media** p_med)
             throw;
         }
     } else {
-        _debug ("No hash specified\n");
+        _debug ("No hash specified");
     }
 
     *p_med = med;
@@ -137,7 +137,7 @@ int Sdp::create_local_offer ()
 {
     pj_status_t status;
 
-    _debug ("Create local offer\n");
+    _debug ("Create local offer");
     // Build local media capabilities
     set_local_media_capabilities ();
 
@@ -172,12 +172,12 @@ int Sdp::create_initial_offer()
     pj_status_t status;
     pjmedia_sdp_neg_state state;
 
-    _debug ("Create initial offer\n");
+    _debug ("Create initial offer");
     // Build the SDP session descriptor
     status = create_local_offer();
 
     if (status != PJ_SUCCESS) {
-        _debug ("    Error: Failled to create initial offer\n");
+        _debug ("    Error: Failled to create initial offer");
         return status;
     }
 
@@ -185,7 +185,7 @@ int Sdp::create_initial_offer()
     status = pjmedia_sdp_neg_create_w_local_offer (_pool, get_local_sdp_session(), &_negociator);
 
     if (status != PJ_SUCCESS) {
-        _debug ("    Error: Failled to create an initial SDP negociator\n");
+        _debug ("    Error: Failled to create an initial SDP negociator");
         return status;
     }
 
@@ -193,7 +193,7 @@ int Sdp::create_initial_offer()
 
     PJ_ASSERT_RETURN (status == PJ_SUCCESS, 1);
 
-    _debug ("    Initial offer created succesfully\n");
+    _debug ("    Initial offer created succesfully");
 
     return PJ_SUCCESS;
 }
@@ -205,7 +205,7 @@ int Sdp::receiving_initial_offer (pjmedia_sdp_session* remote)
 
     pj_status_t status;
 
-    _debug ("Receiving initial offer\n");
+    _debug ("Receiving initial offer");
 
     // Create the SDP negociator instance by calling
     // pjmedia_sdp_neg_create_w_remote_offer with the remote offer, and by providing the local offer ( optional )
@@ -246,12 +246,12 @@ pj_status_t Sdp::check_sdp_answer (pjsip_inv_session *inv, pjsip_rx_data *rdata)
         }
 
         if (message->body == NULL) {
-            _debug ("Empty message body\n");
+            _debug ("Empty message body");
             return PJMEDIA_SDP_EINSDP;
         }
 
         if (pj_stricmp (&message->body->content_type.type, &str_application) || pj_stricmp (&message->body->content_type.subtype, &str_sdp)) {
-            _debug ("Incoming Message does not contain SDP\n");
+            _debug ("Incoming Message does not contain SDP");
             return PJMEDIA_SDP_EINSDP;
         }
 
@@ -263,17 +263,17 @@ pj_status_t Sdp::check_sdp_answer (pjsip_inv_session *inv, pjsip_rx_data *rdata)
         }
 
         if (status != PJ_SUCCESS) {
-            _debug ("SDP cannot be validated\n");
+            _debug ("SDP cannot be validated");
             return PJMEDIA_SDP_EINSDP;
         }
 
         // This is an answer
-        _debug ("Got SDP answer %s\n", pjsip_rx_data_get_info (rdata));
+        _debug ("Got SDP answer %s", pjsip_rx_data_get_info (rdata));
 
         status = pjmedia_sdp_neg_set_remote_answer (inv->pool, inv->neg, remote_sdp);
 
         if (status != PJ_SUCCESS) {
-            _debug ("An error occured while processing remote answer %s\n", pjsip_rx_data_get_info (rdata));
+            _debug ("An error occured while processing remote answer %s", pjsip_rx_data_get_info (rdata));
             return PJMEDIA_SDP_EINSDP;
         }
 
@@ -282,9 +282,9 @@ pj_status_t Sdp::check_sdp_answer (pjsip_inv_session *inv, pjsip_rx_data *rdata)
 
         status = pjmedia_sdp_neg_negotiate (inv->pool, inv->neg, 0);
 
-        _debug ("Negotiation returned with status %d PJ_SUCCESS being %d\n", status, PJ_SUCCESS);
+        _debug ("Negotiation returned with status %d PJ_SUCCESS being %d", status, PJ_SUCCESS);
     } else {
-        _debug ("No need to check sdp answer since we are UAS\n");
+        _debug ("No need to check sdp answer since we are UAS");
         return PJ_SUCCESS;
     }
 
@@ -446,9 +446,9 @@ void Sdp::set_negotiated_sdp (const pjmedia_sdp_session *sdp)
 
             pjmedia_sdp_attr_to_rtpmap (_pool, attribute, &rtpmap);
 
-            // _debug("================== set_negociated_offer ===================== %i\n", pj_strtoul(&rtpmap->pt));
-            // _debug("================== set_negociated_offer ===================== %s\n", current->desc.fmt[j].ptr);
-            // _debug("================== set_negociated_offer ===================== %i\n", atoi(current->desc.fmt[j].ptr));
+            // _debug("================== set_negociated_offer ===================== %i", pj_strtoul(&rtpmap->pt));
+            // _debug("================== set_negociated_offer ===================== %s", current->desc.fmt[j].ptr);
+            // _debug("================== set_negociated_offer ===================== %i", atoi(current->desc.fmt[j].ptr));
             iter = codecs_list.find ( (AudioCodecType) pj_strtoul (&rtpmap->pt));
 
             if (iter==codecs_list.end())
@@ -469,7 +469,7 @@ AudioCodec* Sdp::get_session_media (void)
     AudioCodec *codec = NULL;
     std::vector<sdpMedia*> media_list;
 
-    _debug ("Executing sdp line %d - get_session_media ()\n", __LINE__);
+    _debug ("Executing sdp line %d - get_session_media ()", __LINE__);
 
     media_list = get_session_media_list ();
     nb_media = media_list.size();
@@ -521,8 +521,7 @@ void Sdp::toString (void)
 
     sdp << "\n";
 
-    _debug ("LOCAL SDP: \n%s\n", sdp.str().c_str());
-
+    _debug ("LOCAL SDP: \n%s", sdp.str().c_str());
 }
 
 void Sdp::set_local_media_capabilities ()
@@ -537,7 +536,7 @@ void Sdp::set_local_media_capabilities ()
     // Clean it first
     _local_media_cap.clear();
 
-    _debug ("Fetch local media capabilities. Local extern audio port: %i\n" , get_local_extern_audio_port());
+    _debug ("Fetch local media capabilities. Local extern audio port: %i" , get_local_extern_audio_port());
 
     /* Only one audio media used right now */
     audio = new sdpMedia (MIME_TYPE_AUDIO);
@@ -585,7 +584,7 @@ void Sdp::set_remote_ip_from_sdp (const pjmedia_sdp_session *r_sdp)
 {
 
     std::string remote_ip (r_sdp->conn->addr.ptr, r_sdp->conn->addr.slen);
-    _debug ("            Remote IP from fetching SDP: %s\n", remote_ip.c_str());
+    _debug ("            Remote IP from fetching SDP: %s", remote_ip.c_str());
     this->set_remote_ip (remote_ip);
 }
 
@@ -595,21 +594,21 @@ void Sdp::set_remote_audio_port_from_sdp (pjmedia_sdp_media *r_media)
     int remote_port;
 
     remote_port = r_media->desc.port;
-    _debug ("            Remote Audio Port from fetching SDP: %d\n", remote_port);
+    _debug ("            Remote Audio Port from fetching SDP: %d", remote_port);
     this->set_remote_audio_port (remote_port);
 }
 
 void Sdp::set_media_transport_info_from_remote_sdp (const pjmedia_sdp_session *remote_sdp)
 {
 
-    _debug ("Fetching media from sdp\n");
+    _debug ("Fetching media from sdp");
 
     pjmedia_sdp_media *r_media;
 
     this->get_remote_sdp_media_from_offer (remote_sdp, &r_media);
 
     if (r_media==NULL) {
-        _debug ("SDP Failure: no remote sdp media found in the remote offer\n");
+        _debug ("SDP Failure: no remote sdp media found in the remote offer");
         return;
     }
 
diff --git a/sflphone-common/src/sip/sipaccount.cpp b/sflphone-common/src/sip/sipaccount.cpp
index fe36571c986ff556d92fe9c158a3fa4b81807b1f..26ee3ca7816a9c1b25aadf289088054e787e984c 100644
--- a/sflphone-common/src/sip/sipaccount.cpp
+++ b/sflphone-common/src/sip/sipaccount.cpp
@@ -80,7 +80,7 @@ int SIPAccount::initCredential (void)
     pjsip_cred_info * cred_info = (pjsip_cred_info *) malloc (sizeof (pjsip_cred_info) * (credentialCount));
 
     if (cred_info == NULL) {
-        _debug ("Failed to set cred_info for account %s\n", _accountID.c_str());
+        _debug ("Failed to set cred_info for account %s", _accountID.c_str());
         return !SUCCESS;
     }
 
@@ -105,7 +105,7 @@ int SIPAccount::initCredential (void)
 // on an assertion.
     if (md5HashingEnabled && _password.length() == 32) {
         dataType = PJSIP_CRED_DATA_DIGEST;
-        _debug ("Setting digest \n");
+        _debug ("Setting digest ");
     } else {
         dataType = PJSIP_CRED_DATA_PLAIN_PASSWD;
     }
@@ -140,7 +140,7 @@ int SIPAccount::initCredential (void)
 
         if (md5HashingEnabled && _password.length() == 32) {
             dataType = PJSIP_CRED_DATA_DIGEST;
-            _debug ("Setting digest \n");
+            _debug ("Setting digest ");
         } else {
             dataType = PJSIP_CRED_DATA_PLAIN_PASSWD;
         }
@@ -149,7 +149,7 @@ int SIPAccount::initCredential (void)
 
         cred_info[i].scheme = pj_str ( (char*) "digest");
 
-        _debug ("Setting credential %d realm = %s passwd = %s username = %s data_type = %d\n", i, realm.c_str(), password.c_str(), username.c_str(), cred_info[i].data_type);
+        _debug ("Setting credential %d realm = %s passwd = %s username = %s data_type = %d", i, realm.c_str(), password.c_str(), username.c_str(), cred_info[i].data_type);
     }
 
     _credentialCount = credentialCount;
@@ -203,7 +203,7 @@ int SIPAccount::registerVoIPLink()
 
 int SIPAccount::unregisterVoIPLink()
 {
-    _debug ("Unregister account %s\n" , getAccountID().c_str());
+    _debug ("Unregister account %s" , getAccountID().c_str());
 
     if (_accountID == IP2IP_PROFILE) {
         return true;
@@ -533,7 +533,7 @@ std::string SIPAccount::getContactHeader (const std::string& address, const std:
 
     _displayName = Manager::instance().getConfigString (_accountID, DISPLAY_NAME);
 
-    _debug ("Display Name: %s\n", _displayName.c_str());
+    _debug ("Display Name: %s", _displayName.c_str());
 
     int len = pj_ansi_snprintf (contact, PJSIP_MAX_URL_SIZE,
 
diff --git a/sflphone-common/src/sip/sipcall.cpp b/sflphone-common/src/sip/sipcall.cpp
index 60680c779a8cf3f0e0b8dbf505b17e7e06f5ba97..d1e22660c64e97650684a27048114b875de382e2 100644
--- a/sflphone-common/src/sip/sipcall.cpp
+++ b/sflphone-common/src/sip/sipcall.cpp
@@ -34,7 +34,7 @@ SIPCall::SIPCall (const CallID& id, Call::CallType type, pj_pool_t *pool) : Call
         , _local_sdp (0)
 {
     _local_sdp = new Sdp (pool);
-    _debug ("SIPCALL::Constructor for this class is called \n");
+    _debug ("SIPCALL::Constructor for this class is called ");
 }
 
 SIPCall::~SIPCall()
@@ -43,7 +43,7 @@ SIPCall::~SIPCall()
     _audiortp = 0;
     delete _local_sdp;
     _local_sdp = 0;
-    _debug ("SIPCALL::Destructor for this class is called \n");
+    _debug ("SIPCALL::Destructor for this class is called ");
 }
 
 
diff --git a/sflphone-common/src/sip/sipvoiplink.cpp b/sflphone-common/src/sip/sipvoiplink.cpp
index a4fc3fb56285a121f003bbb10eff382b88492406..580fb180062b3c4e51cbb1e1394ff9801b12d1fc 100644
--- a/sflphone-common/src/sip/sipvoiplink.cpp
+++ b/sflphone-common/src/sip/sipvoiplink.cpp
@@ -246,7 +246,7 @@ SIPVoIPLink* SIPVoIPLink::instance (const AccountID& id)
 {
 
     if (!_instance) {
-        _debug ("Create new SIPVoIPLink instance\n");
+        _debug ("Create new SIPVoIPLink instance");
         _instance = new SIPVoIPLink (id);
     }
 
@@ -434,15 +434,15 @@ int SIPVoIPLink::sendRegister (AccountID id)
         while (result.status == 0x12345678) {
             pj_time_val timeout = { 1, 0 };
             pjsip_endpt_handle_events (_endpt, &timeout);
-            _debug ("status : %d\n", result.status);
+            _debug ("status : %d", result.status);
         }
 
         if (result.status != PJ_SUCCESS) {
             _debug ("Failed to resolve hostname only once."
                     " Default resolver will be used on"
-                    " hostname for all requests.\n");
+                    " hostname for all requests.");
         } else {
-            _debug ("%d servers where obtained from name resolution.\n", result.servers.count);
+            _debug ("%d servers where obtained from name resolution.", result.servers.count);
             char addr_buf[80];
 
             pj_sockaddr_print ( (pj_sockaddr_t*) &result.servers.entry[0].addr, addr_buf, sizeof (addr_buf), 3);
@@ -455,11 +455,11 @@ int SIPVoIPLink::sendRegister (AccountID id)
     if (account->isTlsEnabled()) {
         pj_status_t status;
 
-        _debug ("    sendRegister: createTlsTransport\n");
+        _debug ("    sendRegister: createTlsTransport");
         status = createTlsTransportRetryOnFailure (id);
 
         if (status != PJ_SUCCESS) {
-            _debug ("Failed to initialize TLS transport for account %s\n", id.c_str());
+            _debug ("Failed to initialize TLS transport for account %s", id.c_str());
         }
     }
 
@@ -468,11 +468,11 @@ int SIPVoIPLink::sendRegister (AccountID id)
         if (account->isStunEnabled ()) {
             pj_status_t status;
 
-            _debug ("    sendRegister: createAlternateUdpTransport\n");
+            _debug ("    sendRegister: createAlternateUdpTransport");
             status = createAlternateUdpTransport (id);
 
             if (status != PJ_SUCCESS) {
-                _debug ("Failed to initialize UDP transport with an extern published address for account %s\n", id.c_str());
+                _debug ("Failed to initialize UDP transport with an extern published address for account %s", id.c_str());
             }
         } else {
 
@@ -506,7 +506,7 @@ int SIPVoIPLink::sendRegister (AccountID id)
     status = pjsip_regc_create (_endpt, (void*) account, &regc_cb, &regc);
 
     if (status != PJ_SUCCESS) {
-        _debug ("UserAgent: Unable to create regc.\n");
+        _debug ("UserAgent: Unable to create regc.");
         _mutexSIP.leaveMutex();
         return false;
     }
@@ -538,7 +538,7 @@ int SIPVoIPLink::sendRegister (AccountID id)
 
     contactUri = account->getContactHeader (address, portStr);
 
-    _debug ("sendRegister: fromUri: %s serverUri: %s contactUri: %s\n",
+    _debug ("sendRegister: fromUri: %s serverUri: %s contactUri: %s",
             fromUri.c_str(),
             srvUri.c_str(),
             contactUri.c_str());
@@ -559,7 +559,7 @@ int SIPVoIPLink::sendRegister (AccountID id)
     status = pjsip_regc_init (regc, &pjSrv, &pjFrom, &pjFrom, 1, &pjContact, expire_value);
 
     if (status != PJ_SUCCESS) {
-        _debug ("UserAgent: Unable to initialize account %d in sendRegister\n", status);
+        _debug ("UserAgent: Unable to initialize account %d in sendRegister", status);
         _mutexSIP.leaveMutex();
         return false;
     }
@@ -567,7 +567,7 @@ int SIPVoIPLink::sendRegister (AccountID id)
     pjsip_cred_info *cred = account->getCredInfo();
 
     int credential_count = account->getCredentialCount();
-    _debug ("setting %d credentials in sendRegister\n", credential_count);
+    _debug ("setting %d credentials in sendRegister", credential_count);
     pjsip_regc_set_credentials (regc, credential_count, cred);
 
     // Add User-Agent Header
@@ -584,7 +584,7 @@ int SIPVoIPLink::sendRegister (AccountID id)
     status = pjsip_regc_register (regc, PJ_TRUE, &tdata);
 
     if (status != PJ_SUCCESS) {
-        _debug ("UserAgent: Unable to register regc.\n");
+        _debug ("UserAgent: Unable to register regc.");
         _mutexSIP.leaveMutex();
         return false;
     }
@@ -595,7 +595,7 @@ int SIPVoIPLink::sendRegister (AccountID id)
     status = pjsip_regc_set_transport (regc, tp);
 
     if (status != PJ_SUCCESS) {
-        _debug ("UserAgent: Unable to set transport.\n");
+        _debug ("UserAgent: Unable to set transport.");
         _mutexSIP.leaveMutex ();
         return false;
     }
@@ -604,7 +604,7 @@ int SIPVoIPLink::sendRegister (AccountID id)
     status = pjsip_regc_send (regc, tdata);
 
     if (status != PJ_SUCCESS) {
-        _debug ("UserAgent: Unable to send regc request.\n");
+        _debug ("UserAgent: Unable to send regc request.");
         _mutexSIP.leaveMutex();
         return false;
     }
@@ -612,7 +612,6 @@ int SIPVoIPLink::sendRegister (AccountID id)
     _mutexSIP.leaveMutex();
 
     account->setRegistrationInfo (regc);
-
     return true;
 }
 
@@ -636,18 +635,18 @@ SIPVoIPLink::sendUnregister (AccountID id)
         status = pjsip_regc_unregister (regc, &tdata);
 
         if (status != PJ_SUCCESS) {
-            _debug ("UserAgent: Unable to unregister regc.\n");
+            _debug ("UserAgent: Unable to unregister regc.");
             return false;
         }
 
         status = pjsip_regc_send (regc, tdata);
 
         if (status != PJ_SUCCESS) {
-            _debug ("UserAgent: Unable to send regc request.\n");
+            _debug ("UserAgent: Unable to send regc request.");
             return false;
         }
     } else {
-        _debug ("UserAgent: regc is null!\n");
+        _debug ("UserAgent: regc is null!");
         return false;
     }
 
@@ -670,7 +669,7 @@ SIPVoIPLink::newOutgoingCall (const CallID& id, const std::string& toUrl)
         account = dynamic_cast<SIPAccount *> (Manager::instance().getAccount (Manager::instance().getAccountFromCall (id)));
 
         if (account == NULL) {
-            _debug ("Error retrieving the account to the make the call with\n");
+            _debug ("Error retrieving the account to the make the call with");
             call->setConnectionState (Call::Disconnected);
             call->setState (Call::Error);
             delete call;
@@ -693,15 +692,15 @@ SIPVoIPLink::newOutgoingCall (const CallID& id, const std::string& toUrl)
 			loadSIPLocalIP (&addrSdp);
 
         try {
-            _debug ("Creating new rtp session in newOutgoingCall\n");
+            _debug ("Creating new rtp session in newOutgoingCall");
             call->getAudioRtp()->initAudioRtpSession (call);
         } catch (...) {
-            _debug ("Failed to create rtp thread from newOutGoingCall\n");
+            _debug ("Failed to create rtp thread from newOutGoingCall");
         }
 
         call->initRecFileName();
 
-        _debug ("Try to make a call to: %s with call ID: %s\n", toUrl.data(), id.data());
+        _debug ("Try to make a call to: %s with call ID: %s", toUrl.data(), id.data());
         // Building the local SDP offer
         // localAddr = getLocalAddressAssociatedToAccount (account->getAccountID());
         call->getLocalSDP()->set_ip_address (addrSdp);
@@ -735,12 +734,12 @@ SIPVoIPLink::answer (const CallID& id)
     Sdp *local_sdp;
     pjsip_inv_session *inv_session;
 
-    _debug ("SIPVoIPLink::answer: start answering \n");
+    _debug ("SIPVoIPLink::answer: start answering ");
 
     call = getSIPCall (id);
 
     if (call==0) {
-        _debug ("! SIP Failure: SIPCall doesn't exists\n");
+        _debug ("! SIP Failure: SIPCall doesn't exists");
         return false;
     }
 
@@ -749,7 +748,7 @@ SIPVoIPLink::answer (const CallID& id)
     try {
         call->getAudioRtp()->initAudioRtpSession (call);
     } catch (...) {
-        _debug ("Failed to create rtp thread from answer\n");
+        _debug ("Failed to create rtp thread from answer");
     }
 
     inv_session = call->getInvSession();
@@ -758,7 +757,7 @@ SIPVoIPLink::answer (const CallID& id)
 
     if (status == PJ_SUCCESS) {
 
-        _debug ("SIPVoIPLink::answer:UserAgent: Negociation success! : call %s \n", call->getCallId().c_str());
+        _debug ("SIPVoIPLink::answer:UserAgent: Negociation success! : call %s ", call->getCallId().c_str());
         // Create and send a 200(OK) response
         status = pjsip_inv_answer (inv_session, PJSIP_SC_OK, NULL, NULL, &tdata);
         PJ_ASSERT_RETURN (status == PJ_SUCCESS, 1);
@@ -779,7 +778,7 @@ SIPVoIPLink::answer (const CallID& id)
         PJ_ASSERT_RETURN (status == PJ_SUCCESS, 1);
 
         // Terminate the call
-        _debug ("SIPVoIPLink::answer: fail terminate call %s \n",call->getCallId().c_str());
+        _debug ("SIPVoIPLink::answer: fail terminate call %s ",call->getCallId().c_str());
 
         if (call->getAudioRtp())
             call->getAudioRtp()->stop ();
@@ -802,7 +801,7 @@ SIPVoIPLink::hangup (const CallID& id)
     call = getSIPCall (id);
 
     if (call==0) {
-        _debug ("! SIP Error: Call doesn't exist\n");
+        _debug ("! SIP Error: Call doesn't exist");
         return false;
     }
 
@@ -834,11 +833,10 @@ SIPVoIPLink::hangup (const CallID& id)
 
     // Release RTP thread
     if (Manager::instance().isCurrentCall (id)) {
-        _debug ("* SIP Info: Stopping AudioRTP for hangup\n");
+        _debug ("* SIP Info: Stopping AudioRTP for hangup");
         call->getAudioRtp()->stop();
     }
 
-
     terminateOneCall (id);
 
     removeCall (id);
@@ -856,7 +854,7 @@ SIPVoIPLink::peerHungup (const CallID& id)
     call = getSIPCall (id);
 
     if (call==0) {
-        _debug ("! SIP Error: Call doesn't exist\n");
+        _debug ("! SIP Error: Call doesn't exist");
         return false;
     }
 
@@ -885,7 +883,7 @@ SIPVoIPLink::peerHungup (const CallID& id)
 
     // Release RTP thread
     if (Manager::instance().isCurrentCall (id)) {
-        _debug ("* SIP Info: Stopping AudioRTP for hangup\n");
+        _debug ("* SIP Info: Stopping AudioRTP for hangup");
         call->getAudioRtp()->stop();
     }
 
@@ -903,11 +901,11 @@ SIPVoIPLink::cancel (const CallID& id)
     SIPCall* call = getSIPCall (id);
 
     if (call==0) {
-        _debug ("! SIP Error: Call doesn't exist\n");
+        _debug ("! SIP Error: Call doesn't exist");
         return false;
     }
 
-    _debug ("- SIP Action: Cancel call %s [cid: %3d]\n", id.data(), call->getCid());
+    _debug ("- SIP Action: Cancel call %s [cid: %3d]", id.data(), call->getCid());
 
     terminateOneCall (id);
     removeCall (id);
@@ -925,7 +923,7 @@ SIPVoIPLink::onhold (const CallID& id)
     call = getSIPCall (id);
 
     if (call==0) {
-        _debug ("! SIP Error: call doesn't exist\n");
+        _debug ("! SIP Error: call doesn't exist");
         return false;
     }
 
@@ -935,7 +933,7 @@ SIPVoIPLink::onhold (const CallID& id)
 
     call->setState (Call::Hold);
 
-    _debug ("* SIP Info: Stopping AudioRTP for onhold action\n");
+    _debug ("* SIP Info: Stopping AudioRTP for onhold action");
 
     call->getAudioRtp()->stop();
 
@@ -959,7 +957,7 @@ int SIPVoIPLink::inv_session_reinvite (SIPCall *call, std::string direction)
     local_sdp = call->getLocalSDP()->get_local_sdp_session();
 
     if (local_sdp == NULL) {
-        _debug ("! SIP Failure: unable to find local_sdp\n");
+        _debug ("! SIP Failure: unable to find local_sdp");
         return !PJ_SUCCESS;
     }
 	
@@ -1002,14 +1000,14 @@ SIPVoIPLink::offhold (const CallID& id)
     call = getSIPCall (id);
 
     if (call==0) {
-        _debug ("! SIP Error: Call doesn't exist\n");
+        _debug ("! SIP Error: Call doesn't exist");
         return false;
     }
 
     try {
         call->getAudioRtp()->initAudioRtpSession (call);
     } catch (...) {
-        _debug ("! SIP Failure: Unable to create RTP Session (%s:%d)\n", __FILE__, __LINE__);
+        _debug ("! SIP Failure: Unable to create RTP Session (%s:%d)", __FILE__, __LINE__);
     }
 
     /* Create re-INVITE with new offer */
@@ -1043,12 +1041,12 @@ SIPVoIPLink::transfer (const CallID& id, const std::string& to)
     account = dynamic_cast<SIPAccount *> (Manager::instance().getAccount (account_id));
 
     if (account == NULL) {
-        _debug ("SIPVoIPLink::transfer account is null. Returning.\n");
+        _debug ("SIPVoIPLink::transfer account is null. Returning.");
         return false;
     }
 
     if (call==0) {
-        _debug ("! SIP Failure: Call doesn't exist\n");
+        _debug ("! SIP Failure: Call doesn't exist");
         return false;
     }
 
@@ -1061,7 +1059,7 @@ SIPVoIPLink::transfer (const CallID& id, const std::string& to)
         pj_cstr (&pjDest, dest.c_str());
     }
 
-    _debug ("Transfering to %s\n", dest.c_str());
+    _debug ("Transfering to %s", dest.c_str());
 
     /* Create xfer client subscription. */
     pj_bzero (&xfer_cb, sizeof (xfer_cb));
@@ -1070,7 +1068,7 @@ SIPVoIPLink::transfer (const CallID& id, const std::string& to)
     status = pjsip_xfer_create_uac (call->getInvSession()->dlg, &xfer_cb, &sub);
 
     if (status != PJ_SUCCESS) {
-        _debug ("UserAgent: Unable to create xfer -- %d\n", status);
+        _debug ("UserAgent: Unable to create xfer -- %d", status);
         return false;
     }
 
@@ -1087,7 +1085,7 @@ SIPVoIPLink::transfer (const CallID& id, const std::string& to)
     status = pjsip_xfer_initiate (sub, &pjDest, &tdata);
 
     if (status != PJ_SUCCESS) {
-        _debug ("UserAgent: Unable to create REFER request -- %d\n", status);
+        _debug ("UserAgent: Unable to create REFER request -- %d", status);
         return false;
     }
 
@@ -1095,7 +1093,7 @@ SIPVoIPLink::transfer (const CallID& id, const std::string& to)
     status = pjsip_xfer_send_request (sub, tdata);
 
     if (status != PJ_SUCCESS) {
-        _debug ("UserAgent: Unable to send REFER request -- %d\n", status);
+        _debug ("UserAgent: Unable to send REFER request -- %d", status);
         return false;
     }
 
@@ -1119,13 +1117,13 @@ SIPVoIPLink::refuse (const CallID& id)
     call = getSIPCall (id);
 
     if (call==0) {
-        _debug ("Call doesn't exist\n");
+        _debug ("Call doesn't exist");
         return false;
     }
 
     // can't refuse outgoing call or connected
     if (!call->isIncoming() || call->getConnectionState() == Call::Connected) {
-        _debug ("It's not an incoming call, or it's already answered\n");
+        _debug ("It's not an incoming call, or it's already answered");
         return false;
     }
 
@@ -1184,7 +1182,7 @@ SIPVoIPLink::carryingDTMFdigits (const CallID& id, char code)
     call = getSIPCall (id);
 
     if (call==0) {
-        _debug ("Call doesn't exist\n");
+        _debug ("Call doesn't exist");
         return false;
     }
 
@@ -1201,7 +1199,7 @@ SIPVoIPLink::carryingDTMFdigits (const CallID& id, char code)
     status = pjsip_dlg_create_request (call->getInvSession()->dlg, &method, -1, &tdata);
 
     if (status != PJ_SUCCESS) {
-        _debug ("UserAgent: Unable to create INFO request -- %d\n", status);
+        _debug ("UserAgent: Unable to create INFO request -- %d", status);
         return false;
     }
 
@@ -1216,7 +1214,7 @@ SIPVoIPLink::carryingDTMFdigits (const CallID& id, char code)
     tdata->msg->body = pjsip_msg_body_create (tdata->pool, &ctype.type, &ctype.subtype, &content);
 
     if (tdata->msg->body == NULL) {
-        _debug ("UserAgent: Unable to create msg body!\n");
+        _debug ("UserAgent: Unable to create msg body!");
         pjsip_tx_data_dec_ref (tdata);
         return false;
     }
@@ -1225,7 +1223,7 @@ SIPVoIPLink::carryingDTMFdigits (const CallID& id, char code)
     status = pjsip_dlg_send_request (call->getInvSession()->dlg, tdata, getModId(), NULL);
 
     if (status != PJ_SUCCESS) {
-        _debug ("UserAgent: Unable to send MESSAGE request -- %d\n", status);
+        _debug ("UserAgent: Unable to send MESSAGE request -- %d", status);
         return false;
     }
 
@@ -1237,7 +1235,7 @@ SIPVoIPLink::SIPOutgoingInvite (SIPCall* call)
 {
     // If no SIP proxy setting for direct call with only IP address
     if (!SIPStartCall (call, "")) {
-        _debug ("! SIP Failure: call not started\n");
+        _debug ("! SIP Failure: call not started");
         return false;
     }
 
@@ -1265,7 +1263,7 @@ SIPVoIPLink::SIPStartCall (SIPCall* call, const std::string& subject UNUSED)
     account = dynamic_cast<SIPAccount *> (Manager::instance().getAccount (id));
 
     if (account == NULL) {
-        _debug ("Account is null in SIPStartCall\n");
+        _debug ("Account is null in SIPStartCall");
         return false;
     }
 
@@ -1294,7 +1292,7 @@ SIPVoIPLink::SIPStartCall (SIPCall* call, const std::string& subject UNUSED)
 
     contactUri = account->getContactHeader (address, portStr);
 
-    _debug ("SIPStartCall: fromUri: %s toUri: %s contactUri: %s\n",
+    _debug ("SIPStartCall: fromUri: %s toUri: %s contactUri: %s",
             fromUri.c_str(),
             toUri.c_str(),
             contactUri.c_str());
@@ -1319,7 +1317,7 @@ SIPVoIPLink::SIPStartCall (SIPCall* call, const std::string& subject UNUSED)
                                    &dialog);
 
     if (status != PJ_SUCCESS) {
-        _debug ("UAC creation failed\n");
+        _debug ("UAC creation failed");
         return false;
     }
 
@@ -1351,7 +1349,7 @@ SIPVoIPLink::SIPStartCall (SIPCall* call, const std::string& subject UNUSED)
     status = pjsip_inv_send_msg (inv, tdata);
 
     if (status != PJ_SUCCESS) {
-        _debug ("    SIPStartCall: failed to send invite\n");
+        _debug ("    SIPStartCall: failed to send invite");
         return false;
     }
 
@@ -1362,7 +1360,7 @@ void
 SIPVoIPLink::SIPCallServerFailure (SIPCall *call)
 {
     if (call != 0) {
-        _debug ("Server error!\n");
+        _debug ("Server error!");
         CallID id = call->getCallId();
         Manager::instance().callFailure (id);
         terminateOneCall (id);
@@ -1384,16 +1382,16 @@ SIPVoIPLink::SIPCallClosed (SIPCall *call)
 
     if (Manager::instance().isCurrentCall (id)) {
         call->setAudioStart (false);
-        _debug ("* SIP Info: Stopping AudioRTP when closing\n");
+        _debug ("* SIP Info: Stopping AudioRTP when closing");
         call->getAudioRtp()->stop();
     }
 
-    _debug ("After close RTP\n");
+    _debug ("After close RTP");
 
     Manager::instance().peerHungupCall (id);
     terminateOneCall (id);
     removeCall (id);
-    _debug ("After remove call ID\n");
+    _debug ("After remove call ID");
 }
 
 void
@@ -1404,7 +1402,7 @@ SIPVoIPLink::SIPCallReleased (SIPCall *call)
     }
 
     // if we are here.. something when wrong before...
-    _debug ("SIP call release\n");
+    _debug ("SIP call release");
 
     CallID id = call->getCallId();
 
@@ -1420,20 +1418,20 @@ void
 SIPVoIPLink::SIPCallAnswered (SIPCall *call, pjsip_rx_data *rdata)
 {
 
-    _debug ("SIPCallAnswered\n");
+    _debug ("SIPCallAnswered");
 
     if (!call) {
-        _debug ("! SIP Failure: unknown call\n");
+        _debug ("! SIP Failure: unknown call");
         return;
     }
 
     if (call->getConnectionState() != Call::Connected) {
-        _debug ("Update call state , id = %s\n", call->getCallId().c_str());
+        _debug ("Update call state , id = %s", call->getCallId().c_str());
         call->setConnectionState (Call::Connected);
         call->setState (Call::Active);
         Manager::instance().peerAnsweredCall (call->getCallId());
     } else {
-        _debug ("* SIP Info: Answering call (on/off hold to send ACK)\n");
+        _debug ("* SIP Info: Answering call (on/off hold to send ACK)");
     }
 }
 
@@ -1472,7 +1470,7 @@ bool SIPVoIPLink::new_ip_to_ip_call (const CallID& id, const std::string& to)
         account = dynamic_cast<SIPAccount *> (Manager::instance().getAccount (IP2IP_PROFILE));
 
         if (account == NULL) {
-            _debug ("Account is null. Returning\n");
+            _debug ("Account is null. Returning");
             return !PJ_SUCCESS;
         }
 
@@ -1481,10 +1479,10 @@ bool SIPVoIPLink::new_ip_to_ip_call (const CallID& id, const std::string& to)
         // Set SDP parameters - Set to local or published address
 		account->isStunEnabled () ? addrSdp = account->getPublishedAddress () :  addrSdp = account->getLocalAddress (); 
 
-        _debug ("new_ip_to_ip_call localAddress: %s\n", localAddress.c_str());
+        _debug ("new_ip_to_ip_call localAddress: %s", localAddress.c_str());
 
         if (localAddress == "0.0.0.0") {
-            _debug ("Here is the local address: %s\n", localAddress.c_str ());
+            _debug ("Here is the local address: %s", localAddress.c_str ());
             loadSIPLocalIP (&localAddress);
         }
 
@@ -1494,11 +1492,11 @@ bool SIPVoIPLink::new_ip_to_ip_call (const CallID& id, const std::string& to)
 
         setCallAudioLocal (call, localAddress);
 
-        _debug ("toUri received in new_ip_to_ip call %s\n", to.c_str());
+        _debug ("toUri received in new_ip_to_ip call %s", to.c_str());
 
         std::string toUri = account->getToUri (to);
         call->setPeerNumber (toUri);
-        _debug ("toUri in new_ip_to_ip call %s\n", toUri.c_str());
+        _debug ("toUri in new_ip_to_ip call %s", toUri.c_str());
         // Building the local SDP offer
         call->getLocalSDP()->set_ip_address (addrSdp);
         call->getLocalSDP()->create_initial_offer();
@@ -1506,7 +1504,7 @@ bool SIPVoIPLink::new_ip_to_ip_call (const CallID& id, const std::string& to)
         try {
             call->getAudioRtp()->initAudioRtpSession (call);
         } catch (...) {
-            _debug ("! SIP Failure: Unable to create RTP Session  in SIPVoIPLink::new_ip_to_ip_call (%s:%d)\n", __FILE__, __LINE__);
+            _debug ("! SIP Failure: Unable to create RTP Session  in SIPVoIPLink::new_ip_to_ip_call (%s:%d)", __FILE__, __LINE__);
         }
 
         // If no account already set, use the default one created at pjsip initialization
@@ -1540,7 +1538,7 @@ bool SIPVoIPLink::new_ip_to_ip_call (const CallID& id, const std::string& to)
 
         contactUri = account->getContactHeader (address, portStr);
 
-        _debug ("new_ip_to_ip_call: fromUri: %s toUri: %s contactUri: %s\n",
+        _debug ("new_ip_to_ip_call: fromUri: %s toUri: %s contactUri: %s",
                 fromUri.c_str(),
                 toUri.c_str(),
                 contactUri.c_str());
@@ -1576,7 +1574,7 @@ bool SIPVoIPLink::new_ip_to_ip_call (const CallID& id, const std::string& to)
         status = pjsip_dlg_set_transport (dialog, tp);
 
         if (status != PJ_SUCCESS) {
-            _debug ("Failed to set the transport for an IP call\n");
+            _debug ("Failed to set the transport for an IP call");
             return status;
         }
 
@@ -1626,7 +1624,7 @@ bool get_dns_server_addresses (std::vector<std::string> *servers)
     // Read configuration files
 
     if (res_init () != 0) {
-        _debug ("Resolver initialization failed\n");
+        _debug ("Resolver initialization failed");
         return false;
     }
 
@@ -1655,12 +1653,12 @@ pj_status_t SIPVoIPLink::enable_dns_srv_resolver (pjsip_endpoint *endpt, pj_dns_
     status = pjsip_endpt_create_resolver (endpt, &resv);
 
     if (status != PJ_SUCCESS) {
-        _debug ("Error creating the DNS resolver instance\n");
+        _debug ("Error creating the DNS resolver instance");
         return status;
     }
 
     if (!get_dns_server_addresses (&dns_servers)) {
-        _debug ("Error  while fetching DNS information\n");
+        _debug ("Error  while fetching DNS information");
         return -1;
     }
 
@@ -1677,7 +1675,7 @@ pj_status_t SIPVoIPLink::enable_dns_srv_resolver (pjsip_endpoint *endpt, pj_dns_
     status = pj_dns_resolver_set_ns (resv, scount, nameservers, NULL);
 
     if (status != PJ_SUCCESS) {
-        _debug ("Error updating the name servers for the DNS resolver\n");
+        _debug ("Error updating the name servers for the DNS resolver");
         return status;
     }
 
@@ -1685,7 +1683,7 @@ pj_status_t SIPVoIPLink::enable_dns_srv_resolver (pjsip_endpoint *endpt, pj_dns_
     status = pjsip_endpt_set_resolver (endpt, resv);
 
     if (status != PJ_SUCCESS) {
-        _debug ("Error setting the DNS resolver instance of the SIP resolver engine\n");
+        _debug ("Error setting the DNS resolver instance of the SIP resolver engine");
         return status;
     }
 
@@ -1733,7 +1731,7 @@ bool SIPVoIPLink::pjsip_init()
     _pool = pj_pool_create (&_cp.factory, "sflphone", 4000, 4000, NULL);
 
     if (!_pool) {
-        _debug ("UserAgent: Could not initialize memory pool\n");
+        _debug ("UserAgent: Could not initialize memory pool");
         return PJ_ENOMEM;
     }
 
@@ -1743,7 +1741,7 @@ bool SIPVoIPLink::pjsip_init()
     PJ_ASSERT_RETURN (status == PJ_SUCCESS, 1);
 
     if (!loadSIPLocalIP (&addr)) {
-        _debug ("UserAgent: Unable to determine network capabilities\n");
+        _debug ("UserAgent: Unable to determine network capabilities");
         return false;
     }
 
@@ -1757,7 +1755,7 @@ bool SIPVoIPLink::pjsip_init()
     account = dynamic_cast<SIPAccount *> (Manager::instance().getAccount (AccountNULL));
 
     if (account == NULL) {
-        _debug ("Account is null in pjsip init\n");
+        _debug ("Account is null in pjsip init");
         port = _regPort;
     } else {
         directIpCallsTlsEnabled = account->isTlsEnabled();
@@ -1772,22 +1770,19 @@ bool SIPVoIPLink::pjsip_init()
     // could not be created, then give it another try
     // on a random sip port
     if (errPjsip != PJ_SUCCESS) {
-        _debug ("UserAgent: Could not initialize SIP listener on port %d\n", port);
+        _debug ("UserAgent: Could not initialize SIP listener on port %d", port);
         port = RANDOM_SIP_PORT;
 
-        _debug ("UserAgent: Trying to initialize SIP listener on port %d\n", port);
+        _debug ("UserAgent: Trying to initialize SIP listener on port %d", port);
         errPjsip = createUDPServer();
 
         if (errPjsip != PJ_SUCCESS) {
-            _debug ("UserAgent: Fail to initialize SIP listener on port %d\n", port);
+            _debug ("UserAgent: Fail to initialize SIP listener on port %d", port);
             return errPjsip;
         }
     }
 
-    // Bind the newly created transport to the ip to ip account
-    // setAccountTransport
-
-    _debug ("pjsip_init -- listening on port %d\n", port);
+    _debug ("pjsip_init -- listening on port %d", port);
 
     // Create a TLS listener meant for Direct IP calls
     // if the user did enabled it.
@@ -1871,7 +1866,7 @@ bool SIPVoIPLink::pjsip_init()
 
     PJ_ASSERT_RETURN (status == PJ_SUCCESS, 1);
 
-    _debug ("UserAgent: VOIP callbacks initialized\n");
+    _debug ("UserAgent: VOIP callbacks initialized");
 
     // Add endpoint capabilities (INFO, OPTIONS, etc) for this UA
     pj_str_t allowed[] = { { (char*) "INFO", 4}, { (char*) "REGISTER", 8}, { (char*) "OPTIONS", 7} };       //  //{"INVITE", 6}, {"ACK",3}, {"BYE",3}, {"CANCEL",6}
@@ -1884,7 +1879,7 @@ bool SIPVoIPLink::pjsip_init()
     // Register "application/sdp" in ACCEPT header
     pjsip_endpt_add_capability (_endpt, &_mod_ua, PJSIP_H_ACCEPT, NULL, 1, &accepted);
 
-    _debug ("UserAgent: pjsip version %s for %s initialized\n", pj_get_version(), PJ_OS_NAME);
+    _debug ("UserAgent: pjsip version %s for %s initialized", pj_get_version(), PJ_OS_NAME);
 
     // Create the secondary thread to poll sip events
     _evThread->start();
@@ -1907,7 +1902,7 @@ pj_status_t SIPVoIPLink::stunServerResolve (AccountID id)
     account = dynamic_cast<SIPAccount *> (Manager::instance().getAccount (id));
 
     if (account == NULL) {
-        _debug ("stunServerResolve: Account is null. Returning\n");
+        _debug ("stunServerResolve: Account is null. Returning");
         return !PJ_SUCCESS;
     }
 
@@ -1978,8 +1973,7 @@ int SIPVoIPLink::createUDPServer (AccountID id)
     // Set information to the local address and port
 
     if (account == NULL) {
-        _debug ("Account with id \"%s\" is null in createUDPServer.\n", id.c_str());
-        // account = Manager::instance()->getAccount(IP2IP_PROFILE);
+        _debug ("Account with id \"%s\" is null in createUDPServer.", id.c_str());
     } else {
         // We are trying to initialize a UDP transport available for all local accounts and direct IP calls
         if (account->getLocalAddress () != "0.0.0.0") {
@@ -2031,17 +2025,17 @@ int SIPVoIPLink::createUDPServer (AccountID id)
 
     tpmgr = pjsip_endpt_get_tpmgr (_endpt);
 
-    _debug ("number of transport: %i\n", pjsip_tpmgr_get_transport_count (tpmgr));
+    _debug ("number of transport: %i", pjsip_tpmgr_get_transport_count (tpmgr));
 
     pjsip_tpmgr_dump_transports (tpmgr);
 
     if (status != PJ_SUCCESS) {
-        _debug ("UserAgent: (%d) Unable to start UDP transport on %s:%d\n", status, listeningAddress.data(), listeningPort);
+        _debug ("UserAgent: (%d) Unable to start UDP transport on %s:%d", status, listeningAddress.data(), listeningPort);
         // Try to acquire an existing one
         // pjsip_tpmgr_acquire_transport ()
         return status;
     } else {
-        _debug ("UserAgent: UDP server listening on port %d\n", listeningPort);
+        _debug ("UserAgent: UDP server listening on port %d", listeningPort);
 
         if (account == NULL)
             _localUDPTransport = transport;
@@ -2049,7 +2043,7 @@ int SIPVoIPLink::createUDPServer (AccountID id)
             account->setAccountTransport (transport);
     }
 
-    _debug ("Transport initialized successfully on %s:%i\n", listeningAddress.c_str (), listeningPort);
+    _debug ("Transport initialized successfully on %s:%i", listeningAddress.c_str (), listeningPort);
 
     return PJ_SUCCESS;
 }
@@ -2060,7 +2054,7 @@ std::string SIPVoIPLink::findLocalAddressFromUri (const std::string& uri, pjsip_
     pjsip_transport_type_e transportType;
     pjsip_tpselector *tp_sel;
 
-    _debug ("SIPVoIPLink::findLocalAddressFromUri\n");
+    _debug ("SIPVoIPLink::findLocalAddressFromUri");
 
     // Find the transport that must be used with the given uri
     pj_str_t tmp;
@@ -2073,7 +2067,7 @@ std::string SIPVoIPLink::findLocalAddressFromUri (const std::string& uri, pjsip_
     std::string machineName (pjMachineName.ptr, pjMachineName.slen);
 
     if (genericUri == NULL) {
-        _debug ("genericUri is NULL in findLocalAddressFromUri\n");
+        _debug ("genericUri is NULL in findLocalAddressFromUri");
         return machineName;
     }
 
@@ -2082,7 +2076,7 @@ std::string SIPVoIPLink::findLocalAddressFromUri (const std::string& uri, pjsip_
     sip_uri = (pjsip_sip_uri*) pjsip_uri_get_uri (genericUri);
 
     if (sip_uri == NULL) {
-        _debug ("Invalid uri in findLocalAddressFromTransport\n");
+        _debug ("Invalid uri in findLocalAddressFromTransport");
         return machineName;
     }
 
@@ -2090,7 +2084,7 @@ std::string SIPVoIPLink::findLocalAddressFromUri (const std::string& uri, pjsip_
         transportType = PJSIP_TRANSPORT_TLS;
     } else {
         if (transport == NULL) {
-            _debug ("transport is NULL in findLocalAddressFromUri\n. Try the local UDP transport");
+            _debug ("transport is NULL in findLocalAddressFromUri. Try the local UDP transport");
             transport = _localUDPTransport;
         }
 
@@ -2104,7 +2098,7 @@ std::string SIPVoIPLink::findLocalAddressFromUri (const std::string& uri, pjsip_
     tpmgr = pjsip_endpt_get_tpmgr (_endpt);
 
     if (tpmgr == NULL) {
-        _debug ("Unexpected: Cannot get tpmgr from endpoint.\n");
+        _debug ("Unexpected: Cannot get tpmgr from endpoint.");
         return machineName;
     }
 
@@ -2115,7 +2109,7 @@ std::string SIPVoIPLink::findLocalAddressFromUri (const std::string& uri, pjsip_
     pj_status_t status;
 
     /* Init the transport selector */
-    //_debug ("Transport ID: %s\n", transport->obj_name);
+    //_debug ("Transport ID: %s", transport->obj_name);
     if (transportType == PJSIP_TRANSPORT_UDP) {
         status = init_transport_selector (transport, &tp_sel);
 
@@ -2127,11 +2121,11 @@ std::string SIPVoIPLink::findLocalAddressFromUri (const std::string& uri, pjsip_
         status = pjsip_tpmgr_find_local_addr (tpmgr, _pool, transportType, NULL, &localAddress, &port);
 
     if (status != PJ_SUCCESS) {
-        _debug ("Failed to find local address from transport\n");
+        _debug ("Failed to find local address from transport");
         return machineName;
     }
 
-    _debug ("Local address discovered from attached transport: %s\n", localAddress.ptr);
+    _debug ("Local address discovered from attached transport: %s", localAddress.ptr);
 
     return std::string (localAddress.ptr, localAddress.slen);
 }
@@ -2167,7 +2161,7 @@ int SIPVoIPLink::findLocalPortFromUri (const std::string& uri, pjsip_transport *
     genericUri = pjsip_parse_uri (_pool, tmp.ptr, tmp.slen, 0);
 
     if (genericUri == NULL) {
-        _debug ("genericUri is NULL in findLocalPortFromUri\n");
+        _debug ("genericUri is NULL in findLocalPortFromUri");
         return atoi (DEFAULT_SIP_PORT);
     }
 
@@ -2176,7 +2170,7 @@ int SIPVoIPLink::findLocalPortFromUri (const std::string& uri, pjsip_transport *
     sip_uri = (pjsip_sip_uri*) pjsip_uri_get_uri (genericUri);
 
     if (sip_uri == NULL) {
-        _debug ("Invalid uri in findLocalAddressFromTransport\n");
+        _debug ("Invalid uri in findLocalAddressFromTransport");
         return atoi (DEFAULT_SIP_PORT);
     }
 
@@ -2185,7 +2179,7 @@ int SIPVoIPLink::findLocalPortFromUri (const std::string& uri, pjsip_transport *
         port = atoi (DEFAULT_SIP_TLS_PORT);
     } else {
         if (transport == NULL) {
-            _debug ("transport is NULL in findLocalPortFromUri - Try the local UDP transport\n");
+            _debug ("transport is NULL in findLocalPortFromUri - Try the local UDP transport");
             transport = _localUDPTransport;
         }
 
@@ -2201,7 +2195,7 @@ int SIPVoIPLink::findLocalPortFromUri (const std::string& uri, pjsip_transport *
     tpmgr = pjsip_endpt_get_tpmgr (_endpt);
 
     if (tpmgr == NULL) {
-        _debug ("Unexpected: Cannot get tpmgr from endpoint.\n");
+        _debug ("Unexpected: Cannot get tpmgr from endpoint.");
         return port;
     }
 
@@ -2212,7 +2206,7 @@ int SIPVoIPLink::findLocalPortFromUri (const std::string& uri, pjsip_transport *
     pj_status_t status;
 
     if (transportType == PJSIP_TRANSPORT_UDP) {
-        _debug ("Transport ID: %s\n", transport->obj_name);
+        _debug ("Transport ID: %s", transport->obj_name);
 
         status = init_transport_selector (transport, &tp_sel);
 
@@ -2225,11 +2219,10 @@ int SIPVoIPLink::findLocalPortFromUri (const std::string& uri, pjsip_transport *
 
 
     if (status != PJ_SUCCESS) {
-        _debug ("Failed to find local address from transport\n");
+        _debug ("Failed to find local address from transport");
     }
 
-    _debug ("Local port discovered from attached transport: %i\n", port);
-
+    _debug ("Local port discovered from attached transport: %i", port);
     return port;
 }
 
@@ -2252,7 +2245,7 @@ pj_status_t SIPVoIPLink::createTlsTransportRetryOnFailure (AccountID id)
         account = dynamic_cast<SIPAccount *> (Manager::instance().getAccount (id));
 
         if (account == NULL) {
-            _debug ("createTlsTransportRetryOnFailure: Account is null. Returning\n");
+            _debug ("createTlsTransportRetryOnFailure: Account is null. Returning");
             return !PJ_SUCCESS;
         }
 
@@ -2263,11 +2256,11 @@ pj_status_t SIPVoIPLink::createTlsTransportRetryOnFailure (AccountID id)
         success = createTlsTransport (id);
 
         if (success != PJ_SUCCESS) {
-            _debug ("createTlsTransportRetryOnFailure: failed to retry on random port %d\n", randomPort);
+            _debug ("createTlsTransportRetryOnFailure: failed to retry on random port %d", randomPort);
             return success;
         }
 
-        _debug ("createTlsTransportRetryOnFailure: TLS transport listening on port %d\n", randomPort);
+        _debug ("createTlsTransportRetryOnFailure: TLS transport listening on port %d", randomPort);
     }
 
     return PJ_SUCCESS;
@@ -2292,7 +2285,7 @@ pj_status_t SIPVoIPLink::createAlternateUdpTransport (AccountID id)
     account = dynamic_cast<SIPAccount *> (Manager::instance().getAccount (id));
 
     if (account == NULL) {
-        _debug ("Account is null. Returning\n");
+        _debug ("Account is null. Returning");
         return !PJ_SUCCESS;
     }
 
@@ -2303,19 +2296,19 @@ pj_status_t SIPVoIPLink::createAlternateUdpTransport (AccountID id)
     status = stunServerResolve (id);
 
     if (status != PJ_SUCCESS) {
-        _debug ("Error resolving STUN server: %i\n", status);
+        _debug ("Error resolving STUN server: %i", status);
         return status;
     }
 
     // Init socket
     sock = PJ_INVALID_SOCKET;
 
-    _debug ("Initializing IPv4 socket on %s:%i\n", stunServer.ptr, stunPort);
+    _debug ("Initializing IPv4 socket on %s:%i", stunServer.ptr, stunPort);
 
     status = pj_sockaddr_in_init (&boundAddr, &stunServer, 0);
 
     if (status != PJ_SUCCESS) {
-        _debug ("Error when initializing IPv4 socket on %s:%i\n", stunServer.ptr, stunPort);
+        _debug ("Error when initializing IPv4 socket on %s:%i", stunServer.ptr, stunPort);
         return status;
     }
 
@@ -2323,7 +2316,7 @@ pj_status_t SIPVoIPLink::createAlternateUdpTransport (AccountID id)
     status = pj_sock_socket (pj_AF_INET(), pj_SOCK_DGRAM(), 0, &sock);
 
     if (status != PJ_SUCCESS) {
-        _debug ("Socket() error (%d)\n", status);
+        _debug ("Socket() error (%d)", status);
         return status;
     }
 
@@ -2356,11 +2349,11 @@ pj_status_t SIPVoIPLink::createAlternateUdpTransport (AccountID id)
     status = pjsip_udp_transport_attach2 (_endpt, PJSIP_TRANSPORT_UDP, sock, &a_name, 1, &transport);
 
     if (status != PJ_SUCCESS) {
-        _debug ("Error creating alternate SIP UDP listener (%d)\n", status);
+        _debug ("Error creating alternate SIP UDP listener (%d)", status);
         return status;
     }
 
-    _debug ("UDP Transport successfully created on %s:%i\n", listeningAddress.c_str (), listeningPort);
+    _debug ("UDP Transport successfully created on %s:%i", listeningAddress.c_str (), listeningPort);
 
     account->setAccountTransport (transport);
 
@@ -2383,7 +2376,7 @@ pj_status_t SIPVoIPLink::createTlsTransport (AccountID id)
     account = dynamic_cast<SIPAccount *> (Manager::instance().getAccount (id));
 
     if (account == NULL) {
-        _debug ("Account is null. Returning\n");
+        _debug ("Account is null. Returning");
         return !PJ_SUCCESS;
     }
 
@@ -2413,7 +2406,7 @@ pj_status_t SIPVoIPLink::createTlsTransport (AccountID id)
         success = pj_sockaddr_in_set_str_addr (&local_addr, &pjAddress);
 
         if (success != PJ_SUCCESS) {
-            _debug ("Failed to set local address in %d\n", __LINE__);
+            _debug ("Failed to set local address in %d", __LINE__);
         }
     }
 
@@ -2428,7 +2421,7 @@ pj_status_t SIPVoIPLink::createTlsTransport (AccountID id)
     pjsip_tls_setting * tls_setting = account->getTlsSetting();
 
     _debug ("TLS transport to be initialized with published address %.*s,"
-            " published port %d, local address %s, local port %d\n",
+            " published port %d, local address %s, local port %d",
             (int) a_name.host.slen, a_name.host.ptr,
             (int) a_name.port, localAddress.c_str(), (int) localTlsPort);
 
@@ -2437,7 +2430,7 @@ pj_status_t SIPVoIPLink::createTlsTransport (AccountID id)
     status = pjsip_tls_transport_start (_endpt, tls_setting, &local_addr, &a_name, 1, &tls);
 
     if (status != PJ_SUCCESS) {
-        _debug ("Error creating SIP TLS listener (%d)\n", status);
+        _debug ("Error creating SIP TLS listener (%d)", status);
     }
 
     return PJ_SUCCESS;
@@ -2461,11 +2454,11 @@ bool SIPVoIPLink::loadSIPLocalIP (std::string *addr)
 
     if (pj_gethostip (pj_AF_INET(), &ip_addr) != PJ_SUCCESS) {
         // Update the registration state if no network capabilities found
-        _debug ("UserAgent: Get host ip failed!\n");
+        _debug ("UserAgent: Get host ip failed!");
         returnValue = false;
     } else {
         localAddress = std::string (pj_inet_ntoa (ip_addr.ipv4.sin_addr));
-        _debug ("UserAgent: Checking network, setting local IP address to: %s\n", localAddress.data());
+        _debug ("UserAgent: Checking network, setting local IP address to: %s", localAddress.data());
     }
 
     *addr = localAddress;
@@ -2504,7 +2497,7 @@ void SIPVoIPLink::busy_sleep (unsigned msec)
 bool SIPVoIPLink::pjsip_shutdown (void)
 {
     if (_endpt) {
-        _debug ("UserAgent: Shutting down...\n");
+        _debug ("UserAgent: Shutting down...");
         busy_sleep (1000);
     }
 
@@ -2561,7 +2554,7 @@ void set_voicemail_info (AccountID account, pjsip_msg_body *body)
     std::string delimiter = "/";
     std::string msg_body, voicemail_str;
 
-    _debug ("UserAgent: checking the voice message!\n");
+    _debug ("UserAgent: checking the voice message!");
     // The voicemail message is formated like that:
     // Voice-Message: 1/0  . 1 is the number we want to retrieve in this case
 
@@ -2595,19 +2588,19 @@ void SIPVoIPLink::handle_reinvite (SIPCall *call)
     call->getAudioRtp()->stop ();
     call->setAudioStart (false);
 
-    _debug ("Create new rtp session from handle_reinvite : %s:%i\n", call->getLocalIp().c_str(), call->getLocalAudioPort());
+    _debug ("Create new rtp session from handle_reinvite : %s:%i", call->getLocalIp().c_str(), call->getLocalAudioPort());
 
     try {
         call->getAudioRtp()->initAudioRtpSession (call);
     } catch (...) {
-        _debug ("! SIP Failure: Unable to create RTP Session (%s:%d)\n", __FILE__, __LINE__);
+        _debug ("! SIP Failure: Unable to create RTP Session (%s:%d)", __FILE__, __LINE__);
     }
 }
 
 // This callback is called when the invite session state has changed
 void call_on_state_changed (pjsip_inv_session *inv, pjsip_event *e)
 {
-    _debug ("call_on_state_changed to state %s\n", invitationStateMap[inv->state]);
+    _debug ("call_on_state_changed to state %s", invitationStateMap[inv->state]);
 
     pjsip_rx_data *rdata;
     pj_status_t status;
@@ -2620,8 +2613,8 @@ void call_on_state_changed (pjsip_inv_session *inv, pjsip_event *e)
         _debug ("Call is NULL in call_on_state_changed");
         return;
     } else {
-        // _debug("    call_on_state_changed: call id %s\n", call->getCallId().c_str());
-        // _debug("    call_on_state_changed: call state %s\n", invitationStateMap[call->getInvSession()->state]);
+        // _debug("    call_on_state_changed: call id %s", call->getCallId().c_str());
+        // _debug("    call_on_state_changed: call state %s", invitationStateMap[call->getInvSession()->state]);
     }
 
     //Retrieve the body message
@@ -2696,12 +2689,12 @@ void call_on_state_changed (pjsip_inv_session *inv, pjsip_event *e)
                                         NULL, &tdata);
 
             if (status != PJ_SUCCESS) {
-                _debug ("UserAgent: Unable to create NOTIFY -- %d\n", status);
+                _debug ("UserAgent: Unable to create NOTIFY -- %d", status);
             } else {
                 status = pjsip_xfer_send_request (call->getXferSub(), tdata);
 
                 if (status != PJ_SUCCESS) {
-                    _debug ("UserAgent: Unable to send NOTIFY -- %d\n", status);
+                    _debug ("UserAgent: Unable to send NOTIFY -- %d", status);
                 }
             }
         }
@@ -2738,7 +2731,7 @@ void call_on_state_changed (pjsip_inv_session *inv, pjsip_event *e)
         status = call->getLocalSDP()->check_sdp_answer (inv, rdata);
 
         if (status != PJ_SUCCESS) {
-            _debug ("Failed to check_incoming_sdp in call_on_state_changed\n");
+            _debug ("Failed to check_incoming_sdp in call_on_state_changed");
             return;
         }
     }
@@ -2750,7 +2743,7 @@ void call_on_state_changed (pjsip_inv_session *inv, pjsip_event *e)
 
     } else if (inv->state == PJSIP_INV_STATE_DISCONNECTED) {
 
-        _debug ("State: %s. Cause: %.*s\n", invitationStateMap[inv->state], (int) inv->cause_text.slen, inv->cause_text.ptr);
+        _debug ("State: %s. Cause: %.*s", invitationStateMap[inv->state], (int) inv->cause_text.slen, inv->cause_text.ptr);
 
         switch (inv->cause) {
                 /* The call terminates normally - BYE / CANCEL */
@@ -2794,7 +2787,7 @@ void call_on_state_changed (pjsip_inv_session *inv, pjsip_event *e)
                 break;
 
             default:
-                _debug ("sipvoiplink.cpp - line %d : Unhandled call state. This is probably a bug.\n", __LINE__);
+                _debug ("sipvoiplink.cpp - line %d : Unhandled call state. This is probably a bug.", __LINE__);
                 break;
         }
     }
@@ -2804,7 +2797,7 @@ void call_on_state_changed (pjsip_inv_session *inv, pjsip_event *e)
 // This callback is called after SDP offer/answer session has completed.
 void call_on_media_update (pjsip_inv_session *inv, pj_status_t status)
 {
-    _debug ("call_on_media_update\n");
+    _debug ("call_on_media_update");
 
     const pjmedia_sdp_session *local_sdp;
     const pjmedia_sdp_session *remote_sdp;
@@ -2815,19 +2808,19 @@ void call_on_media_update (pjsip_inv_session *inv, pj_status_t status)
     call = reinterpret_cast<SIPCall *> (inv->mod_data[getModId() ]);
 
     if (!call) {
-        _debug ("Call declined by peer, SDP negociation stopped\n");
+        _debug ("Call declined by peer, SDP negociation stopped");
         return;
     }
 
     link = dynamic_cast<SIPVoIPLink *> (Manager::instance().getAccountLink (AccountNULL));
 
     if (link == NULL) {
-        _debug ("Failed to get sip link\n");
+        _debug ("Failed to get sip link");
         return;
     }
 
     if (status != PJ_SUCCESS) {
-        _debug ("Error while negotiating the offer\n");
+        _debug ("Error while negotiating the offer");
         link->hangup (call->getCallId());
         Manager::instance().callFailure (call->getCallId());
         return;
@@ -2857,7 +2850,7 @@ void call_on_media_update (pjsip_inv_session *inv, pj_status_t status)
         call->setAudioStart (true);
         call->getAudioRtp()->start();
     } catch (exception& rtpException) {
-        _debug ("%s\n", rtpException.what());
+        _debug ("%s", rtpException.what());
     }
 
 }
@@ -2868,7 +2861,7 @@ void call_on_forked (pjsip_inv_session *inv, pjsip_event *e)
 
 void call_on_tsx_changed (pjsip_inv_session *inv, pjsip_transaction *tsx, pjsip_event *e)
 {
-    _debug ("call_on_tsx_changed to state %s\n", transactionStateMap[tsx->state]);
+    _debug ("call_on_tsx_changed to state %s", transactionStateMap[tsx->state]);
 
     if (tsx->role==PJSIP_ROLE_UAS && tsx->state==PJSIP_TSX_STATE_TRYING &&
             pjsip_method_cmp (&tsx->method, &pjsip_refer_method) ==0) {
@@ -2883,7 +2876,7 @@ void regc_cb (struct pjsip_regc_cbparam *param)
     account = static_cast<SIPAccount *> (param->token);
 
     if (account == NULL) {
-        _debug ("Account is NULL in regc_cb.\n");
+        _debug ("Account is NULL in regc_cb.");
         return;
     }
 
@@ -2905,7 +2898,7 @@ void regc_cb (struct pjsip_regc_cbparam *param)
             /* Sometimes, the status is OK, but we still failed.
              * So checking the code for real result
              */
-            _debug ("UserAgent: The error is: %d\n", param->code);
+            _debug ("UserAgent: The error is: %d", param->code);
 
             switch (param->code) {
 
@@ -2976,7 +2969,7 @@ mod_on_rx_request (pjsip_rx_data *rdata)
     std::string request;
 
     // Handle the incoming call invite in this function
-    _debug ("UserAgent: Callback on_rx_request is involved! \n");
+    _debug ("UserAgent: Callback on_rx_request is involved! ");
 
     /* First, let's got the username and server name from the invite.
      * We will use them to detect which account is the callee.
@@ -2987,7 +2980,7 @@ mod_on_rx_request (pjsip_rx_data *rdata)
     userName = std::string (sip_uri->user.ptr, sip_uri->user.slen);
     server = std::string (sip_uri->host.ptr, sip_uri->host.slen);
 
-    _debug ("mod_on_rx_request: %s@%s\n", userName.c_str(), server.c_str());
+    _debug ("mod_on_rx_request: %s@%s", userName.c_str(), server.c_str());
 
     // Get the account id of callee from username and server
     account_id = Manager::instance().getAccountIdFromNameAndServer (userName, server);
@@ -2995,7 +2988,7 @@ mod_on_rx_request (pjsip_rx_data *rdata)
     /* If we don't find any account to receive the call */
 
     if (account_id == AccountNULL) {
-        _debug ("UserAgent: Username %s doesn't match any account!\n",userName.c_str());
+        _debug ("UserAgent: Username %s doesn't match any account!",userName.c_str());
         //return false;
     }
 
@@ -3005,7 +2998,7 @@ mod_on_rx_request (pjsip_rx_data *rdata)
 
     /* If we can't find any voIP link to handle the incoming call */
     if (link == 0) {
-        _debug ("ERROR: can not retrieve the voiplink from the account ID...\n");
+        _debug ("ERROR: can not retrieve the voiplink from the account ID...");
         return false;
     }
 
@@ -3017,15 +3010,15 @@ mod_on_rx_request (pjsip_rx_data *rdata)
         std::string temp (from_header);
         int begin_displayName = temp.find ("\"") + 1;
         int end_displayName = temp.rfind ("\"");
-        // _debug("The display name start at %i, end at %i\n", begin_displayName, end_displayName);
+        // _debug("The display name start at %i, end at %i", begin_displayName, end_displayName);
         displayName = temp.substr (begin_displayName, end_displayName - begin_displayName);//display_name);
     } else {
         displayName = std::string ("");
     }
 
-    _debug ("UserAgent: The receiver is : %s@%s\n", userName.data(), server.data());
+    _debug ("UserAgent: The receiver is : %s@%s", userName.data(), server.data());
 
-    _debug ("UserAgent: The callee account id is %s\n", account_id.c_str());
+    _debug ("UserAgent: The callee account id is %s", account_id.c_str());
 
     /* Now, it is the time to find the information of the caller */
     uri = rdata->msg_info.from->uri;
@@ -3104,7 +3097,7 @@ mod_on_rx_request (pjsip_rx_data *rdata)
                                     Manager::instance().getConfigString (HOOKS, URLHOOK_COMMAND));
             }
         } else
-            throw length_error ("Url exceeds std::string max_size\n");
+            throw length_error ("Url exceeds std::string max_size");
 
     }
 
@@ -3175,7 +3168,7 @@ mod_on_rx_request (pjsip_rx_data *rdata)
         // Fail to notify UI
         delete call;
         call = NULL;
-        _debug ("UserAgent: Fail to notify UI!\n");
+        _debug ("UserAgent: Fail to notify UI!");
         return false;
     }
 
@@ -3254,7 +3247,7 @@ void onCallTransfered (pjsip_inv_session *inv, pjsip_rx_data *rdata)
         /* Invalid Request.
          * No Refer-To header!
          */
-        _debug ("UserAgent: Received REFER without Refer-To header!\n");
+        _debug ("UserAgent: Received REFER without Refer-To header!");
         pjsip_dlg_respond (inv->dlg, rdata, 400, NULL, NULL, NULL);
         return;
     }
@@ -3278,7 +3271,7 @@ void onCallTransfered (pjsip_inv_session *inv, pjsip_rx_data *rdata)
     /* Notify callback */
     code = PJSIP_SC_ACCEPTED;
 
-    _debug ("UserAgent: Call to %.*s is being transfered to %.*s\n",
+    _debug ("UserAgent: Call to %.*s is being transfered to %.*s",
             (int) inv->dlg->remote.info_str.slen,
             inv->dlg->remote.info_str.ptr,
             (int) refer_to->hvalue.slen,
@@ -3296,7 +3289,7 @@ void onCallTransfered (pjsip_inv_session *inv, pjsip_rx_data *rdata)
                                             &tdata);
 
         if (status != PJ_SUCCESS) {
-            _debug ("UserAgent: Unable to create 2xx response to REFER -- %d\n", status);
+            _debug ("UserAgent: Unable to create 2xx response to REFER -- %d", status);
             return;
         }
 
@@ -3313,7 +3306,7 @@ void onCallTransfered (pjsip_inv_session *inv, pjsip_rx_data *rdata)
                                           tdata);
 
         if (status != PJ_SUCCESS) {
-            _debug ("UserAgent: Unable to create 2xx response to REFER -- %d\n", status);
+            _debug ("UserAgent: Unable to create 2xx response to REFER -- %d", status);
             return;
         }
 
@@ -3336,7 +3329,7 @@ void onCallTransfered (pjsip_inv_session *inv, pjsip_rx_data *rdata)
         status = pjsip_xfer_create_uas (inv->dlg, &xfer_cb, rdata, &sub);
 
         if (status != PJ_SUCCESS) {
-            _debug ("UserAgent: Unable to create xfer uas -- %d\n", status);
+            _debug ("UserAgent: Unable to create xfer uas -- %d", status);
             pjsip_dlg_respond (inv->dlg, rdata, 500, NULL, NULL, NULL);
             return;
         }
@@ -3372,7 +3365,7 @@ void onCallTransfered (pjsip_inv_session *inv, pjsip_rx_data *rdata)
         status = pjsip_xfer_send_request (sub, tdata);
 
         if (status != PJ_SUCCESS) {
-            _debug ("UserAgent: Unable to send NOTIFY to REFER -- %d\n", status);
+            _debug ("UserAgent: Unable to send NOTIFY to REFER -- %d", status);
             return;
         }
     }
@@ -3390,7 +3383,7 @@ void onCallTransfered (pjsip_inv_session *inv, pjsip_rx_data *rdata)
     tmp = std::string (uri);
 
     if (existing_call == NULL) {
-        _debug ("UserAgent: Call doesn't exist!\n");
+        _debug ("UserAgent: Call doesn't exist!");
         return;
     }
 
@@ -3406,14 +3399,14 @@ void onCallTransfered (pjsip_inv_session *inv, pjsip_rx_data *rdata)
                                         500, NULL, &tdata);
 
             if (status != PJ_SUCCESS) {
-                _debug ("UserAgent: Unable to create NOTIFY to REFER -- %d\n", status);
+                _debug ("UserAgent: Unable to create NOTIFY to REFER -- %d", status);
                 return;
             }
 
             status = pjsip_xfer_send_request (sub, tdata);
 
             if (status != PJ_SUCCESS) {
-                _debug ("UserAgent: Unable to send NOTIFY to REFER -- %d\n", status);
+                _debug ("UserAgent: Unable to send NOTIFY to REFER -- %d", status);
                 return;
             }
         }
@@ -3429,7 +3422,7 @@ void onCallTransfered (pjsip_inv_session *inv, pjsip_rx_data *rdata)
         newCall = dynamic_cast<SIPCall *> (link->getCall (newCallId));
 
         if (!newCall) {
-            _debug ("UserAgent: can not find the call from sipvoiplink!\n");
+            _debug ("UserAgent: can not find the call from sipvoiplink!");
             return;
         }
     }
@@ -3462,7 +3455,7 @@ void xfer_func_cb (pjsip_evsub *sub, pjsip_event *event)
 
     if (pjsip_evsub_get_state (sub) == PJSIP_EVSUB_STATE_ACCEPTED) {
 
-        _debug ("Transfer accepted! Waiting for notifications. \n");
+        _debug ("Transfer accepted! Waiting for notifications. ");
 
     }
 
@@ -3494,13 +3487,13 @@ void xfer_func_cb (pjsip_evsub *sub, pjsip_event *event)
 
         if (pjsip_evsub_get_state (sub) == PJSIP_EVSUB_STATE_TERMINATED) {
             pjsip_evsub_set_mod_data (sub, _mod_ua.id, NULL);
-            _debug ("UserAgent: Xfer client subscription terminated\n");
+            _debug ("UserAgent: Xfer client subscription terminated");
 
         }
 
         if (!link || !event) {
             /* Application is not interested with call progress status */
-            _debug ("UserAgent: Either link or event is empty!\n");
+            _debug ("UserAgent: Either link or event is empty!");
             return;
         }
 
@@ -3521,10 +3514,10 @@ void xfer_func_cb (pjsip_evsub *sub, pjsip_event *event)
 
             if (!body) {
                 // if (call->getCallConfiguration () == Call::IPtoIP) {
-                //   _debug("UserAgent: IptoIp NOTIFY without message body\n");
+                //   _debug("UserAgent: IptoIp NOTIFY without message body");
                 // }
                 // else{
-                _debug ("UserAgent: Warning! Received NOTIFY without message body\n");
+                _debug ("UserAgent: Warning! Received NOTIFY without message body");
                 return;
                 // }
             }
@@ -3534,7 +3527,7 @@ void xfer_func_cb (pjsip_evsub *sub, pjsip_event *event)
             /* Check for appropriate content */
             if (pj_stricmp2 (&body->content_type.type, "message") != 0 ||
                     pj_stricmp2 (&body->content_type.subtype, "sipfrag") != 0) {
-                _debug ("UserAgent: Warning! Received NOTIFY with non message/sipfrag content\n");
+                _debug ("UserAgent: Warning! Received NOTIFY with non message/sipfrag content");
                 return;
             }
 
@@ -3543,12 +3536,12 @@ void xfer_func_cb (pjsip_evsub *sub, pjsip_event *event)
                                                &status_line);
 
             if (status != PJ_SUCCESS) {
-                _debug ("UserAgent: Warning! Received NOTIFY with invalid message/sipfrag content\n");
+                _debug ("UserAgent: Warning! Received NOTIFY with invalid message/sipfrag content");
                 return;
             }
 
         } else {
-            _debug ("UserAgent: Set code to 500!\n");
+            _debug ("UserAgent: Set code to 500!");
             status_line.code = 500;
             status_line.reason = *pjsip_get_status_text (500);
         }
@@ -3557,7 +3550,7 @@ void xfer_func_cb (pjsip_evsub *sub, pjsip_event *event)
         SIPCall *call = dynamic_cast<SIPCall *> (link->getCall (Manager::instance().getCurrentCallId()));
 
         if (!call) {
-            _debug ("UserAgent: Call doesn't exit!\n");
+            _debug ("UserAgent: Call doesn't exit!");
             return;
         }
 
@@ -3566,7 +3559,7 @@ void xfer_func_cb (pjsip_evsub *sub, pjsip_event *event)
             request = event->body.rx_msg.rdata->msg_info.msg_buf;
 
             if ( (int) request.find (noresource) != -1) {
-                _debug ("UserAgent: NORESOURCE for transfer!\n");
+                _debug ("UserAgent: NORESOURCE for transfer!");
                 link->transferStep2 (call);
                 pjsip_evsub_terminate (sub, PJ_TRUE);
 
@@ -3575,7 +3568,7 @@ void xfer_func_cb (pjsip_evsub *sub, pjsip_event *event)
             }
 
             if ( (int) request.find (ringing) != -1) {
-                _debug ("UserAgent: transfered call RINGING!\n");
+                _debug ("UserAgent: transfered call RINGING!");
                 link->transferStep2 (call);
                 pjsip_evsub_terminate (sub, PJ_TRUE);
 
@@ -3592,18 +3585,18 @@ void xfer_func_cb (pjsip_evsub *sub, pjsip_event *event)
 
         if (status_line.code/100 == 2) {
 
-            _debug ("UserAgent: Try to stop rtp!\n");
+            _debug ("UserAgent: Try to stop rtp!");
             pjsip_tx_data *tdata;
 
             status = pjsip_inv_end_session (call->getInvSession(), PJSIP_SC_GONE, NULL, &tdata);
 
             if (status != PJ_SUCCESS) {
-                _debug ("UserAgent: Fail to create end session msg!\n");
+                _debug ("UserAgent: Fail to create end session msg!");
             } else {
                 status = pjsip_inv_send_msg (call->getInvSession(), tdata);
 
                 if (status != PJ_SUCCESS)
-                    _debug ("UserAgent: Fail to send end session msg!\n");
+                    _debug ("UserAgent: Fail to send end session msg!");
             }
 
             link->transferStep2 (call);
@@ -3643,7 +3636,7 @@ void xfer_svr_cb (pjsip_evsub *sub, pjsip_event *event)
 
         call->setXferSub (NULL);
 
-        _debug ("UserAgent: Xfer server subscription terminated\n");
+        _debug ("UserAgent: Xfer server subscription terminated");
     }
 }
 
@@ -3652,7 +3645,7 @@ void on_rx_offer (pjsip_inv_session *inv, const pjmedia_sdp_session *offer)
 
 
 #ifdef CAN_REINVITE
-    _debug ("%s (%d): on_rx_offer REINVITE\n", __FILE__, __LINE__);
+    _debug ("%s (%d): on_rx_offer REINVITE", __FILE__, __LINE__);
 
     SIPCall *call;
     pj_status_t status;
@@ -3752,10 +3745,10 @@ bool setCallAudioLocal (SIPCall* call, std::string localIP)
 			//localIP = account->getPublishedAddress ();
         }
 
-        _debug ("            Setting local ip address: %s\n", localIP.c_str());
+        _debug ("            Setting local ip address: %s", localIP.c_str());
 
-        _debug ("            Setting local audio port to: %d\n", callLocalAudioPort);
-        _debug ("            Setting local audio port (external) to: %d\n", callLocalExternAudioPort);
+        _debug ("            Setting local audio port to: %d", callLocalAudioPort);
+        _debug ("            Setting local audio port (external) to: %d", callLocalExternAudioPort);
 
         // Set local audio port for SIPCall(id)
         call->setLocalIp (localIP);
@@ -3815,7 +3808,7 @@ std::vector<std::string> SIPVoIPLink::getAllIpInterface (void)
         return ifaceList;
     }
 
-    _debug ("Detecting available interfaces...\n");
+    _debug ("Detecting available interfaces...");
 
     int i;
 
@@ -3823,7 +3816,7 @@ std::vector<std::string> SIPVoIPLink::getAllIpInterface (void)
         char tmpAddr[PJ_INET_ADDRSTRLEN];
         pj_sockaddr_print (&addrList[i], tmpAddr, sizeof (tmpAddr), 0);
         ifaceList.push_back (std::string (tmpAddr));
-        _debug ("Local interface %s\n", tmpAddr);
+        _debug ("Local interface %s", tmpAddr);
     }
 
     return ifaceList;
@@ -3870,12 +3863,12 @@ std::string getLocalAddressAssociatedToAccount (AccountID id)
         local_addr_ipv4 = _localUDPTransport->local_addr.ipv4;
     }
 
-    _debug ("slbvasjklbvaskbvaskvbaskvaskvbsdfk: %i\n", local_addr_ipv4.sin_addr.s_addr);
+    _debug ("slbvasjklbvaskbvaskvbaskvaskvbsdfk: %i", local_addr_ipv4.sin_addr.s_addr);
 
     tmp = pj_str (pj_inet_ntoa (local_addr_ipv4.sin_addr));
     localAddr = std::string (tmp.ptr);
 
-    _debug ("slbvasjklbvaskbvaskvbaskvaskvbsdfk: %s\n", localAddr.c_str());
+    _debug ("slbvasjklbvaskbvaskvbaskvaskvbsdfk: %s", localAddr.c_str());
 
     return localAddr;
 
diff --git a/sflphone-common/src/util/Pattern.cpp b/sflphone-common/src/util/Pattern.cpp
index 85cb60392bb6356e5e380e6396eb6b38bc8cee7c..95186c5d689692cc30c1cf78d00e06e5aa66ebdb 100644
--- a/sflphone-common/src/util/Pattern.cpp
+++ b/sflphone-common/src/util/Pattern.cpp
@@ -125,7 +125,7 @@ std::vector<std::string> Pattern::groups (void)
 
     while (stringList[i] != NULL) {
         matchedSubstrings.push_back (stringList[i]);
-        printf ("Substr: <start>%s<end>\n", stringList[i]);
+        printf ("Substr: <start>%s<end>", stringList[i]);
         i++;
     }
 
@@ -246,8 +246,8 @@ bool Pattern::matches (void) throw (match_error)
 
 bool Pattern::matches (const std::string& subject) throw (match_error)
 {
-    //printf("\n\n\nCurrent offset: %d, old offset: %d\n", _offset[1], _offset[0]);
-    //printf("Trying <start>%s<end>\n", subject.substr(_offset[1]).c_str());
+    //printf("Current offset: %d, old offset: %d", _offset[1], _offset[0]);
+    //printf("Trying <start>%s<end>", subject.substr(_offset[1]).c_str());
 
     // Try to find a match for this pattern
     int rc = pcre_exec (
@@ -264,7 +264,7 @@ bool Pattern::matches (const std::string& subject) throw (match_error)
 
     if (rc < 0) {
         _offset[0] = _offset[1] = 0;
-        //printf("Matching failed with %d\n", rc);
+        //printf("Matching failed with %d", rc);
         return false;
     }
 
@@ -275,7 +275,7 @@ bool Pattern::matches (const std::string& subject) throw (match_error)
         _offset[1] =  _ovector[1] + _offset[0];
     }
 
-    //printf("Matching succeeded with %d to %d\n", (int) start(), (int) end());
+    //printf("Matching succeeded with %d to %d", (int) start(), (int) end());
 
     // Matching succeded but not enough space.
     if (rc == 0) {
diff --git a/sflphone-common/test/audiolayerTest.cpp b/sflphone-common/test/audiolayerTest.cpp
index cf0552f4833f2bc862707dc04942ca3c0f6826b7..065b396c47ba801d95da7aa082610f4c861322dd 100644
--- a/sflphone-common/test/audiolayerTest.cpp
+++ b/sflphone-common/test/audiolayerTest.cpp
@@ -80,13 +80,13 @@ void AudioLayerTest::testAudioLayerConfig()
 void AudioLayerTest::testAudioLayerSwitch()
 {
 
-    _debug ("---------- AudioLayerTest::testAudioLayerSwitch ---------------------------\n");
+    _debug ("---------- AudioLayerTest::testAudioLayerSwitch ---------------------------");
 
 
     int previous_layer = Manager::instance().getAudioDriver()->getLayerType();
 
     for (int i = 0; i < 2; i++) {
-        _debug ("---------- AudioLayerTest::testAudioLayerSwitch - %i -------------\n",i);
+        _debug ("---------- AudioLayerTest::testAudioLayerSwitch - %i -------------",i);
         Manager::instance().switchAudioManager();
 
         if (previous_layer == ALSA) {
@@ -106,7 +106,7 @@ void AudioLayerTest::testAudioLayerSwitch()
 void AudioLayerTest::testPulseConnect()
 {
 
-    _debug ("---------- AudioLayerTest::testPulseConnect ---------------------------\n");
+    _debug ("---------- AudioLayerTest::testPulseConnect ---------------------------");
 
     ManagerImpl* manager;
     manager = &Manager::instance();
@@ -133,7 +133,7 @@ void AudioLayerTest::testPulseConnect()
     try {
         CPPUNIT_ASSERT (_pulselayer->openDevice (numCardIn, numCardOut, sampleRate, frameSize, SFL_PCM_BOTH, alsaPlugin) == true);
     } catch (...) {
-        _debug ("Exception occured wile opening device! \n");
+        _debug ("Exception occured wile opening device! ");
     }
 
     usleep (100000);
@@ -184,7 +184,7 @@ void AudioLayerTest::testPulseConnect()
 void AudioLayerTest::testAlsaConnect()
 {
 
-    _debug ("---------- AudioLayerTest::testAlsaConnect ---------------------------\n");
+    _debug ("---------- AudioLayerTest::testAlsaConnect ---------------------------");
 
     int layer = Manager::instance().getAudioDriver()->getLayerType();
 
diff --git a/sflphone-common/test/audiorecorderTest.cpp b/sflphone-common/test/audiorecorderTest.cpp
index fc349f08c20745dc684918034cd920705d9dec91..d4dda35db6300499aeba05c5019a04ceec205349 100644
--- a/sflphone-common/test/audiorecorderTest.cpp
+++ b/sflphone-common/test/audiorecorderTest.cpp
@@ -40,7 +40,7 @@ void AudioRecorderTest::testRecordData()
       _ar->setSndSamplingRate(44100);
       _ar->openFile("theWavFile.wav",ft,sf);
 
-      cout << "file opened!\n";
+      cout << "file opened!";
 
       SFLDataFormat buf [2];
       for (SFLDataFormat i = -32768; i < 32767; i++ ){
diff --git a/sflphone-common/test/mainbufferTest.cpp b/sflphone-common/test/mainbufferTest.cpp
index 9551715a29eed00a3ec89de9fc9e27123fbdd309..830ff2c76979e67b867861c1433643c766dd609a 100644
--- a/sflphone-common/test/mainbufferTest.cpp
+++ b/sflphone-common/test/mainbufferTest.cpp
@@ -53,7 +53,7 @@ void MainBufferTest::tearDown()
 
 void MainBufferTest::testRingBufferCreation()
 {
-    _debug ("MainBufferTest::testRingBufferCreation()\n");
+    _debug ("MainBufferTest::testRingBufferCreation()");
 
     CallID test_id = "1234";
     CallID null_id = "null id";
@@ -100,7 +100,7 @@ void MainBufferTest::testRingBufferCreation()
 
 void MainBufferTest::testRingBufferReadPointer()
 {
-    _debug ("MainBufferTest::testRingBufferReadPointer()\n");
+    _debug ("MainBufferTest::testRingBufferReadPointer()");
 
     CallID call_id = "call id";
     CallID read_id = "read id";
@@ -147,7 +147,7 @@ void MainBufferTest::testRingBufferReadPointer()
 
 void MainBufferTest::testCallIDSet()
 {
-    _debug ("MainBufferTest::testCallIDSet()\n");
+    _debug ("MainBufferTest::testCallIDSet()");
 
     CallID test_id = "set id";
     CallID false_id = "false set id";
@@ -231,7 +231,7 @@ void MainBufferTest::testCallIDSet()
 void MainBufferTest::testRingBufferInt()
 {
 
-    _debug ("MainBufferTest::testRingbufferInt()\n");
+    _debug ("MainBufferTest::testRingbufferInt()");
 
     // CallID test_id = "test_int";
 
@@ -348,7 +348,7 @@ void MainBufferTest::testRingBufferInt()
 void MainBufferTest::testRingBufferNonDefaultID()
 {
 
-    _debug ("MainBufferTest::testRingBufferNonDefaultID()\n");
+    _debug ("MainBufferTest::testRingBufferNonDefaultID()");
 
     CallID test_id = "test_int";
 
@@ -436,7 +436,7 @@ void MainBufferTest::testRingBufferNonDefaultID()
 void MainBufferTest::testRingBufferFloat()
 {
 
-    _debug ("MainBufferTest::testRingBufferFloat()\n");
+    _debug ("MainBufferTest::testRingBufferFloat()");
 
     float testfloat1 = 12.5;
     float testfloat2 = 13.4;
@@ -471,7 +471,7 @@ void MainBufferTest::testRingBufferFloat()
 void MainBufferTest::testTwoPointer()
 {
 
-    _debug ("MainBufferTest::testTwoPointer()\n");
+    _debug ("MainBufferTest::testTwoPointer()");
 
 
     RingBuffer* input_buffer = _mainbuffer.createRingBuffer (default_id);
@@ -490,7 +490,7 @@ void MainBufferTest::testTwoPointer()
 void MainBufferTest::testBindUnbindBuffer()
 {
 
-    _debug ("MainBufferTest::testBindUnbindBuffer()\n");
+    _debug ("MainBufferTest::testBindUnbindBuffer()");
 
     CallID test_id1 = "bind unbind 1";
     CallID test_id2 = "bind unbind 2";
@@ -554,7 +554,7 @@ void MainBufferTest::testBindUnbindBuffer()
     // unbind test_id1 with default_id
     _mainbuffer.unBindCallID (test_id1);
 
-    _debug ("%i\n", (int) (_mainbuffer._ringBufferMap.size()));
+    _debug ("%i", (int) (_mainbuffer._ringBufferMap.size()));
     CPPUNIT_ASSERT (_mainbuffer._ringBufferMap.size() == 0);
     CPPUNIT_ASSERT (_mainbuffer._callIDMap.size() == 0);
 
@@ -767,7 +767,7 @@ void MainBufferTest::testBindUnbindBuffer()
     CPPUNIT_ASSERT (iter_readpointer->second == 0);
 
 
-    _debug ("ok1\n");
+    _debug ("ok1");
 
     // unbind test_id1 with test_id2
     // calling it twice not supposed to break anything
@@ -890,7 +890,7 @@ void MainBufferTest::testBindUnbindBuffer()
 void MainBufferTest::testGetPutDataByID()
 {
 
-    _debug ("MainBufferTest::testGetPutData()\n");
+    _debug ("MainBufferTest::testGetPutData()");
 
     CallID test_id = "getData putData";
     CallID false_id = "false id";
@@ -946,7 +946,7 @@ void MainBufferTest::testGetPutDataByID()
 void MainBufferTest::testGetPutData()
 {
 
-    _debug ("MainBufferTest::testGetDataAndCallID()\n");
+    _debug ("MainBufferTest::testGetDataAndCallID()");
 
     CallID test_id = "incoming rtp session";
 
@@ -995,7 +995,7 @@ void MainBufferTest::testGetPutData()
 void MainBufferTest::testDiscardFlush()
 {
 
-    _debug ("MainBufferTest::testDiscardFlush()\n");
+    _debug ("MainBufferTest::testDiscardFlush()");
 
     CallID test_id = "flush discard";
     // _mainbuffer.createRingBuffer(test_id);
@@ -1038,7 +1038,7 @@ void MainBufferTest::testDiscardFlush()
 void MainBufferTest::testReadPointerInit()
 {
 
-    _debug ("MainBufferTest::testReadPointerInit()\n");
+    _debug ("MainBufferTest::testReadPointerInit()");
 
     CallID test_id = "test read pointer init";
     // RingBuffer* test_ring_buffer = _mainbuffer.createRingBuffer(test_id);
@@ -1067,7 +1067,7 @@ void MainBufferTest::testReadPointerInit()
 void MainBufferTest::testRingBufferSeveralPointers()
 {
 
-    _debug ("MainBufferTest::testRingBufferSeveralPointers\n");
+    _debug ("MainBufferTest::testRingBufferSeveralPointers");
 
     CallID test_id = "test multiple read pointer";
     RingBuffer* test_ring_buffer = _mainbuffer.createRingBuffer (test_id);
@@ -1181,7 +1181,7 @@ void MainBufferTest::testRingBufferSeveralPointers()
 void MainBufferTest::testConference()
 {
 
-    _debug ("MainBufferTest::testConference()\n");
+    _debug ("MainBufferTest::testConference()");
 
     CallID test_id1 = "participant A";
     CallID test_id2 = "participant B";
@@ -1695,7 +1695,7 @@ void MainBufferTest::testConference()
     CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == sizeof (int));
     CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == sizeof (int));
     test_ring_buffer = _mainbuffer.getRingBuffer (test_id1);
-    _debug ("%i\n", test_ring_buffer->putLen());
+    _debug ("%i", test_ring_buffer->putLen());
     test_ring_buffer->debug();
     CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
     CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_id1 - sizeof (int)));
diff --git a/sflphone-common/test/rtpTest.cpp b/sflphone-common/test/rtpTest.cpp
index 48f8ef5e4cbcfb6739f8e56bf29a9052a57a410e..31dfcc81663b2c3842a3b4a0be2a1bb63dc1ab02 100644
--- a/sflphone-common/test/rtpTest.cpp
+++ b/sflphone-common/test/rtpTest.cpp
@@ -41,7 +41,7 @@ using std::endl;
 void RtpTest::setUp()
 {
 
-    _debug ("------ Set up rtp test------\n");
+    _debug ("------ Set up rtp test------");
 
     Manager::instance().initConfigFile();
     Manager::instance().init();
@@ -69,7 +69,7 @@ bool RtpTest::pjsipInit()
     _pool = pj_pool_create (&_cp.factory, "rtpTest", 4000, 4000, NULL);
 
     if (!_pool) {
-        _debug ("----- RtpTest: Could not initialize pjsip memory pool ------\n");
+        _debug ("----- RtpTest: Could not initialize pjsip memory pool ------");
         return PJ_ENOMEM;
     }
 
@@ -83,16 +83,16 @@ void RtpTest::testRtpInitClose()
 
     audiortp = new AudioSymmetricRtpSession (Manager::instance(), sipcall);
 
-    _debug ("------ void RtpTest::testRtpInit() ------\n");
+    _debug ("------ void RtpTest::testRtpInit() ------");
 
     try {
 
-        _debug ("-------- Open Rtp Session ----------\n");
+        _debug ("-------- Open Rtp Session ----------");
         audiortp->createNewSession (sipcall);
 
     } catch (...) {
 
-        _debug ("!!! Exception occured while Oppenning Rtp !!!\n");
+        _debug ("!!! Exception occured while Oppenning Rtp !!!");
 
     }
 
@@ -103,18 +103,18 @@ void RtpTest::testRtpInitClose()
 
     // computeNbByteAudioLayer
 
-    _debug ("------ Finilize Rtp Initialization ------ \n");
+    _debug ("------ Finilize Rtp Initialization ------ ");
 
 
-    _debug ("------ RtpTest::testRtpClose() ------\n");
+    _debug ("------ RtpTest::testRtpClose() ------");
 
     try {
-        _debug ("------ Close Rtp Session -------\n");
+        _debug ("------ Close Rtp Session -------");
         CPPUNIT_ASSERT (audiortp->closeRtpSession());
 
     } catch (...) {
 
-        _debug ("!!! Exception occured while closing Rtp !!!\n");
+        _debug ("!!! Exception occured while closing Rtp !!!");
 
     }
 
@@ -129,7 +129,7 @@ void RtpTest::testRtpThread()
 
     audiortp = new AudioRtp();
 
-    _debug ("-------- Open Rtp Session ----------\n");
+    _debug ("-------- Open Rtp Session ----------");
 
     try {
 
@@ -137,11 +137,11 @@ void RtpTest::testRtpThread()
 
     } catch (...) {
 
-        _debug ("!!! Exception occured while Oppenning Rtp !!!\n");
+        _debug ("!!! Exception occured while Oppenning Rtp !!!");
 
     }
 
-    _debug ("------ void RtpTest::testRtpThread ------\n");
+    _debug ("------ void RtpTest::testRtpThread ------");
 
     CPPUNIT_ASSERT (audiortp->_RTXThread->computeCodecFrameSize (160,8000) == 20.0f);
     CPPUNIT_ASSERT (audiortp->_RTXThread->computeCodecFrameSize (320,16000) == 20.0f);
@@ -150,7 +150,7 @@ void RtpTest::testRtpThread()
     // 20 ms at 44.1 khz corespond to 882 samples (1764 byte)
     CPPUNIT_ASSERT (audiortp->_RTXThread->computeNbByteAudioLayer (20.f) == 1764);
 
-    _debug ("------ Close Rtp Session -------\n");
+    _debug ("------ Close Rtp Session -------");
 
     try {
 
@@ -158,7 +158,7 @@ void RtpTest::testRtpThread()
 
     } catch (...) {
 
-        _debug ("!!! Exception occured while closing Rtp !!!\n");
+        _debug ("!!! Exception occured while closing Rtp !!!");
 
     }
 
@@ -184,7 +184,7 @@ void RtpTest::testRtpResampling()
 
     audiortp = new AudioRtp();
 
-    _debug ("-------- Open Rtp Session ----------\n");
+    _debug ("-------- Open Rtp Session ----------");
 
     try {
 
@@ -192,28 +192,28 @@ void RtpTest::testRtpResampling()
 
     } catch (...) {
 
-        _debug ("!!! Exception occured while Oppenning Rtp !!!\n");
+        _debug ("!!! Exception occured while Oppenning Rtp !!!");
 
     }
 
-    _debug ("------ void RtpTest::testRtpResampling ------\n");
+    _debug ("------ void RtpTest::testRtpResampling ------");
 
     CPPUNIT_ASSERT (0 == 0);
     rsmpl_nbSample = audiortp->_RTXThread->reSampleData (data, rsmpl_data, 8000, nbSample, UP_SAMPLING);
-    _debug ("ORIGINAL DATA SET\n");
+    _debug ("ORIGINAL DATA SET");
 
     for (int i = 0; i < nbSample; i++)
         printf ("  %i=>%i  ", i, data[i]);
 
-    _debug ("RESAMPLED DATA SET\n");
+    _debug ("RESAMPLED DATA SET");
 
     for (int i = 0; i < rsmpl_nbSample; i++)
         printf ("  %i=>%i  ", i, rsmpl_data[i]);
 
-    printf ("\n");
+    printf ("");
 
 
-    _debug ("------ Close Rtp Session -------\n");
+    _debug ("------ Close Rtp Session -------");
 
     try {
 
@@ -221,7 +221,7 @@ void RtpTest::testRtpResampling()
 
     } catch (...) {
 
-        _debug ("!!! Exception occured while closing Rtp !!!\n");
+        _debug ("!!! Exception occured while closing Rtp !!!");
 
     }