diff --git a/resources/templates/provision/mitel/5324/MN_{$mac}.cfg b/resources/templates/provision/mitel/5324/MN_{$mac}.cfg
index 032e4ac9b0..785286ce3a 100644
--- a/resources/templates/provision/mitel/5324/MN_{$mac}.cfg
+++ b/resources/templates/provision/mitel/5324/MN_{$mac}.cfg
@@ -267,30 +267,23 @@
0
0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ {foreach $keys as $row}
+ #Configure Line Key {$row.device_key_id}
+ {if $row.device_key_category == "line"}
+ {if $row.device_key_line == "1"}{$feature = "6"}{$user_id = $user_id_1}{/if}
+ {if $row.device_key_line == "2"}{$feature = "7"}{$user_id = $user_id_2}{/if}
+ {if $row.device_key_line == "3"}{$feature = "8"}{$user_id = $user_id_3}{/if}
+ {if $row.device_key_line == "4"}{$feature = "9"}{$user_id = $user_id_4}{/if}
+ {if $row.device_key_line == "5"}{$feature = "10"}{$user_id = $user_id_5}{/if}
+ {if $row.device_key_line == "6"}{$feature = "11"}{$user_id = $user_id_6}{/if}
+ {if $row.device_key_line == "7"}{$feature = "12"}{$user_id = $user_id_7}{/if}
+ {if $row.device_key_line == "8"}{$feature = "13"}{$user_id = $user_id_8}{/if}
+
+ {/else}
+
+ {/if}
+ {/foreach}
1
diff --git a/resources/templates/provision/mitel/5340/MN_{$mac}.cfg b/resources/templates/provision/mitel/5340/MN_{$mac}.cfg
index 0cc9e1d55b..4d937002c9 100644
--- a/resources/templates/provision/mitel/5340/MN_{$mac}.cfg
+++ b/resources/templates/provision/mitel/5340/MN_{$mac}.cfg
@@ -267,30 +267,23 @@
0
0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ {foreach $keys as $row}
+ #Configure Line Key {$row.device_key_id}
+ {if $row.device_key_category == "line"}
+ {if $row.device_key_line == "1"}{$feature = "6"}{$user_id = $user_id_1}{/if}
+ {if $row.device_key_line == "2"}{$feature = "7"}{$user_id = $user_id_2}{/if}
+ {if $row.device_key_line == "3"}{$feature = "8"}{$user_id = $user_id_3}{/if}
+ {if $row.device_key_line == "4"}{$feature = "9"}{$user_id = $user_id_4}{/if}
+ {if $row.device_key_line == "5"}{$feature = "10"}{$user_id = $user_id_5}{/if}
+ {if $row.device_key_line == "6"}{$feature = "11"}{$user_id = $user_id_6}{/if}
+ {if $row.device_key_line == "7"}{$feature = "12"}{$user_id = $user_id_7}{/if}
+ {if $row.device_key_line == "8"}{$feature = "13"}{$user_id = $user_id_8}{/if}
+
+ {/else}
+
+ {/if}
+ {/foreach}
1