File: megaco.html

package info (click to toggle)
erlang-doc-html 1%3A11.b.2-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 23,284 kB
  • ctags: 10,724
  • sloc: erlang: 505; ansic: 323; makefile: 62; perl: 61; sh: 45
file content (2306 lines) | stat: -rw-r--r-- 73,156 bytes parent folder | download
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- This document was generated using DocBuilder 3.3.3 -->
<HTML>
<HEAD>
  <TITLE>megaco</TITLE>
  <SCRIPT type="text/javascript" src="../../../../doc/erlresolvelinks.js">
</SCRIPT>
  <STYLE TYPE="text/css">
<!--
    .REFBODY     { margin-left: 13mm }
    .REFTYPES    { margin-left: 8mm }
-->
  </STYLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#FF00FF"
      ALINK="#FF0000">
<!-- refpage -->
<CENTER>
<A HREF="http://www.erlang.se">
  <IMG BORDER=0 ALT="[Ericsson AB]" SRC="min_head.gif">
</A>
<H1>megaco</H1>
</CENTER>

<H3>MODULE</H3>
<DIV CLASS=REFBODY>
megaco
</DIV>

<H3>MODULE SUMMARY</H3>
<DIV CLASS=REFBODY>
 Main API of the Megaco application

</DIV>

<H3>DESCRIPTION</H3>
<DIV CLASS=REFBODY>

<P> Interface module for the Megaco application

</DIV>

<H3>DATA TYPES</H3>
<DIV CLASS=REFBODY>

<PRE>
megaco_timer() = infinity | integer() | megaco_incr_timer()
megaco_incr_timer() = #megaco_incr_timer{}
    
</PRE>

<P>The record <CODE>megaco_incr_timer</CODE> contains the following fields: 
<P>
<DL>

<DT>
<CODE>wait_for = integer()</CODE>
</DT>

<DD>
 The actual timer time.<BR>


</DD>

<DT>
<CODE>factor = integer()</CODE>
</DT>

<DD>
 The factor when calculating the new timer time (wait_for).<BR>


</DD>

<DT>
<CODE>incr = integer()</CODE>
</DT>

<DD>
 The increment value when calculating the new timer time 
(wait_for).<BR>


</DD>

<DT>
<CODE>max_retries = infinity | infinity_restartable | integer()</CODE>
</DT>

<DD>
 The maximum number of repetitions of the timer.<BR>

There is a special case for this field. When the 
max_retries has the value <CODE>infinity_restartable</CODE>, it 
means that the timer is restartable as long as some 
external event occurs (e.g. receipt of a pending 
message for instance). But the timer will never be
restarted &#34;by itself&#34;, i.e. when the timer expires 
(whatever the timeout time), so does the timer. 
Whever the timer is restarted, the timeout time will 
be calculated in the usual way!<BR>


</DD>

</DL>

</DIV>

<H3>EXPORTS</H3>

<P><A NAME="start/0"><STRONG><CODE>start() -&#62; ok | {error, Reason}</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>Reason = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Starts the Megaco application
<P>Users may either explicitly be registered with
         megaco:start_user/2 and/or be statically configured by
         setting the application environment variable 'users' to a
         list of {UserMid, Config} tuples. See the function
         megaco:start_user/2 for details.
</DIV>

<P><A NAME="stop/0"><STRONG><CODE>stop() -&#62; ok | {error, Reason}</CODE></STRONG></A><BR>
<A NAME="stop"><STRONG><CODE>stop</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>Reason = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Stops the Megaco application
</DIV>

<P><A NAME="start_user/2"><STRONG><CODE>start_user(UserMid, Config) -&#62; ok | {error, Reason}</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>UserMid = megaco_mid()</CODE></STRONG><BR>
<STRONG><CODE>Config = [{user_info_item(), user_info_value()}]</CODE></STRONG><BR>
<STRONG><CODE>Reason = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Initial configuration of a user
<P>Requires the megaco application to be started. A user is
         either a Media Gateway (MG) or a Media Gateway Controller
         (MGC). One Erlang node may host many users.
<P>A user is identified by its UserMid, which must be a legal
         Megaco MID.
<P>Config is a list of {Item, Value} tuples. See
         megaco:user_info/2 about which items and values that are valid.
</DIV>

<P><A NAME="stop_user/1"><STRONG><CODE>stop_user(UserMid) -&#62; ok | {error, Reason}</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>UserMid = megaco_mid()</CODE></STRONG><BR>
<STRONG><CODE>Reason = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Delete the configuration of a user
<P>Requires that the user does not have any active connection.<A NAME="user_info"><!-- Empty --></A>
</DIV>

<P><A NAME="user_info/2"><STRONG><CODE>user_info(UserMid, Item) -&#62; Value | exit(Reason)</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>Handle = user_info_handle()</CODE></STRONG><BR>
<STRONG><CODE>UserMid = megaco_mid() </CODE></STRONG><BR>
<STRONG><CODE>Item = user_info_item()</CODE></STRONG><BR>
<STRONG><CODE>Value = user_info_value()</CODE></STRONG><BR>
<STRONG><CODE>Reason = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Lookup user information
<P>The following Item's are valid:
<P>
<DL>

<DT>
<CODE>connections</CODE>
</DT>

<DD>
         Lists all active connections for this user. Returns a
         list of megaco_conn_handle records.<BR>

         
</DD>

<DT>
<CODE>receive_handle</CODE>
</DT>

<DD>
         Construct a megaco_receive_handle record from user config<BR>

         
</DD>

<DT>
<CODE>trans_id</CODE>
</DT>

<DD>
         Current transaction id. <BR>

A positive integer or the atom 
<CODE>undefined_serial</CODE> (in case no messages has been sent).<BR>

         
</DD>

<DT>
<CODE>min_trans_id</CODE>
</DT>

<DD>
         First trans id. <BR>

A positive integer, defaults to 1.<BR>

         
</DD>

<DT>
<CODE>max_trans_id</CODE>
</DT>

<DD>
         Last trans id. <BR>

A positive integer or <CODE>infinity</CODE>, 
defaults to <CODE>infinity</CODE>.<BR>

         
</DD>

<DT>
<CODE>request_timer</CODE>
</DT>

<DD>
         Wait for reply. <BR>

The timer is cancelled when a reply is received. <BR>

When a pending message is received, the timer is 
cancelled and the <CODE>long_request_timer</CODE> is started instead 
(see below). No resends will be performed from this point 
(since we now know that the other side has received the 
request). <BR>

When the timer reaches an intermediate expire, the request
is resent and the timer is restarted. <BR>

         When the timer reaches the final expire, either the function 
<CODE>megaco:call</CODE> will return with <CODE>{error, timeout}</CODE>
or the callback function <CODE>handle_trans_reply</CODE> will be 
called with <CODE>UserReply = {error, timeout}</CODE> (if 
<CODE>megaco:cast</CODE> was used).<BR>

A Megaco Timer (see explanation above), 
         defaults to <CODE>#megaco_incr_timer{}</CODE>.<BR>

         
</DD>

<DT>
<CODE>long_request_timer</CODE>
</DT>

<DD>
         Wait for reply after having received a pending message. <BR>

When the timer reaches an intermediate expire, the timer 
is restarted. <BR>

When a pending message is received, and the 
<CODE>long_request_timer</CODE> 
is <STRONG>not</STRONG> &#34;on it's final leg&#34;, the timer will be 
restarted, and, if <CODE>long_request_resend = true</CODE>, the
request will be re-sent. <BR>

A Megaco Timer (see explanation above), 
         defaults to <CODE>infinity</CODE>.<BR>

         
</DD>

<DT>
<CODE>long_request_resend</CODE>
</DT>

<DD>
         This option indicates weather the request should be 
resent until the reply is received,
<STRONG>even</STRONG> though a pending message has been received. <BR>

Normally, after a pending message has been received, 
the request is not resent 
(since a pending message is an indication that the
request has been received). But since the reply (to the 
request) can be
lost, this behaviour has it's values.<BR>

It is ofcourse pointless to set this value to <STRONG>true</STRONG>
unless the <CODE>long_request_timer</CODE> (see above) is also set
to an incremental timer (<CODE>#megaco_incr_timer{}</CODE>). <BR>

A <CODE>boolean</CODE>, 
         defaults to <CODE>false</CODE>.<BR>

         
</DD>

<DT>
<CODE>reply_timer</CODE>
</DT>

<DD>
         Wait for an ack. <BR>

When a request is received, some info
related to the reply is store internally (e.g. the
binary of the reply). This info will live until either
an ack is received or this timer expires. For instance,
if the same request is received again (e.g. a request
with the same transaction id), the (stored) reply will
be (re-) sent automatically by megaco.<BR>

         If the timer is of type <CODE>#megaco_incr_timer{}</CODE>, 
then for each intermediate timout, the reply will be resent
(this is valid until the ack is received or 
the timer expires). <BR>

A Megaco Timer (see explanation above), defaults to 30000.<BR>

         
</DD>

<DT>
<CODE>auto_ack</CODE>
</DT>

<DD>
         Automatic send transaction ack when the transaction
         reply has been received (see <CODE>trans_ack</CODE> below). <BR>

         This is used for <STRONG>three-way-handshake</STRONG>.<BR>

         A <CODE>boolean</CODE>, defaults to <CODE>false</CODE>.<BR>

         
</DD>

<DT>
<CODE>trans_ack</CODE>
</DT>

<DD>
         Shall ack's be accumulated or not. <BR>

         This property is only valid if <CODE>auto_ack</CODE> is true.<BR>

         If <CODE>auto_ack</CODE> is true, then if <CODE>trans_ack</CODE> is
         <CODE>false</CODE>, ack's will be sent immediatelly. 
If <CODE>trans_ack</CODE> is <CODE>true</CODE>, then 
ack's will instead be sent to the transaction 
         sender process for accumulation and later sending 
         (see <CODE>trans_ack_maxcount</CODE>, <CODE>trans_req_maxcount</CODE>, 
         <CODE>trans_req_maxsize</CODE>, <CODE>trans_ack_maxcount</CODE> and 
         <CODE>trans_timer</CODE>). <BR>

         See also <A HREF="megaco_run.html#transaction_sender"> transaction sender</A> for more info.<BR>

         An <CODE>boolean</CODE>, defaults to <CODE>false</CODE>.<BR>

         
</DD>

<DT>
<CODE>trans_ack_maxcount</CODE>
</DT>

<DD>
         Maximum number of accumulated ack's. At most this many ack's
         will be accumulated by the transaction sender (if started and 
         configured to accumulate ack's).<BR>

         See also <A HREF="megaco_run.html#transaction_sender">         transaction sender</A> for more info. <BR>

         An <CODE>integer</CODE>, defaults to 10.<BR>

         
</DD>

<DT>
<CODE>trans_req</CODE>
</DT>

<DD>
         Shall requests be accumulated or not. <BR>

         If <CODE>trans_req</CODE> is <CODE>false</CODE>, then request(s)
         will be sent immediatelly (in it's own message).<BR>

         If <CODE>trans_req</CODE> is true, then request(s) will 
         instead be sent to the transaction sender process for 
         accumulation and later sending 
         (see <CODE>trans_ack_maxcount</CODE>, <CODE>trans_req_maxcount</CODE>, 
         <CODE>trans_req_maxsize</CODE>, <CODE>trans_ack_maxcount</CODE> and 
         <CODE>trans_timer</CODE>). <BR>

         See also <A HREF="megaco_run.html#transaction_sender"> transaction sender</A> for more info. <BR>

         An <CODE>boolean</CODE>, defaults to <CODE>false</CODE>.<BR>

         
</DD>

<DT>
<CODE>trans_req_maxcount</CODE>
</DT>

<DD>
         Maximum number of accumulated requests. At most this many 
         requests will be accumulated by the transaction sender 
         (if started and configured to accumulate requests). <BR>

         See also <A HREF="megaco_run.html#transaction_sender"> transaction sender</A> for more info.<BR>

         An <CODE>integer</CODE>, defaults to 10.<BR>

         
</DD>

<DT>
<CODE>trans_req_maxsize</CODE>
</DT>

<DD>
         Maximum size of the accumulated requests. At most this much
         requests will be accumulated by the transaction sender 
         (if started and configured to accumulate requests).<BR>

         See also <A HREF="megaco_run.html#transaction_sender">         transaction sender</A> for more info.<BR>

         An <CODE>integer</CODE>, defaults to 2048.<BR>

         
</DD>

<DT>
<CODE>trans_timer</CODE>
</DT>

<DD>
         Transaction sender timeout time. Has two functions. First, if 
         the value is 0, then transactions will not be accumulated 
         (e.g. the transaction sender process will not be started). 
         Second, if the value is greater then 0 and <CODE>auto_ack</CODE> 
         and <CODE>trans_ack</CODE> is true or if <CODE>trans_req</CODE> is true, 
         then transaction sender will be started and transactions 
         (which is depending on the values of <CODE>auto_ack</CODE>, 
         <CODE>trans_ack</CODE> and <CODE>trans_req</CODE>) will be accumulated,
         for later sending. <BR>
 
         See also <A HREF="megaco_run.html#transaction_sender"> transaction sender</A> for more info. <BR>

An <CODE>integer</CODE>, defaults to 0.<BR>

         
</DD>

<DT>
<CODE>pending_timer</CODE>
</DT>

<DD>
         Automatically send pending if the timer expires before a
         transaction reply has been sent. This timer is also called 
         provisional response timer. <BR>

A Megaco Timer (see explanation above), defaults to 30000.<BR>

         
</DD>

<DT>
<CODE>sent_pending_limit</CODE>
</DT>

<DD>
         Sent pending limit (see the MGOriginatedPendingLimit
         and the MGCOriginatedPendingLimit of the megaco root package).
         This parameter specifies how many pending messages that can
         be sent (for a given received transaction request).
         When the limit is exceeded, the transaction is aborted
         (see <A HREF="megaco_user.html#request_abort">         handle_trans_request_abort</A>) and an error message 
         is sent to the other side. <BR>

         Note that this has no effect on the actual sending of
         pending transactions. This is either implicit (e.g. when 
         receiving a re-sent transaction request for a request which
         is beeing processed) or controlled by the pending_timer,
         see above. <BR>

         A positive integer or <CODE>infinity</CODE>, 
defaults to <CODE>infinity</CODE>.<BR>

         
</DD>

<DT>
<CODE>recv_pending_limit</CODE>
</DT>

<DD>
         Receive pending limit (see the MGOriginatedPendingLimit
         and the MGCOriginatedPendingLimit of the megaco root package).
         This parameter specifies how many pending messages that can
         be received (for a sent transaction request).
         When the limit is exceeded, the transaction is considered
         lost, and an error returned to the user (through the call-back
         function <STRONG>handle_trans_reply</STRONG>). <BR>

         A positive integer or <CODE>infinity</CODE>, 
defaults to <CODE>infinity</CODE>. <BR>

         
</DD>

<DT>
<CODE>send_mod</CODE>
</DT>

<DD>
         Send callback module which exports send_message/2. The
         function SendMod:send_message(SendHandle, Binary) is
         invoked when the bytes needs to be transmitted to the
         remote user. <BR>

An <CODE>atom</CODE>, defaults to <CODE>megaco_tcp</CODE>.<BR>

         
</DD>

<DT>
<CODE>encoding_mod</CODE>
</DT>

<DD>
         Encoding callback module which exports encode_message/2
         and decode_message/2. The function
         EncodingMod:encode_message(EncodingConfig,
         MegacoMessage) is invoked whenever a 'MegacoMessage'
         record needs to be translated into an Erlang binary. The
         function EncodingMod:decode_message(EncodingConfig,
         Binary) is invoked whenever an Erlang binary needs to be
         translated into a 'MegacoMessage' record. <BR>

An <CODE>atom</CODE>, defaults to <CODE>megaco_pretty_text_encoder</CODE>.<BR>

         
</DD>

<DT>
<CODE>encoding_config</CODE>
</DT>

<DD>
         Encoding module config. <BR>

A <CODE>list</CODE>, defaults to <CODE>[]</CODE>.<BR>

         
</DD>

<DT>
<CODE>protocol_version</CODE>
</DT>

<DD>
         Actual protocol version. <BR>

An <CODE>integer</CODE>, default is 1.<BR>

         
</DD>

<DT>
<CODE>strict_version</CODE>
</DT>

<DD>
         Strict version control, i.e. when a message is received,
verify that the version is that which was negotiated. <BR>

An <CODE>boolean</CODE>, default is true.<BR>

         
</DD>

<DT>
<CODE>reply_data</CODE>
</DT>

<DD>
         Default reply data. <BR>

Any term, defaults to the atom <CODE>undefined</CODE>.<BR>

         
</DD>

<DT>
<CODE>user_mod</CODE>
</DT>

<DD>
         Name of the user callback module. See the the reference
         manual for megaco_user for more info.<BR>

         
</DD>

<DT>
<CODE>user_args</CODE>
</DT>

<DD>
         List of extra arguments to the user callback
         functions. See the the reference manual for megaco_user
         for more info.<BR>

         
</DD>

<DT>
<CODE>threaded</CODE>
</DT>

<DD>
         If a received message contains several transaction requests, 
         this option indicates whether the requests should be handled
         sequencially in the same process (<CODE>false</CODE>), or if each 
         request should be handled by it's own process (<CODE>true</CODE>
         i.e. a separate process is spawned for each request). <BR>

         An <CODE>boolean</CODE>, defaults to <CODE>false</CODE>. <BR>

         
</DD>

</DL>
<A NAME="update_user_info"><!-- Empty --></A>
</DIV>

<P><A NAME="update_user_info/3"><STRONG><CODE>update_user_info(UserMid, Item, Value) -&#62; ok | {error, Reason}</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>UserMid = megaco_mid() </CODE></STRONG><BR>
<STRONG><CODE>Item = user_info_item()</CODE></STRONG><BR>
<STRONG><CODE>Value = user_info_value()</CODE></STRONG><BR>
<STRONG><CODE>Reason = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Update information about a user
<P>Requires that the user is started. See megaco:user_info/2
         about which items and values that are valid.<A NAME="conn_info"><!-- Empty --></A>
</DIV>

<P><A NAME="conn_info/2"><STRONG><CODE>conn_info(ConnHandle, Item) -&#62; Value | exit(Reason)</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>ConnHandle = #megaco_conn_handle{}</CODE></STRONG><BR>
<STRONG><CODE>Item = conn_info_item()</CODE></STRONG><BR>
<STRONG><CODE>Value = conn_info_value()</CODE></STRONG><BR>
<STRONG><CODE>Reason = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Lookup information about an active connection
<P>Requires that the connection is active.
<P>
<DL>

<DT>
<CODE>control_pid</CODE>
</DT>

<DD>
         The process identifier of the controlling process for a
         connenction.<BR>

         
</DD>

<DT>
<CODE>send_handle</CODE>
</DT>

<DD>
         Opaque send handle whose contents is internal for the
         send module. May be any term.<BR>

         
</DD>

<DT>
<CODE>local_mid</CODE>
</DT>

<DD>
         The local mid (of the connection, i.e. the own mid). 
<CODE>megaco_mid()</CODE>.<BR>

         
</DD>

<DT>
<CODE>remote_mid</CODE>
</DT>

<DD>
         The remote mid (of the connection). 
<CODE>megaco_mid()</CODE>.<BR>

         
</DD>

<DT>
<CODE>receive_handle</CODE>
</DT>

<DD>
         Construct a megaco_receive_handle record.<BR>

         
</DD>

<DT>
<CODE>trans_id</CODE>
</DT>

<DD>
         Next transaction id. A positive integer or the atom 
<CODE>undefined_serial</CODE> (only in case of error). <BR>

Note that transaction id's are (currently) maintained 
on a per user basis so there is no way to be sure that 
the value returned will actually be used for a transaction 
sent on this connection (in case a user has several 
connections, which is not at all unlikely). <BR>

         
</DD>

<DT>
<CODE>max_trans_id</CODE>
</DT>

<DD>
         Last trans id. <BR>

A positive integer or <CODE>infinity</CODE>, 
defaults to <CODE>infinity</CODE>.<BR>

         
</DD>

<DT>
<CODE>request_timer</CODE>
</DT>

<DD>
         Wait for reply. <BR>

The timer is cancelled when a reply is received. <BR>

When a pending message is received, the timer is 
cancelled and the <CODE>long_request_timer</CODE> is started instead 
(see below). No resends will be performed from this point 
(since we now know that the other side has received the 
request). <BR>

When the timer reaches an intermediate expire, the request
is resent and the timer is restarted. <BR>

         When the timer reaches the final expire, either the function 
<CODE>megaco:call</CODE> will return with <CODE>{error, timeout}</CODE>
or the callback function <CODE>handle_trans_reply</CODE> will be 
called with <CODE>UserReply = {error, timeout}</CODE> (if 
<CODE>megaco:cast</CODE> was used).<BR>

A Megaco Timer (see explanation above), 
         defaults to #megaco_incr_timer{}.<BR>

         
</DD>

<DT>
<CODE>long_request_timer</CODE>
</DT>

<DD>
         Wait for reply after having received a pending message. <BR>

When the timer reaches an intermediate expire, the timer 
restarted. <BR>

When a pending message is received, and the 
<CODE>long_request_timer</CODE> 
is <STRONG>not</STRONG> &#34;on it's final leg&#34;, the timer will be 
restarted, and, if <CODE>long_request_resend = true</CODE>, the
request will be re-sent. <BR>

A Megaco Timer (see explanation above), 
defaults to <CODE>infinity</CODE>.<BR>

         
</DD>

<DT>
<CODE>long_request_resend</CODE>
</DT>

<DD>
         This option indicates weather the request should be 
resent until the reply is received,
<STRONG>even</STRONG> though a pending message has been received. <BR>

Normally, after a pending message has been received, 
the request is not resent 
(since a pending message is an indication that the
request has been received). But since the reply (to the 
request) can be
lost, this behaviour has it's values.<BR>

It is ofcourse pointless to set this value to <STRONG>true</STRONG>
unless the <CODE>long_request_timer</CODE> (see above) is also set
to an incremental timer (<CODE>#megaco_incr_timer{}</CODE>). <BR>

A <CODE>boolean</CODE>, 
         defaults to <CODE>false</CODE>.<BR>

         
</DD>

<DT>
<CODE>reply_timer</CODE>
</DT>

<DD>
         Wait for an ack. <BR>

When a request is received, some info
related to the reply is store internally (e.g. the
binary of the reply). This info will live until either
an ack is received or this timer expires. For instance,
if the same request is received again (e.g. a request
with the same transaction id), the (stored) reply will
be (re-) sent automatically by megaco.<BR>

         If the timer is of type <CODE>#megaco_incr_timer{}</CODE>, 
then for each intermediate timout, the reply will be resent
(this is valid until the ack is received or 
the timer expires). <BR>

A Megaco Timer (see explanation above), defaults to 30000.<BR>

         
</DD>

<DT>
<CODE>auto_ack</CODE>
</DT>

<DD>
         Automatic send transaction ack when the transaction
         reply has been received (see <CODE>trans_ack</CODE> below). <BR>

         This is used for <STRONG>three-way-handshake</STRONG>. <BR>

         A <CODE>boolean</CODE>, defaults to <CODE>false</CODE>.<BR>

         
</DD>

<DT>
<CODE>trans_ack</CODE>
</DT>

<DD>
         Shall ack's be accumulated or not. <BR>

         This property is only valid if <CODE>auto_ack</CODE> is true. <BR>

         If <CODE>auto_ack</CODE> is true, then if <CODE>trans_ack</CODE> is
         <CODE>false</CODE>, ack's will be sent immediatelly. 
If <CODE>trans_ack</CODE> is
         <CODE>true</CODE>, then ack's will instead be sent to the transaction 
         sender process for accumulation and later sending 
         (see <CODE>trans_ack_maxcount</CODE>, <CODE>trans_req_maxcount</CODE>, 
         <CODE>trans_req_maxsize</CODE>, <CODE>trans_ack_maxcount</CODE> and 
         <CODE>trans_timer</CODE>). <BR>

         See also <A HREF="megaco_run.html#transaction_sender"> transaction sender</A> for more info. <BR>

         An <CODE>boolean</CODE>, defaults to <CODE>false</CODE>.<BR>

         
</DD>

<DT>
<CODE>trans_ack_maxcount</CODE>
</DT>

<DD>
         Maximum number of accumulated ack's. At most this many ack's
         will be accumulated by the transaction sender (if started and 
         configured to accumulate ack's).
         <BR>
See also <A HREF="megaco_run.html#transaction_sender">          transaction sender</A> for more info.
         <BR>
An integer, defaults to 10.<BR>

         
</DD>

<DT>
<CODE>trans_req</CODE>
</DT>

<DD>
         Shall requests be accumulated or not. <BR>

         If <CODE>trans_req</CODE> is <CODE>false</CODE>, then request(s)
         will be sent immediatelly (in it's own message). <BR>

         If <CODE>trans_req</CODE> is true, then request(s) will 
         instead be sent to the transaction sender process for 
         accumulation and later sending 
         (see <CODE>trans_ack_maxcount</CODE>, <CODE>trans_req_maxcount</CODE>, 
         <CODE>trans_req_maxsize</CODE>, <CODE>trans_ack_maxcount</CODE> and 
         <CODE>trans_timer</CODE>). <BR>

         See also <A HREF="megaco_run.html#transaction_sender"> transaction sender</A> for more info. <BR>

         An <CODE>boolean</CODE>, defaults to <CODE>false</CODE>.<BR>

         
</DD>

<DT>
<CODE>trans_req_maxcount</CODE>
</DT>

<DD>
         Maximum number of accumulated requests. At most this many 
         requests will be accumulated by the transaction sender 
         (if started and configured to accumulate requests). <BR>

         See also <A HREF="megaco_run.html#transaction_sender"> transaction sender</A> for more info. <BR>

         An <CODE>integer</CODE>, defaults to 10.<BR>

         
</DD>

<DT>
<CODE>trans_req_maxsize</CODE>
</DT>

<DD>
         Maximum size of the accumulated requests. At most this much
         requests will be accumulated by the transaction sender 
         (if started and configured to accumulate requests). <BR>

         See also <A HREF="megaco_run.html#transaction_sender"> transaction sender</A> for more info. <BR>

         An <CODE>integer</CODE>, defaults to 2048.<BR>

         
</DD>

<DT>
<CODE>trans_timer</CODE>
</DT>

<DD>
         Transaction sender timeout time. Has two functions. First, if 
         the value is 0, then transactions will not be accumulated 
         (e.g. the transaction sender process will not be started). 
         Second, if the value is greater then 0 and <CODE>auto_ack</CODE> 
         and <CODE>trans_ack</CODE> is true or if <CODE>trans_req</CODE> is true, 
         then transaction sender will be started and transactions 
         (which is depending on the values of <CODE>auto_ack</CODE>, 
         <CODE>trans_ack</CODE> and <CODE>trans_req</CODE>) will be accumulated,
         for later sending. <BR>

         See also <A HREF="megaco_run.html#transaction_sender"> transaction sender</A> for more info. <BR>

An <CODE>integer</CODE>, defaults to 0.<BR>

         
</DD>

<DT>
<CODE>pending_timer</CODE>
</DT>

<DD>
         Automatic send transaction pending if the timer expires
         before a transaction reply has been sent. This timer is
         also called provisional response timer. <BR>

A Megaco Timer (see explanation above), defaults to 30000.<BR>

         
</DD>

<DT>
<CODE>sent_pending_limit</CODE>
</DT>

<DD>
         Sent pending limit (see the MGOriginatedPendingLimit
         and the MGCOriginatedPendingLimit of the megaco root package).
         This parameter specifies how many pending messages that can
         be sent (for a given received transaction request).
         When the limit is exceeded, the transaction is aborted
         (see <A HREF="megaco_user.html#request_abort">         handle_trans_request_abort</A>) and an error message 
         is sent to the other side. <BR>

         Note that this has no effect on the actual sending of
         pending transactions. This is either implicit (e.g. when 
         receiving a re-sent transaction request for a request which
         is beeing processed) or controlled by the pending_timer,
         see above. <BR>

         A positive integer or <CODE>infinity</CODE>, 
         defaults to <CODE>infinity</CODE>.<BR>

         
</DD>

<DT>
<CODE>recv_pending_limit</CODE>
</DT>

<DD>
         Receive pending limit (see the MGOriginatedPendingLimit
         and the MGCOriginatedPendingLimit of the megaco root package).
         This parameter specifies how many pending messages that can
         be received (for a sent transaction request).
         When the limit is exceeded, the transaction is considered
         lost, and an error returned to the user (through the call-back
         function <STRONG>handle_trans_reply</STRONG>). <BR>

         A positive integer or <CODE>infinity</CODE>, 
         defaults to <CODE>infinity</CODE>.<BR>

         
</DD>

<DT>
<CODE>send_mod</CODE>
</DT>

<DD>
         Send callback module which exports send_message/2. The
         function SendMod:send_message(SendHandle, Binary) is
         invoked when the bytes needs to be transmitted to
         the remote user. <BR>

An <CODE>atom</CODE>, defaults to <CODE>megaco_tcp</CODE>.<BR>

         
</DD>

<DT>
<CODE>encoding_mod</CODE>
</DT>

<DD>
         Encoding callback module which exports encode_message/2
         and decode_message/2. The function
         EncodingMod:encode_message(EncodingConfig, MegacoMessage)
         is invoked whenever a 'MegacoMessage' record needs to be
         translated into an Erlang binary. The function
         EncodingMod:decode_message(EncodingConfig, Binary) is
         invoked whenever an Erlang binary needs to be translated
         into a 'MegacoMessage' record. <BR>

An <CODE>atom</CODE>, 
defaults to <CODE>megaco_pretty_text_encoder</CODE>.<BR>

         
</DD>

<DT>
<CODE>encoding_config</CODE>
</DT>

<DD>
         Encoding module config. <BR>

A <CODE>list</CODE>, defaults to [].<BR>

         
</DD>

<DT>
<CODE>protocol_version</CODE>
</DT>

<DD>
         Actual protocol version. <BR>

An positive integer, Current default is 1.<BR>

         
</DD>

<DT>
<CODE>strict_version</CODE>
</DT>

<DD>
         Strict version control, i.e. when a message is received,
verify that the version is that which was negotiated. <BR>

An <CODE>boolean</CODE>, default is true.<BR>

         
</DD>

<DT>
<CODE>reply_data</CODE>
</DT>

<DD>
         Default reply data. <BR>

Any term, defaults to the atom <CODE>undefined</CODE>.<BR>

         
</DD>

<DT>
<CODE>threaded</CODE>
</DT>

<DD>
         If a received message contains several transaction requests, 
         this option indicates whether the requests should be handled
         sequencially in the same process (<CODE>false</CODE>), or if each 
         request should be handled by it's own process (<CODE>true</CODE>
         i.e. a separate process is spawned for each request). <BR>

         An <CODE>boolean</CODE>, defaults to <CODE>false</CODE>. <BR>

         
</DD>

</DL>
<A NAME="update_conn_info"><!-- Empty --></A>
</DIV>

<P><A NAME="update_conn_info/3"><STRONG><CODE>update_conn_info(ConnHandle, Item, Value) -&#62; ok | {error, Reason}</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>ConnHandle = #megaco_conn_handle{}</CODE></STRONG><BR>
<STRONG><CODE>Item = conn_info_item()</CODE></STRONG><BR>
<STRONG><CODE>Value = conn_info_value()</CODE></STRONG><BR>
<STRONG><CODE>Reason = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Update information about an active connection
<P>Requires that the connection is activated. See
         megaco:conn_info/2 about which items and values that are
         valid.<A NAME="system_info"><!-- Empty --></A>
</DIV>

<P><A NAME="system_info/1"><STRONG><CODE>system_info(Item) -&#62; Value | exit(Reason)</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>Item = system_info_item()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Lookup system information
<P>The following items are valid:
<P>
<DL>

<DT>
<CODE>text_config</CODE>
</DT>

<DD>
         The text encoding config.<BR>

         
</DD>

<DT>
<CODE>connections</CODE>
</DT>

<DD>
         Lists all active connections. Returns a list of
         megaco_conn_handle records.<BR>

         
</DD>

<DT>
<CODE>users</CODE>
</DT>

<DD>
         Lists all active users. Returns a list of
         megaco_mid()'s.<BR>

         
</DD>

<DT>
<CODE>n_active_requests</CODE>
</DT>

<DD>
         Returns an integer representing the number of requests
         that has originated from this Erlang node and still are
         active (and therefore consumes system resources).<BR>

         
</DD>

<DT>
<CODE>n_active_replies</CODE>
</DT>

<DD>
         Returns an integer representing the number of replies
         that has originated from this Erlang node and still are
         active (and therefore consumes system resources).<BR>

         
</DD>

<DT>
<CODE>n_active_connections</CODE>
</DT>

<DD>
         Returns an integer representing the number of active
         connections.<BR>

         
</DD>

</DL>

</DIV>

<P><A NAME="connect/4"><STRONG><CODE>connect(ReceiveHandle, RemoteMid, SendHandle, ControlPid) -&#62; {ok, ConnHandle} | {error, Reason}</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>ReceiveHandle = #megaco_receive_handle{}</CODE></STRONG><BR>
<STRONG><CODE>RemoteMid = preliminary_mid | megaco_mid()</CODE></STRONG><BR>
<STRONG><CODE>SendHandle = term()</CODE></STRONG><BR>
<STRONG><CODE>ControlPid = pid()</CODE></STRONG><BR>
<STRONG><CODE>ConnHandle = #megaco_conn_handle{}</CODE></STRONG><BR>
<STRONG><CODE>Reason = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Establish a &#34;virtual&#34; connection
<P>Activates a connection to a remote user. When this is done
         the connection can be used to send messages (with
         SendMod:send_message/2). The ControlPid is the identifier
         of a process that controls the connection. That process will
         be supervised and if it dies, this will be detected and the
         UserMod:handle_disconnect/2 callback function will be
         invoked. See the megaco_user module for more info about the
         callback arguments. The connection may also explicitly be
         deactivated by invoking megaco:disconnect/2.
<P>The ControlPid may be the identity of a process residing on
         another Erlang node. This is useful when you want to
         distribute a user over several Erlang nodes. In such a case
         one of the nodes has the physical connection. When a user
         residing on one of the other nodes needs to send a request
         (with megaco:call/3 or megaco:cast/3), the message will
         encoded on the originating Erlang node, and then be
         forwarded to the node with the physical connection. When the
         reply arrives, it will be forwarded back to the originator.
         The distributed connection may explicitely be deactivated by
         a local call to megaco:disconnect/2 or implicitely when
         the physical connection is deactivated (with megaco:disconnect/2,
         killing the controlling process, halting the other node, ...).
<P>The call of this function will trigger the callback
         function UserMod:handle_connect/2 to be invoked. See the
         megaco_user module for more info about the callback
         arguments.
<P>A connection may be established in several ways:
<P>
<DL>

<DT>
<CODE>provisioned MID</CODE>
</DT>

<DD>
         The MG may explicitely invoke megaco:connect/4 and use
         a provisioned MID of the MGC as the RemoteMid.<BR>

         
</DD>

<DT>
<CODE>upgrade preliminary MID</CODE>
</DT>

<DD>
         The MG may explicitely invoke megaco:connect/4 with the
         atom 'preliminary_mid' as a temporary MID of the MGC,
         send an intial message, the Service Change Request, to
         the MGC and then wait for an initial message, the
         Service Change Reply. When the reply arrives, the Megaco
         application will pick the MID of the MGC from the
         message header and automatically upgrade the connection
         to be a &#34;normal&#34; connection. By using this method of
         establishing the connection, the callback function
         UserMod:handle_connect/2 to be invoked twice. First with
         a ConnHandle with the remote_mid-field set to
         preliminary_mid, and then when the connection upgrade is
         done with the remote_mid-field set to the actual MID of
         the MGC.<BR>

         
</DD>

<DT>
<CODE>automatic</CODE>
</DT>

<DD>
         When the MGC receives its first message, the Service
         Change Request, the Megaco application will
         automatically establish the connection by using the MG
         MID found in the message header as remote mid.<BR>

         
</DD>

<DT>
<CODE>distributed</CODE>
</DT>

<DD>
         When a user (MG/MGC) is distributed over several nodes,
         it is required that the node hosting the connection
         already has activated the connection and that it is
         in the &#34;normal&#34; state. The RemoteMid must be a real
         Megaco MID and not a preliminary_mid.<BR>

         
</DD>

</DL>

<P>An initial megaco_receive_handle record may be obtained
        with megaco:user_info(UserMid, receive_handle)
<P>The send handle is provided by the preferred transport
         module, e.g. megaco_tcp, megaco_udp. Read the documentation
         about each transport module about the details.
</DIV>

<P><A NAME="disconnect/2"><STRONG><CODE>disconnect(ConnHandle, DiscoReason) -&#62; ok | {error, ErrReason}</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>ConnHandle = conn_handle()</CODE></STRONG><BR>
<STRONG><CODE>DiscoReason = term()</CODE></STRONG><BR>
<STRONG><CODE>ErrReason = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Tear down a &#34;virtual&#34; connection
<P>Causes the UserMod:handle_disconnect/2 callback function to
         be invoked. See the megaco_user module for more info about
         the callback arguments.<A NAME="call"><!-- Empty --></A>
</DIV>

<P><A NAME="call/3"><STRONG><CODE>call(ConnHandle, Actions, Options) -&#62; {ProtocolVersion, UserReply}</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>ConnHandle = conn_handle()</CODE></STRONG><BR>
<STRONG><CODE>Actions = action_reqs() | [action_reqs()]</CODE></STRONG><BR>
<STRONG><CODE>action_reqs() = binary() | [#'ActionRequest'{}]</CODE></STRONG><BR>
<STRONG><CODE>Options = [send_option()]</CODE></STRONG><BR>
<STRONG><CODE>send_option() = {request_timer, megaco_timer()} | {long_request_timer, megaco_timer()} | {send_handle, term()} | {protocol_version, integer()}</CODE></STRONG><BR>
<STRONG><CODE>ProtocolVersion = integer()</CODE></STRONG><BR>
<STRONG><CODE>UserReply = user_reply() | [user_reply()]</CODE></STRONG><BR>
<STRONG><CODE>user_reply() = success() | failure()</CODE></STRONG><BR>
<STRONG><CODE>success() = {ok, [#'ActionReply'{}]}</CODE></STRONG><BR>
<STRONG><CODE>failure() = message_error() | user_cancel_error() | send_error() | other_error()</CODE></STRONG><BR>
<STRONG><CODE>message_error() = {error, error_descr()}</CODE></STRONG><BR>
<STRONG><CODE>user_cancel_error() = {error, user_cancel_reason()}</CODE></STRONG><BR>
<STRONG><CODE>user_cancel_reason() = {user_cancel, reason_for_user_cancel()}</CODE></STRONG><BR>
<STRONG><CODE>reason_for_user_cancel() = term()</CODE></STRONG><BR>
<STRONG><CODE>send_error() = {error, send_reason()}</CODE></STRONG><BR>
<STRONG><CODE>send_reason() = send_cancelled_reason() | send_failed_reason()</CODE></STRONG><BR>
<STRONG><CODE>send_cancelled_reason() = {send_message_cancelled, reason_for_send_cancel()}</CODE></STRONG><BR>
<STRONG><CODE>reason_for_send_cancel() = term()</CODE></STRONG><BR>
<STRONG><CODE>send_failed_reason() = {send_message_failed, reason_for_send_failure()}</CODE></STRONG><BR>
<STRONG><CODE>reason_for_send_failure() = term()</CODE></STRONG><BR>
<STRONG><CODE>other_error() = {error, term()}</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Sends one or more transaction request(s) and waits for the 
         reply.
<P>When sending one transaction in a message, <CODE>Actions</CODE> should be 
         <CODE>action_reqs()</CODE> (<CODE>UserReply</CODE> will then be 
         <CODE>user_reply()</CODE>). When sending several transactions in a message,
         <CODE>Actions</CODE> should be <CODE>[action_reqs()]</CODE> (<CODE>UserReply</CODE> 
         will then be <CODE>[user_reply()]</CODE>). Each element of the list is 
         part of one transaction.
<P>For some of <STRONG>our</STRONG> codecs (not binary), it is also possible 
         to pre-encode the actions, in which case <CODE>Actions</CODE> will be 
         either a <CODE>binary()</CODE> or <CODE>[binary()]</CODE>.
<P>The function returns when the reply arrives, when the
         request timer eventually times out or when the outstanding
         requests are explicitly cancelled.
<P>The default values of the send options are obtained by
         <CODE>megaco:conn_info(ConnHandle, Item)</CODE>. But the send options 
above, may explicitly be overridden.
<P>The <CODE>ProtocolVersion</CODE> version is the version actually encoded
         in the reply message.
<P>At <CODE>success()</CODE>, the <CODE>UserReply</CODE> contains a list of 
'ActionReply' records possibly containing error indications.
<P>A <CODE>message_error()</CODE>, indicates that the remote user has
         replied with an explicit transactionError.
<P>A <CODE>user_cancel_error()</CODE>, indicates that the request has been
canceled by the user. <CODE>reason_for_user_cancel()</CODE> is the reason
given in the call to the <A HREF="#cancel">cancel</A>
function. 
<P>A <CODE>send_error()</CODE>, indicates that the send function of the 
megaco transport callback module failed to send the request. 
There are two separate cases: <CODE>send_cancelled_reason()</CODE> and 
<CODE>send_failed_reason()</CODE>. 
The first is the result of the send function returning 
<CODE>{cancel, Reason}</CODE> and the second is some other kind of 
erroneous return value. See the 
<A HREF="megaco_transport.html#send_message">send_message</A>
function for more info. 
<P>An <CODE>other_error()</CODE>, indicates some other error such as 
timeout.<A NAME="cast"><!-- Empty --></A>
</DIV>

<P><A NAME="cast/3"><STRONG><CODE>cast(ConnHandle, Actions, Options) -&#62; ok | {error, Reason}</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>ConnHandle = conn_handle()</CODE></STRONG><BR>
<STRONG><CODE>Actions = action_reqs() | [action_reqs()]</CODE></STRONG><BR>
<STRONG><CODE>action_reqs() = binary() | [#'ActionRequest'{}]</CODE></STRONG><BR>
<STRONG><CODE>Options = [send_option()]</CODE></STRONG><BR>
<STRONG><CODE>send_option() = {request_timer, megaco_timer()} | {long_request_timer, megaco_timer()} | {send_handle, term()} | {reply_data, reply_data()} | {protocol_version, integer()}</CODE></STRONG><BR>
<STRONG><CODE>Reason = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Sends one or more transaction request(s) but does NOT wait for a reply
<P>When sending one transaction in a message, <CODE>Action</CODE> should be 
         <CODE>action_reqs()</CODE>. When sending several transactions in a message,
         <CODE>Actions</CODE> should be <CODE>[action_reqs()]</CODE>. Each element of the 
         list is part of one transaction.
<P>For some of <STRONG>our</STRONG> codecs (not binary), it is also possible 
         to pre-encode the actions, in which case <CODE>Actions</CODE> will be 
         either a <CODE>binary()</CODE> or <CODE>[binary()]</CODE>.
<P>The default values of the send options are obtained by
         megaco:conn_info(ConnHandle, Item). But the send options above,
         may explicitly be overridden.
<P>The ProtocolVersion version is the version actually encoded
         in the reply message.
<P>The callback function UserMod:handle_trans_reply/4 is invoked
         when the reply arrives, when the request timer eventually
         times out or when the outstanding requests are explicitly
         cancelled. See the megaco_user module for more info about
         the callback arguments.
<P> Given as UserData argument to UserMod:handle_trans_reply/4.<A NAME="encode_actions"><!-- Empty --></A>
</DIV>

<P><A NAME="encode_actions/3"><STRONG><CODE>encode_actions(ConnHandle, Actions, Options) -&#62; {ok, BinOrBins} | {error, Reason}</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>ConnHandle = conn_handle()</CODE></STRONG><BR>
<STRONG><CODE>Actions = action_reqs() | [action_reqs()]</CODE></STRONG><BR>
<STRONG><CODE>action_reqs() = [#'ActionRequest'{}]</CODE></STRONG><BR>
<STRONG><CODE>Options = [send_option()]</CODE></STRONG><BR>
<STRONG><CODE>send_option() = {request_timer, megaco_timer()} | {long_request_timer, megaco_timer()} | {send_handle, term()} | {protocol_version, integer()}</CODE></STRONG><BR>
<STRONG><CODE>BinOrBins = binary() | [binary()]</CODE></STRONG><BR>
<STRONG><CODE>Reason = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Encodes lists of action requests for one or more transaction 
         request(s).
<P>When encoding action requests for one transaction, 
         <CODE>Actions</CODE> should be <CODE>action_reqs()</CODE>. 
         When encoding action requests for several transactions,
         <CODE>Actions</CODE> should be <CODE>[action_reqs()]</CODE>. Each element 
         of the list is part of one transaction.<A NAME="token_tag2string"><!-- Empty --></A>
</DIV>

<P><A NAME="token_tag2string/1"><STRONG><CODE>token_tag2string(Tag) -&#62; Result</CODE></STRONG></A><BR>
<A NAME="token_tag2string/2"><STRONG><CODE>token_tag2string(Tag, EncoderMod) -&#62; Result</CODE></STRONG></A><BR>
<A NAME="token_tag2string/3"><STRONG><CODE>token_tag2string(Tag, EncoderMod, Version) -&#62; Result</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>Tag = atom()</CODE></STRONG><BR>
<STRONG><CODE>EncoderMod = pretty | compact | encoder_module()</CODE></STRONG><BR>
<STRONG><CODE>encoder_module() = megaco_pretty_text_encoder | megaco_compact_text_encoder | atom()</CODE></STRONG><BR>
<STRONG><CODE>Version = int_version() | atom_version()</CODE></STRONG><BR>
<STRONG><CODE>int_version() = 1 | 2 | 3</CODE></STRONG><BR>
<STRONG><CODE>atom_version() = v1 | v2 | v3 | prev3b</CODE></STRONG><BR>
<STRONG><CODE>Result = string() | {error, Reason}</CODE></STRONG><BR>
<STRONG><CODE>Reason = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Convert a token tag to a string
<P>If no encoder module is given, the default is used 
(which is pretty).
<P>If no or an unknown version is given, 
the <STRONG>best</STRONG> version is used (which is prev3b).
<P>If no match is found for <CODE>Tag</CODE>, <CODE>Result</CODE> will be the 
empty string (<CODE>[]</CODE>).<A NAME="cancel"><!-- Empty --></A>
</DIV>

<P><A NAME="cancel/2"><STRONG><CODE>cancel(ConnHandle, CancelReason) -&#62; ok | {error, ErrReason}</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>ConnHandle = conn_handle()</CODE></STRONG><BR>
<STRONG><CODE>CancelReason = term()</CODE></STRONG><BR>
<STRONG><CODE>ErrReason = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Cancel all outstanding messages for this connection
<P>This causes outstanding megaco:call/3 requests to return.
         The callback functions UserMod:handle_reply/4 and
         UserMod:handle_trans_ack/4 are also invoked where it
         applies. See the megaco_user module for more info about the
         callback arguments.<A NAME="process_received_message"><!-- Empty --></A>
</DIV>

<P><A NAME="process_received_message/4"><STRONG><CODE>process_received_message(ReceiveHandle, ControlPid, SendHandle, BinMsg) -&#62; ok</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>ReceiveHandle = #megaco_receive_handle{}</CODE></STRONG><BR>
<STRONG><CODE>ControlPid = pid()</CODE></STRONG><BR>
<STRONG><CODE>SendHandle = term()</CODE></STRONG><BR>
<STRONG><CODE>BinMsg = binary()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Process a received message
<P>This function is intended to be invoked by some
         transport modules when get an incoming message. Which
         transport that actually is used is up to the user to
         choose.
<P>The message is delivered as an Erlang binary and is decoded
         by the encoding module stated in the receive handle together
         with its encoding config (also in the receive
         handle). Depending of the outcome of the decoding various
         callback functions will be invoked. See megaco_user for more
         info about the callback arguments.
<P>Note that all processing is done in the context of the calling 
         process. A transport module could call this function via one of the
         <CODE>spawn</CODE> functions (e.g. <CODE>spawn_opt</CODE>). See also 
         <CODE>receive_message/4</CODE>.

        
<P>If the message cannot be decoded the following callback
         function will be invoked:
<P>
<UL>

<LI>
UserMod:handle_syntax_error/3<BR>

</LI>


</UL>

<P>If the decoded message instead of transactions contains a
         message error, the following callback function will be
         invoked:
<P>
<UL>

<LI>
UserMod:handle_message_error/3<BR>

</LI>


</UL>

<P>If the decoded message happens to be received before the
         connection is established, a new &#34;virtual&#34; connection is
         established. This is typically the case for the Media
         Gateway Controller (MGC) upon the first Service Change.
         When this occurs the following callback function will be
         invoked:
<P>
<UL>

<LI>
UserMod:handle_connect/2<BR>

</LI>


</UL>

<P>For each transaction request in the decoded message the
         following callback function will be invoked:
<P>
<UL>

<LI>
UserMod:handle_trans_request/3<BR>

</LI>


</UL>

<P>For each transaction reply in the decoded message the reply
         is returned to the user. Either the originating function
         megaco:call/3 will return. Or in case the originating
         function was megaco:case/3 the following callback function
         will be invoked:
<P>
<UL>

<LI>
UserMod:handle_trans_reply/4<BR>

</LI>


</UL>

<P>When a transaction acknowledgement is received it is
         possible that user has decided not to bother about the
         acknowledgement. But in case the return value from
         UserMod:handle_trans_request/3 indicates that the
         acknowledgement is important the following callback function
         will be invoked:
<P>
<UL>

<LI>
UserMod:handle_trans_ack/4<BR>

</LI>


</UL>

<P>See the megaco_user module for more info about the callback
         arguments.
</DIV>

<P><A NAME="receive_message/4"><STRONG><CODE>receive_message(ReceiveHandle, ControlPid, SendHandle, BinMsg) -&#62; ok</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>ReceiveHandle = #megaco_receive_handle{}</CODE></STRONG><BR>
<STRONG><CODE>ControlPid = pid()</CODE></STRONG><BR>
<STRONG><CODE>SendHandle = term()</CODE></STRONG><BR>
<STRONG><CODE>BinMsg = binary()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Process a received message
<P>This is a callback function intended to be invoked by some
         transport modules when get an incoming message. Which
         transport that actually is used is up to the user to
         choose.
<P>In principle, this function calls the 
         <CODE>process_received_message/4</CODE> function via a <CODE>spawn</CODE> to
         perform the actual processing.
<P>For further information see the <CODE>process_received_message/4</CODE> 
         function.
</DIV>

<P><A NAME="parse_digit_map/1"><STRONG><CODE>parse_digit_map(DigitMapBody) -&#62; {ok, ParsedDigitMap} | {error, Reason}</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>DigitMapBody = string()</CODE></STRONG><BR>
<STRONG><CODE>ParsedDigitMap = parsed_digit_map()</CODE></STRONG><BR>
<STRONG><CODE>parsed_digit_map() = term()</CODE></STRONG><BR>
<STRONG><CODE>Reason = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Parses a digit map body
<P>Parses a digit map body, represented as a list of
         characters, into a list of state transitions suited to
         be evaluated by megaco:eval_digit_map/1,2.<A NAME="eval_digit_map"><!-- Empty --></A>
</DIV>

<P><A NAME="eval_digit_map/1"><STRONG><CODE>eval_digit_map(DigitMap) -&#62; {ok, MatchResult} | {error, Reason}</CODE></STRONG></A><BR>
<A NAME="eval_digit_map/2"><STRONG><CODE>eval_digit_map(DigitMap, Timers) -&#62; {ok, MatchResult} | {error, Reason}</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>DigitMap = #'DigitMapValue'{} | parsed_digit_map()</CODE></STRONG><BR>
<STRONG><CODE>parsed_digit_map() = term()</CODE></STRONG><BR>
<STRONG><CODE>ParsedDigitMap = term()</CODE></STRONG><BR>
<STRONG><CODE>Timers = ignore() | reject()</CODE></STRONG><BR>
<STRONG><CODE>ignore() = ignore | {ignore, digit_map_value()}</CODE></STRONG><BR>
<STRONG><CODE>reject() = reject | {reject, digit_map_value()} | digit_map_value()</CODE></STRONG><BR>
<STRONG><CODE>MatchResult = {Kind, Letters} | {Kind, Letters, Extra}</CODE></STRONG><BR>
<STRONG><CODE>Kind = kind()</CODE></STRONG><BR>
<STRONG><CODE>kind() = full | unambiguous</CODE></STRONG><BR>
<STRONG><CODE>Letters = [letter()]</CODE></STRONG><BR>
<STRONG><CODE>letter() = $0..$9 | $a .. $k</CODE></STRONG><BR>
<STRONG><CODE>Extra = letter()</CODE></STRONG><BR>
<STRONG><CODE>Reason = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Collect digit map letters according to the digit map.
<P>When evaluating a digit map, a state machine waits for
         timeouts and letters reported by
         megaco:report_digit_event/2. The length of the various
         timeouts are defined in the digit_map_value() record.
<P>When a complete sequence of valid events has been received,
         the result is returned as a list of letters.
<P>There are two options for handling syntax errors (that is
         when an unexpected event is received when the digit map
         evaluator is expecting some other event). The unexpected
         events may either be ignored or rejected. The latter means
         that the evaluation is aborted and an error is returned.

        <A NAME="report_digit_event"><!-- Empty --></A> 

</DIV>

<P><A NAME="report_digit_event/2"><STRONG><CODE>report_digit_event(DigitMapEvalPid, Events) -&#62; ok | {error, Reason}</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>DigitMapEvalPid = pid()</CODE></STRONG><BR>
<STRONG><CODE>Events = Event | [Event]</CODE></STRONG><BR>
<STRONG><CODE>Event = letter() | pause() | cancel()</CODE></STRONG><BR>
<STRONG><CODE>letter() = $0..$9 | $a .. $k | $A .. $K</CODE></STRONG><BR>
<STRONG><CODE>pause() = one_second() | ten_seconds()</CODE></STRONG><BR>
<STRONG><CODE>one_second() = $s | $S</CODE></STRONG><BR>
<STRONG><CODE>ten_seconds() = $l | $L</CODE></STRONG><BR>
<STRONG><CODE>cancel() = $z | $Z | cancel</CODE></STRONG><BR>
<STRONG><CODE>Reason = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Send one or more events to the event collector process.
<P>Send one or more events to a process that is evaluating a
         digit map, that is a process that is executing
         megaco:eval_digit_map/1,2.
<P>Note that the events <CODE>$s | $S</CODE>, <CODE>l | $L</CODE> and
<CODE>$z | $Z</CODE> has nothing to do with the timers using
the same characters.<A NAME="test_digit_event"><!-- Empty --></A>
</DIV>

<P><A NAME="test_digit_event/2"><STRONG><CODE>test_digit_event(DigitMap, Events) -&#62; {ok, Kind, Letters} | {error, Reason}</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>DigitMap = #'DigitMapValue'{} | parsed_digit_map()</CODE></STRONG><BR>
<STRONG><CODE>parsed_digit_map() = term()</CODE></STRONG><BR>
<STRONG><CODE>ParsedDigitMap = term()</CODE></STRONG><BR>
<STRONG><CODE>Timers = ignore() | reject()</CODE></STRONG><BR>
<STRONG><CODE>ignore() = ignore | {ignore, digit_map_value()}</CODE></STRONG><BR>
<STRONG><CODE>reject() = reject | {reject, digit_map_value()} | digit_map_value()</CODE></STRONG><BR>
<STRONG><CODE>DigitMapEvalPid = pid()</CODE></STRONG><BR>
<STRONG><CODE>Events = Event | [Event]</CODE></STRONG><BR>
<STRONG><CODE>Event = letter() | pause() | cancel()</CODE></STRONG><BR>
<STRONG><CODE>Kind = kind()</CODE></STRONG><BR>
<STRONG><CODE>kind() = full | unambiguous</CODE></STRONG><BR>
<STRONG><CODE>Letters = [letter()]</CODE></STRONG><BR>
<STRONG><CODE>letter() = $0..$9 | $a .. $k | $A .. $K</CODE></STRONG><BR>
<STRONG><CODE>pause() = one_second() | ten_seconds()</CODE></STRONG><BR>
<STRONG><CODE>one_second() = $s | $S</CODE></STRONG><BR>
<STRONG><CODE>ten_seconds() = $l | $L</CODE></STRONG><BR>
<STRONG><CODE>cancel () = $z | $Z | cancel</CODE></STRONG><BR>
<STRONG><CODE>Reason = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Feed digit map collector with events and return the result
<P>This function starts the evaluation of a digit map with
         megaco:eval_digit_map/1 and sends a sequence of events to it
         megaco:report_digit_event/2 in order to simplify testing of
         digit maps.<A NAME="encode_sdp"><!-- Empty --></A>
</DIV>

<P><A NAME="encode_sdp/1"><STRONG><CODE>encode_sdp(SDP) -&#62; {ok, PP} | {error, Reason}</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>SDP = sdp_property_parm() | sdp_property_group() | sdp_property_groups() | asn1_NOVALUE</CODE></STRONG><BR>
<STRONG><CODE>sdp_property_parm() = sdp() | property_parm()</CODE></STRONG><BR>
<STRONG><CODE>sdp() = sdp_c() | sdp_o() | sdp_s() | sdo_i() | sdo_u() | sdo_e() | sdo_p() | sdo_c() | sdo_b() | sdo_z() | sdo_k() | sdo_a() | sdo_a_rtpmap() | sdo_a_ptime() | sdo_t() | sdo_r() | sdo_m()</CODE></STRONG><BR>
<STRONG><CODE>sdp_v() = #megaco_sdp_v{} (Protocol version)</CODE></STRONG><BR>
<STRONG><CODE>sdp_o() = #megaco_sdp_o{} (Owner/creator and session indentifier)</CODE></STRONG><BR>
<STRONG><CODE>sdp_s() = #megaco_sdp_s{} (Session name)</CODE></STRONG><BR>
<STRONG><CODE>sdp_i() = #megaco_sdp_i{} (Session information)</CODE></STRONG><BR>
<STRONG><CODE>sdp_u() = #megaco_sdp_u{} (URI of description)</CODE></STRONG><BR>
<STRONG><CODE>sdp_e() = #megaco_sdp_e{} (Email address)</CODE></STRONG><BR>
<STRONG><CODE>sdp_p() = #megaco_sdp_p{} (Phone number)</CODE></STRONG><BR>
<STRONG><CODE>sdp_c() = #megaco_sdp_c{} (Connection information)</CODE></STRONG><BR>
<STRONG><CODE>sdp_b() = #megaco_sdp_b{} (Bandwidth information)</CODE></STRONG><BR>
<STRONG><CODE>sdp_k() = #megaco_sdp_k{} (Encryption key)</CODE></STRONG><BR>
<STRONG><CODE>sdp_a() = #megaco_sdp_a{} (Session attribute)</CODE></STRONG><BR>
<STRONG><CODE>sdp_a_rtpmap() = #megaco_sdp_rtpmap{}</CODE></STRONG><BR>
<STRONG><CODE>sdp_a_ptime() = #megaco_sdp_a_ptime{}</CODE></STRONG><BR>
<STRONG><CODE>sdp_a_quality() = #megaco_sdp_a_quality{}</CODE></STRONG><BR>
<STRONG><CODE>sdp_a_fmtp() = #megaco_sdp_a_fmtp{}</CODE></STRONG><BR>
<STRONG><CODE>sdp_z() = #megaco_sdp_z{} (Time zone adjustment)</CODE></STRONG><BR>
<STRONG><CODE>sdp_t() = #megaco_sdp_t{} (Time the session is active)</CODE></STRONG><BR>
<STRONG><CODE>sdp_r() = #megaco_sdp_r{} (Repeat times)</CODE></STRONG><BR>
<STRONG><CODE>sdp_m() = #megaco_sdp_m{} (Media name and transport address)</CODE></STRONG><BR>
<STRONG><CODE>sdp_property_group() = [sdp()]</CODE></STRONG><BR>
<STRONG><CODE>sdp_property_groups() = [sdp_property_group()]</CODE></STRONG><BR>
<STRONG><CODE>PP = property_parm() | property_group() | property_groups() | asn1_NOVALUE</CODE></STRONG><BR>
<STRONG><CODE>property_group() = [property_parm()]</CODE></STRONG><BR>
<STRONG><CODE>property_groups() = [property_group()]</CODE></STRONG><BR>
<STRONG><CODE>Reason = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Encode (generate) an SDP construct.
<P>If a <CODE>property_parm()</CODE> is found as part of the input
(<CODE>SDP</CODE>) then it is left unchanged.
<P>This function performs the following transformation:
<P>
<UL>

<LI>
sdp() -&#62; property_parm()<BR>

</LI>


<LI>
sdp_property_group() -&#62; property_group()<BR>

</LI>


<LI>
sdp_property_groups() -&#62; property_groups()<BR>

</LI>


</UL>
<A NAME="decode_sdp"><!-- Empty --></A>
</DIV>

<P><A NAME="decode_sdp/1"><STRONG><CODE>decode_sdp(PP) -&#62; {ok, SDP} | {error, Reason}</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>PP = property_parm() | property_group() | property_groups() | asn1_NOVALUE</CODE></STRONG><BR>
<STRONG><CODE>property_group() = [property_parm()]</CODE></STRONG><BR>
<STRONG><CODE>property_groups() = [property_group()]</CODE></STRONG><BR>
<STRONG><CODE>SDP = sdp() | {property_parm(), DecodeError} | sdp_property_group() | {sdp_property_groups(), BadPPs} | asn1_NOVALUE</CODE></STRONG><BR>
<STRONG><CODE>sdp() = sdp_c() | sdp_o() | sdp_s() | sdo_i() | sdo_u() | sdo_e() | sdo_p() | sdo_c() | sdo_b() | sdo_z() | sdo_k() | sdo_a() | sdo_a_rtpmap() | sdo_a_ptime() | sdo_t() | sdo_r() | sdo_m()</CODE></STRONG><BR>
<STRONG><CODE>sdp_v() = #megaco_sdp_v{} (Protocol version)</CODE></STRONG><BR>
<STRONG><CODE>sdp_o() = #megaco_sdp_o{} (Owner/creator and session indentifier)</CODE></STRONG><BR>
<STRONG><CODE>sdp_s() = #megaco_sdp_s{} (Session name)</CODE></STRONG><BR>
<STRONG><CODE>sdp_i() = #megaco_sdp_i{} (Session information)</CODE></STRONG><BR>
<STRONG><CODE>sdp_u() = #megaco_sdp_u{} (URI of description)</CODE></STRONG><BR>
<STRONG><CODE>sdp_e() = #megaco_sdp_e{} (Email address)</CODE></STRONG><BR>
<STRONG><CODE>sdp_p() = #megaco_sdp_p{} (Phone number)</CODE></STRONG><BR>
<STRONG><CODE>sdp_c() = #megaco_sdp_c{} (Connection information)</CODE></STRONG><BR>
<STRONG><CODE>sdp_b() = #megaco_sdp_b{} (Bandwidth information)</CODE></STRONG><BR>
<STRONG><CODE>sdp_k() = #megaco_sdp_k{} (Encryption key)</CODE></STRONG><BR>
<STRONG><CODE>sdp_a() = #megaco_sdp_a{} (Session attribute)</CODE></STRONG><BR>
<STRONG><CODE>sdp_a_rtpmap() = #megaco_sdp_rtpmap{}</CODE></STRONG><BR>
<STRONG><CODE>sdp_a_ptime() = #megaco_sdp_a_ptime{}</CODE></STRONG><BR>
<STRONG><CODE>sdp_a_quality() = #megaco_sdp_a_quality{}</CODE></STRONG><BR>
<STRONG><CODE>sdp_a_fmtp() = #megaco_sdp_a_fmtp{}</CODE></STRONG><BR>
<STRONG><CODE>sdp_z() = #megaco_sdp_z{} (Time zone adjustment)</CODE></STRONG><BR>
<STRONG><CODE>sdp_t() = #megaco_sdp_t{} (Time the session is active)</CODE></STRONG><BR>
<STRONG><CODE>sdp_r() = #megaco_sdp_r{} (Repeat times)</CODE></STRONG><BR>
<STRONG><CODE>sdp_m() = #megaco_sdp_m{} (Media name and transport address)</CODE></STRONG><BR>
<STRONG><CODE>sdp_property_group() = [sdp()]</CODE></STRONG><BR>
<STRONG><CODE>sdp_property_groups() = [sdp_property_group()]</CODE></STRONG><BR>
<STRONG><CODE>DecodeError = term()</CODE></STRONG><BR>
<STRONG><CODE>Reason = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Decode (parse) a property parameter construct.
<P>When decoding <CODE>property_group()</CODE> or <CODE>property_groups()</CODE>, 
those property parameter constructs that cannot be decoded
(either because of decode error or because they are unknown),
will be returned as a two-tuple. The first element of which 
will be the (ndecoded) property parameter and the other the 
actual reason. 
This means that the caller of this function has to expect not 
only sdp-records, but also this two-tuple construct.
<P>This function performs the following transformation:
<P>
<UL>

<LI>
property_parm() -&#62; sdp()<BR>

</LI>


<LI>
property_group() -&#62; sdp_property_group()<BR>

</LI>


<LI>
property_groups() -&#62; sdp_property_groups()<BR>

</LI>


</UL>
<A NAME="versions1"><!-- Empty --></A><A NAME="versions2"><!-- Empty --></A>
</DIV>

<P><A NAME="versions1/0"><STRONG><CODE>versions1() -&#62; {ok, VersionInfo} | {error, Reason}</CODE></STRONG></A><BR>
<A NAME="versions2/0"><STRONG><CODE>versions2() -&#62; {ok, Info} | {error, Reason}</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>VersionInfo = [version_info()]</CODE></STRONG><BR>
<STRONG><CODE>version_info() = term()</CODE></STRONG><BR>
<STRONG><CODE>Reason = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Utility functions used to retreive some system and
application info.
<P>The difference between the two functions is in how they get
the modules to check. <CODE>versions1</CODE> uses the app-file and
<CODE>versions2</CODE> uses the function <CODE>application:get_key</CODE>.

<A NAME="print_version_info"><!-- Empty --></A> 

</DIV>

<P><A NAME="print_version_info/0"><STRONG><CODE>print_version_info() -&#62; void()</CODE></STRONG></A><BR>
<A NAME="print_version_info/1"><STRONG><CODE>print_version_info(VersionInfo) -&#62; void()</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>VersionInfo = [version_info()]</CODE></STRONG><BR>
<STRONG><CODE>version_info() = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Utility function to produce a formated printout of the versions 
info generated by the <CODE>versions1</CODE> and <CODE>versions2</CODE> 
functions.
<P>The function print_version_info/0 uses the result of function
version1/0 as <CODE>VersionInfo</CODE>.
<P>Example: 
<PRE>
           {ok, V} = megaco:versions1(), megaco:format_versions(V). 
        
</PRE>
<A NAME="enable_trace"><!-- Empty --></A>
</DIV>

<P><A NAME="enable_trace/2"><STRONG><CODE>enable_trace(Level, Destination) -&#62; void()</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>Level = max | min | 0 &#60;= integer() &#60;= 100</CODE></STRONG><BR>
<STRONG><CODE>Destination = File | Port | HandlerSpec | io</CODE></STRONG><BR>
<STRONG><CODE>File = string()</CODE></STRONG><BR>
<STRONG><CODE>Port = integer()</CODE></STRONG><BR>
<STRONG><CODE>HandleSpec = {HandlerFun, Data}</CODE></STRONG><BR>
<STRONG><CODE>HandleFun = fun() (two arguments)</CODE></STRONG><BR>
<STRONG><CODE>Data = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>This function is used to start megaco tracing at a given 
         <CODE>Level</CODE> and direct result to the given <CODE>Destination</CODE>.
<P>It starts a tracer server and then sets the proper match spec 
         (according to <CODE>Level</CODE>).
<P>In the case when <CODE>Destination</CODE> is <CODE>File</CODE>, the printable 
         megaco trace events will be printed to the file <CODE>File</CODE> using
         plain <CODE>io:format/2</CODE>. 
<P>In the case when <CODE>Destination</CODE> is <CODE>io</CODE>, the printable 
         megaco trace events will be printed on stdout using plain 
         <CODE>io:format/2</CODE>. 
<P>See <CODE>dbg</CODE> for further information.<A NAME="disable_trace"><!-- Empty --></A>
</DIV>

<P><A NAME="disable_trace/0"><STRONG><CODE>disable_trace() -&#62; void()</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY>

<P>This function is used to stop megaco tracing.<A NAME="set_trace"><!-- Empty --></A>
</DIV>

<P><A NAME="set_trace/1"><STRONG><CODE>set_trace(Level) -&#62; void()</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>Level = max | min | 0 &#60;= integer() &#60;= 100</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>This function is used to change the megaco trace level.
<P>It is assumed that tracing has already been enabled (see 
         <CODE>enable_trace</CODE> above).<A NAME="stats"><!-- Empty --></A>
</DIV>

<P><A NAME="get_stats/0"><STRONG><CODE>get_stats() -&#62; {ok, TotalStats} | {error, Reason}</CODE></STRONG></A><BR>
<A NAME="get_stats/1"><STRONG><CODE>get_stats(GlobalCounter) -&#62; {ok, CounterStats} | {error, Reason}</CODE></STRONG></A><BR>
<A NAME="get_stats/1"><STRONG><CODE>get_stats(CallHandle) -&#62; {ok, CallHandleStats} | {error, Reason}</CODE></STRONG></A><BR>
<A NAME="get_stats/2"><STRONG><CODE>get_stats(CallHandle, Counter) -&#62; {ok, integer()} | {error, Reason}</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>TotalStats = [total_stats()]</CODE></STRONG><BR>
<STRONG><CODE>total_stats() = {call_handle(), [stats()]} | {global_counter(), integer()}</CODE></STRONG><BR>
<STRONG><CODE>GlobalCounter = global_counter()</CODE></STRONG><BR>
<STRONG><CODE>GlobalCounterStats = integer()</CODE></STRONG><BR>
<STRONG><CODE>CallHandle = call_handle()</CODE></STRONG><BR>
<STRONG><CODE>CallHandleStats = [stats()]</CODE></STRONG><BR>
<STRONG><CODE>stats() = {counter(), integer()}</CODE></STRONG><BR>
<STRONG><CODE>Counter = counter()</CODE></STRONG><BR>
<STRONG><CODE>counter() = medGwyGatewayNumTimerRecovery | 
         medGwyGatewayNumErrors</CODE></STRONG><BR>
<STRONG><CODE>global_counter() = medGwyGatewayNumErrors</CODE></STRONG><BR>
<STRONG><CODE>Reason = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>      Retreive the (SNMP) statistic counters. The global
counters handle events that cannot be attributed to 
a single connection (e.g. protocol errors that occur 
before the connection has been properly setup).
        <A NAME="reset_stats"><!-- Empty --></A>
</DIV>

<P><A NAME="reset_stats/0"><STRONG><CODE>reset_stats() -&#62; void()</CODE></STRONG></A><BR>
<A NAME="reset_stats/1"><STRONG><CODE>reset_stats(SendHandle) -&#62; void()</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>SendHandle = send_handle()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>      Reset all related (SNMP) statistics counters.
        <A NAME="test_request"><!-- Empty --></A>
</DIV>

<P><A NAME="test_request/5"><STRONG><CODE>test_request(ConnHandle, Version, EncodingMod, EncodingConfig, Actions) -&#62; {MegaMsg, EncodeRes}</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>ConnHandle = conn_handle()</CODE></STRONG><BR>
<STRONG><CODE>Version = integer()</CODE></STRONG><BR>
<STRONG><CODE>EncodingMod = atom()</CODE></STRONG><BR>
<STRONG><CODE>EncodingConfig = Encoding configuration</CODE></STRONG><BR>
<STRONG><CODE>Actions = A list</CODE></STRONG><BR>
<STRONG><CODE>MegaMsg = #'MegacoMessage'{}</CODE></STRONG><BR>
<STRONG><CODE>EncodeRes = {ok, Bin} | {error, Reason}</CODE></STRONG><BR>
<STRONG><CODE>Bin = binary()</CODE></STRONG><BR>
<STRONG><CODE>Reason = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Tests if the Actions argument is correctly composed.
<P>This function is only intended for testing purposes. It's
         supposed to have a same kind of interface as the <A HREF="#call">call</A> or <A HREF="#cast">cast</A> functions (with the additions
         of the <CODE>EncodingMod</CODE> and <CODE>EncodingConfig</CODE>
         arguments). It composes a complete megaco message end
         attempts to encode it. The return value, will be a tuple of
         the composed megaco message and the encode result. <A NAME="test_reply"><!-- Empty --></A>
</DIV>

<P><A NAME="test_reply/5"><STRONG><CODE>test_reply(ConnHandle, Version, EncodingMod, EncodingConfig, Reply) -&#62; {MegaMsg, EncodeRes}</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>ConnHandle = conn_handle()</CODE></STRONG><BR>
<STRONG><CODE>Version = integer()</CODE></STRONG><BR>
<STRONG><CODE>EncodingMod = atom()</CODE></STRONG><BR>
<STRONG><CODE>EncodingConfig = A list</CODE></STRONG><BR>
<STRONG><CODE>Reply = actual_reply()</CODE></STRONG><BR>
<STRONG><CODE>MegaMsg = #'MegacoMessage'{}</CODE></STRONG><BR>
<STRONG><CODE>EncodeRes = {ok, Bin} | {error, Reason}</CODE></STRONG><BR>
<STRONG><CODE>Bin = binary()</CODE></STRONG><BR>
<STRONG><CODE>Reason = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Tests if the Reply argument is correctly composed.
<P>This function is only intended for testing purposes. It's
         supposed to test the <CODE>actual_reply()</CODE> return value of
         the callback functions 
         <A HREF="megaco_user.html#trans_request">handle_trans_request</A>
         and 
         <A HREF="megaco_user.html#trans_long_request">handle_trans_long_request</A>
         functions (with the additions of the <CODE>EncodingMod</CODE> and
         <CODE>EncodingConfig</CODE> arguments). It composes a complete
         megaco message end attempts to encode it. The return value,
         will be a tuple of the composed megaco message and the
         encode result.
</DIV>

<H3>AUTHORS</H3>
<DIV CLASS=REFBODY>
Hkan Mattsson - support@erlang.ericsson.se<BR>

</DIV>
<CENTER>
<HR>
<SMALL>megaco 3.5<BR>
Copyright &copy; 1991-2006
<A HREF="http://www.erlang.se">Ericsson AB</A><BR>
</SMALL>
</CENTER>
</BODY>
</HTML>