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
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<section id="ser-howto" xmlns:xi="http://www.w3.org/2001/XInclude">
<sectioninfo>
<authorgroup>
<author>
<firstname>Dan</firstname>
<surname>Austin</surname>
</author>
<editor>
<firstname>Nils</firstname>
<surname>Ohlmeier</surname>
<address>
<email>nils@iptel.org</email>
</address>
</editor>
</authorgroup>
<copyright>
<year>2002-2003</year>
<holder>NSI Ltd.</holder>
</copyright>
<revhistory>
<revision>
<revnumber>$Revision$</revnumber>
<date>$Date$</date>
</revision>
</revhistory>
</sectioninfo>
<title>SER Howto</title>
<section id="introduction">
<title>Introduction</title>
<section>
<title>Why SER</title>
<para>
SER is an open-source project that aims to make available a
fully functional and scalable Session Initiated Protocol
server. Call processing is described with a concise scripting
language that offers the flexibility of regular expressions and
the ability to interface with 3rd party applications for the
purposes of call accounting and authorization.
</para>
</section>
<section>
<title>Where to get SER</title>
<para>
SER is available for download from <ulink
url="ftp://ftp.berlios.de/pub/ser"></ulink>
</para>
<para>
The newest release may be found in the folder /latest
</para>
</section>
</section>
<section id="installation">
<title>Installation</title>
<section id="installation_notes">
<title>Installation Notes</title>
<para>
Supported architectures:
</para>
<itemizedlist>
<listitem>
<para>
Linux/i386
</para>
</listitem>
<listitem>
<para>
Linux/armv4l
</para>
</listitem>
<listitem>
<para>
FreeBSD/i386
</para>
</listitem>
<listitem>
<para>
OpenBSD/i386
</para>
</listitem>
<listitem>
<para>
Solaris/sparc64
</para>
</listitem>
<listitem>
<para>
NetBSD/sparc64
</para>
</listitem>
</itemizedlist>
<para>
(For other architectures the Makefiles might need to be edited) There are various
configuration options defined in the Makefile and Makefile.defs.
</para>
</section>
<section id="requirements">
<title>Requirements</title>
<itemizedlist>
<listitem>
<para>
gcc or icc : gcc >= 2.9x; >=3.1 recommended (it
will work with older version but it might require some
options tweaking for best performance)
</para>
</listitem>
<listitem>
<para>
bison or yacc (Berkley yacc)
</para>
</listitem>
<listitem>
<para>
flex
</para>
</listitem>
<listitem>
<para>
<acronym>GNU</acronym> make (on Linux this is the standard
"make", on FreeBSD and Solaris is called "gmake")
</para>
</listitem>
<listitem>
<para>
sed and tr (used in the make files)
</para>
</listitem>
<listitem>
<para>
<acronym>GNU</acronym> tar ("gtar" on Solaris) and gzip if you
want "make tar" to work.
</para>
</listitem>
<listitem>
<para>
<acronym>GNU</acronym> install or BSD install (on Solaris
"ginstall") if you want "make install",
"make bin", "make sunpkg" to work.
</para>
</listitem>
<listitem>
<para>
mysql if you need MySQL support.
</para>
</listitem>
<listitem>
<para>
Apache (httpd) if you want serweb support
</para>
</listitem>
<listitem>
<para>
PHP, MySQL-PHP for serweb support
</para>
</listitem>
<listitem>
<para>
libmysqlclient and libz (zlib) if you want mysql support (the mysql module)
</para>
</listitem>
<listitem>
<para>
libexpat if you want the jabber gateway support (the jabber module)
</para>
</listitem>
</itemizedlist>
<para>
Installing SER on a RedHat Linux distribution for example, is a
simple matter of unzipping the downloaded file and using your
favorite package manager.
</para>
</section>
<section id="install_package">
<title>Install the package</title>
<para>
Example:
</para>
<screen>
/root>rpm -i ser-08.11-1.i386.rpm
</screen>
<para>
Packages for other popular distributions are available, and can be installed using
the appropriate package manager for that distribution.
</para>
<para>
On many platforms you can start the service with:
</para>
<screen>
/etc/init.d/ser start
</screen>
<para>
RedHat systems will use:
</para>
<screen>
/etc/rc.d/init.d/ser start
</screen>
<para>
You now have a functioning SIP server, but what can you do with it? At this point
not very much. With an SIP client, such as Microsoft MSN Messenger 4.6, you can
register with the server, send Instant Messages to other logged on clients of the
same server, and even have voice conversations with them.
</para>
<para>
That sounds pretty good, but maybe you'd like to add a little more security, or make
you server accessible to others.
</para>
</section>
<section id="serctl_utility">
<title>Serctl Utility</title>
<para>
To do so, first set the environment variable SIP_DOMAIN to your domain name, e.g.,
in Bourne shell (bash), call:
</para>
<screen>
export SIP_DOMAIN="foo.bar"
</screen>
<para>
If you wont the system to created this variable automatically, you need to add the
line
</para>
<screen>
export SIP_DOMAIN="foo.bar"
</screen>
<para>
in the end of file /etc/profile.
</para>
<para>
If you are using other than 'localhost' mysql server for maintaining subscriber
database, change the variable 'SQL_HOST' to the proper host name in the serctl
script.
</para>
<para>
Run the serctl utility
</para>
<screen>
/usr/sbin/serctl monitor
</screen>
<para>
If you installed from a tar.gz or Solaris package:
</para>
<screen>
/usr/local/sbin/serctl monitor
</screen>
</section>
<section id="dns_srv">
<title>DNS SVR Resource Records</title>
<para>
It is important that your SIP clients can connect to your
server for purposes of registration and call control. You
might even want to have a redundant server to handle calls if
your primary server is unavailable.
</para>
<para>
These requirements can be meet by using <acronym>DNS</acronym>
<acronym>SVR</acronym> Resource Records, available in BIND 8.X and up releases.
</para>
<para>
The format for a <acronym>SVR RR</acronym> is this:
</para>
<screen>
_service._protocol SVR Priority Weight Port hostname
</screen>
<para>
In this case we want to establish an entry for our primary SIP server,
gateway.mydomain.com, that will listen on UDP port 5060. The entry will look like
this:
</para>
<screen>
_sip._udp SRV 0 0 5060 gateway.mydomain.com
</screen>
<para>
Placement of the new resource record is important. Here is a sample zone file:
</para>
<para>
<screen>
; zone 'mydomain.com' last serial 1998071308
$ORIGIN com.
mydomain 86400 IN SOA gateway.mydomain.com. postmaster.mydomain.com. (
1998111908 ; Serial
36000 ; Refresh
900 ; Retry
36000 ; Expire
28800 ); Minimum
IN NS gateway.mydomain.com.
IN NS ns3.backupdomain.com.
IN MX 1 gateway.mydomain.com.
IN A 192.168.0.1
;If we place the SRV record above the next line it fails to load
$ORIGIN fitawi.com.
_sip._udp SRV 0 0 5060 gateway.mydomain.com.
gateway IN A 192.168.0.1
www IN CNAME gateway.mydomain.com.
</screen>
</para>
<para>
After reloading your zone file you can verify that the entry is working by using dig.
</para>
<screen>
dig -t SRV _sip._udp.mydomain.com
</screen>
<para>
The results should look something like this:
</para>
<para>
<screen>
<![CDATA[
; <<>> DiG 9.1.0 <<>> -t SRV _sip._udp.mydomain.com
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 32654
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 1
;; QUESTION SECTION:
;_sip._udp.mydomain.com. IN SRV
;; ANSWER SECTION:
_sip._udp.mydomain.com. 86400 IN SRV 0 0 5060 gateway.mydomain.com.
;; AUTHORITY SECTION:
mydomain.com. 86400 IN NS ns3.elsewhere.com.
mydomain..com 86400 IN NS gateway. mydomain.com.
;; ADDITIONAL SECTION:
gateway. mydomain.com. 86400 IN A 192.168.0.150
;; Query time: 6 msec
;; SERVER: 192.168.0.150#53(192.168.0.150)
;; WHEN: Tue Dec 3 08:34:17 2002
;; MSG SIZE rcvd: 132
]]>
</screen>
</para>
</section>
<section>
<title>Adding a database for client information</title>
<para>
By leveraging a MySQL database, we can provide support for user credentials, and
keeping track of where the clients are logged on during server restarts.
</para>
</section>
<section>
<title>MySQL setup</title>
<para>
To install support for a MySQL database you will need to download the package
ser-mysql, which is available from the same download location that you retrieved
SER. This package has scripts to create the required database and establish
permissions for the accounts needed. A recent release of MySQL is recommended.
Earlier versions may have problems with the syntax required to set permissions on
the database.
</para>
<para>
If you do not already have a copy of MySQL installed, download it from your <ulink
url="http://www.mysql.com"></ulink>
</para>
<para>
Once you have MySQL installed and started, execute
</para>
<screen>
/usr/sbin/ser_mysql.sh
</screen>
<para>
You can verify that the database has been created, and correct permissions assigned
by using the mysql management tool and these steps:
</para>
<para>
<screen>
Mysql> select * from user;
| Host | User | Password | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv |
| % | ser | 4e633cf914a735a0 | N | N | N | N | N | N | N | N | N | N | N | N | N | N |
| localhost | ser | 4e633cf914a735a0 | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | N | Y | Y | Y |
| % | serro | 7cb73a267cb7bd5f | N | N | N | N | N | N | N | N | N | N | N | N | N | N |
| localhost | serro | 7cb73a267cb7bd5f | Y | N | N | N | N | N | N | N | N | N | N | N | N | N |
</screen>
</para>
<para>
The above results show that the two user, ser and serro, have been created and
granted the permissions needed to access the database. Note that in the above
example the permissions have been modified to deny access to these accounts from any
system(%) other than local host.
</para>
<para>
<screen>
mysql> connect ser;
Connection id: 294
Current database: ser
mysql> show tables;
+-----------------+
| Tables_in_ser |
+-----------------+
| acc |
| active_sessions |
| aliases |
| config |
| event |
| grp |
| location |
| missed_calls |
| pending |
| phonebook |
| reserved |
| silo |
| subscriber |
| version |
+-----------------+
14 rows in set (0.00 sec)
mysql> select * from subscriber;
| phplib_id | USERNAME | PASSWORD | FIRST_NAME | LAST_NAME | PHONE | EMAIL_ADDRESS | DATETIME_CREATED | DATETIME_MODIFIED | confirmation | flag | SendNotification | Greeting | HA1 | REALM | ha1b | perms | allow_find | timezone |
| 4cefa7a4d3c8c2dbf6328520bd873a19 | admin | heslo | first | admin | 557-8469 | admin@iptel.org | 2002-12-02 19:20:41 | 2002-12-02 20:29:46 | 80e0f273b2067d40277b49ff842bb9e3 | o | | | c79a8f8f08596baa84bb02c88884426d | iptel.org | f322c94b8b2fbe557d43ab3ac9e05b3a | admin | 1 | America/Los_Angeles |
</screen>
</para>
<para>
This last query shows that you have one user account defined and it has
administrator privileges.
</para>
<para>
We'll need to add another account to be the administrator for your realm, which we
will do after the next section.
</para>
</section>
</section>
<section id="configuration">
<title>Configuration</title>
<section>
<title>Modify SER configuration</title>
<para>
Now that we have a working MySQL database, we need to modify the configuration file
for ser, located on a RedHat, installed in /etc/ser/ser.cfg. The following changes
need to be made:
</para>
<para>
To enable support for the new MySQL database we need to load the appropriate module.
That is accomplished by uncomment this line:
</para>
<screen>
loadmodule "/usr/lib/ser/modules/mysql.so
</screen>
<para>
Next we need to set SER to use the database and write changes instead of just
caching them in memory. This is done by means of commenting this line:
</para>
<screen>
modparam ("usrloc", "db_mode", 0)
</screen>
<para>
And uncomment this line:
</para>
<screen>
modparam ("usrloc", "db_mode", 2)
</screen>
<para>
Note on db_modes:
</para>
<para>
<itemizedlist>
<listitem>
<para>
Mode 0
</para>
<para>
Disables writes to the database. Contact information will not be
preserved if the server is restarted.
</para>
</listitem>
<listitem>
<para>
Mode 1
</para>
<para>
Writes all changes to the database immediately. Contact information is
saved to the database immediately. This can slow the response to
clients as they connect.
</para>
</listitem>
<listitem>
<para>
Mode 2
</para>
<para>
Periodically writes contact information to the database based in the in
memory cache.
</para>
</listitem>
</itemizedlist>
</para>
<para>
To enable digest authentication we additionally need to uncomment the following two lines:
</para>
<screen>
loadmodule "/usr/lib/ser/modules/auth.so"
loadmodule "/usr/lib/ser/modules/auth_db.so"
</screen>
<para>
We have the option of storing passwords in our database in plain text. This allows
for password recovery and makes the initial setup and testing easier. To enable
this feature uncomment these lines:
</para>
<screen>
modparam ("auth_db", "calculate_ha1", yes)
modparam ("auth_db", "password_column", "password")
</screen>
<para>
These lines work together. The first tells SER to generate a hash based on
username, password and realm. The second tells SER where to look for the plain-text
password in the database.
</para>
<para>
Uncomment these lines and change all instances of iptel.org to your domain
</para>
<para>
<screen>
if (!www_authorize("mydomain.com", "subscriber")) {
www_challenge("mydomain.com", "0");
break;
};
</screen>
</para>
<para>
We're now ready to restart ser. On RedHat use
</para>
<screen>
/etc/rc.d/init.d/ser restart
</screen>
</section>
<section>
<title>Adding an admin for your realm</title>
<para>
Now that we have a working database and ser is configured to use it, we need to add
some users and at least one of them should have administrator privileges. The
administrator role becomes important if you want to use a web management tool such
as serweb.
</para>
<para>
Basic account manipulation can be performed with the serctl script, located in
/usr/sbin.
</para>
<para>
To add a user use these commands
</para>
<screen>
serctl add JoeUser qwerty joe@mydomain.com
</screen>
<para>
The system notify for "Type MySQL Password", the default password is
"heslo"
</para>
<para>
To make JoeUser an administrator, we need to login to MySQL and modify the database.
</para>
<para>
<screen>
mysql> connect ser;
mysql> update subscriber set perms=?admin? where USER_ID=?JoeUser?;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select * from subscriber;
| 4cefa7a4d3c8c2dbf6328520bd873a19 | JoeUser | qwerty | | | | joe@mydomain.com | 2002-12-02 19:20:41 | 2002-12-02 20:29:46 | 80e0f273b2067d40277b49ff842bb9e3 | o | | | c79a8f8f08596baa84bb02c88884426d | mydomain.com | f322c94b8b2fbe557d43ab3ac9e05b3a | admin | 1 | America/Los_Angeles |
</screen>
</para>
<para>
The third from last field shows that Joe has been assigned admin privileges.
</para>
<para>
At this point Joe can login to our server, but since he is the only user, there is
not much he can do. We can now add additional users using the serctl script, or now
is a good time to look at installing serweb, which will allow users to subscribe to
our service.
</para>
</section>
<section>
<title>More on serctl</title>
<para>
The script serctl can be used to manage users, access control lists, in memory
contacts, and to monitor server health. Executing serctl with no arguments will
produce this output:
</para>
<para>
<screen>
usage:
* subscribers *
add <username> <password> <email> .. add a new subscriber (*)
passwd <username> <passwd> ......... change user's password (*)
rm <username> ...................... delete a user (*)
mail <username> .................... send an email to a user
alias show [<alias>] ............... show aliases
alias rm <alias> ................... remove an alias
alias add <alias> <uri> ............ add an aliases
* access control lists *
acl show [<username>] .............. show user membership
acl grant <username> <group> ....... grant user membership (*)
acl revoke <username> [<group>] .... grant user membership(s) (*)
* usrloc *
ul show [<username>]................ show in-RAM online users
ul rm <username> ................... delete user's UsrLoc entries
ul add <username> <uri> ............ introduce a permanent UsrLoc entry
showdb [<username>] ................ show online users flushed in DB
* control and diagnostic *
moni ... show internal status start .... start ser
ps ..... show running processes stop ..... stop ser
fifo ... send raw FIFO commands restart .. restart ser
ping <uri> .. ping a URI (OPTIONS)
cisco_restart <uri> .. restart a Cisco phone (NOTIFY)
Commands labeled with (*) will prompt for a MySQL password.
If the variable PW is set, the password will not be prompted.
ACL privileges are: local ld int voicemail free-pstn
</screen>
</para>
</section>
<section>
<title>Adding and deleting users with serctl</title>
<para>
User account management is performed with these commands:
</para>
<screen>
serctl add
serctl password
serctl rm
</screen>
<para>
The contents of the in memory cache can be managed with the ul argument. Care must
be taken to with these commands. For example:
</para>
<screen>
serctl ul rm joe
</screen>
<para>
Will remove the current contact information about Joe from memory
</para>
<para>
Whereas "serctl rm joe" will delete joe's account.
</para>
</section>
<section>
<title>Examining in memory cache with serctl</title>
<para>
The command "serctl ul show" will list any currently registered
clients. The output will look like this:
</para>
<para>
<screen>
===Domain list===
---Domain---
name : 'location'
size : 512
table: 0x402ee6d0
d_ll {
n : 2
first: 0x402f1a74
last : 0x402f089c
}
lock : 0
...Record(0x402f1a74)...
domain: 'location'
aor : 'test'
~~~Contact(0x402f708c)~~~
domain : 'location'
aor : 'test'
Contact: 'sip:test@192.168.0.100:5060'
Expires: 2501
q : 0.00
Call-ID: '000a8a93-d4660017-4571a6cd-658ac1bf@192.168.0.100'
CSeq : 101
State : CS_SYNC
next : (nil)
prev : (nil)
~~~/Contact~~~~
.../Record...
...Record(0x402f089c)...
domain: 'location'
aor : 'joe'
~~~Contact(0x402f0924)~~~
domain : 'location'
aor : 'joe'
Contact: 'sip:192.168.0.101:14354'
Expires: 432
q : 0.00
Call-ID: 'e8d93059-e46e-4fd9-958b-ccb36a1cf245@192.168.0.101'
CSeq : 11
State : CS_SYNC
next : (nil)
prev : (nil)
~~~/Contact~~~~
.../Record...
---/Domain---
===/Domain list===
</screen>
</para>
</section>
<section>
<title>Examining server status</title>
<para>
Two commands can be used to check the health of the server. The first command
serctl ps returns a list of all SER related processes, the ip address and the port
they are listening on. For example:
</para>
<para>
<screen>
[root@gateway /root]# serctl ps
0 31029 attendant
1 31033 receiver child=0 sock=0 @ 127.0.0.1::5060
2 31034 receiver child=1 sock=0 @ 127.0.0.1::5060
3 31035 receiver child=2 sock=0 @ 127.0.0.1::5060
4 31036 receiver child=3 sock=0 @ 127.0.0.1::5060
5 31037 receiver child=0 sock=1 @ 192.168.0.1::5060
6 31038 receiver child=1 sock=1 @ 192.168.0.1::5060
7 31039 receiver child=2 sock=1 @ 192.168.0.1::5060
8 31040 receiver child=3 sock=1 @ 192.168.0.1::5060
9 31049 fifo server
10 31072 timer
</screen>
</para>
<para>
The second command, serctl monitor, shows the server version, uptime, pending and
completed transactions, and the number of major category responses the server has
sent. Another example:
</para>
<para>
<screen>
[cycle #: 1; if constant make sure server lives and fifo is on]
Server: Sip EXpress router (0.8.11 (i386/linux)
Now: Wed Dec 4 10:13:02 2002
Up Since: Mon Dec 2 21:21:11 2002
Up time: 132711 [sec]
Transaction Statistics
Current: 0 (2 waiting) Total: 46 (0 local)
Replied localy: 37
Completion status 6xx: 0, 5xx: 0, 4xx: 23, 3xx: 0,2xx: 22
Stateless Server Statistics
200: 101 202: 0 2xx: 0
300: 0 301: 0 302: 0 3xx: 0
400: 0 401: 0 403: 0 404: 132 407: 0 408: 0 483: 1 4xx: 0
500: 0 5xx: 0
6xx: 0
xxx: 0
failures: 0
UsrLoc Stats
Domain Registered Expired
'location' 2 2
</screen>
</para>
</section>
</section>
<section>
<title>Installing SERWeb</title>
<para>
The SERweb package can be downloaded from <ulink
url="ftp://ftp.berlios.de/ser/latest/serweb"></ulink>
</para>
<para>
The pages associated with SERweb provide a starting point to customize your SIP user
account management tools.
</para>
<section>
<title><acronym>PHP</acronym> configuration</title>
<para>
Go to <acronym>PHP</acronym> configuration file in /etc/php.ini and change
"register_globals = Off" to "On"
</para>
</section>
<section>
<title>Installing SERweb default configuration</title>
<para>
If you are installing this package on a server that does not host any other web
pages, you can simply extract the files to the document directory of your web
server. This presumes that you have a working Web Server.
</para>
</section>
<section>
<title>Installing SERweb custom file locations</title>
<para>
In case your server performs multiple functions, and you want to just add the SERweb
tools to an existing web site, we will need to make changes to a number of the php
files. The following examples are from an Apache 2.0 on RedHat.
</para>
<para>
Unzip the files into a temporary directory, such as /root/serweb. The directory
will contain these files:
</para>
<para>
<screen>
-rw-rw-r-- 1 827 2020 18561 Sep 25 16:31 COPYING
drwxr-xr-x 2 827 2020 1024 Nov 27 16:43 CVS
-rw-rw-r-- 1 827 2020 529 Sep 25 16:29 README
drwxr-xr-x 7 827 2020 1024 Nov 27 22:24 html
drwxr-xr-x 3 827 2020 2048 Sep 26 10:26 phplib
</screen>
</para>
<para>
On the Linux RedHat Version 8 root directory on web server is /var/www/html/
</para>
<para>
Move the html directory to the root of your web server:
</para>
<screen>
mv html /var/www/html/htdocs/serweb
</screen>
<para>
Move the phplib directory to your web server application directory:
</para>
<screen>
mv phplib /var/www/html/phplib
</screen>
<para>
Following files must be updated with this "new" path to the libraries:
</para>
<screen>
./admin/prepend.php
./user_interface/prepend.php
./user_interface/reg/prepend.php
</screen>
<para>
For these files the variable: $_PHPLIB["libdir"] =
"../../phplib/"; becomes $_PHPLIB["libdir"] =
"../../../phplib/";
</para>
<para>
In the ./admin directory edit the files acl.php, index.php, and users.php will need
their path to the forms library updated. For this example, add ../ to the existing
line
</para>
<screen>
:require "../../../phplib/oohforms.inc";
</screen>
<para>
In the ./user_interface directory the following files need the same change:
</para>
<para>
accounting.php, find_user.php, index.php, missed_calls.php, my_account.php,
phonebook.php, send_im.php, notification_subscription.php
</para>
<para>
Next these files in ./user_interface/reg need the same change, with an additional
../:
</para>
<para>
Finish.php, get_pass.php, index.php
</para>
<para>
The last changes occur in the config.php file to provide the
location for graphic files, style sheets and time zone
information. Update the following variables:
</para>
<screen>
$this->root_path="/serweb/";
$this->fifo_server = "/tmp/ser_fifo";
$this->zonetab_file = "/usr/share/zoneinfo/zone.tab";
//TZ zone descriptions file, usually: /usr/share/zoneinfo/zone.tab
</screen>
<para>
Find two variables: "$this->mail_forgot_pass=","
$this->mail_register=" and change line
http://oook/~iptel/user_interface/reg/confirmation.php?nr=#confirm#\n\n
</para>
<para>
with line
</para>
<para>
http://".$_SERVER['HTTP_HOST']."/htdocs/serweb/user_interface/reg/confirmation.php?nr=#confirm#\n\n
</para>
<para>
This will insure sending a registration feedback mail to SIP server using its IP
address
</para>
</section>
<section>
<title>Modifying SERweb configuration general</title>
<para>
We need to update /usr/local/apache/htdocs/serweb/config.php to represent our realm.
The following variables need to be changed to our domain:
</para>
<para>
<screen>
$this->realm="mydomain.com";
$this->domainname=" mydomain.com";
$this->web_contact="sip:JoeUser@ mydomain.com";
//address of pseudo sender
</screen>
</para>
<screen>
$this->default_domain=" mydomain.com";
$this->mail_header_from="Registration@ mydomain.com";
</screen>
<para>
</para>
<para>
Additionally we will want to modify the section for Terms and Conditions, either
replacing it with appropriate language for our services, or at least replacing
iptel.org with our domain information.
</para>
</section>
</section>
<section id="issues_and_limitation">
<title>Issues And Limitation</title>
<para>
Since one of the design goals behind SIP is to decentralize the intelligence in
communications handling, a basic tenant is that SIP clients need to be able to
communicate directly with each other. The problem is that many clients find themselves
either behind a firewall or in a NAT fronted address space. When a client registers
with the SIP server, it tells the server what it is using for an IP address, and that
address may not be accessible to the public.
</para>
<section>
<title>More on NAT</title>
<para>
There are a couple of ways that we can overcome the problem that NAT introduces.
Some SIP client providers are building in options into their products that allow the
user to identify the IP address that their phone will appear as to the public. This
is a nice simple approach, but presumes that the person installing the client knows
what that IP address is, and that it doesn't change. Cisco has built this feature
into their 79XX series SIP phones.
</para>
<para>
A second solution that is working its way through the standards process is called
<quote>Simple Traversal of UDP through NAT</quote>, or <acronym>STUN</acronym>.
A <acronym>STUN</acronym> equipped client is configured to send a who-am-I packet to
a known server on the public network. That server will respond with the IP
address that the client appears to be communicating from, and the client can then
use that address to register with the SIP server. Phones that leverage
<acronym>STUN</acronym> include: Snom 100, kphone, and sipc .
</para>
</section>
<section>
<title>Firewalls</title>
<para>
SIP clients also present an interesting challenge to configuring a firewall. During
registration the SIP client will be assigned a UDP port in the range of 16384 to
32768. Our firewall administrators will not happily open up all of those ports to
all of the internal systems, on the chance that a SIP connection may be needed.
</para>
<para>
This is where the concept of a Firewall Control Protocol, or <acronym>FCP</acronym>,
comes into play. The design idea is that when a SIP client registers, a
<acronym>FCP</acronym> agent, or server if you prefer, will dynamically insert a new
rule into the firewall policy to permit that client to participate in SIP
conversations.
</para>
</section>
</section>
<section id="diagnostics">
<title>Diagnostics And Tools</title>
<para>
Detailed information about the communications between clients and the SIP server is
needed to isolate problems. Two tools that can be used to gather such information are
sipsak and ngrep.
</para>
<section>
<title>ngrep</title>
<para>
Ngrep is a capable of listening in on network traffic and filtering it in much the
same way as grep can locate patterns in files. To monitor the communications
between a client, joe, and the server the following command would be run on the
server:
</para>
<screen>
ngrep -n 5060 -d eth0 joe
</screen>
<para>
Since SIP communications are <acronym>ASCII</acronym> based, all events such as
REGISTER, INVITE, SUBSCRIBE, etc. are captured. The output of ngrep can identify
problems with SIP addresses, or client identity.
</para>
<para>
Ngrep should be part of most modern distributions, or can be downloaded from <ulink
url="http://sourceforge.net/projects/ngrep/"></ulink>
</para>
</section>
<section>
<title>Sipsak</title>
<para>
Sipsak can be used to determine if your server is responding to requests, and provide information on
how your server would route SIP connections. Sipsak and basic documentation on its use can be
downloaded from <ulink url="http://sipsak.berlios.de"></ulink>
</para>
</section>
</section>
<section id="client_configuration">
<title>Client Configuration</title>
<section>
<title>Microsoft Messenger 4.6</title>
<para>
Microsoft Messenger 4.6 can be configured as a SIP client by selecting Tools\Options\Accounts and
selecting Communications Service for the account sign in. Clear the check boxes for .NET Passport
and Exchange Account. Check the Communications Service account and enter your SIP account name.
Click on Advanced and select Configure settings. Enter the IP address of your server, or hostname
and choose UDP.
</para>
</section>
<section>
<title>Cisco 79XX phones</title>
<para>
Cisco has complete documentation on how to convert a 79XX series phone to use SIP.
The basic steps are:
</para>
<section>
<title>Configure a <acronym>DHCP</acronym> service that provides</title>
<para>
<itemizedlist>
<listitem>
<para>
IP address
</para>
</listitem>
<listitem>
<para>
Subnet mask
</para>
</listitem>
<listitem>
<para>
Default gateway
</para>
</listitem>
<listitem>
<para>
<acronym>DNS</acronym> server addresses
</para>
</listitem>
<listitem>
<para>
<acronym>TFTP</acronym> server address
</para>
</listitem>
</itemizedlist>
</para>
</section>
<section>
<title>On the <acronym>TFTP</acronym> server load these files</title>
<para>
<itemizedlist>
<listitem>
<para>
OS79XX - Identifies which firmware the phone should load with no
extension. Example: P0S3-04-1-00
</para>
</listitem>
<listitem>
<para>
P0S3-04-1-00.bin - The firmware image
</para>
</listitem>
<listitem>
<para>
SIPDefault.cnf - Site wide configuration options
</para>
</listitem>
<listitem>
<para>
SIPmacaddress.cnf - Phone specific settings, including login name
and password. Example: SIP000A8A93D466.cnf
</para>
</listitem>
<listitem>
<para>
RINGLIST.DAT, ringer1.pcm, ringer2.pcm - ring tones
</para>
</listitem>
</itemizedlist>
</para>
<para>
Each time the phone is powered on it will tftp download OS79XX and determine if
it needs a firmware update. If no update is needed the next step is to download
SIPDefault.cnf, SIPmacaddress.cnf, and optionally a dial plan, ringlist and ring
tones.
</para>
<para>
Calls can be placed to other registered SIP clients, or to a PSTN number
provided there is PSTN gateway identified in the SER configuration file.
</para>
</section>
</section>
</section>
<section id="pstn_connectivity">
<title>PSTN Connectivity</title>
<para>
Passing calls that originate from a SIP client to the PSTN is a simple matter of
permitting SER to relay the session to an established PSTN gateway. Calls that start
out on the PSTN and need to be directed to a SIP client requires that the PSTN gateway
be aware of where to direct the call.
</para>
<section>
<title>Cisco Dial-peer</title>
<para>
The Cisco gateway needs to have a PSTN interface, such as FXO ports or a VXB-2TE1+
card, and depending on the model of Cisco device an upgraded IOS revision. The
dial-peer itself is simple:
</para>
<para>
dial-peer voice 999 voip
</para>
<para>
destination-pattern 555999. ** Associate the number range 555-9990 to 9999 with our
SIP server
</para>
<para>
session protocol sipv2 ** Set this dial-peer to use SIP instead of Cisco protocols
</para>
<para>
session target sip-server ** Send the call to our SIP server. See SIP-UA below
</para>
<para>
codec g711ulaw ** Set the default codec to 711-Ulaw (common codec between clients)
</para>
<para>
!
</para>
<para>
sip-ua
</para>
<para>
sip-server ipv4:192.168.0.1 ** IP address of our SIP server
</para>
</section>
<section>
<title>Relaying PSTN in ser.cfg</title>
<para>
The following is an extremely simple sample of how to relay a call from a SIP client
to the PSTN
</para>
<para>
<screen>
# attempt handoff to PSTN
if (uri=~<quote>^sip:9[0-9]*@mydomain.com</quote>) { ## This assumes that the caller is
log(<quote>Forwarding to PSTN\n</quote>); ## registered in our realm
t_relay_to( <quote>192.168.0.2</quote>, <quote>5060</quote>); ## Our Cisco router
break;
};
</screen>
</para>
</section>
</section>
<section id="sip_status_codes">
<title>SIP Status Codes</title>
<para>
The following are the SIP status codes as of RFC3261;
</para>
<para>
<table><title>1XX-2XX Informational</title>
<tgroup cols="2">
<tbody>
<row>
<entry>
100
</entry>
<entry>
Trying
</entry>
</row>
<row>
<entry>
180
</entry>
<entry>
Ringing
</entry>
</row>
<row>
<entry>
181
</entry>
<entry>
Call Is Being Forwarded
</entry>
</row>
<row>
<entry>
182
</entry>
<entry>
Queued
</entry>
</row>
<row>
<entry>
183
</entry>
<entry>
Session Progress
</entry>
</row>
<row>
<entry>
200
</entry>
<entry>
OK
</entry>
</row>
<row>
<entry>
202
</entry>
<entry>
OK
</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
<table><title>3XX Redirection</title>
<tgroup cols='2'>
<tbody>
<row>
<entry>
300
</entry>
<entry>
Multiple Choices
</entry>
</row>
<row>
<entry>
301
</entry>
<entry>
Moved Permanently
</entry>
</row>
<row>
<entry>
303
</entry>
<entry>
See Other
</entry>
</row>
<row>
<entry>
305
</entry>
<entry>
Use Proxy
</entry>
</row>
<row>
<entry>
380
</entry>
<entry>
Alternative Service
</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
<table><title>4XX Client-Error</title>
<tgroup cols='2'>
<tbody>
<row>
<entry>
400
</entry>
<entry>
Bad Request
</entry>
</row>
<row>
<entry>
401
</entry>
<entry>
Unauthorized
</entry>
</row>
<row>
<entry>
402
</entry>
<entry>
Payment Required
</entry>
</row>
<row>
<entry>
403
</entry>
<entry>
Forbidden
</entry>
</row>
<row>
<entry>
404
</entry>
<entry>
Not Found
</entry>
</row>
<row>
<entry>
405
</entry>
<entry>
Method Not Allowed
</entry>
</row>
<row>
<entry>
406
</entry>
<entry>
Not Acceptable
</entry>
</row>
<row>
<entry>
407
</entry>
<entry>
Proxy Authentication Required
</entry>
</row>
<row>
<entry>
408
</entry>
<entry>
Request Timeout
</entry>
</row>
<row>
<entry>
409
</entry>
<entry>
Conflict
</entry>
</row>
<row>
<entry>
410
</entry>
<entry>
Gone
</entry>
</row>
<row>
<entry>
411
</entry>
<entry>
Length Required
</entry>
</row>
<row>
<entry>
413
</entry>
<entry>
Request Entity Too Large
</entry>
</row>
<row>
<entry>
414
</entry>
<entry>
Request-URI Too Large
</entry>
</row>
<row>
<entry>
415
</entry>
<entry>
Unsupported Media Type
</entry>
</row>
<row>
<entry>
420
</entry>
<entry>
Bad Extension
</entry>
</row>
<row>
<entry>
480
</entry>
<entry>
Temporarily not available
</entry>
</row>
<row>
<entry>
481
</entry>
<entry>
Call Leg/Transaction does not exist
</entry>
</row>
<row>
<entry>
482
</entry>
<entry>
Loop Detected
</entry>
</row>
<row>
<entry>
483
</entry>
<entry>
Too Many Hops
</entry>
</row>
<row>
<entry>
484
</entry>
<entry>
Address Incomplete
</entry>
</row>
<row>
<entry>
485
</entry>
<entry>
Ambiguous
</entry>
</row>
<row>
<entry>
486
</entry>
<entry>
Busy Here
</entry>
</row>
<row>
<entry>
487
</entry>
<entry>
Request Terminated
</entry>
</row>
<row>
<entry>
488
</entry>
<entry>
Not Acceptable Here
</entry>
</row>
<row>
<entry>
489
</entry>
<entry>
Bad Event
</entry>
</row>
<row>
<entry>
491
</entry>
<entry>
Request Pending
</entry>
</row>
<row>
<entry>
493
</entry>
<entry>
Undecipherable
</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
<table><title>5XX Server-Error</title>
<tgroup cols='2'>
<tbody>
<row>
<entry>
500
</entry>
<entry>
Internal Server Error
</entry>
</row>
<row>
<entry>
501
</entry>
<entry>
Not Implemented
</entry>
</row>
<row>
<entry>
502
</entry>
<entry>
Bad Gateway
</entry>
</row>
<row>
<entry>
503
</entry>
<entry>
Service Unavailable
</entry>
</row>
<row>
<entry>
504
</entry>
<entry>
Gateway Time-out
</entry>
</row>
<row>
<entry>
505
</entry>
<entry>
SIP Version not supported
</entry>
</row>
<row>
<entry>
513
</entry>
<entry>
Message Too Large
</entry>
</row>
<row>
<entry>
580
</entry>
<entry>
Precondition Failure
</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
<table><title>6XX Global-Failure</title>
<tgroup cols='2'>
<tbody>
<row>
<entry>
600
</entry>
<entry>
Busy Everywhere
</entry>
</row>
<row>
<entry>
603
</entry>
<entry>
Decline
</entry>
</row>
<row>
<entry>
604
</entry>
<entry>
Does Note Exist Anywhere
</entry>
</row>
<row>
<entry>
606
</entry>
<entry>
Not Acceptable
</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</section>
</section>
|