File: userguide.xml

package info (click to toggle)
kannel 1.4.5-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 16,284 kB
  • sloc: ansic: 105,659; sh: 32,211; xml: 20,360; php: 1,103; perl: 711; makefile: 583; yacc: 548; awk: 133; python: 122; javascript: 27; pascal: 3
file content (10916 lines) | stat: -rw-r--r-- 405,627 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
9491
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506
9507
9508
9509
9510
9511
9512
9513
9514
9515
9516
9517
9518
9519
9520
9521
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565
9566
9567
9568
9569
9570
9571
9572
9573
9574
9575
9576
9577
9578
9579
9580
9581
9582
9583
9584
9585
9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10596
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
10909
10910
10911
10912
10913
10914
10915
10916
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
                      "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
<!ENTITY figtype "#FIGTYPE#">
<!ENTITY timestamp "#DATE#">
<!ENTITY version "#VERSION#">
<!ENTITY % draft "#DRAFTS#">
]>

<!-- Embbeb your block with these to set it to "draft"
<![%draft;[ <your block> ]]>
-->

<book>

<bookinfo>
	<title>Kannel &version; User's Guide</title>
	<subtitle>Open Source WAP and SMS gateway</subtitle>

<authorgroup>
	<author>
		<firstname>Andreas</firstname>
		<surname>Fink</surname>
		<affiliation>
			<jobtitle>Chairman &amp; CTO</jobtitle>
			<orgname>Global Networks Inc.</orgname>
			<address> <email>andreas@fink.org</email>
				<otheraddr>http://www.smsrelay.com/</otheraddr>
				<otheraddr>http://www.gni.ch/</otheraddr>
			</address>
		</affiliation>
	</author>
	<author>
		<firstname>Bruno</firstname>
		<surname>Rodrigues</surname>
		<affiliation>
			<address> 
				<email>bruno.rodrigues@litux.org</email>
				<otheraddr>http://litux.org/bruno</otheraddr>
			</address>
		</affiliation>
	</author>
	<author>
		<firstname>Stipe</firstname>
		<surname>Tolj</surname>
		<affiliation>
			<jobtitle>System Architect</jobtitle>
			<orgname>Tolj System Architecture</orgname>
			<address> 
				<email>stolj@kannel.org</email>
				<otheraddr>http://www.tolj.org/</otheraddr>
			</address>
		</affiliation>
	</author>
	<author>
		<firstname>Aarno</firstname>
		<surname>Syv&auml;nen</surname>
		<affiliation>
			<jobtitle>Chief MMS Developer</jobtitle>
			<orgname>Global Networks Inc.</orgname>
			<address> 
				<email>as@gni.ch</email>
				<otheraddr>http://www.gni.ch/</otheraddr>
			</address>
		</affiliation>
	</author>
	<author>
		<firstname>Alexander</firstname>
		<surname>Malysh</surname>
		<affiliation>
			<jobtitle>Senior Software Engineer</jobtitle>
			<orgname>GTX Messaging GmbH.</orgname>
			<address> 
				<email>amalysh at kannel.org</email>
				<otheraddr>http://www.gtx-messaging.com/</otheraddr>
			</address>
		</affiliation>
	</author>
    <author>
        <firstname>Alejandro</firstname>
        <surname>Guerrieri</surname>
        <affiliation>
            <jobtitle>Senior System Architect</jobtitle>
            <orgname>3Cinteractive, L.L.C.</orgname>
            <address> 
                <email>aguerrieri@kannel.org</email>
                <otheraddr>http://www.3cinteractive.com/</otheraddr>
            </address>
        </affiliation>
    </author>
	<author>
		<firstname>Lars</firstname>
		<surname>Wirzenius</surname>
		<affiliation>
			<jobtitle>Gateway architect</jobtitle>
			<orgname>former Wapit Ltd</orgname>
			<!--<address> <email>liw@wapit.com</email>
			<otheraddr>http://www.wapit.com</otheraddr>
			</address>-->
		</affiliation>
	</author>
	<author>
		<firstname>Kalle</firstname>
		<surname>Marjola</surname>
		<affiliation>
			<jobtitle>Senior Software Engineer</jobtitle>
			<orgname>Enpocket</orgname>
			<address> 
				<email>marjola@enpocket.com</email>
				<otheraddr>http://www.enpocket.com</otheraddr>
			</address>
		</affiliation>
	</author>

</authorgroup>

	<abstract>
		<title>Abstract</title> 
		<para>
		This document describes how
		to install and use Kannel, the Open Source WAP and SMS Gateway
		originally developed by Wapit Ltd (now out of business) and now
		being developed further by the open source community, namely the 
		Kannel Group.
		</para>
	</abstract>

  <revhistory>
    <revision>
      <revnumber>&version;</revnumber>
      <date>&timestamp;</date>
    </revision>
  </revhistory>

</bookinfo>


<chapter>
<title>Introduction</title>

	<highlights>
	<para>This chapter introduces WAP and SMS in general terms, and explains the
	role of the gateway in WAP and SMS, outlining their duties and features. It
	also explains why the Kannel project was started in the first place,
	and why it is open source.</para>
	</highlights>
	
	<para>With hundreds of millions of mobile phones in use all over the
	world, the market for services targeted at mobile users
	is mind-bogglingly immense.  Even simple services find plenty of users,
	as long as they're useful or fun. Being able to get news, send e-mail
	or just be entertained wherever you are is extremely attractive to
	many.</para>

	<para>The hottest technology for implementing mobile services is WAP,
	short for Wireless Application Protocol. It lets the phone act
	as a simple web browser, but optimizes the markup language,
	scripting language, and the transmission protocols for wireless
	use. The optimized protocols are translated to plain old HTTP by
	a <emphasis>WAP gateway</emphasis>.</para>

	<para>Kannel is an open source WAP gateway. It attempts to
	provide this essential part of the WAP infrastructure freely
	to everyone so that the market potential for WAP services,
	both from wireless operators and specialized service providers,
	will be realized as efficiently as possible.</para>

	<para>Kannel also works as an SMS gateway for GSM networks. Almost
	all GSM phones can send and receive SMS messages, so this is
	a way to serve many more clients than just those using a new
	WAP phone.</para>

        <para>In addition, Kannel operates as <emphasis>Push Proxy Gateway 
        </emphasis>, or <emphasis>PPG</emphasis>, making possible for content 
        servers to send data to the phones. This is a new type of WAP service,
        and have many interesting applications. Usually servers know whether
        some data is new, not the users. </para>

	<para>Kannel's quality has been recognized on March 7, 2001 when it
	was <ulink url="http://www.kannel.org/oldnews.shtml#wapcert">certified</ulink> 
	by <ulink url="http://www.wapforum.org">WAP Forum</ulink>
	as the first WAP 1.1 gateway in the world.</para>

	<para>Greater quality recognition are the quantity of companies 
	using Kannel to successful connect to a variety of SMSC protocols 
	in lots of countries.</para>

	<para><ulink url="http://www.opensource.org">Open Source</ulink>
	is a way to formalize the principle of openness by placing the
	source code of a product under a Open Source compliant software
	license. The BSD license was chosen over other Open Source
	licenses by the merit of placing the least amount of limitations
	on what a third party is able to do with the source code. In
	practice this means that Kannel is going to be a fully-featured
	WAP implementation and compatible with the maximum number of
	bearers with special emphasis on SMSC compatibility.
	The Kannel project was founded by Wapit Ltd in June, 1999.</para>
	
	
<sect1>
<title>Overview of WAP</title>

	<para>WAP, short for Wireless Application Protocol, is a
	collection of various languages and tools and an infrastructure for
	implementing services for mobile phones. Traditionally such
	services have worked via normal phone calls or short textual
	messages (e.g., SMS messages in GSM networks). Neither are very
	efficient to use, nor very user friendly.  WAP makes it possible
	to implement services similar to the World Wide Web.</para>
	
	<para>Unlike marketers claim, WAP does not bring the existing
	content of the Internet directly to the phone. There are too many
	technical and other problems for this to ever work properly. The
	main problem is that Internet content is mainly in the form of
	HTML pages, and they are written in such way that they require
	fast connections, fast processors, large memories, big screens,
	audio output and often also fairly efficient input mechanisms.
	That's OK, since they hopefully work better for traditional
	computers and networks that way. However, portable phones have
	very slow processors, very little memory, abysmal and intermittent
	bandwidth, and extremely awkward input mechanisms. Most existing
	HTML pages do not work on mobiles phones, and never will.</para>
	
	<para>WAP defines a completely new markup language, the Wireless
	Markup Language (WML), which is simpler and much more strictly
	defined than HTML.  It also defines a scripting language,
	WMLScript, which all browsers are required to support. To make
	things even simpler for the phones, it even defines its own
	bitmap format (Wireless Bitmap, or WBMP).</para>
	
	<para>HTTP is also too inefficient for wireless use. However, by using
	a semantically similar binary and compressed format it
	is possible to reduce the protocol overhead to a few bytes per
	request, instead of the usual hundreds of bytes. Thus, WAP defines a
	new protocol stack to be used. However, to make things simpler
	also for the people actually implementing the services, WAP
	introduces a gateway between the phones and the servers providing
	content to the phones.</para>

        <figure>
        <title>Logical position of WAP gateway (and PPG) between a phone and a 
        content server.</title>
        <graphic fileref="wap-gateway&figtype;"></graphic>
        </figure>

	<para>The WAP gateway talks to the phone using the WAP protocol
	stack, and translates the requests it receives to normal
	HTTP. Thus content providers can use any HTTP servers and
	utilize existing know-how about HTTP service implementation
	and administration.</para>
	
	<para>In addition to protocol translations, the gateway
	also compresses the WML pages into a more compact form, to
	save on-the-air bandwidth and to further reduce the phone's
	processing requirements. It also compiles WMLScript programs
	into a byte-code format. Latest WAP specifications defines some 
	additional conversions that Kannel is starting to implement, like
	multipart/form-data, multipart/mixed or MMS content conversion.</para>
	
	<para>Kannel is not just a WAP gateway. It also works as an
	SMS gateway.  Although WAP is the hot and technically superior
	technology, SMS phones exist in huge numbers and SMS services are
	thus quite useful. Therefore, Kannel functions simultaneously
	as both a WAP and an SMS gateway.</para>

</sect1>

<sect1>
<title>Overview of WAP Push</title>
       <para>Previous chapter explained pull mode of operation: the phone
       initiates the transaction. There is, however, situations when the
       server (called in this context a push initiator) should be the 
       initiator, for instance, when it must send a mail notification or a
       stock quote. For this purpose WAP Forum defined WAP Push.</para>

       <para>Push is an application level service, sitting on the top of
       existing WAP stack. It defines two protocols, OTA and PAP. OTA is
       a ligthweigth protocol speaking with WAP stack (to be more specific,
       with WSP), PAP speaks with the push initiator. It defines three kind
       of XML documents, one for the push data itself and another for 
       protocol purposes (these are called pap document or push control 
       documents). </para>

       <para>The server does not simply send push content to the phone, the
       user would surely not accept, for instance, interrupting of a voice 
       call. Instead it sends a specific XML document, either Service 
       Indication or Service Loading. These inform the user about the content 
       become available, and it is displayed only when it is not interrupting 
       anything. It contains an URL specifying the service and a text for user 
       describing the content. Then the user can decide does he accept push or not.
       </para>

       <para>The push content is send ed to the phones over SMS, but the 
       content is fetched by the phone over IP bearer, for instance CSD
       or GPRS. Because Push Proxy Gateway tokenises SI and SL documents, it 
       may fit one SMS message (if not, it is segmented for transfer). </para>

       <para>Using two bearers seems to be an unnecessary complication. But
       quite simply, phones currently operate this way. Push over GPRS can 
       only simplify matters.</para>
</sect1>
	
<sect1>
<title>Overview of SMS</title>

      <para>SMS, short messaging service, is a way to send short (160
      character) messages from one GSM phone to another. It can also
      be used to send regular text as well as advanced content like 
      operator logos, ringing tones, business cards
      and phone configurations.</para>

      <para><emphasis>SMS services</emphasis> are content services
      initiated by SMS message to certain (usually short) phone
      number, which then answers with requested content, if available.</para>

      <para>When SMS services are used, the client (mobile terminal) 
      sends an SMS
      message to certain number, usually a very short specialized
      number, which points to specific SMS center responsible
      for that number (plus possibly many others). This SMS center
      then sends the message onward to specified receiver in intra- or
      Internet, using an SMS center specific protocol. For example, a
      Nokia SMS center uses CIMD protocol.</para>

      <para>As practically every different kind of SMS center uses different
      protocol, an <emphasis>SMS gateway</emphasis> is used to handle
      connections with SMS centers and to relay them onward in an
      unified form. Kannel's biggest feature is to abstract each SMSC protocol
      to a well-known HTTP protocol, simplifying services deployment.</para>

        <figure>
        <title>Logical position of SMS gateway between a phone and a content server.</title>
        <graphic fileref="sms-gateway&figtype;"></graphic>
        </figure>

      <para>An SMS gateway can also be used to relay SMS messages from
      one GSM network to another, if the networks do not roam messages
      normally.</para>

      <para>Kannel works as an SMS gateway, talking with many
      different kind of SMS centers, and relaying the messages onward
      to content providers, as HTTP queries. Content providers then
      answer to this HTTP query and the answer is sent back to mobile
      terminal, with appropriate SMS center connection using SMS center
      specific protocol.</para>

      <para>In addition to serving mobile originated (MO) SMS messages
      Kannel also works as an SMS push gateway - content providers can
      request Kannel to send SMS messages to terminals. Kannel then
      determines the correct SMS center to relay the SMS message and
      sends the SMS message to that SMS center, again using SMS center
      specific protocol. This way the content provider does not need
      to know any SMS center specific protocol, just unified Kannel
      SMS sending interface.</para>

</sect1>

	
<sect1>
<title>Features</title>

	<sect2>
	<title>WAP</title>
		<para>
			<itemizedlist>
			<listitem><para>Fully compliant with WAP 1.1 specification</para></listitem>
			<listitem><para>Already implements some WAP 1.2 and even WAP 2.0 features.</para></listitem>
			</itemizedlist>
		</para>
	</sect2>
	<sect2>
	<title>WAP Push</title>
		<para>
			<itemizedlist>
			<listitem><para>Supports WAP Push SI and SL</para></listitem>
			<listitem><para>...</para></listitem>
			</itemizedlist>
		</para>
	</sect2>
	<sect2>
	<title>SMS</title>
		<para>
			<itemizedlist>
			<listitem><para>Supports a variety of SMSC protocols, namely:</para>
				<itemizedlist>
				<listitem><para>CMG's UCP/EMI 4.0 and 3.5</para></listitem>
				<listitem><para>...</para></listitem>
				</itemizedlist>
			</listitem>
			<listitem><para>Full support for MO and MT messages</para></listitem>
			</itemizedlist>
		</para>
	</sect2>
</sect1>

<sect1>
<title>Requirements</title>

	<para>Kannel is being developed on Linux systems,
	and should be fairly easy to export to other Unix-like
	systems. However, we don't yet support other platforms, due to lack
	of time, although it should be working without major problems on 
	Windows (through Cygwin), Solaris and FreeBSD.
	</para>
	
	<para>Kannel requires the following software environment:
	
	<itemizedlist>

	<listitem><para>C compiler and libraries for ANSI C, with normal
		Unix extensions such as BSD sockets and related tools. 
		(GNU's GCC tool-chain is recommended)</para></listitem>

	<listitem><para>The Gnome XML library (known as
		gnome-xml and libxml), version 2.2.5 or newer. See <ulink
		url="http://xmlsoft.org/xml.html">http://xmlsoft.org/xml.html</ulink>.
		</para>
		<para>If you are installing it from your distribution's packages, you'll need
		<literal>libxml2-dev</literal> in addition to run-time <literal>libxml2</literal> package
		libraries.</para></listitem>
	
	<listitem><para>GNU Make.</para></listitem>

	<listitem><para>An implementation of POSIX threads
		(<filename>pthread.h</filename>).</para></listitem>

	<listitem><para>GNU Bison 1.28, if you want to modify the WMLScript
		compiler (a pre-generated parser is included for those who just
		want to compile Kannel).</para></listitem>

	<listitem><para>DocBook processing tools: DocBook style-sheets,
		jade, jadetex, etc; see <filename>README</filename>, section
                `Documentation', for more information (pre-formatted versions
                of the documentation are available, and you can compile Kannel
                itself even without the documentation tools).</para></listitem>
	
	<listitem><para>GNU autoconf, if you want to modify the
		configuration script.</para></listitem>

	</itemizedlist>
	</para>
	
	<para>Hardware requirements are fluffier. Some informal benchmarking 
	have shown that with a reasonably fast PC architecture (e.g. 400MHz 
	Pentium II with 128MB RAM), SMS performance's bottleneck is always on the
	SMSC side, even for example with multiple connections summing a pipeline with 
	400 msg/sec.  We haven't benchmarked Kannel yet on WAP side, so there are 
	no hard numbers.</para>

</sect1>

</chapter>

<chapter>
<title>Installing the gateway</title>

	<para>This chapter explains how the gateway can be installed,
	either from a source code package or by using a pre-compiled
	binary version. The goal of this chapter is to get the gateway
	compiled and all the files in the correct places; the next
	chapter will explain how the gateway is configured.</para>

	<note><para>If you are upgrading from a previous version, please look at
	<xref linkend="upgrading-notes"/> for any important information.</para></note>

<sect1>
<title>Getting the source code</title>

	<para>The source code to
	Kannel is available for download at <ulink
	url="http://www.kannel.org/download.shtml">http://www.kannel.org/download.shtml</ulink>.
	It is available in various formats and you can choose to download
	either the latest release version or the daily snapshot of the
	development source tree for the next release version, depending
	on whether you want to use Kannel for production use or to
	participate in the development.</para>
	
	<para>If you're serious about development, you probably want to
	use CVS, the version control system used by the Kannel project.
	This allows you to participate in Kannel development much
	more easily than by downloading the current daily snapshot and
	integrating any changes you've made every day. CVS does that
	for you. (See the Kannel web site for more information on how
	to use CVS.)</para>

</sect1>


<sect1>
<title>Finding the documentation</title>

	<para>The documentation for Kannel consists of three parts:
	
	<orderedlist>
	<listitem><para><citetitle>User's Guide</citetitle>, i.e., the one
		you're reading at the moment.</para></listitem>
	<listitem><para><citetitle>Architecture and
		Design</citetitle>, in <filename>doc/arch</filename> or
		at <ulink url="http://www.kannel.org/arch.shtml">
		http://www.kannel.org/arch.shtml</ulink></para></listitem>
	<listitem><para>The <filename>README</filename> and various other
		text files in the source tree.</para></listitem>
		
	</orderedlist>
	</para>
	
	<para>You can also find general information on Kannel's 
		<ulink url="http://www.kannel.org">website</ulink> and
		information about existing problems at 
		<ulink url="http://bugs.kannel.org">our bug tracker</ulink>.
	</para>

	<para>
	We intend to cover everything you need to install and use Kannel
	is in <citetitle>User's Guide</citetitle>, but the guide is still 
	incomplete in this respect. Similarly, the <citetitle>Architecture and
	Design</citetitle> document should tell you everything you need
	to know to dive into the sources and quickly make your own modifications. 
	It's not a replacement for actually
	reading the source code, but it should work as a map to the
	source code.  The <filename>README</filename> is not supposed
	to be very important, nor contain much information. Instead,
	it will just point at the other documentation.
	</para>
	
</sect1>

<sect1>
<title>Compiling the gateway</title>

	<para>If you are using Kannel on a supported platform, or one
	that is similar enough to one, compiling Kannel should be trivial.
	After you have unpacked the source package of your choose,
	or after you have checked out the source code from CVS, enter
	the following commands:
	
	<screen><userinput>
        ./configure
        make
	</userinput></screen>
	
	The <filename>configure</filename> script investigates various
	things on your computer for the Kannel compilation needs, and
	writes out the <filename>Makefile</filename> used to compile
	Kannel. <command>make</command> then runs the commands to actually
	compile Kannel.</para>
	
	<para>If either command writes out an error message and stops
	before it finishes its job, you have a problem, and you either
	need to fix it yourself, if you can, or report the
	problem to the Kannel project. See <xref linkend="bug-reporting"/>
	for details.</para>
	
	<para>For detailed instruction on using the configuration
	script, see file <filename>INSTALL</filename>. That file is
	a generic documentation for <command>configure</command>. Kannel
	defines a few additional options:
	
    	<itemizedlist>

        <listitem><para><literal>--with-defaults=</literal><replaceable>type</replaceable>

	    Set defaults for the other options.
	    <replaceable>type</replaceable> is either <literal>speed</literal>
	    or <literal>debug</literal>.  The default is
            <literal>speed</literal>. <literal>speed</literal> options is equivalent to 
	    <literal>--with-malloc=native --disable-assertions</literal>, while 
	    <literal>debug</literal> is <literal>--with-malloc=checking --enable-assertions</literal>.

	    </para></listitem>

	<listitem><para><literal>--disable-docs (default is --enable-docs)</literal>

	    Use this option if you don't have DocBook installed and/or 
	    you want to save some time and CPU cycles. 
	    Pre-generated documentation is available on Kannel's site.
	    Default behavior is to build documentation, b.e., converting the User Guide and
	    the Architecture Guide from the DocBook markup language to
	    PostScript and HTML if DocBook is available.
	    </para></listitem>

	<listitem><para><literal>--enable-drafts (default is --disable-drafts)</literal>

	    When building documentation, include the sections marked as
	    <literal>draft</literal>.</para></listitem>

	<listitem><para><literal>--enable-debug (default is --disable-debug)</literal>

	    Enable non-reentrant development time
	    debugging of WMLScript compiler.</para></listitem>

	<listitem><para><literal>--disable-localtime (default is --enable-localtime)</literal>

	    Write log file time stamps in GMT, not in local time.
	    </para></listitem>

	<listitem><para><literal>--enable-assertions / --disable-assertions</literal>

	    Turn on or off runtime assertion checking.  <literal>enable</literal> makes
	    Kannel faster, but gives less information if it crashes.
	    Default value is dependent on <literal>--with-defaults</literal>.
	    </para></listitem>

	<listitem><para><literal>--with-malloc=</literal><replaceable>type</replaceable>

	    Select memory allocation module to use:
	    <replaceable>type</replaceable> is <literal>native</literal>,
            <literal>checking</literal>, or
            <literal>slow</literal>.  For production use you probably
	    want <literal>native</literal>.  The <literal>slow</literal>
            module is more thorough than <literal>checking</literal>,
	    but much slower. 
	    Default value is dependent on <literal>--with-defaults</literal>.
	    </para></listitem>

	<listitem><para><literal>--enable-mutex-stats</literal>

	    Produce information about lock contention.</para></listitem>

	<listitem><para><literal>--enable-start-stop-daemon</literal>

	    Compile the start-stop-daemon program.</para></listitem>

	<listitem><para><literal>--enable-pam</literal>

	    Enable using PAM for authentication of sendsms users for
	    smsbox.</para></listitem>

        <listitem><para><literal>--with-mssql<replaceable>[=DIR]</replaceable></literal>

            Enable using FreeTDS libraries for DBPool and
            DLR support on MS-SQL and Sybase. Optional DIR specifies where to look for
            FreeTDS libraries and include files (defaults to /usr/local).</para></listitem>

        <listitem><para><literal>--with-mysql</literal>

            Enable using MySQL libraries for DBPool and
            DLR support.</para></listitem>

        <listitem><para><literal>--with-mysql-dir=</literal><replaceable>DIR</replaceable>

            Where to look for MySQL libs and header files.
            DIR points to the installation of MySQL.</para></listitem>

        <listitem><para><literal>--with-sdb</literal>

            Enable using LibSDB libraries for dlr support.
            </para></listitem>

        <listitem><para><literal>--with-oracle</literal>

            Enable using Oracle OCI-Libraries for Oracle 8i/9i DBPool and
            DLR support.</para></listitem>

        <listitem><para><literal>--with-oracle-includes=</literal><replaceable>DIR</replaceable>

            Where to look for Oracle OCI-Header files.</para></listitem>

        <listitem><para><literal>--with-oracle-libs=</literal><replaceable>DIR</replaceable>

            Where to look for Oracle OCI-Library files.</para></listitem>

        <listitem><para><literal>--with-redis</literal>
                
            Enable using Redis for DBPool and DLR support. Requires the hiredis library.</para></listitem>
            
            <listitem><para><literal>--with-redis-dir=</literal><replaceable>DIR</replaceable>
                
                Where to look for the hiredis library and header files.</para></listitem>

        <listitem><para><literal>--with-cassandra</literal>
                
            Enable using Cassandra for DBPool and DLR support. Requires the DataStax C/C++ driver for 
            Apache Cassandra.</para></listitem>
            
            <listitem><para><literal>--with-cassandra-dir=</literal><replaceable>DIR</replaceable>
                
                Where to look for the DataStax C/C++ Cassandra library and header files.</para></listitem>

	<!-- XXX DAVI add openssl and others in here -->

	</itemizedlist>
	</para>
	
	<para>You may need to add compilations flags to configure:

	<screen><userinput>
	CFLAGS='-pthread' ./configure
	</userinput></screen>

	The above, for instance, seems to be required on FreeBSD. If you
	want to develop Kannel, you probably want to add CFLAGS that make
	your compiler use warning messages. For example, for GCC:
	
	<screen><userinput>
	CFLAGS='-Wall -O2 -g' ./configure
	</userinput></screen>
	
	(You may, at your preference, use even stricter checking options.)
	</para>

</sect1>

<sect1>
<title>Installing the gateway</title>

	<para>After you have compiled Kannel, you need to install
	certain programs in a suitable place. This is most easily
	done by using <command>make</command> again:
	
	<screen><userinput>
	make bindir=<replaceable>/path/to/directory</replaceable> install
	</userinput></screen>

	Replace <replaceable>/path/to/directory</replaceable> with the
	pathname of the actual directory where the programs should be
	installed. The programs that are installed are (as filenames
	from the root of the source directory):
	
	<simplelist>
	<member><filename>gw/bearerbox</filename></member>
	<member><filename>gw/smsbox</filename></member>
	<member><filename>gw/wapbox</filename></member>
	</simplelist>
	
	The version number of the gateway is added to the file names
	during installation. This makes it easier to have several
	versions installed, and makes it easy to go back to an older
	version if the new version proves problematic.</para>
	
	<para>Kannel consists of three programs called boxes: the
	bearer box is the interface towards the phones. It accepts
	WAP and SMS messages from the phones and sends them to the
	other boxes. The SMS box handles SMS gateway functionality,
	and the WAP box handles WAP gateway functionality. There can
	be several SMS boxes and several WAP boxes running and they
	don't have to run on the same host. This makes it possible
	to handle much larger loads.</para>

</sect1>

<sect1>
<title>Using pre-compiled binary packages</title>

<sect2>
<title>Installing Kannel from RPM packages</title>

	<para>This chapter explains how to install, upgrade and remove
	Kannel binary RPM packages.</para>
		
	<para>Before you install Kannel, check that you have libxml2
	installed on your system:</para>

	<screen><userinput>
	rpm -q libxml2
	</userinput></screen>
	
	<para>Installing Kannel</para>

	<para>1. Download the binary RPM packet from the Kannel
	web site.</para>
	
	<para>2. Install the RPM package:

	<screen><userinput>
	rpm -ivh kannel-<replaceable>VERSION</replaceable>.<replaceable>i386</replaceable>.rpm
	</userinput></screen>
	</para>

	<para>Upgrading Kannel</para>

	<para>1. Download the binary RPM packet from the Kannel
        web site.</para>

	<para>2. Upgrade the RPM package:

        <screen><userinput>
	rpm -Uvh kannel-<replaceable>VERSION</replaceable>.<replaceable>i386</replaceable>.rpm
	</userinput></screen>
        </para>
	
	<para>Removing Kannel</para>

	<para>1. Remove the RPM package:
	
	<screen><userinput>
	rpm -e kannel
	</userinput></screen>
	</para>

	<para>After you have installed Kannel from the RPM packages you
	should now be able to run the Kannel init.d script that will
	start Kannel as a WAP gateway. Run the script as root.</para>

	<screen><userinput>
	/etc/rc.d/init.d/kannel start
	</userinput></screen>

	<para>To stop the gateway just run the same script with the
	stop parameter.</para>

	<screen><userinput>
	/etc/rc.d/init.d/kannel stop
	</userinput></screen>
	
	<para>If Kannel is already running and you just want to quickly
	stop and start the gateway,e.g.to set a new configuration option,
	run the script with the restart parameter.</para>

	<screen><userinput>
	/etc/rc.d/init.d/kannel restart
	</userinput></screen>
	
	<para>If you want Kannel to run as a daemon, you need to add a
	symbolic link to the Kannel script from the runlevel you want
	Kannel to run in. E.g. to run Kannel in runlevel 5 add symbolic
	links to /etc/rc.d/rc5.d/.</para>

	<screen><userinput>
	cd /etc/rc.d/rc5.d/
	ln -s ../init.d/kannel S91kannel
	ln -s ../init.d/kannel K91kannel
	</userinput></screen>

	<para>To run Kannel as a SMS gateway you need to edit the
	configuration file which is at /etc/kannel/kannel.conf.
	In Kannel's documentation directory 
	(<filename>/usr/share/doc/kannel</filename>) 
	there is an example file called examples/smskannel.conf. 
	It has some basic examples of the configuration groups needed 
	to run Kannel as a SMS gateway. For more detailed information 
	please see <filename>examples/kannel.conf</filename> in the
	same directory for a commented complete example, and read the 
	section "SMS gateway configuration" later in this same 
	document.</para>

	<para>The logging is disabled by default and you can enable
	it from the kannel.conf file. Just add the log-file option
	to the group of which box you want to log.</para>  
	
	<para>The documentation will be installed at 
	/usr/doc/kannel-VERSION/ or /usr/share/doc/kannel-VERSION/
	depending on if you used the RedHat 6.x or a 7.x or newer 
	package.</para>

	<para>In the Kannel documentation directory there is a HTML
	file called control.html. It is an example file that shows
	how to use the Kannel HTTP administration interface. It
	also has a template for sending SMS messages.</para>

</sect2>

<sect2>
<title>Installing Kannel from DEB packages</title>

	<para>This chapter explains how to install, upgrade and remove
	Kannel binary DEB packages.</para>

	<para>Kannel's packages are available on main Debian repository 
	(<ulink url="http://packages.debian.org/kannel">http://packages.debian.org/kannel</ulink>)
	although that version may be out-of-sync with latest Kannel version.
	</para>
	<!-- XXX DAVI add kannel packages and my repository here -->
		
	<para>Before you install Kannel, check that you have libxml2
	installed on your system:</para>

	<screen><userinput>
	dpkg -l libxml2
	</userinput></screen>
	
	<para>Installing or upgrading Kannel from Debian or Kannel repository</para>

	<para>1. Install or upgrade the package:

	<screen><userinput>
	apt-get install kannel
	</userinput></screen>
	</para>

	<para>See http://kannel.org/download.shtml#debian_repository for 
	information about kannel repository sources.list</para>

	<para>Installing or upgrading Kannel from a file</para>

	<para>1. Download the binary DEB packet from the Kannel
	web site.</para>
	
	<para>2. Log in as root:</para>

	<screen><userinput>
	su -
	</userinput></screen>

	<para>3. Install or upgrade the DEB package:</para>
	<screen><userinput>
	dpkg -i kannel-<replaceable>VERSION</replaceable>.deb
	</userinput></screen>

	<para>Removing Kannel</para>
	
	<para>1. Log in as root:</para>

	<para>2. Remove the package keeping configuration files:</para>
	<screen><userinput>
	dpkg --remove kannel
	</userinput></screen>

	<para>3. Remove the package completely:</para>
	<screen><userinput>
	dpkg --purge kannel
	</userinput></screen>

	<para>After you have installed Kannel from the DEB packages you
	should now be able to run the Kannel init.d script that will
	start Kannel as a WAP gateway. Run the script as root.</para>

	<screen><userinput>
	/etc/init.d/kannel start
	</userinput></screen>

	<para>To stop the gateway just run the same script with the
	stop parameter.</para>

	<screen><userinput>
	/etc/init.d/kannel stop
	</userinput></screen>
	
	<para>If Kannel is already running and you just want to quickly
	stop and start the gateway,e.g.to set a new configuration option,
	run the script with the restart parameter.</para>

	<screen><userinput>
	/etc/init.d/kannel restart
	</userinput></screen>
	
	<para>If you don't want Kannel to run as a daemon, 
	run: </para>
	
	<screen><userinput>
	update-rc.d -f kannel remove
	</userinput></screen>

	<para>If you want to restore Kannel running as a daemon, you 
	need to add a
	symbolic link to the Kannel script from the runlevel you want
	Kannel to run in. E.g. to run Kannel in default runlevel, 
	just run: </para>
	
	<screen><userinput>
	update-rc.d kannel defaults
	</userinput></screen>
	
	<para>Kannel package starts by default with a wapbox daemon.
	To activate smsbox or select which box you want to start, 
	edit /etc/default/kannel and comment/uncomment START_xxxBOX.
	</para>

	<para>To run Kannel as a SMS gateway you need to edit the
	configuration file which is at /etc/kannel/kannel.conf.
	In /usr/share/docs/kannel/examples/ there are example files. 
	They have some basic examples of the configuration groups 
	needed to run Kannel as a SMS gateway. For
	more detailed information please read the section "SMS gateway
	configuration" later in this same document.</para>

	<para>The documentation will be installed at 
	/usr/share/doc/kannel/.</para>

	<para>In the Kannel documentation directory there is a html
	file called control.html. It is an example file that shows
	how to use the Kannel HTTP administration interface. It
	also has a template for sending SMS messages.</para>

	<para>Additionally to kannel-VERSION.deb, there's now an optional
	kannel-docs-VERSION.deb with documentation (userguide et al) and
	a kannel-extras-VERSION.deb with contrib and test stuff.</para>

	<para>If you want to test development version, use the packages
	called kannel-devel-*.deb.</para>

</sect2>

</sect1>

</chapter>


<chapter>
<title>Using the gateway</title>

	<para>This chapter explains how the gateway core, bearerbox,
        is configured and used.
	It covers the configuration file, keeping an eye on the gateway
	while it is running, and using the HTTP interface to control
	the gateway.</para>

        <para>After this chapter there is distinct chapter for each
        kind of gateway use: WAP gateway, SMS gateway and WAP Push
        proxy. These chapters explain the configuration and other
        aspects of gateway of that type.</para>
	
	<para>You can configure your Kannel to be only a WAP or a SMS
	gateway, or to be both at the same time. You just need to read
	each chapter and combine all configurations.</para>

	<para>There is only one configuration file for all parts of
	Kannel, although when Kannel is distributed to several hosts
	some lines from the configuration file can be removed in some
	hosts.</para>

<sect1>
<title>Configuring the gateway</title>

	<para>The configuration file can be divided into three parts:
	bearerbox configurations, smsbox configurations and
	wapbox configurations. Bearerbox part has one 'core' group
	and any used SMS center groups, while wapbox part has only
	one wapbox group. In smsbox part there is one smsbox group and
	then number of sms-service and sendsms-user groups.</para>

	<para>Details of each part are in an appropriate section of this
        documentation. The 'core' group used by the bearerbox is
        explained in this chapter, while 'wapbox' part is in the next
        chapter and 'smsbox', 'smsc' (SMS center), 'sms-service' and
        'sendsms-user' groups are in the SMS Kannel chapter.</para>

  

<sect2>
<title>Configuration file syntax</title>

	<para>A configuration file consists of groups of configuration variables. Groups are
	separated by empty lines, and each variable is defined on its
	own line. Each group in Kannel configuration is distinguished
	with a group variable. Comments are lines that begin with a number sign
	(<literal>#</literal>) and are ignored (they don't, for example,
	separate groups of variables).</para>
	
	<para>A variable definition line has the name of the variable,
	and equals sign (<literal>=</literal>) and the value of the
	variable. The name of the variable can contain any characters
	except white space and equals. The value of the variable is a
	string, with or without quotation marks (<literal></literal>)
	around it. Quotation marks are needed if the variable needs to
	begin or end with white space or contain special
	characters. Normal C 	escape character syntax works inside 
	quotation marks.</para>

	<para>Perhaps an example will make things easier to comprehend:

<programlisting>
1    # A do-nothing service.
2    group = sms-service
3    keyword = nop
4    text = "You asked nothing and I did it!"
5
6    # Default service.
7    group = sms-service
8    keyword = default
9    text = "No services defined"
</programlisting>

	The above snippet defines the keyword <literal>nop</literal>
	for an SMS service, and a default action for situation when
	the keyword in the SMS message does not match any defined
	service.</para>
	
	<para>Lines 1 and 6 are comment lines. Line 5 separates the
	two groups. The remaining lines define variables. The
	group type is defined by the group variable value.</para>
	
	<para>The various variables that are understood in each type
	of configuration group are explained below.</para>

	<para>Some variable values are marked as
	<literal>'bool'</literal>. The value for variable can be like
	true, false, yes, no, on, off, 0 or 1. Other values are
	treated as 'true' while if the variable is not present at all,
	it is treated as being 'false'.</para>

	<para>In order to make some configuration lines more readable
	you may use the delimiter '\' at the end of a line to wrap
	and concatenate the next line up to the current line. Here is 
	an example:

<programlisting>
1    # A group with a wrapped alias line
2    group = sms-service
3    keyword = hello
4    aliases = hallo;haalloo;\
5      heelloo;haelloo;healloo
5    text = "Hello world!"
</programlisting>
 
     The above example shows how a list for various alias keywords
     is wrapped to two lines using the line wrap delimiter. In order
     to use the delimiter '\' itself, you need to escape it via a
     prefixed '\' itself. So this is '\\' to escape the wrapping
     function and use the character in the string.</para>
     
</sect2>

<sect2 id="includes">
<title id="includes.title">Inclusion of configuration files</title>

	<para>A configuration file may contain a special directive 
	called <literal>include</literal> to include other 
	file or a directory with files to the configuration 
	processing.</para>
 
	<para>This allows to segment the specific configuration groups
	required for several services and boxes to different files and
	hence to have more control in larger setups.</para>

	<para>Here is an example that illustrates the <literal>include
	</literal> statement :

<programlisting>
group = core
admin-port = 13000
wapbox-port = 13002
admin-password = bar
wdp-interface-name = "*"
log-file = "/var/log/bearerbox.log"
log-level = 1
box-deny-ip = "*.*.*.*"
box-allow-ip = "127.0.0.1"

include = "wapbox.conf"

include = "configurations"
</programlisting>

	Above is the main <literal>kannel.conf</literal> configuration
	file that includes the following <literal>wapbox.conf</literal>
	file with all required directives for the specific box, and a 
	<literal>configurations</literal> directory which may include 
	more files to include.

<programlisting>
group = wapbox
bearerbox-host = localhost
log-file = "/var/log/wapbox.log"
log-level = 0
syslog-level = none
</programlisting>


	The above <literal>include</literal> statement may be defined
	at any point in the configuration file and at any inclusion 
	depth. Hence you can cascade numerous inclusions if necessary.
	</para>

	<para>At process start time inclusion of configuration files 
	breaks if either the included file can not be opened and 
	processed or the included file has been processed already in 
	the stack and a recursive cycling has been detected.</para>

</sect2>

<sect2>
<title>Core configuration</title>

  <para>Configuration for Kannel <emphasis>MUST</emphasis> always
  include a group for general bearerbox configuration. This group is
  named as 'core' in configuration file, and should be the first group
  in the configuration file.</para>

  <para>As its simplest form, 'core' group looks like this:

<programlisting>
group = core
admin-port = 13000
admin-password = f00bar
</programlisting>

   Naturally this is not sufficient for any real use, as you want to
   use Kannel as an SMS gateway, or WAP gateway, or both. Thus, one or
   more of the optional configuration variables are used. In following
   list (as in any other similar lists), all mandatory variables are
   marked with <literal>(m)</literal>, while conditionally mandatory
   (variables which must be set in certain cases) are marked with
   <literal>(c)</literal>.</para>


 <table frame="none">
  <title>Core Group Variables</title>
  <tgroup cols="3">
  <thead>
   <row>
     <entry>Variable</entry>
     <entry>Value</entry>
     <entry>Description</entry>
   </row>
  </thead>
  <tbody>
   <row><entry><literal>group (m)</literal></entry>
     <entry><literal>core</literal></entry>
     <entry valign="bottom">
       This is a mandatory variable
     </entry></row>

    <row><entry><literal>admin-port (m)</literal></entry>
     <entry>port-number</entry>
     <entry valign="bottom">
        The port number in which the bearerbox listens to HTTP
        administration commands. It is NOT the same as the HTTP
        port of the local HTTP server, just invent any port, but
        it must be over 1023 unless you are running Kannel as a
        root process (not recommended)
     </entry></row>

	 <row><entry><literal>admin-port-ssl (o)</literal></entry>
     <entry>bool</entry>
     <entry valign="bottom">
        If set to true a SSL-enabled administration HTTP server
		  will be used instead of the default insecure plain HTTP
		  server. To access the administration pages you will have
		  to use a HTTP client that is capable of talking to such
		  a server. Use the "https://" scheme to access the
		  secured HTTP server. Defaults to "no".
     </entry></row>

    <row><entry><literal>admin-password (m)</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
         Password for HTTP administration commands (see below)
     </entry></row>

    <row><entry><literal>status-password</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
         Password to request Kannel status. If not set, no password is
	 required, and if set, either this or
	 <literal>admin-password</literal> can be used
     </entry></row>
   
    <row><entry><literal>admin-deny-ip</literal></entry>
     <entry morerows="1">IP-list</entry>
     <entry morerows="1" valign="bottom">
        These lists can be used to prevent connection from given IP 
  addresses. Each list can have several addresses, separated with    
  semicolons (';'). An asterisk ('*') can be used
        as a wild-card in a place of any ONE number, so *.*.*.*
        matches any IP.
     </entry></row>
    <row><entry><literal>admin-allow-ip</literal></entry></row>

     <row><entry><literal>smsbox-interface (o)</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
        If this is set, the smsbox listener will only bind
        to a specified address. For example: "127.0.0.1".
     </entry></row>

    <row><entry><literal>smsbox-port (c)</literal></entry>
     <entry>port-number</entry>
     <entry valign="bottom">
        This is the port number to which the smsboxes, if any, connect.
        As with admin-port, this can be anything you want. Must be set
        if you want to handle any SMS traffic.
     </entry></row>
	  
	 <row><entry><literal>smsbox-port-ssl (o)</literal></entry>
     <entry>bool</entry>
     <entry valign="bottom">
	     If set to true, the smsbox connection module will be SSL-enabled.
		  Your smsboxes will have to connect using SSL to the bearerbox
		  then. This is used to secure communication between bearerbox
		  and smsboxes in case they are in separate networks operated and
		  the TCP communication is not secured on a lower network layer.
		  Defaults to "no".
     </entry></row>

    <row><entry><literal>wapbox-port (c)</literal></entry>
     <entry>port-number</entry>
     <entry valign="bottom">
        Like smsbox-port, but for wapbox-connections. If not set,
        Kannel cannot handle WAP traffic
     </entry></row>

	 <row><entry><literal>wapbox-port-ssl (o)</literal></entry>
     <entry>bool</entry>
     <entry valign="bottom">
	     If set to true, the wapbox connection module will be SSL-enabled.
		  Your wapboxes will have to connect using SSL to the bearerbox
		  then. This is used to secure communication between bearerbox
		  and wapboxes in case they are in separate networks operated and
		  the TCP communication is not secured on a lower network layer.
		  Defaults to "no".
     </entry></row>

    <row><entry><literal>box-deny-ip</literal></entry>
     <entry morerows="1">IP-list</entry>
     <entry morerows="1" valign="bottom">
        These lists can be used to prevent box connections from given IP 
        addresses. Each list can have several addresses, 
        separated with semicolons (';'). An asterisk ('*') can be used
        as a wild-card in place of any ONE number, so *.*.*.*
        matches any IP.
     </entry></row>
    <row><entry><literal>box-allow-ip</literal></entry></row>

    <row><entry><literal>udp-deny-ip</literal></entry>
     <entry morerows="1">IP-list</entry>
     <entry morerows="1" valign="bottom">
        These lists can be used to prevent UDP packets from given IP 
        addresses, thus preventing unwanted use of the WAP gateway.
	Used the same way as <literal>box-deny-ip</literal> and
	<literal>box-allow-ip</literal>.
     </entry></row>
    <row><entry><literal>udp-allow-ip</literal></entry></row>

    <row><entry><literal>wdp-interface-name (c)</literal></entry>
     <entry>IP or '*'</entry>
     <entry valign="bottom">
        If this is set, Kannel listens to WAP UDP packets incoming to
        ports 9200-9208, bound to given IP. If no specific IP is
        needed, use just an asterisk ('*'). If UDP messages are
        listened to, wapbox-port variable MUST be set.
     </entry></row>

    <row><entry><literal>log-file</literal></entry>
     <entry>filename</entry>
     <entry valign="bottom">
        A file in which to write a log. This in addition to <literal>stdout</literal>
        and any log file defined in command line. Log-file in 'core'
        group is only used by the bearerbox.
     </entry></row>

    <row><entry><literal>log-level</literal></entry>
     <entry>number 0..5</entry>
     <entry valign="bottom">
        Minimum level of log-file events logged. 0 is for 'debug', 1
        'info', 2 'warning, 3 'error' and 4 'panic' (see Command Line
        Options)
     </entry></row>

    <row><entry><literal>access-log</literal></entry>
     <entry>filename</entry>
     <entry valign="bottom">
        A file in which information about received/sent SMS messages 
        is stored. Access-log in 'core' group is only used by the
        bearerbox.
     </entry></row>

    <row><entry><literal>access-log-clean</literal></entry>
     <entry>boolean</entry>
     <entry valign="bottom">
        Indicates if <literal>access-log</literal> will contain standard 'markers', 
		  which means the 'Log begins', 'Log ends' markers and the prefixed
		  timestamp. This config directive should be set to 'true' if a custom 
		  logging format is desired without a prefixed default timestamp. 
     </entry></row>

    <row><entry><literal>access-log-format</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
		  String defining a custom log file line format. May use escape codes as defined
		  later on to substitute values of the messages into the log entry. If no
		  custom log format is used the standard format will be:
		  <literal>"%t %l [SMSC:%i] [SVC:%n] [ACT:%A] [BINF:%B] [FID:%F] [META:%D] [from:%p] [to:%P] 
		           [flags:%m:%c:%M:%C:%d] [msg:%L:%b] [udh:%U:%u]"</literal>
     </entry></row>

    <row><entry><literal>syslog-level</literal></entry>
     <entry>number</entry>
     <entry valign="bottom">
	 Messages of this log level or higher will also be
	 sent to syslog, the UNIX system log daemon. If not explicitly
         set with <literal>syslog-facility</literal>, it logs under the
         'daemon' category. The default is not to use syslog, and you can
         set that explicitly by setting <literal>syslog-level</literal>
	 to 'none'.
     </entry></row>

    <row><entry><literal>syslog-facility</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
         The syslog facility to send the syslog entries to. The
         default is 'daemon'.
     </entry></row>

    <row><entry><literal>unified-prefix</literal></entry>
     <entry>prefix-list</entry>
     <entry valign="bottom">
        String to unify received phone numbers, for SMSC routing and
        to ensure that SMS centers can handle them properly. 
        This is applied to 'sender' number when receiving SMS
        messages from SMS Center and for 'receiver' number when
        receiving messages from smsbox (either sendsms message or
         reply to original message). Format is that first comes the
        unified prefix, then all prefixes which are replaced by the
        unified prefix, separated with comma (','). For example,
        for Finland an unified-prefix "+358,00358,0;+,00" should do the trick. 
        If there are several unified prefixes, separate their rules with
        semicolon (';'), like "+35850,050;+35840,040". <emphasis>Note
        that prefix routing is next to useless now that there are
        SMSC ID entries. To remove prefixes, use like 
	"-,+35850,050;-,+35840,040".
	</emphasis>

     </entry></row>

    <row><entry><literal>white-list</literal></entry>
     <entry>URL</entry>
     <entry valign="bottom">
        (Deprecated, see <literal>white-list-sender</literal>).
     </entry></row>

     <row><entry><literal>white-list-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
        (Deprecated, see <literal>white-list-sender-regex</literal>).
        </entry>   
     </row>

    <row><entry><literal>black-list</literal></entry>
     <entry>URL</entry>
     <entry valign="bottom">
        (Deprecated, see <literal>black-list-sender</literal>).
     </entry></row>

     <row><entry><literal>black-list-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
        (Deprecated, see <literal>black-list-sender-regex</literal>).
        </entry>   
     </row>

    <row><entry><literal>white-list-sender</literal></entry>
     <entry>URL</entry>
     <entry valign="bottom">
        Load a list of accepted senders of SMS messages. If a sender
        of an SMS message is not in this list, any message received
        from the SMS Center, or tried to be delivered to the SMS Center
        is rejected. See notes of phone number
        format from numhash.h header file. NOTE: the system has only
        a precision of last 9 or 18 digits of phone numbers, so
        beware!
     </entry></row>

     <row><entry><literal>white-list-sender-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
        A regular expression defining the set of accepted senders.
        See section on <xref linkend="regular-expressions"/> for details.
        </entry>   
     </row>

    <row><entry><literal>black-list-sender</literal></entry>
     <entry>URL</entry>
     <entry valign="bottom">
        As white-list-sender, but SMS messages from these sender numbers are
        automatically rejected.
     </entry></row>

     <row><entry><literal>black-list-sender-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
        A regular expression defining the set of rejected senders.
        See section on <xref linkend="regular-expressions"/> for details.
        </entry>   
     </row>

    <row><entry><literal>white-list-receiver</literal></entry>
     <entry>URL</entry>
     <entry valign="bottom">
        Load a list of accepted receiver of SMS messages. If a receiver
        of an SMS message is not in this list, any message received
        from the SMS Center, or tried to be delivered to the SMS Center
        is rejected. See notes of phone number
        format from numhash.h header file. NOTE: the system has only
        a precision of last 9 or 18 digits of phone numbers, so
        beware!
     </entry></row>

     <row><entry><literal>white-list-receiver-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
        A regular expression defining the set of accepted receivers.
        See section on <xref linkend="regular-expressions"/> for details.
        </entry>   
     </row>

    <row><entry><literal>black-list-receiver</literal></entry>
     <entry>URL</entry>
     <entry valign="bottom">
        As white-list, but SMS messages from these receiver numbers are
        automatically rejected.
     </entry></row>

     <row><entry><literal>black-list-receiver-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
        A regular expression defining the set of rejected receivers.
        See section on <xref linkend="regular-expressions"/> for details.
        </entry>   
     </row>

    <row><entry><literal>store-type</literal></entry>
     <entry>filename</entry>
     <entry valign="bottom">
        Kannel can use store subsystem that means storing messages
        on hard disk or in a remote key store until they are successfully 
        handled. By using this subsystem, no SMS messages are lost in Kannel even by
        crash, but theoretically some messages can duplicate when
        system is taken down violently. 
        This variable defines a type of backend used for store
        subsystem. Now two types are supported:
        a) file: writes store into one single file
        b) spool: writes store into spool directory (one file for each message)
        c) redis: writes store into a redis key storage. For redis as message storage
           you will need a <literal>group = redis-connection</literal> and a
           <literal>group = store-db</literal> configuration group that define the
           connection to the redis server and the table name to be used. See file
           <literal>doc/examples/store-redis.conf</literal> for an example config
           secttion.
     </entry></row>

    <row><entry><literal>store-location</literal></entry>
     <entry>filename</entry>
     <entry valign="bottom">
        Depends on <literal>store-type</literal> option used, it is ether file or spool directory,
        or none if redis is used as storage subsystem.
     </entry></row>

    <row><entry><literal>store-dump-freq</literal></entry>
     <entry>seconds</entry>
     <entry valign="bottom">
        Approximated frequency how often the memory dump of current
        pending messages are stored to store-file, providing something
        has happened. Defaults to 10 seconds if not set.
     </entry></row>

    <row><entry><literal>http-proxy-host</literal></entry>
     <entry>hostname</entry>
     <entry morerows="1" valign="bottom">
        Enable the use of an HTTP proxy for all HTTP requests.
     </entry></row>
    <row><entry><literal>http-proxy-port</literal></entry>
     <entry>port-number</entry></row>

    <row><entry><literal>http-proxy-exceptions</literal></entry>
     <entry>URL-list</entry>
     <entry valign="bottom">
         A list of excluded hosts from being used via a
         proxy. Separate each entry with space.
     </entry></row>

    <row><entry><literal>http-proxy-exceptions-regex</literal></entry>
     <entry>UNIX regular expression</entry>
     <entry valign="bottom">
         Same as http-proxy-exceptions but match against UNIX regular expression.
     </entry></row>
    
    <row><entry><literal>http-proxy-username</literal></entry>
     <entry>username</entry>
     <entry valign="bottom">
         Username for authenticating proxy use, for proxies that
	 require this.
     </entry></row>
    
    <row><entry><literal>http-proxy-password</literal></entry>
     <entry>URL-list</entry>
     <entry valign="bottom">
         Password for authenticating proxy use, for proxies that
	 require this.
     </entry></row>
    
    <row><entry><literal>ssl-client-certkey-file (c)</literal></entry>
     <entry>filename</entry>
     <entry valign="bottom">
      A PEM encoded SSL certificate and private key file to be used
      with SSL client connections. This certificate is used for
  	   the HTTPS client side only, i.e. for SMS service requests to 
		SSL-enabled HTTP servers. 
     </entry>
    </row>
  
	 <row><entry><literal>ssl-server-cert-file (c)</literal></entry>
     <entry>filename</entry>
     <entry valign="bottom">
      A PEM encoded SSL certificate file to be used with SSL server
		connections. This certificate is used for the HTTPS server
		side only, i.e. for the administration HTTP server and the
		HTTP interface to send SMS messages.
	  </entry>
    </row>

	 <row><entry><literal>ssl-server-key-file (c)</literal></entry>
     <entry>filename</entry>
     <entry valign="bottom">
      A PEM encoded SSL private key file to be used with SSL server
		connections. This key is associated to the specified 
		certificate and is used for the HTTPS server side only.
	  </entry>
    </row>

	 <row><entry><literal>ssl-trusted-ca-file</literal></entry>
     <entry>filename</entry>
     <entry valign="bottom">
     This file contains the certificates Kannel is willing to trust when
     working as a HTTPS client. If this option is not set, certificates
     are not validated and those the identity of the server is not proven.
	  </entry>
    </row>

     <row><entry><literal>ssl-client-cipher-list</literal></entry>
     <entry>filename</entry>
     <entry valign="bottom">
     Defines the list of encryption suites and ciphers to be used for 
     client side connections. For further details please see
     https://www.openssl.org/docs/manmaster/man1/ciphers.html
      </entry>
    </row>

     <row><entry><literal>ssl-server-cipher-list</literal></entry>
     <entry>filename</entry>
     <entry valign="bottom">
     Defines the list of encryption suites and ciphers to be used for 
     server side connections. For further details please see
     https://www.openssl.org/docs/manmaster/man1/ciphers.html
      </entry>
    </row>

    <row><entry><literal>dlr-storage</literal></entry>
     <entry>type</entry>
     <entry valign="bottom">
        Defines the way DLRs are stored. Natively in-memory storage is 
        supported, which is very fast, but has no persistancy. This means 
        you will loose all your temporary DLR information on bearebox 
        re-start. In addition a spool directory approach is natively 
        supported, which garantees persistancy with a reasonable 
        performance, depending on your disk IO performance.
        If you have build-in external DLR storage support, i.e. using 
        MySQL you may define here the alternative storage type like 
        <literal>mysql</literal>. 
        Supported types are:
        <literal>internal</literal>, 
        <literal>spool</literal>, 
        <literal>mysql</literal>,
        <literal>pgsql</literal>,
        <literal>sdb</literal>,
        <literal>mssql</literal>,
        <literal>sqlite3</literal>,
        <literal>oracle</literal>,
        <literal>redis</literal> and
        <literal>cassandra</literal>.
        By default this is set to <literal>internal</literal>.
     </entry></row>

    <row><entry><literal>dlr-spool</literal></entry>
     <entry>filename</entry>
     <entry valign="bottom">
        Depends on <literal>dlr-storage = spool</literal> option used, it 
        is the spool directory to use for DLR storage data.
     </entry></row>

     <row><entry><literal>maximum-queue-length</literal></entry>
	  <entry>number of messages</entry>
     <entry valign="bottom">
   	 (Deprecated, see <literal>sms-incoming-queue-limit</literal>).
     </entry></row>

     <row><entry><literal>sms-incoming-queue-limit</literal></entry>
     <entry>number of messages</entry>
     <entry valign="bottom">
        Set maximum size of incoming message queue. After number of messages
        has hit this value, Kannel began to discard them.
        Value 0 means giving strict priority to outgoing messages. -1,
        default, means that the queue of infinite length is accepted. (This
        works with any normal input, use this variable only when Kannel message
        queues grow very long).
     </entry></row>

     <row><entry><literal>sms-outgoing-queue-limit</literal></entry>
     <entry>number of messages</entry>
     <entry valign="bottom">
        Set maximum size of outgoing message queue. After number of messages
        has hit this value, Kannel began to discard them.
        The default value, 1 million, works for most installations.
     </entry></row>

     <row><entry><literal>smsbox-max-pending</literal></entry>
        <entry>number of messages</entry>
        <entry valign="bottom">
        Maximum number of pending messages on the line to smsbox compatible boxes.
        </entry>   
     </row>
  
     <row><entry><literal>sms-resend-freq</literal></entry>
        <entry>seconds</entry>
        <entry valign="bottom">
        Frequency for the SMS resend thread in which temporarily failed or queued messages will be resent.
        Defaults to 60 seconds.
        </entry>   
     </row>

     <row><entry><literal>sms-resend-retry</literal></entry>
        <entry>number</entry>
        <entry valign="bottom">
        Maximum retry attempts for the temporarily failed messages.
        Defaults to -1, means: unlimited.
        </entry>   
     </row>

     <row><entry><literal>sms-combine-concatenated-mo</literal></entry>
        <entry>boolean</entry>
        <entry valign="bottom">
        Whether Kannel should attempt to combine concatenated MO SMS
        prior to passing them over to smsbox. Default is true
        </entry>   
     </row>

     <row><entry><literal>sms-combine-concatenated-mo-timeout</literal></entry>
        <entry>seconds</entry>
        <entry valign="bottom">
        How long to wait for all concatenated message parts to arrive before timeouting.
        Default 1800 seconds.
        </entry>   
     </row>

    <row><entry><literal>http-timeout</literal></entry>
     <entry>seconds</entry>
     <entry valign="bottom">
        Sets socket timeout in seconds for outgoing client http
        connections. Optional. Defaults to 240 seconds.
     </entry></row>

  </tbody>
  </tgroup>
 </table>

  <para>A sample more complex 'core' group could be something like
  this:

<programlisting>
group = core
admin-port = 13000
admin-password = f00bar
status-password = sTat
admin-deny-ip = "*.*.*.*"
admin-allow-ip = "127.0.0.1;200.100.0.*"
smsbox-port = 13003
wapbox-port = 13004
box-deny-ip = "*.*.*.*"
box-allow-ip = "127.0.0.1;200.100.0.*"
wdp-interface-name = "*"
log-file = "kannel.log"
log-level = 1
access-log = "kannel.access"
unified-prefix = "+358,00358,0;+,00"
white-list = "http://localhost/whitelist.txt"
</programlisting>
  
    </para>

</sect2>

</sect1>

<sect1>
<title>Running Kannel</title>

	<para>To start the gateway, you need to start each box you need.
	You always need the bearer box, and depending on whether you want
	WAP and SMS gateways you need to start the WAP and SMS boxes. If
	you want, you can run several of them, but we'll explain the
	simple case of only running one each.</para>


<sect2>
<title>Starting the gateway</title>

  <para>After you have compiled Kannel and edited configuration file
  for your taste, you can either run Kannel from command line or use
  supplied <literal>start-stop-daemon</literal> and
  <literal>run_kannel_box</literal> programs to use it as a daemon
  service (more documentation about that later).</para>

  <para>If you cannot or do not know how to set up daemon systems or
  just want to test Kannel, you probably want to start it from
  command line. This means that you probably want to have one terminal
  window for each box you want to start (xterm or screen will do
  fine). To start the bearerbox, give the following command:

	<screen><userinput>
	./bearerbox -v 1 [config-file]
	</userinput></screen>

  The <option>-v 1</option> sets the logging level to
  <literal>INFO</literal>. This way, you won't see a large amount of
  debugging output (the default is <literal>DEBUG</literal>). Full
  explanation of Kannel command line arguments is below.</para>

  <para><emphasis>[config-file]</emphasis> is the name of the
  configuration file you are using with Kannel. The basic distribution
  packet comes with two sample configuration files,
  <literal>smskannel.conf</literal> and
  <literal>wapkannel.conf</literal> (in <literal>gw</literal>
  sub directory), of which the first one is for
  testing out SMS Kannel and the second one for setting up a WAP
  Kannel. Feel free to edit those configuration files to set up your
  own specialized system.</para>

  <para>After the bearer box, you can start the WAP box:

	<screen><userinput>
	./wapbox -v 1 [config-file]
	</userinput></screen>

  or the SMS box:

	<screen><userinput>
	./smsbox -v 1 [config-file]
	</userinput></screen>

  or both, of course. The order does not matter, except that you need
  to start the bearer box before the other boxes. Without the bearer
  box, the other boxes won't even start.</para>

</sect2>

<sect2 id="arguments">
<title id="arguments.title">Command line options</title>

 <para>Bearerbox, smsbox and wapbox each accept certain command line options
   and arguments when they are launched. These arguments are:</para>

 <table frame="none">
  <title>Kannel Command Line Options</title>
  <tgroup cols="2">
  <tbody>
   <row><entry><literal></literal></entry>
        <entry morerows="1" valign="bottom">
             Print the version of the Kannel binary.
        </entry></row>
   <row><entry><literal>--version</literal></entry></row>

   <row><entry><literal>-v &lt;level&gt;</literal></entry>
        <entry morerows="1" valign="bottom">
             Set verbosity level for stdout (screen) logging. Default is 0,
             which means 'debug'. 1 is 'info, 2 'warning', 3
             'error' and 4 'panic'
        </entry></row>
   <row><entry><literal>--verbosity &lt;level&gt;</literal></entry></row>

   <row><entry><literal>-D &lt;places&gt;</literal></entry>
        <entry morerows="1" valign="bottom">
             Set debug-places for 'debug' level output.
        </entry></row>
   <row><entry><literal>--debug &lt;places&gt;</literal></entry></row>

   <row><entry><literal>-F &lt;file-name&gt;</literal></entry>
        <entry morerows="1" valign="bottom">
              Log to file named file-name, too. Does not overrun or
              affect any log-file defined in configuration file.
        </entry></row>
   <row><entry><literal>--logfile &lt;file-name&gt;</literal></entry></row>

   <row><entry><literal>-V &lt;level&gt;</literal></entry>
        <entry morerows="1" valign="bottom">
            Set verbosity level for that extra log-file (default 0,
            which means 'debug'). Does not affect verbosity level of
            the log-file defined in configuration file, not verbosity
            level of the <literal>stdout</literal> output.
        </entry></row>
   <row><entry><literal>--fileverbosity &lt;level&gt;</literal></entry></row>

   <row><entry><literal>-S</literal></entry>
        <entry morerows="1" valign="bottom">
             Start the system initially at SUSPENDED state (see below,
              bearerbox only)
        </entry></row>
   <row><entry><literal>--suspended</literal></entry></row>

   <row><entry><literal>-I</literal></entry>
        <entry morerows="1" valign="bottom">
             Start the system initially at ISOLATED state (see below,
              bearerbox only)
        </entry></row>
   <row><entry><literal>--isolated</literal></entry></row>

   <row><entry><literal>-H</literal></entry>
        <entry morerows="1" valign="bottom">
             Only try to open HTTP sendsms interface; if it
             fails, only warn about that, do not exit. (smsbox only)
        </entry></row>
   <row><entry><literal>--tryhttp</literal></entry></row>

   <row><entry><literal>-g</literal></entry>
        <entry morerows="1" valign="bottom">
             Dump all known config groups and config keys to stdout
             and exit.
        </entry></row>
   <row><entry><literal>--generate</literal></entry></row>

   <row><entry><literal>-u &lt;username&gt;</literal></entry>
        <entry morerows="1" valign="bottom">
             Change process user-id to the given.
        </entry></row>
   <row><entry><literal>--user &lt;username&gt;</literal></entry></row>

   <row><entry><literal>-p &lt;filename&gt;</literal></entry>
        <entry morerows="1" valign="bottom">
             Write process PID to the given file.
        </entry></row>
   <row><entry><literal>--pid-file &lt;filename&gt;</literal></entry></row>

   <row><entry><literal>-d</literal></entry>
        <entry morerows="1" valign="bottom">
             Start process as daemon (detached from a current shell session).
             Note: Process will change CWD (Current working directory) to <literal>/</literal>,
                   therefore you should ensure that all paths to binary/config/config-includes are
                   absolute instead of relative.
        </entry></row>
   <row><entry><literal>--daemonize</literal></entry></row>

   <row><entry><literal>-P</literal></entry>
        <entry morerows="1" valign="bottom">
             Start watcher process. This process watch a child process and if child process
             crashed will restart them automatically.
        </entry></row>
   <row><entry><literal>--parachute</literal></entry></row>

   <row><entry><literal>-X &lt;scriptname&gt;</literal></entry>
        <entry morerows="1" valign="bottom">
             Execute a given shell script or binary when child process crash detected. This option
             is usable only with <literal>--parachute/-P</literal>.
             Script will be executed with 2 arguments:
                 scriptname 'processname' 'respawn-count'.
        </entry></row>
   <row><entry><literal>--panic-script &lt;scriptname&gt;</literal></entry></row>

 </tbody>
 </tgroup>
 </table>

</sect2>

<sect2>
<title>Kannel statuses</title>

    <para>In Kannel, there are four states for the program (which
    currently directly only apply to bearerbox):</para>

    <orderedlist numeration="loweralpha">
     <listitem><para>
       Running. The gateway accepts, proceeds and relies 
       messages normally. This is the default state for the bearerbox.
     </para></listitem>
     <listitem><para>
 Suspended. The gateway does not accept any new messages from SMS
   centers nor from UDP ports. Neither does it accept new sms and wapbox
   connections nor sends any messages already in the system
   onward.

     </para></listitem>
     <listitem><para>
 Isolated. In this state, the gateway does not accept any messages
   from external message providers, which means SMS Centers and UDP
   ports. It still processes any messages in the system and can
   accept new messages from sendsms interface in smsbox.
     </para></listitem>

     <listitem><para>
   Full. Gateway does not accept any messages from SMS centers, because 
   <literal>maximum-queue-length</literal> is achieved.
     </para></listitem>

     <listitem><para>
   Shutdown. When the gateway is brought down, it does not accept any
   new messages from SMS centers and UDP ports, but processes all
   systems already in the system. As soon as any queues are emptied,
   the system exits

   </para></listitem>
    </orderedlist>
 
  <para>
The state can be changed via HTTP administration interface (see below),
and shutdown can also be initiated via TERM or INT signal from
terminal. In addition, the bearerbox can be started already in
suspended or isolated state with -S or -I command line option, see
above.
</para>

</sect2>

<sect2>
<title>HTTP administration</title>

<para>Kannel can be controlled via an HTTP administration interface. All
commands are done as normal HTTP queries, so they can be easily done
from command line like this:

	<screen><userinput>
	lynx -dump "http://localhost:12345/shutdown?password=bar"
	</userinput></screen>

...in which the '12345' is the configured admin-port in Kannel
configuration file (see above). For most commands, admin-password is required as a
argument as shown above. In addition, HTTP administration can
be denied from certain IP addresses, as explained in configuration
chapter.</para>

<para>Note that you can use these commands with WAP terminal, too, but
if you use it through the same Kannel, replies to various suspend
commands never arrive nor can you restart it via WAP anymore.</para>

 <table frame="none">
  <title>Kannel HTTP Administration Commands</title>
  <tgroup cols="2">
  <tbody>
   <row><entry><literal>status or status.txt</literal></entry>
   <entry valign="bottom">
        Get the current status of the gateway in a text version. Tells the current 
	state (see above) and total number of messages relied and queuing 
	in the system right now. Also lists the total number of smsbox
        and wapbox connections. No password required, unless
        <literal>status-password</literal> set, in which case either
        that or main admin password must be supplied.
   </entry></row>
   <row><entry><literal>status.html</literal></entry>
   <entry valign="bottom">
        HTML version of status
   </entry></row>
   <row><entry><literal>status.xml</literal></entry>
   <entry valign="bottom">
        XML version of status
   </entry></row>
   <row><entry><literal>status.wml</literal></entry>
   <entry valign="bottom">
        WML version of status
   </entry></row>

   <row><entry><literal>store-status or store-status.txt</literal></entry>
   <entry valign="bottom">
        Get the current content of the store queue of the gateway 
		  in a text version. No password required, unless
        <literal>status-password</literal> set, in which case either
        that or main admin password must be supplied.
   </entry></row>
   <row><entry><literal>store-status.html</literal></entry>
   <entry valign="bottom">
        HTML version of store-status
   </entry></row>
   <row><entry><literal>store-status.xml</literal></entry>
   <entry valign="bottom">
        XML version of store-status
   </entry></row>

   <row><entry><literal>suspend</literal></entry>
   <entry valign="bottom">
        Set Kannel state as 'suspended' (see above). Password
        required.
   </entry></row>

   <row><entry><literal>isolate</literal></entry>
   <entry valign="bottom">
        Set Kannel state as 'isolated' (see above). Password required.
   </entry></row>

   <row><entry><literal>resume</literal></entry>
   <entry valign="bottom">
        Set Kannel state as 'running' if it is suspended or isolated.
        Password required.
   </entry></row>

   <row><entry><literal>shutdown</literal></entry>
   <entry valign="bottom">
        Bring down the gateway, by setting state to 'shutdown'. After
        a shutdown is initiated, there is no other chance to resume
        normal operation. However, 'status' command still works.
        Password required. If shutdown is sent for a second time, the
        gateway is forced down, even if it has still messages in
        queue.
   </entry></row>

	<row><entry><literal>flush-dlr</literal></entry>
   <entry valign="bottom">
        If Kannel state is 'suspended' this will flush all queued DLR
		  messages in the current storage space. Password required.
   </entry></row>

	<row><entry><literal>start-smsc</literal></entry>
   <entry valign="bottom">
        Re-start a single SMSC link. Password required. Additionally
		  the <literal>smsc</literal> parameter must be given to identify
 		  which <literal>smsc-admin-id</literal> should be re-started.
        The configuration for the SMSC link is re-read from disk before
        the action is performed.
   </entry></row>

  	<row><entry><literal>stop-smsc</literal></entry>
   <entry valign="bottom">
        Shutdown a single SMSC link. Password required. Additionally
		  the <literal>smsc</literal> parameter must be given (see above).
   </entry></row>

    <row><entry><literal>add-smsc</literal></entry>
    <entry valign="bottom">
        Adds an SMSC link previously removed or created after the service was
        started. Password required. Additionally the <literal>smsc</literal>
        parameter must be given (see above).
    </entry></row>

    <row><entry><literal>remove-smsc</literal></entry>
    <entry valign="bottom">
        Removes an existing SMSC link. Password required. Additionally the
        <literal>smsc</literal> parameter must be given (see above). If you
        want a permanent removal, you should also remove the entry from the
        configuration file or it will be recreated after a service restart.
    </entry></row>

	<row><entry><literal>restart</literal></entry>
   <entry valign="bottom">
        This is the hard restarting version, where we fully stop the
        bearerbox and then initiate from ground up.
        Beware that you loose the smsbox connections in such a case.
   </entry></row>

    <row><entry><literal>graceful-restart</literal></entry>
    <entry valign="bottom">
        Re-start bearerbox gracefully, hence only the changes in the
        configuration for the SMSC connections are performed. I.e.
        an added SMSC group will be start, and a removed SMSC group
        will be shutdown and destroyed. Any unchanged SMSC connection
        keeps on running without interruption. Password required.
        This is the soft restarting version, where we keep all internal
        parts of the bearebox running, including the smsbox connections.
        The same graceful restart can be initiated by sending a SIGHUP
        signal to the bearerbox daemon process.
    </entry></row>

	<row><entry><literal>log-level</literal></entry>
   <entry valign="bottom">
        Set Kannel log-level of log-files while running. This allows
		you to change the current log-level of the log-files on the fly.
		This includes the main event log and the SMSC specific logs, if
		any exist.
   </entry></row>

	<row><entry><literal>reload-lists</literal></entry>
   <entry valign="bottom">
        Re-loads the 'white-list' and 'black-list' URLs provided in the
        core group. This allows Kannel to keep running while the remote
        lists change and signal bearerbox to re-load them on the fly.
   </entry></row>

    <row><entry><literal>remove-message</literal></entry>
   <entry valign="bottom">
        Removes the message with the give <literal>id</literal> (an UUID)
        from the local storage subsystem.
   </entry></row>

  </tbody>
  </tgroup>
 </table>

</sect2>
  
</sect1>
</chapter>



<chapter id="wap-gateway">
<title>Setting up a WAP gateway</title>

    <para>This chapter tells you how to set Kannel up as a WAP
    gateway.</para>

<sect1>
<title>WAP gateway configuration</title>

  <para>To set up a WAP Kannel, you have to edit the 'core' group in the
  configuration file, and define the 'wapbox' group.</para>

  <para>You must set following variables for the 'core' group:  
    <literal>wapbox-port</literal> and
    <literal>wdp-interface-name</literal>. See previous chapter about
    details of these variables.</para>

  <para>With standard distribution, a sample configuration file
  <literal>wapkannel.conf</literal> is supplied. You may want to take
  a look at that when setting up a WAP Kannel.</para>

<sect2>
<title>Wapbox group</title>

  <para>If you have set <literal>wapbox-port</literal> variable in the
  'core' configuration group, you <emphasis>MUST</emphasis> supply
  a 'wapbox' group.</para>

  <para>The simplest working 'wapbox' group looks like this:
<programlisting>
group = wapbox
bearerbox-host = localhost
</programlisting>

   There is, however, multiple optional variables for the 'wapbox'
   group.</para>

 <table frame="none">
  <title>Wapbox Group Variables</title>
  <tgroup cols="3">
  <thead>
   <row>
     <entry>Variable</entry>
     <entry>Value</entry>
     <entry>Description</entry>
   </row>
  </thead>
  <tbody>
   <row><entry><literal>group (m)</literal></entry>
     <entry><literal>wapbox</literal></entry>
     <entry valign="bottom">
       This is mandatory variable
     </entry></row>

   <row><entry><literal>bearerbox-host (m)</literal></entry>
     <entry><literal>hostname</literal></entry>
     <entry valign="bottom">
        The machine in which the bearerbox is. 
     </entry></row>

    <row><entry><literal>timer-freq</literal></entry>
     <entry>value-in-seconds</entry>
     <entry valign="bottom">
         The frequency of how often timers are checked out. Default is 1 
     </entry></row>

    <row><entry><literal>http-interface-name</literal></entry>
     <entry>IP address</entry>
     <entry valign="bottom">
         If this is set then Kannel do outgoing HTTP requests
         using this interface.
     </entry></row>

    <row><entry><literal>map-url</literal></entry>
     <entry>URL-pair</entry>
     <entry valign="bottom">
        The pair is separated with space.
        Adds a single mapping for the left side URL to the given destination.
        If you append an asterisk `*' to the left side URL, its prefix
        Is matched against the incoming URL. Whenever the prefix matches,
        the URL will be replaced completely by the right side. In addition, if 	  if you append an asterisk to the right side URL, the part
        of the incoming URL coming after the prefix, will be appended
        to the right side URL. Thus, for a line:
                map-url = "http://source/* http://destination/*"
        and an incoming URL of "http://source/some/path", the result
        will be "http://destination/some/path"
     </entry></row>

    <row><entry><literal>map-url-max</literal></entry>
     <entry>number</entry>
     <entry valign="bottom">
        If you need more than one mapping, set this to the highest number
        mapping you need. The default gives you 10 mappings, numbered
        from 0 to 9. Default: 9
     </entry></row>

    <row><entry><literal>map-url-0</literal></entry>
     <entry>URL-pair</entry>
     <entry valign="bottom">
        Adds a mapping for the left side URL to the given destination URL.
        Repeat these lines, with 0 replaced by a number up to map-url-max,
        if you need several mappings.
     </entry></row>

    <row><entry><literal>device-home</literal></entry>
     <entry>URL</entry>
     <entry valign="bottom">
        Adds a mapping for the URL DEVICE:home (as sent by Phone.com browsers)
        to the given destination URL. There is no default mapping.
        NOTE: the mapping is added with both asterisks, as described above
        for the "map-url" setting. Thus, the above example line is
        equivalent to writing
                map-url = "DEVICE:home* http://some.where/*"

     </entry></row>

    <row><entry><literal>log-file</literal></entry>
     <entry>filename</entry>
     <entry morerows="1" valign="bottom">
       As with bearerbox 'core' group. 
     </entry></row>

    <row><entry><literal>log-level</literal></entry>
     <entry>number 0..5</entry></row>

    <row><entry><literal>access-log</literal></entry>
     <entry>filename</entry>
     <entry valign="bottom">
        A file containing all requested URLs from clients while wapbox operation,
        including client IP, HTTP server User-Agent string, HTTP response code, 
        size of reply.
     </entry></row>

    <row><entry><literal>access-log-clean</literal></entry>
     <entry>boolean</entry>
     <entry valign="bottom">
        Indicates if <literal>access-log</literal> will contain standard 'markers', 
		  which means the 'Log begins', 'Log ends' markers and the prefixed
		  timestamp. This config directive should be set to 'true' if a custom 
		  logging format is desired without a prefixed default timestamp. 
     </entry></row>

    <row><entry><literal>access-log-time</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
          Determine which timezone we use for access logging. Use 'gmt' for GMT time, 
          anything else will use local time. Default is local time.
     </entry></row>

    <row><entry><literal>syslog-level</literal></entry>
     <entry>number</entry>
     <entry valign="bottom">
	 Messages of this log level or higher will also be
	 sent to syslog, the UNIX system log daemon. If not explicitly
         set with <literal>syslog-facility</literal>, it logs under the
         'daemon' category. The default is not to use syslog, and you can
         set that explicitly by setting <literal>syslog-level</literal>
	 to 'none'.
     </entry></row>

    <row><entry><literal>syslog-facility</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
         The syslog facility to send the syslog entries to. The
         default is 'daemon'.
     </entry></row>

    <row><entry><literal>smart-errors</literal></entry>
     <entry>bool</entry>
     <entry valign="bottom">
	 If set wapbox will return a valid WML deck describing the 
	 error that occurred while processing an WSP request. This may
	 be used to have a smarter gateway and let the user know what
	 happened actually.
	 </entry></row>
	 
	 <row><entry><literal>wml-strict</literal></entry>
     <entry>bool</entry>
     <entry valign="bottom">
	 If set wapbox will use a strict policy in XML parsing the WML
	 deck. If not set it will be more relaxing and let the XML parser
	 recover from parsing errors. This has mainly impacts in how smart
	 the WML deck and it's character set encoding can be adopted, even
	 while you used an encoding that does not fit the XML preamble.
	 BEWARE: This may be a vulnerability in your wapbox for large bogus 
	 WML input. Therefore this defaults to 'yes', strict parsing.
	 is assumed.
	 </entry></row>

    <row><entry><literal>http-timeout</literal></entry>
     <entry>seconds</entry>
     <entry valign="bottom">
        Sets socket timeout in seconds for outgoing client http
        connections. Optional. Defaults to 240 seconds.
     </entry></row>
  </tbody>
  </tgroup>
 </table>

<programlisting>
</programlisting>
</sect2>
  
</sect1>

<sect1>
<title>Running WAP gateway</title>

 <para>WAP Gateway is ran as explained in previous chapter.</para>

</sect1>


<sect1>
<title>Checking whether the WAP gateway is alive</title>

    <para>You can check whether the WAP gateway (both the
    bearerbox and the wapbox) is alive by fetching the URL
    <literal>kannel:alive</literal>.</para>

</sect1>

</chapter>


<chapter id="wtls">
<title>Setting up wtls security</title>

	<para>This chapter tells you how to set Kannel up to handle wtls traffic.
	</para>

	<para><literal>wtls</literal> group is optional and single. The prerequisites for this group
		are to have defined a wapbox group, and a pair of SSL certificates
		available. Instructions on how to create self-signed 1024-bit RSA
		certificates are in <xref linkend="certificates"/>.
	</para>
	<para>Current imlementation provides for the following functionality:</para>
	<para>
		<orderedlist numeration="upperalpha">
			<listitem><para>Supported MACs:</para>
				<itemizedlist>
						<listitem><para>SHA_0</para></listitem>
						<listitem><para>SHA_40</para></listitem>
						<listitem><para>SHA_80</para></listitem>
						<listitem><para>SHA_NOLIMIT</para></listitem>
						<listitem><para>MD5_40</para></listitem>
						<listitem><para>MD5_80</para></listitem>
						<listitem><para>MD5_NOLIMIT</para></listitem>
				</itemizedlist>
				<para>Missing:</para>
				<itemizedlist>
						<listitem><para>SHA_XOR_40</para></listitem>
				</itemizedlist>
			</listitem>
			<listitem><para>Supported Ciphers:</para>
				<itemizedlist>
						<listitem><para>RC5_CBC_40</para></listitem>
						<listitem><para>RC5_CBC_56</para></listitem>
						<listitem><para>RC5_CBC</para></listitem>
						<listitem><para>DES_CBC</para></listitem>
						<listitem><para>DES_CBC_40</para></listitem>
				</itemizedlist>
				<para>Missing:</para>
				<itemizedlist>
						<listitem><para>NULL_bulk</para></listitem>
						<listitem><para>TRIPLE_DES_CBC_EDE</para></listitem>
						<listitem><para>IDEA_CBC_40</para></listitem>
						<listitem><para>IDEA_CBC_56</para></listitem>
						<listitem><para>IDEA_CBC</para></listitem>
				</itemizedlist>
			</listitem>
			<listitem><para>Supported Keys:</para>
				<itemizedlist>
						<listitem><para>RSA_anon</para></listitem>
				</itemizedlist>
				<para>Missing:</para>
				<itemizedlist>
						<listitem><para>RSA_anon_512</para></listitem>
						<listitem><para>RSA_anon_768</para></listitem>
						<listitem><para>RSA_NOLIMIT</para></listitem>
						<listitem><para>RSA_512</para></listitem>
						<listitem><para>RSA_768</para></listitem>
						<listitem><para>ECDH_anon</para></listitem>
						<listitem><para>ECDH_anon_113</para></listitem>
						<listitem><para>ECDH_anon_131</para></listitem>
						<listitem><para>ECDH_ECDSA_NOLIMIT</para></listitem>
				</itemizedlist>
				<para>Keys might seem a shortcoming, but all mobiles support
					RSA_anon. Some of the other RSA_anon keys (i.e. RSA_anon_512,
					RSA_anon_768) are propably supported as well, just haven't been
					tested yet.</para>
			</listitem>
			<listitem><para>All wtls states except:</para>
				<itemizedlist>
						<listitem><para>Suspend/Resume wtls session</para></listitem>
						<listitem><para>Cipher change when already connected. In practice
							this is handled through another client hello, while
							already connected to the same client</para></listitem>
				</itemizedlist>
			</listitem>
	</orderedlist></para>

	<para>The simplest working <literal>wtls</literal> group looks like this:
<programlisting>
group = wtls
certificate-file = /etc/kannel/server.crt
privatekey-file = /etc/kannel/server.key
</programlisting>

	Can also be the same single combined pem file with both certificate and
	privatekey parts. The complete variable list for the <literal>wtls</literal> group is:</para>

<sect1>
<title>Wtls configuration</title>
 <table frame="none">
  <title>Wtls Group Variables</title>
  <tgroup cols="3">
  <thead>
   <row>
     <entry>Variable</entry>
     <entry>Value</entry>
     <entry>Description</entry>
   </row>
  </thead>
  <tbody>
   <row><entry><literal>group (m)</literal></entry>
     <entry><literal>wtls</literal></entry>
     <entry valign="bottom">
       This is mandatory variable
     </entry></row>

   <row><entry><literal>certificate-file (m)</literal></entry>
     <entry><literal>filename</literal></entry>
     <entry valign="bottom">
       Public key SSL certificate.
     </entry></row>

   <row><entry><literal>privatekey-file (m)</literal></entry>
     <entry><literal>filename</literal></entry>
     <entry valign="bottom">
       Private key SSL certificate.
     </entry></row>

   <row><entry><literal>privatekey-password (o)</literal></entry>
     <entry><literal>Phrase</literal></entry>
     <entry valign="bottom">
       Optional. Needed only if private key was created with a passphrase.
     </entry></row>
   </tbody>
  </tgroup>
 </table>
</sect1>
</chapter>

<chapter id="msisdn-provisioning">
<title>Setting up MSISDN provisioning for WAP gateway</title>

    <para>This chapter tells you how to set Kannel up to deliver the MSISDN
	 number of the WAP device using the WAP gateway.</para>

	 <para>Mostly this feature is interested because the WAP protocol stack
	 itself does not provide such a protocol layer bridging of information.
	 In case you want to know which unique MSISDN is used by the WAP device
	 your HTTP application is currently interacting, then you can pick this
	 information from a RADIUS server that is used by a NAS (network access
	 server) for authentication and accounting purposes.
	 </para>

	 <para>Kannel provides a RADIUS accounting proxy thread inside wapbox
	 which holds a mapping table for the dynamically assigned (DHCP) IP 
	 addresses of the WAP clients and their MSISDN numbers provided to the
	 NAS device.
	 </para>

	 <para>Beware that you <emphasis>HAVE TO</emphasis> to be in control of 
	 the NAS to configure it to use Kannel's wapbox as RADIUS accounting 
	 server. You can not use
	 MSISDN provisioning via Kannel's RADIUS accounting proxy if you can
	 not forward the accounting packets to Kannel's accounting proxy thread.
	 So obviously this feature is for operators and people who have dedicated
	 dial-in servers (NAS).
	 </para>

<sect1>
<title>RADIUS accounting proxy configuration</title>

  <para>To set up the RADIUS accounting proxy thread inside Kannel you 
  have to define a 'radius-acct' group.</para>

<sect2>
<title>RADIUS-Acct configuration</title>

  <para>The simplest working 'radius-acct' group looks like this:
<programlisting>
group = radius-acct
our-port = 1646
secret-nas = radius
</programlisting>

   This example does not forward any accounting packets to a remote 
	RADIUS server. There is, however, multiple optional variables for 
	the 'radius-acct' group.</para>

 <table frame="none">
  <title>RADIUS-Acct Group Variables</title>
  <tgroup cols="3">
  <thead>
   <row>
     <entry>Variable</entry>
     <entry>Value</entry>
     <entry>Description</entry>
   </row>
  </thead>
  <tbody>
   <row><entry><literal>group (m)</literal></entry>
     <entry><literal>radius-acct</literal></entry>
     <entry valign="bottom">
       This is mandatory variable if you want to have Kannel's 
		 RADIUS accounting proxy thread to be active inside wapbox.
     </entry></row>

   <row><entry><literal>secret-nas (m)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
	    Specifies the shared secret between NAS and our RADIUS accounting proxy.
     </entry></row>

   <row><entry><literal>secret-radius</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
	    Specifies the shared secret between our RADIUS accounting proxy and the
		 remote RADIUS server itself in case we are forwarding packets.
     </entry></row>

   <row><entry><literal>our-host</literal></entry>
     <entry><literal>IP address</literal></entry>
     <entry valign="bottom">
	    Specifies the local interface where our-port value will bind
		 to. (defaults to 0.0.0.0)
     </entry></row>

   <row><entry><literal>remote-host</literal></entry>
     <entry><literal>FQDN or IP address</literal></entry>
     <entry valign="bottom">
	    Specifies the remote RADIUS server to which we forward the 
		 accounting packets. If none is given, then no forwarding of
		 accounting packets is performed.
     </entry></row>

   <row><entry><literal>our-port</literal></entry>
     <entry><literal>number</literal></entry>
     <entry valign="bottom">
	    Specifies the port to which our RADIUS accounting proxy thread
		 will listen to. (defaults according to RFC2866 to 1813)
     </entry></row>

   <row><entry><literal>remote-port</literal></entry>
     <entry><literal>number</literal></entry>
     <entry valign="bottom">
	    Specifies the port to which our RADIUS accounting proxy thread
		 will forward any packets to the remote-host. 
		 (defaults according to RFC2866 to 1813)
     </entry></row>
     
   <row><entry><literal>remote-timeout</literal></entry>
     <entry><literal>number</literal></entry>
     <entry valign="bottom">
	    Specifies the timeout value in milliseconds for waiting on a 
	    response from the remote RADIUS server.
		 (defaults to 40 msecs.)
     </entry></row>

   <row><entry><literal>nas-ports</literal></entry>
     <entry><literal>number</literal></entry>
     <entry valign="bottom">
	    Specifies how many possible clients can connect simultaneously 
		 to the NAS. This value is used to initialize the mapping hash table.
		 If does not require to be exact, because the table grows automatically
		 if required. (defaults to 30)
     </entry></row>

    <row><entry><literal>unified-prefix</literal></entry>
     <entry>prefix-list</entry>
     <entry valign="bottom">
        String to unify provided phone numbers from NAS.
		  Format is that first comes the
        unified prefix, then all prefixes which are replaced by the
        unified prefix, separated with comma (','). For example,
        for Finland an unified-prefix "+358,00358,0;+,00" should do the trick. 
        If there are several unified prefixes, separate their rules with
        semicolon (';'), like "+35850,050;+35840,040".
	  </entry></row>

  </tbody>
  </tgroup>
 </table>
<programlisting>
</programlisting>

</sect2>
<sect2>
<title>Using the MSISDN provisioning on HTTP server side</title>

  <para>Kannel's wapbox will include a specific HTTP header in the HTTP
  request issued to the URL provided by the WAP client. That HTTP header 
  is <literal>X-WAP-Network-Client-MSISDN</literal>. It will carry as value
  the MSISDN of the WAP client if the RADIUS accounting proxy has received
  a valid accounting packet from the NAS that provided the client IP.
  </para>

</sect2>
</sect1>
</chapter>



<chapter id="sms-gateway">
<title>Setting up a SMS Gateway</title>

    <para>This chapter is a more detailed guide on how to set up Kannel as an
    SMS gateway.</para>

<sect1>
<title>Required components</title>

    <para>To set up an SMS gateway, you need, in addition to a machine
    running Kannel, access to (an operator's) SMS center, or possibly
    to multiple ones. The list of supported SMS centers and their
    configuration variables is below.</para>

    <para>If you do not have such access, you can still
    use Kannel as an SMS gateway via <emphasis>phone-as-SMSC</emphasis> 
    feature, by using a GSM phone as a virtual SMS center.</para>

    <para>In addition to an SMS center (real or virtual), you need some
    server to handle any SMS requests received. This server then has
    simple or more complex cgi-bins, programs or scripts to serve HTTP
    requests generated by Kannel in response to received SMS
    messages. These services can also initiate SMS push via Kannel
    smsbox HTTP sendsms interface.</para>

</sect1>

<sect1>
<title>SMS gateway configuration</title>

  <para>To set up a SMS Kannel, you have to edit the 'core' group in the
  configuration file, and define an 'smsbox' group plus one or more
  'sms-service' groups, plus possibly one or more 'sendsms-user' groups.</para>

  <para>For the 'core' group, you must set the following variable:  
    <literal>smsbox-port</literal>. In addition, you may be interested
    to set <literal>unified-prefix</literal>,
    <literal>white-list</literal> and/or <literal>black-list</literal>
    variables. See above for details of these variables.</para>

  <para> A sample configuration file <literal>smskannel.conf</literal> 
  is supplied with the standard distribution. You may want to take
  a look at that when setting up an SMS Kannel.</para>
</sect1>

<sect1>
<title>SMS centers</title>

    <para>To set up the SMS center at Kannel, you have to add a 'smsc'
    group into configuration file. 
    This group must include all the data needed to connect
    that SMS center. You may also want to define an ID
    (identification) name for the SMSC, for logging and routing
    purposes.</para>

    <para>SMSC ID is an abstract name for the connection. It can be
    anything you like, but you should avoid any special
    characters. You do not need to use ID, but rely on SMS center IP
    address and other information. However, if you use the ID, you do
    not need to re-define sms-services nor routing systems if the IP
    of the SMS Center is changed, for example.</para>

    <para>Common 'smsc' group variables are defined in the following
    table. The first two (<literal>group</literal> and
    <literal>smsc</literal>) are mandatory, but rest can be used if
    needed.</para>

 <table frame="none">
  <title>SMSC Group Variables</title>
  <tgroup cols="3">
  <thead>
   <row>
     <entry>Variable</entry>
     <entry>Value</entry>
     <entry>Description</entry>
   </row>
  </thead>
  <tbody>
   <row><entry><literal>group (m)</literal></entry>
     <entry><literal>smsc</literal></entry>
     <entry valign="bottom">
       This is a mandatory variable
     </entry></row>

   <row><entry><literal>smsc (m)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Identifies the SMS center type. See below
       for a complete list.
     </entry></row>


   <row><entry><literal>smsc-id</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
        An optional name or id for the smsc. Any string is
        acceptable, but semicolon ';' may cause problems, so avoid
        it and any other special non-alphabet characters. 
        This 'id' is written into log files and can be used to
        route SMS messages, and to specify the used SMS-service. 
        Several SMSCs can have the same id. The name is
        case-insensitive. Note that if SMS Center connection has an
	assigned SMSC ID, it does NOT automatically mean that messages
	with identical SMSC ID are routed to it; instead configuration
	variables <literal>denied-smsc-id</literal>, 
	<literal>allowed-smsc-id</literal> and
	<literal>preferred-smsc-id</literal> is used for that.
	If you want to use Delivery Reports, you must define this.

     </entry></row>

   <row><entry><literal>smsc-admin-id</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
        An optional id for the smsc to be used on administrative
        commands. This allows commands targeted to individual binds
        even if they share the same <literal>smsc-id</literal>
        (for load balancing scenarios, for example). Any string is
        acceptable, but semicolon ';' may cause problems, so avoid
        it and any other special non-alphabet characters.
        Several SMSCs can have the same admin-id, though it's not
        recommended. The name is case-insensitive.
     </entry></row>

    <row><entry><literal>throughput</literal></entry>
      <entry><literal>float (messages/sec)</literal></entry>
      <entry valign="bottom">
        If SMSC requires that Kannel limits the number of messages per second, 
        use this variable. This is considered as active throttling. (optional)
     </entry></row>

   <row><entry><literal>denied-smsc-id</literal></entry>
     <entry><literal>id-list</literal></entry>
     <entry valign="bottom">
        SMS messages with SMSC ID equal to any of the IDs in this list
        are never routed to this SMSC. Multiple entries are separated 
        with semicolons (';')
     </entry></row>

   <row><entry><literal>allowed-smsc-id</literal></entry>
     <entry><literal>id-list</literal></entry>
     <entry valign="bottom">
        This list is opposite to previous: only SMS messages with SMSC
        ID in this list are ever routed to this SMSC.
        Multiple entries are separated with semicolons (';')
     </entry></row>

   <row><entry><literal>preferred-smsc-id</literal></entry>
     <entry><literal>id-list</literal></entry>
     <entry valign="bottom">
        SMS messages with SMSC ID from this list are sent to this SMSC
        instead than to SMSC without that ID as preferred. Multiple
        entries are separated with semicolons (';')
     </entry></row>

   <row><entry><literal>allowed-prefix</literal></entry>
     <entry><literal>prefix-list</literal></entry>
     <entry valign="bottom">
        A list of phone number prefixes which are accepted to be
        sent through this SMSC. Multiple entries are separated with 
        semicolon (';'). For example, "040;050" prevents sending of
        any SMS message with prefix of 040 or 050 through this SMSC.
	If denied-prefix is unset, only these numbers are allowed. If
	set, number are allowed if present in allowed or not in 
	denied list.
     </entry></row>

   <row><entry><literal>denied-prefix</literal></entry>
     <entry><literal>prefix-list</literal></entry>
     <entry valign="bottom">
        A list of phone number prefixes which are NOT accepted to be
        sent through this SMSC.
     </entry></row>

   <row><entry><literal>preferred-prefix</literal></entry>
     <entry><literal>prefix-list</literal></entry>
     <entry valign="bottom">
        As <literal>denied-prefix</literal>, but SMS messages with receiver starting
        with any of these prefixes are preferably sent through this
        SMSC. In a case of multiple preferences, one is selected at random
        (also if there are preferences, SMSC is selected randomly)

     </entry></row>

   <row><entry><literal>unified-prefix</literal></entry>
     <entry>prefix-list</entry>
     <entry valign="bottom">
        String to unify received phone numbers, for SMSC routing and
        to ensure that SMS centers can handle them properly. 
        This is applied to 'sender' number when receiving SMS
        messages from SMS Center and for 'receiver' number when
        receiving messages from smsbox (either sendsms message or
        reply to original message). Format is that first comes the
        unified prefix, then all prefixes which are replaced by the
        unified prefix, separated with comma (','). For example,
        for Finland an unified-prefix "+358,00358,0;+,00" should do the trick. 
        If there are several unified prefixes, separate their rules with
        semicolon (';'), like "+35850,050;+35840,040". <emphasis>Note
        that prefix routing is next to useless now that there are
        SMSC ID entries. To remove prefixes, use like 
	     "-,+35850,050;-,+35840,040".
	</emphasis>
     </entry></row>

   <row><entry><literal>alt-charset</literal></entry>
     <entry><literal>number</literal></entry>
     <entry valign="bottom">
        As some SMS Centers do not follow the standards in character
        coding, an <literal>alt-charset</literal> character conversion is
        presented. This directive acts different for specific SMSC types.
		Please see your SMSC module type you want to use for more details.
     </entry></row>

   <row><entry><literal>alt-dcs</literal></entry>
     <entry><literal>boolean</literal></entry>
     <entry valign="bottom">
	   Optional data coding scheme value usage. Sets the 'alt-dcs' value 
	   for the sendsms HTTP interface to a fixed value for each SMS sent 
	   via this SMSC connection. 
	   If equals to yes, uses FX. If equals to no (default), uses 0X.
     </entry></row>

   <row><entry><literal>our-host</literal></entry>
     <entry><literal>hostname</literal></entry>
     <entry valign="bottom">
       Optional hostname or IP address in which to bind the connection in our
       end. TCP/IP connection only.
     </entry></row>

    <row><entry><literal>log-file</literal></entry>
     <entry>filename</entry>
     <entry valign="bottom">
        A file in which to write a log of the given smsc output. Hence
        this allows to log smsc specific entries to a separate file.
     </entry></row>

    <row><entry><literal>log-level</literal></entry>
     <entry>number 0..5</entry>
     <entry valign="bottom">
        Minimum level of log-file events logged. 0 is for 'debug', 1
        'info', 2 'warning, 3 'error' and 4 'panic' (see Command Line
        Options)
     </entry></row>

    <row><entry><literal>reconnect-delay</literal></entry>
      <entry><literal>number</literal></entry>
      <entry valign="bottom">
			Number of seconds to wait between single re-connection attempts.
			Hence all SMSC modules should use this value for their 
			re-connect behavior. (Defaults to '10' seconds).
     </entry></row>

    <row><entry><literal>reroute</literal></entry>
      <entry><literal>boolean</literal></entry>
      <entry valign="bottom">
			If set for a smsc group, all inbound messages coming from this smsc
			connection are passed internally	to the outbound routing functions. 
			Hence this messages is not delivered to any connected box for 
			processing. It is passed to the bearerbox routing as if it would
 		   have originated from an externally connected smsbox.
			(Defaults to 'no').
     </entry></row>

    <row><entry><literal>reroute-smsc-id</literal></entry>
      <entry><literal>string</literal></entry>
      <entry valign="bottom">
			Similar to 'reroute'. Defines the explicit smsc-id 
			the MO message should be passed to for MT traffic. Hence all 
			messages coming from the the configuration group smsc are passed
			to the outbound queue of the specified smsc-id. This allows 
			direct proxying of messages between 2 smsc connections without 
			injecting them to the general	routing procedure in bearerbox.
     </entry></row>

    <row><entry><literal>reroute-receiver</literal></entry>
      <entry><literal>string</literal></entry>
      <entry valign="bottom">
			Similar to 'reroute'. Defines the explicit smsc-id routes 
 		   for specific receiver numbers of messages that are coming from this
			smsc connection.
			Format is that first comes the smsc-id to route the message to, then 
			all receiver numbers that should be routed, separated with comma (','). 
			For example, route receivers 111 and 222 to smsc-id A and 333 and 444
			to smsc-id B would look like: "A,111,222; B,333,444".
     </entry></row>

    <row><entry><literal>reroute-dlr</literal></entry>
      <entry><literal>boolean</literal></entry>
      <entry valign="bottom">
                       Indicate whether DLR's should be re-routed too, if one of above reroute
                       rules are enabled. Please note, that SMSC-Module should support DLR sending.
                       At time of writing none of SMSC-Module supports DLR sending.
      </entry></row>

     <row><entry><literal>allowed-smsc-id-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
        SMS messages with SMSC ID equal to any of the IDs in this set of SMSC IDs
        are always routed to this SMSC. 
        See section on <xref linkend="regular-expressions"/> for details.
        </entry>   
     </row>

     <row><entry><literal>denied-smsc-id-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
        SMS messages with SMSC ID equal to any of the IDs in this set of SMSC IDs
        are never routed to this SMSC. 
        See section on <xref linkend="regular-expressions"/> for details.
        </entry>   
     </row>

     <row><entry><literal>preferred-smsc-id-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
        SMS messages with SMSC ID in this set of SMSC IDs are sent to this SMSC
        as preferred.
        See section on <xref linkend="regular-expressions"/> for details.
        </entry>   
     </row>

     <row><entry><literal>allowed-prefix-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
        A set of phone number prefixes which are accepted to be
        sent through this SMSC. 
        See section on <xref linkend="regular-expressions"/> for details.
        </entry>   
     </row>

     <row><entry><literal>denied-prefix-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
        A set of phone number prefixes which may not be
        sent through this SMSC. 
        See section on <xref linkend="regular-expressions"/> for details.
        </entry>   
     </row>

     <row><entry><literal>preferred-prefix-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
        As <literal>denied-prefix-regex</literal>, but SMS messages with receiver matching 
        any of these prefixes are preferably sent through this
        SMSC. In a case of multiple preferences, one is selected at random.
        See section on <xref linkend="regular-expressions"/> for details.
        </entry>   
     </row>

     <row><entry><literal>max-sms-octets</literal></entry>
        <entry>number</entry>
        <entry valign="bottom">
        Maximum allowed octets for this SMSC. If this maximum exceeds Kannel will split
        SMS into multiparts.
        Default: 140
        </entry>   
     </row>

     <row><entry><literal>dead-start</literal></entry>
        <entry><literal>boolean</literal></entry>
        <entry valign="bottom">
        Optional, defines if the SMSC connection type is started in disconnected mode (dead).
        This allows SMSC to be connected at a later time with the add-smsc HTTP administration command. 
        If set to 'true' the connection will start as 'dead' and will require a start-smsc command 
        to activate it. Defaults to 'false' if not present.</entry>
     </row>

     <row><entry><literal>instances</literal></entry>
        <entry>number</entry>
        <entry valign="bottom">
        The number of same instances of this group to be created. This allows to declare
        the config group one time in the configuration and to multiply it by this value
        for the numner of runtime instances. (default: 1)
        </entry>   
     </row>

  </tbody>
  </tgroup>
 </table>

   <para>In addition to these common variables there are several
   variables used by certain SMS center connections. Each currently
   supported SMS center type is explained below, with configuration
   group for each. Note that many of them use variables with same
   name, but most also have some specific variables.</para>

   <para><emphasis>NOTE: SMS center configuration variables are a bit 
   incomplete, and will be updated as soon as people responsible for
   the protocols are contacted. Meanwhile, please have
   patience.</emphasis></para>


<sect2>
<title>Nokia CIMD 1.37 and 2.0</title>

<para>Support for CIMD 1.37 is quite old and will be removed in a
future version of Kannel.  Please let us know if you still need it.</para>

<programlisting>
group = smsc
smsc = cimd
host = 100.101.102.103
port = 600
smsc-username = foo
smsc-password = bar
</programlisting>

<para>The driver for CIMD2 is a "receiving SME" and expects the SMSC
to be configured for that.  It also expects the SMSC to automatically
send stored messages as soon as Kannel logs in (this is the normal
configuration).</para>

<programlisting>
group = smsc
smsc = cimd2
host = 100.101.102.103
port = 600
smsc-username = foo
smsc-password = bar
keepalive = 5 
my-number = "12345"
</programlisting>

 <informaltable frame="none">
  <tgroup cols="3"><thead><row>
     <entry>Variable</entry>
     <entry>Value</entry>
     <entry>Description</entry>
   </row></thead><tbody>

   <row><entry><literal>host (m)</literal></entry>
     <entry><literal>hostname</literal></entry>
     <entry valign="bottom">
        Machine that runs the SMSC. As IP (100.100.100.100) 
        or hostname (their.machine.here)
     </entry></row>

   <row><entry><literal>port (m)</literal></entry>
     <entry><literal>port-number</literal></entry>
     <entry valign="bottom">
       Port number in the smsc host machine
     </entry></row>

   <row><entry><literal>smsc-username (m)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Username in the SMSC machine/connection account
     </entry></row>

   <row><entry><literal>smsc-password (m)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
        Password in the SMSC machine needed to contact SMSC
     </entry></row>

   <row><entry><literal>keepalive</literal></entry>
     <entry><literal>number</literal></entry>
     <entry valign="bottom">
       SMSC connection will not be left idle for longer than this many
       seconds.  The right value to use depends on how eager the SMSC
       is to close idle connections. If you see many unexplained 
       reconnects, try lowering this value.
       Set it to 0 to disable this feature.
     </entry></row>

   <row><entry><literal>no-dlr</literal></entry>
     <entry><literal>boolean</literal></entry>
     <entry valign="bottom">
       Optional. If defined, status delivery report requests (DLR) won't be
       requested at all. Some CIMD2 SMSC have prohibited these reports so
       if you are getting error like "Incorrect status report request parameter
       usage", this option is for you. Defaults to "false".
     </entry></row>

   <row><entry><literal>my-number</literal></entry>
      <entry><literal>string</literal></entry>
      <entry valign="bottom">
        The number that the SMSC will add in front of the sender number
        of all messages sent from Kannel.  If Kannel is asked to send
        a message, it will remove this prefix from the sender number
        so that the SMSC will add it again.  If the prefix was not present,
        Kannel will log a warning and will not send the sender number.
        If <literal>my-number</literal> is not set, or is set
        to <literal>"never"</literal>, then Kannel will not send the
        sender number to the SMSC at all.
        If you want Kannel to pass all sender numbers to the SMSC
        unchanged, then just set <literal>sender-prefix</literal> to the
        empty string <literal>""</literal>.
      </entry></row>

   <row><entry><literal>our-port</literal></entry>
     <entry><literal>port-number</literal></entry>
     <entry valign="bottom">
       Optional port number in which to bind the connection in our
       end.
     </entry></row>

   </tbody></tgroup></informaltable>
   
</sect2>

<sect2>
<title>CMG UCP/EMI 4.0 and 3.5</title>

  <warning><para>See <xref linkend="upgrading-notes"/> for changes.</para></warning>
  <para>Kannel supports two types of connections with CMG SMS centers:
  direct TCP/IP connections ( <literal>emi</literal>) and ISDN/modem 
  (X.25) connection (<literal>emi_x25</literal>).</para>
  <note><para><literal>emi_x25</literal> is an old implementation and supports less 
  features than it's IP counterpart. If you still need this module, please tell
  us to <literal>devel@kannel.org</literal> so we can fix it.</para></note> 
  <para>Sample configurations for these are:</para>
  
<programlisting>
group = smsc
smsc = emi
host = 103.102.101.100
port = 6000
smsc-username = foo
smsc-password = bar
keepalive = 55
our-port = 600 (optional bind in our end)
receive-port = 700 (the port in which the SMSC will contact)
idle-timeout = 30

group = smsc
smsc = emi_x25
phone = ...
device = /dev/tty0
smsc-username = foo
smsc-password = bar
</programlisting>

 <informaltable frame="none">
  <tgroup cols="3"><thead><row>
     <entry>Variable</entry>
     <entry>Value</entry>
     <entry>Description</entry>
   </row></thead><tbody>

   <row><entry><literal>host (c)</literal></entry>
     <entry><literal>hostname</literal></entry>
     <entry valign="bottom">
        Machine that runs SMSC. As IP (100.100.100.100) 
        or hostname (their.machine.here)
     </entry></row>

   <row><entry><literal>port (c)</literal></entry>
     <entry><literal>port-number</literal></entry>
     <entry valign="bottom">
       Port number in the SMSC host machine
     </entry></row>

   <row><entry><literal>alt-host</literal></entry>
     <entry><literal>hostname</literal></entry>
     <entry valign="bottom">
        Optional alternate Machine that runs SMSC. 
	As IP (100.100.100.100) or hostname (their.machine.here)
	(If undef but exists alt-port, emi2 would try host:alt-port)
     </entry></row>

   <row><entry><literal>alt-port</literal></entry>
     <entry><literal>port-number</literal></entry>
     <entry valign="bottom">
       Optional alternate Port number in the SMSC host machine
	(If undef but exists alt-host, emi2 would try alt-host:port)
     </entry></row>

   <row><entry><literal>smsc-username</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Username in the SMSC machine/connection account
     </entry></row>

   <row><entry><literal>smsc-password</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
        Password in the SMSC machine needed to contact SMSC
     </entry></row>

   <row><entry><literal>device (c)</literal></entry>
     <entry><literal>device-name</literal></entry>
     <entry valign="bottom">
          The device the modem is connected to, like <literal>/dev/ttyS0</literal>.
          ISDN connection only.
     </entry></row>

   <row><entry><literal>phone (c)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Phone number to dial to, when connecting over a modem to an
       SMS center.
     </entry></row>

   <row><entry><literal>our-port</literal></entry>
     <entry><literal>port-number</literal></entry>
     <entry valign="bottom">
       Optional port number in which to bind the connection in our
     end. TCP/IP connection only.
     </entry></row>

   <row><entry><literal>our-receiver-port</literal></entry>
     <entry><literal>port-number</literal></entry>
     <entry valign="bottom">
       Optional port number allowing to specify our port when connecting
       an SMSC. TCP/IP connection only.
     </entry></row>

   <row><entry><literal>receive-port</literal></entry>
     <entry><literal>port-number</literal></entry>
     <entry valign="bottom">
        Optional port number we listen to and to which the SMS center
        connects when it has messages to send. Required if SMS center
	needs one connection to send and other to receive.
	TCP/IP connection only.
     </entry></row>

   <row><entry><literal>appname</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
	    Name of a "Send only" service. Defaults to <literal>send</literal>.
		 All outgoing messages are routed through this service.
     </entry></row>

   <row><entry><literal>connect-allow-ip</literal></entry>
     <entry><literal>IP-list</literal></entry>
     <entry valign="bottom">
       If set, only connections from these IP addresses are accepted
       to receive-port. TCP/IP connection only.
     </entry></row>

    <row><entry><literal>idle-timeout</literal></entry>
      <entry><literal>number (seconds)</literal></entry>
      <entry valign="bottom">
      If this option is set to a value larger than 0, then the connection will
      be closed after the configured amount of seconds without activity. This 
      option interacts with the <literal>keepalive</literal> configuration option.
      If <literal>keepalive</literal> is smaller than <literal>idle-timeout</literal>,
      then the connection will never be idle and those this option has no effect.
      If <literal>keepalive</literal> is larger than <literal>idle-timeout</literal>,
      than <literal>keepalive</literal> reopens the connection. This allows one to poll
      for pending mobile originated Short Messages at the SMSC.
     </entry></row>

    <row><entry><literal>keepalive</literal></entry>
      <entry><literal>number (seconds)</literal></entry>
      <entry valign="bottom">
        A keepalive command will be
        sent to the SMSC connection this many seconds after the last
        message. The right value to use depends on how eager the SMSC is
        to close idle connections.  50 seconds is a good guess. If you
        see many unexplained reconnects, try lowering this value. Set it
        to 0 to disable this feature.
	Requires username or my-number to be set.
     </entry></row>

    <row><entry><literal>wait-ack</literal></entry>
      <entry><literal>number (seconds)</literal></entry>
      <entry valign="bottom">
        A message is resent if the acknowledge from SMSC takes more than 
	this time.  Defaults to 60 seconds.
     </entry></row>

    <row><entry><literal>wait-ack-expire</literal></entry>
      <entry><literal>number</literal></entry>
      <entry valign="bottom">
        Defines what kind of action should be taken if the the ack of 
		  a message expires. The options for this value are:
		  0x00 - disconnect/reconnect, (default) 0x01 - as is now, re-queue, 
		  but this could potentially result in the msg arriving twice
		  0x02 - just carry on waiting (given that the wait-ack should never 
		  expire this is the must accurate)
     </entry></row>

    <row><entry><literal>flow-control</literal></entry>
      <entry><literal>number</literal></entry>
      <entry valign="bottom">
	This SMSC can support two types of flow control. The first type 
	of flow control is a <literal>stop-and-wait</literal> protocol, 
	when this parameter equals to '1'. During the handling of commands, 
	no other commands shall be sent before the a response is received. 
	Any command that is sent before the reception of the response will 
	be discarded.
	The second type of flow control is <literal>windowing</literal>,
	when this parameter is unset or equals '0'. In this case a maximum 
	of n commands can be sent before a response is received. 
     </entry></row>

    <row><entry><literal>window</literal></entry>
      <entry><literal>number (messages)</literal></entry>
      <entry valign="bottom">
        When using <literal>flow-control=0</literal>, emi works in windowed
        flow control mode. This variable defines the size of the window used
        to send messages. (optional, defaults to the maximum - 100)
     </entry></row>

    <row><entry><literal>my-number</literal></entry>
      <entry><literal>number</literal></entry>
      <entry valign="bottom">
        If the large account number is different from the short number, assign
	it with this variable. For example, if short number is 12345 and large account
	is 0100100100101234 (IP+port), set my-number to 12345 and 
	every message received will have that receiver. In addition, if you are bound
	to the SMSC without an explicit login, use this configuration directive to 
	enable keep-alive (OP/31) operations. 
     </entry></row>

   <row><entry><literal>alt-charset</literal></entry>
     <entry><literal>number</literal></entry>
     <entry valign="bottom">
        Defines which character conversion kludge may be used for this 
		  specific link. Currently implemented alternative charsets are 
		  defined in "alt_charsets.h" and new ones can be added.
     </entry></row>

   <row><entry><literal>notification-pid</literal></entry>
     <entry><literal>4 num char.</literal></entry>
     <entry valign="bottom">
        Notification PID value. See below for a complete list and other notes.
	Example: 0539
       <footnote id="notification-pid-note"><para>If you set 
       <literal>notification-pid</literal>, you should also set 
       <literal>notification-addr</literal>.</para></footnote>
     </entry></row>

   <row><entry><literal>notification-addr</literal></entry>
     <entry><literal>string (max 16)</literal></entry>
     <entry valign="bottom">
        Notification Address. Example: 0100110120131234.
       <footnote id="notification-addr-note"><para>If you set 
       <literal>notification-addr</literal>, you should also set 
       <literal>notification-pid</literal>.</para></footnote>
     </entry></row>

 </tbody></tgroup></informaltable>

 <para>
   You should use <literal>notification-pid</literal> and 
   <literal>notification-addr</literal> if you need to inform
   your exact "address" to your smsc. For example, if you have a
   <literal>Multiple-Address (MA)</literal> account with several
   connections to the same <literal>short number</literal>, you may 
   need to tell your smsc to send delivery reports to the exact instance
   that sent the message. This is required because if you send a message
   with instance 1, your instance 2 wouldn't know about it, unless you
   use a shared DB store for delivery reports.
 </para>

 <informaltable frame="none">
  <tgroup cols="2"><thead><row>
     <entry>Notification PID Value</entry>
     <entry>Description</entry>
   </row></thead><tbody>

   <row><entry>0100</entry><entry>Mobile Station</entry></row>
   <row><entry>0122</entry><entry>Fax Group 3</entry></row>
   <row><entry>0131</entry><entry>X.400</entry></row>
   <row><entry>0138</entry><entry>Menu over PSTN</entry></row>
   <row><entry>0139</entry><entry>PC appl. over PSTN (E.164)</entry></row>
   <row><entry>0339</entry><entry>PC appl. over X.25 (X.121)</entry></row>
   <row><entry>0439</entry><entry>PC appl. over ISDN (E.164)</entry></row>
   <row><entry>0539</entry><entry>PC appl. over TCP/IP</entry></row>

 </tbody></tgroup></informaltable>


   

</sect2>

<sect2>
<title>SMPP 3.3, 3.4 and 5.0</title>

   <para>This implements Short Message Peer to Peer (SMPP) Protocol
   5.0, with most used support for 3.4 and full support for 3.3. Sample
   configuration:</para>

<programlisting>
group = smsc
smsc = smpp
host = 123.123.123.123
port = 600
smsc-username = "STT"
smsc-password = foo
system-type = "VMA"
address-range = ""
</programlisting>

<informaltable frame="none">
  <tgroup cols="3"><thead><row>
     <entry>Variable</entry>
     <entry>Value</entry>
     <entry>Description</entry>
   </row></thead><tbody>

   <row><entry><literal>host (m)</literal></entry>
     <entry><literal>hostname</literal></entry>
     <entry valign="bottom">
        Machine that runs SMSC. As IP (100.100.100.100) 
        or hostname (their.machine.here)
     </entry></row>

   <row><entry><literal>port (m)</literal></entry>
     <entry><literal>port-number</literal></entry>
     <entry valign="bottom">
       The port number for the TRANSMITTER connection to the SMSC. 
       If set, receive-port must be ommited or set to 0.
     </entry></row>

   <row><entry><literal>use-ssl</literal></entry>
     <entry><literal>bool</literal></entry>
     <entry valign="bottom">
        Defines whether we should try to bind with SSL enabled connection
        to create a SSMPP (secure SMPP) session.
     </entry></row>

    <row><entry><literal>ssl-client-certkey-file (c)</literal></entry>
     <entry>filename</entry>
     <entry valign="bottom">
      A PEM encoded SSL certificate and private key file to be used
      for SSL connections. This option is used together with use-ssl
      for client certificate validation with SMPP SMSCs requiring it.
     </entry></row>

   <row><entry><literal>transceiver-mode</literal></entry>
     <entry>bool</entry>
     <entry valign="bottom">
       Use a TRANSCEIVER mode connection to the SMSC. 
       It uses the standard transmit 'port' to define the port
       to connect to.
       This is a SMPP 3.4 and 5.0 feature and will not work
       on an earlier SMSC using SMPP 3.3.
       This will do a bind_transceiver only and will not attempt
       to fall back to doing transmit and receive on the same connection.
      </entry></row>

   <row><entry><literal>receive-port</literal></entry>
     <entry><literal>port-number</literal></entry>
     <entry valign="bottom">
       The port number for the RECEIVER connection to the SMSC. 
       If set, port must be ommited or set to 0.
     </entry></row>

   <row><entry><literal>smsc-username (m)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       The 'username' of the Messaging Entity connecting to the
       SMSC. If the SMSC operator reports that the "TELEPATH
       SYSTEM MANAGER TERMINAL" view "Control.Apps.View" value 
       "Name:" is "SMPP_ZAPVMA_T" for the transmitter and 
       "SMPP_ZAPVMA_R" for the receiver the smsc-username value 
       is accordingly "SMPP_ZAP". Note that this used to be called
       system-id (the name in SMPP documentation) and has been
       changed to smsc-username to make all Kannel SMS center
       drivers use the same name.
     </entry></row>

   <row><entry><literal>smsc-password (m)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       The password matching the "smsc-username" your teleoperator
       provided you with.
     </entry></row>


   <row><entry><literal>system-type (m)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Optional; used to categorize the type of ESME that is binding 
       to the SMSC. Examples include "VMS" (voice mail system) and "OTA" 
       (over-the-air activation system). If not set, defaults to 
       "VMA" (voice mail alerting).
     </entry></row>

   <row><entry><literal>service-type</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Optional; if specified, sets the service type for the SMSC. If
       unset, the default service type is used. This may be used to
       influence SMS routing (for example). The SMSC operator may
       also refer to this as the "profile ID". The maximum length of the
       service type is 6, according to the SMPP specification v3.4.
       Defined values are: "CMT" (cellular messaging), "CPT" (cellular
       paging), "VMN" (voice mail notification), "VMA" (voice mail
       alerting), "WAP" (wireless application protocol), "USSD"
       (unstructured supplementary services data), "CBS" (cell broadcast
       service) and "GUTS" (generic UDP transport service). Other values
       may be defined mutually between the SMSC and the ESME application.
     </entry></row>

   <row><entry><literal>interface-version</literal></entry>
     <entry><literal>number</literal></entry>
     <entry valign="bottom">
       Change the "interface version" parameter sent from Kannel to
       a value other then 0x34 (for SMPP v3.4). The value entered here
       should be the hexadecimal representation of the interface version
       parameter. For example, the default (if not set) is "34" which stands
       for 0x34. For SMPP v3.3 set to "33". For SMPP v5.0 set to "50".
     </entry></row>

   <row><entry><literal>address-range (m)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       According to the SMPP 3.4 spec this is supposed to
       affect which MS's can send messages to this account.
       Doesn't seem to work, though.
     </entry></row>

    <row><entry><literal>my-number</literal></entry>
      <entry><literal>number</literal></entry>
      <entry valign="bottom">
      	Optional smsc short number. Should be set if smsc sends
	a different one.
     </entry></row>

    <row><entry><literal>enquire-link-interval</literal></entry>
      <entry><literal>number</literal></entry>
      <entry valign="bottom">
      Optional the time lapse allowed between operations after which 
      an SMPP entity should interrogate whether it's peer still has an 
      active session. The default is 30 seconds.  
     </entry></row>

    <row><entry><literal>max-pending-submits</literal></entry>
      <entry><literal>number</literal></entry>
      <entry valign="bottom">
      	Optional the maximum number of outstanding (i.e. acknowledged)
        SMPP operations between an ESME and SMSC. This number
        is not specified explicitly in the SMPP Protocol Specification
        and will be governed by the SMPP implementation on the SMSC.
        As a guideline it is recommended that no more than 10 (default)
        SMPP messages are outstanding at any time.
     </entry></row>

    <row><entry><literal>reconnect-delay</literal></entry>
      <entry><literal>number</literal></entry>
      <entry valign="bottom">
      Optional the time between attempts to connect an ESME to an SMSC 
      having failed to connect initiating or during an SMPP session. 
		The default is 10 seconds.
     </entry></row>

    <row><entry><literal>source-addr-ton</literal></entry>
      <entry><literal>number</literal></entry>
      <entry valign="bottom">
      Optional, source address TON setting for the link.
		(Defaults to 2).
     </entry></row>

    <row><entry><literal>source-addr-npi</literal></entry>
      <entry><literal>number</literal></entry>
      <entry valign="bottom">
      Optional, source address NPI setting for the link.
		(Defaults to 1).
     </entry></row>

    <row><entry><literal>source-addr-autodetect</literal></entry>
      <entry><literal>boolean</literal></entry>
      <entry valign="bottom">
      Optional, if defined tries to scan the source address and 
		set TON and NPI settings accordingly. If you don't want to autodetect
		the source address, turn this off, by setting it to no.
		(Defaults to yes).
     </entry></row>

    <row><entry><literal>dest-addr-ton</literal></entry>
      <entry><literal>number</literal></entry>
      <entry valign="bottom">
      Optional, destination address TON setting for the link.
		(Defaults to 2).
     </entry></row>

    <row><entry><literal>dest-addr-npi</literal></entry>
      <entry><literal>number</literal></entry>
      <entry valign="bottom">
      Optional, destination address NPI setting for the link.
		(Defaults to 1).
     </entry></row>

    <row><entry><literal>bind-addr-ton</literal></entry>
      <entry><literal>number</literal></entry>
      <entry valign="bottom">
      Optional, bind address TON setting for the link.
		(Defaults to 0).
     </entry></row>

    <row><entry><literal>bind-addr-npi</literal></entry>
      <entry><literal>number</literal></entry>
      <entry valign="bottom">
      Optional, bind address NPI setting for the link.
		(Defaults to 0).
     </entry></row>

   <row><entry><literal>msg-id-type</literal></entry>
     <entry><literal>number</literal></entry>
     <entry valign="bottom">
       Optional, specifies which number base the SMSC is using for the
		 message ID numbers in the corresponding <literal>submit_sm_resp</literal> 
		 and <literal>deliver_sm</literal> PDUs. This is required to make
		 delivery reports (DLR) work on SMSC that behave differently. The number
		 is a combined set of bit 1 and bit 2 that indicate as follows:
		 bit 1: type for <literal>submit_sm_resp</literal>, bit 2: type for 
		 <literal>deliver_sm</literal>. If the bit is set then the  value is 
		 in hex otherwise in decimal number base. Which means the following
		 combinations are possible and valid: 
		 0x00 <literal>deliver_sm</literal> decimal, 
		 <literal>submit_sm_resp</literal> decimal;
		 0x01 <literal>deliver_sm</literal> decimal, 
		 <literal>submit_sm_resp</literal> hex;
		 0x02 <literal>deliver_sm</literal> hex, 
		 <literal>submit_sm_resp</literal> decimal;
		 0x03 <literal>deliver_sm</literal> hex, 
		 <literal>submit_sm_resp</literal> hex. 
		 In accordance to the SMPP v3.4 specs the default will be a C string 
		 literal if no of the above values is explicitly indicated using the 
		 config directive.
     </entry></row>

   <row><entry><literal>alt-charset</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
        Defines which character encoding is used for this specific smsc link. 
		  Uses <literal>iconv()</literal> routines to convert from and to that
		  specific character set encoding. See your local iconv_open(3) manual 
		  page for the supported character encodings and the type strings that
		  should be presented for this directive.
     </entry></row>

     <row><entry><literal>alt-addr-charset</literal></entry>
        <entry><literal>string</literal></entry>
        <entry valign="bottom">
            Defines which character encoding is used for alphanumeric addresses.
            When set to <literal>GSM</literal>, addresses are converted into the
            GSM 03.38 charset (Since @ is translated into 0x00 which will break
			the SMPP PDU, @ replaced with ?). If set to another value,
            <literal>iconv()</literal> is used.
            (Defaults to windows-1252)
        </entry></row>

    <row><entry><literal>connection-timeout</literal></entry>
      <entry><literal>number (seconds)</literal></entry>
      <entry valign="bottom">
        This timer specifies the maximum time lapse allowed 
        between transactions , after which period of inactivity, an SMPP driver may 
        assume that the session is no longer active and does reconnect.
	Defaults to 300 seconds, to disable set it to 0.
     </entry></row>

    <row><entry><literal>wait-ack</literal></entry>
      <entry><literal>number (seconds)</literal></entry>
      <entry valign="bottom">
        A message is resent if the acknowledge from SMSC takes more than 
	this time.  Defaults to 60 seconds.
     </entry></row>

    <row><entry><literal>wait-ack-expire</literal></entry>
      <entry><literal>number</literal></entry>
      <entry valign="bottom">
        Defines what kind of action should be taken if the ack of 
		  a message expires. The options for this value are:
		  0x00 - disconnect/reconnect, (default) 0x01 - as is now, re-queue, 
		  but this could potentially result in the msg arriving twice
		  0x02 - just carry on waiting (given that the wait-ack should never 
		  expire this is the must accurate)
     </entry></row>

   <row><entry><literal>validityperiod</literal></entry>
     <entry><literal>integer</literal></entry>
     <entry valign="bottom">
     	 How long the message will be valid, i.e., how long the SMSC will try
     	 try to send the message to the recipient. Defined in minutes.
     </entry></row>

   <row><entry><literal>esm-class</literal></entry>
     <entry><literal>number</literal></entry>
     <entry valign="bottom">
       Change the "esm_class" parameter sent from Kannel. 
       Accepted values are 0 (Default SMSC Mode) and 3 (Store and Forward). 
       Defaults to 3.
     </entry></row>

   <row><entry><literal>log-format</literal></entry>
     <entry><literal>number</literal></entry>
     <entry valign="bottom">
       Selects which SMPP PDU dump format to use:
       	1 - for multiline (default)
       	2 - for one line
     </entry></row>

   </tbody></tgroup></informaltable>

</sect2>

<sect2>
<title>Sema Group SMS2000 OIS 4.0, 5.0 and 5.8</title>
 
   <para>The 4.0 implementation is over Radio PAD (X.28). Following
   configuration variables are needed, and if you find out the more
   exact meaning, please send a report.</para>

   <para>The 5.0 implementation uses X.25 access gateway.</para>
  
   <para>The 5.8 implementation uses direct TCP/IP access interface.</para>

<programlisting>
group = smsc
smsc = sema
device = /dev/tty0
smsc_nua = (X121 smsc address)
home_nua = (x121 radio pad address)
wait_report = 0/1 (0 means false, 1 means true)
</programlisting>

<informaltable frame="none">
  <tgroup cols="3"><thead><row>
     <entry>Variable</entry>
     <entry>Value</entry>
     <entry>Description</entry>
   </row></thead><tbody>

   <row><entry><literal>device (m)</literal></entry>
     <entry><literal>device</literal></entry>
     <entry valign="bottom">
        ex: /dev/tty0
     </entry></row>

   <row><entry><literal>smsc_nua (m)</literal></entry>
     <entry><literal>X121 smsc address</literal></entry>
     <entry valign="bottom">
       The address of an SMSC for SEMA SMS2000 protocols using an
       X.28 connection.
     </entry></row>

   <row><entry><literal>home_nua (m)</literal></entry>
     <entry><literal>X121 radio pad address</literal></entry>
     <entry valign="bottom">
       The address of a radio PAD implementing Sema SMS2000 using
       X.28 connection.
     </entry></row>

   <row><entry><literal>wait_report</literal></entry>
     <entry><literal>0 (false)/1 (true)</literal></entry>
     <entry valign="bottom">
       Report indicator used by the Sema SMS2000 protocol. Optional.
     </entry></row>
   </tbody></tgroup></informaltable>

<programlisting>
group = smsc
smsc = ois
host = 103.102.101.100
port = 10000
receive-port = 10000
ois-debug-level = 0
</programlisting>

<informaltable frame="none">
  <tgroup cols="3"><thead><row>
     <entry>Variable</entry>
     <entry>Value</entry>
     <entry>Description</entry>
   </row></thead><tbody>

   <row><entry><literal>host (m)</literal></entry>
     <entry><literal>ip</literal></entry>
     <entry valign="bottom">
        SMSC Host name or IP
     </entry></row>

   <row><entry><literal>port (m)</literal></entry>
     <entry><literal>port number</literal></entry>
     <entry valign="bottom">
       SMSC Port number
     </entry></row>

   <row><entry><literal>receive-port (m)</literal></entry>
     <entry><literal>port number</literal></entry>
     <entry valign="bottom">
       The port in which the SMSC will contact
     </entry></row>

   <row><entry><literal>ois-debug-level</literal></entry>
     <entry><literal>number 0 to 8</literal></entry>
     <entry valign="bottom">
       extra debug, optional, see smsc_ois.c
     </entry></row>

   </tbody></tgroup></informaltable>

<programlisting>
group = smsc
smsc = oisd
host = 103.102.101.100
port = 10000
keepalive = 25
my-number = 12345
validityperiod = 30
</programlisting>

<informaltable frame="none">
  <tgroup cols="3"><thead><row>
     <entry>Variable</entry>
     <entry>Value</entry>
     <entry>Description</entry>
   </row></thead><tbody>

   <row><entry><literal>host (m)</literal></entry>
     <entry><literal>ip</literal></entry>
     <entry valign="bottom">
        SMSC Host name or IP
     </entry></row>

   <row><entry><literal>port (m)</literal></entry>
     <entry><literal>port number</literal></entry>
     <entry valign="bottom">
       SMSC Port number
     </entry></row>

   <row><entry><literal>keepalive</literal></entry>
     <entry><literal>number</literal></entry>
     <entry valign="bottom">
       SMSC connection will not be left idle for longer than this many
       seconds.  The right value to use depends on how eager the SMSC
       is to close idle connections. If you see many unexplained 
       reconnects, try lowering this value.
       Set it to 0 to disable this feature.
     </entry></row>

   <row><entry><literal>my-number</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Any valid SME number acceptable by SMSC. This number is used only in keepalive request. 
     </entry></row>

   <row><entry><literal>validityperiod</literal></entry>
     <entry><literal>integer</literal></entry>
     <entry valign="bottom">
     	 How long the message will be valid, i.e., how long the SMS
	 center (the real one, not the phone acting as one for Kannel)
	 will try to send the message to the recipient. Defined in minutes.
     </entry></row>

   </tbody></tgroup></informaltable>
</sect2>


<sect2>
<title>SM/ASI (for CriticalPath InVoke SMS Center 4.x)</title>

   <para>This implements Short Message/Advanced Service Interface 
	(SM/ASI) Protocol for the use of connecting to a CriticalPath
	InVoke SMS Center. Sample
   configuration:</para>

<programlisting>
group = smsc
smsc = smasi
host = 10.11.12.13
port = 23456
smsc-username = foo
smsc-password = foo
</programlisting>

<informaltable frame="none">
  <tgroup cols="3"><thead><row>
     <entry>Variable</entry>
     <entry>Value</entry>
     <entry>Description</entry>
   </row></thead><tbody>

   <row><entry><literal>host (m)</literal></entry>
     <entry><literal>hostname</literal></entry>
     <entry valign="bottom">
        Machine that runs SMSC. As IP (10.11.12.13) 
        or hostname (host.foobar.com)
     </entry></row>

   <row><entry><literal>port (m)</literal></entry>
     <entry><literal>port-number</literal></entry>
     <entry valign="bottom">
       The port number for the connection to the SMSC. 
     </entry></row>

   <row><entry><literal>smsc-username (m)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       The 'username' of the Messaging Entity connecting to the
       SMSC. 
     </entry></row>

   <row><entry><literal>smsc-password (m)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       The password matching the "smsc-username" your teleoperator
       provided you with.
     </entry></row>

    <row><entry><literal>reconnect-delay</literal></entry>
      <entry><literal>number</literal></entry>
      <entry valign="bottom">
      Optional, the time between attempts to connect to an SMSC 
      having failed to connect initiating or during an session. 
		The default is 10 seconds.
     </entry></row>

    <row><entry><literal>source-addr-ton</literal></entry>
      <entry><literal>number</literal></entry>
      <entry valign="bottom">
      Optional, source address TON setting for the link.
		(Defaults to 1).
     </entry></row>

    <row><entry><literal>source-addr-npi</literal></entry>
      <entry><literal>number</literal></entry>
      <entry valign="bottom">
      Optional, source address NPI setting for the link.
		(Defaults to 1).
     </entry></row>

    <row><entry><literal>dest-addr-ton</literal></entry>
      <entry><literal>number</literal></entry>
      <entry valign="bottom">
      Optional, destination address TON setting for the link.
		(Defaults to 1).
     </entry></row>

    <row><entry><literal>dest-addr-npi</literal></entry>
      <entry><literal>number</literal></entry>
      <entry valign="bottom">
      Optional, destination address NPI setting for the link.
		(Defaults to 1).
     </entry></row>

    <row><entry><literal>priority</literal></entry>
      <entry><literal>number</literal></entry>
      <entry valign="bottom">
      Optional, sets the default priority of messages transmitted
      over this smsc link.
      (Defaults to 0, which is the lowest priority).
     </entry></row>

   </tbody></tgroup></informaltable>
</sect2>


<sect2>
<title>GSM modem</title>

  <warning><para>See <xref linkend="upgrading-notes"/> for changes.</para></warning>

  <para>This driver allows a GSM Modem or Phone to be connected to Kannel 
  and work as a virtual SMSC</para>

<programlisting>
group = smsc
smsc = at
modemtype = auto
device = /dev/ttyS0
speed = 9600
pin = 2345
</programlisting>

 <informaltable frame="none">
  <tgroup cols="3"><thead><row>
     <entry>Variable</entry>
     <entry>Value</entry>
     <entry>Description</entry>
   </row></thead><tbody>

   <row><entry><literal>modemtype</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
        Modems from different manufacturers have slightly different
        behavior. We need to know what type of modem is used. Use "auto"
        or omit parameter to have Kannel detect the modem type automatically.
        (some types should not be auto-detected like the Nokia Premicell).
     </entry></row>

   <row><entry><literal>device (m)</literal></entry>
     <entry><literal>device-name</literal></entry>
     <entry valign="bottom">
          The device the modem is connected to, like <literal>/dev/ttyS0</literal>.
          When the device name is set to <literal>rawtcp</literal> or 
          <literal>telnet</literal> two other
          variables are required in the configuration: <literal>host</literal>
          and <literal>port</literal>. See the note below.
      </entry></row>

   <row><entry><literal>speed</literal></entry>
     <entry><literal>serial speed in bps</literal></entry>
     <entry valign="bottom">
          The speed in bits per second. Default value 0 means to try to use
	  speed from modem definition, or if it fails, try to autodetect.
     </entry></row>

   <row><entry><literal>pin</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
         This is the PIN number of the SIM card in the GSM modem. You can specify
         this option if your SIM has never been used before and needs to have
         the PIN number entered. The PIN is usually a four digit number.
     </entry></row>

   <row><entry><literal>validityperiod</literal></entry>
     <entry><literal>integer</literal></entry>
     <entry valign="bottom">
     	 How long the message will be valid, i.e., how long the SMS
	 center (the real one, not the phone acting as one for Kannel)
	 will try to send the message to the recipient. Encoded as per
	 the GSM 03.40 standard, section 9.2.3.12. Default is
	 167, meaning 24 hours.
     </entry></row>

    <row><entry><literal>keepalive</literal></entry>
      <entry><literal>seconds</literal></entry>
      <entry valign="bottom">
        Kannel would "ping" the modem for this many seconds. If the probe fails, 
	try to reconnect to it.
     </entry></row>

    <row><entry><literal>my-number</literal></entry>
      <entry><literal>number</literal></entry>
      <entry valign="bottom">
      	Optional phone number.
     </entry></row>

    <row><entry><literal>sms-center</literal></entry>
      <entry><literal>number</literal></entry>
      <entry valign="bottom">
      	SMS Center to send messages.
     </entry></row>

    <row><entry><literal>sim-buffering</literal></entry>
      <entry><literal>boolean</literal></entry>
      <entry valign="bottom">
        Whether to enable the so-called "SIM buffering behavior" of the GSM module.
                if assigned a true value, the module will query the message storage memory
                of the modem and will process and delete any messages found there. this does
                not alter normal behavior, but only add the capability of reading messages that
                were stored in the memory for some reason. The type of memory to use can be
                selected using the 'message-storage' parameter of the modem configuration.
                Polling the memory is done at the same interval as keepalive (if set) or 60 seconds
                (if not set).
                NOTE: This behavior is known to cause minor or major hiccups for a few buggy modems.
                Modems known to work with this setting are Wavecom WM02/M1200 and the Siemens M20.
     </entry></row>

     <row><entry><literal>max-error-count</literal></entry>
       <entry><literal>integer</literal></entry>
       <entry valign="bottom">
          Maximal error count for opening modem device or initializing of the modem before
          <literal>reset-string</literal> will be executed. This is useful when modem crashed and needs
          hard reset. Default disabled.
       </entry></row>
       
     <row><entry><literal>host</literal></entry>
       <entry><literal>IP address</literal></entry>
       <entry valign="bottom">
          Hostname or IP address to connect in <literal>rawtcp</literal> mode. 
          Required if <literal>device</literal> is set to <literal>rawtcp</literal>.
       </entry></row>

     <row><entry><literal>port</literal></entry>
       <entry><literal>integer</literal></entry>
       <entry valign="bottom">
          TCP port to connect to on <literal>rawtcp-host</literal>.
          Required if <literal>device</literal> is set to <literal>rawtcp</literal>.
       </entry></row>

     <row><entry><literal>smsc-username</literal></entry>
       <entry><literal>string</literal></entry>
       <entry valign="bottom">
          Username to use on a Login: or User: prompt prior to be connected
          to the modem. Useful if modem is connected to a terminal server
          and <literal>rawtcp</literal> mode or <literal>telnet</literal> mode
          are used.
       </entry></row>

     <row><entry><literal>smsc-password</literal></entry>
       <entry><literal>string</literal></entry>
       <entry valign="bottom">
          Username to use on a Password prompt prior to be connected
          to the modem. Useful if modem is connected to a terminal server
          and <literal>rawtcp</literal> mode or <literal>telnet</literal> mode
          are used. <literal>smsc-password</literal> can be used alone
          without <literal>smsc-username</literal> for devices only asking for
          a password.
       </entry></row>

    <row><entry><literal>login-prompt</literal></entry>
       <entry><literal>string</literal></entry>
       <entry valign="bottom">
          An alternative string to be used instead of Login: or Username:
       </entry></row>

     <row><entry><literal>password-prompt</literal></entry>
       <entry><literal>string</literal></entry>
       <entry valign="bottom">
           An alternative string to be used instead of Password:
       </entry></row>

   </tbody></tgroup></informaltable>

   <para>Modem definitions are now multiple groups present in kannel.conf,
   either directly or, for example, by including the example
   modems.conf. (See <xref linkend="includes" endterm="includes.title"/>)
   </para>

 <informaltable frame="none">
  <tgroup cols="3"><thead><row>
     <entry>Variable</entry>
     <entry>Value</entry>
     <entry>Description</entry>
   </row></thead><tbody>

   <row><entry><literal>group</literal></entry>
     <entry><literal>modems</literal></entry>
     <entry valign="bottom">
     	This is a mandatory variable
     </entry></row>

   <row><entry><literal>id</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
     	This is the the id that should be used in
	<literal>modemtype</literal> variable from AT2
     </entry></row>

   <row><entry><literal>name</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
     	The name of this modem configuration. Used in
	logs
     </entry></row>

   <row><entry><literal>detect-string</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
     	String to use when trying to detect the modem.
	See <literal>detect-string2</literal>
     </entry></row>

   <row><entry><literal>detect-string2</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
     	Second string to use to detect the modem. For example,
	if the modem replies with "SIEMENS MODEM M20", 
	<literal>detect-string</literal> could be "SIEMENS" 
	and <literal>detect-string2</literal> "M20"
     </entry></row>

   <row><entry><literal>init-string</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
     	Optional initialization string. Defaults to
	"AT+CNMI=1,2,0,1,0"
     </entry></row>

   <row><entry><literal>speed</literal></entry>
     <entry><literal>number</literal></entry>
     <entry valign="bottom">
     	Serial port hint speed to use. Optional. 
	Defaults to smsc group speed or autodetect
     </entry></row>

   <row><entry><literal>enable-hwhs</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
     	Optional AT command to enable hardware handshake.
	Defaults to "AT+IFC=2,2"
     </entry></row>

   <row><entry><literal>hardware-flow-control</literal></entry>
     <entry><literal>boolean</literal></entry>
     <entry valign="bottom">
     	Optionally disable hardware handshake on the computer side by setting it to false.
	Defaults to true.
     </entry></row>

   <row><entry><literal>need-sleep</literal></entry>
     <entry><literal>boolean</literal></entry>
     <entry valign="bottom">
     	Optional. Defaults to false. Some modems needs
	to sleep after opening the serial port and before
	first command
     </entry></row>

   <row><entry><literal>no-pin</literal></entry>
     <entry><literal>boolean</literal></entry>
     <entry valign="bottom">
     	Optional. Defaults to false. If the modem doesn't
	support the PIN command, enable this
     </entry></row>

   <row><entry><literal>no-smsc</literal></entry>
     <entry><literal>boolean</literal></entry>
     <entry valign="bottom">
     	Optional. Defaults to false. If the modem doesn't
	support setting the SMSC directly on the PDU, enable
	this. (Default is to include a "00" at the beginning
	of the PDU to say it's the default smsc, and remove
	the "00" when receiving)
     </entry></row>

   <row><entry><literal>sendline-sleep</literal></entry>
     <entry><literal>number (milliseconds)</literal></entry>
     <entry valign="bottom">
     	Optional, defaults to 100 milliseconds. The sleep time
	after sending a AT command.
     </entry></row>

   <row><entry><literal>keepalive-cmd</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
     	Optional, defaults to "AT". If keepalive is activated
	in AT2 group, this is the command to be sent. If your
	modem supports it, for example, use "AT+CBC;+CSQ", and
	see in logs the reply "+CBC: 0,64" (0=On battery, 64% 
	full) and "+CSQ: 14,99" (0-31, 0-7: signal strength and
	channel bit error rate; 99 for unknown). See 3GPP 27007.
     </entry></row>

   <row><entry><literal>message-storage</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
        Message storage memory type to enable for "SIM buffering".
                Possible values are: "SM" - SIM card memory or "ME" -
                Mobile equipment memory (may not be supported by your
                modem). check your modem's manual for more types.
                By default, if the option is not set, no message storage command
                will be sent to the modem and the modem's default message
                storage will be used (usually "SM").
     </entry></row>

   <row><entry><literal>message-start</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
        Optional integer, defaults to 1. Specifies starting index in
                SIM buffer for new SMS. Most modems start numbering from 1,
                however a few like the UMG181 start numbering from 0. This
                parameter ensures that all SMS are fetched when using
                "SIM buffering".
     </entry></row>

   <row><entry><literal>enable-mms</literal></entry>
     <entry><literal>boolean</literal></entry>
     <entry valign="bottom">
     	Optional, defaults to false. If enabled, Kannel
	would send an AT+CMMS=2 if it have more than one
	message on queue and hopefully will be quicker
	sending the messages.
     </entry></row>

   <row><entry><literal>reset-string</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
        Which reset string to execute when <literal>max-error-count</literal> reached.
        Example for Falcom: AT+CFUN=1
     </entry></row>


   </tbody></tgroup></informaltable>

   <para><emphasis>A note about delivery reports and GSM modems:</emphasis>
   while it is possible (and supported) to receive delivery reports on GSM 
   modems, it may not work for you. if you encounter problems, check that your 
   modem's init string (if not the default) is set to correctly allow the modem 
   to send delivery reports using unsolicited notification (check your modem's 
   manual). If the init-string is not set as si, some modems will store delivery 
   reports to SIM memory, to get at which you will need to enable sim-buffering. 
   finally your GSM network provider may not support delivery reports to mobile 
   units.</para>

   <para><emphasis>About <literal>rawtcp</literal> mode:</emphasis>
   This mode allows you to use a GSM modem connected to a remote terminal server,
   such as Perle IOLAN DS1 or a Cisco router with reverse telnet. The teminal
   server should support raw TCP mode. The driver is not tested in telnet mode.
   It is recommended to use <literal>keepalive</literal> variable, in order to 
   automatically reconnect in case of network connectivity problems.</para>

   <sect3>
     <title>Modem initialization</title>
     <para>This question has been asked frequently in the users mailing list. 
     It usually comes in two forms:

     <orderedlist>
        <listitem><para>Modem doesn't receive or transmit SMS.</para>
           <para>In its current implementation, the at driver will panic if it
                 cannot find the modem device and bearerbox won't start. This
                 can happen either because the wrong modem device is configured
                 or the device has no write access for kannel's user.</para>
           <para> In the first case use system logs to discover where is your
                  modem assigned to:</para>
           <para>grep tty /var/log/messages</para>
           <para>Then verify that this is indeed your GSM modem device by
                 connecting to it with minicom or wvdial and issuing a few AT
                 commands. Wvdial is preferrable, since it can also give you a
                 working <literal>init-string</literal></para>
           <para>In the second case you need to give write access to kannel
                 user. This is no problem if you run kannel as root, but it is
                 not recommended to do so. In Ubuntu linux you just need to
                 assign kannel user to group "dial". In other systems you can
                 either:</para>
           <programlisting>chmod 666 /dev/modem</programlisting>
           <para>or preferably:</para>
           <programlisting>
chmod 664 /dev/modem
chgrp <emphasis>group</emphasis> /dev/modem
usermod -G <emphasis>group</emphasis> <emphasis>kannel-user</emphasis>
           </programlisting>
        </listitem>
        <listitem><para>Modem doesn't receive DLRs or SMS.</para>
           <para>By default the modem doesn't know how to treat incoming
                 messages. To tell it to send it to kannel you have to
                 configure <literal>init-string</literal> with the <emphasis>
                 +CNMI=x,x,x,x,x</emphasis> command. X's are decimal numbers
                 and CNMI stands for Command New Message Indication. There is
                 no hard rule about its values. They are model and manufacturer
                 specific. Best to consult modem manual or manufacturer's web
                 site. Failing that, wvdialconf might give a working CNMI.
                 Finally see modems.conf for examples and try out different
                 values. Some Nokia phones do not support this command, but
                 are ready to transmit incoming messages from the start.</para>
           <para>Since this setting is modem specific, kannel cannot understand
                 what it means from its value, and if using unconventional
                 values you should tell kannel through <literal>sim-buffering
                 </literal> and <literal> message-storage</literal>. In any
                 case it is useful to add +CMEE = 1 or 2 in the <literal>
                 init-string</literal> in order to make the modem more verbose
                 in its responses.</para>
           <programlisting>
group = modems
init-string = "AT+CNMI=2,3,0,1,0;+CMEE=1"
message-storage = ME or SM    Depending on your modem, you may need to adjust it
...

group = smsc
smsc = at
sim-buffering = true          This will tell kannel to search for messages in
...                           the modem (either memory or its SIM)
           </programlisting>
        </listitem>
     </orderedlist>
     </para>
   </sect3>
</sect2>


<sect2>
<title>GSMA OneAPI v1.0 ParlayX SMS SOAP</title>

   <para>This implements the GSMA OneAPI v1.0 ParlayX SMS SOAP/XML interface
   in two flavors, the Ericsson SDP (service delivery platform) ParlayX and
   the GSMA OneAPI v1.0 SOAP interfaces.</para>

  <para>Example configuration for the Ericsson SDP variant:</para>

<programlisting>
group = smsc
smsc = parlayx
system-type = ericsson-sdp
port = 10000
connect-allow-ip = 10.11.12.13
send-url = http://host/location
dlr-url = http://our-host:10000/dlr-location
smsc-username = tester
smsc-password = foobar
</programlisting>

 <informaltable frame="none">
  <tgroup cols="3"><thead><row>
     <entry>Variable</entry>
     <entry>Value</entry>
     <entry>Description</entry>
   </row></thead><tbody>

   <row><entry><literal>system-type (m)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
        Type of ParlayX connection. Currently supported are: 
        'oneapi-v1', 'ericsson-sdp'. 
        The variants have the same ParlayX SOAP XML PDUs, but differ in the
        authentication scheme they use, where 'ericsson-sdp' uses WS-Security 
        via wsse and 'oneapi-v1' uses plain HTTP basic authentication.
     </entry></row>

   <row><entry><literal>port (m)</literal></entry>
     <entry><literal>port-number</literal></entry>
     <entry valign="bottom">
       Port number in which Kannel listens to (MO and DLR) messages 
       from other SOAP service side.
     </entry></row>

   <row><entry><literal>send-url (m)</literal></entry>
     <entry><literal>url</literal></entry>
     <entry valign="bottom">
       Location of the SOAP service to send MT messages.
     </entry></row>

   <row><entry><literal>dlr-url (m)</literal></entry>
     <entry><literal>url</literal></entry>
     <entry valign="bottom">
       Location of our side SOAP service for DLR notifications.
     </entry></row>

   <row><entry><literal>smsc-username (m)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Username associated for the SOAP service connection.
     </entry></row>

   <row><entry><literal>smsc-password (m)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Password associated for the SOAP service username.
     </entry></row>

   <row><entry><literal>use-ssl</literal></entry>
   <entry><literal>boolean</literal></entry>
   <entry valign="bottom">
      Defines whether listen port should use SSL.
   </entry></row>

   <row><entry><literal>connect-allow-ip</literal></entry>
     <entry><literal>IP-list</literal></entry>
     <entry valign="bottom">
       IPs allowed to use this SOAP service interface. If not set, 
       "127.0.0.1" (localhost) is the only host allowed to connect.
       Typically you will allow the IP of the other side SOAP service
       here.
     </entry></row>

   <row><entry><literal>window</literal></entry>
   <entry><literal>boolean</literal></entry>
   <entry valign="bottom">
      Number of concurrent sending threads. If not set,
      one thread is used.
   </entry></row>

   </tbody></tgroup></informaltable>

</sect2>


<sect2>
<title>Fake SMSC</title>

  <para>Fake SMSC is a simple protocol to test out Kannel. It is not
  a real SMS center, and cannot be used to send or receive SMS
  messages from real phones. So, it is ONLY used for testing purposes.
  </para>

<programlisting>
group = smsc
smsc = fake
port = 10000
connect-allow-ip = 127.0.0.1
</programlisting>

 <informaltable frame="none">
  <tgroup cols="3"><thead><row>
     <entry>Variable</entry>
     <entry>Value</entry>
     <entry>Description</entry>
   </row></thead><tbody>

   <row><entry><literal>host (m)</literal></entry>
     <entry><literal>hostname</literal></entry>
     <entry valign="bottom">
        Machine that runs the SMSC. As IP (100.100.100.100) 
        or hostname (their.machine.here)
     </entry></row>

   <row><entry><literal>port (m)</literal></entry>
     <entry><literal>port-number</literal></entry>
     <entry valign="bottom">
       Port number in smsc host machine
     </entry></row>

   <row><entry><literal>connect-allow-ip</literal></entry>
     <entry><literal>IP-list</literal></entry>
     <entry valign="bottom">
       If set, only connections from these IP addresses are accepted.
     </entry></row>

   </tbody></tgroup></informaltable>

</sect2>


<sect2>
<title>HTTP-based relay and content gateways</title>
 
   <para>This special "SMSC" is used for HTTP based connections with
   other gateways and various other relay services, when direct SMSC
   is not available.</para>
  
<programlisting>
group = smsc
smsc = http
system-type = kannel
smsc-username = nork
smsc-password = z0rK
port = 13015
send-url = "http://localhost:20022"
</programlisting>


 <informaltable frame="none">
  <tgroup cols="3"><thead><row>
     <entry>Variable</entry>
     <entry>Value</entry>
     <entry>Description</entry>
   </row></thead><tbody>

   <row><entry><literal>system-type (m)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
        Type of HTTP connection. Currently supported are: 'kannel', 
		  'brunet', 'xidris', 'clickatell' and 'generic'.
     </entry></row>

   <row><entry><literal>send-url (m)</literal></entry>
     <entry><literal>url</literal></entry>
     <entry valign="bottom">
       Location to send MT messages. This URL is expanded by used
       system, if need to.
     </entry></row>

   <row><entry><literal>no-sender</literal></entry>
   <entry><literal>boolean</literal></entry>
   <entry valign="bottom">
      Do not add variable sender to the send-url.
   </entry></row>

   <row><entry><literal>no-coding</literal></entry>
   <entry><literal>boolean</literal></entry>
   <entry valign="bottom">
      Do not add variable coding to the send-url.
   </entry></row>

   <row><entry><literal>no-sep</literal></entry>
   <entry><literal>boolean</literal></entry>
   <entry valign="bottom">
      Represent udh and text as a numeric string containing the hex-dump. For
      instance, text=%2b123 is represented as text=2b313233. 
   </entry></row>

   <row><entry><literal>port (m)</literal></entry>
     <entry><literal>port-number</literal></entry>
     <entry valign="bottom">
       Port number in which Kannel listens to (MO) messages from other
       gateway
     </entry></row>

   <row><entry><literal>use-ssl</literal></entry>
   <entry><literal>boolean</literal></entry>
   <entry valign="bottom">
      Defines whether listen port should use SSL.
   </entry></row>

   <row><entry><literal>connect-allow-ip</literal></entry>
     <entry><literal>IP-list</literal></entry>
     <entry valign="bottom">
       IPs allowed to use this interface. If not set, "127.0.0.1"
     (localhost) is the only host allowed to connect.
     </entry></row>

   <row><entry><literal>smsc-username</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Username associated to connection, if needed. Kannel requires
       this, and it is the same as send-sms username at other end.
     </entry></row>

   <row><entry><literal>smsc-password</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Password for username, if needed.
     </entry></row>

   <row><entry><literal>max-pending-submits</literal></entry>
     <entry><literal>number</literal></entry>
     <entry valign="bottom">
       Optional the maximum number of outstanding (i.e. acknowledged)
       requests. As a guideline it is recommended that no more than
       10 (default) requests are outstanding at any time.
    </entry></row>
   </tbody></tgroup></informaltable>

<sect3>
<title>The "generic" system-type</title>

   <para>For a generic HTTP-based relay, the system-type 'generic' can be used.
   It can use the escape codes known from sms-service's get-url config
   directives in the send-url string to indicate the HTTP API calling style of
   the remote HTTP server, and the 3 HTTP body response parsing regular
   expressions 'status-success-regex' for successfull acknowledge,
   'status-permfail-regex' for permanent failure and 'status-tempfail-regex'
   for temporary failure. It can also accomodate the incoming parameters and response
   codes and text. This system-type has a lot of extra parameters that gives it a lot
   of flexibility:
   </para>


 <informaltable frame="none">
  <tgroup cols="3"><thead><row>
     <entry>Variable</entry>
     <entry>Value</entry>
     <entry>Description</entry>
   </row></thead><tbody>
     
   <row><entry><literal>status-success-regex (o)</literal></entry>
     <entry><literal>POSIX regular expression</literal></entry>
     <entry valign="bottom">
       Regular expression to match against HTTP
       response body content, indicating a successful submission.
     </entry></row>
     
   <row><entry><literal>status-permfail-regex (o)</literal></entry>
     <entry><literal>POSIX regular expression</literal></entry>
     <entry valign="bottom">
       Regular expression to match against HTTP
       response body content, indicating a permanent failure.
     </entry></row>

   <row><entry><literal>status-tempfail-regex (o)</literal></entry>
     <entry><literal>POSIX regular expression</literal></entry>
     <entry valign="bottom">
       Regular expression to match against HTTP
       response body content, indicating a temporary failure.
     </entry></row>

   <row><entry><literal>generic-foreign-id-regex (o)</literal></entry>
     <entry><literal>POSIX regular expression</literal></entry>
     <entry valign="bottom">
       Regular expression to match against HTTP
       response body content to get the foreign message id
       in case of successful submission.
     </entry></row>
    
   <row><entry><literal>generic-param-username (o)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Overrides the default parameter for the 'username'
       field used on incoming requests.
     </entry></row>

   <row><entry><literal>generic-param-password (o)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Overrides the default parameter for the 'password'
       field used on incoming requests.
     </entry></row>

   <row><entry><literal>generic-param-from (o)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Overrides the default parameter for the 'from' field
       used on incoming requests.
     </entry></row>

   <row><entry><literal>generic-param-to (o)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Overrides the default parameter for the 'to' field
       used on incoming requests.
     </entry></row>

   <row><entry><literal>generic-param-text (o)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Overrides the default parameter for the 'text' field
       used on incoming requests.
     </entry></row>

   <row><entry><literal>generic-param-udh (o)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Overrides the default parameter for the 'udh' field
       used on incoming requests.
     </entry></row>

   <row><entry><literal>generic-param-service (o)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Overrides the default parameter for the 'service' field
       used on incoming requests.
     </entry></row>

   <row><entry><literal>generic-param-account (o)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Overrides the default parameter for the 'account' field
       used on incoming requests.
     </entry></row>

   <row><entry><literal>generic-param-binfo (o)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Overrides the default parameter for the 'binfo' field
       used on incoming requests.
     </entry></row>

   <row><entry><literal>generic-param-dlr-mask (o)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Overrides the default parameter for the 'dlr-mask' field
       used on incoming requests.
     </entry></row>

   <row><entry><literal>generic-param-dlr-err (o)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Overrides the default parameter for the 'dlr-err' field
       used on incoming requests.
     </entry></row>

   <row><entry><literal>generic-param-dlr-url (o)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Overrides the default parameter for the 'dlr-url' field
       used on incoming requests.
     </entry></row>

   <row><entry><literal>generic-param-dlr-mid (o)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Overrides the default parameter for the 'dlr-mid' field
       used on incoming requests.
     </entry></row>

   <row><entry><literal>generic-param-flash (o)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Overrides the default parameter for the 'flash' field
       used on incoming requests.
     </entry></row>

   <row><entry><literal>generic-param-mclass (o)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Overrides the default parameter for the 'mclass' field
       used on incoming requests.
     </entry></row>

   <row><entry><literal>generic-param-mwi (o)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Overrides the default parameter for the 'mwi' field
       used on incoming requests.
     </entry></row>

   <row><entry><literal>generic-param-coding (o)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Overrides the default parameter for the 'coding' field
       used on incoming requests.
     </entry></row>

   <row><entry><literal>generic-param-validity (o)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Overrides the default parameter for the 'validity' field
       used on incoming requests.
     </entry></row>

   <row><entry><literal>generic-param-deferred (o)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Overrides the default parameter for the 'deferred' field
       used on incoming requests.
     </entry></row>

   <row><entry><literal>generic-param-foreign-id (o)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Overrides the default parameter for the 'foreign-id' field
       used on incoming requests.
     </entry></row>
     
   <row><entry><literal>generic-param-meta-data (o)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Overrides the default parameter for the 'meta-data' field
       used on incoming requests.
     </entry></row>

   <row><entry><literal>generic-message-sent (o)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       It allows you to set the text returned when a succesful request is made.
       If not set, defaults to 'Sent.'. Note that you can use all sms service escapes
       here, see <xref linkend="escapecodes" endterm="escapecodes.title"/> for details.
     </entry></row>

   <row><entry><literal>generic-status-sent (o)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Overrides the HTTP status code returned when a successful
       request is made. If not set, defaults to 202 (HTTP_ACCEPTED).
     </entry></row>

   <row><entry><literal>generic-status-error (o)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Overrides the HTTP status code returned when a request is
       rejected for any reason. If not set, defaults to 202 (HTTP_ACCEPTED).
     </entry></row>

   </tbody></tgroup></informaltable>

   <para>An example for a 'generic' group looks like this:</para>

<programlisting>
group = smsc
smsc = http
system-type = generic
port = 13015
send-url = "http://www.foobar.com/mt.php?from=%P&amp;to=%p&amp;text=%b"
status-success-regex = "ok"
status-permfail-regex = "failure"
status-tempfail-regex = "retry later"
generic-foreign-id-regex = "&lt;id&gt;(.+)&lt;/id&gt;"
generic-param-from = "phoneNumber"
generic-param-to = "shortCode"
generic-message-sent = "Message sent with ID: %I"
generic-status-sent = 200
generic-status-error = 404
</programlisting>
</sect3>
</sect2>


<sect2>
<title>Loopback SMSC (MT to MO direction switching)</title>
 
   <para>This special "SMSC" type can be used to route MT messages in
   bearerbox internally as MO input messages again. Therefore this
   tyoe is the MT wise counterpart of the 'reroute' functionality
   of the smsc group when MOs are re-routed as MTs.</para>
  
<programlisting>
group = smsc
smsc = loopback
smsc-id = loop1
reroute-smsc-id = my_id
</programlisting>

 <informaltable frame="none">
  <tgroup cols="3"><thead><row>
     <entry>Variable</entry>
     <entry>Value</entry>
     <entry>Description</entry>
   </row></thead><tbody>

   <row><entry><literal>reroute-smsc-id (o)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
        Tag the rerouted MO with the given value for smsc-id 
        instead of the canonical smsc-id value of the smsc group 
        itself.
     </entry></row>

   </tbody></tgroup></informaltable>
</sect2>


<sect2>
<title>Using multiple SMS centers</title>

    <para>If you have several SMS center connections (multiple
    operators or a number of GSM modems) you need to configure one smsc
    group per SMS center (or GSM modem). When doing this, you might
    want to use routing systems to rout messages to specific centers -
    for example, you have 2 operator SMS centers, and the other is
    much faster and cheaper to use.</para>

    <para>To set up routing systems, first give an unique ID for each
    SMS center - or if you want to treat multiple ones completely
    identical, give them identical ID. Then use 
    <literal>preferred-smsc-id</literal> and
    <literal>denied-smsc-id</literal> to set up the routing to your
    taste. See also SMS PUSH settings ('sendsms-user' groups), below.</para>
</sect2>

<sect2>
<title>Feature checklist</title>

<para>Not all of Kannel's SMSC drivers support the same set of features.
This is because they were written at different times, and new features
are often only added to drivers that the feature author can test.</para>

<para>The table in this section is an attempt to show exactly what
features to expect from a driver, and to help identify areas where
drivers need to be updated.  Currently most of the entries are
marked as "not tested" because the table is still new.</para>

<table>
 <title>SMSC driver features</title>
 <tgroup cols="13" align="center">
  <colspec colname="first" colnum="1" align="center"/>
  <colspec colname="last" colnum="13"/>
  <spanspec spanname="feature" namest="first" nameend="last"/>
  <thead>
   <row>
     <entry>Feature</entry>
     <entry>cimd</entry>
     <entry>cimd2</entry>
     <entry>emi</entry>
     <entry>emi_x25</entry>
     <entry>smpp</entry>
     <entry>sema</entry>
     <entry>ois</entry>
     <entry>oisd</entry>
     <entry>at</entry>
     <entry>http</entry>
     <entry>fake</entry>
     <entry>smasi</entry>
   </row>
  </thead>
  <tbody>
   <row>
    <entry spanname="feature">Can use DLR</entry>
   </row>
   <row>
    <entry></entry>
    <entry>n</entry>
    <entry>y?</entry>
    <entry>y</entry>
    <entry>n</entry>
    <entry>y?</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>y</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>y</entry>
    <entry>y</entry>
   </row>
   <row>
    <entry spanname="feature">Can set DCS<footnote id="fields-to-dcs"><para>To use 
      <literal>mclass</literal>, <literal>mwi</literal>, <literal>coding</literal>
      and <literal>compress</literal> fields.</para></footnote></entry>
   </row>
   <row>
    <entry></entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>y</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>y</entry>
    <entry>y</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>?</entry>
   </row>
   <row>
    <entry spanname="feature">Can set Alt-DCS</entry>
   </row>
   <row>
    <entry></entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>y</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>y</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>?</entry>
   </row>

   <row>
    <entry spanname="feature">Can set Validity</entry>
   </row>
   <row>
    <entry></entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>y</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>y</entry>
    <entry>y</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>?</entry>
   </row>

   <row>
    <entry spanname="feature">Can set Deferred</entry>
   </row>
   <row>
    <entry></entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>y</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>?</entry>
   </row>

   <row>
    <entry spanname="feature">Can set PID</entry>
   </row>
   <row>
    <entry></entry>
    <entry>n</entry>
    <entry>y</entry>
    <entry>y</entry>
    <entry>n</entry>
    <entry>y</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>y</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>?</entry>
   </row>

	<row>
    <entry spanname="feature">Can set RPI</entry>
   </row>
   <row>
    <entry></entry>
    <entry>n</entry>
    <entry>y</entry>
    <entry>y</entry>
    <entry>n</entry>
    <entry>y</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>?</entry>
   </row>

   <row>
    <entry spanname="feature">Can send Unicode</entry>
   </row>
   <row>
    <entry></entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>y</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>y</entry>
    <entry>y</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>?</entry>
   </row>

   <row>
    <entry spanname="feature">Can send 8 bits</entry>
   </row>
   <row>
    <entry></entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>y</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>y</entry>
    <entry>y</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>y</entry>
   </row>

   <row>
    <entry spanname="feature">Correctly send GSM alphabet</entry>
   </row>
   <row>
    <entry></entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>y</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>y</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>?</entry>
   </row>

   <row>
    <entry spanname="feature">Can set binfo / tariff class</entry>
   </row>
   <row>
    <entry></entry>
    <entry>?</entry>
    <entry>y</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>n</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>?</entry>
   </row>

   <row>
    <entry spanname="feature">Can use throttling</entry>
   </row>
   <row>
    <entry></entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>y</entry>
    <entry>n</entry>
    <entry>y</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>y</entry>
    <entry>y</entry>
    <entry>y</entry>
   </row>
   
  </tbody>
 </tgroup>
</table>

<table>
 <title>SMSC driver internal features</title>
 <tgroup cols="13" align="center">
  <colspec colname="first" colnum="1" align="center"/>
  <colspec colname="last" colnum="13"/>
  <spanspec spanname="feature" namest="first" nameend="last"/>
  <thead>
   <row>
     <entry>Feature</entry>
     <entry>cimd</entry>
     <entry>cimd2</entry>
     <entry>emi2</entry>
     <entry>emi_x25</entry>
     <entry>smpp</entry>
     <entry>sema</entry>
     <entry>ois</entry>
     <entry>oisd</entry>
     <entry>at</entry>
     <entry>http</entry>
     <entry>fake</entry>
     <entry>smasi</entry>
   </row>
  </thead>
  <tbody>

   <row>
    <entry spanname="feature">Can keep idle connections alive</entry>
   </row>
   <row>
    <entry></entry>
    <entry>n</entry>
    <entry>y?</entry>
    <entry>y</entry>
    <entry>n</entry>
    <entry>y?</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>y</entry>
    <entry>y</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>y</entry>
   </row>

   <!-- Lets clean the rest of the table -->

   <row>
    <entry spanname="feature">Can send octet data without UDH</entry>
   </row>
   <row>
    <entry></entry>
    <entry>n</entry>
    <entry>y?</entry>
    <entry>y</entry>
    <entry>y?</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>y?</entry>
    <entry>y</entry>
    <entry>y</entry>
    <entry>n</entry>
    <entry>y?<footnote id="nomarkod"><para>Does not mark it as octet data</para></footnote></entry>
    <entry>?</entry>
   </row>

   <row>
    <entry spanname="feature">Can send octet data with UDH</entry>
   </row>
   <row>
    <entry></entry>
    <entry>N</entry>
    <entry>y?</entry>
    <entry>y</entry>
    <entry>y?</entry>
    <entry>y?</entry>
    <entry>n</entry>
    <entry>?</entry>
    <entry>y</entry>
    <entry>y</entry>
    <entry>y?</entry>
    <entry>y?<footnoteref linkend="nomarkod"/></entry>
    <entry>?</entry>
   </row>

   <row>
    <entry spanname="feature">Can send text messages with UDH</entry>
   </row>
   <row>
    <entry></entry>
    <entry>n</entry>
    <entry>y?</entry>
    <entry>y</entry>
    <entry>y?</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>?</entry>
    <entry>y</entry>
    <entry>y</entry>
    <entry>n</entry>
    <entry>y?</entry>
    <entry>?</entry>
   </row>

   <row>
    <entry spanname="feature">Can receive octet data without UDH</entry>
   </row>
   <row>
    <entry></entry>
    <entry>n</entry>
    <entry>y?</entry>
    <entry>y</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>y?<footnote><para>However, it looks like the <literal>sema</literal> driver can't receive <emphasis>text</emphasis> data.</para></footnote></entry>
    <entry>y?</entry>
    <entry>y</entry>
    <entry>y</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>?</entry>
   </row>

   <row>
    <entry spanname="feature">Can receive Unicode messages</entry>
   </row>
   <row>
    <entry></entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>y</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>y</entry>
    <entry>y</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>?</entry>
   </row>

   <row>
    <entry spanname="feature">Can receive octet data with UDH</entry>
   </row>
   <row>
    <entry></entry>
    <entry>n</entry>
    <entry>y?</entry>
    <entry>y</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>N</entry>
    <entry>y</entry>
    <entry>y</entry>
    <entry>y?</entry>
    <entry>y?</entry>
    <entry>?</entry>
   </row>

   <row>
    <entry spanname="feature">Can receive text messages with UDH</entry>
   </row>
   <row>
    <entry></entry>
    <entry>n</entry>
    <entry>y?</entry>
    <entry>y</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>N</entry>
    <entry>y</entry>
    <entry>y</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>?</entry>
   </row>

   <row>
    <entry spanname="feature">Correctly encodes <literal>@</literal> when sending</entry>
   </row>
   <row>
    <entry></entry>
    <entry>y?</entry>
    <entry>y?</entry>
    <entry>y</entry>
    <entry>?</entry>
    <entry>y?</entry>
    <entry>?</entry>
    <entry>y?</entry>
    <entry>y</entry>
    <entry>y</entry>
    <entry>y?</entry>
    <entry>y?</entry>
    <entry>?</entry>
   </row>

   <row>
    <entry spanname="feature">Correctly encodes <literal>&auml;</literal> when sending</entry>
   </row>
   <row>
    <entry></entry>
    <entry>y?</entry>
    <entry>y?</entry>
    <entry>y</entry>
    <entry>?</entry>
    <entry>y?</entry>
    <entry>?</entry>
    <entry>y?</entry>
    <entry>y</entry>
    <entry>y</entry>
    <entry>y?</entry>
    <entry>y?</entry>
    <entry>?</entry>
   </row>

   <row>
    <entry spanname="feature">Correctly encodes <literal>{</literal> when sending</entry>
   </row>
   <row>
    <entry></entry>
    <entry>n</entry>
    <entry>y?</entry>
    <entry>y</entry>
    <entry>?</entry>
    <entry>y?</entry>
    <entry>?</entry>
    <entry>n</entry>
    <entry>y</entry>
    <entry>N<footnote><para>Miscalculates message length</para></footnote></entry>
    <entry>y?</entry>
    <entry>y?</entry>
    <entry>?</entry>
   </row>

   <row>
    <entry spanname="feature">Can receive <literal>@</literal> in text messages</entry>
   </row>
   <row>
    <entry></entry>
    <entry>y?</entry>
    <entry>y?</entry>
    <entry>y</entry>
    <entry>?</entry>
    <entry>y?</entry>
    <entry>?</entry>
    <entry>y?</entry>
    <entry>y</entry>
    <entry>y</entry>
    <entry>y?</entry>
    <entry>y?</entry>
    <entry>?</entry>
   </row>

   <row>
    <entry spanname="feature">Can receive <literal>&auml;</literal> in text messages</entry>
   </row>
   <row>
    <entry></entry>
    <entry>y?</entry>
    <entry>y?</entry>
    <entry>y</entry>
    <entry>?</entry>
    <entry>y?</entry>
    <entry>?</entry>
    <entry>y?</entry>
    <entry>y</entry>
    <entry>y?</entry>
    <entry>y?</entry>
    <entry>y?</entry>
    <entry>?</entry>
   </row>

   <row>
    <entry spanname="feature">Can receive <literal>{</literal> in text messages</entry>
   </row>
   <row>
    <entry></entry>
    <entry>n</entry>
    <entry>y?</entry>
    <entry>y</entry>
    <entry>?</entry>
    <entry>y?</entry>
    <entry>?</entry>
    <entry>n</entry>
    <entry>y</entry>
    <entry>y?</entry>
    <entry>y?</entry>
    <entry>y?</entry>
    <entry>?</entry>
   </row>

   <row>
    <entry spanname="feature">Can shut down idle connections</entry>
   </row>
   <row>
    <entry></entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>y</entry>
    <entry>n</entry>
    <entry>n</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>n</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>?</entry>
    <entry>?</entry>
   </row>

  </tbody>
 </tgroup>
</table>

<informaltable frame="none">
 <tgroup cols="2">
  <colspec colnum="1" align="left"/>
  <thead>
   <row><entry>Symbol</entry><entry>Meaning</entry></row>
  </thead>

  <tbody>

   <row>
    <entry>?</entry>
    <entry>not yet investigated</entry>
   </row>
 
   <row>
    <entry>y</entry>
    <entry>driver has this feature, and it has been tested</entry>
   </row>
  
   <row>
    <entry>y?</entry>
    <entry>driver probably has this feature, has not been tested</entry>
   </row>
  
   <row>
    <entry>n</entry>
    <entry>driver does not have this feature</entry>
   </row>
  
   <row>
    <entry>N</entry>
    <entry>driver claims to have this feature but it doesn't work</entry>
   </row>

   <row>
    <entry>-</entry>
    <entry>feature is not applicable for this driver</entry>
   </row>

  </tbody>

 </tgroup>
</informaltable>

</sect2>
</sect1>


<sect1>
<title>External delivery report (DLR) storage</title>

   <para>Delivery reports are supported by default internally, which
	means all DLRs are stored in the memory of the bearerbox process.
	This is problematic if bearerbox crashes or you take the process
	down in a controlled way, but there are still DLRs open. Therefore
	you may use external DLR storage places, i.e. a MySQL database.
	</para>
	<para>Following are the supported DLR storage types and how to use
	them:</para>

	<sect2>
	<title>Internal DLR storage</title>

   <para>This is the default way in handling DLRs and does not
	require any special configuration. In order to configure bearerbox
	to use internal DLR storage use <literal>dlr-storage = internal</literal>
	in the <literal>core</literal> group.
	</para>

   </sect2>

	<sect2>
	<title>MySQL DLR storage</title>
	<para>To store DLR information into a MySQL database you may use the
	<literal>dlr-storage = mysql</literal> configuration directive in the
	<literal>core</literal> group.
	</para>
	<para>In addition to that you must have a <literal>dlr-db</literal>
	group defined that specifies the table field names that are used to the
	DLR attributes and a <literal>mysql-connection</literal> group that
	defines the connection to the MySQL server itself.
	</para>
	<para>Here is the example configuration from
	<literal>doc/examples/dlr-mysql.conf</literal>:

<programlisting>
group = mysql-connection
id = mydlr
host = localhost
username = foo
password = bar
database = dlr
max-connections = 1

group = dlr-db
id = mydlr
table = dlr
field-smsc = smsc
field-timestamp = ts
field-destination = destination
field-source = source
field-service = service
field-url = url
field-mask = mask
field-status = status
field-boxc-id = boxc
</programlisting>

	</para>

<sect3>
<title>MySQL connection configuration</title>

   <para>For several reasons external storage may be required to 
	handle dynamical issues, i.e. DLRs, sms-service, sendsms-user, 
	ota-setting, ota-bookmark definitions and so on. To define a 
	MySQL database connection you simple need to specify a
	<literal>mysql-connection</literal> group as follows:
	</para>
	
 <table frame="none">
  <title>MySQL Connection Group Variables</title>
  <tgroup cols="3">
  <thead>
   <row>
     <entry>Variable</entry>
     <entry>Value</entry>
     <entry>Description</entry>
   </row>
  </thead>
  <tbody>
   <row><entry><literal>group</literal></entry>
     <entry><literal>mysql-connection</literal></entry>
     <entry valign="bottom">
       This is a mandatory variable
     </entry></row>

   <row><entry><literal>id (m)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
	     An optional name or id to identify this MySQL connection
		  for internal reference with other MySQL related configuration
		  groups. Any string is acceptable, but semicolon ';' may cause
		  problems, so avoid it and any other special non-alphabet characters.
     </entry></row>

   <row><entry><literal>host (m)</literal></entry>
     <entry>hostname or IP</entry>
     <entry valign="bottom">
        Hostname or IP of a server running a MySQL database to connect to.
     </entry></row>

    <row><entry><literal>username (m)</literal></entry>
     <entry>username</entry>
     <entry valign="bottom">
        User name for connecting to MySQL database.
     </entry></row>

    <row><entry><literal>password (m)</literal></entry>
     <entry>password</entry>
     <entry valign="bottom">
        Password for connecting to MySQL database.
     </entry></row>

    <row><entry><literal>database (m)</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
        Name of database in MySQL database server to connect to.
     </entry></row>

    <row><entry><literal>max-connections</literal></entry>
     <entry>integer</entry>
     <entry valign="bottom">
        How many connections should be opened to the given database.
        This is used for database pool.
     </entry></row>

  </tbody>
  </tgroup>
 </table>

  <para>A sample 'mysql-connection' group:

<programlisting>
group = mysql-connection
id = dlr-db
host = localhost
username = foo
password = bar
database = dlr
max-connections = 1
</programlisting>

  </para>
  <para>In case you use different MySQL connections for several storage
  issues, i.e. one for DLR and another different one for sms-service you
  may use the <literal>include</literal> configuration statement to extract
  the MySQL related configuration groups to a separate <literal>mysql.conf
  </literal> file.
  </para>

</sect3>
	</sect2>

	<sect2>
	<title>LibSDB DLR storage</title>
	<para>To store DLR information into a LibSDB resource (which is an
	abstraction	of a real database) you may use the
	<literal>dlr-storage = sdb</literal> configuration directive in the
	<literal>core</literal> group.
	</para>
	<para>In addition to that you must have a <literal>dlr-db</literal>
	group defined that specifies the table field names that are used to the
	DLR attributes and a <literal>sdb-connection</literal> group that
	defines the LibSDB resource itself.
	</para>
	<para>Here is the example configuration from
	<literal>doc/examples/dlr-sdb.conf</literal> using a PostgreSQL resource:

<programlisting>
group = sdb-connection
id = pgdlr
url = "postgres:host=localhost:db=myapp:port=1234"
max-connections = 1

group = dlr-db
id = pgdlr
table = dlr
field-smsc = smsc
field-timestamp = ts
field-destination = destination
field-source = source
field-service = service
field-url = url
field-mask = mask
field-status = status
field-boxc-id = boxc
</programlisting>

	</para>
  <para>Beware that you have the DB support build in your LibSDB
  installation when trying to use a specific DB type within the URL.
  </para>

	</sect2>

	<sect2>
	<title>Oracle 8i/9i DLR storage</title>
	<para>To store DLR information into a Oracle database you may use the
	<literal>dlr-storage = oracle</literal> configuration directive in the
	<literal>core</literal> group.
	</para>
	<para>In addition to that you must have a <literal>dlr-db</literal>
	group defined that specifies the table field names that are used to the
	DLR attributes and a <literal>oracle-connection</literal> group that
	defines the connection to the Oracle server itself.
	</para>
	<para>Here is the example configuration from
	<literal>doc/examples/dlr-oracle.conf</literal>:

<programlisting>
group = oracle-connection
id = mydlr
username = foo
password = bar
tnsname = dlr
max-connections = 1

group = dlr-db
id = mydlr
table = dlr
field-smsc = smsc
field-timestamp = ts
field-destination = destination
field-source = source
field-service = service
field-url = url
field-mask = mask
field-status = status
field-boxc-id = boxc
</programlisting>

	</para>

	</sect2>

	<sect2>
	<title>PostgreSQL DLR storage</title>
	<para>To store DLR information into a PostgreSQL database you may use the
	<literal>dlr-storage = pgsql</literal> configuration directive in the
	<literal>core</literal> group.
	</para>
	<para>In addition to that you must have a <literal>dlr-db</literal>
	group defined that specifies the table field names that are used to the
	DLR attributes and a <literal>pgsql-connection</literal> group that
	defines the connection to the PostgreSQL server itself.
	</para>
	<para>Here is the example configuration:

<programlisting>
group = pgsql-connection
id = mydlr
host = myhost.com
username = foo
password = bar
database = dlr
max-connections = 1

group = dlr-db
id = mydlr
table = dlr
field-smsc = smsc
field-timestamp = ts
field-destination = destination
field-source = source
field-service = service
field-url = url
field-mask = mask
field-status = status
field-boxc-id = boxc
</programlisting>

	</para>

	</sect2>

    <sect2>
    <title>MS-SQL/Sybase DLR storage</title>
    <para>To store DLR information into a MS-SQL or Sybase (via FreeTDS)
    database you may use the <literal>dlr-storage = mssql</literal>
    configuration directive in the <literal>core</literal> group.
    </para>
    <para>In addition to that you must have a <literal>dlr-db</literal>
    group defined that specifies the table field names that are used to the
    DLR attributes and a <literal>mssql-connection</literal> group that
    defines the connection to the MS-SQL or Sybase server itself.
    </para>
    <para>Please note that the <literal>server</literal> configuration directive
    must match the corresponding <literal>[section]</literal> on
    <literal>freetds.conf</literal></para>
    <para>Here is the example configuration:

<programlisting>
group = mssql-connection
id = msdlr
server = myservername
username = foo
password = bar
database = dlr
max-connections = 1

group = dlr-db
id = msdlr
table = dlr
field-smsc = smsc
field-timestamp = ts
field-destination = destination
field-source = source
field-service = service
field-url = url
field-mask = mask
field-status = status
field-boxc-id = boxc
</programlisting>

    </para>

    </sect2>

	<sect2>
	<title>SQLite3 DLR storage</title>
	<para>To store DLR information into a SQLite3 database you may use the
	<literal>dlr-storage = sqlite3</literal> configuration directive in the
	<literal>core</literal> group.
	</para>
	<para>In addition to that you must have a <literal>dlr-db</literal>
	group defined that specifies the table field names that are used to the
	DLR attributes and a <literal>sqlite3-connection</literal> group that
	defines the connection to the SQLite3 database itself.
	</para>
	<para>Here is the example configuration:

<programlisting>
group = sqlite3-connection
id = mydlr
database = /path/to/file
max-connections = 1

group = dlr-db
id = mydlr
table = dlr
field-smsc = smsc
field-timestamp = ts
field-destination = destination
field-source = source
field-service = service
field-url = url
field-mask = mask
field-status = status
field-boxc-id = boxc
</programlisting>

	</para>

	</sect2>

    <sect2>
        <title>Redis DLR storage</title>
        <para>To store DLR information using the Redis (http://www.redis.io) keystore, you should set the
            <literal>dlr-storage = redis</literal> configuration directive in the
            <literal>core</literal> group.
        </para>
        <para>In addition, you must have a <literal>dlr-db</literal> group defined that specifies 
            the key and hash field names that are used to store the DLR attributes and a 
            <literal>redis-connection</literal> group that defines the connection to the Redis server.
        </para>
        <para>
            Since Redis is a keystore and not a SQL database, keys and not tables are used to store 
            DLR attributes. For ease of configuration, the same configuration parameters in the <literal>dlr-db</literal> 
            group that are used to define SQL tables in other DLR storage engines are used to configure
            key names in Redis. DLRs are stored as Redis hash keys with a separate key 
            for each DLR. Key names are in the format 
            <literal>&lt;table&gt;:&lt;smsc&gt;:&lt;timestamp&gt;</literal>. Some SMSCs also append the 
            destination to the DLR keyname resulting DLR keynames in the format 
            <literal>&lt;table&gt;:&lt;smsc&gt;:&lt;timestamp&gt;:&lt;destination&gt;</literal>. You can
            specify the <literal>&lt;table&gt;</literal> portion of the keyname by specifying the
            <literal>table</literal> value in the <literal>dlr-db</literal> group.</para>
        <para>
            In addition to one key per DLR, an additional key with a name in the format
            <literal>&lt;table&gt;:Count</literal> is created to maintain a count of the total
            number of outstanding DLRs.
        </para>
        
        <para>Here is the example configuration from
            <literal>doc/examples/dlr-redis.conf</literal>:
            
            <programlisting>
                group = redis-connection
                id = mydlr
                host = localhost
                port = 6379
                #password = foo
                database = 2
                idle-timeout = 3600
                max-connections = 1
                
                group = dlr-db
                id = mydlr
                ttl = 604800
                table = dlr
                field-smsc = smsc
                field-timestamp = ts
                field-destination = destination
                field-source = source
                field-service = service
                field-url = url
                field-mask = mask
                field-status = status
                field-boxc-id = boxc
            </programlisting>
            
        </para>
        
        <sect3>
            <title>Redis connection configuration</title>
            
            <para>To define a Redis connection you need to specify a
                <literal>redis-connection</literal> group as follows:
            </para>
            
            <table frame="none">
                <title>Redis Connection Group Variables</title>
                <tgroup cols="3">
                    <thead>
                        <row>
                            <entry>Variable</entry>
                            <entry>Value</entry>
                            <entry>Description</entry>
                        </row>
                    </thead>
                    <tbody>
                        <row><entry><literal>group</literal></entry>
                            <entry><literal>redis-connection</literal></entry>
                            <entry valign="bottom">
                                This is a mandatory variable
                            </entry></row>
                        
                        <row><entry><literal>id (m)</literal></entry>
                            <entry><literal>string</literal></entry>
                            <entry valign="bottom">
                                An optional name or id to identify this Redis connection
                                for internal reference with other Redis related configuration
                                groups. Any string is acceptable, but semicolon ';' may cause
                                problems, so avoid it and any other special non-alphabet characters.
                            </entry></row>
                        
                        <row><entry><literal>host (m)</literal></entry>
                            <entry>hostname or IP</entry>
                            <entry valign="bottom">
                                Hostname or IP of a server running Redis to connect to.
                            </entry></row>
                        
                        <row><entry><literal>password</literal></entry>
                            <entry>password</entry>
                            <entry valign="bottom">
                                If the Redis server is secured with a password in redis.conf, it must be 
                                specified here. By default, Redis servers are unsecured and in that case,
                                this parameter may be ommitted.</entry></row>
                        
                        <row><entry><literal>database</literal></entry>
                            <entry>integer</entry>
                            <entry valign="bottom">
                                The numeric ID (0-15) of the Redis database to use. Ideally this database
                                should be dedicated to storing Redis DLRs since a separate key wil be created
                                for each DLR. If this variable is ommitted, the default database (0) will be used.
                            </entry></row>
                        
                        <row><entry><literal>idle-timeout</literal></entry>
                            <entry>integer</entry>
                            <entry valign="bottom">
                                The number of seconds that Redis should hold the connection open without any
                                traffic. Some Redis servers are configured to disconnect idle clients very
                                quickly, and if this is the case you should set this value to something more
                                reasonable. If ommitted, the Redis server-wide timeout from redis.conf will 
                                apply.
                            </entry></row>
                        
                        <row><entry><literal>max-connections</literal></entry>
                            <entry>integer</entry>
                            <entry valign="bottom">
                                How many connections should be opened to the Redis server.
                            </entry></row>
                        
                    </tbody>
                </tgroup>
            </table>
        </sect3>
	</sect2>

    <sect2>
        <title>Cassandra DLR storage</title>
        <para>To store DLR information using Cassandra (http://cassandra.apache.org/) database, you should set the
            <literal>dlr-storage = cassandra</literal> configuration directive in the
            <literal>core</literal> group.
        </para>
        <para>In addition, you must have a <literal>dlr-db</literal> group defined that specifies 
            the field names that are used to store the DLR attributes and a 
            <literal>cassandra-connection</literal> group that defines the connection to Cassandra.
        </para>
        <para>Here is the example configuration from
            <literal>doc/examples/dlr-cassandra.conf</literal>:
            
            <programlisting>
                group = cassandra-connection
                id = mydlr
                host = localhost
                #username = foo
                #password = bar
                #database = dlr
                max-connections = 1
                
                group = dlr-db
                id = mydlr
                ttl = 604800
                table = dlr
                field-smsc = smsc
                field-timestamp = ts
                field-destination = destination
                field-source = source
                field-service = service
                field-url = url
                field-mask = mask
                field-status = status
                field-boxc-id = boxc
            </programlisting>
            
        </para>
    </sect2>
    
        <sect2>
	<title>DLR database field configuration</title>
	<para>For external database storage of DLR information in relational
	database management systems (RDBMS) you will have to specify which table
	field are used to represent the stored data. This is done via the
	<literal>dlr-db</literal> group as follows:
	</para>

 <table frame="none">
  <title>DLR Database Field Configuration Group Variables</title>
  <tgroup cols="3">
  <thead>
   <row>
     <entry>Variable</entry>
     <entry>Value</entry>
     <entry>Description</entry>
   </row>
  </thead>
  <tbody>
   <row><entry><literal>group</literal></entry>
     <entry><literal>dlr-db</literal></entry>
     <entry valign="bottom">
       This is a mandatory variable
     </entry></row>

   <row><entry><literal>id (m)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
	     An id to identify which external connection should be used for
 		  DLR storage. Any string is acceptable, but semicolon ';' may cause
		  problems, so avoid it and any other special non-alphabet characters.
     </entry></row>

   <row><entry><literal>table (m)</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
        The name of the table that is used to store the DLR information.
     </entry></row>

   <row><entry><literal>field-smsc (m)</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
        The table field that is used for the smsc data.
     </entry></row>

   <row><entry><literal>field-timestamp (m)</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
        The table field that is used for the timestamp data.
     </entry></row>

   <row><entry><literal>field-destination (m)</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
        The table field that is used for the destination number data.
     </entry></row>

   <row><entry><literal>field-source (m)</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
        The table field that is used for the source number data.
     </entry></row>

   <row><entry><literal>field-service (m)</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
        The table field that is used for the service username data.
     </entry></row>

   <row><entry><literal>field-url (m)</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
        The table field that is used for the DLR URL which is triggered
		  when the DLR for this message arrives from the SMSC.
     </entry></row>

   <row><entry><literal>field-mask (m)</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
        The table field that is used for the DLR mask that has been set
		  for a message.
     </entry></row>

   <row><entry><literal>field-status (m)</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
        The table field that is used to reflect the status of the DLR
		  for a specific message.
     </entry></row>

   <row><entry><literal>field-boxc-id (m)</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
        The table field that is used to store the smsbox connection id
		  that has passed the message for delivery. This is required in 
		  cases you want to guarantee that DLR messages are routed back to
		  the same smsbox conn instance. This is done via the smsbox routing.
		  If you don't use smsbox routing simply add this field to your
		  database table and keep it empty.
     </entry></row>

  </tbody>
  </tgroup>
 </table>

  <para>A sample 'dlr-db' group:

<programlisting>
group = dlr-db
id = dlr-db
table = dlr
field-smsc = smsc
field-timestamp = ts
field-source = source
field-destination = destination
field-service = service
field-url = url
field-mask = mask
field-status = status
field-boxc-id = boxc
</programlisting>

  </para>
  <para>Beware that all variables in this group are mandatory, so you
  have to specify all fields to enable bearerbox to know how to store
  and retrieve the DLR information from the external storage spaces.
  </para>

	</sect2>

</sect1>	  



<sect1>
<title>SMSBox configuration</title>

<sect2>
<title>Smsbox group</title>

  <para>You must define an 'smsbox' group into the configuration file to be
  able to use SMS Kannel. The simplest working 'smsbox' group looks 
   like this:

<programlisting>
group = smsbox
bearerbox-host = localhost
</programlisting>

   ...but you would most probably want to define 'sendsms-port' to be
   able to use SMS push.</para>

   <para>SMSBox inherits from core the following fields:
<programlisting>
smsbox-port
http-proxy-port
http-proxy-host
http-proxy-username
http-proxy-password
http-proxy-exceptions
http-proxy-exceptions-regex
ssl-certkey-file
</programlisting>
   </para>

 <table frame="none">
  <title>Smsbox Group Variables</title>
  <tgroup cols="3">
  <thead>
   <row>
     <entry>Variable</entry>
     <entry>Value</entry>
     <entry>Description</entry>
   </row>
  </thead>
  <tbody>
   <row><entry><literal>group (m)</literal></entry>
     <entry><literal>smsbox</literal></entry>
     <entry valign="bottom">
       This is a mandatory variable
     </entry></row>

   <row><entry><literal>bearerbox-host (m)</literal></entry>
     <entry><literal>hostname</literal></entry>
     <entry valign="bottom">
        The machine in which the bearerbox is. 
     </entry></row>

   <row><entry><literal>bearerbox-port (o)</literal></entry>
     <entry>port-number</entry>
     <entry valign="bottom">
        This is the port number to which smsbox will connect bearerbox.
        If not given <literal>smsbox-port</literal> from core group used.
     </entry></row>
	  
   <row><entry><literal>bearerbox-port-ssl (o)</literal></entry>
     <entry>bool</entry>
     <entry valign="bottom">
         If set to true, the smsbox connection will be SSL-enabled.
	 Your smsbox will connect using SSL to the bearerbox
	 then. This is used to secure communication between bearerbox
	 and smsboxes in case they are in separate networks operated and
	 the TCP communication is not secured on a lower network layer.
         If not given <literal>smsbox-port-ssl</literal> from core group used.
     </entry></row>

   <row><entry><literal>smsbox-id (o)</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
        Optional smsbox instance identifier. This is used to 
 		  identify an smsbox connected to an bearerbox for the purpose
		  of having smsbox specific routing inside bearerbox. So if you
		  you own boxes that do pass messages into bearerbox for delivery
		  you may want that answers to those are routed back to your 
		  specific smsbox instance, i.e. SMPP or EMI proxying boxes.
     </entry></row>

     <row><entry><literal>sendsms-interface (o)</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
        If this is set, the sendsms HTTP interface will only bind
        to a specified address. For example: "127.0.0.1".
     </entry></row>

    <row><entry><literal>sendsms-port (c)</literal></entry>
     <entry>port-number</entry>
     <entry valign="bottom">
        The port in which any sendsms HTTP requests are done. As with
        other ports in Kannel, can be set as anything desired.
     </entry></row>

	 <row><entry><literal>sendsms-port-ssl (o)</literal></entry>
     <entry>bool</entry>
     <entry valign="bottom">
        If set to true, the sendsms HTTP interface will use a
		  SSL-enabled HTTP server with the specified 
		  ssl-server-cert-file and ssl-server-key-file from the 
		  core group. Defaults to "no".
     </entry></row>

	 <row><entry><literal>sendsms-url (o)</literal></entry>
     <entry>url</entry>
     <entry valign="bottom">
	     URL locating the sendsms service. Defaults to <literal>
        /cgi-bin/sendsms</literal>.
     </entry></row>

	 <row><entry><literal>sendota-url (o)</literal></entry>
     <entry>url</entry>
     <entry valign="bottom">
	     URL locating the sendota service. Defaults to <literal>
        /cgi-bin/sendota</literal>.
     </entry></row>
	
    <row><entry><literal>immediate-sendsms-reply (o)</literal></entry>
     <entry>boolean</entry>
     <entry valign="bottom">
        This is a backward compatibility flag: when set, Kannel will 
        immediately answer to any sendsms requests, without knowing if
        the bearerbox will ever accept the message. If set to false
       (default), smsbox will not reply to HTTP request until the bearerbox
        has received the message.
     </entry></row>

    <row><entry><literal>sendsms-chars</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
        Only these characters are allowed in 'to' field when send-SMS
        service is requested via HTTP. Naturally, you should allow 
        at least <literal>0123456789</literal>. The
        <emphasis>space</emphasis> character (' ') has special
        meaning: it is used to separate multiple phone numbers from
        each other in multi-send. To disable this feature, do not have
        it as an accepted character. If this variable is
        not set, the default set <literal>"0123456789&nbsp;+-"</literal> is used.
     </entry></row>

    <row><entry><literal>global-sender</literal></entry>
     <entry>phone-number</entry>
     <entry valign="bottom">
        If set, all sendsms originators are set as these before
        proceeding. Note that in a case of most SMS centers you
        cannot set the sender number, but it is automatically set
        as the number of SMSC
     </entry></row>

    <row><entry><literal>log-file</literal></entry>
     <entry>filename</entry>
     <entry morerows="2" valign="bottom">
       As with the bearerbox 'core' group. Access-log is used to store
       information about MO and send-sms requests. Can be named same as the 
       'main' access-log (in 'core' group).
     </entry></row>

    <row><entry><literal>log-level</literal></entry>
     <entry>number 0..5</entry></row>

    <row><entry><literal>access-log</literal></entry>
     <entry>filename</entry></row>

    <row><entry><literal>syslog-level</literal></entry>
     <entry>number</entry>
     <entry valign="bottom">
	 Messages of this log level or higher will also be
	 sent to syslog, the UNIX system log daemon. If not explicitly
         set with <literal>syslog-facility</literal>, it logs under the
         'daemon' category. The default is not to use syslog, and you can
         set that explicitly by setting <literal>syslog-level</literal>
	 to 'none'.
     </entry></row>

    <row><entry><literal>syslog-facility</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
         The syslog facility to send the syslog entries to. The
         default is 'daemon'.
     </entry></row>

    <row><entry><literal>white-list</literal></entry>
     <entry>URL</entry>
     <entry valign="bottom">
        Load a list of accepted destinations of SMS messages. If a 
	destination of an SMS message is not in this list, any message 
	received from the HTTP interface is rejected. See notes of phone 
	number format from numhash.h header file. 
     </entry></row>

    <row><entry><literal>black-list</literal></entry>
     <entry>URL</entry>
     <entry valign="bottom">
        As white-list, but SMS messages to these numbers are
        automatically discarded
     </entry></row>

    <row><entry><literal>reply-couldnotfetch</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
        If set, replaces the SMS message sent back to user when Kannel
	could not fetch content. 
	Defaults to <literal>Could not fetch content, sorry.</literal>.
     </entry></row>

    <row><entry><literal>reply-couldnotrepresent</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
        If set, replaces the SMS message sent back when Kannel could not 
	represent the result as a SMS message. 
	Defaults to <literal>Result could not be represented as an 
	SMS message.</literal>.
     </entry></row>

    <row><entry><literal>reply-requestfailed</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
        If set, replaces the SMS message sent back when Kannel could not 
	contact http service.
	Defaults to <literal>Request Failed</literal>.
     </entry></row>

    <row><entry><literal>reply-emptymessage</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
        If set, replaces the SMS message sent back when message is
	empty. Set to "" to enable empty messages.
	Defaults to <literal>&lt;Empty reply from service provider&gt;</literal>.
     </entry></row>

    <row><entry><literal>mo-recode</literal></entry>
     <entry>boolean</entry>
     <entry valign="bottom">
        If enabled, Kannel will try to convert received messages with UCS-2 charset
	to WINDOWS-1252 or to UTF-8, simplifying external servers jobs. If Kannel is 
	able to recode message, it will also change <literal>coding</literal> to 
	<literal>7 bits</literal> and <literal>charset</literal> to 
	<literal>windows-1252</literal> or to <literal>utf-8</literal>. 
     </entry></row>

    <row><entry><literal>http-request-retry</literal></entry>
     <entry>integer</entry>
     <entry valign="bottom">
        If set, specifies how many retries should be performed for failing
        HTTP requests of sms-services. Defaults to 0, which means no retries
        should be performed and hence no HTTP request queuing is done.
     </entry></row>

	 <row><entry><literal>http-queue-delay</literal></entry>
     <entry>integer</entry>
     <entry valign="bottom">
        If set, specifies how many seconds should pass within the HTTP queuing
        thread for retrying a failed HTTP request. Defaults to 10 sec. and is
        only obeyed if <literal>http-request-retry</literal> is set to a 
        non-zero value.
     </entry></row>

     <row><entry><literal>white-list-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
        Defines the set of accepted destinations of SMS messages. If a 
	destination of an SMS message is not in this set, any message 
	received from the HTTP interface is rejected. 
        See section on <xref linkend="regular-expressions"/> for details.
        </entry>   
     </row>
     <row><entry><literal>black-list-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
        As white-list-regex, but SMS messages to numbers within in this set are
        automatically discarded.
        See section on <xref linkend="regular-expressions"/> for details.
        </entry>   
     </row>
     <row><entry><literal>max-pending-requests</literal></entry>   
        <entry>number of messages</entry>
        <entry valign="bottom">
        Maximum number of pending MO or DLR messages that are handled in parallel.
        (Default: 512)
        </entry>
     </row>

    <row><entry><literal>http-timeout</literal></entry>
     <entry>seconds</entry>
     <entry valign="bottom">
        Sets socket timeout in seconds for outgoing client http
        connections. Optional. Defaults to 240 seconds.
     </entry></row>

     <row><entry><literal>sms-length</literal></entry>
        <entry>number</entry>
        <entry valign="bottom">
        Maximum allowed number of characters for a single SMS in smsbox.
        If this maximum exceeds Kannel will split SMS into multiparts.
        Default: 140
     </entry></row>

  </tbody>
  </tgroup>
 </table>

   <para>A typical 'smsbox' group could be something like this:

<programlisting>
group = smsbox
bearerbox-host = localhost
sendsms-port = 13131
sendsms-chars = "0123456789 "
global-sender = 123456
access-log = "kannel.access"
log-file = "smsbox.log"
log-level = 0
</programlisting>
 </para>


</sect2>

<sect2>
<title>Smsbox routing inside bearerbox</title>

  <para>The communication link between bearerbox and smsbox has been
  designed for the purpose of load-balancing via random assignment. 
  Which means, bearerbox holds all smsc connections and passes inbound
  message to one of the connected smsboxes. So you have a determined route
  for outbound messages, but no determined route for inbound messages.
  </para>

  <para>The smsbox routing solves this for the inbound direction. In
  certain scenarios you want that bearerbox to know to which smsbox
  instance it should pass messages. I.e. if you implement own boxes
  that pass messages to bearerbox and expect to receive messages defined
  on certain rules, like receiver number or smsc-id. This is the case
  for EMI/UCP and SMPP proxies that can be written easily using smsbox
  routing facility.
  </para>

  <para>If you box handles the SMPP server specific communication to your
  EMSEs, and if an client send a submit_sm PDU, the box would transform
  the message into Kannel message representation and inject the message to
  bearerbox as if it would be an smsbox. As you want to assign your clients
  shortcodes for certain networks or route any inbound traffic from a certain
  smsc link connected to bearerbox, you need to separate in the scope of 
  bearerbox where the inbound message will be going to. An example may
  look like this:

<programlisting>
group = smsbox
...
smsbox-id = mysmsc
...

group = smsbox-route
smsbox-id = mysmsc
shortcode = "1111;2222;3333"
</programlisting>

	Which means any inbound message with receiver number 1111, 2222 or 3333
	will be delivered to the smsbox instance that has identified itself
	via the id "mysmsc" to bearerbox. Using this routing the smsbox instance
	(which may be an EMI/UCP or SMPP proxy) is able to send a deliver_sm PDU. 
	Another example showing the combination use of criteria smsc-id and 
	shortcode looks like this:

<programlisting>
group = smsbox
...
smsbox-id = mysmsc
...

group = smsbox-route
smsbox-id = mysmsc
smsc-id = "A;B;C"
shortcode = "1111;2222"
</programlisting>

	Which means any inbound message with receiver number 1111 or 2222 that have
	been originating from the smsc-id connections A, B or C will be delivered
	to the via the id "mysmsc" to bearerbox.
	</para>

   <para>smsbox-route inherits from core the following fields:
   </para>

 <table frame="none">
  <title>Smsbox-route Group Variables</title>
  <tgroup cols="3">
  <thead>
   <row>
     <entry>Variable</entry>
     <entry>Value</entry>
     <entry>Description</entry>
   </row>
  </thead>
  <tbody>
   <row><entry><literal>group (m)</literal></entry>
     <entry><literal>smsbox-route</literal></entry>
     <entry valign="bottom">
       This is a mandatory variable
     </entry></row>

   <row><entry><literal>smsbox-id (m)</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
        Defines for which smsbox instance the routing rules do apply.
     </entry></row>

	 <row><entry><literal>smsc-id</literal></entry>
     <entry>word-list</entry>
     <entry valign="bottom">
        If set, specifies from which smsc-ids all inbound messages should
		  be routed to this smsbox instance. List contains smsc-ids separated
		  by semicolon (";"). This rule may be used to pull any smsc specific
		  message stream to an smsbox instance. If used in combination with 
		  config directive shortcode, then this is another matching criteria
		  for the routing decission.
     </entry></row>

	 <row><entry><literal>shortcode</literal></entry>
     <entry>number-list</entry>
     <entry valign="bottom">
        If set, specifies which receiver numbers for inbound messages should
		  be routed to this smsbox instance. List contains numbers separated
		  by semicolon (";"). This rule may be used to pull receiver number
		  specific message streams to an smsbox instance. If used in combination
		  with config directive smsc-id, then only messages originating from
		  the connections in the smsc-id are matched against the shortcode list.
     </entry></row>

  </tbody>
  </tgroup>
 </table>

</sect2>

<sect2>
<title>SMS-service configurations</title>

    <para>Now that you have an SMS center connection to send and
    receive SMS messages you need to define services for incoming
    messages. This is done via 'sms-service' configuration
    groups.</para>

    <para>These groups define SMS services in the smsbox, so they are only
    used by the smsbox. Each service is recognized from the first word
    in an SMS message and by the number of arguments accepted by the
    service configuration (unless <literal>catch-all</literal>
    configuration variable is used).  By adding a username and password in the URL
    in the following manner
    "http://luser:password@host.domain:port/path?query" we can perform
    HTTP Basic authentication.</para>

    <para>The simplest service group looks like this:

<programlisting>
group = sms-service
keyword = www
get-url = "http://%S"
</programlisting>
     
     This service grabs any SMS with two words and 'www' as the first
     word, and then does an HTTP request to an URL which is taken from
     the rest of the message. Any result is sent back to the phone
     (or requester), but is truncated to the 160 characters that will
     fit into an SMS message, naturally.</para>

     <para>Service group <literal>default</literal> has a special
     meaning: if the incoming message is not routed to any other
     service, <literal>default</literal> 'sms-service' group is used.
     You should always define <literal>default</literal> service.</para>

     <para>Service group <literal>black-list</literal> has a special
     meaning: if the incoming message is in service's black-list, this
     service is used to reply to user. If unset, message will be 
     discarded.</para>

 <table frame="none">
  <title>SMS-Service Group Variables</title>
  <tgroup cols="3">
  <thead>
   <row>
     <entry>Variable</entry>
     <entry>Value</entry>
     <entry>Description</entry>
   </row>
  </thead>
  <tbody>
   <row><entry><literal>group (m)</literal></entry>
     <entry><literal>sms-service</literal></entry>
     <entry valign="bottom">
       This is a mandatory variable
     </entry></row>

   <row><entry><literal>keyword (m)</literal></entry>
     <entry>word</entry>
     <entry valign="bottom">
        Services are identified by the first word in the SMS. Each
        `%s' in the URL corresponds to one word in the SMS message.
         Words are separated with spaces. A keyword is matched only if
         the number of words in the SMS message is the same as the
         number of `%s' fields in the URL. This allows you to
        configure the gateway to use different URLs for the same
        keyword depending on the number of words the SMS message
        contains. The keyword is case insensitive, which means you don't
        have to use aliases to handle different cased versions of your keyword.
     </entry></row>

   <row><entry><literal>keyword-regex</literal></entry>
     <entry>POSIX regular expression</entry>
     <entry valign="bottom">
     This field may be used to enable service-selection based on a regular expression.
     You can define either keyword or keyword-regex in configuration, but not both in
     the same sms-service. keyword-regex is case sensitive.
     See section on <xref linkend="regular-expressions"/> for details.
   </entry></row>

   <row><entry><literal>aliases</literal></entry>
     <entry>word-list</entry>
     <entry valign="bottom">
        If the service has aliases, they are listed as a list with 
        each entry separated with a semicolon (';'). Aliases are case
        insensitive just like keyword.

     </entry></row>

   <row><entry><literal>name</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
        Optional name to identify the service in logs. If unset,
	<literal>keyword</literal> is used.
     </entry></row>

   <row><entry><literal>get-url (c)</literal></entry>
     <entry>URL</entry>
     <entry valign="bottom">
        Requested URL. The url can include a list of parameters, which are
        parsed before the url is fetched. See below for these
        parameters. Also works with plain 'url'

     </entry></row>

   <row><entry><literal>post-url (c)</literal></entry>
     <entry>URL</entry>
     <entry valign="bottom">
        Requested URL. As above, but request is done as POST, not GET.
	Always matches the keyword, regardless of pattern matching.
	See notes on POST other where.

     </entry></row>


   <row><entry><literal>post-xml (c)</literal></entry>
     <entry>URL</entry>
     <entry valign="bottom">
        Requested URL. As above, but request is done as XML POST.
	Always matches the keyword, regardless of pattern matching.
	See notes on POST other where and <xref
	    linkend="postxml" endterm="postxml.title"/>
     </entry></row>

   <row><entry><literal>file (c)</literal></entry>
     <entry>filename</entry>
     <entry valign="bottom">
        File read from a local disc. Use this variable only if no
        <literal>url</literal> is set. All escape codes (parameters)
        in <literal>url</literal> are supported in filename. 
        The last character of the file (usually linefeed) is removed.

     </entry></row>

   <row><entry><literal>text (c)</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
        Predefined text answer. Only if there is neither <literal>url</literal> nor 
        <literal>file</literal> set. Escape codes (parameters) are
        usable here, too.

     </entry></row>

   <row><entry><literal>exec (c)</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
        Executes the given shell command as the current UID of the
		  running smsbox user and returns the output to 
		  <literal>stdout</literal> as reply.
		  Escape codes (parameters) are
        usable here, too. BEWARE: You may harm your system if you use
		  this sms-service type without serious caution! Make sure anyone
		  who is allowed to use these kind of services is checked using 
		  white/black-list mechanisms for security reasons.
     </entry></row>

   <row><entry><literal>accepted-smsc</literal></entry>
     <entry>id-list</entry>
     <entry valign="bottom">
        Accept ONLY SMS messages arriving from SMSC with matching ID.
        <footnote><para>Even if this service is denied,
	Kannel still searches for other service which accepts the message,
	or default service.</para></footnote>
        Separate multiple entries with ';'. For example, if 
         <literal>accepted-smsc</literal>
        is "RL;SON", accept messages which originate from SMSC with
        ID set as 'RL' or 'SON'
     </entry></row>
   
   <row><entry><literal>accepted-account</literal></entry>
     <entry>id-list</entry>
     <entry valign="bottom">
        Accept ONLY SMS messages arriving with a matching ACCOUNT field.
        <footnote><para>Even if this service is denied,
	Kannel still searches for other service which accepts the message,
	or default service.</para></footnote>
        Separate multiple entries with ';'. For example, if 
         <literal>accepted-account</literal>
        is "FOO;BAR", accept messages which originate with the ACCOUNT
        field set as 'FOO' or 'BAR'
     </entry></row>

   <row><entry><literal>allowed-prefix</literal></entry>
     <entry><literal>prefix-list</literal></entry>
     <entry valign="bottom">
        A list of phone number prefixes of the sender number which are 
		  accepted to be received by this service. 
        <footnote><para>Like in accepted-smsc, 
	Kannel still searches for other service which accepts the message.
	This way there could be several services with the same keyword and
	different results.</para></footnote>
	Multiple entries are separated with 
        semicolon (';'). For example, "91;93" selects this service for
	these prefixes. 
	If denied-prefix is unset, only this numbers are allowed. If 
	denied is set, number are allowed if present in allowed or not 
	in denied list.
     </entry></row>

   <row><entry><literal>denied-prefix</literal></entry>
     <entry><literal>prefix-list</literal></entry>
     <entry valign="bottom">
        A list of phone number prefixes of the sender number which are 
		  NOT accepted to be sent through this SMSC.
     </entry></row>

   <row><entry><literal>allowed-receiver-prefix</literal></entry>
     <entry><literal>prefix-list</literal></entry>
     <entry valign="bottom">
        A list of phone number prefixes of the receiver number which are 
		  accepted to be received by this service. This may be used to
 		  allow only inbound SMS to certain shortcut numbers to be allowed
		  to this service.
     </entry></row>

   <row><entry><literal>denied-receiver-prefix</literal></entry>
     <entry><literal>prefix-list</literal></entry>
     <entry valign="bottom">
        A list of phone number prefixes of the receiver number which are 
		  NOT accepted to be sent through this SMSC.
     </entry></row>


   <row><entry><literal>catch-all</literal></entry>
     <entry>bool</entry>
     <entry valign="bottom">
        Catch keyword regardless of '%s' parameters in pattern.

     </entry></row>

   <row><entry><literal>send-sender</literal></entry>
     <entry>bool</entry>
     <entry valign="bottom">
        Used only with POST. If set to true, number of the handset is
        set, otherwise not.
     </entry></row>

   <row><entry><literal>strip-keyword</literal></entry>
     <entry>bool</entry>
     <entry valign="bottom">
     Used only with POST. Remove matched keyword from message text
        before sending it onward.
     </entry></row>

   <row><entry><literal>faked-sender</literal></entry>
     <entry>phone-number</entry>
     <entry valign="bottom">
        This number is set as sender. Most SMS centers ignore this,
        and use their fixed number instead. This option
        overrides all other sender setting methods.
     </entry></row>

   <row><entry><literal>max-messages</literal></entry>
     <entry>number</entry>
     <entry valign="bottom">
        If the message to be sent is longer than maximum length of an SMS
        it will be split into several parts. <literal>max-messages</literal>
        lets you specify a maximum number of individual SMS messages that
        can be used. If
        <literal>max-messages</literal> is set to 0, no reply is sent, 
        except for error messages. 
     </entry></row>

   <row><entry><literal>accept-x-kannel-headers</literal></entry>
     <entry>bool</entry>
     <entry valign="bottom">
        Request reply can include special X-Kannel headers but these
        are only accepted if this variable is set to true. See
	<xref linkend="xkannel" endterm="xkannel.title"/>.
     </entry></row>

   <row><entry><literal>assume-plain-text</literal></entry>
     <entry>bool</entry>
     <entry valign="bottom">
        If client does not set Content-Type for reply, it is normally
        application/octet-stream which is then handled as data in
        Kannel. This can be forced to be plain/text to allow backward
        compatibility, when data was not expected.
     </entry></row>

   <row><entry><literal>concatenation</literal></entry>
     <entry>bool</entry>
     <entry valign="bottom">
        Long messages can be sent as independent SMS messages with
        <literal>concatenation = false</literal> or as concatenated messages
        with <literal>concatenation = true</literal>. Concatenated messages
        are reassembled into one long message by the receiving device.
     </entry></row>

   <row><entry><literal>split-chars</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
        Allowed characters to split the message into several messages.
        So, with "#!" the message is split from last '#' or '!', which is 
        included in the previous part.

     </entry></row>

   <row><entry><literal>split-suffix</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
        If the message is split into several ones, this string is appended to 
        each message except the last one.
     </entry></row>

   <row><entry><literal>omit-empty</literal></entry>
     <entry>bool</entry>
     <entry valign="bottom">
	Normally, Kannel sends a warning to the user if there was an
	empty reply from the service provider.  If
	<literal>omit-empty</literal> is set to 'true', Kannel will send
	nothing at all in such a case.

     </entry></row>

   <row><entry><literal>header</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
        If specified, this string is automatically added to each SMS sent with
        this service. If the message is split, it is added to each part.

     </entry></row>

   <row><entry><literal>footer</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
        As header, but not inserted into head but appended to end.

     </entry></row>

   <row><entry><literal>prefix</literal></entry>
     <entry>string</entry>
     <entry morerows="1" valign="bottom">
        Stuff in answer that is cut away, only things between prefix
        and suffix is left. Not case sensitive. Matches the first prefix
        and then the first suffix. These are only used for 
        <literal>url</literal> type services, and only if both are
	specified.
     </entry></row>

   <row><entry><literal>suffix</literal></entry>
     <entry>string</entry></row>

    <row><entry><literal>white-list</literal></entry>
     <entry>URL</entry>
     <entry valign="bottom">
        Load a list of accepted senders of SMS messages. If a 
	sender of an SMS message is not in this list, any message 
	received from the SMSC is rejected, unless a <literal>
	black-list</literal> service is defined. See notes of phone 
	number format from numhash.h header file. 
     </entry></row>

    <row><entry><literal>black-list</literal></entry>
     <entry>URL</entry>
     <entry valign="bottom">
        As white-list, but SMS messages from these numbers are
        automatically discarded
     </entry></row>

     <row><entry><literal>accepted-smsc-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
        Accept only SMS messages arriving from SMSCs with a matching ID.
        <footnote><para>Even if this service is denied,
	Kannel still searches for other service which accepts the message,
	or default service.</para></footnote>
        See section on <xref linkend="regular-expressions"/> for details.
        </entry>   
     </row>

     <row><entry><literal>accepted-account-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
        Accept ONLY SMS messages arriving with a matching ACCOUNT field.
        <footnote><para>Even if this service is denied,
	Kannel still searches for other service which accepts the message,
	or default service.</para></footnote>
        See section on <xref linkend="regular-expressions"/> for details.
        </entry>   
     </row>

     <row><entry><literal>allowed-prefix-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
        A set of phone number prefixes of sender-numbers accepted by this service.
        <footnote><para>Like in accepted-smsc-regex, 
	Kannel still searches for another service which accepts the message.
	This way there could be several services with the same keyword and
	different results.</para></footnote>
        See section on <xref linkend="regular-expressions"/> for details.
        </entry>   
     </row>

     <row><entry><literal>denied-prefix-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
        A set of phone number prefixes of sender-numbers which may
        not use this service.
        See section on <xref linkend="regular-expressions"/> for details.
        </entry>   
     </row>

     <row><entry><literal>allowed-receiver-prefix-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
        A set of phone number prefixes of receiver-numbers which 
        may receive data sent by this service. This can be used to
        allow only inbound SMS to certain shortcut numbers to be allowed
	to this service.
        See section on <xref linkend="regular-expressions"/> for details.
        </entry>   
     </row>

     <row><entry><literal>denied-receiver-prefix-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
        A set of phone number prefixes of receiver-numbers which may not
        receive data sent by this service.
        See section on <xref linkend="regular-expressions"/> for details.
        </entry>   
     </row>

     <row><entry><literal>white-list-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
        Defines a set of accepted senders of SMS messages. If a 
	sender of an SMS message is not in this list, the message is rejected.
        See section on <xref linkend="regular-expressions"/> for details.
        </entry>   
     </row>

     <row><entry><literal>black-list-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
        As white-list-regex, but SMS messages from these numbers are
        automatically discarded.
        See section on <xref linkend="regular-expressions"/> for details.
        </entry>   
     </row>

     <row><entry><literal>alt-charset</literal></entry>
        <entry>string</entry>
        <entry valign="bottom">
        Defines which character encoding is used for the SMS message when
        passed to a remote HTTP application. This includes how the SMS message
        text is send in the HTTP GET parameter list and in the HTTP POST bidy.
        Uses <literal>iconv()</literal> routines to convert from and to that 
        specific character set encoding. 
        See your local <literal>iconv_open(3)</literal> manual page for the 
        supported character encodings and the type strings that should be 
        presented for this directive.
        </entry>   
     </row>

     <row><entry><literal>dlr-url</literal></entry>
        <entry>string (URL)</entry>
        <entry valign="bottom">
        Optional Defines a default URL which is fetched for DLR event, if no 
        specific X-Kannel HTTP header parameter is returned by the HTTP response.
        </entry>   
     </row>

     <row><entry><literal>dlr-mask</literal></entry>
        <entry>number (bit mask)</entry>
        <entry valign="bottom">
        Optional. Defines a default DLR event bit mask which is used in 
        combination with the <literal>dlr-url</literal> config directive, 
        if no specific X-Kannel HTTP header parameter is returned by the 
        HTTP response.
        </entry>   
     </row>

  </tbody>
  </tgroup>
 </table>






 <table frame="none" id="escapecodes">
  <title id="escapecodes.title">Parameters (Escape Codes)</title>
  <tgroup cols="2">
  <tbody>

<row><entry><literal>%k</literal></entry><entry>
the keyword in the SMS request (i.e., the first word in the SMS message)
                 
</entry></row>

<row><entry><literal>%s</literal></entry><entry>
next word from the SMS message, starting with
                         the second one (i.e., the first word, the
                         keyword, is not included); problematic characters
                         for URLs are encoded (e.g., '+' becomes '%2B')
                 
</entry></row>

<row><entry><literal>%S</literal></entry><entry>
same as %s, but '*' is converted to '~' (useful
                         when user enters a URL) and URL encoding isn't done
                         (all others do URL encode)
</entry></row>

<row><entry><literal>%r</literal></entry><entry>
words not yet used by %s; e.g., if the message
                         is "FOO BAR FOOBAR BAZ", and the has been one %s,
                         %r will mean "FOOBAR BAZ"
</entry></row>

<row><entry><literal>%a</literal></entry><entry>
all words of the SMS message, including the first one, with spaces
squeezed to one
</entry></row>

<row><entry><literal>%b</literal></entry><entry>
the original SMS message, in a binary form (URL-encoded)
</entry></row>

<row><entry><literal>%e</literal></entry><entry>
the original SMS message, in a binary form (printable hexadecimal byte codes). 
I.e. "xyz" would be send as byte codes "78797A".
</entry></row>

<row><entry><literal>%t</literal></entry><entry>
the time the message was sent, formatted as
                         "YYYY-MM-DD HH:MM", e.g., "1999-09-21 14:18"
</entry></row>

<row><entry><literal>%T</literal></entry><entry>
the time the message was sent, in UNIX epoch timestamp format
</entry></row>

<row><entry><literal>%p</literal></entry><entry>
the phone number of the sender of the SMS message
</entry></row>

<row><entry><literal>%P</literal></entry><entry>
the phone number of the receiver of the SMS message
</entry></row>

<row><entry><literal>%q</literal></entry><entry>
like %p, but a leading `00' is replaced with `+'
</entry></row>

<row><entry><literal>%Q</literal></entry><entry>
like %P, but a leading `00' is replaced with `+'
</entry></row>

<row><entry><literal>%i</literal></entry><entry>
the smsc-id of the connection that received the message
</entry></row>

<row><entry><literal>%I</literal></entry><entry>
the SMS ID of the internal message structure
</entry></row>

<row><entry><literal>%d</literal></entry><entry>
the delivery report value
</entry></row>

<row><entry><literal>%R</literal></entry><entry>
the delivery report URL value
</entry></row>

<row><entry><literal>%N</literal></entry><entry>
the delivery report notification message
</entry></row>

<row><entry><literal>%D</literal></entry><entry>
meta-data from the SMSC. See <xref linkend="meta-data"/> for more into.
</entry></row>

<row><entry><literal>%A</literal></entry><entry>
the delivery report SMSC reply, if any
</entry></row>

<row><entry><literal>%F</literal></entry><entry>
the <literal>foreign</literal> (smsc-provided) message ID. Only
relevant on DLR url's.
</entry></row>

<row><entry><literal>%n</literal></entry><entry>
the sendsms-user or sms-service name
</entry></row>

<row><entry><literal>%c</literal></entry><entry>
message coding: 0 (default, 7 bits), 1 (8 bits) or 2 (Unicode)
</entry></row>

<row><entry><literal>%m</literal></entry><entry>
message class bits of DCS: 0 (directly to display, flash),
1 (to mobile), 2 (to SIM) or 3 (to SIM toolkit).
</entry></row>

<row><entry><literal>%M</literal></entry><entry>
mwi (message waiting indicator) bits of DCS:
0 (voice), 1, (fax), 2 (email) or 3 (other) for activation
and 4, 5, 6, 7 for deactivation respectively.
</entry></row>

<row><entry><literal>%C</literal></entry><entry>
message charset: for a "normal" message, it will 
be "GSM" (coding=0), "binary" (coding=1) or 
"UTF-16BE" (coding=2). If the message was successfully
recoded from Unicode, it will be "WINDOWS-1252"
</entry></row>

<row><entry><literal>%u</literal></entry><entry>
<literal>udh</literal> of incoming message
</entry></row>

<row><entry><literal>%B</literal></entry><entry>
billing identifier/information of incoming message. The value
depends on the SMSC module and the associated billing semantics
of the specific SMSC providing the information. For EMI2 the value
is the XSer 0c field, for SMPP MO it is the service_type of the 
deliver_sm PDU, and for SMPP DLR it is the DLR message err component. 
(Note: This is used for proxying billing 
information to external applications. There is no semantics 
associated while processing these.)
</entry></row>

<row><entry><literal>%o</literal></entry><entry>
account identifier/information of incoming message. The value
depends on the SMSC module and has been introduced to allow the
forwarding of an operator ID from aggregator SMSCs to the application
layer, hence the smsbox HTTP calling instance.
</entry></row>

<row><entry><literal>%O</literal></entry><entry>
DCS (Data coding schema) value.
</entry></row>

<row><entry><literal>%f</literal></entry><entry>
Originating SMSC of incoming message. The value is set if
the AT driver is used to receive a SMS on a gsm modem.
The value of %f will contain the number of the SMSC sending
the SMS to the SIM card. Other SMSC types than AT do not
set this field so it will be empty.
</entry></row>

<row><entry><literal>%x</literal></entry><entry>
the smsbox-id of the message, identifying from which smsbox connection
the message is originating. (Only available withing the
<literal>access-log-format</literal> directive)
</entry></row>

<row><entry><literal>%v</literal></entry><entry>
Validity period in minutes. Available only if SMSC supports
and sent this value.
</entry></row>

<row><entry><literal>%V</literal></entry><entry>
Deferred in minutes. Available only if SMSC supports
and sent this value.
</entry></row>

<row><entry><literal>%#</literal></entry><entry>
This allows to pass meta-data individual parameters into urls.
The syntax is as follows: <literal>%#group#parameter#</literal>
For example: <literal>%#smpp#my_param#</literal> would be replaced 
with the value 'my_param' from the group 'smpp' coming inside the 
meta_data field.
</entry></row>

</tbody>
</tgroup>
</table>



 <para>Some sample 'sms-service' groups:

<programlisting>
group = sms-service
keyword = nop
text = "You asked nothing and I did it!"
catch-all = true

group = sms-service
keyword = complex
get-url = "http://host/service?sender=%p&amp;text=%r"
accept-x-kannel-headers = true
max-messages = 3
concatenation = true

group = sms-service
keyword = default
text = "No action specified"
</programlisting>
</para>


</sect2>


<sect2>
<title>How sms-service interprets the HTTP response</title>

    <para>When an <literal>sms-service</literal> requests a document
    via HTTP, it will accept one of four types of content types:

    	<informaltable frame="none">
	<tgroup cols="2">
	<tbody>
	
	<row>
	<entry><literal>text/plain</literal></entry>
	<entry>Blanks are squeezed into one, rest is chopped to fit an
	SMS message.</entry>
	</row>
	
	<row>
	<entry><literal>text/html</literal></entry>
	<entry>Tags are removed, rest is chopped to fit an
	SMS message.</entry>
	</row>
	
	<row>
	<entry><literal>text/vnd.wap.wml</literal></entry>
	<entry>Processed like HTML.</entry>
	</row>
	
	<row>
	<entry><literal>text/xml</literal></entry>
	<entry>Processed as a POST-XML. See <xref
	    linkend="postxml" endterm="postxml.title"/></entry>
	</row>
	
	<row>
	<entry><literal>application/octet-stream</literal></entry>
	<entry>The body will be transmitted as the SMS message, as
	8-bit data. This can be avoided by setting
	<literal>assume-plain-text</literal> variable on for the
	SMS-service.</entry>
	</row>
	
	</tbody>
	</tgroup>
	</informaltable>

        </para>


<sect3 id="xkannel">
<title id="xkannel.title">Extended headers</title>
	
	<para>Kannel uses and accepts several X-Kannel headers to be
	used with SMS-services, if option
        <literal>accept-x-kannel-headers</literal> was provided in the
        relevant 'sms-service' group.</para>

 <table frame="none">
  <title>X-Kannel Headers</title>
  <tgroup cols="2">
  <thead>
   <row>
     <entry>SMSPush equivalent</entry>
     <entry>X-Kannel Header</entry>
   </row>
  </thead>
  <tbody>
   <row><entry><literal>username</literal></entry>
   <entry><literal>X-Kannel-Username</literal></entry></row>

   <row><entry><literal>password</literal></entry>
   <entry><literal>X-Kannel-Password</literal></entry></row>

   <row><entry><literal>from</literal></entry>
   <entry><literal>X-Kannel-From</literal></entry></row>

   <row><entry><literal>to</literal></entry>
   <entry><literal>X-Kannel-To</literal></entry></row>

   <row><entry><literal>text</literal></entry>
   <entry>request body</entry></row>

   <row><entry><literal>charset</literal></entry>
   <entry>charset as in <literal>Content-Type: text/html; charset=ISO-8859-1</literal></entry></row>

   <row><entry><literal>udh</literal></entry>
   <entry><literal>X-Kannel-UDH</literal></entry></row>

   <row><entry><literal>smsc</literal></entry>
   <entry><literal>X-Kannel-SMSC</literal></entry></row>

   <row><entry><literal>flash</literal></entry>
   <entry><literal>X-Kannel-Flash</literal> (deprecated, see <literal>X-Kannel-MClass</literal></entry></row>

   <row><entry><literal>mclass</literal></entry>
   <entry><literal>X-Kannel-MClass</literal></entry></row>

   <row><entry><literal>mwi</literal></entry>
   <entry><literal>X-Kannel-MWI</literal></entry></row>

   <row><entry><literal>compress</literal></entry>
   <entry><literal>X-Kannel-Compress</literal></entry></row>

   <row><entry><literal>coding</literal></entry>
   <entry><literal>X-Kannel-Coding</literal>. If unset, defaults to 0 
   (7 bits) if <literal>Content-Type</literal> is <literal>text/plain
   </literal>, <literal>text/html</literal> or 
   <literal>text/vnd.wap.wml</literal>. On 
   <literal>application/octet-stream</literal>, defaults to
   8 bits (1). All other <literal>Content-Type</literal> values 
   are rejected.</entry></row>

   <row><entry><literal>validity</literal></entry>
   <entry><literal>X-Kannel-Validity</literal></entry></row>

   <row><entry><literal>deferred</literal></entry>
   <entry><literal>X-Kannel-Deferred</literal></entry></row>

   <row><entry><literal>dlr-mask</literal></entry>
   <entry><literal>X-Kannel-DLR-Mask</literal></entry></row>

   <row><entry><literal>dlr-url</literal></entry>
   <entry><literal>X-Kannel-DLR-Url</literal></entry></row>

   <row><entry><literal>account</literal></entry>
   <entry><literal>X-Kannel-Account</literal></entry></row>

   <row><entry><literal>pid</literal></entry>
   <entry><literal>X-Kannel-PID</literal></entry></row>

   <row><entry><literal>alt-dcs</literal></entry>
   <entry><literal>X-Kannel-Alt-DCS</literal></entry></row>

   <row><entry><literal>binfo</literal></entry>
   <entry><literal>X-Kannel-BInfo</literal></entry></row>

   <row><entry><literal>rpi</literal></entry>
   <entry><literal>X-Kannel-RPI</literal></entry></row>

   <row><entry><literal>priority</literal></entry>
   <entry><literal>X-Kannel-Priority</literal></entry></row>

   <row><entry><literal>meta-data</literal></entry>
   <entry><literal>X-Kannel-Meta-Data</literal></entry></row>

  </tbody>
  </tgroup>
 </table>

</sect3>


<sect3 id="kannelpost">
<title id="kannelpost.title">Kannel POST</title>

	<para>Kannel can do POST if <literal>service</literal> is
	contains a <literal>post-url="..."</literal>.</para>

<table frame="none">
  <title>X-Kannel Post Headers</title>
  <tgroup cols="2">
  <thead>
   <row>
     <entry>Parameter (escape code) equivalent</entry>
     <entry>X-Kannel Header</entry>
     <entry>Notes</entry>
   </row>
  </thead>
  <tbody>
   <row><entry><literal>%p (from)</literal></entry>
   <entry><literal>X-Kannel-From</literal></entry>
   <entry>Only sent if <literal>send-sender</literal> is true</entry> </row>

   <row><entry><literal>%P (to)</literal></entry>
   <entry><literal>X-Kannel-To</literal></entry>
   <entry></entry></row>

   <row><entry><literal>%t (time)</literal></entry>
   <entry><literal>X-Kannel-Time</literal></entry>
   <entry></entry></row>

   <row><entry><literal>%u (udh)</literal></entry>
   <entry><literal>X-Kannel-UDH</literal></entry>
   <entry>in hex format: <literal>06050415820000</literal></entry></row>

   <row><entry><literal>%i (smsc)</literal></entry>
   <entry><literal>X-Kannel-SMSC</literal></entry>
   <entry></entry></row>

   <row><entry><literal>- (mclass)</literal></entry>
   <entry><literal>X-Kannel-MClass</literal></entry>
   <entry></entry></row>

   <row><entry><literal>- (pid)</literal></entry>
   <entry><literal>X-Kannel-PID</literal></entry>
   <entry></entry></row>

   <row><entry><literal>- (alt-dcs)</literal></entry>
   <entry><literal>X-Kannel-Alt-DCS</literal></entry>
   <entry></entry></row>

   <row><entry><literal>- (mwi)</literal></entry>
   <entry><literal>X-Kannel-MWI</literal></entry>
   <entry></entry></row>

   <row><entry><literal>%c (coding)</literal></entry>
   <entry><literal>X-Kannel-Coding</literal></entry>
   <entry>0=7 Bits, 1=8 Bits, 2=UCS-2</entry></row>

   <row><entry><literal>- (compress)</literal></entry>
   <entry><literal>X-Kannel-Compress</literal></entry>
   <entry></entry></row>

   <row><entry><literal>- (validity)</literal></entry>
   <entry><literal>X-Kannel-Validity</literal></entry>
   <entry></entry></row>

   <row><entry><literal>- (deferred)</literal></entry>
   <entry><literal>X-Kannel-Deferred</literal></entry>
   <entry></entry></row>

   <row><entry><literal>%n (service name)</literal></entry>
   <entry><literal>X-Kannel-Service</literal></entry>
   <entry></entry></row>

   <row><entry><literal>%D (meta-data)</literal></entry>
   <entry><literal>X-Kannel-Meta-Data</literal></entry>
   <entry>Meta-Data (Only SMPP TLV's supported at the moment)</entry></row>

   <row><entry><literal>%a or %r (text)</literal></entry>
   <entry>request body</entry>
   <entry>Kannel send all words (%a) unless <literal>strip-keyword</literal> is true</entry></row>

   <row><entry><literal>%C (charset)</literal></entry>
   <entry>present in <literal>Content-Type</literal> <literal>HTTP</literal></entry>
   <entry>Example: <literal>Content-Type: text/plain; charset=ISO-8859-1</literal></entry></row>

  </tbody>
  </tgroup>
</table>
 
</sect3>
	
<sect3 id="postxml">
<title id="postxml.title">XML Post</title>
	
	<para>Kannel can send and receive XML POST with the following
	format:</para>

<programlisting>
&#60;?xml version="1.0"?&#62;
&#60;!DOCTYPE ...&#62;
&#60;message&#62;
  &#60;submit&#62;
    &#60;da&#62;&#60;number&#62;destination number (to)&#60;/number&#62;&#60;/da&#62;
    &#60;oa&#62;&#60;number&#62;originating number (from)&#60;/number&#62;&#60;/oa&#62;
    &#60;ud&#62;user data (text)&#60;/ud&#62;
    &#60;udh&#62;user data header (udh)&#60;/udh&#62;
    &#60;meta-data&#62;meta-data&#60;/meta-data&#62;
    &#60;dcs&#62;
      &#60;mclass&#62;mclass&#60;/mclass&#62;
      &#60;coding&#62;coding&#60;/coding&#62;
      &#60;mwi&#62;mwi&#60;/mwi&#62;
      &#60;compress&#62;compress&#60;/compress&#62;
      &#60;alt-dcs&#62;alt-dcs&#60;/alt-dcs&#62;
    &#60;/dcs&#62;
    &#60;pid&#62;pid&#60;/pid&#62;
    &#60;rpi&#62;rpi&#60;/rpi&#62;
    &#60;vp&#62;
      &#60;delay&#62;validity time in minutes&#60;/delay&#62;
    &#60;/vp&#62;
    &#60;timing&#62;
      &#60;delay&#62;deferred time in minutes&#60;/delay&#62;
    &#60;/timing&#62;
    &#60;statusrequest&#62;
      &#60;dlr-mask&#62;dlr-mask&#60;/dlr-mask&#62;
      &#60;dlr-url&#62;dlr-url&#60;/dlr-url&#62;
    &#60;/statusrequest&#62;

    &#60;!-- request from application to Kannel --&#62;
    &#60;from&#62;
      &#60;user&#62;username&#60;/user&#62;
      &#60;username&#62;username&#60;/username&#62; 
      &#60;pass&#62;password&#60;/pass&#62;
      &#60;password&#62;password&#60;/password&#62;
      &#60;account&#62;account&#60;/account&#62;
    &#60;/from&#62;
    &#60;to&#62;smsc-id&#60;/to&#62;

    &#60;!-- request from Kannel to application --&#62;
    &#60;from&#62;smsc-id&#60;/from&#62;
    &#60;to&#62;service-name&#60;/to&#62;

  &#60;/submit&#62;
&#60;/message&#62;
</programlisting>

	<note><para>Don't forget to set POST Content-Type to 
	<literal>text/xml</literal>!</para></note>

	<para>There could be several <literal>da</literal> entries for <literal>sendsms-user
	</literal> to enable multi-recipient messages. <literal>da</literal> doesn't make
	sense in <literal>sms-service</literal>.</para>

	<!--
	<para><literal>ud</literal><note><para>DAVI: I still have to test binary and Unicode
	&#60;ud&#62; content</para></note></para>
	-->
	
	<para><literal>udh</literal> is the same format as <literal>X-Kannel-UDH</literal>.
	Example: &#60;udh&#62;06050415820000&#60;/udh&#62;.</para>
	
	<para>On Kannel->application, <literal>from</literal> is the <literal>smsc-id</literal>
	that message arrives and <literal>to</literal> is the service name.</para>
	<para>On application->Kannel, <literal>from</literal> contains the credentials (
	<literal>user/username</literal>, <literal>pass/password</literal> and <literal>
	account</literal> and <literal>to</literal> corresponds to the <literal>smsc-id
	</literal> to submit the message.</para>
	
	<para><literal>user</literal> and <literal>username</literal> are equivalent and 
	only one of them should be used. (same for <literal>pass</literal> and <literal>
	password</literal>.</para>

	<para>When application POST in Kannel, as in GET, only <literal>user</literal>, <literal>
	pass</literal> and <literal>da</literal> are required. Everything else is optional. 
	(<literal>oa</literal> could be needed too is there's no <literal>default-sender</literal>
	or <literal>forced-sender</literal>.</para>

	<warning><para>This is experimental code. XML format could and should change to fully
	met IETF's sms-xml standard (yet in draft) and additional tags needed by Kannel should be
	pondered.</para></warning>
</sect3>

</sect2>


<sect2>
<title>SendSMS-user configurations</title>

   <para>To enable an SMS push, you must set
   <literal>sendsms-port</literal> into the 'smsbox' group and define one or
   more 'sendsms-user' groups. Each of these groups define one
   account, which can be used for the SMS push, via HTTP interface (see
   below)</para>

 <table frame="none">
  <title>SendSMS-User Group Variables</title>
  <tgroup cols="3">
  <thead>
   <row>
     <entry>Variable</entry>
     <entry>Value</entry>
     <entry>Description</entry>
   </row>
  </thead>
  <tbody>
   <row><entry><literal>group (m)</literal></entry>
     <entry><literal>sendsms-user</literal></entry>
     <entry valign="bottom">
       This is a mandatory variable
     </entry></row>

   <row><entry><literal>username (m)</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
       Name for the user/account. 
     </entry></row>

   <row><entry><literal>password (m)</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
       Password for the user (see HTTP interface, below)
     </entry></row>

   <row><entry><literal>name</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
       As in 'sms-service' groups.
     </entry></row>

   <row><entry><literal>user-deny-ip</literal></entry>
     <entry>IP-list</entry>
     <entry morerows="1" valign="bottom">
        As other deny/allow IP lists, but for this user (i.e. this
         user is not allowed to do the SMS push HTTP request from
         other IPs than allowed ones). If not set, there is no
         limitations.
     </entry></row>
   <row><entry><literal>user-allow-IP</literal></entry>
     <entry>IP-list</entry></row>

   <row><entry><literal>forced-smsc</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
         Force SMSC ID as a 'string' (linked to SMS routing, see 'smsc' groups)
     </entry></row>

   <row><entry><literal>default-smsc</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
        If no SMSC ID is given with the send-sms request (see below), use
        this one. No idea to use with forced-smsc.
     </entry></row>


   <row><entry><literal>default-sender</literal></entry>
     <entry>phone-number</entry>
     <entry valign="bottom">
        This number is set as sender if not set by <literal>from</literal>
	get/post parameter 
     </entry></row>

   <row><entry><literal>faked-sender</literal></entry>
     <entry>phone-number</entry>
     <entry valign="bottom">
        As in 'sms-service' groups
     </entry></row>

   <row><entry><literal>max-messages</literal></entry>
     <entry>number</entry></row>

   <row><entry><literal>concatenation</literal></entry>
     <entry>bool</entry></row>

   <row><entry><literal>split-chars</literal></entry>
     <entry>string</entry></row>

   <row><entry><literal>split-suffix</literal></entry>
     <entry>string</entry></row>

   <row><entry><literal>omit-empty</literal></entry>
     <entry>bool</entry></row>

   <row><entry><literal>header</literal></entry>
     <entry>string</entry></row>

   <row><entry><literal>footer</literal></entry>
     <entry>string</entry></row>

   <row><entry><literal>allowed-prefix</literal></entry>
     <entry><literal>prefix-list</literal></entry>
     <entry valign="bottom">
        A list of phone number prefixes which are accepted to be
        sent using this username. Multiple entries are separated with 
        semicolon (';'). For example, "040;050" prevents sending of
        any SMS message with prefix of 040 or 050 through this SMSC.
	If denied-prefix is unset, only this numbers are allowed. If
	set, number are allowed if present in allowed or not in 
	denied list.
     </entry></row>

   <row><entry><literal>denied-prefix</literal></entry>
     <entry><literal>prefix-list</literal></entry>
     <entry valign="bottom">
        A list of phone number prefixes which are NOT accepted to be
        sent using this username.
     </entry></row>

    <row><entry><literal>white-list</literal></entry>
     <entry>URL</entry>
     <entry valign="bottom">
        Load a list of accepted destinations of SMS messages. If a 
	destination of an SMS message is not in this list, any message 
	received from the HTTP interface is rejected. See notes of phone 
	number format from numhash.h header file. 
     </entry></row>

    <row><entry><literal>black-list</literal></entry>
     <entry>URL</entry>
     <entry valign="bottom">
        As white-list, but SMS messages from these numbers are
        automatically rejected.
     </entry></row>

    <row><entry><literal>dlr-url</literal></entry>
     <entry>URL</entry>
     <entry valign="bottom">
	URL to be fetched if a <literal>dlr-mask</literal> CGI 
	parameter is present.
     </entry></row>

     <row><entry><literal>allowed-prefix-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
        A set of phone numbers which are accepted to be
        sent using this username. 
        See section on <xref linkend="regular-expressions"/> for details.
        </entry>
     </row>

     <row><entry><literal>denied-prefix-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
        A set of phone numbers which may not
        send using this username. 
        See section on <xref linkend="regular-expressions"/> for details.
        </entry>
     </row>

     <row><entry><literal>white-list-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
        Defines a set of accepted destinations of SMS messages. If a 
	destination of an SMS message is not in this list, any message 
	received from the HTTP interface is rejected. 
        See section on <xref linkend="regular-expressions"/> for details.
        </entry>
     </row>

     <row><entry><literal>black-list-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
        As <literal>white-list-regex</literal>, but SMS messages originating from 
        a number matching the pattern are discarded.
        See section on <xref linkend="regular-expressions"/> for details.
        </entry>
     </row>

  </tbody>
  </tgroup>
 </table>

  <para>Some sample 'sendsms-user' groups:

<programlisting>
group = sendsms-user
username = simple
password = elpmis

group = sendsms-user
username = complex
password = 76ftY
user-deny-ip = "*.*.*.*"
user-allow-ip = "123.234.123.234"
max-messages = 3
concatenation = true
forced-smsc = SOL
</programlisting>

   The second one is very limited and only allows a user from IP
   "123.234.123.234". On the other hand, the user can send a longer
   message, up to 3 SMSes long, which is sent as concatenated
   SMS.</para>

</sect2>

<sect2>
<title>Over-The-Air configurations</title>

   <para>To enable Over-The-Air configuration of phones or other client
   devices that support the protocol you need to configure a <literal>
   sendsms-user</literal>.<literal>ota-setting</literal> group is not 
   necessary, you can send settings to the phone as a XML document, but
   this method is perhaps more suitable for continuous provisioning.
   </para>

   <para>If you want to send multiple OTA configurations through the smsbox
   and you do not want to send XML documents, you will have to declare a 
   <literal>ota-id</literal> string to the different <literal>ota-setting
   </literal> groups.
   </para>

 <table frame="none">
  <title>OTA Setting Group Variables</title>
  <tgroup cols="3">
  <thead>
   <row>
     <entry>Variable</entry>
     <entry>Value</entry>
     <entry>Description</entry>
   </row>
  </thead>
  <tbody>
   <row><entry><literal>group</literal></entry>
     <entry><literal>ota-setting</literal></entry>
     <entry valign="bottom">
       This is a mandatory variable
     </entry></row>

   <row><entry><literal>ota-id</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
	     An optional name or id for the ota-setting. Any string is
        acceptable, but semicolon ';' may cause problems, so avoid
        it and any other special non-alphabet characters. 
     </entry></row>

   <row><entry><literal>location</literal></entry>
     <entry><literal>URL</literal></entry>
     <entry valign="bottom">
       The address of the HTTP server for your WAP services, i.e. 
		 <literal>http://wap.company.com</literal>
     </entry></row>

   <row><entry><literal>service</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Description of the service
     </entry></row>

   <row><entry><literal>ipaddress</literal></entry>
     <entry><literal>IP</literal></entry>
     <entry valign="bottom">
      IP address of your WAP gateway 
     </entry></row>

   <row><entry><literal>phonenumber</literal></entry>
     <entry><literal>phone-number</literal></entry>
     <entry valign="bottom">
       Phone number used to establish the PPP connection
     </entry></row>

   <row><entry><literal>speed</literal></entry>
     <entry><literal>number</literal></entry>
     <entry valign="bottom">
       Connection speed: 9600 or 14400. Defaults to 9600.
     </entry></row>

   <row><entry><literal>bearer</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Bearer type: data or sms. Defaults to data.
     </entry></row>

   <row><entry><literal>calltype</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Call type: isdn or analog. Defaults to isdn.
     </entry></row>

   <row><entry><literal>connection</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Connection type: cont or temp. Cont uses TCP port 9201
		 and Temp uses UDP port 9200. Defaults to cont.
     </entry></row>

   <row><entry><literal>pppsecurity</literal></entry>
     <entry><literal>on or off</literal></entry>
     <entry valign="bottom">
       Enable CHAP authentication if set to on, PAP otherwise
     </entry></row>

   <row><entry><literal>authentication</literal></entry>
     <entry><literal></literal></entry>
     <entry valign="bottom">
       normal or secure. Indicates whether WTLS should be used 
		 or not. Defaults to normal.
     </entry></row>

   <row><entry><literal>login</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Login name.
     </entry></row>

   <row><entry><literal>secret</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Login password
     </entry></row>

  </tbody>
  </tgroup>
 </table>

  <para>A sample 'ota-setting' group:

<programlisting>
group = ota-setting
location = http://wap.company.com
service = "Our company's WAP site"
ipaddress = 10.11.12.13
phonenumber = 013456789
bearer = data
calltype = analog
connection = cont
pppsecurity = off
authentication = normal
login = wapusr
secret = thepasswd
</programlisting>

And a 'sendsms-user' to use with it. With concatenation enabled:

<programlisting>
group = sendsms-user
username = otauser
password = foo
max-messages = 2
concatenation = 1
</programlisting>

  </para>

 <table frame="none">
  <title>OTA Bookmark Group Variables</title>
  <tgroup cols="3">
  <thead>
   <row>
     <entry>Variable</entry>
     <entry>Value</entry>
     <entry>Description</entry>
   </row>
  </thead>
  <tbody>
   <row><entry><literal>group</literal></entry>
     <entry><literal>ota-bookmark</literal></entry>
     <entry valign="bottom">
       This is a mandatory variable
     </entry></row>

   <row><entry><literal>ota-id</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
	     An optional name or id for the ota-bookmark. Any string is
        acceptable, but semicolon ';' may cause problems, so avoid
        it and any other special non-alphabet characters. 
     </entry></row>

   <row><entry><literal>url</literal></entry>
     <entry><literal>URL</literal></entry>
     <entry valign="bottom">
       The address of the HTTP server for your WAP services, i.e. 
		 <literal>http://wap.company.com</literal>
     </entry></row>

   <row><entry><literal>name</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
       Description of the service
     </entry></row>

  </tbody>
  </tgroup>
 </table>

  <para>A sample 'ota-bookmark' group:

<programlisting>
group = ota-bookmark
ota-id = wap-link
url = "http://wap.company.com"
service = "Our company's WAP site"
</programlisting>

And a 'sendsms-user' to use with it, with the same conditions as for the
'ota-setting' group.

  </para>


</sect2>

<sect2>
<title>Setting up more complex services</title>

    <para>The basic service system is very limited - it can only
    answer to original requester and it cannot send UDH data, for
    example. This chapter explains some more sophisticated and complex
    SMS service setups.</para>

<sect3>
<title>Redirected replies</title>

    <para>The basic service system always sends the answer back to
    original requester, but sometimes the content server needs to send
    something to other terminals or delay the answer. To create 
    such systems, an SMS push is used.</para>

    <para>The idea is to get the initial request, but then send no
    reply. Instead, the reply (if any) is sent via HTTP
    sendsms-interface as SMS Push. This way the service
    application has full control of the return content, and can do all
    needed formatting beforehand.</para>

    <para>Note that when no reply is wanted, remember to set the variable
    <literal>max-messages</literal> to zero (0) so that no reply is sent, unless an
    error occurs. Simple sample:</para>

<programlisting>
group = sms-service
keyword = talk
get-url = "http://my.applet.machine/Servlet/talk?sender=%p&amp;text=%r"
max-messages = 0
</programlisting>


</sect3>
<sect3>
<title>Setting up operator specific services</title>

   <para>Those running Kannel with several SMS centers might need to
   define services according to the relying SMS center. To achieve this,
   first you need to give an ID name for SMS center connections (see
   above). Then use the <literal>accepted-smsc</literal> variable to 
   define which messages can use that service.</para>

<programlisting>
group = sms-service
keyword = weather
accepted-smsc = SOL
get-url = "http://my.applet.machine/Servlet/weather?sender=%p&amp;operator=SOL&amp;text=%r"
</programlisting>

</sect3>
<sect3>
<title>Setting up multi-operator Kannel</title>

   <para>Sometimes there is a need for Kannel to listen to two (or
   more) distinct SMS centers, and messages must be routed to services
   according to where they came from, and replies likewise must return
   to same SMSC. This is done via <literal>smsc-id</literal>
   magic. Here is a shortened sample configuration, which handles to
   distinct SMS servers and services:</para>

<programlisting>
group = smsc
smsc-id = A
denied-smsc-id = B
...

group = smsc
smsc-id = B
denied-smsc-id = A
...

group = sms-service
accepted-smsc = A
get-url = "..."

group = sms-service
accepted-smsc = B
get-url = "..."
</programlisting>
 
    <para>As can be seen, the <literal>smsc-id</literal> is used to
    identify the SMS center from which the message came. Then, the
    <literal>denied-smsc-id</literal> variable is used to prevent
    messages originally from the other SMS center from being sent
    through the other one. Finally 'sms-service' groups are defined
    with <literal>accepted-smsc</literal> so that they only accept
    messages from certain SMS center.</para>

    <para>If you want to use SMS push services, requesters 
    should then set the <literal>smsc</literal> request parameter, or
    'sendsms-user' groups should be defined like this:</para>

<programlisting>
group = sendsms-user
username = operator_A
password = foo
forced-smsc = A

group = sendsms-user
username = operator_B
password = bar
forced-smsc = B
</programlisting> 

    <para>Note that if your SMS centers do not set the sender phone
    number but rely on number transmitted, you should set
    <literal>faked-sender</literal> to all 'sendsms-user'
    groups.</para>

</sect3>

</sect2>

</sect1>

<sect1>
<title>Running SMS gateway</title>

<sect2>
<title>Using the HTTP interface to send SMS messages</title>

	<para>After you have configured Kannel to allow the sendsms
	service, you can send SMS messages via HTTP, e.g., using a
	WWW browser. The URL looks something like this:
	
<programlisting>
http://smsbox.host.name:13013/cgi-bin/sendsms?
username=foo&amp;password=bar&amp;to=0123456&amp;text=Hello+world
</programlisting>

         Thus, technically,
	you make an HTTP GET request. This means that all the information
	is stuffed into the URL. If you want to use this often via a
	browser, you probably want to make an HTML form for this.</para>

  <para>
     Kannel will answer to sendsms request with following codes and
     body texts:</para>
  
 <table frame="none">
  <title>SMS Push reply codes</title>
      <tgroup cols="3"><thead><row>
             <entry>Status</entry>
             <entry>Body</entry>
             <entry>Meaning</entry>
             </row></thead>
  <tbody>
   <row><entry><literal>202</literal></entry>
   <entry><literal>0: Accepted for delivery</literal></entry>
   <entry valign="bottom">
        The message has been accepted and is delivered onward to a SMSC
        driver. Note that this status does not ensure that the
        intended recipient receives the message.
   </entry></row>
   <row><entry><literal>202</literal></entry>
   <entry><literal>3: Queued for later delivery</literal></entry>
   <entry valign="bottom">
        The bearerbox accepted and stored the message, but there was
        temporarily no SMSC driver to accept the message so it was
        queued. However, it should be delivered later on.
   </entry></row>
   <row><entry><literal>4xx</literal></entry>
   <entry>(varies)</entry>
   <entry valign="bottom">
        There was something wrong in the request or Kannel was so
      configured that the message cannot be in any circumstances
      delivered. Check the request and Kannel configuration.
   </entry></row>
   <row><entry><literal>503</literal></entry>
   <entry><literal>Temporal failure, try again later.</literal></entry>
   <entry valign="bottom">
        There was temporal failure in Kannel. Try again later.
   </entry></row>

  </tbody>
  </tgroup>
 </table>


 <table frame="none">
  <title>SMS Push (send-sms) CGI Variables</title>
  <tgroup cols="3">
  <tbody>
   <row><entry><literal>username</literal> (or <literal>user</literal>)</entry>
   <entry><literal>string</literal></entry>
   <entry valign="bottom">
        Username or account name. Must be <literal>username</literal> of the one
        'sendsms-user' group in the Kannel configuration,
        or results in 'Authorization failed' reply.
   </entry></row>

   <row><entry><literal>password</literal> (or <literal>pass</literal>)</entry>
   <entry><literal>string</literal></entry>
   <entry valign="bottom">
       Password associated with given <literal>username</literal>. Must match
 corresponding field in the 'sendsms-user' group of
the Kannel configuration, or 'Authorization failed' is returned.
   </entry></row>

   <row><entry><literal>from</literal></entry>
   <entry><literal>string</literal></entry>
   <entry valign="bottom">
        Phone number of the sender. This field is usually overridden
        by the SMS Center, or it can be overridden by
        <literal>faked-sender</literal> variable in the
        <literal>sendsms-user</literal> group. If this variable is not
        set, smsbox <literal>global-sender</literal> is used.
   </entry></row>

   <row><entry><literal>to</literal></entry>
   <entry><literal>phone number list</literal></entry>
   <entry valign="bottom">
        Phone number of the receiver. To send to multiple receivers,
   separate each entry with <emphasis>space</emphasis> (' ', '+'
   url-encoded) - but note that this can be deactivated via
   <literal>sendsms-chars</literal> in the 'smsbox' group.
   </entry></row>

   <row><entry><literal>text</literal></entry>
   <entry><literal>string</literal></entry>
   <entry valign="bottom">
        Contents of the message, URL encoded as necessary. The content
        can be more than 160 characters, but then
        <literal>sendsms-user</literal> group must have
        <literal>max-messages</literal> set more than 1.
   </entry></row>

   <row><entry><literal>charset</literal></entry>
   <entry><literal>string</literal></entry>
   <entry valign="bottom">
        Charset of text message. Used to convert to a format suitable for
	7 bits or to UCS-2. Defaults to UTF-8 if coding is 7 bits and
	UTF-16BE if coding is UCS-2.
   </entry></row>

   <row><entry><literal>udh</literal></entry>
   <entry><literal>string</literal></entry>
   <entry valign="bottom">
         Optional User Data Header (UDH) part of the message. Must be
         URL encoded.
   </entry></row>

   <row><entry><literal>smsc</literal></entry>
   <entry><literal>string</literal></entry>
   <entry valign="bottom">
        Optional virtual smsc-id from which the message is supposed to 
	have arrived. This is used for routing purposes, if any denied
	or preferred SMS centers are set up in SMS center
	configuration. This variable can be overridden with a
        <literal>forced-smsc</literal> configuration
        variable. Likewise, the <literal>default-smsc</literal> variable
        can be used to set the SMSC if it is not set otherwise.
   </entry></row>

   <row><entry><literal>flash</literal></entry>
   <entry><literal>number</literal></entry>
   <entry valign="bottom">
         Deprecated. See <literal>mclass</literal>.
   </entry></row>

   <row><entry><literal>mclass</literal></entry>
   <entry><literal>number</literal></entry>
   <entry valign="bottom">
         Optional. Sets the Message Class in DCS field.
	 Accepts values between 0 and 3, for Message Class 0 to 3, 
	 A value of 0 sends the message directly to display, 1 sends
	 to mobile, 2 to SIM and 3 to SIM toolkit.
   </entry></row>

   <row><entry><literal>mwi</literal></entry>
   <entry><literal>number</literal></entry>
   <entry valign="bottom">
         Optional. Sets Message Waiting Indicator bits in DCS field.
	 If given, the message will be encoded as a Message Waiting
	 Indicator. The accepted values are 0,1,2 and 3 for activating the
	 voice, fax, email and other indicator, or 4,5,6,7 for deactivating,
	 respectively.
	 This option excludes the <literal>flash</literal> option.
     <footnote id="mwi-messages"><para>To set number of messages, use
	 <literal>mwi=[0-3]&amp;coding=0&amp;udh=%04%01%02%&lt;XX&gt;%&lt;YY&gt;</literal>,
	 where YY are the number of messages, in HEX, and XX are <literal>mwi</literal>
	 plus 0xC0 if <literal>text</literal> field is not empty.</para> </footnote>
   </entry></row>

   <row><entry><literal>compress</literal></entry>
   <entry><literal>number</literal></entry>
   <entry valign="bottom">
         Optional. Sets the Compression bit in DCS Field.
   </entry></row>

   <row><entry><literal>coding</literal></entry>
   <entry><literal>number</literal></entry>
   <entry valign="bottom">
         Optional. Sets the coding scheme bits in DCS field.
	 Accepts values 0 to 2, for 7bit, 8bit or UCS-2.
	 If unset, defaults to 7 bits unless a udh is defined, which sets
	 coding to 8bits.
   </entry></row>

   <row><entry><literal>validity</literal></entry>
   <entry><literal>number (minutes)</literal></entry>
   <entry valign="bottom">
         Optional. If given, Kannel will inform SMS Center that it should only
	 try to send the message for this many minutes. If the destination
	 mobile is off other situation that it cannot receive the sms, the
	 smsc discards the message.
	 Note: you must have your Kannel box time synchronized with the SMS Center.
   </entry></row>

   <row><entry><literal>deferred</literal></entry>
   <entry><literal>number (minutes)</literal></entry>
   <entry valign="bottom">
         Optional. If given, the SMS center will postpone the message to be
	 delivered at now plus this many minutes.
	 Note: you must have your Kannel box time synchronized with the SMS Center.
   </entry></row>

   <row><entry><literal>dlrmask</literal></entry>
   <entry><literal>number (bit mask)</literal></entry>
   <entry valign="bottom">
	   Deprecated. See <literal>dlr-mask</literal>.
   </entry></row>

   <row><entry><literal>dlr-mask</literal></entry>
   <entry><literal>number (bit mask)</literal></entry>
   <entry valign="bottom">
	   Optional. Request for delivery reports with the state of the sent 
	   message. The value is a bit mask composed of: 1: Delivered to phone, 
	   2: Non-Delivered to Phone, 4: Queued on SMSC, 8: Delivered to SMSC, 
	   16: Non-Delivered to SMSC. Must set <literal>dlr-url</literal> on 
	   <literal>sendsms-user</literal> group or use the 
	   <literal>dlr-url</literal> CGI variable. 
   </entry></row>

   <row><entry><literal>dlrurl</literal></entry>
   <entry><literal>string (url)</literal></entry>
   <entry valign="bottom">
	   Deprecated. See <literal>dlr-url</literal>.
   </entry></row>

   <row><entry><literal>dlr-url</literal></entry>
   <entry><literal>string (url)</literal></entry>
   <entry valign="bottom">
	   Optional. If <literal>dlr-mask</literal> is given, this is the url to
	   be fetched. (Must be url-encoded)
   </entry></row>

   <row><entry><literal>pid</literal></entry>
   <entry><literal>byte</literal></entry>
   <entry valign="bottom">
	   Optional. Sets the PID value. (See ETSI Documentation).
	   Ex: SIM Toolkit messages would use something like 
	   <literal>&amp;pid=127&amp;coding=1&amp;alt-dcs=1&amp;mclass=3</literal>
   </entry></row>

   <row><entry><literal>alt-dcs</literal></entry>
   <entry><literal>number</literal></entry>
   <entry valign="bottom">
	   Optional. If unset, Kannel uses the alt-dcs defined on smsc configuration,
	   or 0X per default. If equals to 1, uses FX. If equals to 0, force 0X.
   </entry></row>

   <row><entry><literal>rpi</literal></entry>
   <entry><literal>number</literal></entry>
   <entry valign="bottom">
	   Optional. Sets the Return Path Indicator (RPI) value. (See ETSI Documentation).
   </entry></row>

   <row><entry><literal>account</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
	Optional. Account name or number to carry forward for billing purposes.
	This field is logged as ACT in the log file so it allows you to do some
	accounting on it if your front end uses the same username for all services
	but wants to distinguish them in the log. In the case of a HTTP SMSC
	type the account name is prepended with the service-name (username) and a colon (:)
	and forwarded to the next instance of Kannel. This allows hierarchical accounting.
   </entry></row>

   <row><entry><literal>binfo</literal></entry>
     <entry>string</entry>
     <entry valign="bottom">
	Optional. Billing identifier/information proxy field used to pass arbitrary
	billing transaction IDs or information to the specific SMSC modules. For EMI2 this
	is encapsulated into the XSer 0c field, for SMPP this is encapsulated into the 
	service_type of the submit_sm PDU.
   </entry></row>

   <row><entry><literal>priority</literal></entry>
   <entry>number</entry>
   <entry valign="bottom">
     Optional. Sets the Priority value (range 0-3 is allowed).
     (Defaults to 0, which is the lowest priority).
   </entry></row>

  </tbody>
  </tgroup>
 </table>

	
</sect2>

<sect2>
<title>Using the HTTP interface to send OTA configuration messages</title>

       <para>OTA messages can be sent to mobile phones or devices to auto-configure the  
       settings for WAP. They are actually complex SMS messages with UDH and sent as
       concatenated messages if too long (and compiled if necessary).</para>
		 
		 <para>You may either pass an HTTP request as GET method or POST method to the 
		 HTTP interface.</para>

		 <para>If you want to send a configuration that is defined within Kannel's 
		 configuration file itself you have to pass a valid 
		 <literal>ota-id</literal> value otherwise the content of the request will 
		 be compiled to as OTA message.</para>

<sect3>
<title>OTA settings and bookmark documents</title>

       <para>
       Here is an example XML document (this one contains CSD settings for logging
       in to a mobile service; note that you must store DTD locally):

<programlisting>
&#60;?xml version="1.0"?&#62;
&#60;!DOCTYPE CHARACTERISTIC-LIST SYSTEM "file:///gw/settings.dtd"&#62;
&#60;CHARACTERISTIC-LIST&#62;

  &#60;CHARACTERISTIC TYPE="ADDRESS"&#62;
    &#60;PARM NAME="BEARER" VALUE="GSM/CSD"/&#62;
    &#60;PARM NAME="PROXY" VALUE="10.11.12.13"/&#62;
    &#60;PARM NAME="PORT" VALUE="9201"/&#62;
    &#60;PARM NAME="CSD_DIALSTRING" VALUE="+12345678"/&#62;
    &#60;PARM NAME="PPP_AUTHTYPE" VALUE="PAP"/&#62;
    &#60;PARM NAME="PPP_AUTHNAME" VALUE="yourusername"/&#62;
    &#60;PARM NAME="PPP_AUTHSECRET" VALUE="yourauthsecret"/&#62;
    &#60;PARM NAME="CSD_CALLTYPE" VALUE="ISDN"/&#62;
    &#60;PARM NAME="CSD_CALLSPEED" VALUE="9600"/&#62;
  &#60;/CHARACTERISTIC&#62;

  &#60;CHARACTERISTIC TYPE="URL" 
                  VALUE="http://wap.company.com/"/&#62;

  &#60;CHARACTERISTIC TYPE="NAME"&#62;
    &#60;PARM NAME="NAME" VALUE="Your WAP Company"/&#62;
  &#60;/CHARACTERISTIC&#62;

&#60;/CHARACTERISTIC-LIST&#62;
</programlisting>

       A bookmark document looks like this:

<programlisting>
&#60;?xml version="1.0"?&#62;
&#60;!DOCTYPE CHARACTERISTIC_LIST SYSTEM "file:///gw/settings.dtd"&#62;
&#60;CHARACTERISTIC-LIST&#62;
  &#60;CHARACTERISTIC TYPE="BOOKMARK"&#62;
    &#60;PARM NAME="NAME" VALUE="WAP Company"/&#62;
    &#60;PARM NAME="URL" VALUE="http://wap.company.com/"/&#62;
  &#60;/CHARACTERISTIC&#62;
&#60;/CHARACTERISTIC-LIST&#62;
</programlisting>

       Document type definition (DTD) for these documents is not
       available from Internet, you must supply it as a file. Kannel
       gw directory contains an
       example, <literal>settings.dtd</literal>.

       </para>
</sect3>

<sect3>
<title>OTA syncsettings documents</title>

	<para>Used for the provisioning of sync configuration to
	  SyncMl enabled handsets. Best supported by sonyericcsson
	  terminals.
	</para>

	<para>Sample syncsettings documents to set contacts, connection data
	  and authentication:

<programlisting>
&#60;SyncSettings&#62;
&#60;Version&#62;1.0&#60;/Version&#62;
&#60;HostAddr&#62;http://syncml.server.com&#60;/HostAddr&#62;
&#60;RemoteDB&#62;
  &#60;CTType&#62;text/x-vcard&#60;/CTType&#62;
  &#60;CTVer&#62;2.1&#60;/CTVer&#62;
  &#60;URI&#62;contact&#60;/URI&#62;
  &#60;Name&#62;Address Book&#60;/Name&#62;
&#60;/RemoteDB&#62;
&#60;Name&#62;Synchonization&#60;/Name&#62;
&#60;Auth&#62;
  &#60;AuthLevel&#62;1&#60;/AuthLevel&#62;
  &#60;AuthScheme&#62;1&#60;/AuthScheme&#62;
  &#60;Username&#62;yourusername&#60;/Username&#62;
  &#60;Cred&#62;passwordbase64encoded&#60;/Cred&#62;
&#60;/Auth&#62;
&#60;/SyncSettings&#62;
</programlisting>

</para>

</sect3>

<sect3>
<title>OMA provisioning content</title>

	<para>OMA provisioning allows the configuration of a wider
	  range of settings than previously available in OTA
	  terminals. Refer to OMA-WAP-ProvCont-v1_1-20021112-C (at
	  http://www.openmobilealliance.org/tech/docs/) for details.
	</para>

	<para>A shared secret (i.e. a pin or the phone IMSI) can be
	  used to authenticate the settings. Defaults are 'userpin'
	  and '1234' a. See the cgi variables 'sec' and 'pin' for
	  available authentication options.
	</para>

</sect3>
<sect3>
<title>GET method for the OTA HTTP interface</title>
														  
		 <para>An example URL (OTA configuration defined in the Kannel 
		 configuration file):
	
	<screen><userinput>
	http://smsbox.host.name:13013/cgi-bin/sendota?
	    otaid=myconfig&amp;username=foo&amp;password=bar&amp;to=0123456
	</userinput></screen>

       URL containing XML document looks like this (you must URL encode it before sending
       it over HTTP): 

	<screen><userinput>
	http://smsbox.host.name:13013/cgi-bin/sendota?
	    username=foo&amp;password=bar&amp;to=0123456&amp;
	    text=MyURLEncodedXMLdocument&amp;type=settings
	</userinput></screen>
       
       You can send either settings, bookmark, syncsettings, or
       oma-settings, set CGI variable type accordingly.  Default for
       this variable is settings.
       </para>

 <table frame="none">
  <title>OTA CGI Variables</title>
  <tgroup cols="3">
  <tbody>
   <row><entry><literal>otaid</literal></entry>
   <entry><literal>string</literal></entry>
   <entry valign="bottom">
        Name or ID of the 'ota-setting' group in Kannel configuration
        that should be sent to the phone. This variable is optional.
        If it is not given the first 'ota-setting' group is sent. This
        is unnecessary when a XML document is send to the phone.
   </entry></row>

   <row><entry><literal>username</literal></entry>
   <entry><literal>string</literal></entry>
   <entry valign="bottom">
        Username of the 'sendsms-user' group in Kannel configuration, that has
        been configured to send OTA messages.
   </entry></row>

   <row><entry><literal>password</literal></entry>
   <entry><literal>string</literal></entry>
   <entry valign="bottom">
       Password associated with given <literal>username</literal>. Must match
       corresponding field in 'sendsms-user' group in Kannel configuration, or
       'Authorization failed' is returned.
   </entry></row>

   <row><entry><literal>to</literal></entry>
   <entry><literal>number</literal></entry>
   <entry valign="bottom">
       Number of the phone that is to receive the OTA configuration message.
   </entry></row>

   <row><entry><literal>from</literal></entry>
   <entry><literal>string</literal></entry>
   <entry valign="bottom">
       Phone number of the sender. This field is usually overridden by
       the SMS Center, or it can be overridden by faked-sender
       variable in the sendsms-user group. If this variable is not
       set, smsbox global-sender is used.
   </entry></row>

	<row><entry><literal>smsc</literal></entry>
   <entry><literal>string</literal></entry>
   <entry valign="bottom">
        Optional virtual smsc-id from which the message is supposed to 
	have arrived. This is used for routing purposes, if any denied
	or preferred SMS centers are set up in SMS center
	configuration. This variable can be overridden with a
        <literal>forced-smsc</literal> configuration
        variable. Likewise, the <literal>default-smsc</literal> variable
        can be used to set the SMSC if it is not set otherwise.
   </entry></row>

   <row><entry><literal>text</literal></entry>
   <entry><literal>XML document</literal></entry>
   <entry valign="bottom">
       An URL encoded XML document, containing either settings or bookmarks.
   </entry></row>

   <row><entry><literal>type</literal></entry>
   <entry><literal>string</literal></entry>
   <entry valign="bottom">
       Type of the XML document, supported values are "settings",
       "bookmarks", "syncsettings", and "oma-settings". Default is "settings".
   </entry></row>

   <row><entry><literal>sec</literal></entry>
   <entry><literal>string</literal></entry>
   <entry valign="bottom">
       Security model used to authenticate oma-settings. One of:
       "userpin", "netwpin", "usernetwpin", or "userpinmac".
   </entry></row>

   <row><entry><literal>pin</literal></entry>
   <entry><literal>number</literal></entry>
   <entry valign="bottom">
     Authentication token.
   </entry></row>

  </tbody>
  </tgroup>
 </table>

</sect3>

</sect2>

</sect1>

</chapter>




<chapter id="ppg">
<title>Setting up Push Proxy Gateway</title>
      <para>This chapter explains how to set up a push proxy gateway (PPG). 
       An example configuration file are given. A working push proxy gateway
      is described. Routing wap pushes to a certain smsc and asking for
      <emphasis>SMS level</emphasis> delivery reports are described.</para>
<sect1>
<title>Configuring ppg core group, for push initiator (PI) interface</title>
     <para>PPG configuration group defines gateway's service interface.
     Configuring a PPG working with a trusted PI is easiest. Actually,
     you need no configuration at all: in this case a PPG with default 
     values will be set up. Do not rely on this, default values may change.
     For PPG core configuration variables, see table 7.1.
     </para>

     <para>An example of a core configuration for PPG working only with 
     specific addresses follows. Note that ppg-deny-ip-list is not actually 
     necessary, but does make configuring simpler: IPs here are always denied,
     even when they are mentioned in the allowed IPs list.</para>

     <para>Ppg-url is a simple stamp, used for routing requests to the right 
     service. You can change this stamp by setting <literal>push-url</literal> 
     configuration variable.
     </para>
<programlisting>
group = ppg
ppg-url = /wappush
ppg-port = 8080
concurrent-pushes = 100
users = 1024
ppg-allow-ip = 194.100.32.125;127.0.0.1
ppg-deny-ip = 194.100.32.89;194.100.32.103
trusted-pi = false
</programlisting>
     <table frame="none">
     <title>PPG core group configuration variables</title>
             <tgroup cols="3"><thead><row>
             <entry>Variable</entry>
             <entry>Value</entry>
             <entry>Description</entry>
             </row></thead>
             <tbody>
             <row><entry><literal>group</literal></entry>
             <entry><emphasis>ppg</emphasis></entry>
             <entry valign="bottom">
             Mandatory value. Tells that we are configuring the PPG group.
             </entry></row>
             <row><entry><literal>ppg-port</literal></entry>
             <entry><emphasis>number</emphasis></entry>
             <entry valign="bottom">
             The port PPG is listening at. Default 8080.
             </entry></row>
             <row><entry><literal>ppg-ssl-port (o)</literal></entry>
             <entry><emphasis>number</emphasis></entry>
             <entry valign="bottom">
             Mandatory value for PPG HTTPS support. The port at which PPG listens
             for HTTPS requests. There are no defaults; you must set the value 
             separately.
             </entry></row>
             <row><entry><literal>ssl-server-cert-file</literal></entry>
             <entry><emphasis>string</emphasis></entry>
             <entry valign="bottom">
             Mandatory value for PPG HTTPS support. The file containing server's ssl
             certificate.
             </entry></row>
             <row><entry><literal>ssl-server-key-file</literal></entry>
             <entry><emphasis>string</emphasis></entry>
             <entry valign="bottom">
             Mandatory value for PPG HTTPS support. The file containing server's ssl
             private key.
             </entry></row>
             <row><entry><literal>ppg-url</literal></entry>
             <entry><emphasis>url</emphasis></entry>
             <entry valign="bottom">
             URL locating PPG services. Default <literal>/wappush
             </literal>.
             </entry></row>
             <row><entry><literal>global-sender</literal></entry>
             <entry><emphasis>string</emphasis></entry>
             <entry valign="bottom">
             Sender phone number required by some protocols.
             </entry></row>
             <row><entry><literal>concurrent-pushes</literal></entry>
             <entry><emphasis>number</emphasis></entry>
             <entry valign="bottom">
             Number of concurrent pushes expected. Note that PPG <emphasis>
             does</emphasis> work even value is too low; it will only be 
             slower. Default 100.
             </entry></row>
             <row><entry><literal>users</literal></entry>
             <entry><emphasis>number</emphasis></entry>
             <entry valign="bottom">
             Number of actually configured user accounts. Note that PPG 
             <emphasis>does</emphasis> work even value is too low; it will 
             only be slower. Default 1024.
             </entry></row>
             <row><entry><literal>trusted-pi</literal></entry>
             <entry><emphasis>boolean</emphasis></entry>
             <entry valign="bottom">
             If true, PI does authentication for PPG. Obviously, both of them
             must reside inside same firewall. Default true. If this variable
             is true, all security variables are ignored (even though they
             may be present).
             </entry></row>
             <row><entry><literal>ppg-deny-ip</literal></entry>
             <entry><emphasis>ip-list</emphasis></entry>
             <entry valign="bottom">
             PPG will not accept pushes from these IPs. Wild-cards are allowed.
             If this attribute is missing, no IP is denied <emphasis> by this
             list </emphasis>.
             </entry></row>
             <row><entry><literal>ppg-allow-ip</literal></entry>
             <entry><emphasis>ip-list</emphasis></entry>
             <entry valign="bottom">
             PPG will accept pushes from these, and only these, IPs. Wild-cards
             are allowed. Adding this list means that IPs not mentioned are 
             denied, too.
             </entry></row>
             <row><entry><literal>default-smsc</literal></entry>
     	     <entry><emphasis>string</emphasis></entry>
     	     <entry valign="bottom">
             If no SMSC ID is given with the wappush HTTP request (see below), use
             this one as default route for all push messages.
     	     </entry></row>
             <row><entry><literal>default-dlr</literal></entry>
             <entry><emphasis>string</emphasis></entry>
             <entry valign="bottom">
             If no dlr url is given with the wappush HTTP request (see below), use
             this one as default route for all push messages.
             </entry></row>
             <row><entry><literal>ppg-smsbox-id</literal></entry>
             <entry><emphasis>string</emphasis></entry>
             <entry valign="bottom">
             All ppg delivery reports are handled by this smsbox. This routes all
				 DLR messages inside beaerbox to the specified smsbox for processing
				 the HTTP requests to the DLR-URL.
             </entry></row>
             <row><entry><literal>service-name</literal></entry>
             <entry><emphasis>string</emphasis></entry>
             <entry valign="bottom">
             This is sms service name used by smsbox for wap push.
             </entry></row>
             <row><entry><literal>default-dlr</literal></entry>
             <entry><emphasis>string</emphasis></entry>
             <entry valign="bottom">
             If no dlr url is given with the wappush HTTP request (see below), use
             this one as default route for all push messages.
             </entry></row>
             <row><entry><literal>service-name</literal></entry>
             <entry><emphasis>string</emphasis></entry>
             <entry valign="bottom">
             This is sms service name used by smsbox for wap push..
             </entry></row>
             <row><entry><literal>concatenation</literal></entry>
             <entry><emphasis>boolean</emphasis></entry>
             <entry valign="bottom">
             Segment wap push binary sms. Default on. You need
             not normally set this value.
             </entry></row>
             <row><entry><literal>max-messages</literal></entry>
             <entry><emphasis>integer</emphasis></entry>
             <entry valign="bottom">
             Maximum number of sm messages generated. Default
             10. You need not set this variable, expect when 
             your push documents are <emphasis>very</emphasis>
             long.
             </entry></row>
             </tbody>
             </tgroup>
     </table>
</sect1>
<sect1>
<title>Configuring PPG user group variables</title>

      <para>In addition of pi lists similar to the core group, ppg 
      configuration specific to a certain user contains variables used for
      authentication and enforcing restrictions to phone numbers pi may 
      contact. All variables are elaborated in table 7.2.</para>

      <para>As an example, let us see how to configure a ppg user (a pi, 
      named here 'picom') allowed to send pushes only from a specified ip.
      </para>

<programlisting>
group = wap-push-user
wap-push-user = picom
ppg-username = foo
ppg-password = bar
allow-ip = 62.254.217.163
</programlisting>

      <para>It goes without saying that in real systems you must use more
            complex passwords than bar.</para>

      <table frame="none">
      <title>PPG user group configuration variables</title>
      <tgroup cols="3"><thead><row>
             <entry>Variable</entry>
             <entry>Value</entry>
             <entry>Description</entry>
             </row></thead>
             <tbody>
             <row><entry><literal>group</literal></entry>
             <entry><emphasis>wap-push-user</emphasis></entry>
             <entry valign="bottom">
             Mandatory value. Tells that we are configuring the users group.
             </entry></row>
             <row><entry><literal>wap-push-user</literal></entry>
             <entry><emphasis>string</emphasis></entry>
             <entry valign="bottom">
             (More) human readable name of an user.
             </entry></row>
             <row><entry><literal>ppg-username</literal></entry>
             <entry><emphasis>string</emphasis></entry>
             <entry valign="bottom">
             Username for this user.
             </entry></row>
             <row><entry><literal>ppg-password</literal></entry>
             <entry><emphasis>string</emphasis></entry>
             <entry valign="bottom">
             Password for this user.
             </entry></row>
             <row><entry><literal>allowed-prefix</literal></entry>
             <entry><emphasis>number-list</emphasis></entry>
             <entry valign="bottom">
             Phone number prefixes allowed in pushes coming from this pi. These
             prefixes must conform international phone number format.
             </entry></row>
             <row><entry><literal>denied-prefix</literal></entry>
             <entry><emphasis>number-list</emphasis></entry>
             <entry valign="bottom">
             Phone number prefixes denied in pushes coming from this pi. These
             prefixes must conform international phone number format.
             </entry></row>
             <row><entry><literal>white-list</literal></entry>
             <entry><emphasis>url</emphasis></entry>
             <entry valign="bottom">
             Defines an url where from the white-list can be fetched. White list
             itself contains list of phone numbers accepting pushes from this 
             pi.
             </entry></row>
             <row><entry><literal>black-list</literal></entry>
             <entry><emphasis>url</emphasis></entry>
             <entry valign="bottom">
             Defines an url where from the blacklist can be fetched. Blacklist 
             itself contains list of phone number not accepting pushes from 
             this pi.
             </entry></row>
             <row><entry><literal>allow-ip</literal></entry>
             <entry><emphasis>ip-list</emphasis></entry>
             <entry valign="bottom">
             Defines IPs where from this pi can do pushes. Adding this list 
             means that IPs not mentioned are denied.
             </entry></row>
             <row><entry><literal>deny-ip</literal></entry>
             <entry><emphasis>ip-list</emphasis></entry>
             <entry valign="bottom">
             Defines IPs where from this pi cannot do pushes. IPs not mentioned
             in either list are denied, too.
             </entry></row>
	     <row><entry><literal>default-smsc</literal></entry>
     	     <entry><emphasis>string</emphasis></entry>
     	     <entry valign="bottom">
             If no SMSC ID is given with the wappush HTTP request (see below), use
             this one as default route for this specific push user.
     	     </entry></row>
	     <row><entry><literal>forced-smsc</literal></entry>
     	     <entry><emphasis>string</emphasis></entry>
     	     <entry valign="bottom">
             Allow only routing to a defined SMSC ID for this specific push user.
     	     </entry></row>
             <row><entry><literal>dlr-url</literal></entry>
             <entry><emphasis>string</emphasis></entry>
             <entry valign="bottom">
             If no dlr  is given with the wappush HTTP request (see below), use
             this one as default route for this specific push user.
             </entry></row>
             <row><entry><literal>smsbox-id</literal></entry>
             <entry><emphasis>string</emphasis></entry>
             <entry valign="bottom">
             Smsbox handling delivery reports fro this user.
             </entry></row>
	     <row><entry><literal>forced-smsc</literal></entry>
             <entry><emphasis>string</emphasis></entry>
             <entry valign="bottom">
             Allow only routing to a defined SMSC ID for this specific push user.
     	     </entry></row>

     <row><entry><literal>white-list-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
             Defines the set of phone-numbers accepting pushes from this 
             pi.
        See section on <xref linkend="regular-expressions"/> for details.
        </entry>   
     </row>

     <row><entry><literal>black-list-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
             Defines the set of phone-numbers rejecting pushes from this 
             pi.
        See section on <xref linkend="regular-expressions"/> for details.
        </entry>   
     </row>

     <row><entry><literal>allowed-prefix-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
             Set of phone number prefixes allowed in pushes coming from this pi. 
        See section on <xref linkend="regular-expressions"/> for details.
        </entry>   
     </row>
     <row><entry><literal>denied-list-regex</literal></entry>
        <entry>POSIX regular expression</entry>
        <entry valign="bottom">
             Set of phone number prefixes denied in pushes coming from this pi. 
        See section on <xref linkend="regular-expressions"/> for details.
        </entry>   
     </row>

             </tbody>
             </tgroup>
      </table>
</sect1>
<sect1>
<title>Finishing ppg configuration</title>
     <para>PPG uses SMS for sending SI to the phone and an IP bearer to
     fetch content specified by it (see chapter Overview of WAP Push). This
     means both wapbox and bearer smsc connections are in use. So your push 
     proxy gateway configuration file must contain groups core, wapbox, smsc 
     and smsbox. These are configured normal way, only smsc group may have 
     push-specific variables. Note that following configurations are only an 
     example, you may need more complex ones.
     </para>
     <para>Bearerbox setup does not require any new variables:</para>
<programlisting>
group = core
admin-port = 13000
smsbox-port = 13001
wapbox-port = 13002
admin-password = b
wdp-interface-name = "*"
log-file = "filename"
log-level = 1
box-deny-ip = "*.*.*.*"
box-allow-ip = "127.0.0.1"
unified-prefix = "00358,0"
</programlisting>
      <para>You must set up wapbox, for pulling (fetching) the wap data, and
      of course starting the push itself. No new variables here, either.
      </para> 
<programlisting>
group = wapbox
bearerbox-host = localhost
log-file = "filename"
log-level = 0
syslog-level = none
</programlisting>
      <para>To set up smsc connections, for pushing SI or SL over SMS. Here
      HTTP SMSC is used as an example. Variables no-sender and no-coding 
      simplify HTTP request generated by Kannel. Send-url specifies content 
      gateway, or sendsms service.
      </para>
<programlisting>
group = smsc
smsc = http
smsc-id = HTTP
port = 10000
system-type = kannel
smsc-username = foo
smsc-password = bar
no-sender = true
no-coding = true
send-url = http://host:port/path
</programlisting>
     <para>To set up smsbox. This is used for ppg delivery reports,
     see later.</para>
<programlisting>
group = smsbox
bearerbox-host = localhost
smsbox-id = dlrbox
</programlisting>
      <para>Kannel sources contain a sample push configuration file 
      <literal>gw/pushkannel.conf</literal>.</para>
</sect1>
<sect1>
<title>Running a push proxy gateway</title>
     <para>Push proxy gateway is started by simply typing, using separate 
     windows:
	<screen><userinput>
	gw/bearerbox [config-file]
	gw/wapbox [config-file]
	</userinput></screen>
     You can, of course, use more complex command line options.</para>
</sect1>
<sect1>
<title>An example using HTTP SMSC</title>
     <para>An easy way to test and implement push services is to put ppg
     in the front of an existing sendsms service capable to send SMS data
     messages and to understand HTTP requests generated by HTTP SMSC.
     (See next chapter.) Then you need only configure SMSC configuration 
     send-url to point to sendsms service.</para>
</sect1>
<sect1>
<title>An example of minimum SI document</title>
     <para> Service indication (SI) should work with all types of
     phones, service loading does not. URL to be loaded is the
     main content of the document in both cases, however. Here an 
     example (this is a minimum si document, not usable for testing,
     probably, but you want PPG to generate only one one SM per 
     SI, if at all possible):</para>
<programlisting>
&#60;?xml version="1.0"?&#62;
&#60;!DOCTYPE si PUBLIC "-//WAPFORUM//DTD SI 1.0//EN"
"http://www.wapforum.org/DTD/si.dtd"&#62;
&#60;si&#62;
    &#60;indication href="http://www.gni.ch"
        si-id="1@gni.ch"&#62;
            You have 4 new emails
    &#60;/indication&#62;
&#60;/si&#62;
</programlisting>
      <para>Note following points:
            a) Every SI must have different si-id. If there are none,
               href is used as an (very unsatisfactory) id.
            b) this si should not interrupt the phone's current action.
      </para>
</sect1>
<sect1>
<title>An example push (tokenized SI) document</title>
       <para>HTTP SMSC generates a HTTP get request when it get a send-message 
       event, expressed in Unicode. The content gateway, or the sendsms 
       service must, of course, understand this URL. So here is an example,
       cgi variable text contains the url escaped form of a SI document. It is
       usable for testing prototype phones.
       </para>
	<screen><userinput>
	http://matrix:8080/phplib/kannelgw.php?user=*deleted*&amp;
	pass=*deleted*=to=%2B358408676001&amp;text=3D%02%06%17%AE%96localhost
	%3A8080%00%AF%80%8D%CF%B4%80%02%05j%00E%C6%0C%03wap.iobox.fi%00%11%03
	1%40wiral.com%00%07%0A%C3%07%19%99%06%25%15%23%15%10%C3%04+%02%060%01
	%03Want+to+test+a+fetch%3F%00%01%01&amp;udh=%06%05%04%0B%84%23%F0
	</userinput></screen>
</sect1>

<sect1>
<title>Default network and bearer used by push proxy gateway</title>
       <para> If network and bearer attributes of the pap control document are
       missing or set any, Kannel uses address type for routing purposes: if
       the address type is a phone number (TYPE=PLMN), network defaults to GSM
       and bearer to SMS; if it is a IP-address (TYPE=IPv4), network defaults
       to GSM and bearer to CSD. So following minimal pap document works:
<programlisting>
&#60;?xml version="1.0"?&#62;
&#60;!DOCTYPE pap PUBLIC "-//WAPFORUM//DTD PAP//EN"
          "http://www.wapforum.org/DTD/pap_1.0.dtd"&#62;
&#60;pap&#62;
  &#60;push-message push-id="9fjeo39jf084@pi.com"&#62;
    &#60;address address-value="WAPPUSH=+358408676001/TYPE=PLMN@ppg.carrier.com"/&#62;
  &#60;/push-message&#62;
&#60;/pap&#62;
</programlisting>
       </para>
</sect1>

<sect1>
<title>Push related Kannel headers</title>
       <para>This chapter recapitulates Kannel headers used by ppg.</para>

       <para>PPG uses many Kannel headers. These are very similar as ones
       used by smsbox. (Both send sms to to the phone, after all.)</para>

       <table frame="none">
       <title>Kannel headers used by PPG</title>
       <tgroup cols="3">
       <thead><row><entry>Variable</entry>
       <entry>Value</entry>
       <entry>Description</entry></row></thead>
       <tbody>
       <row><entry><literal>X-Kannel-SMSC</literal></entry>
       <entry><emphasis>string</emphasis></entry>
       <entry valign="bottom">Name of smsc used to deliver this push.
       Smsc configuration must contain some of corresponding variables, 
       see </entry></row>
       <row><entry><literal>X-Kannel-DLR-URL</literal></entry>
       <entry><emphasis>url</emphasis></entry>
       <entry valign="bottom">Url smsbox would call this url when doing 
       the delivery report. Note that it can contain all Kannel escapes.
       See table 6.7 for details.</entry></row>
       <row><entry><literal>X-Kannel-DLR-Mask</literal></entry>
       <entry><emphasis>number</emphasis></entry>
       <entry valign="bottom">Mask telling smsbox when it should do
       the delivery reports. Values are same as used by smsbox, see
       chapter Delivery Reports for details.</entry></row>
       <row><entry><literal>X-Kannel-Smsbox-Id</literal></entry>
       <entry><emphasis>string</emphasis></entry>
       <entry valign="bottom">Tells which smsbox does the delivery
       report. Smsbox configuration must contain corresponding 
       variable.</entry></row>
       </tbody>
       </tgroup>
       </table>
</sect1>

<sect1>
<title>Requesting SMS level delivery reports for WAP pushes</title>
       <para>Push content is a normal binary SM, so you can ask delivery 
       reports for them. These are useful for testing purposes (did the
       phone get the content at all, or did it just reject it.) Another
       use is create fall-back services for phones not supporting displaying
       a specific push content. (MMS one being perhaps currently most
       obvious.) Generally speaking, this service is very similar to 
       smsbox one. See chapter Delivery Reports for details.</para>

       <para> For ppg sms delivery reports you will need a fully working 
       smsbox. Add configuration variable <literal>smsbox-id</literal> to
       <literal>smsbox</literal> group (it is necessary, because there
       is no MT from any smsbox corresponding the delivery report 
       bearerbox is receiving):</para>

<programlisting>
       group = smsbox
       smsbox-id = dlrbox
       bearerbox-host = localhost
       log-file = "/var/log/kannel/smsbox-core.log"
       log-level = 0
       access-log = "/var/log/kannel/smsbox-access.log"
</programlisting>

       <para> Start smsbox normal way after updating the configuration
       file. </para>

       <para> You must add to PPG configuration file two less obvious
       variables: <literal>ppg-smsbox-id</literal> and <literal>
       service-name</literal>. <literal>Ppg-smsbox-id</literal> 
       defines smsbox through which you want to route delivery reports,
       <literal>service-name</literal> makes possible for smsbox to
       handle wap pushes as a separate sms service.</para>

       <para>Setting <literal>ppg-smsbox-id</literal> will route all
       ppg messages through same smsbox. You can route delivery 
       reports of separate user through separate smsboxes, by using
       configuration variable <literal>smsbox-id</literal> in group
       wap push user. Or you can use <literal>X-Kannel-Smsbox-Id
      </literal>. This means routing every message separately. </para>

       <para> You can supply dlr url and dlr mask as kannel header, or
       as a configuration variable in ppg user or ppg core group. (This
       is order of precedence, too.) First one is valid for only one
       message, second for a specific user, and third for every ppg
       user. </para>

       <para> So following is a minimum ppg core group for sms delivery
       reports:</para>

<programlisting>
group = ppg
ppg-url = /wappush
ppg-port = 8080
concurrent-pushes = 100
trusted-pi = true
users = 1024
service-name = ppg
ppg-smsbox-id = dlrbox
</programlisting>

       <para>And you can add Kannel headers to http post request. Here
       an example code snippet (C using Kannel gwlib; this example asks
       for all possible delivery reports).</para>

<programlisting>
http_header_add(push_headers, "X-Kannel-SMSC", "link0");
http_header_add(push_headers, "X-Kannel-DLR-Url",
                "http://193.53.0.56:8001/notification-dlr?smsc-id=%i"
                "&amp;status=%d&amp;answer=%A&amp;to=%P&amp;from=%p&amp;ts=%t");
http_header_add(push_headers, "X-Kannel-DLR-Mask",
                octstr_get_cstr(dos = octstr_format("%d", 31)));
http_header_add(push_headers, "X-Kannel-Smsbox-Id", "dlrbox"));
</programlisting>

       <para>Here status=%d tells the type of the delivery report and
       answer=%A the delivery report itself (sms content of it).
       Other ones are needed to map delivery report to original wap
       push.</para>

       <para>With these  you can use with following http post request</para>

<screen><userinput>
       http://193.53.0.56:8080/phplib/kannelgw.php?user=*deleted*&amp;
       pass=*deleted*=to=%2B358408676001&amp;text=3D%02%06%17%AE%96localhost
       %3A8080%00%AF%80%8D%CF%B4%80%02%05j%00E%C6%0C%03wap.iobox.fi%00%11%03
       1%40wiral.com%00%07%0A%C3%07%19%99%06%25%15%23%15%10%C3%04+%02%060%01
       %03Want+to+test+a+fetch%3F%00%01%01&amp;udh=%06%05%04%0B%84%23%F0
</userinput></screen>

       <para>Note that you can use all sms service escapes in dlrurl, see
       Parameters (Escape Codes) for details.</para>

       <para> If you want to set dlr url for a specific user, you must set
       configuration variable <literal>dlr-url</literal>in <literal>
       wap-push-user</literal>, if for entire ppg, <literal>default-dlr-url
       </literal> in group <literal>ppg</literal>. Value must naturally match
       with one used in group smsc.</para>
</sect1>

<sect1>
<title>Routing WAP pushes to a specific smsc</title>
       <para> This chapter explains how to route wap push to a specific
       smsc. </para>

       <para> Smsc routing for wap pushes is similar to sms pushes. So,
       firstly you must define configuration variable <literal>smsc-id
       </literal> in smsc group (or groups) in question. Say you used
       value <literal>link0</literal>. You can send this as a Kannel
       header:</para>

<programlisting>
http_header_add(push_headers, "X-Kannel-SMSC", "link0");
</programlisting> 

       <para>Then you can issue a request:</para>

<screen><userinput>
       http://193.53.0.56:8080/phplib/kannelgw.php?user=*deleted*&amp;
       pass=*deleted*=to=%2B358408676001&amp;text=3D%02%06%17%AE%96localhost
       %3A8080%00%AF%80%8D%CF%B4%80%02%05j%00E%C6%0C%03wap.iobox.fi%00%11%03
       1%40wiral.com%00%07%0A%C3%07%19%99%06%25%15%23%15%10%C3%04+%02%060%01
       %03Want+to+test+a+fetch%3F%00%01%01&amp;udh=%06%05%04%0B%84%23%F0
</userinput></screen>

      <para> You can use configuration variables to route all messages of a
      specific user or all ppg messages. Set <literal>default-smsc</literal>
      in group wap-push-user or in group ppg.</para>

      <para>Again precedence of various methods of setting the smsc is 
      kannel header, then configuration variable in group wap push user and
      then in group ppg.</para>

</sect1>
     
</chapter>


<chapter id="ssl-enabling">
<title>Using SSL for HTTP</title>

	<para>This chapter explains how you can use SSL to ensure
	secure HTTP communication on both, client and server side.
	</para>

	<para>Beware that the gateway, is acting in both roles of
	the HTTP model:

	<orderedlist>
	 <listitem><para>as HTTP client, i.e. for requesting URLs 
	   while acting as WAP gateway and while fetching information
		for the SMS services.</para></listitem>
	 <listitem><para>as HTTP server, i.e. for the administration HTTP
	   interface, the PPG and for the sendsms HTTP interface.
		</para></listitem>
   </orderedlist>

	That is why you can specify separate certification files within
	the core group to be used for the HTTP sides.</para>

	<para>You can use one or both sides of the SSL support. There 
	is no mandatory to use both if only one is desired.</para>

	<sect1>
	 <title>Using SSL client support</title>
     <para>To use the client support please use the following
	    configuration directive within the core group</para>
<programlisting>
group = core
...
ssl-client-certkey-file = "filename"
</programlisting>
	  <para>Now you are able to use https:// scheme URLs within 
 	    your WML decks and SMS services.</para>
	</sect1>	

	<sect1>
	 <title>Using SSL server support for the administration HTTP
	   interface</title>
     <para>To use the SSL-enabled HTTP server please use the 
	    following configuration directive within the core group
		 </para>
<programlisting>
group = core
...
admin-port-ssl = true
...
ssl-server-cert-file = "filename"
ssl-server-key-file = "filename"
</programlisting>
	</sect1>	

	<sect1>
	 <title>Using SSL server support for the sendsms HTTP
	   interface</title>
     <para>To use the SSL-enabled HTTP server please use the 
	    following configuration directive within the core and 
		 smsbox groups
		 </para>
<programlisting>
group = core
...
ssl-server-cert-file = "filename"
ssl-server-key-file = "filename"

group = smsbox
...
sendsms-port-ssl = true
</programlisting>
	</sect1>

        <sect1>
        <title>Using SSL server support for PPG HTTPS interface</title>
        <para>
        If you want use PAP over HTTPS, (it is, a https scheme) add following 
        directives to the ppg core group:
<programlisting>
group = ppg
...
ppg-ssl-port = 8090
ssl-server-cert-file = "/etc/kannel/cert1.pem"
ssl-server-key-file = "/etc/kannel/key1.pem"
</programlisting>
        </para>
        <para>
        PPG uses a separate port for HTTPS traffic, so so you must define it. This
        means that you can use both HTTP and HTTPS, when needed.
        </para>
        </sect1>
							  
</chapter>

<chapter id="delivery-reports">
<title>SMS Delivery Reports</title>

	<para>This chapter explains how to set up Kannel to deliver delivery reports.
	</para>
	
	<para>Delivery reports are a method to tell your system if the message
	has arrived on the destination phone. There are different things which can happen
	to a message on the way to the phone which are:
	</para>
	<para>
	<itemizedlist>
	<listitem><para>Message gets rejected by the SMSC (unknown subscriber, invalid destination number etc).</para></listitem>
	<listitem><para>Message gets accepted by the SMSC but the phone rejects the message.</para></listitem>
	<listitem><para>Message gets accepted by the SMSC but the phone is off or out of reach.
	 The message gets buffered.</para></listitem>
	<listitem><para>Message gets successfully delivered.</para></listitem>
	</itemizedlist>
	</para>
	
	<note>
	    <para>If you want to use delivery reports, you must define a <literal>smsc-id</literal> for each smsc group.</para>
	</note>

	<para>When you deliver SMS to Kannel you have to indicate what kind of delivery report messages you
	would like to receive back from the system. The delivery report types currently implemented are:
	<itemizedlist>
	<listitem><para>1: delivery success</para></listitem>
	<listitem><para>2: delivery failure</para></listitem>
	<listitem><para>4: message buffered</para></listitem>
	<listitem><para>8: smsc submit</para></listitem>
	<listitem><para>16: smsc reject</para></listitem>
	</itemizedlist>
	If you want multiple report types, you simply add the values together. For example if you want to get delivery success and/or failure
	you set the <literal>dlr-mask</literal> value to 1+2. and so on. If you specify <literal>dlr-mask</literal> on the URL you pass on to
	Kannel you also need to specify <literal>dlr-url</literal>. <literal>dlr-url</literal> should contain the URL to which
	Kannel should place a HTTP requests once the delivery report is ready to be delivered back to your system.
	</para>
	<para>
	An example transaction would work as following.
	<itemizedlist>
	<listitem><para>1. you send a message using dlr-mask=7 and dlr-url=http://www.xyz.com/cgi/dlr.php?myId=123456&amp;type=%d</para></listitem>
	<listitem><para>2. Kannel forwards the message to the SMSC and keeps track of the message</para></listitem>
	<listitem><para>3. The SMSC can not reach the phone and thus returns a buffered message</para></listitem>
	<listitem><para>4. Kannel calls http://www.xyz.com/cgi/dlr.php?myId=123456&amp;type=4 to indicate the message being buffered</para></listitem>
	<listitem><para>5. The phone is switched on and the SMS gets delivered from the SMSC. The SMSC reports this to Kannel</para></listitem>
	<listitem><para>6. Kannel calls http://www.xyz.com/cgi/dlr.php?myId=123456&amp;type=1 to indicate the final success</para></listitem>
	</itemizedlist>
	<note>
	  <para>
	  If you put your own message ID in the dlr-url like in the example above, you can then use this ID to update your database
	  with the message status.
	  </para>
	</note>
	Depending on the SMSC type not all type of messages are supported. For example a CIMD SMSC does
	not support buffered messages. Also some SMSC drivers have not implemented all DLR types.
	</para>
</chapter>


<chapter id="bug-reporting">
<title>Getting help and reporting bugs</title>

	<para>This chapter explains where to find help with problems
	related to the gateway, and the preferred procedure for reporting
	bugs and sending corrections to them.</para>
	
	<para>The Kannel development mailing list is devel@kannel.org.  To subscribe, send mail to <ulink url="mailto:devel-subscribe@kannel.org">devel-subscribe@kannel.org</ulink>.
	This is currently the best location for asking help and reporting
	bugs. Please include configuration file and version number.</para>
	
</chapter>

<appendix id="upgrading-notes">
<title>Upgrading notes</title>

	<para>This appendix includes pertinent information about required
	changes on upgrades.
	</para>

<sect1>
	<title>From 1.2.x or 1.3.1 to 1.3.2 and later</title>
	<para>
		<itemizedlist>
		<listitem><para>1. <literal>at</literal> module was dropped and <literal>at2</literal> module is now called <literal>at</literal></para></listitem>
		<listitem><para>2. <literal>emi</literal> module was renamed to <literal>emi_x25</literal>, <literal>emi_ip</literal> sub-module was dropped and <literal>emi2</literal> is now called <literal>emi</literal>.</para></listitem>
		</itemizedlist>
	</para>
</sect1>

</appendix>

<appendix id="certificates">
<title>Certificate generation</title>

	<para>This appendix includes pertinent information about required SSL
		certificate genaration, where needed.
	</para>

<sect1>
	<title>Self-signed 1024-bit RSA SSL certificates using openssl</title>
	<para>
		<orderedlist numeration="arabic">
			<listitem><para>Generate private key:</para>
				<para><literal>openssl genrsa -des3 -out server.key 1024</literal></para>
				<para>You will be asked for a passphrase.</para></listitem>

			<listitem><para>Generate a certificate request:</para>
				<para><literal>
					openssl req -new -key server.key -out server.csr
				</literal></para>
				<para>Several questions follow. At the end you may send server.csr
					to a certificate authority, which in turn will sign it and
					generate the certificate for you, or you can sign it yourself.
			</para></listitem>

			<listitem><para>Remove passphrase from key:</para>
				<para><literal>cp server.key server.key.org</literal>
				</para>
				<para><literal>openssl rsa -in server.key.org -out server.key
				</literal></para>
				<para><literal>rm server.key.org</literal></para>
			</listitem>

			<listitem><para>Self-sign the certificate:</para>
				<para>If you chose not to send the request to a Certificate
					Authority, you will need to sign it yourself. This one is good
					for 1 year:</para>
				<para><literal>openssl x509 -req -days 365 -in server.csr -signkey
					server.key -out server.crt</literal></para>
		</listitem>

			<listitem><para>Move keys to desired location:</para>
				<para><literal>mv server.crt /etc/kannel/public/server.crt</literal>
				</para>
				<para><literal>mv server.key /etc/kannel/private/server.key
				</literal></para>
				<para><literal>mv server.csr /etc/ianwap/private/ianwap.csr (key
					request)</literal></para>
			</listitem>
		</orderedlist>
	</para>
	<para>Update configuration accordingly</para>
</sect1>

</appendix>
<appendix>
<title>Using the fake WAP sender</title>

	<para>This appendix explains how to use the fake WAP sender
	to test the gateway.</para>

</appendix>


<appendix>
<title>Using the fake SMS center</title>

	<para>Fakesmsc is a simple testing tool to test out Kannel and
	its SMS services. It <emphasis>cannot</emphasis> be used to
	send messages to mobile terminals, it is just a simulated SMS
	center with no connection to real terminals.</para>

<sect1>
<title>Setting up fakesmsc</title>

    <para>This section sums up needed steps to set up system for
    fakesmsc use.</para>


<sect2>
<title>Compiling fakesmsc</title>

     <para>The fake SMS center should compile at the same time as main
     Kannel compiles. The outcome binary,
     <literal>fakesmsc</literal>, is in <literal>test</literal>
     directory. The source code is quite simple and trivial, and is
     easily edited.</para>

</sect2>
<sect2>
<title>Configuring Kannel</title>

     <para>To use <literal>fakesmsc</literal> to test out Kannel, you
     have to add it to main configuration file (see above). The
     simplest form for this configuration group is like this:</para>

<programlisting>
group = smsc
smsc = fake
port = 10000
</programlisting>

      <para>The fakesmsc configuration group accepts all common 'smsc' 
      configuration group variables, like <literal>smsc-id</literal>,
      <literal>preferred-smsc-id</literal> or
      <literal>denied-smsc-id</literal>, which can be used to test out
      routing systems and diverted services, before setting up real
      SMS center connections. If you include a fakesmsc group when
      bearerbox is connected to real SMS centers, you should add
      the <literal>connect-allow-ip</literal> variable to prevent
      unauthorized use.</para>

      <para>To set up multiple fakesmsc'es, just add new
      groups. Remember to put a different port number to each one.</para>

</sect2>

</sect1>
<sect1>
<title>Running Kannel with fakesmsc connections</title>

      <para>After configuring Kannel, you can start testing
      it. The bearerbox will listen for fakesmsc client connections
      to the port(s) specified in the configuration file.</para>

<sect2>
<title>Starting fake SMS center</title>

    <para>Each fakesmsc is started from command line, with all sent
    messages after command name. If any options are used (see below),
    they are put between the command and the messages. The usage is as
    follows:</para>

<programlisting>
test/fakesmsc [options] &lt;message1&gt; [message2 ...]
</programlisting>

    <para>Options and messages are explained below, but as a quick
    example, a typical startup can go like this:</para>

<programlisting>
test/fakesmsc -i 0.1 -m 100 "100 200 text nop" "100 300 text echo this"
</programlisting>

    <para>This tells fakesmsc to connect to bearerbox at localhost:10000
    (default) and send a hundred messages with an interval of 0.1 seconds.
    Each message is from number 100, and is either to number 200 with
    message 'nop' or to 300 with message 'echo this'.</para>

    <para>Messages received from bearerbox are shown in the same format
    (described below).</para>

<sect3>
<title>Fake messages</title>

    <para>Each message consists of four or five parts: sender number,
    receiver number, type, udh (if present) and main message itself.
    Sender and receiver numbers do not mean anything except for log files
    and number-based routing in Kannel.</para>

    <para>The parts of a message are separated with spaces. As each message is
    taken as one argument, it must be put in quotation marks.</para>

    <para>Message type must be one of the following: "text", "data", "ucs2", 
    "udh-data", "udh-text", "route" and "dlr-mask".
    Here are some examples:</para>

<programlisting>
test/fakesmsc -i 0.01 -v 1 -m 1000 "100 300 text echo this message"
test/fakesmsc -i 0.01 -m 1000 "100 300 data echo+these+chars%03%04%7f"
test/fakesmsc -m 1 "100 500 udh-data %0eudh+stuff+here main+message"
</programlisting>

    <para>For "text", the rest of the argument is taken as the literal
    message. For "data", the next part must be the url-encoded version of
    the message. Space is coded as '+'. For "ucs2", the next part must be the
    url-encoded version of the message. For "udh-data", the next 2 parts
    are the UDH and main message. Both must be in url-encoded form. For "udh-text",
    the UDH part must be url-encoded, and the message is taken as literals.
    For "route" both values are literal, where the first value defines the smsbox
    route destination. For "dlr-mask" noth values are literal, where the first
    value defines the numerical DLR event.
    </para>

    <para>If multiple messages are given, fakesmsc randomly chooses
    one for each sending.</para>

</sect3>
<sect3>
<title>Interactive mode</title>
    <para>If no messages are passed on the command line when starting fakesmsc,
		it runs on "interactive mode".</para>
		<para>When running on this mode, fakesmsc accept single messages typed on stdin
		(without quotation marks) and displays the responses on stdout. This allows
		for a more finely controlled interaction with the backend applications.</para>
</sect3>
<sect3>
<title>Fakesmsc command line options</title>

   <para>Fake SMS center can be started with various optional command
   line arguments.</para>

 <table frame="none">
  <title>Fakesmsc command line options</title>
  <tgroup cols="3">
  <thead>
   <row>
     <entry>Switch</entry>
     <entry>Value</entry>
     <entry>Description</entry>
   </row>
  </thead>
  <tbody>
   <row><entry><literal>-H</literal></entry>
     <entry><emphasis>host</emphasis></entry>
     <entry valign="bottom">
       Use host <emphasis>host</emphasis> instead of default
       <literal>localhost</literal>.
     </entry></row>

   <row><entry><literal>-r</literal></entry>
     <entry><emphasis>port</emphasis></entry>
     <entry valign="bottom">
       Use port number <emphasis>port</emphasis> instead of default
       10000.
     </entry></row>

   <row><entry><literal>-i</literal></entry>
     <entry><emphasis>interval</emphasis></entry>
     <entry valign="bottom">
       Use message interval <emphasis>interval</emphasis> (in seconds,
       fractions accepted) instead of default interval 1.0 seconds.
     </entry></row>

   <row><entry><literal>-m</literal></entry>
     <entry><emphasis>max</emphasis></entry>
     <entry valign="bottom">
       Send a maximum of <emphasis>max</emphasis> messages. Value -1
       means that an unlimited number of messages is sent. Default -1.
       Using 0 can be useful to listen for messages sent via other
       channels.
     </entry></row>
  </tbody>
  </tgroup>
 </table>

    <para>In addition, fakesmsc accepts all common Kannel <xref
    linkend="arguments" endterm="arguments.title"/> like 
    <literal>--verbosity</literal>.</para>

</sect3>

</sect2>
</sect1>

</appendix>

<appendix>
<title>Setting up a test environment for Push Proxy Gateway</title>

       <para>This appendix explains how to set a test environment for PPG. 
       This contains a simulated SMSC, for instance a http server simulation
       (this is used as example, because it is simplest) and a simulated
       push initiator. Between them, there is the push proxy gateway to be
       tested. This means that you must configure HTTP SMSC.
       </para>
<sect1>
<title>Creating push content and control document for testing</title>
      <para>
      Here is an example of a push control document, which gives PPG 
      instructions how to do the pushing.
      <programlisting>
&#60;?xml version="1.0"?&#62;
&#60;!DOCTYPE pap PUBLIC "-//WAPFORUM//DTD PAP//EN"
          "http://www.wapforum.org/DTD/pap_1.0.dtd"&#62;
&#60;pap&#62;
  &#60;push-message push-id="9fjeo39jf084@pi.com"
                deliver-before-timestamp="2001-09-28T06:45:00Z"
                deliver-after-timestamp="2001-02-28T06:45:00Z"
                progress-notes-requested="false"&#62;
    &#60;address address-value="WAPPUSH=+358408676001/TYPE=PLMN@ppg.carrier.com"/&#62;
    &#60;quality-of-service priority="low"
                        delivery-method="unconfirmed"
                        network-required="true"
                        network="GSM"
                        bearer-required="true"
                        bearer="SMS"/&#62;
  &#60;/push-message&#62;
&#60;/pap&#62;
      </programlisting>
      Because the push content is send to the phone over SMS, right value for
      <literal>network-required</literal> and <literal>bearer-required
      </literal> is true, for <literal>network</literal> GSM and for <literal>bearer
      </literal> SMS. However, you can omit these values altogether, if you use
      a phone number as an address. Address value is international phone number and
      it must start with plus. It is used here as an unique identifier, SMSC, or 
      sendsms script must transform it to an usable phone number.
      </para>
      <para>
      Here is an example of Service Indication, a type of push content. 
      Essentially, the phone displays, when it receives this SI, the text 
      "Want to test a fetch" and if the user wants, fetches the content 
      located by URL <literal>http://wap.iobox.fi</literal>.
      <programlisting>
&#60;?xml version="1.0"?&#62;
&#60;!DOCTYPE si PUBLIC "-//WAPFORUM//DTD SI 1.0//EN"
          "http://www.wapforum.org/DTD/si.dtd"&#62;
&#60;si&#62;
  &#60;indication href="http://wap.iobox.fi"
              si-id="1@wiral.com"
              action="signal-high"
              created="1999-06-25T15:23:15Z"
              si-expires="2002-06-30T00:00:00Z"&#62;
    Want to test a fetch?
  &#60;/indication&#62;
&#60;/si&#62;
      </programlisting>
      Note that the date value of the si-expires attribute contains trailing
      zeroes. They are OK here, because SI tokenizer removes them. But phones
      does not accept them in the final SMS data message. You should probably
      use <literal>action="signal-high"</literal> for testing purposes, for
      it causes an immediate presentation of the push message. Production
      usage is a quite another matter.
      </para>

      <para>
      Another example of push content is Service Loading. In principle, the phone
      should fetch immediately content from URL <literal>http://wap.iobox.fi
      </literal> when it receives this document. This sounds quite insecure, and
      indeed, user invention is probably required before fetching.

      <programlisting>
&#60;?xml version="1.0"?&#62;
&#60;!DOCTYPE sl PUBLIC "-//WAPFORUM//DTD SL 1.0//EN"
          "http://www.wapforum.org/DTD/sl.dtd"&#62;
&#60;sl href="http://wap.iobox.fi"
    action="execute-high"&#62;
&#60;/sl&#62;
      </programlisting>
      </para>

</sect1>
<sect1>
<title>Starting necessary programs</title>
       <para>PPG test environment contains, in addition of wapbox and 
       bearerbox, two test programs, <literal>test_ppg</literal> (simulating
       push initiator) and <literal>test_http_server</literal> (simulating 
       a SMSC center accepting pushed content send over SMS. You can find 
       both of these programs in <literal>test</literal> directory, and they 
       both are short and easily editable. </para>

       <para>To set up a test environment, you must first configure a push
       proxy gateway (setting flag trusted-pi true makes testing easier). 
       This explained in Chapter "Setting up push proxy gateway". Then issue 
       following commands, in Kannel's root directory and in separate windows:
	<screen><userinput>
	gw/bearerbox [config-file]
	gw/wapbox [config-file]
	</userinput></screen>
       Of course you can use more complicated wapbox and bearerbox command
       line options, if necessary.</para>

       <para>To run a http smsc,  start http server simulation:
	<screen><userinput>
	test/test_http_server -p port
	</userinput></screen>
       You can, of course, select the port at will. Remember, though, that
       PPG listens at the port defined in the ppg configuration file. Other 
       <literal>test_http_server</literal> options are irrelevant here.</para>

       <para>Lastly, start making push requests, for instance with a test 
       program <literal> test_ppg</literal>. Its first argument is a URL 
       specifying location of push services. Other arguments are two file 
       names, first one push content and second one pap control document. 
       (For command line options, see Table C.1.). For example doing one 
       push(you can simplify push url by setting a ppg configuration variable,
       see "Setting up push proxy gateway"; q flag here prevents dumping of 
       test_ppg program debugging information):
       </para>
	<screen><userinput>
	test/test_ppg -q http://ppg-host-name:ppg-port/ppg-url [content_file] 
	[control_file]
	</userinput></screen>

       <para> This presumes that you have set trusted-pi true.
       </para>

       <para>If you want use authentication in a test environment, you can pass
       username and password either using headers (setting flag -b) or url (you
       must have set trusted-pi false and added wap-push-user configuration group):
       </para>

	<screen><userinput>
	test/test_ppg -q http://ppg-host-name:ppg-port?username=ppg-username'&amp;'
	password=ppg-password [content_file] [control_file]
	</userinput></screen>
   
       <table frame="none">
             <title>Test_ppg's command line options</title>
             <tgroup cols="3"><thead><row>
             <entry>Switch</entry>
             <entry>Value</entry>
             <entry>Description</entry>
             </row></thead>
             <tbody>
             <row><entry><literal>-c</literal></entry>
             <entry><emphasis>string</emphasis></entry>
             <entry valign="bottom">
             Use content qualifier <emphasis>string</emphasis> instead of 
             default <literal>si</literal> (service indication). Allowed 
             values are wml, si, sl, sia, multipart, nil and scrap. Nil and 
             scrap are used for debugging purposes. Wml does work with some 
             older phone simulators.
             </entry></row>
             <row><entry><literal>-a</literal></entry>
             <entry><emphasis>string</emphasis></entry>
             <entry valign="bottom">
             Use application id <emphasis>string</emphasis> instead of default
             <literal>any</literal>. Application identifies the application in
             the phone that should handle the push request. Sia, ua, mms, nil
             and scrap are accepted. Nil and scrap are used for debugging 
             purposes.
             </entry></row>
             <row><entry><literal>-e</literal></entry>
             <entry><emphasis>string</emphasis></entry>
             <entry valign="bottom">
             Use transfer encoding when sending a push content. Only base64 is
             currently supported.
             </entry></row>
             <row><entry><literal>-b</literal></entry>
             <entry><emphasis>boolean</emphasis></entry>
             <entry valign="bottom">
             Use headers for authentication, instead of url. Default off.
             </entry></row>
             <row><entry><literal>-i</literal></entry>
             <entry><emphasis>number</emphasis></entry>
             <entry valign="bottom">
             Wait interval <emphasis>number</emphasis> instead of default
             <literal>0</literal> between pushes.
             </entry></row>
             <row><entry><literal>-r</literal></entry>
             <entry><emphasis>number</emphasis></entry>
             <entry valign="bottom">
             Do <emphasis>number</emphasis> requests instead of default
             <literal>1</literal>.
             </entry></row>
             <row><entry><literal>-t</literal></entry>
             <entry><emphasis>number</emphasis></entry>
             <entry valign="bottom">
             Use <emphasis>number</emphasis> threads instead of default
             <literal>1</literal>.
             </entry></row>
             <row><entry><literal>-s</literal></entry>
             <entry><emphasis>string</emphasis></entry>
             <entry valign="bottom">
             Use <literal>string</literal> as a X-WAP-Application-Id
             header (You must supply whole header).
             </entry></row>

             <row><entry><literal>-I</literal></entry>
             <entry><emphasis>string</emphasis></entry>
             <entry valign="bottom">
             Use <literal>string</literal> as a X-WAP-Initiator-URI
             header (You must supply whole header).
             </entry></row>

             <row><entry><literal>-B</literal></entry>
             <entry><emphasis>boolean</emphasis></entry>
             <entry valign="bottom">
             If set, accept binary content. Default is off.
             <literal>1</literal>.
             </entry></row>
             <row><entry><literal>-d</literal></entry>
             <entry><emphasis>enumerated string</emphasis></entry>
             <entry valign="bottom">
             Set delimiter to be used. Acceptable values are crlf and
             lf. Default is <literal>crlf</literal>.
             </entry></row>
             <row><entry><literal>-p</literal></entry>
             <entry><emphasis>boolean</emphasis></entry>
             <entry valign="bottom">
             If set, add an preamble (hard-coded one). Default
             is off.
             </entry></row>
             <row><entry><literal>-E</literal></entry>
             <entry><emphasis>boolean</emphasis></entry>
             <entry valign="bottom">
             if set, add an epilogue (hard-coded). Default is off.
             </entry></row>
             </tbody>
             </tgroup>
       </table>
</sect1>
<sect1>
<title>Using Nokia Toolkit as a part of a developing environment</title>
       <para>This chapter describes a developing environment using Nokia 
       Toolkit instead of <literal>test_http_server</literal> program.
       </para>
       <para>You cannot use a real phone for testing a push server. Sending
       random messages to a phone does not work, because its only feedback
       (if it works properly) in error situations is dropping the offending
       message.</para>
       <para>Nokia Toolkit, instead, displays push headers, decompiles
       tokenized documents and outputs debugging information. It is not,
       of course, a carbon copy of a real phone. But it is still useful
       for checking spec conformance of push servers.</para>
       <para>Toolkit runs on Windows, the first thing you must is to install
       a virtual machine (VMWare is one possibility) in the machine where
       Kannel runs. Then you must configure Toolkit for working with a push
       gateway.</para>
       <para>Then start <literal>bearerbox</literal> and <literal>wapbox
       </literal> similar way as told before. You must set the correct client
       address in the push document send by <literal>test_ppg</literal>
       program. Use IP address of our virtual machine (easiest way to get this
       is to ping your virtual machine name in the dos prompt window). Your
       bearer is in this case IP. An example pap document follows:</para> 
       
       <programlisting>
&#60;?xml version="1.0"?&#62;
&#60;!DOCTYPE pap PUBLIC "-//WAPFORUM//DTD PAP//EN"
          "http://www.wapforum.org/DTD/pap_1.0.dtd"&#62;
&#60;pap&#62;
  &#60;push-message push-id="9fjeo39jf084@pi.com"
                deliver-before-timestamp="2001-09-28T06:45:00Z"
                deliver-after-timestamp="2001-02-28T06:45:00Z"
                progress-notes-requested="false"&#62;
    &#60;address address-value="WAPPUSH=192.168.214.1/TYPE=IPV4@ppg.carrier.com"/&#62;
    &#60;quality-of-service priority="low"
                        delivery-method="unconfirmed"
    &#60;/quality-of-service&#62;
  &#60;/push-message&#62;
&#60;/pap&#62;
       </programlisting>
       <para>Note address-value format. It is contains type and value, 
       because PAP protocol supports different address formats.</para>
       <para>You must use <literal>test_ppg</literal>'s -a and -c flags
       when pushing messages to Toolkit. -A defines the client application
       handling pushes, right value for it is ua. -C defines the content 
       type of your push message. SI works with all Toolkits, wml only
       with some older versions. </para>
</sect1>

 <sect1>
 <title>Testing PAP protocol over HTTPS </title>
        <para>
        When testing HTTPS connection to PPG, you probably want use test_ppg's
        configuration file, because number of required parameters is quite 
        high. Here is a example test_ppg configuration file:
        </para>
 
<programlisting>
 group = test-ppg
 retries = 2
 pi-ssl = yes
 ssl-client-certkey-file = /etc/kannel/certkey.pem
 
 group = configuration
 push-url = https://localhost:8900/wappush
 pap-file = /etc/kannel/ipnoqos.txt
 content-file = /etc/kannel/si.txt
 username = foo
 password = bar
</programlisting>
 
        <para>
        With a configuration file, you can do a push by typing:
        </para>
 
	<screen><userinput>
        test/test_ppg -q [configuration_file]
	</userinput></screen>
 
        <table frame="none">
              <title>Test_ppg's configuration file directives</title>
              <tgroup cols="3"><thead><row>
              <entry>Directive</entry>
              <entry>Value</entry>
              <entry>Description</entry>
              </row></thead>
              <tbody>
              <row><entry><literal>group</literal></entry>
              <entry><emphasis>test_ppg</emphasis></entry>
              <entry valign="bottom">
              Mandatory parameter. Start of test_ppg's core group.
              </entry></row>
              <row><entry><literal>retries</literal></entry>
              <entry><emphasis>number</emphasis></entry>
              <entry valign="bottom">
              The client tries to log in to PPG <emphasis>number</emphasis> times
              before discarding the push request. Default is 2.
              </entry></row>
              <row><entry><literal>pi-ssl</literal></entry>
              <entry><emphasis>boolean</emphasis></entry>
              <entry valign="bottom">
              Mandatory parameter for HTTPS connection. Does the client use HTTPS
              connection. Default is no.
              </entry></row>
              <row><entry><literal>ssl-client-certkey-file</literal></entry>
              <entry><emphasis>filename</emphasis></entry>
              <entry valign="bottom">
               Mandatory parameter for HTTPS connection. File containing the client's 
               ssl certificate and private key. 
              </entry></row>
               <row><entry><literal>ssl-trusted-ca-file</literal></entry>
              <entry>filename</entry>
              <entry valign="bottom">
              Mandatory parameter for HTTPS connection.This file contains the 
              certificates test_ppg is willing to trust. If this directive is not set, 
              certificates are not validated and HTTPS would not be tested.
	      </entry></row>
              <row><entry><literal>group</literal></entry>
              <entry><emphasis>configuration</emphasis></entry>
              <entry valign="bottom">
              Mandatory parameter. Start of test_ppg's test group.
              </entry></row>
              <row><entry><literal>push-url</literal></entry>
              <entry><emphasis>url</emphasis></entry>
              <entry valign="bottom">
              Mandatory value. URL locating PPG's services.
              </entry></row>
              <row><entry><literal>pap-file</literal></entry>
              <entry><emphasis>filename</emphasis></entry>
              <entry valign="bottom">
              Mandatory value. File containing pap request's control document.
              </entry></row>
              <row><entry><literal>content-file</literal></entry>
              <entry><emphasis>filename</emphasis></entry>
              <entry valign="bottom">
              Mandatory value. File containing pap request's content document.
              </entry></row>
              <row><entry><literal>username</literal></entry>
              <entry><emphasis>string</emphasis></entry>
              <entry valign="bottom">
              Mandatory value. PPG service user's username.
              </entry></row>
              <row><entry><literal>password</literal></entry>
              <entry><emphasis>string</emphasis></entry>
              <entry valign="bottom">
              Mandatory value. PPG service user's password.
              </entry></row>
              </tbody>
              </tgroup>
        </table>
 </sect1>
</appendix>

<appendix>
<title>Setting up a dial-up line</title>

	<para>This appendix explains how to set up a dial-up line in Linux
	for use with the Kannel WAP gateway. In order for it to work you need
	a Linux kernel with PPP capabilities. Most distributions provides PPP
	kernel support by default. For more information how to compile PPP
	support into the kernel please read the "Linux Kernel HOWTO"
	at http://www.linuxdoc.org/.</para>

<sect1>
<title>Analog modem</title>

	<para>This section explains how to set up a dial-up line with an
	analog modem.</para>

	<para>Download and install the mgetty package.</para>

	<screen><userinput>
	rpm -ivh mgetty-VERSION-rpm
	</userinput></screen>	

	<para>To run mgetty as a daemon, add the following line to
	/etc/inittab.</para>

	<para>Read man inittab for more detailed information. In this
	example we assume your modem is connected to the serial port ttyS0
	(COM 1).</para>
	
	<screen><userinput>
	S0:2345:respawn:/sbin/mgetty ttyS0 -x 6 -D /dev/ttyS0
	</userinput></screen>

	<para>We need to start the pppd automatically when mgetty receives
	an AutoPPP request. Add the next line to /etc/mgetty+sendfax/login.config</para>

	<screen><userinput>
	/AutoPPP/ - - /usr/sbin/pppd file /etc/ppp/options.server
	</userinput></screen>

	<para>In /etc/mgetty+sendfax/mgetty.config you might need to change
	the connect speed between the computer and the modem. Note: this is
	not the connect speed between the WAP client and the server modem.
	If you are e.g. going to use a Nokia 7110 as the server side modem
	you need to change the speed to 19200. Usually you can just leave the
	speed to the default value (38400).</para>

	<screen><userinput>
	speed 38400
	</userinput></screen>

	<para>Add the following lines to /etc/ppp/options.server</para>
	
	<screen><userinput>
	refuse-chap
	require-pap
	lock
	modem
	crtscts
	passive
	192.168.1.10:192.168.1.20
	debug
	</userinput></screen>

	<para>In /etc/ppp/pap-secrets add the username and password for the
	ppp account. The IP address is the one assigned to the phone.</para>

	<screen><userinput>
	wapuser * wappswd 192.168.0.20
	</userinput></screen>

	<para>Configure your phone (this example is for Nokia 7110)</para>

	<screen><userinput>
	homepage http:/yourhost/hello.wml
	connection type continuous
	connection security off
	bearer data
	dial up number (your phone number)
	ip address (IP of host running bearerbox)
	auth type normal
	data call type analogue
	data call speed 9600
	username wapuser
	password wappswd
	</userinput></screen>
</sect1>

<sect1>
<title>ISDN terminal</title>

	<para>This section needs to be written</para>

</sect1>

</appendix>

<appendix id="regular-expressions" xreflabel="Regular Expressions">
    <title>Regular Expressions</title>
    <para>Note: this is not intended to be an introduction to regular expressions (short: regex) but a 
    description of their application within Kannel. For general information regarding regexes
    please refer to <xref linkend="Biblio-regexp"/>.
    </para>
    <sect1>
        <title>Syntax and semantics of the regex configuration parameter</title>
        <para>This section describes the regex-configuration parameters and their effects in combination with the
        respective non-regex-parameter, e.g. <literal>white-list</literal> and <literal>white-list-regex</literal>.</para>

        <sect2>
                <title>How-to setup the regex-parameters</title>
                <para>examples, short syntax, what happens on errors
                Regex-parameters are configured just as every other parameter is configured. Regular expressions are
                supported as defined by POSIX Extended Regular Expressions. Suppose a configuration where only SMS messages
                originating from a sender using a number with a prefix of "040", "050", "070" or "090" are accepted.
                Without regexes the configuration would read
                <programlisting>
                allowed-prefix="040;050;070;090"
                </programlisting>
                Using regular expressions yields a more concise configuration
                <programlisting>
                allowed-prefix-regex=^0[4579]0
                </programlisting>
                The following table gives an overview over some regex-operators and their meaning, the POSIX Regular
                Expressions manual page (regex(7)). Once again, the extended regex-syntax is used and the table is 
                just meant as a means to give a quick-start to regular expressions, the next section features some more
                complex examples.
                <informaltable>
                        <tgroup cols="2">
                                <thead>
                                        <row>
                                        <entry>Operator</entry>
                                        <entry>Meaning</entry>
                                        </row>
                                </thead>    
                                <tbody>
                                        <row>
                                        <entry><literal>|</literal></entry>
                                        <entry>or, for example "dog|hog" matches dog or hog.</entry>
                                        </row>
                                        <row>
                                        <entry><literal>{number,number}</literal></entry>
                                        <entry>repetition, for example "a{2,5}" matches - among others - 
                                        "aa", "aaa" and "baaaaad"</entry>
                                        </row>
                                        <row>
                                        <entry><literal>*</literal></entry>
                                        <entry>shorthand for {0,}</entry>
                                        </row>
                                        <row>
                                        <entry><literal>?</literal></entry>
                                        <entry>shorthand for {0,1}</entry>
                                        </row>
                                        <row>
                                        <entry><literal>+</literal></entry>
                                        <entry>shorthand for {1,}</entry>
                                        </row>
                                        <row>
                                        <entry><literal>[]</literal></entry>
                                        <entry>bracket expression, defines a class of possible single character matches.
                                        For example "[hb]og" matches "hog" and "bog". If the expression starts with
                                        <literal>^</literal> then the class is negated, e.g. "[^hb]og" does not match
                                        "hog" and "bog" but matches for example "dog".</entry>
                                        </row>
                                        <row>
                                        <entry><literal>()</literal></entry>
                                        <entry>groups patterns, e.g. "[hb]o(g|ld)" matches "hog", "hold", "bog", "bold"
                                        </entry>
                                        </row>
                                        <row>
                                        <entry><literal>[:class:]</literal></entry>
                                        <entry>A character class such as digit, space etc. See wctype(3) for details.
                                        </entry>
                                        </row>
                                        <row>
                                        <entry><literal>^</literal></entry>
                                        <entry>Start of line anchor.</entry>
                                        </row>
                                        <row>
                                        <entry><literal>$</literal></entry>
                                        <entry>End of line anchor.</entry>
                                        </row>
                                </tbody>
                        </tgroup>
                </informaltable>

                The advantages of regular expressions are at hand
		<itemizedlist>
		<listitem><para>Regexes are easier to understand, if one is fluent in POSIX Regular Expressions. 
                                Although simple expressions as shown above should be clear to everyone who has
                                ever used a standard UN*X shell.
                          </para></listitem>
                <listitem>
                        <para>Regexes are easier to maintain. Suppose the example above needed to cope with 
                        dozens of different prefixes each with subtle differences, in such cases using a - carefully
                        constructed - regular expression could help to keep things in apple pie order. 
                        Furthermore regexes help reducing redundancy within the configuration.
                        </para>
                </listitem>
                <listitem>
                        <para>Regexes more flexible than standard parameters.
                        </para>
                </listitem>
                </itemizedlist>
                Nevertheless, it must be mentioned that - in addition to the overhead involved - complexity is an issue, 
                too. Although the syntactic correctness of each used regular expression is ensured (see below)
                    the semantic correctness cannot be automatically proofed.
                </para>
                <para>
                Expressions that are not compilable, which means they are not valid POSIX regexes, force  Kannel
                to panic with a message like (note the missing "]")
	<screen><computeroutput>
                ERROR: gwlib/regex.c:106: gw_regex_comp_real: regex compilation `[hbo(g|ld)' failed: Invalid regular expression (Called from gw/urltrans.c:987:create_onetrans.)
                PANIC: Could not compile pattern '[hbo(g|ld)'
	</computeroutput></screen>
                As shown the erroneous pattern is reported in the error message. 
                </para>
        </sect2>
        
        <sect2>
                <title>Regex and non-regex-parameters</title>
                <para>
                Using the regex and non-regex version of a parameter at the same time should be done with caution.
                Both are combined in a boolean-or sense, for example
                <programlisting>
                white-list=01234
                white-list-regex=^5(23)?$
                </programlisting>
                implies that a number is accepted either if it is "01234", "5" or "523" - note the use of anchors!
                The same goes for all the other parameters, thus both mechanisms can be used without problems in parallel,
                but care should be taken that the implications are understood and wanted.
                </para>
        </sect2>
        
        <sect2>
                <title>Performance issues</title>
                <para>While there is some overhead involved, the actual performance degradation is negligible.
                At startup - e.g. when the configuration files are parsed - the regular expressions are pre-compiled
                and stored in the pre-compiled fashion, thus future comparisons involve executing the expression on 
                some string only. To be on the sure side, before using regexes extensively some benchmarking should be
                performed, to verify that the loss of performance is acceptable.
                </para>
        </sect2>
    </sect1>
    <sect1>
        <title>Examples</title>
        <para>This section discusses some simple scenarios and potential solutions based on regexes.
        The examples are not meant to be comprehensive but rather informative.</para>
        <sect2>
                <title>Example 1: core-configuration</title>
                <para>The bearerbox must only accept SMS messages from three costumers. The first costumer uses numbers
                that always start with "0824" the second one uses numbers that start with either "0123" and end in 
                "314" or start with "0882" and end in "666". The third costumer uses numbers starting with "0167"
                and ending in a number between "30" and "57".</para>
                <para>
                Important in this and in the following examples is the use of anchors, otherwise a "string contains"
                semantic instead of a "string is equal" semantic would be used.
                </para>
                <programlisting>
                group=core
                ...
                white-list-regex=^((0824[0-9]+)|(0123[0-9]+314)|(0882[0-9]+666)|(0167[0-9]+([34][0-9]|5[0-7])))$
                ...
                </programlisting>
        </sect2>
        <sect2>
                <title>Example 3: smsc-configuration</title>
                <para>Only SMS messages originating from certain SMSCs (<literal>smsc-id</literal> is either 
                        "foo", "bar" or "blah")
                are preferably forwarded to this smsc. 
                Furthermore all SMSCs with an id containing "vodafone" must never
                be forwarded to the smsc. Not the missing anchors around "vodafone".</para>
                <programlisting>
                group=smsc
                ...
                preferred-smsc-id-regex=^(foo|bar|blah)$
                denied-prefix-regex=vodafone
                ...
                </programlisting>
        </sect2>
        <sect2>
                <title>Example 4: sms-service-configuration</title>
                <para>Please note that there are a mandatory <literal>keyword</literal> and an optional
                <literal>keyword-regex</literal> fields.
                That means that service selection can be simplified as in the following example.
                Suppose that some Web-content should be delivered to the mobile. Different costumers use the 
                same service but they rely on different keywords. Whenever a sms-service is requested, Kannel
                first checks whether a regex has been defined, if not a literal match based on <literal>keyword</literal>
                is performed. If a regex is configured then the literal match is never tried.
                </para>
                <programlisting>
                group=sms-service
                ...
                keyword=web_service
                keyword-regex=^(data|www|text|net)$
                get-url=http://someserver.net/getContent.jsp
                ...
                </programlisting>
        </sect2>
    </sect1>
</appendix> 

<appendix id="meta-data" xreflabel="Meta Data">
    <title>Meta Data</title>
    <para>This appendix describes the elements and syntax required to access meta-data coming from and going to SMSC connections.</para>
    <sect1>
      <title>Overview</title>
      <para>Many SMSC services have means to exchange data that doesn't conform to the established format</para>
      <para>For example, the SMPP protocol defines the TLV (Tag, Length, Value) mechanism to allow adding arbitrary parameters
      to it's PDU's, thus extending it's functionality.</para>
      <para>To achieve this, a special group and parameters were added to abstract the meta-data into something that could be used disregarding
      the SMSC type.</para>
      <para>Currently only the SMPP module is implemented, but the format chosen allows for other modules to be added in the future.</para>
    </sect1>
    <sect1>
      <title>SMPP Implementation</title>
      <para>A special group type <literal>smpp-tlv</literal> is needed for each TLV. Each group defines the address, data type and length of the TLV</para>
      <para>Example configuration:</para>
<programlisting>
group = smpp-tlv
name = my_tlv_name
tag = 0x1601
type = octetstring
length = 20
smsc-id = a;b;c
</programlisting>

<informaltable frame="none">
  <tgroup cols="3">
    <thead><row>
     <entry>Variable</entry>
     <entry>Data Type</entry>
     <entry>Description</entry>
   </row></thead><tbody>

   <row><entry><literal>tag</literal></entry>
     <entry><literal>hex</literal></entry>
     <entry valign="bottom">
        32-Bit HEX address for the given TLV. Must match SMPP specifications for the TLV (or be agreed with the SMSC operator).
     </entry></row>

   <row><entry><literal>type</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
        Accepted data type. Accepted values are <literal>integer</literal>, <literal>nulterminated</literal> and <literal>octetstring</literal>.
        Must match SMPP specifications for the TLV (or be agreed with the SMSC operator).
     </entry></row>

   <row><entry><literal>length</literal></entry>
     <entry><literal>integer</literal></entry>
     <entry valign="bottom">
        Maximum data length expected in bytes. Must match SMPP specifications for the TLV (or be agreed with the SMSC operator).
     </entry></row>

   <row><entry><literal>smsc-id</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
        An optional smsc-id for which this TLV is valid. If smsc-id is not given
		then this TLV is valid for all SMSCs.
		To define list of smsc-id, just use ; as split char.
     </entry></row>

   <row><entry><literal>const</literal></entry>
     <entry><literal>string</literal></entry>
     <entry valign="bottom">
        An optional constant value which is used if no value is set for this TLV via meta-data.
     </entry></row>

	</tbody>
  </tgroup>
</informaltable>
<para>
Beside defined in the configuration <literal>smpp-tlv</literal> group, SMPP also supports some hardcoded <literal>meta-data</literal>
values:
<itemizedlist>
<listitem><para>data_coding</para></listitem>
<listitem><para>source_addr_ton</para></listitem>
<listitem><para>source_addr_npi</para></listitem>
<listitem><para>dest_addr_ton</para></listitem>
<listitem><para>dest_addr_npi</para></listitem>
</itemizedlist>
</para>

      <sect2>
        <title>MO Messages</title>
        <para>Meta Data coming from MO messages comes urlencoded into the <literal>%D</literal> parameter. Only TLV parameters defined on the configuration file are honored.</para>
        <sect3>
	        <title>Example</title>
	        <para><literal>http://localhost/myscript?...&amp;meta-data=%D&amp;...</literal></para>
        </sect3>
      </sect2>
      <sect2>
        <title>MT Messages</title>
        <para>To send into an MT messages the <literal>meta-data</literal> parameter should be used.</para>
        
        <para>The format used to pass the data has 2 parts: The <literal>?smsc-type?</literal> (surrounded by question marks),
        which specify the kind of smsc receiving the data (at the moment only <literal>smpp</literal> is implemented) and then a set of key/value
        pairs with the data to be transmitted. Extra smsc-types can be added surrounded by question marks and followed by the key/value pairs.</para>
        
        <para>In other words,  the data should be coded using the following format, where URLENCODE() implies that the data between parentheses should
        be urlencoded:</para>

        <para><literal>?URLENCODE(&lt;smsc-type1&gt;)?URLENCODE(key1)=URLENCODE(value1)&amp;URLENCODE(key2)=URLENCODE(value2)&amp;...</literal></para>
        <para><literal>?URLENCODE(&lt;smsc-type2&gt;)?URLENCODE(key1)=URLENCODE(value1)&amp;...</literal></para>

        <para>Only the parameters defined on the configuration file are honored.</para>

        <para>Important: For the sendsms interface, you must URLENCODE the resulting string again to pass it as a single parameter on the URL.</para>

	      <sect3>
	        <title>Examples</title>
	        <para>If we want to send the parameter "my-data" with value "Hello World" to an SMSC over SMPP, we'd use:</para>
	        <para>sendsms get-url:</para>
	        <para><literal>http://localhost:13013/cgi-bin/sendsms?...&amp;meta-data=%3Fsmpp%3Fmy-data%3DHello%2BWorld</literal></para>
          <para>sendsms post:</para>
          <para>Send <literal>?smpp?my-data=Hello+World</literal> on the <literal>X-Kannel-Meta-Data</literal> header</para>
          <para>XML:</para>
          <para><literal>&lt;meta-data&gt;?smpp?my-data=Hello+World&lt;/meta-data&gt;</literal></para>
	      </sect3>
      </sect2>
    </sect1>
</appendix>

<appendix>
<title>Log files</title>

	<para>This appendix describes the log file format.</para>

<sect1>
<title>Bearerbox Access Log</title>

	<screen><computeroutput>
	2001-01-01 12:00:00 Sent SMS [SMSC:smsc] [SVC:sms] [ACT:account] [BINFO:binfo] [FID:1234567890] [META:meta]
            [from:12345] [to:67890] [flags:0:1:0:0:0] [msg:11:Hello World] [udh:0]
	</computeroutput></screen>	

 <informaltable frame="none">
  <tgroup cols="3">
  <thead>
   <row>
     <entry>Variable</entry>
     <entry>Value</entry>
     <entry>Description</entry>
   </row>
  </thead>
  <tbody>
   <row><entry>Date</entry>
     <entry>2001-01-01 12:00:00</entry>
     <entry valign="bottom">
       Date
     </entry></row>

   <row><entry>Result</entry>
     <entry>Sent SMS</entry>
     <entry valign="bottom">
       Result: Send, failed, DLR (deliver report), Received, etc.
     </entry></row>

   <row><entry>SMSC</entry>
     <entry>smsc</entry>
     <entry valign="bottom">
	     Smsc id (<literal>smsc-id</literal>) defined in configuration 
	     group <literal>smsc</literal> 
     </entry></row>

     <row><entry>SVC</entry>
     <entry>sms</entry>
     <entry valign="bottom">
	     Service name (<literal>name</literal>) defined in configuration 
	     group <literal>sendsms-user</literal>
     </entry></row>

     <row><entry>ACT</entry>
     <entry>account</entry>
     <entry valign="bottom">
	     Account name (<literal>name</literal>) defined in configuration 
	     group <literal>sendsms-user</literal>
     </entry></row>

     <row><entry>BINF</entry>
     <entry>binfo</entry>
     <entry valign="bottom">
	     Billing information used to send this message.
     </entry></row>

     <row><entry>Foreign ID</entry>
     <entry>1234567890</entry>
     <entry valign="bottom">
	     Foreign (SMSC-provided) Message ID (only available on MT messages)
     </entry></row>

     <row><entry>META</entry>
     <entry>meta-data</entry>
     <entry valign="bottom">
	     Meta-data used to send this message.
             See <xref linkend="meta-data"/> for an explanation about meta-data.
     </entry></row>

     <row><entry>from</entry>
     <entry>12345</entry>
     <entry valign="bottom">
	     Sender
     </entry></row>

     <row><entry>to</entry>
     <entry>67890</entry>
     <entry valign="bottom">
	     Recipient
     </entry></row>

     <row><entry>Flags</entry>
     <entry>0:1:0:0:0</entry>
     <entry valign="bottom">
	     Flags: MClass, Coding, MWI, Compress, DLRMask
     </entry></row>

     <row><entry>Message Text</entry>
     <entry>11:Hello World</entry>
     <entry valign="bottom">
	     Size of message and message dump (in text or hex if it's binary)
     </entry></row>

     <row><entry>User Data Header</entry>
     <entry>0:</entry>
     <entry valign="bottom">
	     Size of UDH and UDH Hex dump 
     </entry></row>

   </tbody>
   </tgroup>
  </informaltable>

</sect1>
<sect1>
<title>Log rotation</title>

	<para>If Kannel is configured so that the bearerbox, wapbox and/or smsbox 
        log to file each of these log files will continue to grow unless administered
        in some way (this is specially true if access logs are created and/or the 
        log level is set to debug). </para>

        <para>
        A typical way of administering log files is to 'rotate' the logs on a regular 
        basis using a tool such as logrotate.  A sample logrotate script (to be added 
        to /etc/logrotate.d) is shown below. In this example the Kannel log files found 
        in /var/log/kannel are rotated and compressed daily over 365 days.  See the 
        documentation for logrotate for more details.  Of particular note however is the 
        postrotate command, this killall -HUP issues a SIGHUP signal to each Kannel
        box process running. The SIGHUP signal has the effect of reopening the log file, 
        and performing graceful restart of SMSC connections. Without this command Kannel 
        will continue to write to the rotated log file. Kannel bearerbox can use the 
        SIGUSR2 to reopen the logs only, without performing the graceful restart. This
        may be more applicable for logrotate usage. 
        </para>

        <screen><userinput>
        /var/log/kannel/*.log {
              daily
              missingok
              rotate 365
              compress
              delaycompress
              notifempty
              create 640 kannel adm
              sharedscripts
              postrotate
                    killall -USR2 bearerbox && killall -HUP smsbox wapbox || true > /dev/null 2> /dev/null
              endscript
        }
        </userinput></screen>
</sect1>

</appendix>


<glossary>
        <title>Glossary</title>

        <glossdiv><title>M</title>
                <glossentry id="MO"><glossterm>MO</glossterm><glossdef>
                        <para>Mobile Originated - a SMS from mobile to application</para>
                </glossdef></glossentry>
                <glossentry id="MT"><glossterm>MT</glossterm><glossdef>
                        <para>Mobile Terminated - a SMS from application to mobile</para>
                </glossdef></glossentry>
                <glossentry id="MWI"><glossterm>MWI</glossterm><glossdef>
                        <para>Message Waiting Indicator (See <xref linkend="Biblio-3GPP-23038"/>)</para>
                </glossdef></glossentry>
                <glossentry id="MCLASS"><glossterm>MClass</glossterm><glossdef>
                        <para>Message Class (See <xref linkend="Biblio-3GPP-23038"/>)</para>
                </glossdef></glossentry>
                <glossentry id="CODING"><glossterm>Coding</glossterm><glossdef>
                        <para>Message Coding (See <xref linkend="Biblio-3GPP-23038"/>)</para>
                </glossdef></glossentry>
        </glossdiv>

</glossary>

<bibliography>
        <title>Bibliography</title>

        <biblioentry id="Biblio-RFC-2616">
                <title>RFC 2616 - Hypertext Transfer Protocol -- HTTP/1.1</title>
                <issn><ulink url="http://www.w3.org/Protocols/rfc2616/rfc2616.html">http://www.w3.org/Protocols/rfc2616/rfc2616.html</ulink></issn>
                <subtitle>Request for Comments: 2616</subtitle>
                <orgname>The Internet Society</orgname>
                <copyright><year>1999</year></copyright>
        </biblioentry>

        <biblioentry id="Biblio-3GPP-23038">
                <title>3GPP 23.038</title>
                <issn><ulink url="http://www.3gpp.org/ftp/Specs/latest/Rel-5/23_series/23038-500.zip">http://www.3gpp.org/ftp/Specs/latest/Rel-5/23_series/23038-500.zip</ulink></issn>
                <subtitle>...</subtitle>
                <orgname>3GPP</orgname>
                <copyright><year>?</year></copyright>
        </biblioentry>

        <biblioentry id="Biblio-3GPP-23040">
                <title>3GPP 23.040</title>
                <issn><ulink url="http://www.3gpp.org/ftp/Specs/latest/Rel-5/23_series/23040-530.zip">http://www.3gpp.org/ftp/Specs/latest/Rel-5/23_series/23040-530.zip</ulink></issn>
                <subtitle>...</subtitle>
                <orgname>3GPP</orgname>
                <copyright><year>?</year></copyright>
        </biblioentry>

        <biblioentry id="Biblio-regexp">
                <title>regex(7), GNU regex manual</title>
                <!-- <issn><ulink url="http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi?coll=linux&db=man&fname=/usr/share/catman/man7/regex.7.html&srch=regex">http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi?coll=linux&db=man&fname=/usr/share/catman/man7/regex.7.html&srch=regex</ulink></issn>-->
                <subtitle></subtitle>
                <orgname>GNU</orgname>
                <copyright><year>1998</year></copyright>
        </biblioentry>
        
</bibliography>

</book>