aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-03-26 17:07:26 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-03-26 17:07:26 +0000
commite2badd799b87d7ae80f8aa6f5d0679bcab903a91 (patch)
tree1d123d8ef0c24763123582d172f1ffdbf73addab
parent9774f6cc479ebeb3142c1dac84fa7cdc5399abf6 (diff)
remove improperly created directory
git-svn-id: http://svn.digium.com/svn/asterisk/tags/1.2.5-netsec@15060 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--1.2-netsec/.cleancount1
-rw-r--r--1.2-netsec/BUGS22
-rw-r--r--1.2-netsec/CHANGES127
-rw-r--r--1.2-netsec/COPYING341
-rw-r--r--1.2-netsec/CREDITS133
-rw-r--r--1.2-netsec/HARDWARE70
-rw-r--r--1.2-netsec/LICENSE56
-rw-r--r--1.2-netsec/Makefile908
-rw-r--r--1.2-netsec/README248
-rw-r--r--1.2-netsec/README.fpm8
-rw-r--r--1.2-netsec/SECURITY67
-rw-r--r--1.2-netsec/UPGRADE.txt205
-rw-r--r--1.2-netsec/acl.c355
-rw-r--r--1.2-netsec/aescrypt.c313
-rw-r--r--1.2-netsec/aeskey.c465
-rw-r--r--1.2-netsec/aesopt.h1029
-rw-r--r--1.2-netsec/aestab.c232
-rw-r--r--1.2-netsec/agi/DialAnMp3.agi82
-rw-r--r--1.2-netsec/agi/Makefile52
-rw-r--r--1.2-netsec/agi/agi-test.agi79
-rw-r--r--1.2-netsec/agi/eagi-sphinx-test.c219
-rw-r--r--1.2-netsec/agi/eagi-test.c162
-rw-r--r--1.2-netsec/agi/fastagi-test94
-rw-r--r--1.2-netsec/agi/numeralize44
-rw-r--r--1.2-netsec/alaw.c100
-rw-r--r--1.2-netsec/app.c1558
-rw-r--r--1.2-netsec/apps/Makefile133
-rw-r--r--1.2-netsec/apps/app_adsiprog.c1606
-rw-r--r--1.2-netsec/apps/app_alarmreceiver.c867
-rw-r--r--1.2-netsec/apps/app_authenticate.c232
-rw-r--r--1.2-netsec/apps/app_cdr.c97
-rw-r--r--1.2-netsec/apps/app_chanisavail.c185
-rw-r--r--1.2-netsec/apps/app_chanspy.c587
-rw-r--r--1.2-netsec/apps/app_controlplayback.c190
-rw-r--r--1.2-netsec/apps/app_curl.c256
-rw-r--r--1.2-netsec/apps/app_cut.c473
-rw-r--r--1.2-netsec/apps/app_datetime.c101
-rw-r--r--1.2-netsec/apps/app_db.c323
-rw-r--r--1.2-netsec/apps/app_dial.c1748
-rw-r--r--1.2-netsec/apps/app_dictate.c358
-rw-r--r--1.2-netsec/apps/app_directed_pickup.c169
-rw-r--r--1.2-netsec/apps/app_directory.c516
-rw-r--r--1.2-netsec/apps/app_disa.c412
-rw-r--r--1.2-netsec/apps/app_dumpchan.c192
-rw-r--r--1.2-netsec/apps/app_echo.c123
-rw-r--r--1.2-netsec/apps/app_enumlookup.c270
-rw-r--r--1.2-netsec/apps/app_eval.c127
-rw-r--r--1.2-netsec/apps/app_exec.c135
-rw-r--r--1.2-netsec/apps/app_externalivr.c583
-rw-r--r--1.2-netsec/apps/app_festival.c532
-rw-r--r--1.2-netsec/apps/app_flash.c141
-rw-r--r--1.2-netsec/apps/app_forkcdr.c131
-rw-r--r--1.2-netsec/apps/app_getcpeid.c167
-rw-r--r--1.2-netsec/apps/app_groupcount.c340
-rw-r--r--1.2-netsec/apps/app_hasnewvoicemail.c264
-rw-r--r--1.2-netsec/apps/app_ices.c225
-rw-r--r--1.2-netsec/apps/app_image.c147
-rw-r--r--1.2-netsec/apps/app_intercom.c234
-rw-r--r--1.2-netsec/apps/app_ivrdemo.c144
-rw-r--r--1.2-netsec/apps/app_lookupblacklist.c141
-rw-r--r--1.2-netsec/apps/app_lookupcidname.c120
-rw-r--r--1.2-netsec/apps/app_macro.c396
-rw-r--r--1.2-netsec/apps/app_math.c297
-rw-r--r--1.2-netsec/apps/app_md5.c205
-rw-r--r--1.2-netsec/apps/app_meetme.c2251
-rw-r--r--1.2-netsec/apps/app_milliwatt.c170
-rw-r--r--1.2-netsec/apps/app_mixmonitor.c466
-rw-r--r--1.2-netsec/apps/app_mp3.c260
-rw-r--r--1.2-netsec/apps/app_nbscat.c241
-rw-r--r--1.2-netsec/apps/app_osplookup.c375
-rw-r--r--1.2-netsec/apps/app_page.c234
-rw-r--r--1.2-netsec/apps/app_parkandannounce.c281
-rw-r--r--1.2-netsec/apps/app_playback.c180
-rw-r--r--1.2-netsec/apps/app_privacy.c254
-rw-r--r--1.2-netsec/apps/app_queue.c3872
-rw-r--r--1.2-netsec/apps/app_random.c127
-rw-r--r--1.2-netsec/apps/app_read.c235
-rw-r--r--1.2-netsec/apps/app_readfile.c144
-rw-r--r--1.2-netsec/apps/app_realtime.c262
-rw-r--r--1.2-netsec/apps/app_record.c377
-rw-r--r--1.2-netsec/apps/app_rpt.c6560
-rw-r--r--1.2-netsec/apps/app_sayunixtime.c163
-rw-r--r--1.2-netsec/apps/app_senddtmf.c129
-rw-r--r--1.2-netsec/apps/app_sendtext.c156
-rw-r--r--1.2-netsec/apps/app_setcallerid.c178
-rw-r--r--1.2-netsec/apps/app_setcdruserfield.c179
-rw-r--r--1.2-netsec/apps/app_setcidname.c132
-rw-r--r--1.2-netsec/apps/app_setcidnum.c131
-rw-r--r--1.2-netsec/apps/app_setrdnis.c132
-rw-r--r--1.2-netsec/apps/app_settransfercapability.c145
-rw-r--r--1.2-netsec/apps/app_skel.c149
-rw-r--r--1.2-netsec/apps/app_sms.c1555
-rw-r--r--1.2-netsec/apps/app_softhangup.c139
-rw-r--r--1.2-netsec/apps/app_sql_postgres.c577
-rw-r--r--1.2-netsec/apps/app_stack.c193
-rw-r--r--1.2-netsec/apps/app_system.c176
-rw-r--r--1.2-netsec/apps/app_talkdetect.c250
-rw-r--r--1.2-netsec/apps/app_test.c529
-rw-r--r--1.2-netsec/apps/app_transfer.c182
-rw-r--r--1.2-netsec/apps/app_txtcidname.c164
-rw-r--r--1.2-netsec/apps/app_url.c196
-rw-r--r--1.2-netsec/apps/app_userevent.c137
-rw-r--r--1.2-netsec/apps/app_verbose.c135
-rw-r--r--1.2-netsec/apps/app_voicemail.c6757
-rw-r--r--1.2-netsec/apps/app_waitforring.c154
-rw-r--r--1.2-netsec/apps/app_waitforsilence.c210
-rw-r--r--1.2-netsec/apps/app_while.c369
-rw-r--r--1.2-netsec/apps/app_zapateller.c138
-rw-r--r--1.2-netsec/apps/app_zapbarge.c335
-rw-r--r--1.2-netsec/apps/app_zapras.c276
-rw-r--r--1.2-netsec/apps/app_zapscan.c399
-rw-r--r--1.2-netsec/apps/enter.h287
-rw-r--r--1.2-netsec/apps/leave.h207
-rw-r--r--1.2-netsec/apps/rpt_flow.pdfbin51935 -> 0 bytes
-rw-r--r--1.2-netsec/ast_expr2.c2419
-rw-r--r--1.2-netsec/ast_expr2.fl189
-rw-r--r--1.2-netsec/ast_expr2.h109
-rw-r--r--1.2-netsec/ast_expr2.y993
-rw-r--r--1.2-netsec/ast_expr2f.c2988
-rw-r--r--1.2-netsec/asterisk.8184
-rw-r--r--1.2-netsec/asterisk.c2450
-rw-r--r--1.2-netsec/asterisk.sgml353
-rw-r--r--1.2-netsec/astmm.c422
-rw-r--r--1.2-netsec/autoservice.c168
-rwxr-xr-x1.2-netsec/build_tools/make_build_h24
-rwxr-xr-x1.2-netsec/build_tools/make_defaults_h25
-rwxr-xr-x1.2-netsec/build_tools/make_svn_branch_name50
-rwxr-xr-x1.2-netsec/build_tools/make_version_h10
-rwxr-xr-x1.2-netsec/build_tools/mkdep123
-rw-r--r--1.2-netsec/buildinfo.c32
-rw-r--r--1.2-netsec/callerid.c788
-rw-r--r--1.2-netsec/cdr.c1271
-rw-r--r--1.2-netsec/cdr/Makefile140
-rw-r--r--1.2-netsec/cdr/cdr_csv.c292
-rw-r--r--1.2-netsec/cdr/cdr_custom.c178
-rw-r--r--1.2-netsec/cdr/cdr_manager.c178
-rw-r--r--1.2-netsec/cdr/cdr_odbc.c483
-rw-r--r--1.2-netsec/cdr/cdr_pgsql.c354
-rw-r--r--1.2-netsec/cdr/cdr_sqlite.c233
-rw-r--r--1.2-netsec/cdr/cdr_tds.c522
-rw-r--r--1.2-netsec/channel.c4059
-rw-r--r--1.2-netsec/channels/DialTone.h252
-rw-r--r--1.2-netsec/channels/Makefile262
-rw-r--r--1.2-netsec/channels/adtranvofr.h105
-rw-r--r--1.2-netsec/channels/answer.h237
-rw-r--r--1.2-netsec/channels/chan_agent.c2507
-rw-r--r--1.2-netsec/channels/chan_alsa.c1140
-rw-r--r--1.2-netsec/channels/chan_features.c606
-rw-r--r--1.2-netsec/channels/chan_h323.c2471
-rw-r--r--1.2-netsec/channels/chan_iax2.c9660
-rw-r--r--1.2-netsec/channels/chan_local.c661
-rw-r--r--1.2-netsec/channels/chan_mgcp.c4409
-rw-r--r--1.2-netsec/channels/chan_misdn.c3816
-rw-r--r--1.2-netsec/channels/chan_misdn_config.c1083
-rw-r--r--1.2-netsec/channels/chan_modem.c1117
-rw-r--r--1.2-netsec/channels/chan_modem_aopen.c501
-rw-r--r--1.2-netsec/channels/chan_modem_bestdata.c613
-rw-r--r--1.2-netsec/channels/chan_modem_i4l.c743
-rw-r--r--1.2-netsec/channels/chan_nbs.c325
-rw-r--r--1.2-netsec/channels/chan_oss.c1438
-rw-r--r--1.2-netsec/channels/chan_oss_old.c1132
-rw-r--r--1.2-netsec/channels/chan_phone.c1414
-rw-r--r--1.2-netsec/channels/chan_sip.c13508
-rw-r--r--1.2-netsec/channels/chan_skinny.c3381
-rw-r--r--1.2-netsec/channels/chan_vpb.c3051
-rw-r--r--1.2-netsec/channels/chan_zap.c11093
-rw-r--r--1.2-netsec/channels/gentone-ulaw.c157
-rw-r--r--1.2-netsec/channels/gentone.c95
-rw-r--r--1.2-netsec/channels/h323/ChangeLog43
-rw-r--r--1.2-netsec/channels/h323/INSTALL.openh32318
-rw-r--r--1.2-netsec/channels/h323/Makefile41
-rw-r--r--1.2-netsec/channels/h323/README142
-rw-r--r--1.2-netsec/channels/h323/TODO14
-rw-r--r--1.2-netsec/channels/h323/ast_h323.cpp1532
-rw-r--r--1.2-netsec/channels/h323/ast_h323.h239
-rw-r--r--1.2-netsec/channels/h323/chan_h323.h232
-rw-r--r--1.2-netsec/channels/h323/h323.conf.sample123
-rw-r--r--1.2-netsec/channels/iax2-parser.c951
-rw-r--r--1.2-netsec/channels/iax2-parser.h155
-rw-r--r--1.2-netsec/channels/iax2-provision.c537
-rw-r--r--1.2-netsec/channels/iax2-provision.h53
-rw-r--r--1.2-netsec/channels/iax2.h231
-rw-r--r--1.2-netsec/channels/misdn/Makefile72
-rw-r--r--1.2-netsec/channels/misdn/chan_misdn_config.h98
-rw-r--r--1.2-netsec/channels/misdn/ie.c1621
-rw-r--r--1.2-netsec/channels/misdn/isdn_lib.c3308
-rw-r--r--1.2-netsec/channels/misdn/isdn_lib.h367
-rw-r--r--1.2-netsec/channels/misdn/isdn_lib_intern.h99
-rw-r--r--1.2-netsec/channels/misdn/isdn_msg_parser.c1356
-rw-r--r--1.2-netsec/channels/misdn/mISDN.patch2500
-rw-r--r--1.2-netsec/channels/misdn/mISDNuser.patch271
-rw-r--r--1.2-netsec/channels/misdn/portinfo.c197
-rw-r--r--1.2-netsec/channels/ring10.h1752
-rw-r--r--1.2-netsec/chanvars.c91
-rw-r--r--1.2-netsec/cli.c1386
-rw-r--r--1.2-netsec/codecs/Makefile134
-rw-r--r--1.2-netsec/codecs/adpcm_slin_ex.h25
-rw-r--r--1.2-netsec/codecs/codec_a_mu.c343
-rw-r--r--1.2-netsec/codecs/codec_adpcm.c655
-rw-r--r--1.2-netsec/codecs/codec_alaw.c428
-rw-r--r--1.2-netsec/codecs/codec_g723_1.c418
-rw-r--r--1.2-netsec/codecs/codec_g726.c1092
-rw-r--r--1.2-netsec/codecs/codec_gsm.c352
-rw-r--r--1.2-netsec/codecs/codec_ilbc.c318
-rw-r--r--1.2-netsec/codecs/codec_lpc10.c431
-rw-r--r--1.2-netsec/codecs/codec_speex.c613
-rw-r--r--1.2-netsec/codecs/codec_ulaw.c445
-rw-r--r--1.2-netsec/codecs/g723_slin_ex.h15
-rw-r--r--1.2-netsec/codecs/g726_slin_ex.h25
-rw-r--r--1.2-netsec/codecs/gsm/COPYRIGHT16
-rw-r--r--1.2-netsec/codecs/gsm/Makefile587
-rw-r--r--1.2-netsec/codecs/gsm/README37
-rw-r--r--1.2-netsec/codecs/gsm/inc/config.h51
-rw-r--r--1.2-netsec/codecs/gsm/inc/gsm.h71
-rw-r--r--1.2-netsec/codecs/gsm/inc/private.h313
-rw-r--r--1.2-netsec/codecs/gsm/inc/proto.h65
-rw-r--r--1.2-netsec/codecs/gsm/inc/unproto.h23
-rw-r--r--1.2-netsec/codecs/gsm/src/add.c235
-rw-r--r--1.2-netsec/codecs/gsm/src/code.c101
-rw-r--r--1.2-netsec/codecs/gsm/src/debug.c76
-rw-r--r--1.2-netsec/codecs/gsm/src/decode.c62
-rw-r--r--1.2-netsec/codecs/gsm/src/gsm_create.c45
-rw-r--r--1.2-netsec/codecs/gsm/src/gsm_decode.c361
-rw-r--r--1.2-netsec/codecs/gsm/src/gsm_destroy.c26
-rw-r--r--1.2-netsec/codecs/gsm/src/gsm_encode.c451
-rw-r--r--1.2-netsec/codecs/gsm/src/gsm_explode.c417
-rw-r--r--1.2-netsec/codecs/gsm/src/gsm_implode.c515
-rw-r--r--1.2-netsec/codecs/gsm/src/gsm_option.c69
-rw-r--r--1.2-netsec/codecs/gsm/src/gsm_print.c167
-rw-r--r--1.2-netsec/codecs/gsm/src/k6opt.h84
-rw-r--r--1.2-netsec/codecs/gsm/src/k6opt.s739
-rw-r--r--1.2-netsec/codecs/gsm/src/long_term.c952
-rw-r--r--1.2-netsec/codecs/gsm/src/lpc.c369
-rw-r--r--1.2-netsec/codecs/gsm/src/preprocess.c131
-rw-r--r--1.2-netsec/codecs/gsm/src/rpe.c490
-rw-r--r--1.2-netsec/codecs/gsm/src/short_term.c448
-rw-r--r--1.2-netsec/codecs/gsm/src/table.c63
-rw-r--r--1.2-netsec/codecs/gsm_slin_ex.h16
-rw-r--r--1.2-netsec/codecs/ilbc/FrameClassify.c110
-rw-r--r--1.2-netsec/codecs/ilbc/FrameClassify.h26
-rw-r--r--1.2-netsec/codecs/ilbc/LPCdecode.c152
-rw-r--r--1.2-netsec/codecs/ilbc/LPCdecode.h44
-rw-r--r--1.2-netsec/codecs/ilbc/LPCencode.c228
-rw-r--r--1.2-netsec/codecs/ilbc/LPCencode.h29
-rw-r--r--1.2-netsec/codecs/ilbc/Makefile25
-rw-r--r--1.2-netsec/codecs/ilbc/StateConstructW.c76
-rw-r--r--1.2-netsec/codecs/ilbc/StateConstructW.h27
-rw-r--r--1.2-netsec/codecs/ilbc/StateSearchW.c194
-rw-r--r--1.2-netsec/codecs/ilbc/StateSearchW.h48
-rw-r--r--1.2-netsec/codecs/ilbc/anaFilter.c71
-rw-r--r--1.2-netsec/codecs/ilbc/anaFilter.h26
-rw-r--r--1.2-netsec/codecs/ilbc/constants.c729
-rw-r--r--1.2-netsec/codecs/ilbc/constants.h74
-rw-r--r--1.2-netsec/codecs/ilbc/createCB.c216
-rw-r--r--1.2-netsec/codecs/ilbc/createCB.h56
-rw-r--r--1.2-netsec/codecs/ilbc/doCPLC.c259
-rw-r--r--1.2-netsec/codecs/ilbc/doCPLC.h32
-rw-r--r--1.2-netsec/codecs/ilbc/enhancer.c665
-rw-r--r--1.2-netsec/codecs/ilbc/enhancer.h33
-rw-r--r--1.2-netsec/codecs/ilbc/filter.c168
-rw-r--r--1.2-netsec/codecs/ilbc/filter.h73
-rw-r--r--1.2-netsec/codecs/ilbc/gainquant.c107
-rw-r--r--1.2-netsec/codecs/ilbc/gainquant.h31
-rw-r--r--1.2-netsec/codecs/ilbc/getCBvec.c181
-rw-r--r--1.2-netsec/codecs/ilbc/getCBvec.h28
-rw-r--r--1.2-netsec/codecs/ilbc/helpfun.c308
-rw-r--r--1.2-netsec/codecs/ilbc/helpfun.h101
-rw-r--r--1.2-netsec/codecs/ilbc/hpInput.c60
-rw-r--r--1.2-netsec/codecs/ilbc/hpInput.h27
-rw-r--r--1.2-netsec/codecs/ilbc/hpOutput.c59
-rw-r--r--1.2-netsec/codecs/ilbc/hpOutput.h25
-rw-r--r--1.2-netsec/codecs/ilbc/iCBConstruct.c108
-rw-r--r--1.2-netsec/codecs/ilbc/iCBConstruct.h38
-rw-r--r--1.2-netsec/codecs/ilbc/iCBSearch.c480
-rw-r--r--1.2-netsec/codecs/ilbc/iCBSearch.h35
-rw-r--r--1.2-netsec/codecs/ilbc/iLBC_decode.c619
-rw-r--r--1.2-netsec/codecs/ilbc/iLBC_decode.h40
-rw-r--r--1.2-netsec/codecs/ilbc/iLBC_define.h201
-rw-r--r--1.2-netsec/codecs/ilbc/iLBC_encode.c514
-rw-r--r--1.2-netsec/codecs/ilbc/iLBC_encode.h37
-rw-r--r--1.2-netsec/codecs/ilbc/lsf.c264
-rw-r--r--1.2-netsec/codecs/ilbc/lsf.h30
-rw-r--r--1.2-netsec/codecs/ilbc/packing.c175
-rw-r--r--1.2-netsec/codecs/ilbc/packing.h67
-rw-r--r--1.2-netsec/codecs/ilbc/syntFilter.c108
-rw-r--r--1.2-netsec/codecs/ilbc/syntFilter.h27
-rw-r--r--1.2-netsec/codecs/ilbc_slin_ex.h17
-rw-r--r--1.2-netsec/codecs/log2comp.h74
-rw-r--r--1.2-netsec/codecs/lpc10/Makefile75
-rw-r--r--1.2-netsec/codecs/lpc10/README89
-rw-r--r--1.2-netsec/codecs/lpc10/analys.c649
-rw-r--r--1.2-netsec/codecs/lpc10/bsynz.c447
-rw-r--r--1.2-netsec/codecs/lpc10/chanwr.c232
-rw-r--r--1.2-netsec/codecs/lpc10/dcbias.c107
-rw-r--r--1.2-netsec/codecs/lpc10/decode.c625
-rw-r--r--1.2-netsec/codecs/lpc10/deemp.c154
-rw-r--r--1.2-netsec/codecs/lpc10/difmag.c133
-rw-r--r--1.2-netsec/codecs/lpc10/dyptrk.c405
-rw-r--r--1.2-netsec/codecs/lpc10/encode.c373
-rw-r--r--1.2-netsec/codecs/lpc10/energy.c103
-rw-r--r--1.2-netsec/codecs/lpc10/f2c.h325
-rw-r--r--1.2-netsec/codecs/lpc10/f2clib.c85
-rw-r--r--1.2-netsec/codecs/lpc10/ham84.c126
-rw-r--r--1.2-netsec/codecs/lpc10/hp100.c169
-rw-r--r--1.2-netsec/codecs/lpc10/invert.c193
-rw-r--r--1.2-netsec/codecs/lpc10/irc2pc.c151
-rw-r--r--1.2-netsec/codecs/lpc10/ivfilt.c136
-rw-r--r--1.2-netsec/codecs/lpc10/lpc10.h248
-rw-r--r--1.2-netsec/codecs/lpc10/lpcdec.c297
-rw-r--r--1.2-netsec/codecs/lpc10/lpcenc.c181
-rw-r--r--1.2-netsec/codecs/lpc10/lpcini.c446
-rw-r--r--1.2-netsec/codecs/lpc10/lpfilt.c125
-rw-r--r--1.2-netsec/codecs/lpc10/median.c89
-rw-r--r--1.2-netsec/codecs/lpc10/mload.c163
-rw-r--r--1.2-netsec/codecs/lpc10/onset.c324
-rw-r--r--1.2-netsec/codecs/lpc10/pitsyn.c583
-rw-r--r--1.2-netsec/codecs/lpc10/placea.c242
-rw-r--r--1.2-netsec/codecs/lpc10/placev.c275
-rw-r--r--1.2-netsec/codecs/lpc10/preemp.c144
-rw-r--r--1.2-netsec/codecs/lpc10/prepro.c116
-rw-r--r--1.2-netsec/codecs/lpc10/random.c125
-rw-r--r--1.2-netsec/codecs/lpc10/rcchk.c119
-rw-r--r--1.2-netsec/codecs/lpc10/synths.c425
-rw-r--r--1.2-netsec/codecs/lpc10/tbdm.c188
-rw-r--r--1.2-netsec/codecs/lpc10/voicin.c786
-rw-r--r--1.2-netsec/codecs/lpc10/vparms.c255
-rw-r--r--1.2-netsec/codecs/lpc10_slin_ex.h13
-rw-r--r--1.2-netsec/codecs/slin_adpcm_ex.h25
-rw-r--r--1.2-netsec/codecs/slin_g723_ex.h36
-rw-r--r--1.2-netsec/codecs/slin_g726_ex.h25
-rw-r--r--1.2-netsec/codecs/slin_gsm_ex.h28
-rw-r--r--1.2-netsec/codecs/slin_ilbc_ex.h28
-rw-r--r--1.2-netsec/codecs/slin_lpc10_ex.h21
-rw-r--r--1.2-netsec/codecs/slin_speex_ex.h262
-rw-r--r--1.2-netsec/codecs/slin_ulaw_ex.h25
-rw-r--r--1.2-netsec/codecs/speex_slin_ex.h16
-rw-r--r--1.2-netsec/codecs/ulaw_slin_ex.h25
-rw-r--r--1.2-netsec/coef_in.h13
-rw-r--r--1.2-netsec/coef_out.h4
-rw-r--r--1.2-netsec/config.c1080
-rw-r--r--1.2-netsec/configs/adsi.conf.sample8
-rw-r--r--1.2-netsec/configs/adtranvofr.conf.sample39
-rw-r--r--1.2-netsec/configs/agents.conf.sample80
-rw-r--r--1.2-netsec/configs/alarmreceiver.conf.sample80
-rw-r--r--1.2-netsec/configs/alsa.conf.sample31
-rw-r--r--1.2-netsec/configs/asterisk.adsi159
-rw-r--r--1.2-netsec/configs/cdr.conf.sample51
-rw-r--r--1.2-netsec/configs/cdr_custom.conf.sample6
-rw-r--r--1.2-netsec/configs/cdr_manager.conf.sample6
-rw-r--r--1.2-netsec/configs/cdr_odbc.conf.sample12
-rw-r--r--1.2-netsec/configs/cdr_pgsql.conf.sample9
-rw-r--r--1.2-netsec/configs/cdr_tds.conf.sample9
-rw-r--r--1.2-netsec/configs/codecs.conf.sample65
-rw-r--r--1.2-netsec/configs/dnsmgr.conf.sample5
-rw-r--r--1.2-netsec/configs/dundi.conf.sample239
-rw-r--r--1.2-netsec/configs/enum.conf.sample22
-rw-r--r--1.2-netsec/configs/extconfig.conf.sample51
-rw-r--r--1.2-netsec/configs/extensions.ael.sample62
-rw-r--r--1.2-netsec/configs/extensions.conf.sample492
-rw-r--r--1.2-netsec/configs/features.conf.sample37
-rw-r--r--1.2-netsec/configs/festival.conf.sample35
-rw-r--r--1.2-netsec/configs/iax.conf.sample418
-rw-r--r--1.2-netsec/configs/iaxprov.conf.sample83
-rw-r--r--1.2-netsec/configs/indications.conf.sample611
-rw-r--r--1.2-netsec/configs/logger.conf.sample69
-rw-r--r--1.2-netsec/configs/manager.conf.sample37
-rw-r--r--1.2-netsec/configs/meetme.conf.sample21
-rw-r--r--1.2-netsec/configs/mgcp.conf.sample75
-rw-r--r--1.2-netsec/configs/misdn.conf.sample267
-rw-r--r--1.2-netsec/configs/modem.conf.sample92
-rw-r--r--1.2-netsec/configs/modules.conf.sample53
-rw-r--r--1.2-netsec/configs/musiconhold.conf.sample64
-rw-r--r--1.2-netsec/configs/osp.conf.sample64
-rw-r--r--1.2-netsec/configs/oss.conf.sample39
-rw-r--r--1.2-netsec/configs/phone.conf.sample47
-rw-r--r--1.2-netsec/configs/privacy.conf.sample3
-rw-r--r--1.2-netsec/configs/queues.conf.sample200
-rw-r--r--1.2-netsec/configs/res_odbc.conf.sample31
-rw-r--r--1.2-netsec/configs/rpt.conf.sample180
-rw-r--r--1.2-netsec/configs/rtp.conf.sample20
-rw-r--r--1.2-netsec/configs/sip.conf.sample442
-rw-r--r--1.2-netsec/configs/sip_notify.conf.sample22
-rw-r--r--1.2-netsec/configs/skinny.conf.sample55
-rw-r--r--1.2-netsec/configs/telcordia-1.adsi83
-rw-r--r--1.2-netsec/configs/voicemail.conf.sample213
-rw-r--r--1.2-netsec/configs/vpb.conf.sample108
-rw-r--r--1.2-netsec/configs/zapata.conf.sample569
-rw-r--r--1.2-netsec/contrib/README.festival47
-rw-r--r--1.2-netsec/contrib/asterisk-doxygen-header10
-rw-r--r--1.2-netsec/contrib/asterisk-ices.xml93
-rw-r--r--1.2-netsec/contrib/asterisk-ng-doxygen1228
-rw-r--r--1.2-netsec/contrib/festival-1.4.1-diff76
-rw-r--r--1.2-netsec/contrib/festival-1.4.2.diff75
-rw-r--r--1.2-netsec/contrib/festival-1.4.3.diff93
-rw-r--r--1.2-netsec/contrib/festival-1.95.diff107
-rw-r--r--1.2-netsec/contrib/firmware/iax/iaxy.binbin39402 -> 0 bytes
-rw-r--r--1.2-netsec/contrib/i18n.testsuite.conf136
-rwxr-xr-x1.2-netsec/contrib/init.d/rc.debian.asterisk85
-rwxr-xr-x1.2-netsec/contrib/init.d/rc.gentoo.asterisk17
-rwxr-xr-x1.2-netsec/contrib/init.d/rc.mandrake.asterisk183
-rwxr-xr-x1.2-netsec/contrib/init.d/rc.mandrake.zaptel98
-rwxr-xr-x1.2-netsec/contrib/init.d/rc.redhat.asterisk136
-rwxr-xr-x1.2-netsec/contrib/init.d/rc.slackware.asterisk42
-rw-r--r--1.2-netsec/contrib/scripts/README.messages-expire20
-rw-r--r--1.2-netsec/contrib/scripts/agents.php73
-rw-r--r--1.2-netsec/contrib/scripts/ast_grab_core64
-rw-r--r--1.2-netsec/contrib/scripts/astgenkey61
-rw-r--r--1.2-netsec/contrib/scripts/astgenkey.8129
-rw-r--r--1.2-netsec/contrib/scripts/astxs157
-rw-r--r--1.2-netsec/contrib/scripts/autosupport155
-rw-r--r--1.2-netsec/contrib/scripts/autosupport.841
-rw-r--r--1.2-netsec/contrib/scripts/iax-friends.sql15
-rw-r--r--1.2-netsec/contrib/scripts/loadtest.tcl148
-rw-r--r--1.2-netsec/contrib/scripts/lookup.agi90
-rw-r--r--1.2-netsec/contrib/scripts/managerproxy.pl242
-rw-r--r--1.2-netsec/contrib/scripts/messages-expire.pl96
-rw-r--r--1.2-netsec/contrib/scripts/postgres_cdr.sql33
-rw-r--r--1.2-netsec/contrib/scripts/qview.pl100
-rw-r--r--1.2-netsec/contrib/scripts/retrieve_extensions_from_mysql.pl113
-rw-r--r--1.2-netsec/contrib/scripts/retrieve_extensions_from_sql.pl158
-rw-r--r--1.2-netsec/contrib/scripts/retrieve_sip_conf_from_mysql.pl93
-rw-r--r--1.2-netsec/contrib/scripts/safe_asterisk85
-rw-r--r--1.2-netsec/contrib/scripts/safe_asterisk.862
-rw-r--r--1.2-netsec/contrib/scripts/sip-friends.sql14
-rw-r--r--1.2-netsec/contrib/scripts/vmail.cgi1099
-rw-r--r--1.2-netsec/contrib/scripts/vmdb.sql11
-rw-r--r--1.2-netsec/contrib/thirdparty/spexxilbcfix_xlite.regbin452 -> 0 bytes
-rw-r--r--1.2-netsec/contrib/thirdparty/spexxilbcfix_xpro.regbin450 -> 0 bytes
-rw-r--r--1.2-netsec/contrib/utils/README.rawplayer37
-rw-r--r--1.2-netsec/contrib/utils/rawplayer.c38
-rw-r--r--1.2-netsec/contrib/valgrind-RedHat-8.0.supp41
-rw-r--r--1.2-netsec/cryptostub.c84
-rw-r--r--1.2-netsec/cygwin/Makefile6
-rw-r--r--1.2-netsec/cygwin/cygloader.c33
-rw-r--r--1.2-netsec/db.c597
-rw-r--r--1.2-netsec/db1-ast/Makefile77
-rw-r--r--1.2-netsec/db1-ast/btree/bt_close.c182
-rw-r--r--1.2-netsec/db1-ast/btree/bt_conv.c221
-rw-r--r--1.2-netsec/db1-ast/btree/bt_debug.c329
-rw-r--r--1.2-netsec/db1-ast/btree/bt_delete.c657
-rw-r--r--1.2-netsec/db1-ast/btree/bt_get.c105
-rw-r--r--1.2-netsec/db1-ast/btree/bt_open.c458
-rw-r--r--1.2-netsec/db1-ast/btree/bt_overflow.c228
-rw-r--r--1.2-netsec/db1-ast/btree/bt_page.c100
-rw-r--r--1.2-netsec/db1-ast/btree/bt_put.c321
-rw-r--r--1.2-netsec/db1-ast/btree/bt_search.c213
-rw-r--r--1.2-netsec/db1-ast/btree/bt_seq.c460
-rw-r--r--1.2-netsec/db1-ast/btree/bt_split.c829
-rw-r--r--1.2-netsec/db1-ast/btree/bt_utils.c260
-rw-r--r--1.2-netsec/db1-ast/btree/btree.h391
-rw-r--r--1.2-netsec/db1-ast/btree/extern.h70
-rw-r--r--1.2-netsec/db1-ast/db/db.c113
-rw-r--r--1.2-netsec/db1-ast/hash/README72
-rw-r--r--1.2-netsec/db1-ast/hash/extern.h65
-rw-r--r--1.2-netsec/db1-ast/hash/hash.c1001
-rw-r--r--1.2-netsec/db1-ast/hash/hash.h293
-rw-r--r--1.2-netsec/db1-ast/hash/hash_bigkey.c668
-rw-r--r--1.2-netsec/db1-ast/hash/hash_buf.c355
-rw-r--r--1.2-netsec/db1-ast/hash/hash_func.c225
-rw-r--r--1.2-netsec/db1-ast/hash/hash_log2.c56
-rw-r--r--1.2-netsec/db1-ast/hash/hash_page.c944
-rw-r--r--1.2-netsec/db1-ast/hash/hsearch.c107
-rw-r--r--1.2-netsec/db1-ast/hash/ndbm.c235
-rw-r--r--1.2-netsec/db1-ast/hash/page.h92
-rw-r--r--1.2-netsec/db1-ast/hash/search.h51
-rw-r--r--1.2-netsec/db1-ast/include/circ-queue.h131
-rw-r--r--1.2-netsec/db1-ast/include/compat.h49
-rw-r--r--1.2-netsec/db1-ast/include/db.h250
-rw-r--r--1.2-netsec/db1-ast/include/mpool.h115
-rw-r--r--1.2-netsec/db1-ast/include/ndbm.h79
-rw-r--r--1.2-netsec/db1-ast/libdb.map11
-rw-r--r--1.2-netsec/db1-ast/mpool/README7
-rw-r--r--1.2-netsec/db1-ast/mpool/mpool.c498
-rw-r--r--1.2-netsec/db1-ast/recno/extern.h54
-rw-r--r--1.2-netsec/db1-ast/recno/rec_close.c183
-rw-r--r--1.2-netsec/db1-ast/recno/rec_delete.c197
-rw-r--r--1.2-netsec/db1-ast/recno/rec_get.c311
-rw-r--r--1.2-netsec/db1-ast/recno/rec_open.c241
-rw-r--r--1.2-netsec/db1-ast/recno/rec_put.c280
-rw-r--r--1.2-netsec/db1-ast/recno/rec_search.c126
-rw-r--r--1.2-netsec/db1-ast/recno/rec_seq.c131
-rw-r--r--1.2-netsec/db1-ast/recno/rec_utils.c122
-rw-r--r--1.2-netsec/db1-ast/recno/recno.h39
-rw-r--r--1.2-netsec/devicestate.c281
-rw-r--r--1.2-netsec/dlfcn.c1314
-rw-r--r--1.2-netsec/dns.c228
-rw-r--r--1.2-netsec/dnsmgr.c371
-rw-r--r--1.2-netsec/doc/CODING-GUIDELINES510
-rw-r--r--1.2-netsec/doc/PEERING499
-rw-r--r--1.2-netsec/doc/README.ael273
-rw-r--r--1.2-netsec/doc/README.asterisk.conf76
-rw-r--r--1.2-netsec/doc/README.backtrace187
-rw-r--r--1.2-netsec/doc/README.cdr122
-rw-r--r--1.2-netsec/doc/README.cliprompt28
-rw-r--r--1.2-netsec/doc/README.configuration180
-rw-r--r--1.2-netsec/doc/README.cygwin7
-rw-r--r--1.2-netsec/doc/README.dundi26
-rw-r--r--1.2-netsec/doc/README.enum306
-rw-r--r--1.2-netsec/doc/README.extconfig85
-rw-r--r--1.2-netsec/doc/README.externalivr109
-rw-r--r--1.2-netsec/doc/README.h32323
-rw-r--r--1.2-netsec/doc/README.iax369
-rw-r--r--1.2-netsec/doc/README.ices12
-rw-r--r--1.2-netsec/doc/README.jitterbuffer137
-rw-r--r--1.2-netsec/doc/README.math69
-rw-r--r--1.2-netsec/doc/README.misdn342
-rw-r--r--1.2-netsec/doc/README.mp319
-rw-r--r--1.2-netsec/doc/README.mysql15
-rw-r--r--1.2-netsec/doc/README.odbcstorage33
-rw-r--r--1.2-netsec/doc/README.privacy361
-rw-r--r--1.2-netsec/doc/README.realtime111
-rw-r--r--1.2-netsec/doc/README.sms147
-rw-r--r--1.2-netsec/doc/README.tds18
-rw-r--r--1.2-netsec/doc/README.variables792
-rw-r--r--1.2-netsec/doc/app_sms.html834
-rw-r--r--1.2-netsec/doc/apps.txt10
-rw-r--r--1.2-netsec/doc/cdr.txt171
-rw-r--r--1.2-netsec/doc/channel.txt40
-rw-r--r--1.2-netsec/doc/extensions.txt58
-rw-r--r--1.2-netsec/doc/iax.txt55
-rw-r--r--1.2-netsec/doc/linkedlists.README98
-rw-r--r--1.2-netsec/doc/localchannel.txt49
-rw-r--r--1.2-netsec/doc/manager.txt297
-rw-r--r--1.2-netsec/doc/model.txt15
-rw-r--r--1.2-netsec/doc/modules.txt26
-rw-r--r--1.2-netsec/doc/queuelog.txt77
-rw-r--r--1.2-netsec/dsp.c1724
-rw-r--r--1.2-netsec/ecdisa.h15
-rw-r--r--1.2-netsec/editline/CHANGES42
-rw-r--r--1.2-netsec/editline/INSTALL64
-rw-r--r--1.2-netsec/editline/Makefile.in233
-rw-r--r--1.2-netsec/editline/PLATFORMS13
-rw-r--r--1.2-netsec/editline/README11
-rw-r--r--1.2-netsec/editline/TEST/test.c268
-rw-r--r--1.2-netsec/editline/chared.c695
-rw-r--r--1.2-netsec/editline/chared.h159
-rw-r--r--1.2-netsec/editline/common.c951
-rwxr-xr-x1.2-netsec/editline/config.guess1449
-rw-r--r--1.2-netsec/editline/config.h.in21
-rwxr-xr-x1.2-netsec/editline/config.sub1412
-rwxr-xr-x1.2-netsec/editline/configure2423
-rw-r--r--1.2-netsec/editline/configure.in276
-rw-r--r--1.2-netsec/editline/editline.3646
-rw-r--r--1.2-netsec/editline/editrc.5491
-rw-r--r--1.2-netsec/editline/el.c509
-rw-r--r--1.2-netsec/editline/el.h145
-rw-r--r--1.2-netsec/editline/emacs.c488
-rw-r--r--1.2-netsec/editline/hist.c197
-rw-r--r--1.2-netsec/editline/hist.h80
-rw-r--r--1.2-netsec/editline/histedit.h197
-rw-r--r--1.2-netsec/editline/history.c875
-rwxr-xr-x1.2-netsec/editline/install-sh250
-rw-r--r--1.2-netsec/editline/key.c687
-rw-r--r--1.2-netsec/editline/key.h79
-rw-r--r--1.2-netsec/editline/makelist254
-rw-r--r--1.2-netsec/editline/map.c1418
-rw-r--r--1.2-netsec/editline/map.h79
-rw-r--r--1.2-netsec/editline/np/fgetln.c88
-rw-r--r--1.2-netsec/editline/np/strlcat.c75
-rw-r--r--1.2-netsec/editline/np/strlcpy.c75
-rw-r--r--1.2-netsec/editline/np/unvis.c322
-rw-r--r--1.2-netsec/editline/np/vis.c348
-rw-r--r--1.2-netsec/editline/np/vis.h96
-rw-r--r--1.2-netsec/editline/parse.c259
-rw-r--r--1.2-netsec/editline/parse.h52
-rw-r--r--1.2-netsec/editline/prompt.c174
-rw-r--r--1.2-netsec/editline/prompt.h62
-rw-r--r--1.2-netsec/editline/read.c555
-rw-r--r--1.2-netsec/editline/read.h55
-rw-r--r--1.2-netsec/editline/readline.c1669
-rw-r--r--1.2-netsec/editline/readline/readline.h118
-rw-r--r--1.2-netsec/editline/refresh.c1104
-rw-r--r--1.2-netsec/editline/refresh.h63
-rw-r--r--1.2-netsec/editline/search.c649
-rw-r--r--1.2-netsec/editline/search.h70
-rw-r--r--1.2-netsec/editline/sig.c198
-rw-r--r--1.2-netsec/editline/sig.h72
-rw-r--r--1.2-netsec/editline/sys.h133
-rw-r--r--1.2-netsec/editline/term.c1587
-rw-r--r--1.2-netsec/editline/term.h124
-rw-r--r--1.2-netsec/editline/tokenizer.c397
-rw-r--r--1.2-netsec/editline/tokenizer.h54
-rw-r--r--1.2-netsec/editline/tty.c1182
-rw-r--r--1.2-netsec/editline/tty.h484
-rw-r--r--1.2-netsec/editline/vi.c941
-rw-r--r--1.2-netsec/enum.c666
-rw-r--r--1.2-netsec/file.c1287
-rw-r--r--1.2-netsec/formats/Makefile68
-rw-r--r--1.2-netsec/formats/format_au.c394
-rw-r--r--1.2-netsec/formats/format_g723.c278
-rw-r--r--1.2-netsec/formats/format_g726.c516
-rw-r--r--1.2-netsec/formats/format_g729.c260
-rw-r--r--1.2-netsec/formats/format_gsm.c280
-rw-r--r--1.2-netsec/formats/format_h263.c281
-rw-r--r--1.2-netsec/formats/format_ilbc.c259
-rw-r--r--1.2-netsec/formats/format_jpeg.c144
-rw-r--r--1.2-netsec/formats/format_ogg_vorbis.c677
-rw-r--r--1.2-netsec/formats/format_pcm.c276
-rw-r--r--1.2-netsec/formats/format_pcm_alaw.c352
-rw-r--r--1.2-netsec/formats/format_sln.c247
-rw-r--r--1.2-netsec/formats/format_vox.c253
-rw-r--r--1.2-netsec/formats/format_wav.c605
-rw-r--r--1.2-netsec/formats/format_wav_gsm.c589
-rw-r--r--1.2-netsec/formats/msgsm.h687
-rw-r--r--1.2-netsec/frame.c1301
-rw-r--r--1.2-netsec/fskmodem.c302
-rw-r--r--1.2-netsec/funcs/Makefile82
-rw-r--r--1.2-netsec/funcs/func_callerid.c153
-rw-r--r--1.2-netsec/funcs/func_cdr.c108
-rw-r--r--1.2-netsec/funcs/func_db.c169
-rw-r--r--1.2-netsec/funcs/func_enum.c243
-rw-r--r--1.2-netsec/funcs/func_env.c71
-rw-r--r--1.2-netsec/funcs/func_groupcount.c192
-rw-r--r--1.2-netsec/funcs/func_language.c75
-rw-r--r--1.2-netsec/funcs/func_logic.c201
-rw-r--r--1.2-netsec/funcs/func_math.c251
-rw-r--r--1.2-netsec/funcs/func_md5.c103
-rw-r--r--1.2-netsec/funcs/func_moh.c56
-rw-r--r--1.2-netsec/funcs/func_strings.c228
-rw-r--r--1.2-netsec/funcs/func_timeout.c177
-rw-r--r--1.2-netsec/funcs/func_uri.c121
-rw-r--r--1.2-netsec/funcs/pbx_functions.c74
-rw-r--r--1.2-netsec/image.c219
-rw-r--r--1.2-netsec/images/animlogo.gifbin63968 -> 0 bytes
-rw-r--r--1.2-netsec/images/asterisk-intro.jpgbin6143 -> 0 bytes
-rw-r--r--1.2-netsec/images/play.gifbin341 -> 0 bytes
-rw-r--r--1.2-netsec/include/asterisk.h127
-rw-r--r--1.2-netsec/include/asterisk/acl.h56
-rw-r--r--1.2-netsec/include/asterisk/adsi.h353
-rw-r--r--1.2-netsec/include/asterisk/aes.h170
-rw-r--r--1.2-netsec/include/asterisk/agi.h56
-rw-r--r--1.2-netsec/include/asterisk/alaw.h43
-rw-r--r--1.2-netsec/include/asterisk/app.h351
-rw-r--r--1.2-netsec/include/asterisk/ast_expr.h32
-rw-r--r--1.2-netsec/include/asterisk/astdb.h52
-rw-r--r--1.2-netsec/include/asterisk/astmm.h79
-rw-r--r--1.2-netsec/include/asterisk/astobj.h752
-rw-r--r--1.2-netsec/include/asterisk/astosp.h48
-rw-r--r--1.2-netsec/include/asterisk/callerid.h306
-rw-r--r--1.2-netsec/include/asterisk/causes.h82
-rw-r--r--1.2-netsec/include/asterisk/cdr.h297
-rw-r--r--1.2-netsec/include/asterisk/channel.h1207
-rw-r--r--1.2-netsec/include/asterisk/chanspy.h140
-rw-r--r--1.2-netsec/include/asterisk/chanvars.h42
-rw-r--r--1.2-netsec/include/asterisk/cli.h111
-rw-r--r--1.2-netsec/include/asterisk/compat.h97
-rw-r--r--1.2-netsec/include/asterisk/compiler.h33
-rw-r--r--1.2-netsec/include/asterisk/config.h194
-rw-r--r--1.2-netsec/include/asterisk/crypto.h112
-rw-r--r--1.2-netsec/include/asterisk/devicestate.h104
-rw-r--r--1.2-netsec/include/asterisk/dlfcn-compat.h88
-rw-r--r--1.2-netsec/include/asterisk/dns.h39
-rw-r--r--1.2-netsec/include/asterisk/dnsmgr.h44
-rw-r--r--1.2-netsec/include/asterisk/doxyref.h449
-rw-r--r--1.2-netsec/include/asterisk/dsp.h111
-rw-r--r--1.2-netsec/include/asterisk/dundi.h226
-rw-r--r--1.2-netsec/include/asterisk/endian.h65
-rw-r--r--1.2-netsec/include/asterisk/enum.h57
-rw-r--r--1.2-netsec/include/asterisk/features.h95
-rw-r--r--1.2-netsec/include/asterisk/file.h318
-rw-r--r--1.2-netsec/include/asterisk/frame.h484
-rw-r--r--1.2-netsec/include/asterisk/fskmodem.h72
-rw-r--r--1.2-netsec/include/asterisk/image.h96
-rw-r--r--1.2-netsec/include/asterisk/indications.h87
-rw-r--r--1.2-netsec/include/asterisk/inline_api.h66
-rw-r--r--1.2-netsec/include/asterisk/io.h145
-rw-r--r--1.2-netsec/include/asterisk/linkedlists.h443
-rw-r--r--1.2-netsec/include/asterisk/localtime.h34
-rw-r--r--1.2-netsec/include/asterisk/lock.h660
-rw-r--r--1.2-netsec/include/asterisk/logger.h126
-rw-r--r--1.2-netsec/include/asterisk/manager.h172
-rw-r--r--1.2-netsec/include/asterisk/md5.h40
-rw-r--r--1.2-netsec/include/asterisk/module.h419
-rw-r--r--1.2-netsec/include/asterisk/monitor.h56
-rw-r--r--1.2-netsec/include/asterisk/musiconhold.h47
-rw-r--r--1.2-netsec/include/asterisk/netsock.h68
-rw-r--r--1.2-netsec/include/asterisk/options.h66
-rw-r--r--1.2-netsec/include/asterisk/pbx.h665
-rw-r--r--1.2-netsec/include/asterisk/plc.h161
-rw-r--r--1.2-netsec/include/asterisk/poll-compat.h111
-rw-r--r--1.2-netsec/include/asterisk/privacy.h46
-rw-r--r--1.2-netsec/include/asterisk/res_odbc.h62
-rw-r--r--1.2-netsec/include/asterisk/rtp.h172
-rw-r--r--1.2-netsec/include/asterisk/say.h102
-rw-r--r--1.2-netsec/include/asterisk/sched.h160
-rw-r--r--1.2-netsec/include/asterisk/slinfactory.h56
-rw-r--r--1.2-netsec/include/asterisk/srv.h47
-rw-r--r--1.2-netsec/include/asterisk/strings.h251
-rw-r--r--1.2-netsec/include/asterisk/tdd.h82
-rw-r--r--1.2-netsec/include/asterisk/term.h74
-rw-r--r--1.2-netsec/include/asterisk/time.h143
-rw-r--r--1.2-netsec/include/asterisk/transcap.h42
-rw-r--r--1.2-netsec/include/asterisk/translate.h120
-rw-r--r--1.2-netsec/include/asterisk/ulaw.h43
-rw-r--r--1.2-netsec/include/asterisk/unaligned.h102
-rw-r--r--1.2-netsec/include/asterisk/utils.h238
-rw-r--r--1.2-netsec/include/asterisk/vmodem.h184
-rw-r--r--1.2-netsec/include/solaris-compat/compat.h46
-rw-r--r--1.2-netsec/include/solaris-compat/sys/cdefs.h10
-rw-r--r--1.2-netsec/include/solaris-compat/sys/queue.h540
-rw-r--r--1.2-netsec/indications.c611
-rw-r--r--1.2-netsec/io.c376
-rw-r--r--1.2-netsec/jitterbuf.c829
-rw-r--r--1.2-netsec/jitterbuf.h160
-rw-r--r--1.2-netsec/keys/freeworlddialup.pub6
-rw-r--r--1.2-netsec/keys/iaxtel.pub6
-rw-r--r--1.2-netsec/loader.c646
-rw-r--r--1.2-netsec/logger.c968
-rw-r--r--1.2-netsec/manager.c1764
-rw-r--r--1.2-netsec/md5.c266
-rwxr-xr-x1.2-netsec/mkpkgconfig43
-rw-r--r--1.2-netsec/muted.c682
-rw-r--r--1.2-netsec/muted.conf.sample26
-rw-r--r--1.2-netsec/netsock.c221
-rw-r--r--1.2-netsec/pbx.c6503
-rw-r--r--1.2-netsec/pbx/Makefile80
-rw-r--r--1.2-netsec/pbx/dundi-parser.c832
-rw-r--r--1.2-netsec/pbx/dundi-parser.h88
-rw-r--r--1.2-netsec/pbx/pbx_ael.c1284
-rw-r--r--1.2-netsec/pbx/pbx_config.c1831
-rw-r--r--1.2-netsec/pbx/pbx_dundi.c4831
-rw-r--r--1.2-netsec/pbx/pbx_gtkconsole.c518
-rw-r--r--1.2-netsec/pbx/pbx_kdeconsole.cc61
-rw-r--r--1.2-netsec/pbx/pbx_kdeconsole.h37
-rw-r--r--1.2-netsec/pbx/pbx_kdeconsole_main.cc81
-rw-r--r--1.2-netsec/pbx/pbx_loopback.c207
-rw-r--r--1.2-netsec/pbx/pbx_realtime.c274
-rw-r--r--1.2-netsec/pbx/pbx_spool.c445
-rw-r--r--1.2-netsec/plc.c250
-rw-r--r--1.2-netsec/poll.c306
-rw-r--r--1.2-netsec/privacy.c118
-rw-r--r--1.2-netsec/redhat/asterisk.spec127
-rw-r--r--1.2-netsec/redhat/rpmmacros3
-rw-r--r--1.2-netsec/redhat/rpmrc3
-rw-r--r--1.2-netsec/res/Makefile122
-rw-r--r--1.2-netsec/res/res_adsi.c1141
-rw-r--r--1.2-netsec/res/res_agi.c2142
-rw-r--r--1.2-netsec/res/res_config_odbc.c540
-rw-r--r--1.2-netsec/res/res_crypto.c622
-rw-r--r--1.2-netsec/res/res_features.c2190
-rw-r--r--1.2-netsec/res/res_indications.c435
-rw-r--r--1.2-netsec/res/res_monitor.c592
-rw-r--r--1.2-netsec/res/res_musiconhold.c1237
-rw-r--r--1.2-netsec/res/res_odbc.c618
-rw-r--r--1.2-netsec/res/res_osp.c886
-rw-r--r--1.2-netsec/rtp.c1896
-rw-r--r--1.2-netsec/sample.call60
-rw-r--r--1.2-netsec/say.c6116
-rw-r--r--1.2-netsec/sched.c416
-rw-r--r--1.2-netsec/slinfactory.c161
-rw-r--r--1.2-netsec/sounds.txt729
-rw-r--r--1.2-netsec/sounds/agent-alreadyon.gsmbin9405 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/agent-incorrect.gsmbin7689 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/agent-loggedoff.gsmbin2640 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/agent-loginok.gsmbin2046 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/agent-newlocation.gsmbin5544 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/agent-pass.gsmbin4884 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/agent-user.gsmbin7392 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/auth-incorrect.gsmbin7524 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/auth-thankyou.gsmbin1947 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/beep.gsmbin726 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/beeperr.gsmbin594 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/conf-adminmenu.gsmbin29634 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/conf-enteringno.gsmbin3630 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/conf-errormenu.gsmbin2376 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/conf-getchannel.gsmbin5709 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/conf-getconfno.gsmbin5511 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/conf-getpin.gsmbin3696 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/conf-hasjoin.gsmbin3102 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/conf-hasleft.gsmbin2640 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/conf-invalid.gsmbin5973 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/conf-invalidpin.gsmbin4752 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/conf-kicked.gsmbin3861 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/conf-leaderhasleft.gsmbin3267 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/conf-locked.gsmbin2805 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/conf-lockednow.gsmbin3597 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/conf-muted.gsmbin2178 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/conf-noempty.gsmbin4422 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/conf-onlyone.gsmbin5511 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/conf-onlyperson.gsmbin5412 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/conf-otherinparty.gsmbin3432 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/conf-placeintoconf.gsmbin3927 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/conf-thereare.gsmbin1947 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/conf-unlockednow.gsmbin4290 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/conf-unmuted.gsmbin2607 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/conf-usermenu.gsmbin20592 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/conf-userswilljoin.gsmbin3201 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/conf-userwilljoin.gsmbin3135 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/conf-waitforleader.gsmbin4488 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/demo-abouttotry.gsmbin23364 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/demo-congrats.gsmbin45573 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/demo-echodone.gsmbin4059 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/demo-echotest.gsmbin31812 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/demo-enterkeywords.gsmbin9603 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/demo-instruct.gsmbin110913 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/demo-moreinfo.gsmbin18810 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/demo-nogo.gsmbin16104 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/demo-nomatch.gsmbin6336 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/demo-thanks.gsmbin7920 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/dictate/both_help.gsmbin8415 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/dictate/enter_filename.gsmbin9339 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/dictate/forhelp.gsmbin2475 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/dictate/pause.gsmbin1122 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/dictate/paused.gsmbin1287 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/dictate/play_help.gsmbin14388 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/dictate/playback.gsmbin1386 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/dictate/playback_mode.gsmbin1848 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/dictate/record.gsmbin1386 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/dictate/record_help.gsmbin8646 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/dictate/record_mode.gsmbin1650 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/dictate/truncating_audio.gsmbin2508 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/0.gsmbin1452 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/1.gsmbin957 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/10.gsmbin1023 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/11.gsmbin1617 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/12.gsmbin1683 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/13.gsmbin1782 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/14.gsmbin1881 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/15.gsmbin2013 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/16.gsmbin2178 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/17.gsmbin2244 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/18.gsmbin2046 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/19.gsmbin2244 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/2.gsmbin990 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/20.gsmbin1122 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/3.gsmbin1122 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/30.gsmbin957 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/4.gsmbin924 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/40.gsmbin990 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/5.gsmbin1023 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/50.gsmbin1155 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/6.gsmbin891 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/60.gsmbin1155 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/7.gsmbin1089 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/70.gsmbin1353 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/8.gsmbin792 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/80.gsmbin1089 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/9.gsmbin1254 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/90.gsmbin1353 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/a-m.gsmbin1848 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/at.gsmbin858 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/day-0.gsmbin1452 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/day-1.gsmbin1980 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/day-2.gsmbin1617 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/day-3.gsmbin2013 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/day-4.gsmbin1848 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/day-5.gsmbin1716 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/day-6.gsmbin1683 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/dollars.gsmbin1353 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/h-1.gsmbin1155 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/h-10.gsmbin990 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/h-11.gsmbin1287 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/h-12.gsmbin1056 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/h-13.gsmbin1650 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/h-14.gsmbin1584 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/h-15.gsmbin1485 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/h-16.gsmbin1551 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/h-17.gsmbin1749 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/h-18.gsmbin1386 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/h-19.gsmbin1617 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/h-2.gsmbin1254 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/h-20.gsmbin1287 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/h-3.gsmbin957 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/h-30.gsmbin1650 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/h-4.gsmbin1221 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/h-5.gsmbin1023 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/h-6.gsmbin1188 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/h-7.gsmbin1254 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/h-8.gsmbin1023 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/h-9.gsmbin1089 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/hundred.gsmbin1122 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/million.gsmbin1320 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/minus.gsmbin1518 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/mon-0.gsmbin1914 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/mon-1.gsmbin2046 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/mon-10.gsmbin1815 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/mon-11.gsmbin2013 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/mon-2.gsmbin1584 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/mon-3.gsmbin1386 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/mon-4.gsmbin1254 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/mon-5.gsmbin1683 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/mon-6.gsmbin1551 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/mon-7.gsmbin1353 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/mon-8.gsmbin1617 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/mon-9.gsmbin1848 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/oclock.gsmbin1452 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/oh.gsmbin1188 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/p-m.gsmbin1485 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/pound.gsmbin1155 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/star.gsmbin1353 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/thousand.gsmbin1155 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/today.gsmbin1254 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/tomorrow.gsmbin1287 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/digits/yesterday.gsmbin1320 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/dir-instr.gsmbin10164 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/dir-intro-fn.gsmbin17424 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/dir-intro.gsmbin17556 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/dir-nomatch.gsmbin3960 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/dir-nomore.gsmbin4950 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/fpm-calm-river.mp3bin1939812 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/fpm-sunshine.mp3bin2582496 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/fpm-world-mix.mp3bin2217563 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/hello-world.gsmbin2838 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/hours.gsmbin1221 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/invalid.gsmbin7128 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/a.gsmbin825 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/at.gsmbin858 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/b.gsmbin990 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/c.gsmbin1023 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/d.gsmbin1122 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/dash.gsmbin1221 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/dollar.gsmbin1122 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/dot.gsmbin990 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/e.gsmbin990 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/equals.gsmbin1386 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/exclaimation-point.gsmbin2442 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/f.gsmbin957 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/g.gsmbin1155 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/h.gsmbin1122 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/i.gsmbin990 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/j.gsmbin1155 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/k.gsmbin1056 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/l.gsmbin924 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/m.gsmbin825 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/n.gsmbin792 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/o.gsmbin891 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/p.gsmbin891 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/plus.gsmbin957 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/q.gsmbin957 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/r.gsmbin924 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/s.gsmbin825 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/slash.gsmbin1353 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/space.gsmbin1320 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/t.gsmbin792 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/u.gsmbin1023 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/v.gsmbin1089 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/w.gsmbin1419 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/x.gsmbin924 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/y.gsmbin1155 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/z.gsmbin1023 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/letters/zed.gsmbin1056 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/minutes.gsmbin1254 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/pbx-invalid.gsmbin6864 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/pbx-invalidpark.gsmbin8184 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/pbx-transfer.gsmbin1551 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/phonetic/9_p.gsmbin1155 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/phonetic/a_p.gsmbin1089 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/phonetic/b_p.gsmbin1188 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/phonetic/c_p.gsmbin1089 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/phonetic/d_p.gsmbin1254 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/phonetic/e_p.gsmbin1056 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/phonetic/f_p.gsmbin1320 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/phonetic/g_p.gsmbin990 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/phonetic/h_p.gsmbin1287 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/phonetic/i_p.gsmbin1089 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/phonetic/j_p.gsmbin1353 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/phonetic/k_p.gsmbin1056 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/phonetic/l_p.gsmbin1122 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/phonetic/m_p.gsmbin858 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/phonetic/n_p.gsmbin1254 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/phonetic/o_p.gsm2
-rw-r--r--1.2-netsec/sounds/phonetic/p_p.gsmbin924 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/phonetic/q_p.gsmbin1122 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/phonetic/r_p.gsmbin1188 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/phonetic/s_p.gsmbin1221 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/phonetic/t_p.gsmbin1155 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/phonetic/u_p.gsmbin1452 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/phonetic/v_p.gsmbin1122 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/phonetic/w_p.gsmbin1089 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/phonetic/x_p.gsmbin1089 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/phonetic/y_p.gsmbin1188 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/phonetic/z_p.gsmbin1188 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/priv-callee-options.gsmbin45375 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/priv-callpending.gsmbin7326 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/priv-introsaved.gsmbin6501 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/priv-recordintro.gsmbin3498 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/privacy-incorrect.gsmbin4620 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/privacy-prompt.gsmbin5973 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/privacy-thankyou.gsmbin1947 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/privacy-unident.gsmbin7029 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/queue-callswaiting.gsmbin3366 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/queue-holdtime.gsmbin4026 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/queue-less-than.gsmbin1419 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/queue-minutes.gsmbin1056 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/queue-periodic-announce.gsmbin12474 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/queue-reporthold.gsmbin1188 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/queue-seconds.gsmbin1386 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/queue-thankyou.gsmbin2739 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/queue-thereare.gsmbin3234 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/queue-youarenext.gsmbin8283 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/screen-callee-options.gsmbin25674 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/seconds.gsmbin1386 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/spy-agent.gsmbin1320 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/spy-h323.gsmbin2706 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/spy-iax.gsmbin957 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/spy-iax2.gsmbin957 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/spy-mgcp.gsmbin2508 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/spy-sip.gsmbin1254 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/spy-skinny.gsmbin1320 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/spy-zap.gsmbin1287 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/ss-noservice.gsmbin7689 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/transfer.gsmbin3696 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/tt-allbusy.gsmbin13926 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/tt-monkeys.gsmbin26697 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/tt-monkeysintro.gsmbin4257 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/tt-somethingwrong.gsmbin2871 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/tt-weasels.gsmbin4323 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-Cust1.gsmbin2046 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-Cust2.gsmbin1914 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-Cust3.gsmbin2112 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-Cust4.gsmbin1815 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-Cust5.gsmbin2277 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-Family.gsmbin990 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-Friends.gsmbin1023 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-INBOX.gsmbin891 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-Old.gsmbin825 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-Work.gsmbin792 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-advopts.gsmbin3729 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-and.gsmbin957 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-calldiffnum.gsmbin5115 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-changeto.gsmbin2640 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-delete.gsmbin3696 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-deleted.gsmbin2112 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-dialout.gsmbin3267 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-enter-num-to-call.gsmbin3399 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-extension.gsmbin1914 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-first.gsmbin1353 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-for.gsmbin1155 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-forward.gsmbin7260 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-forwardoptions.gsmbin9702 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-from-extension.gsmbin2640 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-from-phonenumber.gsmbin2574 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-from.gsmbin759 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-goodbye.gsmbin1419 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-helpexit.gsmbin5181 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-incorrect-mailbox.gsmbin4554 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-incorrect.gsmbin2805 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-instructions.gsmbin10659 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-intro.gsmbin8844 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-isonphone.gsmbin1980 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-isunavail.gsmbin1980 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-last.gsmbin1254 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-leavemsg.gsmbin3828 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-login.gsmbin3993 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-mailboxfull.gsmbin6534 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-message.gsmbin1320 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-messages.gsmbin1452 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-minutes.gsmbin1056 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-mismatch.gsmbin8085 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-msginstruct.gsmbin22341 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-msgsaved.gsmbin3168 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-newpassword.gsmbin5214 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-newuser.gsmbin10494 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-next.gsmbin3960 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-no.gsmbin1254 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-nobodyavail.gsmbin4620 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-nobox.gsmbin6864 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-nomore.gsmbin2079 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-nonumber.gsmbin4257 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-num-i-have.gsmbin2607 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-onefor.gsmbin2244 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-options.gsmbin25245 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-opts.gsmbin11253 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-passchanged.gsmbin3366 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-password.gsmbin1551 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-press.gsmbin1320 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-prev.gsmbin3696 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-reachoper.gsmbin4950 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-rec-busy.gsmbin7095 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-rec-name.gsmbin6501 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-rec-temp.gsmbin7689 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-rec-unv.gsmbin7524 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-received.gsmbin1287 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-reenterpassword.gsmbin7821 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-repeat.gsmbin4092 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-review.gsmbin14487 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-saved.gsmbin1254 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-savedto.gsmbin1584 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-savefolder.gsmbin4125 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-savemessage.gsmbin3564 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-saveoper.gsmbin16533 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-sorry.gsmbin4686 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-star-cancel.gsmbin3102 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-starmain.gsmbin4620 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-tempgreeting.gsmbin5181 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-tempgreeting2.gsmbin11154 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-tempremoved.gsmbin5148 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-then-pound.gsmbin2178 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-theperson.gsmbin2508 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-tocallback.gsmbin6204 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-tocallnum.gsmbin4554 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-tocancel.gsmbin2772 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-tocancelmsg.gsmbin5445 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-toenternumber.gsmbin4389 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-toforward.gsmbin4785 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-tohearenv.gsmbin5346 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-tomakecall.gsmbin5247 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-tooshort.gsmbin2904 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-toreply.gsmbin4422 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-torerecord.gsmbin5379 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-undelete.gsmbin4059 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-undeleted.gsmbin2310 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-unknown-caller.gsmbin2277 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-whichbox.gsmbin5247 -> 0 bytes
-rw-r--r--1.2-netsec/sounds/vm-youhave.gsmbin1320 -> 0 bytes
-rw-r--r--1.2-netsec/srv.c137
-rw-r--r--1.2-netsec/stdtime/Makefile24
-rw-r--r--1.2-netsec/stdtime/localtime.c1505
-rw-r--r--1.2-netsec/stdtime/private.h222
-rw-r--r--1.2-netsec/stdtime/test.c21
-rw-r--r--1.2-netsec/stdtime/tzfile.h189
-rw-r--r--1.2-netsec/strcompat.c57
-rw-r--r--1.2-netsec/tdd.c320
-rw-r--r--1.2-netsec/term.c279
-rw-r--r--1.2-netsec/translate.c509
-rw-r--r--1.2-netsec/ulaw.c105
-rw-r--r--1.2-netsec/utils.c905
-rw-r--r--1.2-netsec/utils/Makefile80
-rw-r--r--1.2-netsec/utils/astman.1102
-rw-r--r--1.2-netsec/utils/astman.c720
-rw-r--r--1.2-netsec/utils/check_expr.c324
-rw-r--r--1.2-netsec/utils/frame.c1034
-rw-r--r--1.2-netsec/utils/frame.h300
-rw-r--r--1.2-netsec/utils/smsq.c763
-rw-r--r--1.2-netsec/utils/stereorize.c159
-rw-r--r--1.2-netsec/utils/streamplayer.c103
1126 files changed, 0 insertions, 321222 deletions
diff --git a/1.2-netsec/.cleancount b/1.2-netsec/.cleancount
deleted file mode 100644
index 45a4fb75d..000000000
--- a/1.2-netsec/.cleancount
+++ /dev/null
@@ -1 +0,0 @@
-8
diff --git a/1.2-netsec/BUGS b/1.2-netsec/BUGS
deleted file mode 100644
index f1c6af13a..000000000
--- a/1.2-netsec/BUGS
+++ /dev/null
@@ -1,22 +0,0 @@
-Asterisk Bug Tracking Information
-=================================
-
-To learn about and report Asterisk bugs, please visit
-the official Asterisk Bug Tracker at:
-
- http://bugs.digium.com
-
-For more information on using the bug tracker, or to
-learn how you can contribute by acting as a bug marshall
-please see:
-
- http://www.digium.com/index.php?menu=bugguidelines
-
-If you would like to submit a feature request, please
-resist the temptation to post it to the bug tracker.
-Feature requests should be posted to the asterisk-dev
-mailing list, located at:
-
- http://lists.digium.com
-
-Thank you!
diff --git a/1.2-netsec/CHANGES b/1.2-netsec/CHANGES
deleted file mode 100644
index 49e14a4fa..000000000
--- a/1.2-netsec/CHANGES
+++ /dev/null
@@ -1,127 +0,0 @@
-Changes since Asterisk 1.2.0-beta2:
-
- * Cygwin build system portability
- * Optional generation of outbound silence during channel recording
-
-Changes since Asterisk 1.2.0-beta1:
-
- * Many, many bug fixes
- * Documentation and sample configuration updates
- * Vastly improved presence/subscription support in the SIP channel driver
- * A new (experimental) mISDN channel driver
- * A new monitoring application (MixMonitor)
- * More portability fixes for non-Linux platforms
- * New dialplan functions replacing old applications
- * Significant deadlock and performance upgrades for the Manager interface
- * An upgrade to the 'new' dialplan expression parser for all users
- * New Zaptel echo cancellers with improved performance
- * Support for the latest OSP toolkit from TransNexus
- * Support user-controlled volume adjustment in MeetMe application
- * More dialplan applications now return status variables instead of priority jumping
- * Much more powerful ENUM support in the dialplan
- * SIP domain support for authentication and virtual hosting
- * Many PRI protocol updates and fixes, including more complete Q.SIG support
- * New applications: Pickup() and Page()
-
-Changes since Asterisk 1.0:
-
-This list currently only containts changes made from the end of November until
-March 26, 2005.
-
- * Add new applications:
- -- AgentMonitorOutgoing
- -- Curl
- -- ExecIf
- -- ExecIfTime
- -- IAX2Provision
- -- MacroExit
- -- MacroIf
- -- PauseQueueMember
- -- ReadFile
- -- SetRDNIS
- -- SIPAddHeader
- -- SIPGetHeader
- -- StartMusicOnHold
- -- StopMusicOnHold
- -- UnpauseQueueMember
- -- WaitForSilence
- -- While / EndWhile
- * app Answer
- -- added delay option
- * app ChanIsAvail
- -- added 's' option
- * app Dial
- -- add option to specify the class for musiconhold with m option
- * app EnumLookup
- -- added "reload enum" for configuration
- * app Goto
- -- added relative priorities
- * app GotoIf
- -- added relative priorities
- * app MeetMe
- -- added 'i' option
- -- added 'r' option
- -- added 'T' option
- -- added 'P' option
- -- added 'c' option
- -- added adminpin to meetme.conf
- -- added reload command
- * app PrivacyManager
- -- add config file privacy.conf
- * app queue
- -- queues.conf
- -- added persistentmembers option to queues.conf
- -- changed music option to musiconhold
- -- added weight option
- -- added note about why agent groups probably shouldn't be used
- -- added timeoutrestart option
- * app Read
- -- added attempts parameter
- -- added timeout parameter
- * app Record
- -- added 'q' option
- * app SendDTMF
- -- add timeout option
- * app SMS
- -- document alternative syntax for queueing messages
- * app Voicemail
- -- add info about VM_CATEGORY
- -- voicemail.conf
- -- added usedirectory option
- -- added VM_CIDNUM and VM_CIDNAME in message config
- * chan IAX2
- -- new jitterbuffer
- -- added setvar option
- -- added regex to iax2 show peers/users
- -- allow multiple bindaddr lines in iax.conf
- -- added reload command
- -- added forcejitterbuffer option
- -- added note about specifying bindport before bindaddr
- -- added trunktimestamps option
- * chan Agent
- -- added agent logoff CLI command
- * chan OSS
- -- added Flash CLI command
- * chan SIP
- -- added setvar option
- -- added compactheaders option
- -- added usereqphone option
- -- added registertimeout option
- -- added externhost option
- -- added sip notify CLI command
- -- added sip_notify.conf
- -- added allowguest option
- * chan Zap
- -- added hanguponplarityswitch option
- -- added sendcalleridafter option
- -- added priresetinterval option
- -- added TON/NPI config options (the ones right above the resetinterval option)
- -- added answeronpolarityswitch option
- -- added "never" for resetinterval
- * extensions
- -- allow '*' when including files (#include "sip-*.conf")
- -- added eswitch
- * General
- -- added #exec syntax for including output from a command
- -- added show features CLI command
- -- added configuration templates for category inheritance
diff --git a/1.2-netsec/COPYING b/1.2-netsec/COPYING
deleted file mode 100644
index aa2ebac66..000000000
--- a/1.2-netsec/COPYING
+++ /dev/null
@@ -1,341 +0,0 @@
-
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) 19yy <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) 19yy name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
diff --git a/1.2-netsec/CREDITS b/1.2-netsec/CREDITS
deleted file mode 100644
index 8dc47d6bd..000000000
--- a/1.2-netsec/CREDITS
+++ /dev/null
@@ -1,133 +0,0 @@
-
-=== DEVELOPMENT SUPPORT ===
-We'd like to thank the following companies for helping fund development of
-Asterisk:
-
-Pilosoft, Inc. - for supporting ADSI development in Asterisk
-
-Asterlink, Inc. - for supporting broad Asterisk development
-
-GFS - for supporting ALSA development
-
-Telesthetic - for supporting SIP development
-
-Christos Ricudis - for substantial code contributions
-
-Paul Bagyenda, Digital Solutions - for initial Voicetronix driver development
-
-=== WISHLIST CONTRIBUTERS ===
-Jeremy McNamara - SpeeX support
-Nick Seraphin - RDNIS support
-Gary - Phonejack ADSI (in progress)
-Wasim - Hangup detect
-
-=== HARDWARE DONORS ===
-* Thanks to QuickNet Technologies for their donation of an Internet
-PhoneJack and Linejack card to the project. (http://www.quicknet.net)
-
-=== MISCELLANEOUS PATCHES ===
-Jim Dixon - Zapata Telephony and app_rpt
- http://www.zapatatelephony.org/app_rpt.html
-Russell Bryant - Asterisk 1.0 maintainer and misc. enhancements
- russelb@clemson.edu
-Anthony Minessale II - Countless big and small fixes, and relentless forward push
- anthmct@yahoo.com http://www.asterlink.com
-James Golovich - Innumerable contributions
- You can find him and asterisk-perl at http://asterisk.gnuinter.net
-Andre Bierwirth - Extension hints and status
-Oliver Daudey - ISDN4Linux fixes
-Pauline Middelink - ISDN4Linux patches and some general patches.
- She can be found at http://www.polyware.nl/~middelink/En/
-Jean-Denis Girard - Various contributions from the South Pacific Islands
- jd-girard@esoft.pf http://www.esoft.pf
-William Jordan / Vonage - MySQL enhancements to Voicemail
- wjordan@vonage.com
-Jac Kersing - Various fixes
-Steven Critchfield - Seek and Trunc functions for playback and recording
- critch@basesys.com
-Jefferson Noxon - app_lookupcidname, app_db, and various other contributions
-Klaus-Peter Junghanns - in-band DTMF on SIP and MGCP
-Ross Finlayson - Dynamic RTP payload support
-Mahmut Fettahlioglu - Audio recording, music-on-hold changes, alaw file
- format, and various fixes. Can be contacted at mahmut@oa.com.au
-James Dennis - Cisco SIP compatibility patches to work with SIP service
- providers. Can be contacted at asterisk@jdennis.net
-Tilghman Lesher - ast_localtime(); ast_say_date_with_format();
- GotoIfTime, Random, SayUnixTime, HasNewVoicemail applications;
- CUT, SORT, EVAL, CURL, FIELDQTY, STRFTIME, QUEUEAGENT* functions;
- and other innumerable bug fixes. http://asterisk.drunkcoder.com/
-Jayson Vantuyl - Manager protocol changes, various other bugs.
- jvantuyl@computingedge.net
-Thorsten Lockert - OpenBSD, FreeBSD ports, making MacOS X port run on 10.3,
- dialplan include verification, route lookup on OpenBSD, various other
- bugs. tholo@sigmasoft.com
-Brian West - ODBC support and Bug Marshaling
-Josh Roberson - chan_zap reload support, Advanced Voicemail Features, other misc. patches,
- and Bug Marshalling. - josh@asteriasgi.com, http://www.asteriasgi.com
-William Waites - syslog support, SIP NAT traversal for SIP-UA. ww@styx.org
-Rich Murphey - Porting to FreeBSD, NetBSD, OpenBSD, and Darwin.
- rich@whiteoaklabs.com http://whiteoaklabs.com
-Simon Lockhart - Porting to Solaris (based on work of Logan ???)
- simon@slimey.org
-Olle E. Johansson - SIP RFC compliance, documentation and testing, testing, testing
- oej@edvina.net, http://edvina.net
-Steve Kann - new jitter buffer for IAX2
- stevek@stevek.com
-Constantine Filin - major contributions to the Asterisk Realtime Architecture
-Steve Murphy - privacy support
-Claude Patry - bug fixes, feature enhancements, and bug marshalling
- cpatry@gmail.com
-
-=== OTHER CONTRIBUTIONS ===
-John Todd - Monkey sounds and associated teletorture prompt
-Michael Jerris - bug marshaling
-Leif Madsen, Jared Smith and Jim van Meggelen - the Asterisk book
- available under a Creative Commons License at http://www.asteriskdocs.org
-
-=== HOLD MUSIC ===
-Music provided by www.freeplaymusic.com
-
-=== OTHER SOURCE CODE IN ASTERISK ===
-
-Digium did not implement the codecs in Asterisk. Here is the copyright on the
-GSM source:
-
-Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann,
-Technische Universitaet Berlin
-
-Any use of this software is permitted provided that this notice is not
-removed and that neither the authors nor the Technische Universitaet Berlin
-are deemed to have made any representations as to the suitability of this
-software for any purpose nor are held responsible for any defects of
-this software. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
-
-As a matter of courtesy, the authors request to be informed about uses
-this software has found, about bugs in this software, and about any
-improvements that may be of general interest.
-
-Berlin, 28.11.1994
-Jutta Degener
-Carsten Bormann
-
-And the copyright on the ADPCM source:
-
-Copyright 1992 by Stichting Mathematisch Centrum, Amsterdam, The
-Netherlands.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the names of Stichting Mathematisch
-Centrum or CWI not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior permission.
-
-STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
-THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
-FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
-OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/1.2-netsec/HARDWARE b/1.2-netsec/HARDWARE
deleted file mode 100644
index 86b28bef7..000000000
--- a/1.2-netsec/HARDWARE
+++ /dev/null
@@ -1,70 +0,0 @@
-A PBX is only really useful if you can get calls into it. Of course, you
-can use Asterisk with VoIP calls (SIP, H.323, IAX), but you can also talk
-to the real PSTN through various cards.
-
-Supported Hardware is divided into two general groups: Zaptel devices and
-non-zaptel devices. The Zaptel compatible hardware supports pseudo-TDM
-conferencing and all call features through chan_zap, whereas non-zaptel
-compatible hardware may have different features.
-
-Zaptel compatible hardware
-==========================
-
--- Digium (Primary author of Asterisk)
- http://www.digium.com, http://store.yahoo.com/asteriskpbx
-
- * Wildcard X100P - Single FXO interface connects to Loopstart phone
- line
-
- * Wildcard T400P (obsolete) - Quad T1 interface connects to four T1/PRI
- interfaces. Supports RBS and PRI voice and PPP, FR, and HDLC data.
-
- * Wildcard E400P (obsolete)- Quad E1 interface connects to four E1/PRI
- (or PRA) interfaces. Supports PRA/PRI, EuroISDN voice and data.
-
- * Wildcard T100P - Single T1 interface connects to a single T1/PRI
- interface. Supports RBS and PRI voice and PPP, FR, and HDLC data.
-
- * Wildcard E100P - Single E1 interface connects to a single E1/PRI (or PRA)
- interface. Supports PRA/PRI, EuroISDN voice and PPP, FR, HDLC data.
-
- * Wildcard S100U - Single FXS interface connects to a standard analog
- telephone.
-
- * Wildcard TDM400P - Quad Modular FXS interface connects to standard
- analog telephones.
-
- * Wildcard TE410P - Quad T1/E1 switchable interface. Supports PRI and
- RBS signalling, as well as PPP, FR, and HDLC data modes.
-
-Non-zaptel compatible hardware
-==============================
-
--- QuickNet, Inc.
- http://www.quicknet.net
-
- * Internet PhoneJack - Single FXS interface. Supports Linux telephony
- interface. DSP compression built-in.
-
- * Internet LineJack - Single FXS or FXO interface. Supports Linux
- telephony interface.
-
-
-Miscellaneous other interfaces
-==============================
-
--- ISDN4Linux
- http://www.isdn4linux.de/
-
- * Any ISDN terminal adapter supported by isdn4linux should provide
- connectivity.
-
--- ALSA
- http://www.alsa-project.org
-
- * Any ALSA compatible full-duplex sound card
-
--- OSS
- http://www.opensound.com
-
- * Any OSS compatible full-duplex sound card
diff --git a/1.2-netsec/LICENSE b/1.2-netsec/LICENSE
deleted file mode 100644
index a30b79413..000000000
--- a/1.2-netsec/LICENSE
+++ /dev/null
@@ -1,56 +0,0 @@
-Asterisk is distributed under the GNU General Public License version 2
-and is also available under alternative licenses negotiated directly
-with Digium, Inc. If you obtained Asterisk under the GPL, then the GPL
-applies to all loadable Asterisk modules used on your system as well,
-except as defined below. The GPL (version 2) is included in this
-source tree in the file COPYING.
-
-Digium, Inc. (formerly Linux Support Services) holds copyright
-and/or sufficient licenses to all components of the Asterisk
-package, and therefore can grant, at its sole discretion, the ability
-for companies, individuals, or organizations to create proprietary or
-Open Source (even if not GPL) modules which may be dynamically linked at
-runtime with the portions of Asterisk which fall under our
-copyright/license umbrella, or are distributed under more flexible
-licenses than GPL.
-
-If you wish to use our code in other GPL programs, don't worry --
-there is no requirement that you provide the same exception in your
-GPL'd products (although if you've written a module for Asterisk we
-would strongly encourage you to make the same exception that we do).
-
-Specific permission is also granted to link Asterisk with OpenSSL and
-OpenH323.
-
-In addition, Asterisk implements two management/control protocols: the
-Asterisk Manager Interface (AMI) and the Asterisk Gateway Interface
-(AGI). It is our belief that applications using these protocols to
-manage or control an Asterisk instance do not have to be licensed
-under the GPL or a compatible license, as we believe these protocols
-do not create a 'derivative work' as referred to in the GPL. However,
-should any court or other judiciary body find that these protocols do
-fall under the terms of the GPL, then we hereby grant you a license to
-use these protocols in combination with Asterisk in external
-applications licensed under any license you wish.
-
-The 'Asterisk' name and logos are trademarks owned by Digium, Inc.,
-and use of them is subject to our trademark licensing policies. If you
-wish to use these trademarks for purposes other than simple
-redistribution of Asterisk source code obtained from Digium, you
-should contact our licensing department to determine the necessary
-steps you must take.
-
-If you have any questions regarding our licensing policy, please
-contact us:
-
-+1.877.546.8963 (via telephone in the USA)
-+1.256.428.6000 (via telephone outside the USA)
-+1.256.864.0464 (via FAX inside or outside the USA)
-IAX2/misery.digium.com/6000 (via IAX2)
-licensing@digium.com (via email)
-
-Digium, Inc.
-150 West Park Loop
-Suite 100
-Huntsville, AL 35806
-USA
diff --git a/1.2-netsec/Makefile b/1.2-netsec/Makefile
deleted file mode 100644
index a238a971a..000000000
--- a/1.2-netsec/Makefile
+++ /dev/null
@@ -1,908 +0,0 @@
-#
-# Asterisk -- A telephony toolkit for Linux.
-#
-# Top level Makefile
-#
-# Copyright (C) 1999-2005, Mark Spencer
-#
-# Mark Spencer <markster@digium.com>
-#
-# This program is free software, distributed under the terms of
-# the GNU General Public License
-#
-
-.EXPORT_ALL_VARIABLES:
-
-# Create OPTIONS variable
-OPTIONS=
-# If cross compiling, define these to suit
-# CROSS_COMPILE=/opt/montavista/pro/devkit/arm/xscale_be/bin/xscale_be-
-# CROSS_COMPILE_BIN=/opt/montavista/pro/devkit/arm/xscale_be/bin/
-# CROSS_COMPILE_TARGET=/opt/montavista/pro/devkit/arm/xscale_be/target
-CC=$(CROSS_COMPILE)gcc
-HOST_CC=gcc
-# CROSS_ARCH=Linux
-# CROSS_PROC=arm
-# SUB_PROC=xscale # or maverick
-
-ifeq ($(CROSS_COMPILE),)
- OSARCH=$(shell uname -s)
- OSREV=$(shell uname -r)
-else
- OSARCH=$(CROSS_ARCH)
- OSREV=$(CROSS_REV)
-endif
-
-# Remember the MAKELEVEL at the top
-MAKETOPLEVEL?=$(MAKELEVEL)
-
-PWD=$(shell pwd)
-
-ifneq ($(findstring dont-optimize,$(MAKECMDGOALS)),dont-optimize)
-######### More GSM codec optimization
-######### Uncomment to enable MMXTM optimizations for x86 architecture CPU's
-######### which support MMX instructions. This should be newer pentiums,
-######### ppro's, etc, as well as the AMD K6 and K7.
-#K6OPT = -DK6OPT
-
-#Tell gcc to optimize the code
-OPTIMIZE+=-O6
-endif
-
-#Overwite config files on "make samples"
-OVERWRITE=y
-
-#Include debug and macro symbols in the executables (-g) and profiling info (-pg)
-DEBUG=-g3 #-pg
-
-#Set NOCRYPTO to yes if you do not want to have crypto support or
-#dependencies
-#NOCRYPTO=yes
-
-# If you are running a radio application, define RADIO_RELAX so that the DTMF
-# will be received more reliably
-#OPTIONS += -DRADIO_RELAX
-
-# If you don't have a lot of memory (e.g. embedded Asterisk), define LOW_MEMORY
-# to reduce the size of certain static buffers
-
-#ifneq ($(CROSS_COMPILE),)
-#OPTIONS += -DLOW_MEMORY
-#endif
-
-# Optional debugging parameters
-DEBUG_THREADS = #-DDUMP_SCHEDULER #-DDEBUG_SCHEDULER #-DDEBUG_THREADS #-DDO_CRASH #-DDETECT_DEADLOCKS
-
-# Uncomment next one to enable ast_frame tracing (for debugging)
-TRACE_FRAMES = #-DTRACE_FRAMES
-
-# Uncomment next one to enable malloc debugging
-# You can view malloc debugging with:
-# *CLI> show memory allocations [filename]
-# *CLI> show memory summary [filename]
-#
-MALLOC_DEBUG = #-include $(PWD)/include/asterisk/astmm.h
-
-# Where to install asterisk after compiling
-# Default -> leave empty
-INSTALL_PREFIX?=
-
-# Staging directory
-# Files are copied here temporarily during the install process
-# For example, make DESTDIR=/tmp/asterisk woud put things in
-# /tmp/asterisk/etc/asterisk
-# XXX watch out, put no spaces or comments after the value
-DESTDIR?=
-#DESTDIR?=/tmp/asterisk
-
-# Original busydetect routine
-BUSYDETECT = #-DBUSYDETECT
-
-# Improved busydetect routine, comment the previous one if you use this one
-BUSYDETECT+= #-DBUSYDETECT_MARTIN
-# Detect the busy signal looking only at tone lengths
-# For example if you have 3 beeps 100ms tone, 100ms silence separated by 500 ms of silence
-BUSYDETECT+= #-DBUSYDETECT_TONEONLY
-# Inforce the detection of busy singal (get rid of false hangups)
-# Don't use together with -DBUSYDETECT_TONEONLY
-BUSYDETECT+= #-DBUSYDETECT_COMPARE_TONE_AND_SILENCE
-
-# Comment this if you want to disable MIDCOM
-MIDCOM = -DMIDCOM
-
-ifneq ($(OSARCH),SunOS)
- ASTLIBDIR=$(INSTALL_PREFIX)/usr/lib/asterisk
- ASTVARLIBDIR=$(INSTALL_PREFIX)/var/lib/asterisk
- ASTETCDIR=$(INSTALL_PREFIX)/etc/asterisk
- ASTSPOOLDIR=$(INSTALL_PREFIX)/var/spool/asterisk
- ASTLOGDIR=$(INSTALL_PREFIX)/var/log/asterisk
- ASTHEADERDIR=$(INSTALL_PREFIX)/usr/include/asterisk
- ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
- ASTBINDIR=$(INSTALL_PREFIX)/usr/bin
- ASTSBINDIR=$(INSTALL_PREFIX)/usr/sbin
- ASTVARRUNDIR=$(INSTALL_PREFIX)/var/run
- ASTMANDIR=$(INSTALL_PREFIX)/usr/share/man
- MODULES_DIR=$(ASTLIBDIR)/modules
- AGI_DIR=$(ASTVARLIBDIR)/agi-bin
-else
- ASTLIBDIR=$(INSTALL_PREFIX)/opt/asterisk/lib
- ASTVARLIBDIR=$(INSTALL_PREFIX)/var/opt/asterisk/lib
- ASTETCDIR=$(INSTALL_PREFIX)/etc/opt/asterisk
- ASTSPOOLDIR=$(INSTALL_PREFIX)/var/opt/asterisk/spool
- ASTLOGDIR=$(INSTALL_PREFIX)/var/opt/asterisk/log
- ASTHEADERDIR=$(INSTALL_PREFIX)/opt/asterisk/usr/include/asterisk
- ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
- ASTBINDIR=$(INSTALL_PREFIX)/opt/asterisk/usr/bin
- ASTSBINDIR=$(INSTALL_PREFIX)/opt/asterisk/usr/sbin
- ASTVARRUNDIR=$(INSTALL_PREFIX)/var/opt/asterisk/run
- ASTMANDIR=$(INSTALL_PREFIX)/opt/asterisk/usr/share/man
- MODULES_DIR=$(ASTLIBDIR)/modules
- AGI_DIR=$(ASTVARLIBDIR)/agi-bin
-endif
-
-ASTCFLAGS=
-
-# Pentium Pro Optimize
-#PROC=i686
-
-# Pentium & VIA processors optimize
-#PROC=i586
-
-#PROC=k6
-#PROC=ppc
-
-#Uncomment this to use the older DSP routines
-#ASTCFLAGS+=-DOLD_DSP_ROUTINES
-
-# Determine by a grep 'DocumentRoot' of your httpd.conf file
-HTTP_DOCSDIR=/var/www/html
-# Determine by a grep 'ScriptAlias' of your httpd.conf file
-HTTP_CGIDIR=/var/www/cgi-bin
-
-# If the file .asterisk.makeopts is present in your home directory, you can
-# include all of your favorite Makefile options so that every time you download
-# a new version of Asterisk, you don't have to edit the makefile to set them.
-# The file, /etc/asterisk.makeopts will also be included, but can be overridden
-# by the file in your home directory.
-
-ifneq ($(wildcard /etc/asterisk.makeopts),)
- include /etc/asterisk.makeopts
-endif
-
-ifneq ($(wildcard ~/.asterisk.makeopts),)
- include ~/.asterisk.makeopts
-endif
-
-ifeq ($(OSARCH),Linux)
- ifeq ($(CROSS_COMPILE),)
- PROC?=$(shell uname -m)
- else
- PROC=$(CROSS_PROC)
- endif
-
- ifeq ($(PROC),x86_64)
- # You must have GCC 3.4 to use k8, otherwise use athlon
- PROC=k8
- #PROC=athlon
- OPTIONS+=-m64
- endif
-
- ifeq ($(PROC),sparc64)
- #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
- #This works for even old (2.96) versions of gcc and provides a small boost either way.
- #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
- #So we go lowest common available by gcc and go a step down, still a step up from
- #the default as we now have a better instruction set to work with. - Belgarath
- PROC=ultrasparc
- OPTIONS+=$(shell if $(CC) -mtune=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mtune=$(PROC)"; fi)
- OPTIONS+=$(shell if $(CC) -mcpu=v8 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mcpu=v8"; fi)
- OPTIONS+=-fomit-frame-pointer
- endif
-
- ifeq ($(PROC),arm)
- # The Cirrus logic is the only heavily shipping arm processor with a real floating point unit
- ifeq ($(SUB_PROC),maverick)
- OPTIONS+=-fsigned-char -mcpu=ep9312
- else
- ifeq ($(SUB_PROC),xscale)
- OPTIONS+=-fsigned-char -msoft-float -mcpu=xscale
- else
- OPTIONS+=-fsigned-char -msoft-float
- endif
- endif
- endif
- MPG123TARG=linux
-endif
-
-GREP=grep
-ID=id
-
-ifeq ($(OSARCH),SunOS)
- GREP=/usr/xpg4/bin/grep
- M4=/usr/local/bin/m4
- ID=/usr/xpg4/bin/id
-endif
-
-INCLUDE+=-Iinclude -I../include
-ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG) $(INCLUDE) -D_REENTRANT -D_GNU_SOURCE #-DMAKE_VALGRIND_HAPPY
-ASTCFLAGS+=$(OPTIMIZE)
-ASTOBJ=-o asterisk
-
-ifeq ($(findstring BSD,$(OSARCH)),BSD)
- PROC=$(shell uname -m)
- ASTCFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include -L$(CROSS_COMPILE_TARGET)/usr/local/lib
-endif
-
-ifneq ($(PROC),ultrasparc)
- ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
-endif
-
-ifeq ($(PROC),ppc)
- ASTCFLAGS+=-fsigned-char
-endif
-
-ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/osp/osp.h),)
- ASTCFLAGS+=-DOSP_SUPPORT -I$(CROSS_COMPILE_TARGET)/usr/local/include/osp
-else
- ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/osp/osp.h),)
- ASTCFLAGS+=-DOSP_SUPPORT -I$(CROSS_COMPILE_TARGET)/usr/include/osp
- endif
-endif
-
-ifeq ($(OSARCH),FreeBSD)
- BSDVERSION=$(shell make -V OSVERSION -f $(CROSS_COMPILE_TARGET)/usr/share/mk/bsd.port.subdir.mk)
- ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
- LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
- ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/spandsp),)
- ASTCFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include/spandsp
- endif
- MPG123TARG=freebsd
-
- # XXX FreeBSD paths
- PREFIX?=/usr/local
- ASTLIBDIR=$(INSTALL_PREFIX)$(PREFIX)/lib/asterisk
- ASTVARLIBDIR=$(INSTALL_PREFIX)$(PREFIX)/share/asterisk
- ASTETCDIR=$(INSTALL_PREFIX)$(PREFIX)/etc/asterisk
- ASTSPOOLDIR=$(INSTALL_PREFIX)/var/spool/asterisk
- ASTLOGDIR=$(INSTALL_PREFIX)/var/log/asterisk
- ASTHEADERDIR=$(INSTALL_PREFIX)$(PREFIX)/include/asterisk
- ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
- ASTBINDIR=$(INSTALL_PREFIX)$(PREFIX)/bin
- ASTSBINDIR=$(INSTALL_PREFIX)$(PREFIX)/sbin
- ASTVARRUNDIR=$(INSTALL_PREFIX)/var/run
- ASTMANDIR=$(INSTALL_PREFIX)$(PREFIX)/man
- # XXX end FreeBSD paths
-
-endif # FreeBSD
-
-ifeq ($(OSARCH),NetBSD)
- ASTCFLAGS+=-pthread
- INCLUDE+=-I$(CROSS_COMPILE_TARGET)/usr/pkg/include
- MPG123TARG=netbsd
-endif
-
-ifeq ($(OSARCH),OpenBSD)
- ASTCFLAGS+=-pthread
-endif
-
-ifeq ($(OSARCH),SunOS)
- ASTCFLAGS+=-Wcast-align -DSOLARIS
- INCLUDE+=-Iinclude/solaris-compat -I$(CROSS_COMPILE_TARGET)/usr/local/ssl/include
-endif
-
-ifeq ($(findstring CYGWIN,$(OSARCH)),CYGWIN)
- CYGLOADER=cygwin_a
- OSARCH=CYGWIN
- ASTOBJ=-shared -o asterisk.dll -Wl,--out-implib=libasterisk.dll.a -Wl,--export-all-symbols
- ASTLINK=
- LIBS+=-lpthread -lncurses -lm -lresolv
- ASTSBINDIR=$(MODULES_DIR)
- PROC=$(shell uname -m)
-endif
-
-ifndef WITHOUT_ZAPTEL
-
-ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/linux/zaptel.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/zaptel.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/pkg/include/zaptel.h),)
- ASTCFLAGS+=-DZAPTEL_OPTIMIZATIONS
-endif
-
-endif # WITHOUT_ZAPTEL
-
-LIBEDIT=editline/libedit.a
-
-ifneq ($(wildcard .version),)
- ASTERISKVERSION:=$(shell cat .version)
- ASTERISKVERSIONNUM:=$(shell awk -F. '{printf "%02d%02d%02d", $$1, $$2, $$3}' .version)
- RPMVERSION:=$(shell sed 's/[-\/:]/_/g' .version)
-else
- RPMVERSION=unknown
-endif
-
-# CVS mirrors of SVN have .svnrevision files showing
-# which SVN revision they are based on, and .svnbranch
-# showing the branch they are made from
-ifneq ($(wildcard .svnrevision),)
- ASTERISKVERSIONNUM=999999
- ASTERISKVERSION:=SVN-$(shell cat .svnbranch)-r$(shell cat .svnrevision)
-else
- ifneq ($(wildcard .svn),)
- ASTERISKVERSIONNUM=999999
- ASTERISKVERSION=SVN-$(shell build_tools/make_svn_branch_name)
- endif
-endif
-
-ASTCFLAGS+= $(DEBUG_THREADS)
-ASTCFLAGS+= $(TRACE_FRAMES)
-ASTCFLAGS+= $(MALLOC_DEBUG)
-ASTCFLAGS+= $(BUSYDETECT)
-ASTCFLAGS+= $(MIDCOM)
-ASTCFLAGS+= $(OPTIONS)
-ifneq ($(findstring dont-optimize,$(MAKECMDGOALS)),dont-optimize)
-ASTCFLAGS+= -fomit-frame-pointer
-endif
-SUBDIRS=res channels pbx apps codecs formats agi cdr funcs utils stdtime
-
-OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
- translate.o file.o say.o pbx.o cli.o md5.o term.o \
- ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
- cdr.o tdd.o acl.o rtp.o manager.o asterisk.o \
- dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
- astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
- utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \
- netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
- cryptostub.o
-
-ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/sys/poll.h),)
- OBJS+= poll.o
- ASTCFLAGS+=-DPOLLCOMPAT
-endif
-
-ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/dlfcn.h),)
- OBJS+= dlfcn.o
- ASTCFLAGS+=-DDLFCNCOMPAT
-endif
-
-ifeq ($(OSARCH),Linux)
- LIBS+=-ldl -lpthread -lncurses -lm -lresolv #-lnjamd
-else
- LIBS+=-lncurses -lm
-endif
-
-ifeq ($(OSARCH),Darwin)
- LIBS+=-lresolv
- ASTCFLAGS+=-D__Darwin__
- AUDIO_LIBS=-framework CoreAudio
- ASTLINK=-Wl,-dynamic
- SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
- OBJS+= poll.o
- ASTCFLAGS+=-DPOLLCOMPAT
-else
-#These are used for all but Darwin
- ASTLINK=-Wl,-E
- SOLINK=-shared -Xlinker -x
-endif
-
-ifeq ($(OSARCH),FreeBSD)
- LIBS+=-lcrypto
-endif
-
-ifeq ($(OSARCH),NetBSD)
- LIBS+=-lpthread -lcrypto -lm -L$(CROSS_COMPILE_TARGET)/usr/pkg/lib -lncurses
-endif
-
-ifeq ($(OSARCH),OpenBSD)
- LIBS+=-lcrypto -lpthread -lm -lncurses
-endif
-
-ifeq ($(OSARCH),SunOS)
- LIBS+=-lpthread -ldl -lnsl -lsocket -lresolv -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
- OBJS+=strcompat.o
- ASTLINK=
- SOLINK=-shared -fpic -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
-endif
-
-ifeq ($(MAKETOPLEVEL),$(MAKELEVEL))
- CFLAGS+=$(ASTCFLAGS)
-endif
-
-# This is used when generating the doxygen documentation
-ifneq ($(wildcard /usr/local/bin/dot)$(wildcard /usr/bin/dot),)
- HAVEDOT=yes
-else
- HAVEDOT=no
-endif
-
-LIBS+=-lssl
-
-INSTALL=install
-
-_all: all
- @echo " +--------- Asterisk Build Complete ---------+"
- @echo " + Asterisk has successfully been built, but +"
- @echo " + cannot be run before being installed by +"
- @echo " + running: +"
- @echo " + +"
- @echo " + $(MAKE) install +"
- @echo " +-------------------------------------------+"
-
-all: cleantest depend asterisk subdirs
-
-#ifneq ($(wildcard tags),)
-ctags: tags
-#endif
-
-ifneq ($(wildcard TAGS),)
-all: TAGS
-endif
-
-noclean: depend asterisk subdirs
-
-editline/config.h:
- cd editline && unset CFLAGS LIBS && ./configure ; \
-
-editline/libedit.a: FORCE
- cd editline && unset CFLAGS LIBS && test -f config.h || ./configure
- $(MAKE) -C editline libedit.a
-
-db1-ast/libdb1.a: FORCE
- @if [ -d db1-ast ]; then \
- $(MAKE) -C db1-ast libdb1.a ; \
- else \
- echo "You need to do a cvs update -d not just cvs update"; \
- exit 1; \
- fi
-
-ifneq ($(wildcard .depend),)
- include .depend
-endif
-
-ifneq ($(wildcard .tags-depend),)
- include .tags-depend
-endif
-
-ast_expr2.c:
- bison -d --name-prefix=ast_yy ast_expr2.y -o ast_expr2.c
-
-ast_expr2f.c:
- flex --full ast_expr2.fl
-
-testexpr2: ast_expr2f.c ast_expr2.c ast_expr2.h
- gcc -g -c -DSTANDALONE ast_expr2f.c
- gcc -g -c -DSTANDALONE ast_expr2.c
- gcc -g -o testexpr2 ast_expr2f.o ast_expr2.o
- rm ast_expr2.o ast_expr2f.o
-
-manpage: asterisk.8
-
-asterisk.8: asterisk.sgml
- rm -f asterisk.8
- docbook2man asterisk.sgml
- mv ./*.8 asterisk.8
-
-asterisk.pdf: asterisk.sgml
- docbook2pdf asterisk.sgml
-
-asterisk.ps: asterisk.sgml
- docbook2ps asterisk.sgml
-
-asterisk.html: asterisk.sgml
- docbook2html asterisk.sgml
- mv r1.html asterisk.html
-
-asterisk.txt: asterisk.sgml
- docbook2txt asterisk.sgml
-
-defaults.h: FORCE
- build_tools/make_defaults_h > $@.tmp
- if cmp -s $@.tmp $@ ; then echo ; else \
- mv $@.tmp $@ ; \
- fi
- rm -f $@.tmp
-
-include/asterisk/version.h: FORCE
- build_tools/make_version_h > $@.tmp
- if cmp -s $@.tmp $@ ; then echo; else \
- mv $@.tmp $@ ; \
- fi
- rm -f $@.tmp
-
-stdtime/libtime.a: FORCE
- @if [ -d stdtime ]; then \
- $(MAKE) -C stdtime libtime.a ; \
- else \
- echo "You need to do a cvs update -d not just cvs update"; \
- exit 1; \
- fi
-
-cygwin_a:
- $(MAKE) -C cygwin all
-
-asterisk: $(CYGLOADER) editline/libedit.a db1-ast/libdb1.a stdtime/libtime.a $(OBJS)
- build_tools/make_build_h > include/asterisk/build.h.tmp
- if cmp -s include/asterisk/build.h.tmp include/asterisk/build.h ; then echo ; else \
- mv include/asterisk/build.h.tmp include/asterisk/build.h ; \
- fi
- rm -f include/asterisk/build.h.tmp
- $(CC) -c -o buildinfo.o $(CFLAGS) buildinfo.c
- $(CC) $(DEBUG) $(ASTOBJ) $(ASTLINK) $(OBJS) buildinfo.o $(LIBEDIT) db1-ast/libdb1.a stdtime/libtime.a $(LIBS)
-
-muted: muted.o
- $(CC) $(AUDIO_LIBS) -o muted muted.o
-
-subdirs:
- for x in $(SUBDIRS); do $(MAKE) -C $$x || exit 1 ; done
-
-clean:
- for x in $(SUBDIRS); do $(MAKE) -C $$x clean || exit 1 ; done
- rm -f *.o *.so asterisk .depend
- rm -f defaults.h
- rm -f include/asterisk/build.h
- rm -f include/asterisk/version.h
- rm -f .tags-depend .tags-sources tags TAGS
- @if [ -f editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
- @if [ -d mpg123-0.59r ]; then $(MAKE) -C mpg123-0.59r clean; fi
- $(MAKE) -C db1-ast clean
- $(MAKE) -C stdtime clean
-
-datafiles: all
- if [ x`$(ID) -un` = xroot ]; then sh mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
- mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits
- mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/priv-callerintros
- for x in sounds/digits/*.gsm; do \
- if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
- $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits ; \
- else \
- echo "No description for $$x"; \
- exit 1; \
- fi; \
- done
- mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/dictate
- for x in sounds/dictate/*.gsm; do \
- if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
- $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/dictate ; \
- else \
- echo "No description for $$x"; \
- exit 1; \
- fi; \
- done
- mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/letters
- for x in sounds/letters/*.gsm; do \
- if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
- $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/letters ; \
- else \
- echo "No description for $$x"; \
- exit 1; \
- fi; \
- done
- mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/phonetic
- for x in sounds/phonetic/*.gsm; do \
- if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
- $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/phonetic ; \
- else \
- echo "No description for $$x"; \
- exit 1; \
- fi; \
- done
- for x in sounds/demo-* sounds/vm-* sounds/transfer* sounds/pbx-* sounds/ss-* sounds/beep* sounds/dir-* sounds/conf-* sounds/agent-* sounds/invalid* sounds/tt-* sounds/auth-* sounds/privacy-* sounds/queue-* sounds/spy-* sounds/priv-* sounds/screen-* sounds/hello-*; do \
- if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
- $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \
- else \
- echo "No description for $$x"; \
- exit 1; \
- fi; \
- done
- mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/mohmp3
- mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/images
- for x in images/*.jpg; do \
- $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/images ; \
- done
- mkdir -p $(DESTDIR)$(AGI_DIR)
-
-update:
- @if [ -d .svn ]; then \
- echo "Updating from Subversion..." ; \
- svn update | tee update.out; \
- rm -f .version; \
- if [ `grep -c ^C update.out` -gt 0 ]; then \
- echo ; echo "The following files have conflicts:" ; \
- grep ^C update.out | cut -b4- ; \
- fi ; \
- rm -f update.out; \
- elif [ -d CVS ]; then \
- echo "Updating from CVS..." ; \
- cvs -q -z3 update -Pd | tee update.out; \
- rm -f .version; \
- if [ `grep -c ^C update.out` -gt 0 ]; then \
- echo ; echo "The following files have conflicts:" ; \
- grep ^C update.out | cut -d' ' -f2- ; \
- fi ; \
- rm -f update.out; \
- else \
- echo "Not under version control"; \
- fi
-
-NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
-OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
-
-bininstall: all
- mkdir -p $(DESTDIR)$(MODULES_DIR)
- mkdir -p $(DESTDIR)$(ASTSBINDIR)
- mkdir -p $(DESTDIR)$(ASTETCDIR)
- mkdir -p $(DESTDIR)$(ASTBINDIR)
- mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
- mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
- mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/dictate
- mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
- mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
- mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
- mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
- if [ -f asterisk ]; then $(INSTALL) -m 755 asterisk $(DESTDIR)$(ASTSBINDIR)/; fi
- if [ -f cygwin/asterisk.exe ]; then $(INSTALL) -m 755 cygwin/asterisk.exe $(DESTDIR)$(ASTSBINDIR)/; fi
- if [ -f asterisk.dll ]; then $(INSTALL) -m 755 asterisk.dll $(DESTDIR)$(ASTSBINDIR)/; fi
- ln -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
- $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
- $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
- if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
- cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
- chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
- fi
- for x in $(SUBDIRS); do $(MAKE) -C $$x install || exit 1 ; done
- $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
- $(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
- if [ -n "$(OLDHEADERS)" ]; then \
- rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
- fi
- rm -f $(DESTDIR)$(ASTVARLIBDIR)/sounds/voicemail
- mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds
- mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
- mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
- mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/keys
- mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/firmware
- mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/firmware/iax
- mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
- $(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTVARLIBDIR)/keys
- $(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTVARLIBDIR)/keys
- $(INSTALL) -m 644 asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
- $(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
- $(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
- $(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
- if [ -d contrib/firmware/iax ]; then \
- $(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTVARLIBDIR)/firmware/iax/iaxy.bin; \
- else \
- echo "You need to do cvs update -d not just cvs update" ; \
- fi
- ( cd $(DESTDIR)$(ASTVARLIBDIR)/sounds ; ln -s $(ASTSPOOLDIR)/voicemail . )
- if [ -f mpg123-0.59r/mpg123 ]; then $(MAKE) -C mpg123-0.59r install; fi
- @echo " +---- Asterisk Installation Complete -------+"
- @echo " + +"
- @echo " + YOU MUST READ THE SECURITY DOCUMENT +"
- @echo " + +"
- @echo " + Asterisk has successfully been installed. +"
- @echo " + If you would like to install the sample +"
- @echo " + configuration files (overwriting any +"
- @echo " + existing config files), run: +"
- @echo " + +"
- @echo " + $(MAKE) samples +"
- @echo " + +"
- @echo " +----------------- or ---------------------+"
- @echo " + +"
- @echo " + You can go ahead and install the asterisk +"
- @echo " + program documentation now or later run: +"
- @echo " + +"
- @echo " + $(MAKE) progdocs +"
- @echo " + +"
- @echo " + **Note** This requires that you have +"
- @echo " + doxygen installed on your local system +"
- @echo " +-------------------------------------------+"
- @$(MAKE) -s oldmodcheck
-
-NEWMODS=$(notdir $(wildcard */*.so))
-OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
-
-oldmodcheck:
- @if [ -n "$(OLDMODS)" ]; then \
- echo " WARNING WARNING WARNING" ;\
- echo "" ;\
- echo " Your Asterisk modules directory, located at" ;\
- echo " $(DESTDIR)$(MODULES_DIR)" ;\
- echo " contains modules that were not installed by this " ;\
- echo " version of Asterisk. Please ensure that these" ;\
- echo " modules are compatible with this version before" ;\
- echo " attempting to run Asterisk." ;\
- echo "" ;\
- for f in $(OLDMODS); do \
- echo " $$f" ;\
- done ;\
- echo "" ;\
- echo " WARNING WARNING WARNING" ;\
- fi
-
-install: all datafiles bininstall
- @if [ -x /usr/sbin/asterisk-post-install ]; then \
- /usr/sbin/asterisk-post-install $(DESTDIR) . ; \
- fi
-
-upgrade: all bininstall
-
-adsi:
- mkdir -p $(DESTDIR)$(ASTETCDIR)
- for x in configs/*.adsi; do \
- if [ ! -f $(DESTDIR)$(ASTETCDIRX)/$$x ]; then \
- $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x` ; \
- fi ; \
- done
-
-samples: adsi
- mkdir -p $(DESTDIR)$(ASTETCDIR)
- for x in configs/*.sample; do \
- if [ -f $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ]; then \
- if [ "$(OVERWRITE)" = "y" ]; then \
- if cmp -s $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` $$x ; then \
- echo "Config file $$x is unchanged"; \
- continue; \
- fi ; \
- mv -f $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample`.old ; \
- else \
- echo "Skipping config file $$x"; \
- continue; \
- fi ;\
- fi ; \
- $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ;\
- done
- if [ "$(OVERWRITE)" = "y" ] || [ ! -f $(DESTDIR)$(ASTCONFPATH) ]; then \
- ( \
- echo "[directories]" ; \
- echo "astetcdir => $(ASTETCDIR)" ; \
- echo "astmoddir => $(MODULES_DIR)" ; \
- echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
- echo "astagidir => $(AGI_DIR)" ; \
- echo "astspooldir => $(ASTSPOOLDIR)" ; \
- echo "astrundir => $(ASTVARRUNDIR)" ; \
- echo "astlogdir => $(ASTLOGDIR)" ; \
- echo "" ; \
- echo "; Changing the following lines may compromise your security." ; \
- echo ";[files]" ; \
- echo ";astctlpermissions = 0660" ; \
- echo ";astctlowner = root" ; \
- echo ";astctlgroup = apache" ; \
- echo ";astctl = asterisk.ctl" ; \
- ) > $(DESTDIR)$(ASTCONFPATH) ; \
- else \
- echo "Skipping asterisk.conf creation"; \
- fi
- mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \
- for x in sounds/demo-*; do \
- if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
- $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \
- else \
- echo "No description for $$x"; \
- exit 1; \
- fi; \
- done
- mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/mohmp3 ; \
- for x in sounds/*.mp3; do \
- $(INSTALL) -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/mohmp3 ; \
- done
- rm -f $(DESTDIR)$(ASTVARLIBDIR)/mohmp3/sample-hold.mp3
- mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
- :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm
- for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
- cat $(DESTDIR)$(ASTVARLIBDIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
- done
- :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm
- for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
- cat $(DESTDIR)$(ASTVARLIBDIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm ; \
- done
-
-webvmail:
- @[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
- @[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
- $(INSTALL) -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
- mkdir -p $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
- for x in images/*.gif; do \
- $(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
- done
- @echo " +--------- Asterisk Web Voicemail ----------+"
- @echo " + +"
- @echo " + Asterisk Web Voicemail is installed in +"
- @echo " + your cgi-bin directory: +"
- @echo " + $(DESTDIR)$(HTTP_CGIDIR)"
- @echo " + IT USES A SETUID ROOT PERL SCRIPT, SO +"
- @echo " + IF YOU DON'T LIKE THAT, UNINSTALL IT! +"
- @echo " + +"
- @echo " + Other static items have been stored in: +"
- @echo " + $(DESTDIR)$(HTTP_DOCSDIR)"
- @echo " + +"
- @echo " + If these paths do not match your httpd +"
- @echo " + installation, correct the definitions +"
- @echo " + in your Makefile of HTTP_CGIDIR and +"
- @echo " + HTTP_DOCSDIR +"
- @echo " + +"
- @echo " +-------------------------------------------+"
-
-spec:
- sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
-
-rpm: __rpm
-
-__rpm: include/asterisk/version.h spec
- rm -rf /tmp/asterisk ; \
- mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
- $(MAKE) DESTDIR=/tmp/asterisk install ; \
- $(MAKE) DESTDIR=/tmp/asterisk samples ; \
- mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
- cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \
- rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
-
-progdocs:
- (cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
- echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen -
-
-mpg123:
- @wget -V >/dev/null || (echo "You need wget" ; false )
- [ -f mpg123-0.59r.tar.gz ] || wget http://www.mpg123.de/mpg123/mpg123-0.59r.tar.gz
- [ -d mpg123-0.59r ] || tar xfz mpg123-0.59r.tar.gz
- $(MAKE) -C mpg123-0.59r $(MPG123TARG)
-
-config:
- if [ -d /etc/rc.d/init.d ]; then \
- $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
- /sbin/chkconfig --add asterisk; \
- elif [ -d /etc/init.d ]; then \
- $(INSTALL) -m 755 init.asterisk /etc/init.d/asterisk; \
- fi
-
-dont-optimize: install
-
-valgrind: dont-optimize
-
-depend: include/asterisk/version.h .depend defaults.h
- for x in $(SUBDIRS); do $(MAKE) -C $$x depend || exit 1 ; done
-
-.depend: include/asterisk/version.h
- build_tools/mkdep $(CFLAGS) $(wildcard *.c)
-
-.tags-depend:
- @echo -n ".tags-depend: " > $@
- @find . -maxdepth 1 -name \*.c -printf "\t%p \\\\\n" >> $@
- @find . -maxdepth 1 -name \*.h -printf "\t%p \\\\\n" >> $@
- @find $(SUBDIRS) -name \*.c -printf "\t%p \\\\\n" >> $@
- @find $(SUBDIRS) -name \*.h -printf "\t%p \\\\\n" >> $@
- @find include -name \*.h -printf "\t%p \\\\\n" >> $@
- @echo >> $@
-
-.tags-sources:
- @rm -f $@
- @find . -maxdepth 1 -name \*.c -print >> $@
- @find . -maxdepth 1 -name \*.h -print >> $@
- @find $(SUBDIRS) -name \*.c -print >> $@
- @find $(SUBDIRS) -name \*.h -print >> $@
- @find include -name \*.h -print >> $@
-
-tags: .tags-depend .tags-sources
- ctags -L .tags-sources -o $@
-
-ctags: tags
-
-TAGS: .tags-depend .tags-sources
- etags -o $@ `cat .tags-sources`
-
-etags: TAGS
-
-FORCE:
-
-%_env:
- $(MAKE) -C $(shell echo $@ | sed "s/_env//g") env
-
-env:
- env
-
-# If the cleancount has been changed, force a make clean.
-# .cleancount is the global clean count, and .lastclean is the
-# last clean count we had
-# We can avoid this by making noclean
-
-cleantest:
- if cmp -s .cleancount .lastclean ; then echo ; else \
- $(MAKE) clean; cp -f .cleancount .lastclean;\
- fi
diff --git a/1.2-netsec/README b/1.2-netsec/README
deleted file mode 100644
index 687b7ca63..000000000
--- a/1.2-netsec/README
+++ /dev/null
@@ -1,248 +0,0 @@
-The Asterisk Open Source PBX
-by Mark Spencer <markster@digium.com>
-and the Asterisk.org developer community
-
-Copyright (C) 2001-2005 Digium, Inc.
-and other copyright holders.
-================================================================
-
-* SECURITY
- It is imperative that you read and fully understand the contents of
-the SECURITY file before you attempt to configure and run an Asterisk
-server.
-
-* WHAT IS ASTERISK ?
- Asterisk is an Open Source PBX and telephony toolkit. It is, in a
-sense, middleware between Internet and telephony channels on the bottom,
-and Internet and telephony applications at the top. For more information
-on the project itself, please visit the Asterisk home page at:
-
- http://www.asterisk.org
-
-In addition you'll find lots of information compiled by the Asterisk
-community on this Wiki:
-
- http://www.voip-info.org/wiki-Asterisk
-
-There is a book on Asterisk published by O'Reilly under the
-Creative Commons License. It is available in book stores as well
-as in a downloadable version on the http://www.asteriskdocs.org
-web site.
-
-* SUPPORTED OPERATING SYSTEMS
-
-== Linux ==
- The Asterisk Open Source PBX is developed and tested primarily on the
-GNU/Linux operating system, and is supported on every major GNU/Linux
-distribution.
-
-== Others ==
- Asterisk has also been 'ported' and reportedly runs properly on other
-operating systems as well, including Sun Solaris, Apple's Mac OS X, and
-the BSD variants.
-
-* GETTING STARTED
-
- First, be sure you've got supported hardware (but note that you don't need
-ANY special hardware, not even a soundcard) to install and run Asterisk.
-
- Supported telephony hardware includes:
-
- * All Wildcard (tm) products from Digium (www.digium.com)
- * QuickNet Internet PhoneJack and LineJack (http://www.quicknet.net)
- * any full duplex sound card supported by ALSA or OSS
- * VoiceTronix OpenLine products
-
-The are several drivers for ISDN BRI cards available from third party sources.
-Check the voip-info.org wiki for more information on chan_capi, chan_misdn and
-zaphfc.
-
-* UPGRADING FROM VERSION 1.0
-
- If you are updating from a previous version of Asterisk, make sure you
-read the UPGRADE.txt file in the source directory. There are some files
-and configuration options that you will have to change, even though we
-made every effort possible to maintain backwards compatibility.
-
- In order to discover new features to use, please check the configuration
-examples in the /configs directory of the source code distribution.
-To discover the major new features of Asterisk 1.2, please visit
-http://edvina.net/asterisk1-2/
-
-* NEW INSTALLATIONS
-
- Ensure that your system contains a compatible compiler and development
-libraries. Asterisk requires either the GNU Compiler Collection (GCC) version
-3.0 or higher, or a compiler that supports the C99 specification and some of
-the gcc language extensions. In addition, your system needs to have the C
-library headers available, and the headers and libraries for OpenSSL,
-ncurses and zlib.
-On many distributions, these files are installed by packages with names like
-'glibc-devel', 'ncurses-devel', 'openssl-devel' and 'zlib-devel' or similar.
-
- So let's proceed:
-
-1) Run "make"
-
- Assuming the build completes successfully:
-
-2) Run "make install"
-
- Each time you update or checkout from CVS, you are strongly encouraged
-to ensure all previous object files are removed to avoid internal
-inconsistency in Asterisk. Normally, this is automatically done with
-the presence of the file .cleancount, which increments each time a 'make clean'
-is required, and the file .lastclean, which contains the last .cleancount used.
-
- If this is your first time working with Asterisk, you may wish to install
-the sample PBX, with demonstration extensions, etc. If so, run:
-
-3) "make samples"
-
- Doing so will overwrite any existing config files you have.
-
- Finally, you can launch Asterisk in the foreground mode (not a daemon)
-with:
-
-# asterisk -vvvc
-
- You'll see a bunch of verbose messages fly by your screen as Asterisk
-initializes (that's the "very very verbose" mode). When it's ready, if
-you specified the "c" then you'll get a command line console, that looks
-like this:
-
-*CLI>
-
- You can type "help" at any time to get help with the system. For help
-with a specific command, type "help <command>". To start the PBX using
-your sound card, you can type "dial" to dial the PBX. Then you can use
-"answer", "hangup", and "dial" to simulate the actions of a telephone.
-Remember that if you don't have a full duplex sound card (and Asterisk
-will tell you somewhere in its verbose messages if you do/don't) then it
-won't work right (not yet).
-
- "man asterisk" at the Unix/Linux command prompt will give you detailed
-information on how to start and stop Asterisk, as well as all the command
-line options for starting Asterisk.
-
- Feel free to look over the configuration files in /etc/asterisk, where
-you'll find a lot of information about what you can do with Asterisk.
-
-* ABOUT CONFIGURATION FILES
-
- All Asterisk configuration files share a common format. Comments are
-delimited by ';' (since '#' of course, being a DTMF digit, may occur in
-many places). A configuration file is divided into sections whose names
-appear in []'s. Each section typically contains two types of statements,
-those of the form 'variable = value', and those of the form 'object =>
-parameters'. Internally the use of '=' and '=>' is exactly the same, so
-they're used only to help make the configuration file easier to
-understand, and do not affect how it is actually parsed.
-
- Entries of the form 'variable=value' set the value of some parameter in
-asterisk. For example, in zapata.conf, one might specify:
-
- switchtype=national
-
-in order to indicate to Asterisk that the switch they are connecting to is
-of the type "national". In general, the parameter will apply to
-instantiations which occur below its specification. For example, if the
-configuration file read:
-
- switchtype = national
- channel => 1-4
- channel => 10-12
- switchtype = dms100
- channel => 25-47
-
-the "national" switchtype would be applied to channels one through
-four and channels 10 through 12, whereas the "dms100" switchtype would
-apply to channels 25 through 47.
-
- The "object => parameters" instantiates an object with the given
-parameters. For example, the line "channel => 25-47" creates objects for
-the channels 25 through 47 of the card, obtaining the settings
-from the variables specified above.
-
-* NETWORK SECURITY DEVICES
-
-This release of Asterisk contains support for network security devices
-manufactured by Ranch Networks, Inc., using their MIDCOM interface
-library. You will need the companion libmidcom-0.1.0.tar.gz file to
-build the library. Contact Ranch Networks' support department for assistance
-in building and configuring MIDCOM support.
-
-* SPECIAL NOTE ON TIME
-
- Those using SIP phones should be aware that Asterisk is sensitive to
-large jumps in time. Manually changing the system time using date(1)
-(or other similar commands) may cause SIP registrations and other
-internal processes to fail. If your system cannot keep accurate time
-by itself use NTP (http://www.ntp.org/) to keep the system clock
-synchronized to "real time". NTP is designed to keep the system clock
-synchronized by speeding up or slowing down the system clock until it
-is synchronized to "real time" rather than by jumping the time and
-causing discontinuities. Most Linux distributions include precompiled
-versions of NTP. Beware of some time synchronization methods that get
-the correct real time periodically and then manually set the system
-clock.
-
- Apparent time changes due to daylight savings time are just that,
-apparent. The use of daylight savings time in a Linux system is
-purely a user interface issue and does not affect the operation of the
-Linux kernel or Asterisk. The system clock on Linux kernels operates
-on UTC. UTC does not use daylight savings time.
-
- Also note that this issue is separate from the clocking of TDM
-channels, and is known to at least affect SIP registrations.
-
-* FILE DESCRIPTORS
-
- Depending on the size of your system and your configuration,
-Asterisk can consume a large number of file descriptors. In UNIX,
-file descriptors are used for more than just files on disk. File
-descriptors are also used for handling network communication
-(e.g. SIP, IAX2, or H.323 calls) and hardware access (e.g. analog and
-digital trunk hardware). Asterisk accesses many on-disk files for
-everything from configuration information to voicemail storage.
-
- Most systems limit the number of file descriptors that Asterisk can
-have open at one time. This can limit the number of simultaneous
-calls that your system can handle. For example, if the limit is set
-at 1024 (a common default value) Asterisk can handle approxiately 150
-SIP calls simultaneously. To change the number of file descriptors
-follow the instructions for your system below:
-
-== PAM-based Linux System ==
-
- If your system uses PAM (Pluggable Authentication Modules) edit
-/etc/security/limits.conf. Add these lines to the bottom of the file:
-
-root soft nofile 4096
-root hard nofile 8196
-asterisk soft nofile 4096
-asterisk hard nofile 8196
-
-(adjust the numbers to taste). You may need to reboot the system for
-these changes to take effect.
-
-== Generic UNIX System ==
-
- If there are no instructions specifically adapted to your system
-above you can try adding the command "ulimit -n 8192" to the script
-that starts Asterisk.
-
-* MORE INFORMATION
-
- See the doc directory for more documentation on various features. Again,
-please read all the configuration samples that include documentation on
-the configuration options.
-
- Finally, you may wish to visit the web site and join the mailing list if
-you're interested in getting more information.
-
- http://www.asterisk.org/support
-
- Welcome to the growing worldwide community of Asterisk users!
-
-Mark Spencer
diff --git a/1.2-netsec/README.fpm b/1.2-netsec/README.fpm
deleted file mode 100644
index ad11c4815..000000000
--- a/1.2-netsec/README.fpm
+++ /dev/null
@@ -1,8 +0,0 @@
-About Hold Music
-================
-Digium has licensed the music included with
-the Asterisk distribution From FreePlayMusic
-for use and distribution with Asterisk. It
-is licensed ONLY for use as hold music within
-an Asterisk based PBX.
-
diff --git a/1.2-netsec/SECURITY b/1.2-netsec/SECURITY
deleted file mode 100644
index 3290cba48..000000000
--- a/1.2-netsec/SECURITY
+++ /dev/null
@@ -1,67 +0,0 @@
-==== Security Notes with Asterisk ====
-
-PLEASE READ THE FOLLOWING IMPORTANT SECURITY RELATED INFORMATION.
-IMPROPER CONFIGURATION OF ASTERISK COULD ALLOW UNAUTHORIZED USE OF YOUR
-FACILITIES, POTENTIALLY INCURRING SUBSTANTIAL CHARGES.
-
-Asterisk security involves both network security (encryption, authentication)
-as well as dialplan security (authorization - who can access services in
-your pbx). If you are setting up Asterisk in production use, please make
-sure you understand the issues involved.
-
-* NETWORK SECURITY
-
-If you install Asterisk and use the "make samples" command to install
-a demonstration configuration, Asterisk will open a few ports for accepting
-VoIP calls. Check the channel configuration files for the ports and IP addresses.
-
-If you enable the manager interface in manager.conf, please make sure that
-you access manager in a safe environment or protect it with SSH or other
-VPN solutions.
-
-For all TCP/IP connections in Asterisk, you can set ACL lists that
-will permit or deny network access to Asterisk services. Please check
-the "permit" and "deny" configuration options in manager.conf and
-the VoIP channel configurations - i.e. sip.conf and iax.conf.
-
-The IAX2 protocol supports strong RSA key authentication as well as
-AES encryption of voice and signalling. The SIP channel does not
-support encryption in this version of Asterisk.
-
-* DIALPLAN SECURITY
-
-First and foremost remember this:
-
-USE THE EXTENSION CONTEXTS TO ISOLATE OUTGOING OR TOLL SERVICES FROM ANY
-INCOMING CONNECTIONS.
-
-You should consider that if any channel, incoming line, etc can enter an
-extension context that it has the capability of accessing any extension
-within that context.
-
-Therefore, you should NOT allow access to outgoing or toll services in
-contexts that are accessible (especially without a password) from incoming
-channels, be they IAX channels, FX or other trunks, or even untrusted
-stations within you network. In particular, never ever put outgoing toll
-services in the "default" context. To make things easier, you can include
-the "default" context within other private contexts by using:
-
- include => default
-
-in the appropriate section. A well designed PBX might look like this:
-
-[longdistance]
-exten => _91NXXNXXXXXX,1,Dial(Zap/g2/${EXTEN:1})
-include => local
-
-[local]
-exten => _9NXXNXXX,1,Dial(Zap/g2/${EXTEN:1})
-include => default
-
-[default]
-exten => 6123,Dial(Zap/1)
-
-
-DON'T FORGET TO TAKE THE DEMO CONTEXT OUT OF YOUR DEFAULT CONTEXT. There
-isn't really a security reason, it just will keep people from wanting to
-play with your Asterisk setup remotely.
diff --git a/1.2-netsec/UPGRADE.txt b/1.2-netsec/UPGRADE.txt
deleted file mode 100644
index 76e557773..000000000
--- a/1.2-netsec/UPGRADE.txt
+++ /dev/null
@@ -1,205 +0,0 @@
-Information for Upgrading From Previous Asterisk Releases
-=========================================================
-
-Compiling:
-
-* The Asterisk 1.2 source code now uses C language features
- supported only by 'modern' C compilers. Generally, this means GCC
- version 3.0 or higher, although some GCC 2.96 releases will also
- work. Some non-GCC compilers that support C99 and the common GCC
- extensions (including anonymous structures and unions) will also
- work. All releases of GCC 2.95 do _not_ have the requisite feature
- support; systems using that compiler will need to be upgraded to
- a more recent compiler release.
-
-Dialplan Expressions:
-
-* The dialplan expression parser (which handles $[ ... ] constructs)
- has gone through a major upgrade, but has one incompatible change:
- spaces are no longer required around expression operators, including
- string comparisons. However, you can now use quoting to keep strings
- together for comparison. For more details, please read the
- doc/README.variables file, and check over your dialplan for possible
- problems.
-
-Agents:
-
-* The default for ackcall has been changed to "no" instead of "yes"
- because of a bug which caused the "yes" behavior to generally act like
- "no". You may need to adjust the value if your agents behave
- differently than you expect with respect to acknowledgement.
-
-* The AgentCallBackLogin application now requires a second '|' before
- specifying an extension@context. This is to distinguish the options
- string from the extension, so that they do not conflict. See
- 'show application AgentCallbackLogin' for more details.
-
-Parking:
-
-* Parking behavior has changed slightly; when a parked call times out,
- Asterisk will attempt to deliver the call back to the extension that
- parked it, rather than the 's' extension. If that extension is busy
- or unavailable, the parked call will be lost.
-
-Dialing:
-
-* The Caller*ID of the outbound leg is now the extension that was
- called, rather than the Caller*ID of the inbound leg of the call. The
- "o" flag for Dial can be used to restore the original behavior if
- desired. Note that if you are looking for the originating callerid
- from the manager event, there is a new manager event "Dial" which
- provides the source and destination channels and callerid.
-
-IAX:
-
-* The naming convention for IAX channels has changed in two ways:
- 1. The call number follows a "-" rather than a "/" character.
- 2. The name of the channel has been simplified to IAX2/peer-callno,
- rather than IAX2/peer@peer-callno or even IAX2/peer@peer/callno.
-
-SIP:
-
-* The global option "port" in 1.0.X that is used to set which port to
- bind to has been changed to "bindport" to be more consistent with
- the other channel drivers and to avoid confusion with the "port"
- option for users/peers.
-
-* The "Registry" event now uses "Username" rather than "User" for
- consistency with IAX.
-
-Applications:
-
-* With the addition of dialplan functions (which operate similarly
- to variables), the SetVar application has been renamed to Set.
-
-* The CallerPres application has been removed. Use SetCallerPres
- instead. It accepts both numeric and symbolic names.
-
-* The applications GetGroupCount, GetGroupMatchCount, SetGroup, and
- CheckGroup have been deprecated in favor of functions. Here is a
- table of their replacements:
-
- GetGroupCount([groupname][@category] GROUP_COUNT([groupname][@category]) Set(GROUPCOUNT=${GROUP_COUNT()})
- GroupMatchCount(groupmatch[@category]) GROUP_MATCH_COUNT(groupmatch[@category]) Set(GROUPCOUNT=${GROUP_MATCH_COUNT(SIP/.*)})
- SetGroup(groupname[@category]) GROUP([category])=groupname Set(GROUP()=test)
- CheckGroup(max[@category]) N/A GotoIf($[ ${GROUP_COUNT()} > 5 ]?103)
-
- Note that CheckGroup does not have a direct replacement. There is
- also a new function called GROUP_LIST() which will return a space
- separated list of all of the groups set on a channel. The GROUP()
- function can also return the name of the group set on a channel when
- used in a read environment.
-
-* The applications DBGet and DBPut have been deprecated in favor of
- functions. Here is a table of their replacements:
-
- DBGet(foo=family/key) Set(foo=${DB(family/key)})
- DBPut(family/key=${foo}) Set(DB(family/key)=${foo})
-
-* The application SetLanguage has been deprecated in favor of the
- function LANGUAGE().
-
- SetLanguage(fr) Set(LANGUAGE()=fr)
-
- The LANGUAGE function can also return the currently set language:
-
- Set(MYLANG=${LANGUAGE()})
-
-* The applications AbsoluteTimeout, DigitTimeout, and ResponseTimeout
- have been deprecated in favor of the function TIMEOUT(timeouttype):
-
- AbsoluteTimeout(300) Set(TIMEOUT(absolute)=300)
- DigitTimeout(15) Set(TIMEOUT(digit)=15)
- ResponseTimeout(15) Set(TIMEOUT(response)=15)
-
- The TIMEOUT() function can also return the currently set timeouts:
-
- Set(DTIMEOUT=${TIMEOUT(digit)})
-
-* The applications SetCIDName, SetCIDNum, and SetRDNIS have been
- deprecated in favor of the CALLERID(datatype) function:
-
- SetCIDName(Joe Cool) Set(CALLERID(name)=Joe Cool)
- SetCIDNum(2025551212) Set(CALLERID(number)=2025551212)
- SetRDNIS(2024561414) Set(CALLERID(RDNIS)=2024561414)
-
-* The application Record now uses the period to separate the filename
- from the format, rather than the colon.
-
-* The application VoiceMail now supports a 'temporary' greeting for each
- mailbox. This greeting can be recorded by using option 4 in the
- 'mailbox options' menu, and 'change your password' option has been
- moved to option 5.
-
-* The application VoiceMailMain now only matches the 'default' context if
- none is specified in the arguments. (This was the previously
- documented behavior, however, we didn't follow that behavior.) The old
- behavior can be restored by setting searchcontexts=yes in voicemail.conf.
-
-Queues:
-
-* A queue is now considered empty not only if there are no members but if
- none of the members are available (e.g. agents not logged on). To
- restore the original behavior, use "leavewhenempty=strict" or
- "joinwhenempty=strict" instead of "=yes" for those options.
-
-* It is now possible to use multi-digit extensions in the exit context
- for a queue (although you should not have overlapping extensions,
- as there is no digit timeout). This means that the EXITWITHKEY event
- in queue_log can now contain a key field with more than a single
- character in it.
-
-Extensions:
-
-* By default, there is a new option called "autofallthrough" in
- extensions.conf that is set to yes. Asterisk 1.0 (and earlier)
- behavior was to wait for an extension to be dialed after there were no
- more extensions to execute. "autofallthrough" changes this behavior
- so that the call will immediately be terminated with BUSY,
- CONGESTION, or HANGUP based on Asterisk's best guess. If you are
- writing an extension for IVR, you must use the WaitExten application
- if "autofallthrough" is set to yes.
-
-AGI:
-
-* AGI scripts did not always get SIGHUP at the end, previously. That
- behavior has been fixed. If you do not want your script to terminate
- at the end of AGI being called (e.g. on a hangup) then set SIGHUP to
- be ignored within your application.
-
-* CallerID is reported with agi_callerid and agi_calleridname instead
- of a single parameter holding both.
-
-Music On Hold:
-
-* The preferred format for musiconhold.conf has changed; please see the
- sample configuration file for the new format. The existing format
- is still supported but will generate warnings when the module is loaded.
-
-chan_modem:
-
-* All the chan_modem channel drivers (aopen, bestdata and i4l) are deprecated
- in this release, and will be removed in the next major Asterisk release.
- Please migrate to chan_misdn for ISDN interfaces; there is no upgrade
- path for aopen and bestdata modem users.
-
-MeetMe:
-
-* The conference application now allows users to increase/decrease their
- speaking volume and listening volume (independently of each other and
- other users); the 'admin' and 'user' menus have changed, and new sound
- files are included with this release. However, if a user calling in
- over a Zaptel channel that does NOT have hardware DTMF detection
- increases their speaking volume, it is likely they will no longer be
- able to enter/exit the menu or make any further adjustments, as the
- software DTMF detector will not be able to recognize the DTMF coming
- from their device.
-
-GetVar Manager Action:
-
-* Previously, the behavior of the GetVar manager action reported the value
- of a variable in the following manner:
- > name: value
- This has been changed to a manner similar to the SetVar action and is now
- > Variable: name
- > Value: value
diff --git a/1.2-netsec/acl.c b/1.2-netsec/acl.c
deleted file mode 100644
index 326cdb66d..000000000
--- a/1.2-netsec/acl.c
+++ /dev/null
@@ -1,355 +0,0 @@
-/*
- * Asterisk -- An open source telephony toolkit.
- *
- * Copyright (C) 1999 - 2005, Digium, Inc.
- *
- * Mark Spencer <markster@digium.com>
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE file
- * at the top of the source tree.
- */
-
-/*! \file
- *
- * \brief Various sorts of access control
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/time.h>
-#include <signal.h>
-#include <errno.h>
-#include <unistd.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <net/if.h>
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-#include <sys/ioctl.h>
-
-#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)
-#include <fcntl.h>
-#include <net/route.h>
-#endif
-
-#if defined(SOLARIS)
-#include <sys/sockio.h>
-#endif
-
-/* netinet/ip.h may not define the following (See RFCs 791 and 1349) */
-#if !defined(IPTOS_LOWCOST)
-#define IPTOS_LOWCOST 0x02
-#endif
-
-#if !defined(IPTOS_MINCOST)
-#define IPTOS_MINCOST IPTOS_LOWCOST
-#endif
-
-#include "asterisk.h"
-
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-
-#include "asterisk/acl.h"
-#include "asterisk/logger.h"
-#include "asterisk/channel.h"
-#include "asterisk/options.h"
-#include "asterisk/utils.h"
-#include "asterisk/lock.h"
-#include "asterisk/srv.h"
-#include "asterisk/compat.h"
-
-#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)
-AST_MUTEX_DEFINE_STATIC(routeseq_lock);
-#endif
-
-struct ast_ha {
- /* Host access rule */
- struct in_addr netaddr;
- struct in_addr netmask;
- int sense;
- struct ast_ha *next;
-};
-
-/* Default IP - if not otherwise set, don't breathe garbage */
-static struct in_addr __ourip = { 0x00000000 };
-
-struct my_ifreq {
- char ifrn_name[IFNAMSIZ]; /* Interface name, e.g. "eth0", "ppp0", etc. */
- struct sockaddr_in ifru_addr;
-};
-
-/* Free HA structure */
-void ast_free_ha(struct ast_ha *ha)
-{
- struct ast_ha *hal;
- while(ha) {
- hal = ha;
- ha = ha->next;
- free(hal);
- }
-}
-
-/* Copy HA structure */
-static void ast_copy_ha(struct ast_ha *from, struct ast_ha *to)
-{
- memcpy(&to->netaddr, &from->netaddr, sizeof(from->netaddr));
- memcpy(&to->netmask, &from->netmask, sizeof(from->netmask));
- to->sense = from->sense;
-}
-
-/* Create duplicate of ha structure */
-static struct ast_ha *ast_duplicate_ha(struct ast_ha *original)
-{
- struct ast_ha *new_ha = malloc(sizeof(struct ast_ha));
- /* Copy from original to new object */
- ast_copy_ha(original, new_ha);
-
- return new_ha;
-}
-
-/* Create duplicate HA link list */
-/* Used in chan_sip2 templates */
-struct ast_ha *ast_duplicate_ha_list(struct ast_ha *original)
-{
- struct ast_ha *start=original;
- struct ast_ha *ret = NULL;
- struct ast_ha *link,*prev=NULL;
-
- while (start) {
- link = ast_duplicate_ha(start); /* Create copy of this object */
- if (prev)
- prev->next = link; /* Link previous to this object */
-
- if (!ret)
- ret = link; /* Save starting point */
-
- start = start->next; /* Go to next object */
- prev = link; /* Save pointer to this object */
- }
- return ret; /* Return start of list */
-}
-
-struct ast_ha *ast_append_ha(char *sense, char *stuff, struct ast_ha *path)
-{
- struct ast_ha *ha = malloc(sizeof(struct ast_ha));
- char *nm = "255.255.255.255";
- char tmp[256];
- struct ast_ha *prev = NULL;
- struct ast_ha *ret;
- int x, z;
- unsigned int y;
- ret = path;
- while (path) {
- prev = path;
- path = path->next;
- }
- if (ha) {
- ast_copy_string(tmp, stuff, sizeof(tmp));
- nm = strchr(tmp, '/');
- if (!nm) {
- nm = "255.255.255.255";
- } else {
- *nm = '\0';
- nm++;
- }
- if (!strchr(nm, '.')) {
- if ((sscanf(nm, "%d", &x) == 1) && (x >= 0) && (x <= 32)) {
- y = 0;
- for (z=0;z<x;z++) {
- y >>= 1;
- y |= 0x80000000;
- }
- ha->netmask.s_addr = htonl(y);
- }
- } else if (!inet_aton(nm, &ha->netmask)) {
- ast_log(LOG_WARNING, "%s is not a valid netmask\n", nm);
- free(ha);
- return path;
- }
- if (!inet_aton(tmp, &ha->netaddr)) {
- ast_log(LOG_WARNING, "%s is not a valid IP\n", tmp);
- free(ha);
- return path;
- }
- ha->netaddr.s_addr &= ha->netmask.s_addr;
- if (!strncasecmp(sense, "p", 1)) {
- ha->sense = AST_SENSE_ALLOW;
- } else {
- ha->sense = AST_SENSE_DENY;
- }
- ha->next = NULL;
- if (prev) {
- prev->next = ha;
- } else {
- ret = ha;
- }
- }
- ast_log(LOG_DEBUG, "%s/%s appended to acl for peer\n", stuff, nm);
- return ret;
-}
-
-int ast_apply_ha(struct ast_ha *ha, struct sockaddr_in *sin)
-{
- /* Start optimistic */
- int res = AST_SENSE_ALLOW;
- while (ha) {
- char iabuf[INET_ADDRSTRLEN];
- char iabuf2[INET_ADDRSTRLEN];
- /* DEBUG */
- ast_log(LOG_DEBUG,
- "##### Testing %s with %s\n",
- ast_inet_ntoa(iabuf, sizeof(iabuf), sin->sin_addr),
- ast_inet_ntoa(iabuf2, sizeof(iabuf2), ha->netaddr));
- /* For each rule, if this address and the netmask = the net address
- apply the current rule */
- if ((sin->sin_addr.s_addr & ha->netmask.s_addr) == ha->netaddr.s_addr)
- res = ha->sense;
- ha = ha->next;
- }
- return res;
-}
-
-int ast_get_ip_or_srv(struct sockaddr_in *sin, const char *value, const char *service)
-{
- struct hostent *hp;
- struct ast_hostent ahp;
- char srv[256];
- char host[256];
- int tportno = ntohs(sin->sin_port);
- if (inet_aton(value, &sin->sin_addr))
- return 0;
- if (service) {
- snprintf(srv, sizeof(srv), "%s.%s", service, value);
- if (ast_get_srv(NULL, host, sizeof(host), &tportno, srv) > 0) {
- sin->sin_port = htons(tportno);
- value = host;
- }
- }
- hp = ast_gethostbyname(value, &ahp);
- if (hp) {
- memcpy(&sin->sin_addr, hp->h_addr, sizeof(sin->sin_addr));
- } else {
- ast_log(LOG_WARNING, "Unable to lookup '%s'\n", value);
- return -1;
- }
- return 0;
-}
-
-int ast_str2tos(const char *value, int *tos)
-{
- int fval;
- if (sscanf(value, "%i", &fval) == 1)
- *tos = fval & 0xff;
- else if (!strcasecmp(value, "lowdelay"))
- *tos = IPTOS_LOWDELAY;
- else if (!strcasecmp(value, "throughput"))
- *tos = IPTOS_THROUGHPUT;
- else if (!strcasecmp(value, "reliability"))
- *tos = IPTOS_RELIABILITY;
- else if (!strcasecmp(value, "mincost"))
- *tos = IPTOS_MINCOST;
- else if (!strcasecmp(value, "none"))
- *tos = 0;
- else
- return -1;
- return 0;
-}
-
-int ast_get_ip(struct sockaddr_in *sin, const char *value)
-{
- return ast_get_ip_or_srv(sin, value, NULL);
-}
-
-/* iface is the interface (e.g. eth0); address is the return value */
-int ast_lookup_iface(char *iface, struct in_addr *address)
-{
- int mysock, res = 0;
- struct my_ifreq ifreq;
-
- memset(&ifreq, 0, sizeof(ifreq));
- ast_copy_string(ifreq.ifrn_name, iface, sizeof(ifreq.ifrn_name));
-
- mysock = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP);
- res = ioctl(mysock, SIOCGIFADDR, &ifreq);
-
- close(mysock);
- if (res < 0) {
- ast_log(LOG_WARNING, "Unable to get IP of %s: %s\n", iface, strerror(errno));
- memcpy((char *)address, (char *)&__ourip, sizeof(__ourip));
- return -1;
- } else {
- memcpy((char *)address, (char *)&ifreq.ifru_addr.sin_addr, sizeof(ifreq.ifru_addr.sin_addr));
- return 0;
- }
-}
-
-int ast_ouraddrfor(struct in_addr *them, struct in_addr *us)
-{
- int s;
- struct sockaddr_in sin;
- socklen_t slen;
-
- s = socket(PF_INET, SOCK_DGRAM, 0);
- if (s < 0) {
- ast_log(LOG_WARNING, "Cannot create socket\n");
- return -1;
- }
- sin.sin_family = AF_INET;
- sin.sin_port = 5060;
- sin.sin_addr = *them;
- if (connect(s, (struct sockaddr *)&sin, sizeof(sin))) {
- ast_log(LOG_WARNING, "Cannot connect\n");
- close(s);
- return -1;
- }
- slen = sizeof(sin);
- if (getsockname(s, (struct sockaddr *)&sin, &slen)) {
- ast_log(LOG_WARNING, "Cannot get socket name\n");
- close(s);
- return -1;
- }
- close(s);
- *us = sin.sin_addr;
- return 0;
-}
-
-int ast_find_ourip(struct in_addr *ourip, struct sockaddr_in bindaddr)
-{
- char ourhost[MAXHOSTNAMELEN] = "";
- struct ast_hostent ahp;
- struct hostent *hp;
- struct in_addr saddr;
-
- /* just use the bind address if it is nonzero */
- if (ntohl(bindaddr.sin_addr.s_addr)) {
- memcpy(ourip, &bindaddr.sin_addr, sizeof(*ourip));
- return 0;
- }
- /* try to use our hostname */
- if (gethostname(ourhost, sizeof(ourhost) - 1)) {
- ast_log(LOG_WARNING, "Unable to get hostname\n");
- } else {
- hp = ast_gethostbyname(ourhost, &ahp);
- if (hp) {
- memcpy(ourip, hp->h_addr, sizeof(*ourip));
- return 0;
- }
- }
- /* A.ROOT-SERVERS.NET. */
- if (inet_aton("198.41.0.4", &saddr) && !ast_ouraddrfor(&saddr, ourip))
- return 0;
- return -1;
-}
-
diff --git a/1.2-netsec/aescrypt.c b/1.2-netsec/aescrypt.c
deleted file mode 100644
index 3406b6603..000000000
--- a/1.2-netsec/aescrypt.c
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- ---------------------------------------------------------------------------
- Copyright (c) 2003, Dr Brian Gladman <brg@gladman.me.uk>, Worcester, UK.
- All rights reserved.
-
- LICENSE TERMS
-
- The free distribution and use of this software in both source and binary
- form is allowed (with or without changes) provided that:
-
- 1. distributions of this source code include the above copyright
- notice, this list of conditions and the following disclaimer;
-
- 2. distributions in binary form include the above copyright
- notice, this list of conditions and the following disclaimer
- in the documentation and/or other associated materials;
-
- 3. the copyright holder's name is not used to endorse products
- built using this software without specific written permission.
-
- ALTERNATIVELY, provided that this notice is retained in full, this product
- may be distributed under the terms of the GNU General Public License (GPL),
- in which case the provisions of the GPL apply INSTEAD OF those given above.
-
- DISCLAIMER
-
- This software is provided 'as is' with no explicit or implied warranties
- in respect of its properties, including, but not limited to, correctness
- and/or fitness for purpose.
- ---------------------------------------------------------------------------
- Issue Date: 26/08/2003
-
-*/
-/*! \file
-\brief This file contains the code for implementing encryption and decryption
- for AES (Rijndael) for block and key sizes of 16, 24 and 32 bytes. It
- can optionally be replaced by code written in assembler using NASM. For
- further details see the file aesopt.h
-*/
-
-#include "aesopt.h"
-
-#if defined(__cplusplus)
-extern "C"
-{
-#endif
-
-#define si(y,x,k,c) (s(y,c) = word_in(x, c) ^ (k)[c])
-#define so(y,x,c) word_out(y, c, s(x,c))
-
-#if defined(ARRAYS)
-#define locals(y,x) x[4],y[4]
-#else
-#define locals(y,x) x##0,x##1,x##2,x##3,y##0,y##1,y##2,y##3
-#endif
-
-#define l_copy(y, x) s(y,0) = s(x,0); s(y,1) = s(x,1); \
- s(y,2) = s(x,2); s(y,3) = s(x,3);
-#define state_in(y,x,k) si(y,x,k,0); si(y,x,k,1); si(y,x,k,2); si(y,x,k,3)
-#define state_out(y,x) so(y,x,0); so(y,x,1); so(y,x,2); so(y,x,3)
-#define round(rm,y,x,k) rm(y,x,k,0); rm(y,x,k,1); rm(y,x,k,2); rm(y,x,k,3)
-
-#if defined(ENCRYPTION) && !defined(AES_ASM)
-
-/* Visual C++ .Net v7.1 provides the fastest encryption code when using
- Pentium optimiation with small code but this is poor for decryption
- so we need to control this with the following VC++ pragmas
-*/
-
-#if defined(_MSC_VER)
-#pragma optimize( "s", on )
-#endif
-
-/* Given the column (c) of the output state variable, the following
- macros give the input state variables which are needed in its
- computation for each row (r) of the state. All the alternative
- macros give the same end values but expand into different ways
- of calculating these values. In particular the complex macro
- used for dynamically variable block sizes is designed to expand
- to a compile time constant whenever possible but will expand to
- conditional clauses on some branches (I am grateful to Frank
- Yellin for this construction)
-*/
-
-#define fwd_var(x,r,c)\
- ( r == 0 ? ( c == 0 ? s(x,0) : c == 1 ? s(x,1) : c == 2 ? s(x,2) : s(x,3))\
- : r == 1 ? ( c == 0 ? s(x,1) : c == 1 ? s(x,2) : c == 2 ? s(x,3) : s(x,0))\
- : r == 2 ? ( c == 0 ? s(x,2) : c == 1 ? s(x,3) : c == 2 ? s(x,0) : s(x,1))\
- : ( c == 0 ? s(x,3) : c == 1 ? s(x,0) : c == 2 ? s(x,1) : s(x,2)))
-
-#if defined(FT4_SET)
-#undef dec_fmvars
-#define fwd_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(f,n),fwd_var,rf1,c))
-#elif defined(FT1_SET)
-#undef dec_fmvars
-#define fwd_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,upr,t_use(f,n),fwd_var,rf1,c))
-#else
-#define fwd_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ fwd_mcol(no_table(x,t_use(s,box),fwd_var,rf1,c)))
-#endif
-
-#if defined(FL4_SET)
-#define fwd_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(f,l),fwd_var,rf1,c))
-#elif defined(FL1_SET)
-#define fwd_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,ups,t_use(f,l),fwd_var,rf1,c))
-#else
-#define fwd_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ no_table(x,t_use(s,box),fwd_var,rf1,c))
-#endif
-
-aes_rval aes_encrypt(const void *in_blk, void *out_blk, const aes_encrypt_ctx cx[1])
-{ aes_32t locals(b0, b1);
- const aes_32t *kp = cx->ks;
-#ifdef dec_fmvars
- dec_fmvars; /* declare variables for fwd_mcol() if needed */
-#endif
-
- aes_32t nr = (kp[45] ^ kp[52] ^ kp[53] ? kp[52] : 14);
-
-#ifdef AES_ERR_CHK
- if( (nr != 10 || !(kp[0] | kp[3] | kp[4]))
- && (nr != 12 || !(kp[0] | kp[5] | kp[6]))
- && (nr != 14 || !(kp[0] | kp[7] | kp[8])) )
- return aes_error;
-#endif
-
- state_in(b0, in_blk, kp);
-
-#if (ENC_UNROLL == FULL)
-
- switch(nr)
- {
- case 14:
- round(fwd_rnd, b1, b0, kp + 1 * N_COLS);
- round(fwd_rnd, b0, b1, kp + 2 * N_COLS);
- kp += 2 * N_COLS;
- case 12:
- round(fwd_rnd, b1, b0, kp + 1 * N_COLS);
- round(fwd_rnd, b0, b1, kp + 2 * N_COLS);
- kp += 2 * N_COLS;
- case 10:
- round(fwd_rnd, b1, b0, kp + 1 * N_COLS);
- round(fwd_rnd, b0, b1, kp + 2 * N_COLS);
- round(fwd_rnd, b1, b0, kp + 3 * N_COLS);
- round(fwd_rnd, b0, b1, kp + 4 * N_COLS);
- round(fwd_rnd, b1, b0, kp + 5 * N_COLS);
- round(fwd_rnd, b0, b1, kp + 6 * N_COLS);
- round(fwd_rnd, b1, b0, kp + 7 * N_COLS);
- round(fwd_rnd, b0, b1, kp + 8 * N_COLS);
- round(fwd_rnd, b1, b0, kp + 9 * N_COLS);
- round(fwd_lrnd, b0, b1, kp +10 * N_COLS);
- }
-
-#else
-
-#if (ENC_UNROLL == PARTIAL)
- { aes_32t rnd;
- for(rnd = 0; rnd < (nr >> 1) - 1; ++rnd)
- {
- kp += N_COLS;
- round(fwd_rnd, b1, b0, kp);
- kp += N_COLS;
- round(fwd_rnd, b0, b1, kp);
- }
- kp += N_COLS;
- round(fwd_rnd, b1, b0, kp);
-#else
- { aes_32t rnd;
- for(rnd = 0; rnd < nr - 1; ++rnd)
- {
- kp += N_COLS;
- round(fwd_rnd, b1, b0, kp);
- l_copy(b0, b1);
- }
-#endif
- kp += N_COLS;
- round(fwd_lrnd, b0, b1, kp);
- }
-#endif
-
- state_out(out_blk, b0);
-#ifdef AES_ERR_CHK
- return aes_good;
-#endif
-}
-
-#endif
-
-#if defined(DECRYPTION) && !defined(AES_ASM)
-
-/* Visual C++ .Net v7.1 provides the fastest encryption code when using
- Pentium optimiation with small code but this is poor for decryption
- so we need to control this with the following VC++ pragmas
-*/
-
-#if defined(_MSC_VER)
-#pragma optimize( "t", on )
-#endif
-
-/* Given the column (c) of the output state variable, the following
- macros give the input state variables which are needed in its
- computation for each row (r) of the state. All the alternative
- macros give the same end values but expand into different ways
- of calculating these values. In particular the complex macro
- used for dynamically variable block sizes is designed to expand
- to a compile time constant whenever possible but will expand to
- conditional clauses on some branches (I am grateful to Frank
- Yellin for this construction)
-*/
-
-#define inv_var(x,r,c)\
- ( r == 0 ? ( c == 0 ? s(x,0) : c == 1 ? s(x,1) : c == 2 ? s(x,2) : s(x,3))\
- : r == 1 ? ( c == 0 ? s(x,3) : c == 1 ? s(x,0) : c == 2 ? s(x,1) : s(x,2))\
- : r == 2 ? ( c == 0 ? s(x,2) : c == 1 ? s(x,3) : c == 2 ? s(x,0) : s(x,1))\
- : ( c == 0 ? s(x,1) : c == 1 ? s(x,2) : c == 2 ? s(x,3) : s(x,0)))
-
-#if defined(IT4_SET)
-#undef dec_imvars
-#define inv_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(i,n),inv_var,rf1,c))
-#elif defined(IT1_SET)
-#undef dec_imvars
-#define inv_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,upr,t_use(i,n),inv_var,rf1,c))
-#else
-#define inv_rnd(y,x,k,c) (s(y,c) = inv_mcol((k)[c] ^ no_table(x,t_use(i,box),inv_var,rf1,c)))
-#endif
-
-#if defined(IL4_SET)
-#define inv_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(i,l),inv_var,rf1,c))
-#elif defined(IL1_SET)
-#define inv_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,ups,t_use(i,l),inv_var,rf1,c))
-#else
-#define inv_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ no_table(x,t_use(i,box),inv_var,rf1,c))
-#endif
-
-aes_rval aes_decrypt(const void *in_blk, void *out_blk, const aes_decrypt_ctx cx[1])
-{ aes_32t locals(b0, b1);
-#ifdef dec_imvars
- dec_imvars; /* declare variables for inv_mcol() if needed */
-#endif
-
- aes_32t nr = (cx->ks[45] ^ cx->ks[52] ^ cx->ks[53] ? cx->ks[52] : 14);
- const aes_32t *kp = cx->ks + nr * N_COLS;
-
-#ifdef AES_ERR_CHK
- if( (nr != 10 || !(cx->ks[0] | cx->ks[3] | cx->ks[4]))
- && (nr != 12 || !(cx->ks[0] | cx->ks[5] | cx->ks[6]))
- && (nr != 14 || !(cx->ks[0] | cx->ks[7] | cx->ks[8])) )
- return aes_error;
-#endif
-
- state_in(b0, in_blk, kp);
-
-#if (DEC_UNROLL == FULL)
-
- switch(nr)
- {
- case 14:
- round(inv_rnd, b1, b0, kp - 1 * N_COLS);
- round(inv_rnd, b0, b1, kp - 2 * N_COLS);
- kp -= 2 * N_COLS;
- case 12:
- round(inv_rnd, b1, b0, kp - 1 * N_COLS);
- round(inv_rnd, b0, b1, kp - 2 * N_COLS);
- kp -= 2 * N_COLS;
- case 10:
- round(inv_rnd, b1, b0, kp - 1 * N_COLS);
- round(inv_rnd, b0, b1, kp - 2 * N_COLS);
- round(inv_rnd, b1, b0, kp - 3 * N_COLS);
- round(inv_rnd, b0, b1, kp - 4 * N_COLS);
- round(inv_rnd, b1, b0, kp - 5 * N_COLS);
- round(inv_rnd, b0, b1, kp - 6 * N_COLS);
- round(inv_rnd, b1, b0, kp - 7 * N_COLS);
- round(inv_rnd, b0, b1, kp - 8 * N_COLS);
- round(inv_rnd, b1, b0, kp - 9 * N_COLS);
- round(inv_lrnd, b0, b1, kp - 10 * N_COLS);
- }
-
-#else
-
-#if (DEC_UNROLL == PARTIAL)
- { aes_32t rnd;
- for(rnd = 0; rnd < (nr >> 1) - 1; ++rnd)
- {
- kp -= N_COLS;
- round(inv_rnd, b1, b0, kp);
- kp -= N_COLS;
- round(inv_rnd, b0, b1, kp);
- }
- kp -= N_COLS;
- round(inv_rnd, b1, b0, kp);
-#else
- { aes_32t rnd;
- for(rnd = 0; rnd < nr - 1; ++rnd)
- {
- kp -= N_COLS;
- round(inv_rnd, b1, b0, kp);
- l_copy(b0, b1);
- }
-#endif
- kp -= N_COLS;
- round(inv_lrnd, b0, b1, kp);
- }
-#endif
-
- state_out(out_blk, b0);
-#ifdef AES_ERR_CHK
- return aes_good;
-#endif
-}
-
-#endif
-
-#if defined(__cplusplus)
-}
-#endif
diff --git a/1.2-netsec/aeskey.c b/1.2-netsec/aeskey.c
deleted file mode 100644
index ec24e6cae..000000000
--- a/1.2-netsec/aeskey.c
+++ /dev/null
@@ -1,465 +0,0 @@
-/*
- ---------------------------------------------------------------------------
- Copyright (c) 2003, Dr Brian Gladman <brg@gladman.me.uk>, Worcester, UK.
- All rights reserved.
-
- LICENSE TERMS
-
- The free distribution and use of this software in both source and binary
- form is allowed (with or without changes) provided that:
-
- 1. distributions of this source code include the above copyright
- notice, this list of conditions and the following disclaimer;
-
- 2. distributions in binary form include the above copyright
- notice, this list of conditions and the following disclaimer
- in the documentation and/or other associated materials;
-
- 3. the copyright holder's name is not used to endorse products
- built using this software without specific written permission.
-
- ALTERNATIVELY, provided that this notice is retained in full, this product
- may be distributed under the terms of the GNU General Public License (GPL),
- in which case the provisions of the GPL apply INSTEAD OF those given above.
-
- DISCLAIMER
-
- This software is provided 'as is' with no explicit or implied warranties
- in respect of its properties, including, but not limited to, correctness
- and/or fitness for purpose.
- ---------------------------------------------------------------------------
- Issue Date: 26/08/2003
-
-*/
-/*! \file
-\brief This file contains the code for implementing the key schedule for AES
- (Rijndael) for block and key sizes of 16, 24, and 32 bytes. See aesopt.h
- for further details including optimisation.
-*/
-
-#include "aesopt.h"
-
-#if defined(__cplusplus)
-extern "C"
-{
-#endif
-
-/* Initialise the key schedule from the user supplied key. The key
- length can be specified in bytes, with legal values of 16, 24
- and 32, or in bits, with legal values of 128, 192 and 256. These
- values correspond with Nk values of 4, 6 and 8 respectively.
-
- The following macros implement a single cycle in the key
- schedule generation process. The number of cycles needed
- for each cx->n_col and nk value is:
-
- nk = 4 5 6 7 8
- ------------------------------
- cx->n_col = 4 10 9 8 7 7
- cx->n_col = 5 14 11 10 9 9
- cx->n_col = 6 19 15 12 11 11
- cx->n_col = 7 21 19 16 13 14
- cx->n_col = 8 29 23 19 17 14
-*/
-
-#define ke4(k,i) \
-{ k[4*(i)+4] = ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; k[4*(i)+5] = ss[1] ^= ss[0]; \
- k[4*(i)+6] = ss[2] ^= ss[1]; k[4*(i)+7] = ss[3] ^= ss[2]; \
-}
-#define kel4(k,i) \
-{ k[4*(i)+4] = ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; k[4*(i)+5] = ss[1] ^= ss[0]; \
- k[4*(i)+6] = ss[2] ^= ss[1]; k[4*(i)+7] = ss[3] ^= ss[2]; \
-}
-
-#define ke6(k,i) \
-{ k[6*(i)+ 6] = ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; k[6*(i)+ 7] = ss[1] ^= ss[0]; \
- k[6*(i)+ 8] = ss[2] ^= ss[1]; k[6*(i)+ 9] = ss[3] ^= ss[2]; \
- k[6*(i)+10] = ss[4] ^= ss[3]; k[6*(i)+11] = ss[5] ^= ss[4]; \
-}
-#define kel6(k,i) \
-{ k[6*(i)+ 6] = ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; k[6*(i)+ 7] = ss[1] ^= ss[0]; \
- k[6*(i)+ 8] = ss[2] ^= ss[1]; k[6*(i)+ 9] = ss[3] ^= ss[2]; \
-}
-
-#define ke8(k,i) \
-{ k[8*(i)+ 8] = ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; k[8*(i)+ 9] = ss[1] ^= ss[0]; \
- k[8*(i)+10] = ss[2] ^= ss[1]; k[8*(i)+11] = ss[3] ^= ss[2]; \
- k[8*(i)+12] = ss[4] ^= ls_box(ss[3],0); k[8*(i)+13] = ss[5] ^= ss[4]; \
- k[8*(i)+14] = ss[6] ^= ss[5]; k[8*(i)+15] = ss[7] ^= ss[6]; \
-}
-#define kel8(k,i) \
-{ k[8*(i)+ 8] = ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; k[8*(i)+ 9] = ss[1] ^= ss[0]; \
- k[8*(i)+10] = ss[2] ^= ss[1]; k[8*(i)+11] = ss[3] ^= ss[2]; \
-}
-
-#if defined(ENCRYPTION_KEY_SCHEDULE)
-
-#if defined(AES_128) || defined(AES_VAR)
-
-aes_rval aes_encrypt_key128(const void *in_key, aes_encrypt_ctx cx[1])
-{ aes_32t ss[4];
-
- cx->ks[0] = ss[0] = word_in(in_key, 0);
- cx->ks[1] = ss[1] = word_in(in_key, 1);
- cx->ks[2] = ss[2] = word_in(in_key, 2);
- cx->ks[3] = ss[3] = word_in(in_key, 3);
-
-#if ENC_UNROLL == NONE
- { aes_32t i;
-
- for(i = 0; i < ((11 * N_COLS - 1) / 4); ++i)
- ke4(cx->ks, i);
- }
-#else
- ke4(cx->ks, 0); ke4(cx->ks, 1);
- ke4(cx->ks, 2); ke4(cx->ks, 3);
- ke4(cx->ks, 4); ke4(cx->ks, 5);
- ke4(cx->ks, 6); ke4(cx->ks, 7);
- ke4(cx->ks, 8); kel4(cx->ks, 9);
-#endif
-
- /* cx->ks[45] ^ cx->ks[52] ^ cx->ks[53] is zero for a 256 bit */
- /* key and must be non-zero for 128 and 192 bits keys */
- cx->ks[53] = cx->ks[45] = 0;
- cx->ks[52] = 10;
-#ifdef AES_ERR_CHK
- return aes_good;
-#endif
-}
-
-#endif
-
-#if defined(AES_192) || defined(AES_VAR)
-
-aes_rval aes_encrypt_key192(const void *in_key, aes_encrypt_ctx cx[1])
-{ aes_32t ss[6];
-
- cx->ks[0] = ss[0] = word_in(in_key, 0);
- cx->ks[1] = ss[1] = word_in(in_key, 1);
- cx->ks[2] = ss[2] = word_in(in_key, 2);
- cx->ks[3] = ss[3] = word_in(in_key, 3);
- cx->ks[4] = ss[4] = word_in(in_key, 4);
- cx->ks[5] = ss[5] = word_in(in_key, 5);
-
-#if ENC_UNROLL == NONE
- { aes_32t i;
-
- for(i = 0; i < (13 * N_COLS - 1) / 6; ++i)
- ke6(cx->ks, i);
- }
-#else
- ke6(cx->ks, 0); ke6(cx->ks, 1);
- ke6(cx->ks, 2); ke6(cx->ks, 3);
- ke6(cx->ks, 4); ke6(cx->ks, 5);
- ke6(cx->ks, 6); kel6(cx->ks, 7);
-#endif
-
- /* cx->ks[45] ^ cx->ks[52] ^ cx->ks[53] is zero for a 256 bit */
- /* key and must be non-zero for 128 and 192 bits keys */
- cx->ks[53] = cx->ks[45];
- cx->ks[52] = 12;
-#ifdef AES_ERR_CHK
- return aes_good;
-#endif
-}
-
-#endif
-
-#if defined(AES_256) || defined(AES_VAR)
-
-aes_rval aes_encrypt_key256(const void *in_key, aes_encrypt_ctx cx[1])
-{ aes_32t ss[8];
-
- cx->ks[0] = ss[0] = word_in(in_key, 0);
- cx->ks[1] = ss[1] = word_in(in_key, 1);
- cx->ks[2] = ss[2] = word_in(in_key, 2);
- cx->ks[3] = ss[3] = word_in(in_key, 3);
- cx->ks[4] = ss[4] = word_in(in_key, 4);
- cx->ks[5] = ss[5] = word_in(in_key, 5);
- cx->ks[6] = ss[6] = word_in(in_key, 6);
- cx->ks[7] = ss[7] = word_in(in_key, 7);
-
-#if ENC_UNROLL == NONE
- { aes_32t i;
-
- for(i = 0; i < (15 * N_COLS - 1) / 8; ++i)
- ke8(cx->ks, i);
- }
-#else
- ke8(cx->ks, 0); ke8(cx->ks, 1);
- ke8(cx->ks, 2); ke8(cx->ks, 3);
- ke8(cx->ks, 4); ke8(cx->ks, 5);
- kel8(cx->ks, 6);
-#endif
-#ifdef AES_ERR_CHK
- return aes_good;
-#endif
-}
-
-#endif
-
-#if defined(AES_VAR)
-
-aes_rval aes_encrypt_key(const void *in_key, int key_len, aes_encrypt_ctx cx[1])
-{
- switch(key_len)
- {
-#ifdef AES_ERR_CHK
- case 16: case 128: return aes_encrypt_key128(in_key, cx);
- case 24: case 192: return aes_encrypt_key192(in_key, cx);
- case 32: case 256: return aes_encrypt_key256(in_key, cx);
- default: return aes_error;
-#else
- case 16: case 128: aes_encrypt_key128(in_key, cx); return;
- case 24: case 192: aes_encrypt_key192(in_key, cx); return;
- case 32: case 256: aes_encrypt_key256(in_key, cx); return;
-#endif
- }
-}
-
-#endif
-
-#endif
-
-#if defined(DECRYPTION_KEY_SCHEDULE)
-
-#if DEC_ROUND == NO_TABLES
-#define ff(x) (x)
-#else
-#define ff(x) inv_mcol(x)
-#ifdef dec_imvars
-#define d_vars dec_imvars
-#endif
-#endif
-
-#if 1
-#define kdf4(k,i) \
-{ ss[0] = ss[0] ^ ss[2] ^ ss[1] ^ ss[3]; ss[1] = ss[1] ^ ss[3]; ss[2] = ss[2] ^ ss[3]; ss[3] = ss[3]; \
- ss[4] = ls_box(ss[(i+3) % 4], 3) ^ t_use(r,c)[i]; ss[i % 4] ^= ss[4]; \
- ss[4] ^= k[4*(i)]; k[4*(i)+4] = ff(ss[4]); ss[4] ^= k[4*(i)+1]; k[4*(i)+5] = ff(ss[4]); \
- ss[4] ^= k[4*(i)+2]; k[4*(i)+6] = ff(ss[4]); ss[4] ^= k[4*(i)+3]; k[4*(i)+7] = ff(ss[4]); \
-}
-#define kd4(k,i) \
-{ ss[4] = ls_box(ss[(i+3) % 4], 3) ^ t_use(r,c)[i]; ss[i % 4] ^= ss[4]; ss[4] = ff(ss[4]); \
- k[4*(i)+4] = ss[4] ^= k[4*(i)]; k[4*(i)+5] = ss[4] ^= k[4*(i)+1]; \
- k[4*(i)+6] = ss[4] ^= k[4*(i)+2]; k[4*(i)+7] = ss[4] ^= k[4*(i)+3]; \
-}
-#define kdl4(k,i) \
-{ ss[4] = ls_box(ss[(i+3) % 4], 3) ^ t_use(r,c)[i]; ss[i % 4] ^= ss[4]; \
- k[4*(i)+4] = (ss[0] ^= ss[1]) ^ ss[2] ^ ss[3]; k[4*(i)+5] = ss[1] ^ ss[3]; \
- k[4*(i)+6] = ss[0]; k[4*(i)+7] = ss[1]; \
-}
-#else
-#define kdf4(k,i) \
-{ ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; k[4*(i)+ 4] = ff(ss[0]); ss[1] ^= ss[0]; k[4*(i)+ 5] = ff(ss[1]); \
- ss[2] ^= ss[1]; k[4*(i)+ 6] = ff(ss[2]); ss[3] ^= ss[2]; k[4*(i)+ 7] = ff(ss[3]); \
-}
-#define kd4(k,i) \
-{ ss[4] = ls_box(ss[3],3) ^ t_use(r,c)[i]; \
- ss[0] ^= ss[4]; ss[4] = ff(ss[4]); k[4*(i)+ 4] = ss[4] ^= k[4*(i)]; \
- ss[1] ^= ss[0]; k[4*(i)+ 5] = ss[4] ^= k[4*(i)+ 1]; \
- ss[2] ^= ss[1]; k[4*(i)+ 6] = ss[4] ^= k[4*(i)+ 2]; \
- ss[3] ^= ss[2]; k[4*(i)+ 7] = ss[4] ^= k[4*(i)+ 3]; \
-}
-#define kdl4(k,i) \
-{ ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; k[4*(i)+ 4] = ss[0]; ss[1] ^= ss[0]; k[4*(i)+ 5] = ss[1]; \
- ss[2] ^= ss[1]; k[4*(i)+ 6] = ss[2]; ss[3] ^= ss[2]; k[4*(i)+ 7] = ss[3]; \
-}
-#endif
-
-#define kdf6(k,i) \
-{ ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; k[6*(i)+ 6] = ff(ss[0]); ss[1] ^= ss[0]; k[6*(i)+ 7] = ff(ss[1]); \
- ss[2] ^= ss[1]; k[6*(i)+ 8] = ff(ss[2]); ss[3] ^= ss[2]; k[6*(i)+ 9] = ff(ss[3]); \
- ss[4] ^= ss[3]; k[6*(i)+10] = ff(ss[4]); ss[5] ^= ss[4]; k[6*(i)+11] = ff(ss[5]); \
-}
-#define kd6(k,i) \
-{ ss[6] = ls_box(ss[5],3) ^ t_use(r,c)[i]; \
- ss[0] ^= ss[6]; ss[6] = ff(ss[6]); k[6*(i)+ 6] = ss[6] ^= k[6*(i)]; \
- ss[1] ^= ss[0]; k[6*(i)+ 7] = ss[6] ^= k[6*(i)+ 1]; \
- ss[2] ^= ss[1]; k[6*(i)+ 8] = ss[6] ^= k[6*(i)+ 2]; \
- ss[3] ^= ss[2]; k[6*(i)+ 9] = ss[6] ^= k[6*(i)+ 3]; \
- ss[4] ^= ss[3]; k[6*(i)+10] = ss[6] ^= k[6*(i)+ 4]; \
- ss[5] ^= ss[4]; k[6*(i)+11] = ss[6] ^= k[6*(i)+ 5]; \
-}
-#define kdl6(k,i) \
-{ ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; k[6*(i)+ 6] = ss[0]; ss[1] ^= ss[0]; k[6*(i)+ 7] = ss[1]; \
- ss[2] ^= ss[1]; k[6*(i)+ 8] = ss[2]; ss[3] ^= ss[2]; k[6*(i)+ 9] = ss[3]; \
-}
-
-#define kdf8(k,i) \
-{ ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; k[8*(i)+ 8] = ff(ss[0]); ss[1] ^= ss[0]; k[8*(i)+ 9] = ff(ss[1]); \
- ss[2] ^= ss[1]; k[8*(i)+10] = ff(ss[2]); ss[3] ^= ss[2]; k[8*(i)+11] = ff(ss[3]); \
- ss[4] ^= ls_box(ss[3],0); k[8*(i)+12] = ff(ss[4]); ss[5] ^= ss[4]; k[8*(i)+13] = ff(ss[5]); \
- ss[6] ^= ss[5]; k[8*(i)+14] = ff(ss[6]); ss[7] ^= ss[6]; k[8*(i)+15] = ff(ss[7]); \
-}
-#define kd8(k,i) \
-{ aes_32t g = ls_box(ss[7],3) ^ t_use(r,c)[i]; \
- ss[0] ^= g; g = ff(g); k[8*(i)+ 8] = g ^= k[8*(i)]; \
- ss[1] ^= ss[0]; k[8*(i)+ 9] = g ^= k[8*(i)+ 1]; \
- ss[2] ^= ss[1]; k[8*(i)+10] = g ^= k[8*(i)+ 2]; \
- ss[3] ^= ss[2]; k[8*(i)+11] = g ^= k[8*(i)+ 3]; \
- g = ls_box(ss[3],0); \
- ss[4] ^= g; g = ff(g); k[8*(i)+12] = g ^= k[8*(i)+ 4]; \
- ss[5] ^= ss[4]; k[8*(i)+13] = g ^= k[8*(i)+ 5]; \
- ss[6] ^= ss[5]; k[8*(i)+14] = g ^= k[8*(i)+ 6]; \
- ss[7] ^= ss[6]; k[8*(i)+15] = g ^= k[8*(i)+ 7]; \
-}
-#define kdl8(k,i) \
-{ ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; k[8*(i)+ 8] = ss[0]; ss[1] ^= ss[0]; k[8*(i)+ 9] = ss[1]; \
- ss[2] ^= ss[1]; k[8*(i)+10] = ss[2]; ss[3] ^= ss[2]; k[8*(i)+11] = ss[3]; \
-}
-
-#if defined(AES_128) || defined(AES_VAR)
-
-aes_rval aes_decrypt_key128(const void *in_key, aes_decrypt_ctx cx[1])
-{ aes_32t ss[5];
-#ifdef d_vars
- d_vars;
-#endif
- cx->ks[0] = ss[0] = word_in(in_key, 0);
- cx->ks[1] = ss[1] = word_in(in_key, 1);
- cx->ks[2] = ss[2] = word_in(in_key, 2);
- cx->ks[3] = ss[3] = word_in(in_key, 3);
-
-#if DEC_UNROLL == NONE
- { aes_32t i;
-
- for(i = 0; i < (11 * N_COLS - 1) / 4; ++i)
- ke4(cx->ks, i);
-#if !(DEC_ROUND == NO_TABLES)
- for(i = N_COLS; i < 10 * N_COLS; ++i)
- cx->ks[i] = inv_mcol(cx->ks[i]);
-#endif
- }
-#else
- kdf4(cx->ks, 0); kd4(cx->ks, 1);
- kd4(cx->ks, 2); kd4(cx->ks, 3);
- kd4(cx->ks, 4); kd4(cx->ks, 5);
- kd4(cx->ks, 6); kd4(cx->ks, 7);
- kd4(cx->ks, 8); kdl4(cx->ks, 9);
-#endif
-
- /* cx->ks[45] ^ cx->ks[52] ^ cx->ks[53] is zero for a 256 bit */
- /* key and must be non-zero for 128 and 192 bits keys */
- cx->ks[53] = cx->ks[45] = 0;
- cx->ks[52] = 10;
-#ifdef AES_ERR_CHK
- return aes_good;
-#endif
-}
-
-#endif
-
-#if defined(AES_192) || defined(AES_VAR)
-
-aes_rval aes_decrypt_key192(const void *in_key, aes_decrypt_ctx cx[1])
-{ aes_32t ss[7];
-#ifdef d_vars
- d_vars;
-#endif
- cx->ks[0] = ss[0] = word_in(in_key, 0);
- cx->ks[1] = ss[1] = word_in(in_key, 1);
- cx->ks[2] = ss[2] = word_in(in_key, 2);
- cx->ks[3] = ss[3] = word_in(in_key, 3);
-
-#if DEC_UNROLL == NONE
- cx->ks[4] = ss[4] = word_in(in_key, 4);
- cx->ks[5] = ss[5] = word_in(in_key, 5);
- { aes_32t i;
-
- for(i = 0; i < (13 * N_COLS - 1) / 6; ++i)
- ke6(cx->ks, i);
-#if !(DEC_ROUND == NO_TABLES)
- for(i = N_COLS; i < 12 * N_COLS; ++i)
- cx->ks[i] = inv_mcol(cx->ks[i]);
-#endif
- }
-#else
- cx->ks[4] = ff(ss[4] = word_in(in_key, 4));
- cx->ks[5] = ff(ss[5] = word_in(in_key, 5));
- kdf6(cx->ks, 0); kd6(cx->ks, 1);
- kd6(cx->ks, 2); kd6(cx->ks, 3);
- kd6(cx->ks, 4); kd6(cx->ks, 5);
- kd6(cx->ks, 6); kdl6(cx->ks, 7);
-#endif
-
- /* cx->ks[45] ^ cx->ks[52] ^ cx->ks[53] is zero for a 256 bit */
- /* key and must be non-zero for 128 and 192 bits keys */
- cx->ks[53] = cx->ks[45];
- cx->ks[52] = 12;
-#ifdef AES_ERR_CHK
- return aes_good;
-#endif
-}
-
-#endif
-
-#if defined(AES_256) || defined(AES_VAR)
-
-aes_rval aes_decrypt_key256(const void *in_key, aes_decrypt_ctx cx[1])
-{ aes_32t ss[8];
-#ifdef d_vars
- d_vars;
-#endif
- cx->ks[0] = ss[0] = word_in(in_key, 0);
- cx->ks[1] = ss[1] = word_in(in_key, 1);
- cx->ks[2] = ss[2] = word_in(in_key, 2);
- cx->ks[3] = ss[3] = word_in(in_key, 3);
-
-#if DEC_UNROLL == NONE
- cx->ks[4] = ss[4] = word_in(in_key, 4);
- cx->ks[5] = ss[5] = word_in(in_key, 5);
- cx->ks[6] = ss[6] = word_in(in_key, 6);
- cx->ks[7] = ss[7] = word_in(in_key, 7);
- { aes_32t i;
-
- for(i = 0; i < (15 * N_COLS - 1) / 8; ++i)
- ke8(cx->ks, i);
-#if !(DEC_ROUND == NO_TABLES)
- for(i = N_COLS; i < 14 * N_COLS; ++i)
- cx->ks[i] = inv_mcol(cx->ks[i]);
-#endif
- }
-#else
- cx->ks[4] = ff(ss[4] = word_in(in_key, 4));
- cx->ks[5] = ff(ss[5] = word_in(in_key, 5));
- cx->ks[6] = ff(ss[6] = word_in(in_key, 6));
- cx->ks[7] = ff(ss[7] = word_in(in_key, 7));
- kdf8(cx->ks, 0); kd8(cx->ks, 1);
- kd8(cx->ks, 2); kd8(cx->ks, 3);
- kd8(cx->ks, 4); kd8(cx->ks, 5);
- kdl8(cx->ks, 6);
-#endif
-#ifdef AES_ERR_CHK
- return aes_good;
-#endif
-}
-
-#endif
-
-#if defined(AES_VAR)
-
-aes_rval aes_decrypt_key(const void *in_key, int key_len, aes_decrypt_ctx cx[1])
-{
- switch(key_len)
- {
-#ifdef AES_ERR_CHK
- case 16: case 128: return aes_decrypt_key128(in_key, cx);
- case 24: case 192: return aes_decrypt_key192(in_key, cx);
- case 32: case 256: return aes_decrypt_key256(in_key, cx);
- default: return aes_error;
-#else
- case 16: case 128: aes_decrypt_key128(in_key, cx); return;
- case 24: case 192: aes_decrypt_key192(in_key, cx); return;
- case 32: case 256: aes_decrypt_key256(in_key, cx); return;
-#endif
- }
-}
-
-#endif
-
-#endif
-
-#if defined(__cplusplus)
-}
-#endif
diff --git a/1.2-netsec/aesopt.h b/1.2-netsec/aesopt.h
deleted file mode 100644
index bb4f05a0b..000000000
--- a/1.2-netsec/aesopt.h
+++ /dev/null
@@ -1,1029 +0,0 @@
-/*
- ---------------------------------------------------------------------------
- Copyright (c) 2003, Dr Brian Gladman <brg@gladman.me.uk>, Worcester, UK.
- All rights reserved.
-
- LICENSE TERMS
-
- The free distribution and use of this software in both source and binary
- form is allowed (with or without changes) provided that:
-
- 1. distributions of this source code include the above copyright
- notice, this list of conditions and the following disclaimer;
-
- 2. distributions in binary form include the above copyright
- notice, this list of conditions and the following disclaimer
- in the documentation and/or other associated materials;
-
- 3. the copyright holder's name is not used to endorse products
- built using this software without specific written permission.
-
- ALTERNATIVELY, provided that this notice is retained in full, this product
- may be distributed under the terms of the GNU General Public License (GPL),
- in which case the provisions of the GPL apply INSTEAD OF those given above.
-
- DISCLAIMER
-
- This software is provided 'as is' with no explicit or implied warranties
- in respect of its properties, including, but not limited to, correctness
- and/or fitness for purpose.
- ---------------------------------------------------------------------------
- Issue Date: 26/08/2003
-
- My thanks go to Dag Arne Osvik for devising the schemes used here for key
- length derivation from the form of the key schedule
-
- This file contains the compilation options for AES (Rijndael) and code
- that is common across encryption, key scheduling and table generation.
-
- OPERATION
-
- These source code files implement the AES algorithm Rijndael designed by
- Joan Daemen and Vincent Rijmen. This version is designed for the standard
- block size of 16 bytes and for key sizes of 128, 192 and 256 bits (16, 24
- and 32 bytes).
-
- This version is designed for flexibility and speed using operations on
- 32-bit words rather than operations on bytes. It can be compiled with
- either big or little endian internal byte order but is faster when the
- native byte order for the processor is used.
-
- THE CIPHER INTERFACE
-
- The cipher interface is implemented as an array of bytes in which lower
- AES bit sequence indexes map to higher numeric significance within bytes.
-
- aes_08t (an unsigned 8-bit type)
- aes_32t (an unsigned 32-bit type)
- struct aes_encrypt_ctx (structure for the cipher encryption context)
- struct aes_decrypt_ctx (structure for the cipher decryption context)
- aes_rval the function return type
-
- C subroutine calls:
-
- aes_rval aes_encrypt_key128(const void *in_key, aes_encrypt_ctx cx[1]);
- aes_rval aes_encrypt_key192(const void *in_key, aes_encrypt_ctx cx[1]);
- aes_rval aes_encrypt_key256(const void *in_key, aes_encrypt_ctx cx[1]);
- aes_rval aes_encrypt(const void *in_blk,
- void *out_blk, const aes_encrypt_ctx cx[1]);
-
- aes_rval aes_decrypt_key128(const void *in_key, aes_decrypt_ctx cx[1]);
- aes_rval aes_decrypt_key192(const void *in_key, aes_decrypt_ctx cx[1]);
- aes_rval aes_decrypt_key256(const void *in_key, aes_decrypt_ctx cx[1]);
- aes_rval aes_decrypt(const void *in_blk,
- void *out_blk, const aes_decrypt_ctx cx[1]);
-
- IMPORTANT NOTE: If you are using this C interface with dynamic tables make sure that
- you call genTabs() before AES is used so that the tables are initialised.
-
- C++ aes class subroutines:
-
- Class AESencrypt for encryption
-
- Construtors:
- AESencrypt(void)
- AESencrypt(const void *in_key) - 128 bit key
- Members:
- void key128(const void *in_key)
- void key192(const void *in_key)
- void key256(const void *in_key)
- void encrypt(const void *in_blk, void *out_blk) const
-
- Class AESdecrypt for encryption
- Construtors:
- AESdecrypt(void)
- AESdecrypt(const void *in_key) - 128 bit key
- Members:
- void key128(const void *in_key)
- void key192(const void *in_key)
- void key256(const void *in_key)
- void decrypt(const void *in_blk, void *out_blk) const
-
- COMPILATION
-
- The files used to provide AES (Rijndael) are
-
- a. aes.h for the definitions needed for use in C.
- b. aescpp.h for the definitions needed for use in C++.
- c. aesopt.h for setting compilation options (also includes common code).
- d. aescrypt.c for encryption and decrytpion, or
- e. aeskey.c for key scheduling.
- f. aestab.c for table loading or generation.
- g. aescrypt.asm for encryption and decryption using assembler code.
- h. aescrypt.mmx.asm for encryption and decryption using MMX assembler.
-
- To compile AES (Rijndael) for use in C code use aes.h and set the
- defines here for the facilities you need (key lengths, encryption
- and/or decryption). Do not define AES_DLL or AES_CPP. Set the options
- for optimisations and table sizes here.
-
- To compile AES (Rijndael) for use in in C++ code use aescpp.h but do
- not define AES_DLL
-
- To compile AES (Rijndael) in C as a Dynamic Link Library DLL) use
- aes.h and include the AES_DLL define.
-
- CONFIGURATION OPTIONS (here and in aes.h)
-
- a. set AES_DLL in aes.h if AES (Rijndael) is to be compiled as a DLL
- b. You may need to set PLATFORM_BYTE_ORDER to define the byte order.
- c. If you want the code to run in a specific internal byte order, then
- ALGORITHM_BYTE_ORDER must be set accordingly.
- d. set other configuration options decribed below.
-*/
-
-#ifndef _AESOPT_H
-#define _AESOPT_H
-
-#include "asterisk/aes.h"
-#include "asterisk/endian.h"
-
-/* CONFIGURATION - USE OF DEFINES
-
- Later in this section there are a number of defines that control the
- operation of the code. In each section, the purpose of each define is
- explained so that the relevant form can be included or excluded by
- setting either 1's or 0's respectively on the branches of the related
- #if clauses.
-*/
-
-/* BYTE ORDER IN 32-BIT WORDS
-
- To obtain the highest speed on processors with 32-bit words, this code
- needs to determine the byte order of the target machine. The following
- block of code is an attempt to capture the most obvious ways in which
- various environemnts define byte order. It may well fail, in which case
- the definitions will need to be set by editing at the points marked
- **** EDIT HERE IF NECESSARY **** below. My thanks to Peter Gutmann for
- some of these defines (from cryptlib).
-*/
-
-#define BRG_LITTLE_ENDIAN 1234 /* byte 0 is least significant (i386) */
-#define BRG_BIG_ENDIAN 4321 /* byte 0 is most significant (mc68k) */
-
-#if defined( __alpha__ ) || defined( __alpha ) || defined( i386 ) || \
- defined( __i386__ ) || defined( _M_I86 ) || defined( _M_IX86 ) || \
- defined( __OS2__ ) || defined( sun386 ) || defined( __TURBOC__ ) || \
- defined( vax ) || defined( vms ) || defined( VMS ) || \
- defined( __VMS )
-
-#define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN
-
-#endif
-
-#if defined( AMIGA ) || defined( applec ) || defined( __AS400__ ) || \
- defined( _CRAY ) || defined( __hppa ) || defined( __hp9000 ) || \
- defined( ibm370 ) || defined( mc68000 ) || defined( m68k ) || \
- defined( __MRC__ ) || defined( __MVS__ ) || defined( __MWERKS__ ) || \
- defined( sparc ) || defined( __sparc) || defined( SYMANTEC_C ) || \
- defined( __TANDEM ) || defined( THINK_C ) || defined( __VMCMS__ )
-
-#define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN
-
-#endif
-
-/* if the platform is still not known, try to find its byte order */
-/* from commonly used definitions in the headers included earlier */
-
-#if !defined(PLATFORM_BYTE_ORDER)
-
-#if defined(LITTLE_ENDIAN) || defined(BIG_ENDIAN)
-# if defined(LITTLE_ENDIAN) && !defined(BIG_ENDIAN)
-# define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN
-# elif !defined(LITTLE_ENDIAN) && defined(BIG_ENDIAN)
-# define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN
-# elif defined(BYTE_ORDER) && (BYTE_ORDER == LITTLE_ENDIAN)
-# define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN
-# elif defined(BYTE_ORDER) && (BYTE_ORDER == BIG_ENDIAN)
-# define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN
-# endif
-
-#elif defined(_LITTLE_ENDIAN) || defined(_BIG_ENDIAN)
-# if defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)
-# define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN
-# elif !defined(_LITTLE_ENDIAN) && defined(_BIG_ENDIAN)
-# define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN
-# elif defined(_BYTE_ORDER) && (_BYTE_ORDER == _LITTLE_ENDIAN)
-# define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN
-# elif defined(_BYTE_ORDER) && (_BYTE_ORDER == _BIG_ENDIAN)
-# define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN
-# endif
-
-#elif defined(__LITTLE_ENDIAN__) || defined(__BIG_ENDIAN__)
-# if defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)
-# define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN
-# elif !defined(__LITTLE_ENDIAN__) && defined(__BIG_ENDIAN__)
-# define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN
-# elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __LITTLE_ENDIAN__)
-# define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN
-# elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __BIG_ENDIAN__)
-# define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN
-# endif
-
-#elif 0 /* **** EDIT HERE IF NECESSARY **** */
-#define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN
-
-#elif 0 /* **** EDIT HERE IF NECESSARY **** */
-#define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN
-
-#else
-#error Please edit aesopt.h (line 235 or 238) to set the platform byte order
-#endif
-
-#endif
-
-/* SOME LOCAL DEFINITIONS */
-
-#define NO_TABLES 0
-#define ONE_TABLE 1
-#define FOUR_TABLES 4
-#define NONE 0
-#define PARTIAL 1
-#define FULL 2
-
-#if defined(bswap32)
-#define aes_sw32 bswap32
-#elif defined(bswap_32)
-#define aes_sw32 bswap_32
-#else
-#define brot(x,n) (((aes_32t)(x) << n) | ((aes_32t)(x) >> (32 - n)))
-#define aes_sw32(x) ((brot((x),8) & 0x00ff00ff) | (brot((x),24) & 0xff00ff00))
-#endif
-
-/* 1. FUNCTIONS REQUIRED
-
- This implementation provides subroutines for encryption, decryption
- and for setting the three key lengths (separately) for encryption
- and decryption. When the assembler code is not being used the following
- definition blocks allow the selection of the routines that are to be
- included in the compilation.
-*/
-#ifdef AES_ENCRYPT
-#define ENCRYPTION
-#define ENCRYPTION_KEY_SCHEDULE
-#endif
-
-#ifdef AES_DECRYPT
-#define DECRYPTION
-#define DECRYPTION_KEY_SCHEDULE
-#endif
-
-/* 2. ASSEMBLER SUPPORT
-
- This define (which can be on the command line) enables the use of the
- assembler code routines for encryption and decryption with the C code
- only providing key scheduling
-*/
-#if 0
-#define AES_ASM
-#endif
-
-/* 3. BYTE ORDER WITHIN 32 BIT WORDS
-
- The fundamental data processing units in Rijndael are 8-bit bytes. The
- input, output and key input are all enumerated arrays of bytes in which
- bytes are numbered starting at zero and increasing to one less than the
- number of bytes in the array in question. This enumeration is only used
- for naming bytes and does not imply any adjacency or order relationship
- from one byte to another. When these inputs and outputs are considered
- as bit sequences, bits 8*n to 8*n+7 of the bit sequence are mapped to
- byte[n] with bit 8n+i in the sequence mapped to bit 7-i within the byte.
- In this implementation bits are numbered from 0 to 7 starting at the
- numerically least significant end of each byte (bit n represents 2^n).
-
- However, Rijndael can be implemented more efficiently using 32-bit
- words by packing bytes into words so that bytes 4*n to 4*n+3 are placed
- into word[n]. While in principle these bytes can be assembled into words
- in any positions, this implementation only supports the two formats in
- which bytes in adjacent positions within words also have adjacent byte
- numbers. This order is called big-endian if the lowest numbered bytes
- in words have the highest numeric significance and little-endian if the
- opposite applies.
-
- This code can work in either order irrespective of the order used by the
- machine on which it runs. Normally the internal byte order will be set
- to the order of the processor on which the code is to be run but this
- define can be used to reverse this in special situations
-
- NOTE: Assembler code versions rely on PLATFORM_BYTE_ORDER being set
-*/
-#if 1 || defined(AES_ASM)
-#define ALGORITHM_BYTE_ORDER PLATFORM_BYTE_ORDER
-#elif 0
-#define ALGORITHM_BYTE_ORDER BRG_LITTLE_ENDIAN
-#elif 0
-#define ALGORITHM_BYTE_ORDER BRG_BIG_ENDIAN
-#else
-#error The algorithm byte order is not defined
-#endif
-
-/* 4. FAST INPUT/OUTPUT OPERATIONS.
-
- On some machines it is possible to improve speed by transferring the
- bytes in the input and output arrays to and from the internal 32-bit
- variables by addressing these arrays as if they are arrays of 32-bit
- words. On some machines this will always be possible but there may
- be a large performance penalty if the byte arrays are not aligned on
- the normal word boundaries. On other machines this technique will
- lead to memory access errors when such 32-bit word accesses are not
- properly aligned. The option SAFE_IO avoids such problems but will
- often be slower on those machines that support misaligned access
- (especially so if care is taken to align the input and output byte
- arrays on 32-bit word boundaries). If SAFE_IO is not defined it is
- assumed that access to byte arrays as if they are arrays of 32-bit
- words will not cause problems when such accesses are misaligned.
-*/
-#if 1 && !defined(_MSC_VER)
-#define SAFE_IO
-#endif
-
-/* 5. LOOP UNROLLING
-
- The code for encryption and decrytpion cycles through a number of rounds
- that can be implemented either in a loop or by expanding the code into a
- long sequence of instructions, the latter producing a larger program but
- one that will often be much faster. The latter is called loop unrolling.
- There are also potential speed advantages in expanding two iterations in
- a loop with half the number of iterations, which is called partial loop
- unrolling. The following options allow partial or full loop unrolling
- to be set independently for encryption and decryption
-*/
-#if 1
-#define ENC_UNROLL FULL
-#elif 0
-#define ENC_UNROLL PARTIAL
-#else
-#define ENC_UNROLL NONE
-#endif
-
-#if 1
-#define DEC_UNROLL FULL
-#elif 0
-#define DEC_UNROLL PARTIAL
-#else
-#define DEC_UNROLL NONE
-#endif
-
-/* 6. FAST FINITE FIELD OPERATIONS
-
- If this section is included, tables are used to provide faster finite
- field arithmetic (this has no effect if FIXED_TABLES is defined).
-*/
-#if 1
-#define FF_TABLES
-#endif
-
-/* 7. INTERNAL STATE VARIABLE FORMAT
-
- The internal state of Rijndael is stored in a number of local 32-bit
- word varaibles which can be defined either as an array or as individual
- names variables. Include this section if you want to store these local
- varaibles in arrays. Otherwise individual local variables will be used.
-*/
-#if 1
-#define ARRAYS
-#endif
-
-/* In this implementation the columns of the state array are each held in
- 32-bit words. The state array can be held in various ways: in an array
- of words, in a number of individual word variables or in a number of
- processor registers. The following define maps a variable name x and
- a column number c to the way the state array variable is to be held.
- The first define below maps the state into an array x[c] whereas the
- second form maps the state into a number of individual variables x0,
- x1, etc. Another form could map individual state colums to machine
- register names.
-*/
-
-#if defined(ARRAYS)
-#define s(x,c) x[c]
-#else
-#define s(x,c) x##c
-#endif
-
-/* 8. FIXED OR DYNAMIC TABLES
-
- When this section is included the tables used by the code are compiled
- statically into the binary file. Otherwise the subroutine gen_tabs()
- must be called to compute them before the code is first used.
-*/
-#if 1
-#define FIXED_TABLES
-#endif
-
-/* 9. TABLE ALIGNMENT
-
- On some sytsems speed will be improved by aligning the AES large lookup
- tables on particular boundaries. This define should be set to a power of
- two giving the desired alignment. It can be left undefined if alignment
- is not needed. This option is specific to the Microsft VC++ compiler -
- it seems to sometimes cause trouble for the VC++ version 6 compiler.
-*/
-
-#if 0 && defined(_MSC_VER) && (_MSC_VER >= 1300)
-#define TABLE_ALIGN 64
-#endif
-
-/* 10. INTERNAL TABLE CONFIGURATION
-
- This cipher proceeds by repeating in a number of cycles known as 'rounds'
- which are implemented by a round function which can optionally be speeded
- up using tables. The basic tables are each 256 32-bit words, with either
- one or four tables being required for each round function depending on
- how much speed is required. The encryption and decryption round functions
- are different and the last encryption and decrytpion round functions are
- different again making four different round functions in all.
-
- This means that:
- 1. Normal encryption and decryption rounds can each use either 0, 1
- or 4 tables and table spaces of 0, 1024 or 4096 bytes each.
- 2. The last encryption and decryption rounds can also use either 0, 1
- or 4 tables and table spaces of 0, 1024 or 4096 bytes each.
-
- Include or exclude the appropriate definitions below to set the number
- of tables used by this implementation.
-*/
-
-#if 1 /* set tables for the normal encryption round */
-#define ENC_ROUND FOUR_TABLES
-#elif 0
-#define ENC_ROUND ONE_TABLE
-#else
-#define ENC_ROUND NO_TABLES
-#endif
-
-#if 1 /* set tables for the last encryption round */
-#define LAST_ENC_ROUND FOUR_TABLES
-#elif 0
-#define LAST_ENC_ROUND ONE_TABLE
-#else
-#define LAST_ENC_ROUND NO_TABLES
-#endif
-
-#if 1 /* set tables for the normal decryption round */
-#define DEC_ROUND FOUR_TABLES
-#elif 0
-#define DEC_ROUND ONE_TABLE
-#else
-#define DEC_ROUND NO_TABLES
-#endif
-
-#if 1 /* set tables for the last decryption round */
-#define LAST_DEC_ROUND FOUR_TABLES
-#elif 0
-#define LAST_DEC_ROUND ONE_TABLE
-#else
-#define LAST_DEC_ROUND NO_TABLES
-#endif
-
-/* The decryption key schedule can be speeded up with tables in the same
- way that the round functions can. Include or exclude the following
- defines to set this requirement.
-*/
-#if 1
-#define KEY_SCHED FOUR_TABLES
-#elif 0
-#define KEY_SCHED ONE_TABLE
-#else
-#define KEY_SCHED NO_TABLES
-#endif
-
-/* END OF CONFIGURATION OPTIONS */
-
-#define RC_LENGTH (5 * (AES_BLOCK_SIZE / 4 - 2))
-
-/* Disable or report errors on some combinations of options */
-
-#if ENC_ROUND == NO_TABLES && LAST_ENC_ROUND != NO_TABLES
-#undef LAST_ENC_ROUND
-#define LAST_ENC_ROUND NO_TABLES
-#elif ENC_ROUND == ONE_TABLE && LAST_ENC_ROUND == FOUR_TABLES
-#undef LAST_ENC_ROUND
-#define LAST_ENC_ROUND ONE_TABLE
-#endif
-
-#if ENC_ROUND == NO_TABLES && ENC_UNROLL != NONE
-#undef ENC_UNROLL
-#define ENC_UNROLL NONE
-#endif
-
-#if DEC_ROUND == NO_TABLES && LAST_DEC_ROUND != NO_TABLES
-#undef LAST_DEC_ROUND
-#define LAST_DEC_ROUND NO_TABLES
-#elif DEC_ROUND == ONE_TABLE && LAST_DEC_ROUND == FOUR_TABLES
-#undef LAST_DEC_ROUND
-#define LAST_DEC_ROUND ONE_TABLE
-#endif
-
-#if DEC_ROUND == NO_TABLES && DEC_UNROLL != NONE
-#undef DEC_UNROLL
-#define DEC_UNROLL NONE
-#endif
-
-/* upr(x,n): rotates bytes within words by n positions, moving bytes to
- higher index positions with wrap around into low positions
- ups(x,n): moves bytes by n positions to higher index positions in
- words but without wrap around
- bval(x,n): extracts a byte from a word
-
- NOTE: The definitions given here are intended only for use with
- unsigned variables and with shift counts that are compile
- time constants
-*/
-
-#if (ALGORITHM_BYTE_ORDER == BRG_LITTLE_ENDIAN)
-#define upr(x,n) (((aes_32t)(x) << (8 * (n))) | ((aes_32t)(x) >> (32 - 8 * (n))))
-#define ups(x,n) ((aes_32t) (x) << (8 * (n)))
-#define bval(x,n) ((aes_08t)((x) >> (8 * (n))))
-#define bytes2word(b0, b1, b2, b3) \
- (((aes_32t)(b3) << 24) | ((aes_32t)(b2) << 16) | ((aes_32t)(b1) << 8) | (b0))
-#endif
-
-#if (ALGORITHM_BYTE_ORDER == BRG_BIG_ENDIAN)
-#define upr(x,n) (((aes_32t)(x) >> (8 * (n))) | ((aes_32t)(x) << (32 - 8 * (n))))
-#define ups(x,n) ((aes_32t) (x) >> (8 * (n))))
-#define bval(x,n) ((aes_08t)((x) >> (24 - 8 * (n))))
-#define bytes2word(b0, b1, b2, b3) \
- (((aes_32t)(b0) << 24) | ((aes_32t)(b1) << 16) | ((aes_32t)(b2) << 8) | (b3))
-#endif
-
-#if defined(SAFE_IO)
-
-#define word_in(x,c) bytes2word(((aes_08t*)(x)+4*c)[0], ((aes_08t*)(x)+4*c)[1], \
- ((aes_08t*)(x)+4*c)[2], ((aes_08t*)(x)+4*c)[3])
-#define word_out(x,c,v) { ((aes_08t*)(x)+4*c)[0] = bval(v,0); ((aes_08t*)(x)+4*c)[1] = bval(v,1); \
- ((aes_08t*)(x)+4*c)[2] = bval(v,2); ((aes_08t*)(x)+4*c)[3] = bval(v,3); }
-
-#elif (ALGORITHM_BYTE_ORDER == PLATFORM_BYTE_ORDER)
-
-#define word_in(x,c) (*((aes_32t*)(x)+(c)))
-#define word_out(x,c,v) (*((aes_32t*)(x)+(c)) = (v))
-
-#else
-
-#define word_in(x,c) aes_sw32(*((aes_32t*)(x)+(c)))
-#define word_out(x,c,v) (*((aes_32t*)(x)+(c)) = aes_sw32(v))
-
-#endif
-
-/* the finite field modular polynomial and elements */
-
-#define WPOLY 0x011b
-#define BPOLY 0x1b
-
-/* multiply four bytes in GF(2^8) by 'x' {02} in parallel */
-
-#define m1 0x80808080
-#define m2 0x7f7f7f7f
-#define gf_mulx(x) ((((x) & m2) << 1) ^ ((((x) & m1) >> 7) * BPOLY))
-
-/* The following defines provide alternative definitions of gf_mulx that might
- give improved performance if a fast 32-bit multiply is not available. Note
- that a temporary variable u needs to be defined where gf_mulx is used.
-
-#define gf_mulx(x) (u = (x) & m1, u |= (u >> 1), ((x) & m2) << 1) ^ ((u >> 3) | (u >> 6))
-#define m4 (0x01010101 * BPOLY)
-#define gf_mulx(x) (u = (x) & m1, ((x) & m2) << 1) ^ ((u - (u >> 7)) & m4)
-*/
-
-/* Work out which tables are needed for the different options */
-
-#ifdef AES_ASM
-#ifdef ENC_ROUND
-#undef ENC_ROUND
-#endif
-#define ENC_ROUND FOUR_TABLES
-#ifdef LAST_ENC_ROUND
-#undef LAST_ENC_ROUND
-#endif
-#define LAST_ENC_ROUND FOUR_TABLES
-#ifdef DEC_ROUND
-#undef DEC_ROUND
-#endif
-#define DEC_ROUND FOUR_TABLES
-#ifdef LAST_DEC_ROUND
-#undef LAST_DEC_ROUND
-#endif
-#define LAST_DEC_ROUND FOUR_TABLES
-#ifdef KEY_SCHED
-#undef KEY_SCHED
-#define KEY_SCHED FOUR_TABLES
-#endif
-#endif
-
-#if defined(ENCRYPTION) || defined(AES_ASM)
-#if ENC_ROUND == ONE_TABLE
-#define FT1_SET
-#elif ENC_ROUND == FOUR_TABLES
-#define FT4_SET
-#else
-#define SBX_SET
-#endif
-#if LAST_ENC_ROUND == ONE_TABLE
-#define FL1_SET
-#elif LAST_ENC_ROUND == FOUR_TABLES
-#define FL4_SET
-#elif !defined(SBX_SET)
-#define SBX_SET
-#endif
-#endif
-
-#if defined(DECRYPTION) || defined(AES_ASM)
-#if DEC_ROUND == ONE_TABLE
-#define IT1_SET
-#elif DEC_ROUND == FOUR_TABLES
-#define IT4_SET
-#else
-#define ISB_SET
-#endif
-#if LAST_DEC_ROUND == ONE_TABLE
-#define IL1_SET
-#elif LAST_DEC_ROUND == FOUR_TABLES
-#define IL4_SET
-#elif !defined(ISB_SET)
-#define ISB_SET
-#endif
-#endif
-
-#if defined(ENCRYPTION_KEY_SCHEDULE) || defined(DECRYPTION_KEY_SCHEDULE)
-#if KEY_SCHED == ONE_TABLE
-#define LS1_SET
-#define IM1_SET
-#elif KEY_SCHED == FOUR_TABLES
-#define LS4_SET
-#define IM4_SET
-#elif !defined(SBX_SET)
-#define SBX_SET
-#endif
-#endif
-
-/* generic definitions of Rijndael macros that use tables */
-
-#define no_table(x,box,vf,rf,c) bytes2word( \
- box[bval(vf(x,0,c),rf(0,c))], \
- box[bval(vf(x,1,c),rf(1,c))], \
- box[bval(vf(x,2,c),rf(2,c))], \
- box[bval(vf(x,3,c),rf(3,c))])
-
-#define one_table(x,op,tab,vf,rf,c) \
- ( tab[bval(vf(x,0,c),rf(0,c))] \
- ^ op(tab[bval(vf(x,1,c),rf(1,c))],1) \
- ^ op(tab[bval(vf(x,2,c),rf(2,c))],2) \
- ^ op(tab[bval(vf(x,3,c),rf(3,c))],3))
-
-#define four_tables(x,tab,vf,rf,c) \
- ( tab[0][bval(vf(x,0,c),rf(0,c))] \
- ^ tab[1][bval(vf(x,1,c),rf(1,c))] \
- ^ tab[2][bval(vf(x,2,c),rf(2,c))] \
- ^ tab[3][bval(vf(x,3,c),rf(3,c))])
-
-#define vf1(x,r,c) (x)
-#define rf1(r,c) (r)
-#define rf2(r,c) ((8+r-c)&3)
-
-/* perform forward and inverse column mix operation on four bytes in long word x in */
-/* parallel. NOTE: x must be a simple variable, NOT an expression in these macros. */
-
-#if defined(FM4_SET) /* not currently used */
-#define fwd_mcol(x) four_tables(x,t_use(f,m),vf1,rf1,0)
-#elif defined(FM1_SET) /* not currently used */
-#define fwd_mcol(x) one_table(x,upr,t_use(f,m),vf1,rf1,0)
-#else
-#define dec_fmvars aes_32t g2
-#define fwd_mcol(x) (g2 = gf_mulx(x), g2 ^ upr((x) ^ g2, 3) ^ upr((x), 2) ^ upr((x), 1))
-#endif
-
-#if defined(IM4_SET)
-#define inv_mcol(x) four_tables(x,t_use(i,m),vf1,rf1,0)
-#elif defined(IM1_SET)
-#define inv_mcol(x) one_table(x,upr,t_use(i,m),vf1,rf1,0)
-#else
-#define dec_imvars aes_32t g2, g4, g9
-#define inv_mcol(x) (g2 = gf_mulx(x), g4 = gf_mulx(g2), g9 = (x) ^ gf_mulx(g4), g4 ^= g9, \
- (x) ^ g2 ^ g4 ^ upr(g2 ^ g9, 3) ^ upr(g4, 2) ^ upr(g9, 1))
-#endif
-
-#if defined(FL4_SET)
-#define ls_box(x,c) four_tables(x,t_use(f,l),vf1,rf2,c)
-#elif defined(LS4_SET)
-#define ls_box(x,c) four_tables(x,t_use(l,s),vf1,rf2,c)
-#elif defined(FL1_SET)
-#define ls_box(x,c) one_table(x,upr,t_use(f,l),vf1,rf2,c)
-#elif defined(LS1_SET)
-#define ls_box(x,c) one_table(x,upr,t_use(l,s),vf1,rf2,c)
-#else
-#define ls_box(x,c) no_table(x,t_use(s,box),vf1,rf2,c)
-#endif
-
-#if defined(__cplusplus)
-extern "C"
-{
-#endif
-
-/* If there are no global variables, the definitions here can be
- used to put the AES tables in a structure so that a pointer
- can then be added to the AES context to pass them to the AES
- routines that need them. If this facility is used, the calling
- program has to ensure that this pointer is managed appropriately.
- In particular, the value of the t_dec(in,it) item in the table
- structure must be set to zero in order to ensure that the tables
- are initialised. In practice the three code sequences in aeskey.c
- that control the calls to gen_tabs() and the gen_tabs() routine
- itself will have to be changed for a specific implementation. If
- global variables are available it will generally be preferable to
- use them with the precomputed FIXED_TABLES option that uses static
- global tables.
-
- The following defines can be used to control the way the tables
- are defined, initialised and used in embedded environments that
- require special features for these purposes
-
- the 't_dec' construction is used to declare fixed table arrays
- the 't_set' construction is used to set fixed table values
- the 't_use' construction is used to access fixed table values
-
- 256 byte tables:
-
- t_xxx(s,box) => forward S box
- t_xxx(i,box) => inverse S box
-
- 256 32-bit word OR 4 x 256 32-bit word tables:
-
- t_xxx(f,n) => forward normal round
- t_xxx(f,l) => forward last round
- t_xxx(i,n) => inverse normal round
- t_xxx(i,l) => inverse last round
- t_xxx(l,s) => key schedule table
- t_xxx(i,m) => key schedule table
-
- Other variables and tables:
-
- t_xxx(r,c) => the rcon table
-*/
-
-#define t_dec(m,n) t_##m##n
-#define t_set(m,n) t_##m##n
-#define t_use(m,n) t_##m##n
-
-#if defined(DO_TABLES) /* declare and instantiate tables */
-
-/* finite field arithmetic operations for table generation */
-
-#if defined(FIXED_TABLES) || !defined(FF_TABLES)
-
-#define f2(x) ((x<<1) ^ (((x>>7) & 1) * WPOLY))
-#define f4(x) ((x<<2) ^ (((x>>6) & 1) * WPOLY) ^ (((x>>6) & 2) * WPOLY))
-#define f8(x) ((x<<3) ^ (((x>>5) & 1) * WPOLY) ^ (((x>>5) & 2) * WPOLY) \
- ^ (((x>>5) & 4) * WPOLY))
-#define f3(x) (f2(x) ^ x)
-#define f9(x) (f8(x) ^ x)
-#define fb(x) (f8(x) ^ f2(x) ^ x)
-#define fd(x) (f8(x) ^ f4(x) ^ x)
-#define fe(x) (f8(x) ^ f4(x) ^ f2(x))
-
-#else
-
-#define f2(x) ((x) ? pow[log[x] + 0x19] : 0)
-#define f3(x) ((x) ? pow[log[x] + 0x01] : 0)
-#define f9(x) ((x) ? pow[log[x] + 0xc7] : 0)
-#define fb(x) ((x) ? pow[log[x] + 0x68] : 0)
-#define fd(x) ((x) ? pow[log[x] + 0xee] : 0)
-#define fe(x) ((x) ? pow[log[x] + 0xdf] : 0)
-#define fi(x) ((x) ? pow[ 255 - log[x]] : 0)
-
-#endif
-
-#if defined(FIXED_TABLES) /* declare and set values for static tables */
-
-#define sb_data(w) \
- w(0x63), w(0x7c), w(0x77), w(0x7b), w(0xf2), w(0x6b), w(0x6f), w(0xc5),\
- w(0x30), w(0x01), w(0x67), w(0x2b), w(0xfe), w(0xd7), w(0xab), w(0x76),\
- w(0xca), w(0x82), w(0xc9), w(0x7d), w(0xfa), w(0x59), w(0x47), w(0xf0),\
- w(0xad), w(0xd4), w(0xa2), w(0xaf), w(0x9c), w(0xa4), w(0x72), w(0xc0),\
- w(0xb7), w(0xfd), w(0x93), w(0x26), w(0x36), w(0x3f), w(0xf7), w(0xcc),\
- w(0x34), w(0xa5), w(0xe5), w(0xf1), w(0x71), w(0xd8), w(0x31), w(0x15),\
- w(0x04), w(0xc7), w(0x23), w(0xc3), w(0x18), w(0x96), w(0x05), w(0x9a),\
- w(0x07), w(0x12), w(0x80), w(0xe2), w(0xeb), w(0x27), w(0xb2), w(0x75),\
- w(0x09), w(0x83), w(0x2c), w(0x1a), w(0x1b), w(0x6e), w(0x5a), w(0xa0),\
- w(0x52), w(0x3b), w(0xd6), w(0xb3), w(0x29), w(0xe3), w(0x2f), w(0x84),\
- w(0x53), w(0xd1), w(0x00), w(0xed), w(0x20), w(0xfc), w(0xb1), w(0x5b),\
- w(0x6a), w(0xcb), w(0xbe), w(0x39), w(0x4a), w(0x4c), w(0x58), w(0xcf),\
- w(0xd0), w(0xef), w(0xaa), w(0xfb), w(0x43), w(0x4d), w(0x33), w(0x85),\
- w(0x45), w(0xf9), w(0x02), w(0x7f), w(0x50), w(0x3c), w(0x9f), w(0xa8),\
- w(0x51), w(0xa3), w(0x40), w(0x8f), w(0x92), w(0x9d), w(0x38), w(0xf5),\
- w(0xbc), w(0xb6), w(0xda), w(0x21), w(0x10), w(0xff), w(0xf3), w(0xd2),\
- w(0xcd), w(0x0c), w(0x13), w(0xec), w(0x5f), w(0x97), w(0x44), w(0x17),\
- w(0xc4), w(0xa7), w(0x7e), w(0x3d), w(0x64), w(0x5d), w(0x19), w(0x73),\
- w(0x60), w(0x81), w(0x4f), w(0xdc), w(0x22), w(0x2a), w(0x90), w(0x88),\
- w(0x46), w(0xee), w(0xb8), w(0x14), w(0xde), w(0x5e), w(0x0b), w(0xdb),\
- w(0xe0), w(0x32), w(0x3a), w(0x0a), w(0x49), w(0x06), w(0x24), w(0x5c),\
- w(0xc2), w(0xd3), w(0xac), w(0x62), w(0x91), w(0x95), w(0xe4), w(0x79),\
- w(0xe7), w(0xc8), w(0x37), w(0x6d), w(0x8d), w(0xd5), w(0x4e), w(0xa9),\
- w(0x6c), w(0x56), w(0xf4), w(0xea), w(0x65), w(0x7a), w(0xae), w(0x08),\
- w(0xba), w(0x78), w(0x25), w(0x2e), w(0x1c), w(0xa6), w(0xb4), w(0xc6),\
- w(0xe8), w(0xdd), w(0x74), w(0x1f), w(0x4b), w(0xbd), w(0x8b), w(0x8a),\
- w(0x70), w(0x3e), w(0xb5), w(0x66), w(0x48), w(0x03), w(0xf6), w(0x0e),\
- w(0x61), w(0x35), w(0x57), w(0xb9), w(0x86), w(0xc1), w(0x1d), w(0x9e),\
- w(0xe1), w(0xf8), w(0x98), w(0x11), w(0x69), w(0xd9), w(0x8e), w(0x94),\
- w(0x9b), w(0x1e), w(0x87), w(0xe9), w(0xce), w(0x55), w(0x28), w(0xdf),\
- w(0x8c), w(0xa1), w(0x89), w(0x0d), w(0xbf), w(0xe6), w(0x42), w(0x68),\
- w(0x41), w(0x99), w(0x2d), w(0x0f), w(0xb0), w(0x54), w(0xbb), w(0x16)
-
-#define isb_data(w) \
- w(0x52), w(0x09), w(0x6a), w(0xd5), w(0x30), w(0x36), w(0xa5), w(0x38),\
- w(0xbf), w(0x40), w(0xa3), w(0x9e), w(0x81), w(0xf3), w(0xd7), w(0xfb),\
- w(0x7c), w(0xe3), w(0x39), w(0x82), w(0x9b), w(0x2f), w(0xff), w(0x87),\
- w(0x34), w(0x8e), w(0x43), w(0x44), w(0xc4), w(0xde), w(0xe9), w(0xcb),\
- w(0x54), w(0x7b), w(0x94), w(0x32), w(0xa6), w(0xc2), w(0x23), w(0x3d),\
- w(0xee), w(0x4c), w(0x95), w(0x0b), w(0x42), w(0xfa), w(0xc3), w(0x4e),\
- w(0x08), w(0x2e), w(0xa1), w(0x66), w(0x28), w(0xd9), w(0x24), w(0xb2),\
- w(0x76), w(0x5b), w(0xa2), w(0x49), w(0x6d), w(0x8b), w(0xd1), w(0x25),\
- w(0x72), w(0xf8), w(0xf6), w(0x64), w(0x86), w(0x68), w(0x98), w(0x16),\
- w(0xd4), w(0xa4), w(0x5c), w(0xcc), w(0x5d), w(0x65), w(0xb6), w(0x92),\
- w(0x6c), w(0x70), w(0x48), w(0x50), w(0xfd), w(0xed), w(0xb9), w(0xda),\
- w(0x5e), w(0x15), w(0x46), w(0x57), w(0xa7), w(0x8d), w(0x9d), w(0x84),\
- w(0x90), w(0xd8), w(0xab), w(0x00), w(0x8c), w(0xbc), w(0xd3), w(0x0a),\
- w(0xf7), w(0xe4), w(0x58), w(0x05), w(0xb8), w(0xb3), w(0x45), w(0x06),\
- w(0xd0), w(0x2c), w(0x1e), w(0x8f), w(0xca), w(0x3f), w(0x0f), w(0x02),\
- w(0xc1), w(0xaf), w(0xbd), w(0x03), w(0x01), w(0x13), w(0x8a), w(0x6b),\
- w(0x3a), w(0x91), w(0x11), w(0x41), w(0x4f), w(0x67), w(0xdc), w(0xea),\
- w(0x97), w(0xf2), w(0xcf), w(0xce), w(0xf0), w(0xb4), w(0xe6), w(0x73),\
- w(0x96), w(0xac), w(0x74), w(0x22), w(0xe7), w(0xad), w(0x35), w(0x85),\
- w(0xe2), w(0xf9), w(0x37), w(0xe8), w(0x1c), w(0x75), w(0xdf), w(0x6e),\
- w(0x47), w(0xf1), w(0x1a), w(0x71), w(0x1d), w(0x29), w(0xc5), w(0x89),\
- w(0x6f), w(0xb7), w(0x62), w(0x0e), w(0xaa), w(0x18), w(0xbe), w(0x1b),\
- w(0xfc), w(0x56), w(0x3e), w(0x4b), w(0xc6), w(0xd2), w(0x79), w(0x20),\
- w(0x9a), w(0xdb), w(0xc0), w(0xfe), w(0x78), w(0xcd), w(0x5a), w(0xf4),\
- w(0x1f), w(0xdd), w(0xa8), w(0x33), w(0x88), w(0x07), w(0xc7), w(0x31),\
- w(0xb1), w(0x12), w(0x10), w(0x59), w(0x27), w(0x80), w(0xec), w(0x5f),\
- w(0x60), w(0x51), w(0x7f), w(0xa9), w(0x19), w(0xb5), w(0x4a), w(0x0d),\
- w(0x2d), w(0xe5), w(0x7a), w(0x9f), w(0x93), w(0xc9), w(0x9c), w(0xef),\
- w(0xa0), w(0xe0), w(0x3b), w(0x4d), w(0xae), w(0x2a), w(0xf5), w(0xb0),\
- w(0xc8), w(0xeb), w(0xbb), w(0x3c), w(0x83), w(0x53), w(0x99), w(0x61),\
- w(0x17), w(0x2b), w(0x04), w(0x7e), w(0xba), w(0x77), w(0xd6), w(0x26),\
- w(0xe1), w(0x69), w(0x14), w(0x63), w(0x55), w(0x21), w(0x0c), w(0x7d),
-
-#define mm_data(w) \
- w(0x00), w(0x01), w(0x02), w(0x03), w(0x04), w(0x05), w(0x06), w(0x07),\
- w(0x08), w(0x09), w(0x0a), w(0x0b), w(0x0c), w(0x0d), w(0x0e), w(0x0f),\
- w(0x10), w(0x11), w(0x12), w(0x13), w(0x14), w(0x15), w(0x16), w(0x17),\
- w(0x18), w(0x19), w(0x1a), w(0x1b), w(0x1c), w(0x1d), w(0x1e), w(0x1f),\
- w(0x20), w(0x21), w(0x22), w(0x23), w(0x24), w(0x25), w(0x26), w(0x27),\
- w(0x28), w(0x29), w(0x2a), w(0x2b), w(0x2c), w(0x2d), w(0x2e), w(0x2f),\
- w(0x30), w(0x31), w(0x32), w(0x33), w(0x34), w(0x35), w(0x36), w(0x37),\
- w(0x38), w(0x39), w(0x3a), w(0x3b), w(0x3c), w(0x3d), w(0x3e), w(0x3f),\
- w(0x40), w(0x41), w(0x42), w(0x43), w(0x44), w(0x45), w(0x46), w(0x47),\
- w(0x48), w(0x49), w(0x4a), w(0x4b), w(0x4c), w(0x4d), w(0x4e), w(0x4f),\
- w(0x50), w(0x51), w(0x52), w(0x53), w(0x54), w(0x55), w(0x56), w(0x57),\
- w(0x58), w(0x59), w(0x5a), w(0x5b), w(0x5c), w(0x5d), w(0x5e), w(0x5f),\
- w(0x60), w(0x61), w(0x62), w(0x63), w(0x64), w(0x65), w(0x66), w(0x67),\
- w(0x68), w(0x69), w(0x6a), w(0x6b), w(0x6c), w(0x6d), w(0x6e), w(0x6f),\
- w(0x70), w(0x71), w(0x72), w(0x73), w(0x74), w(0x75), w(0x76), w(0x77),\
- w(0x78), w(0x79), w(0x7a), w(0x7b), w(0x7c), w(0x7d), w(0x7e), w(0x7f),\
- w(0x80), w(0x81), w(0x82), w(0x83), w(0x84), w(0x85), w(0x86), w(0x87),\
- w(0x88), w(0x89), w(0x8a), w(0x8b), w(0x8c), w(0x8d), w(0x8e), w(0x8f),\
- w(0x90), w(0x91), w(0x92), w(0x93), w(0x94), w(0x95), w(0x96), w(0x97),\
- w(0x98), w(0x99), w(0x9a), w(0x9b), w(0x9c), w(0x9d), w(0x9e), w(0x9f),\
- w(0xa0), w(0xa1), w(0xa2), w(0xa3), w(0xa4), w(0xa5), w(0xa6), w(0xa7),\
- w(0xa8), w(0xa9), w(0xaa), w(0xab), w(0xac), w(0xad), w(0xae), w(0xaf),\
- w(0xb0), w(0xb1), w(0xb2), w(0xb3), w(0xb4), w(0xb5), w(0xb6), w(0xb7),\
- w(0xb8), w(0xb9), w(0xba), w(0xbb), w(0xbc), w(0xbd), w(0xbe), w(0xbf),\
- w(0xc0), w(0xc1), w(0xc2), w(0xc3), w(0xc4), w(0xc5), w(0xc6), w(0xc7),\
- w(0xc8), w(0xc9), w(0xca), w(0xcb), w(0xcc), w(0xcd), w(0xce), w(0xcf),\
- w(0xd0), w(0xd1), w(0xd2), w(0xd3), w(0xd4), w(0xd5), w(0xd6), w(0xd7),\
- w(0xd8), w(0xd9), w(0xda), w(0xdb), w(0xdc), w(0xdd), w(0xde), w(0xdf),\
- w(0xe0), w(0xe1), w(0xe2), w(0xe3), w(0xe4), w(0xe5), w(0xe6), w(0xe7),\
- w(0xe8), w(0xe9), w(0xea), w(0xeb), w(0xec), w(0xed), w(0xee), w(0xef),\
- w(0xf0), w(0xf1), w(0xf2), w(0xf3), w(0xf4), w(0xf5), w(0xf6), w(0xf7),\
- w(0xf8), w(0xf9), w(0xfa), w(0xfb), w(0xfc), w(0xfd), w(0xfe), w(0xff)
-
-#define h0(x) (x)
-
-/* These defines are used to ensure tables are generated in the
- right format depending on the internal byte order required
-*/
-
-#define w0(p) bytes2word(p, 0, 0, 0)
-#define w1(p) bytes2word(0, p, 0, 0)
-#define w2(p) bytes2word(0, 0, p, 0)
-#define w3(p) bytes2word(0, 0, 0, p)
-
-#define u0(p) bytes2word(f2(p), p, p, f3(p))
-#define u1(p) bytes2word(f3(p), f2(p), p, p)
-#define u2(p) bytes2word(p, f3(p), f2(p), p)
-#define u3(p) bytes2word(p, p, f3(p), f2(p))
-
-#define v0(p) bytes2word(fe(p), f9(p), fd(p), fb(p))
-#define v1(p) bytes2word(fb(p), fe(p), f9(p), fd(p))
-#define v2(p) bytes2word(fd(p), fb(p), fe(p), f9(p))
-#define v3(p) bytes2word(f9(p), fd(p), fb(p), fe(p))
-
-const aes_32t t_dec(r,c)[RC_LENGTH] =
-{
- w0(0x01), w0(0x02), w0(0x04), w0(0x08), w0(0x10),
- w0(0x20), w0(0x40), w0(0x80), w0(0x1b), w0(0x36)
-};
-
-#define d_1(t,n,b,v) const t n[256] = { b(v##0) }
-#define d_4(t,n,b,v) const t n[4][256] = { { b(v##0) }, { b(v##1) }, { b(v##2) }, { b(v##3) } }
-
-#else /* declare and instantiate tables for dynamic value generation in in tab.c */
-
-aes_32t t_dec(r,c)[RC_LENGTH];
-
-#define d_1(t,n,b,v) t n[256]
-#define d_4(t,n,b,v) t n[4][256]
-
-#endif
-
-#else /* declare tables without instantiation */
-
-#if defined(FIXED_TABLES)
-
-extern const aes_32t t_dec(r,c)[RC_LENGTH];
-
-#if defined(_MSC_VER) && defined(TABLE_ALIGN)
-#define d_1(t,n,b,v) extern __declspec(align(TABLE_ALIGN)) const t n[256]
-#define d_4(t,n,b,v) extern __declspec(align(TABLE_ALIGN)) const t n[4][256]
-#else
-#define d_1(t,n,b,v) extern const t n[256]
-#define d_4(t,n,b,v) extern const t n[4][256]
-#endif
-#else
-
-extern aes_32t t_dec(r,c)[RC_LENGTH];
-
-#if defined(_MSC_VER) && defined(TABLE_ALIGN)
-#define d_1(t,n,b,v) extern __declspec(align(TABLE_ALIGN)) t n[256]
-#define d_4(t,n,b,v) extern __declspec(align(TABLE_ALIGN)) t n[4][256]
-#else
-#define d_1(t,n,b,v) extern t n[256]
-#define d_4(t,n,b,v) extern t n[4][256]
-#endif
-#endif
-
-#endif
-
-#ifdef SBX_SET
- d_1(aes_08t, t_dec(s,box), sb_data, h);
-#endif
-#ifdef ISB_SET
- d_1(aes_08t, t_dec(i,box), isb_data, h);
-#endif
-
-#ifdef FT1_SET
- d_1(aes_32t, t_dec(f,n), sb_data, u);
-#endif
-#ifdef FT4_SET
- d_4(aes_32t, t_dec(f,n), sb_data, u);
-#endif
-
-#ifdef FL1_SET
- d_1(aes_32t, t_dec(f,l), sb_data, w);
-#endif
-#ifdef FL4_SET
- d_4(aes_32t, t_dec(f,l), sb_data, w);
-#endif
-
-#ifdef IT1_SET
- d_1(aes_32t, t_dec(i,n), isb_data, v);
-#endif
-#ifdef IT4_SET
- d_4(aes_32t, t_dec(i,n), isb_data, v);
-#endif
-
-#ifdef IL1_SET
- d_1(aes_32t, t_dec(i,l), isb_data, w);
-#endif
-#ifdef IL4_SET
- d_4(aes_32t, t_dec(i,l), isb_data, w);
-#endif
-
-#ifdef LS1_SET
-#ifdef FL1_SET
-#undef LS1_SET
-#else
- d_1(aes_32t, t_dec(l,s), sb_data, w);
-#endif
-#endif
-
-#ifdef LS4_SET
-#ifdef FL4_SET
-#undef LS4_SET
-#else
- d_4(aes_32t, t_dec(l,s), sb_data, w);
-#endif
-#endif
-
-#ifdef IM1_SET
- d_1(aes_32t, t_dec(i,m), mm_data, v);
-#endif
-#ifdef IM4_SET
- d_4(aes_32t, t_dec(i,m), mm_data, v);
-#endif
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif
diff --git a/1.2-netsec/aestab.c b/1.2-netsec/aestab.c
deleted file mode 100644
index c84a480af..000000000
--- a/1.2-netsec/aestab.c
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- ---------------------------------------------------------------------------
- Copyright (c) 2003, Dr Brian Gladman <brg@gladman.me.uk>, Worcester, UK.
- All rights reserved.
-
- LICENSE TERMS
-
- The free distribution and use of this software in both source and binary
- form is allowed (with or without changes) provided that:
-
- 1. distributions of this source code include the above copyright
- notice, this list of conditions and the following disclaimer;
-
- 2. distributions in binary form include the above copyright
- notice, this list of conditions and the following disclaimer
- in the documentation and/or other associated materials;
-
- 3. the copyright holder's name is not used to endorse products
- built using this software without specific written permission.
-
- ALTERNATIVELY, provided that this notice is retained in full, this product
- may be distributed under the terms of the GNU General Public License (GPL),
- in which case the provisions of the GPL apply INSTEAD OF those given above.
-
- DISCLAIMER
-
- This software is provided 'as is' with no explicit or implied warranties
- in respect of its properties, including, but not limited to, correctness
- and/or fitness for purpose.
- ---------------------------------------------------------------------------
- Issue Date: 26/08/2003
-
-*/
-
-#if defined(__cplusplus)
-extern "C"
-{
-#endif
-
-#define DO_TABLES
-
-#include "aesopt.h"
-
-#if defined(FIXED_TABLES)
-
-/* implemented in case of wrong call for fixed tables */
-
-void gen_tabs(void)
-{
-}
-
-#else /* dynamic table generation */
-
-#if !defined(FF_TABLES)
-
-/* Generate the tables for the dynamic table option
-
- It will generally be sensible to use tables to compute finite
- field multiplies and inverses but where memory is scarse this
- code might sometimes be better. But it only has effect during
- initialisation so its pretty unimportant in overall terms.
-*/
-
-/* return 2 ^ (n - 1) where n is the bit number of the highest bit
- set in x with x in the range 1 < x < 0x00000200. This form is
- used so that locals within fi can be bytes rather than words
-*/
-
-static aes_08t hibit(const aes_32t x)
-{ aes_08t r = (aes_08t)((x >> 1) | (x >> 2));
-
- r |= (r >> 2);
- r |= (r >> 4);
- return (r + 1) >> 1;
-}
-
-/* return the inverse of the finite field element x */
-
-static aes_08t fi(const aes_08t x)
-{ aes_08t p1 = x, p2 = BPOLY, n1 = hibit(x), n2 = 0x80, v1 = 1, v2 = 0;
-
- if(x < 2) return x;
-
- for(;;)
- {
- if(!n1) return v1;
-
- while(n2 >= n1)
- {
- n2 /= n1; p2 ^= p1 * n2; v2 ^= v1 * n2; n2 = hibit(p2);
- }
-
- if(!n2) return v2;
-
- while(n1 >= n2)
- {
- n1 /= n2; p1 ^= p2 * n1; v1 ^= v2 * n1; n1 = hibit(p1);
- }
- }
-}
-
-#endif
-
-/* The forward and inverse affine transformations used in the S-box */
-
-#define fwd_affine(x) \
- (w = (aes_32t)x, w ^= (w<<1)^(w<<2)^(w<<3)^(w<<4), 0x63^(aes_08t)(w^(w>>8)))
-
-#define inv_affine(x) \
- (w = (aes_32t)x, w = (w<<1)^(w<<3)^(w<<6), 0x05^(aes_08t)(w^(w>>8)))
-
-static int init = 0;
-
-void gen_tabs(void)
-{ aes_32t i, w;
-
-#if defined(FF_TABLES)
-
- aes_08t pow[512], log[256];
-
- if(init) return;
- /* log and power tables for GF(2^8) finite field with
- WPOLY as modular polynomial - the simplest primitive
- root is 0x03, used here to generate the tables
- */
-
- i = 0; w = 1;
- do
- {
- pow[i] = (aes_08t)w;
- pow[i + 255] = (aes_08t)w;
- log[w] = (aes_08t)i++;
- w ^= (w << 1) ^ (w & 0x80 ? WPOLY : 0);
- }
- while (w != 1);
-
-#else
- if(init) return;
-#endif
-
- for(i = 0, w = 1; i < RC_LENGTH; ++i)
- {
- t_set(r,c)[i] = bytes2word(w, 0, 0, 0);
- w = f2(w);
- }
-
- for(i = 0; i < 256; ++i)
- { aes_08t b;
-
- b = fwd_affine(fi((aes_08t)i));
- w = bytes2word(f2(b), b, b, f3(b));
-
-#ifdef SBX_SET
- t_set(s,box)[i] = b;
-#endif
-
-#ifdef FT1_SET /* tables for a normal encryption round */
- t_set(f,n)[i] = w;
-#endif
-#ifdef FT4_SET
- t_set(f,n)[0][i] = w;
- t_set(f,n)[1][i] = upr(w,1);
- t_set(f,n)[2][i] = upr(w,2);
- t_set(f,n)[3][i] = upr(w,3);
-#endif
- w = bytes2word(b, 0, 0, 0);
-
-#ifdef FL1_SET /* tables for last encryption round (may also */
- t_set(f,l)[i] = w; /* be used in the key schedule) */
-#endif
-#ifdef FL4_SET
- t_set(f,l)[0][i] = w;
- t_set(f,l)[1][i] = upr(w,1);
- t_set(f,l)[2][i] = upr(w,2);
- t_set(f,l)[3][i] = upr(w,3);
-#endif
-
-#ifdef LS1_SET /* table for key schedule if t_set(f,l) above is */
- t_set(l,s)[i] = w; /* not of the required form */
-#endif
-#ifdef LS4_SET
- t_set(l,s)[0][i] = w;
- t_set(l,s)[1][i] = upr(w,1);
- t_set(l,s)[2][i] = upr(w,2);
- t_set(l,s)[3][i] = upr(w,3);
-#endif
-
- b = fi(inv_affine((aes_08t)i));
- w = bytes2word(fe(b), f9(b), fd(b), fb(b));
-
-#ifdef IM1_SET /* tables for the inverse mix column operation */
- t_set(i,m)[b] = w;
-#endif
-#ifdef IM4_SET
- t_set(i,m)[0][b] = w;
- t_set(i,m)[1][b] = upr(w,1);
- t_set(i,m)[2][b] = upr(w,2);
- t_set(i,m)[3][b] = upr(w,3);
-#endif
-
-#ifdef ISB_SET
- t_set(i,box)[i] = b;
-#endif
-#ifdef IT1_SET /* tables for a normal decryption round */
- t_set(i,n)[i] = w;
-#endif
-#ifdef IT4_SET
- t_set(i,n)[0][i] = w;
- t_set(i,n)[1][i] = upr(w,1);
- t_set(i,n)[2][i] = upr(w,2);
- t_set(i,n)[3][i] = upr(w,3);
-#endif
- w = bytes2word(b, 0, 0, 0);
-#ifdef IL1_SET /* tables for last decryption round */
- t_set(i,l)[i] = w;
-#endif
-#ifdef IL4_SET
- t_set(i,l)[0][i] = w;
- t_set(i,l)[1][i] = upr(w,1);
- t_set(i,l)[2][i] = upr(w,2);
- t_set(i,l)[3][i] = upr(w,3);
-#endif
- }
- init = 1;
-}
-
-#endif
-
-#if defined(__cplusplus)
-}
-#endif
-
diff --git a/1.2-netsec/agi/DialAnMp3.agi b/1.2-netsec/agi/DialAnMp3.agi
deleted file mode 100644
index 59a54265e..000000000
--- a/1.2-netsec/agi/DialAnMp3.agi
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/usr/bin/perl
-#
-# Simple AGI application to play mp3's selected by a user both using
-# xmms and over the phone itself.
-#
-$|=1;
-while(<STDIN>) {
- chomp;
- last unless length($_);
- if (/^agi_(\w+)\:\s+(.*)$/) {
- $AGI{$1} = $2;
- }
-}
-
-print STDERR "AGI Environment Dump:\n";
-foreach $i (sort keys %AGI) {
- print STDERR " -- $i = $AGI{$i}\n";
-}
-
-dbmopen(%DIGITS, "/var/lib/asterisk/mp3list", 0644) || die("Unable to open mp3list");;
-
-sub checkresult {
- my ($res) = @_;
- my $retval;
- $tests++;
- chomp $res;
- if ($res =~ /^200/) {
- $res =~ /result=(-?[\w\*\#]+)/;
- return $1;
- } else {
- return -1;
- }
-}
-
-#print STDERR "1. Playing beep...\n";
-#print "STREAM FILE beep \"\"\n";
-#$result = <STDIN>;
-#checkresult($result);
-
-print STDERR "2. Getting song name...\n";
-print "GET DATA demo-enterkeywords\n";
-$result = <STDIN>;
-$digitstr = checkresult($result);
-if ($digitstr < 0) {
- exit(1);
-}
-$digitstr =~ s/\*/ /g;
-
-print STDERR "Resulting songname is $digitstr\n";
-@searchwords = split (/\s+/, $digitstr);
-print STDERR "Searchwords: " . join(':', @searchwords) . "\n";
-
-foreach $key (sort keys %DIGITS) {
- @words = split(/\s+/, $DIGITS{$key});
- $match = 1;
- foreach $search (@searchwords) {
- $match = 0 unless grep(/$search/, @words);
- }
- if ($match > 0) {
- print STDERR "File $key matches\n";
- # Play a beep
- print "STREAM FILE beep \"\"\n";
- system("xmms", $key);
- $result = <STDIN>;
- if (&checkresult($result) < 0) {
- exit 0;
- }
- print "EXEC MP3Player \"$key\"\n";
-# print "WAIT FOR DIGIT 60000\n";
- $result = <STDIN>;
- if (&checkresult($result) < 0) {
- exit 0;
- }
- print STDERR "Got here...\n";
- }
-}
-
-print STDERR "4. Testing 'saynumber' of $digitstr...\n";
-print "STREAM FILE demo-nomatch\"\"\n";
-$result = <STDIN>;
-checkresult($result);
-
diff --git a/1.2-netsec/agi/Makefile b/1.2-netsec/agi/Makefile
deleted file mode 100644
index 8cea3499f..000000000
--- a/1.2-netsec/agi/Makefile
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-# Asterisk -- A telephony toolkit for Linux.
-#
-# Makefile for AGI-related stuff
-#
-# Copyright (C) 1999-2005, Digium
-#
-# Mark Spencer <markster@digium.com>
-#
-# This program is free software, distributed under the terms of
-# the GNU General Public License
-#
-
-AGIS=agi-test.agi eagi-test eagi-sphinx-test
-
-CFLAGS+=
-
-LIBS=
-ifeq ($(OSARCH),SunOS)
- LIBS=-lsocket -lnsl ../strcompat.o
-endif
-
-ifeq ($(findstring BSD,${OSARCH}),BSD)
- CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include -L$(CROSS_COMPILE_TARGET)/usr/local/lib
-endif
-
-all: depend $(AGIS)
-
-install: all
- mkdir -p $(DESTDIR)$(AGI_DIR)
- for x in $(AGIS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(AGI_DIR) ; done
-
-eagi-test: eagi-test.o
- $(CC) $(CFLAGS) -o eagi-test eagi-test.o $(LIBS)
-
-eagi-sphinx-test: eagi-sphinx-test.o
- $(CC) $(CFLAGS) -o eagi-sphinx-test eagi-sphinx-test.o $(LIBS)
-
-clean:
- rm -f *.so *.o look .depend eagi-test eagi-sphinx-test
-
-%.so : %.o
- $(CC) -shared -Xlinker -x -o $@ $<
-
-ifneq ($(wildcard .depend),)
-include .depend
-endif
-
-depend: .depend
-
-.depend:
- ../build_tools/mkdep $(CFLAGS) `ls *.c`
diff --git a/1.2-netsec/agi/agi-test.agi b/1.2-netsec/agi/agi-test.agi
deleted file mode 100644
index 4fc36eda8..000000000
--- a/1.2-netsec/agi/agi-test.agi
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/usr/bin/perl
-use strict;
-
-$|=1;
-
-# Setup some variables
-my %AGI; my $tests = 0; my $fail = 0; my $pass = 0;
-
-while(<STDIN>) {
- chomp;
- last unless length($_);
- if (/^agi_(\w+)\:\s+(.*)$/) {
- $AGI{$1} = $2;
- }
-}
-
-print STDERR "AGI Environment Dump:\n";
-foreach my $i (sort keys %AGI) {
- print STDERR " -- $i = $AGI{$i}\n";
-}
-
-sub checkresult {
- my ($res) = @_;
- my $retval;
- $tests++;
- chomp $res;
- if ($res =~ /^200/) {
- $res =~ /result=(-?\d+)/;
- if (!length($1)) {
- print STDERR "FAIL ($res)\n";
- $fail++;
- } else {
- print STDERR "PASS ($1)\n";
- $pass++;
- }
- } else {
- print STDERR "FAIL (unexpected result '$res')\n";
- $fail++;
- }
-}
-
-print STDERR "1. Testing 'sendfile'...";
-print "STREAM FILE beep \"\"\n";
-my $result = <STDIN>;
-&checkresult($result);
-
-print STDERR "2. Testing 'sendtext'...";
-print "SEND TEXT \"hello world\"\n";
-my $result = <STDIN>;
-&checkresult($result);
-
-print STDERR "3. Testing 'sendimage'...";
-print "SEND IMAGE asterisk-image\n";
-my $result = <STDIN>;
-&checkresult($result);
-
-print STDERR "4. Testing 'saynumber'...";
-print "SAY NUMBER 192837465 \"\"\n";
-my $result = <STDIN>;
-&checkresult($result);
-
-print STDERR "5. Testing 'waitdtmf'...";
-print "WAIT FOR DIGIT 1000\n";
-my $result = <STDIN>;
-&checkresult($result);
-
-print STDERR "6. Testing 'record'...";
-print "RECORD FILE testagi gsm 1234 3000\n";
-my $result = <STDIN>;
-&checkresult($result);
-
-print STDERR "6a. Testing 'record' playback...";
-print "STREAM FILE testagi \"\"\n";
-my $result = <STDIN>;
-&checkresult($result);
-
-print STDERR "================== Complete ======================\n";
-print STDERR "$tests tests completed, $pass passed, $fail failed\n";
-print STDERR "==================================================\n";
diff --git a/1.2-netsec/agi/eagi-sphinx-test.c b/1.2-netsec/agi/eagi-sphinx-test.c
deleted file mode 100644
index 95c47c909..000000000
--- a/1.2-netsec/agi/eagi-sphinx-test.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Extended AGI test application
- *
- * This code is released into public domain
- * without any warranty of any kind.
- *
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/select.h>
-#include <fcntl.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <asterisk/compat.h>
-
-#define AUDIO_FILENO (STDERR_FILENO + 1)
-
-#define SPHINX_HOST "192.168.1.108"
-#define SPHINX_PORT 3460
-
-static int sphinx_sock = -1;
-
-static int connect_sphinx(void)
-{
- struct hostent *hp;
- struct sockaddr_in sin;
- int res;
- hp = gethostbyname(SPHINX_HOST);
- if (!hp) {
- fprintf(stderr, "Unable to resolve '%s'\n", SPHINX_HOST);
- return -1;
- }
- sphinx_sock = socket(PF_INET, SOCK_STREAM, 0);
- if (sphinx_sock < 0) {
- fprintf(stderr, "Unable to allocate socket: %s\n", strerror(errno));
- return -1;
- }
- memset(&sin, 0, sizeof(sin));
- sin.sin_family = AF_INET;
- sin.sin_port = htons(SPHINX_PORT);
- memcpy(&sin.sin_addr, hp->h_addr, sizeof(sin.sin_addr));
- if (connect(sphinx_sock, (struct sockaddr *)&sin, sizeof(sin))) {
- fprintf(stderr, "Unable to connect on socket: %s\n", strerror(errno));
- close(sphinx_sock);
- sphinx_sock = -1;
- return -1;
- }
- res = fcntl(sphinx_sock, F_GETFL);
- if ((res < 0) || (fcntl(sphinx_sock, F_SETFL, res | O_NONBLOCK) < 0)) {
- fprintf(stderr, "Unable to set flags on socket: %s\n", strerror(errno));
- close(sphinx_sock);
- sphinx_sock = -1;
- return -1;
- }
- return 0;
-}
-
-static int read_environment(void)
-{
- char buf[256];
- char *val;
- /* Read environment */
- for(;;) {
- fgets(buf, sizeof(buf), stdin);
- if (feof(stdin))
- return -1;
- buf[strlen(buf) - 1] = '\0';
- /* Check for end of environment */
- if (!strlen(buf))
- return 0;
- val = strchr(buf, ':');
- if (!val) {
- fprintf(stderr, "Invalid environment: '%s'\n", buf);
- return -1;
- }
- *val = '\0';
- val++;
- val++;
- /* Skip space */
- fprintf(stderr, "Environment: '%s' is '%s'\n", buf, val);
-
- /* Load into normal environment */
- setenv(buf, val, 1);
-
- }
- /* Never reached */
- return 0;
-}
-
-static char *wait_result(void)
-{
- fd_set fds;
- int res;
- int max;
- static char astresp[256];
- static char sphinxresp[256];
- char audiobuf[4096];
- for (;;) {
- FD_ZERO(&fds);
- FD_SET(STDIN_FILENO, &fds);
- FD_SET(AUDIO_FILENO, &fds);
- max = AUDIO_FILENO;
- if (sphinx_sock > -1) {
- FD_SET(sphinx_sock, &fds);
- if (sphinx_sock > max)
- max = sphinx_sock;
- }
- /* Wait for *some* sort of I/O */
- res = select(max + 1, &fds, NULL, NULL, NULL);
- if (res < 0) {
- fprintf(stderr, "Error in select: %s\n", strerror(errno));
- return NULL;
- }
- if (FD_ISSET(STDIN_FILENO, &fds)) {
- fgets(astresp, sizeof(astresp), stdin);
- if (feof(stdin)) {
- fprintf(stderr, "Got hungup on apparently\n");
- return NULL;
- }
- astresp[strlen(astresp) - 1] = '\0';
- fprintf(stderr, "Ooh, got a response from Asterisk: '%s'\n", astresp);
- return astresp;
- }
- if (FD_ISSET(AUDIO_FILENO, &fds)) {
- res = read(AUDIO_FILENO, audiobuf, sizeof(audiobuf));
- if (res > 0) {
- if (sphinx_sock > -1)
- write(sphinx_sock, audiobuf, res);
- }
- }
- if ((sphinx_sock > -1) && FD_ISSET(sphinx_sock, &fds)) {
- res = read(sphinx_sock, sphinxresp, sizeof(sphinxresp));
- if (res > 0) {
- fprintf(stderr, "Oooh, Sphinx found a token: '%s'\n", sphinxresp);
- return sphinxresp;
- } else if (res == 0) {
- fprintf(stderr, "Hrm, lost sphinx, guess we're on our own\n");
- close(sphinx_sock);
- sphinx_sock = -1;
- }
- }
- }
-
-}
-
-static char *run_command(char *command)
-{
- fprintf(stdout, "%s\n", command);
- return wait_result();
-}
-
-static int run_script(void)
-{
- char *res;
- res = run_command("STREAM FILE demo-enterkeywords 0123456789*#");
- if (!res) {
- fprintf(stderr, "Failed to execute command\n");
- return -1;
- }
- fprintf(stderr, "1. Result is '%s'\n", res);
- res = run_command("STREAM FILE demo-nomatch 0123456789*#");
- if (!res) {
- fprintf(stderr, "Failed to execute command\n");
- return -1;
- }
- fprintf(stderr, "2. Result is '%s'\n", res);
- res = run_command("SAY NUMBER 23452345 0123456789*#");
- if (!res) {
- fprintf(stderr, "Failed to execute command\n");
- return -1;
- }
- fprintf(stderr, "3. Result is '%s'\n", res);
- res = run_command("GET DATA demo-enterkeywords");
- if (!res) {
- fprintf(stderr, "Failed to execute command\n");
- return -1;
- }
- fprintf(stderr, "4. Result is '%s'\n", res);
- res = run_command("STREAM FILE auth-thankyou \"\"");
- if (!res) {
- fprintf(stderr, "Failed to execute command\n");
- return -1;
- }
- fprintf(stderr, "5. Result is '%s'\n", res);
- return 0;
-}
-
-int main(int argc, char *argv[])
-{
- char *tmp;
- int ver = 0;
- int subver = 0;
- /* Setup stdin/stdout for line buffering */
- setlinebuf(stdin);
- setlinebuf(stdout);
- if (read_environment()) {
- fprintf(stderr, "Failed to read environment: %s\n", strerror(errno));
- exit(1);
- }
- connect_sphinx();
- tmp = getenv("agi_enhanced");
- if (tmp) {
- if (sscanf(tmp, "%d.%d", &ver, &subver) != 2)
- ver = 0;
- }
- if (ver < 1) {
- fprintf(stderr, "No enhanced AGI services available. Use EAGI, not AGI\n");
- exit(1);
- }
- if (run_script())
- return -1;
- exit(0);
-}
diff --git a/1.2-netsec/agi/eagi-test.c b/1.2-netsec/agi/eagi-test.c
deleted file mode 100644
index 5ba28f9c6..000000000
--- a/1.2-netsec/agi/eagi-test.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Extended AGI test application
- *
- * This code is released into the public domain
- * with no warranty of any kind
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/select.h>
-#include <asterisk/compat.h>
-
-#define AUDIO_FILENO (STDERR_FILENO + 1)
-
-static int read_environment(void)
-{
- char buf[256];
- char *val;
- /* Read environment */
- for(;;) {
- fgets(buf, sizeof(buf), stdin);
- if (feof(stdin))
- return -1;
- buf[strlen(buf) - 1] = '\0';
- /* Check for end of environment */
- if (!strlen(buf))
- return 0;
- val = strchr(buf, ':');
- if (!val) {
- fprintf(stderr, "Invalid environment: '%s'\n", buf);
- return -1;
- }
- *val = '\0';
- val++;
- val++;
- /* Skip space */
- fprintf(stderr, "Environment: '%s' is '%s'\n", buf, val);
-
- /* Load into normal environment */
- setenv(buf, val, 1);
-
- }
- /* Never reached */
- return 0;
-}
-
-static char *wait_result(void)
-{
- fd_set fds;
- int res;
- int bytes = 0;
- static char astresp[256];
- char audiobuf[4096];
- for (;;) {
- FD_ZERO(&fds);
- FD_SET(STDIN_FILENO, &fds);
- FD_SET(AUDIO_FILENO, &fds);
- /* Wait for *some* sort of I/O */
- res = select(AUDIO_FILENO + 1, &fds, NULL, NULL, NULL);
- if (res < 0) {
- fprintf(stderr, "Error in select: %s\n", strerror(errno));
- return NULL;
- }
- if (FD_ISSET(STDIN_FILENO, &fds)) {
- fgets(astresp, sizeof(astresp), stdin);
- if (feof(stdin)) {
- fprintf(stderr, "Got hungup on apparently\n");
- return NULL;
- }
- astresp[strlen(astresp) - 1] = '\0';
- fprintf(stderr, "Ooh, got a response from Asterisk: '%s'\n", astresp);
- return astresp;
- }
- if (FD_ISSET(AUDIO_FILENO, &fds)) {
- res = read(AUDIO_FILENO, audiobuf, sizeof(audiobuf));
- if (res > 0) {
- /* XXX Process the audio with sphinx here XXX */
-#if 0
- fprintf(stderr, "Got %d/%d bytes of audio\n", res, bytes);
-#endif
- bytes += res;
- /* Prentend we detected some audio after 3 seconds */
- if (bytes > 16000 * 3) {
- return "Sample Message";
- bytes = 0;
- }
- }
- }
- }
-
-}
-
-static char *run_command(char *command)
-{
- fprintf(stdout, "%s\n", command);
- return wait_result();
-}
-
-static int run_script(void)
-{
- char *res;
- res = run_command("STREAM FILE demo-enterkeywords 0123456789*#");
- if (!res) {
- fprintf(stderr, "Failed to execute command\n");
- return -1;
- }
- fprintf(stderr, "1. Result is '%s'\n", res);
- res = run_command("STREAM FILE demo-nomatch 0123456789*#");
- if (!res) {
- fprintf(stderr, "Failed to execute command\n");
- return -1;
- }
- fprintf(stderr, "2. Result is '%s'\n", res);
- res = run_command("SAY NUMBER 23452345 0123456789*#");
- if (!res) {
- fprintf(stderr, "Failed to execute command\n");
- return -1;
- }
- fprintf(stderr, "3. Result is '%s'\n", res);
- res = run_command("GET DATA demo-enterkeywords");
- if (!res) {
- fprintf(stderr, "Failed to execute command\n");
- return -1;
- }
- fprintf(stderr, "4. Result is '%s'\n", res);
- res = run_command("STREAM FILE auth-thankyou \"\"");
- if (!res) {
- fprintf(stderr, "Failed to execute command\n");
- return -1;
- }
- fprintf(stderr, "5. Result is '%s'\n", res);
- return 0;
-}
-
-int main(int argc, char *argv[])
-{
- char *tmp;
- int ver = 0;
- int subver = 0;
- /* Setup stdin/stdout for line buffering */
- setlinebuf(stdin);
- setlinebuf(stdout);
- if (read_environment()) {
- fprintf(stderr, "Failed to read environment: %s\n", strerror(errno));
- exit(1);
- }
- tmp = getenv("agi_enhanced");
- if (tmp) {
- if (sscanf(tmp, "%d.%d", &ver, &subver) != 2)
- ver = 0;
- }
- if (ver < 1) {
- fprintf(stderr, "No enhanced AGI services available. Use EAGI, not AGI\n");
- exit(1);
- }
- if (run_script())
- return -1;
- exit(0);
-}
diff --git a/1.2-netsec/agi/fastagi-test b/1.2-netsec/agi/fastagi-test
deleted file mode 100644
index d3f13cf6b..000000000
--- a/1.2-netsec/agi/fastagi-test
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/usr/bin/perl
-use strict;
-use Socket;
-use Carp;
-use IO::Handle;
-
-my $port = 4573;
-
-$|=1;
-
-# Setup some variables
-my %AGI; my $tests = 0; my $fail = 0; my $pass = 0;
-
-sub checkresult {
- my ($res) = @_;
- my $retval;
- $tests++;
- chomp $res;
- if ($res =~ /^200/) {
- $res =~ /result=(-?\d+)/;
- if (!length($1)) {
- print STDERR "FAIL ($res)\n";
- $fail++;
- } else {
- print STDERR "PASS ($1)\n";
- $pass++;
- }
- } else {
- print STDERR "FAIL (unexpected result '$res')\n";
- $fail++;
- }
-}
-
-socket(SERVER, PF_INET, SOCK_STREAM, 0);
-setsockopt(SERVER, SOL_SOCKET, SO_REUSEADDR, pack("l", 1));
-bind(SERVER, sockaddr_in($port, INADDR_ANY)) || die("can't bind\n");
-listen(SERVER, SOMAXCONN);
-
-for(;;) {
- my $raddr = accept(CLIENT, SERVER);
- my ($s, $p) = sockaddr_in($raddr);
- CLIENT->autoflush(1);
- while(<CLIENT>) {
- chomp;
- last unless length($_);
- if (/^agi_(\w+)\:\s+(.*)$/) {
- $AGI{$1} = $2;
- }
- }
- print STDERR "AGI Environment Dump from $s:$p --\n";
- foreach my $i (sort keys %AGI) {
- print STDERR " -- $i = $AGI{$i}\n";
- }
-
- print STDERR "1. Testing 'sendfile'...";
- print CLIENT "STREAM FILE beep \"\"\n";
- my $result = <CLIENT>;
- &checkresult($result);
-
- print STDERR "2. Testing 'sendtext'...";
- print CLIENT "SEND TEXT \"hello world\"\n";
- my $result = <CLIENT>;
- &checkresult($result);
-
- print STDERR "3. Testing 'sendimage'...";
- print CLIENT "SEND IMAGE asterisk-image\n";
- my $result = <CLIENT>;
- &checkresult($result);
-
- print STDERR "4. Testing 'saynumber'...";
- print CLIENT "SAY NUMBER 192837465 \"\"\n";
- my $result = <CLIENT>;
- &checkresult($result);
-
- print STDERR "5. Testing 'waitdtmf'...";
- print CLIENT "WAIT FOR DIGIT 1000\n";
- my $result = <CLIENT>;
- &checkresult($result);
-
- print STDERR "6. Testing 'record'...";
- print CLIENT "RECORD FILE testagi gsm 1234 3000\n";
- my $result = <CLIENT>;
- &checkresult($result);
-
- print STDERR "6a. Testing 'record' playback...";
- print CLIENT "STREAM FILE testagi \"\"\n";
- my $result = <CLIENT>;
- &checkresult($result);
- close(CLIENT);
- print STDERR "================== Complete ======================\n";
- print STDERR "$tests tests completed, $pass passed, $fail failed\n";
- print STDERR "==================================================\n";
-}
-
diff --git a/1.2-netsec/agi/numeralize b/1.2-netsec/agi/numeralize
deleted file mode 100644
index 5ca51913d..000000000
--- a/1.2-netsec/agi/numeralize
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/usr/bin/perl
-#
-# Build a database linking filenames to their numerical representations
-# using a keypad for the DialAnMp3 application
-#
-
-$mp3dir="/usr/media/mpeg3";
-
-dbmopen(%DIGITS, "/var/lib/asterisk/mp3list", 0644) || die("Unable to open mp3list");;
-sub process_dir {
- my ($dir) = @_;
- my $file;
- my $digits;
- my @entries;
- opendir(DIR, $dir);
- @entries = readdir(DIR);
- closedir(DIR);
- foreach $_ (@entries) {
- if (!/^\./) {
- $file = "$dir/$_";
- if (-d "$file") {
- process_dir("$file");
- } else {
- $digits = $_;
- $digits =~ s/[^ \w]+//g;
- $digits =~ s/\_/ /g;
- $digits =~ tr/[a-z]/[A-Z]/;
- $digits =~ tr/[A-C]/2/;
- $digits =~ tr/[D-F]/3/;
- $digits =~ tr/[G-I]/4/;
- $digits =~ tr/[J-L]/5/;
- $digits =~ tr/[M-O]/6/;
- $digits =~ tr/[P-S]/7/;
- $digits =~ tr/[T-V]/8/;
- $digits =~ tr/[W-Z]/9/;
- $digits =~ s/\s+/ /;
- print "File: $file, digits: $digits\n";
- $DIGITS{$file} = $digits;
- }
- }
- }
-}
-
-process_dir($mp3dir);
diff --git a/1.2-netsec/alaw.c b/1.2-netsec/alaw.c
deleted file mode 100644
index a85c89f3d..000000000
--- a/1.2-netsec/alaw.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Asterisk -- An open source telephony toolkit.
- *
- * Copyright (C) 1999 - 2005, Digium, Inc.
- *
- * Mark Spencer <markster@digium.com>
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE file
- * at the top of the source tree.
- */
-
-/*! \file
- *
- * \brief u-Law to Signed linear conversion
- *
- */
-
-#include "asterisk.h"
-
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-
-#include "asterisk/alaw.h"
-
-#define AMI_MASK 0x55
-
-static inline unsigned char linear2alaw (short int linear)
-{
- int mask;
- int seg;
- int pcm_val;
- static int seg_end[8] =
- {
- 0xFF, 0x1FF, 0x3FF, 0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF
- };
-
- pcm_val = linear;
- if (pcm_val >= 0)
- {
- /* Sign (7th) bit = 1 */
- mask = AMI_MASK | 0x80;
- }
- else
- {
- /* Sign bit = 0 */
- mask = AMI_MASK;
- pcm_val = -pcm_val;
- }
-
- /* Convert the scaled magnitude to segment number. */
- for (seg = 0; seg < 8; seg++)
- {
- if (pcm_val <= seg_end[seg])
- break;
- }
- /* Combine the sign, segment, and quantization bits. */
- return ((seg << 4) | ((pcm_val >> ((seg) ? (seg + 3) : 4)) & 0x0F)) ^ mask;
-}
-/*- End of function --------------------------------------------------------*/
-
-static inline short int alaw2linear (unsigned char alaw)
-{
- int i;
- int seg;
-
- alaw ^= AMI_MASK;
- i = ((alaw & 0x0F) << 4);
- seg = (((int) alaw & 0x70) >> 4);
- if (seg)
- i = (i + 0x100) << (seg - 1);
- return (short int) ((alaw & 0x80) ? i : -i);
-}
-
-unsigned char __ast_lin2a[8192];
-short __ast_alaw[256];
-
-void ast_alaw_init(void)
-{
- int i;
- /*
- * Set up mu-law conversion table
- */
- for(i = 0;i < 256;i++)
- {
- __ast_alaw[i] = alaw2linear(i);
- }
- /* set up the reverse (mu-law) conversion table */
- for(i = -32768; i < 32768; i++)
- {
- __ast_lin2a[((unsigned short)i) >> 3] = linear2alaw(i);
- }
-
-}
-
diff --git a/1.2-netsec/app.c b/1.2-netsec/app.c
deleted file mode 100644
index b7bc31fe1..000000000
--- a/1.2-netsec/app.c
+++ /dev/null
@@ -1,1558 +0,0 @@
-/*
- * Asterisk -- An open source telephony toolkit.
- *
- * Copyright (C) 1999 - 2005, Digium, Inc.
- *
- * Mark Spencer <markster@digium.com>
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE file
- * at the top of the source tree.
- */
-
-/*! \file
- *
- * \brief Convenient Application Routines
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/time.h>
-#include <signal.h>
-#include <errno.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <regex.h>
-
-#include "asterisk.h"
-
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-
-#include "asterisk/channel.h"
-#include "asterisk/pbx.h"
-#include "asterisk/file.h"
-#include "asterisk/app.h"
-#include "asterisk/dsp.h"
-#include "asterisk/logger.h"
-#include "asterisk/options.h"
-#include "asterisk/utils.h"
-#include "asterisk/lock.h"
-#include "asterisk/indications.h"
-
-#define MAX_OTHER_FORMATS 10
-
-
-/* !
-This function presents a dialtone and reads an extension into 'collect'
-which must be a pointer to a **pre-initilized** array of char having a
-size of 'size' suitable for writing to. It will collect no more than the smaller
-of 'maxlen' or 'size' minus the original strlen() of collect digits.
-\return 0 if extension does not exist, 1 if extension exists
-*/
-int ast_app_dtget(struct ast_channel *chan, const char *context, char *collect, size_t size, int maxlen, int timeout)
-{
- struct tone_zone_sound *ts;
- int res=0, x=0;
-
- if(maxlen > size)
- maxlen = size;
-
- if(!timeout && chan->pbx)
- timeout = chan->pbx->dtimeout;
- else if(!timeout)
- timeout = 5;
-
- ts = ast_get_indication_tone(chan->zone,"dial");
- if (ts && ts->data[0])
- res = ast_playtones_start(chan, 0, ts->data, 0);
- else
- ast_log(LOG_NOTICE,"Huh....? no dial for indications?\n");
-
- for (x = strlen(collect); strlen(collect) < maxlen; ) {
- res = ast_waitfordigit(chan, timeout);
- if (!ast_ignore_pattern(context, collect))
- ast_playtones_stop(chan);
- if (res < 1)
- break;
- collect[x++] = res;
- if (!ast_matchmore_extension(chan, context, collect, 1, chan->cid.cid_num)) {
- if (collect[x-1] == '#') {
- /* Not a valid extension, ending in #, assume the # was to finish dialing */
- collect[x-1] = '\0';
- }
- break;
- }
- }
- if (res >= 0) {
- if (ast_exists_extension(chan, context, collect, 1, chan->cid.cid_num))
- res = 1;
- else
- res = 0;
- }
- return res;
-}
-
-
-
-/*! \param timeout set timeout to 0 for "standard" timeouts. Set timeout to -1 for
- "ludicrous time" (essentially never times out) */
-int ast_app_getdata(struct ast_channel *c, char *prompt, char *s, int maxlen, int timeout)
-{
- int res,to,fto;
- /* XXX Merge with full version? XXX */
- if (maxlen)
- s[0] = '\0';
- if (prompt) {
- res = ast_streamfile(c, prompt, c->language);
- if (res < 0)
- return res;
- }
- fto = c->pbx ? c->pbx->rtimeout * 1000 : 6000;
- to = c->pbx ? c->pbx->dtimeout * 1000 : 2000;
-
- if (timeout > 0)
- fto = to = timeout;
- if (timeout < 0)
- fto = to = 1000000000;
- res = ast_readstring(c, s, maxlen, to, fto, "#");
- return res;
-}
-
-
-int ast_app_getdata_full(struct ast_channel *c, char *prompt, char *s, int maxlen, int timeout, int audiofd, int ctrlfd)
-{
- int res,to,fto;
- if (prompt) {
- res = ast_streamfile(c, prompt, c->language);
- if (res < 0)
- return res;
- }
- fto = 6000;
- to = 2000;
- if (timeout > 0)
- fto = to = timeout;
- if (timeout < 0)
- fto = to = 1000000000;
- res = ast_readstring_full(c, s, maxlen, to, fto, "#", audiofd, ctrlfd);
- return res;
-}
-
-int ast_app_getvoice(struct ast_channel *c, char *dest, char *dstfmt, char *prompt, int silence, int maxsec)
-{
- int res;
- struct ast_filestream *writer;
- int rfmt;
- int totalms=0, total;
-
- struct ast_frame *f;
- struct ast_dsp *sildet;
- /* Play prompt if requested */
- if (prompt) {
- res = ast_streamfile(c, prompt, c->language);
- if (res < 0)
- return res;
- res = ast_waitstream(c,"");
- if (res < 0)
- return res;
- }
- rfmt = c->readformat;
- res = ast_set_read_format(c, AST_FORMAT_SLINEAR);
- if (res < 0) {
- ast_log(LOG_WARNING, "Unable to set to linear mode, giving up\n");
- return -1;
- }
- sildet = ast_dsp_new();
- if (!sildet) {
- ast_log(LOG_WARNING, "Unable to create silence detector :(\n");
- return -1;
- }
- writer = ast_writefile(dest, dstfmt, "Voice file", 0, 0, 0666);
- if (!writer) {
- ast_log(LOG_WARNING, "Unable to open file '%s' in format '%s' for writing\n", dest, dstfmt);
- ast_dsp_free(sildet);
- return -1;
- }
- for(;;) {
- if ((res = ast_waitfor(c, 2000)) < 0) {
- ast_log(LOG_NOTICE, "Waitfor failed while recording file '%s' format '%s'\n", dest, dstfmt);
- break;
- }
- if (res) {
- f = ast_read(c);
- if (!f) {
- ast_log(LOG_NOTICE, "Hungup while recording file '%s' format '%s'\n", dest, dstfmt);
- break;
- }
- if ((f->frametype == AST_FRAME_DTMF) && (f->subclass == '#')) {
- /* Ended happily with DTMF */
- ast_frfree(f);
- break;
- } else if (f->frametype == AST_FRAME_VOICE) {
- ast_dsp_silence(sildet, f, &total);
- if (total > silence) {
- /* Ended happily with silence */
- ast_frfree(f);
- break;
- }
- totalms += f->samples / 8;
- if (totalms > maxsec * 1000) {
- /* Ended happily with too much stuff */
- ast_log(LOG_NOTICE, "Constraining voice on '%s' to %d seconds\n", c->name, maxsec);
- ast_frfree(f);
- break;
- }
- res = ast_writestream(writer, f);
- if (res < 0) {
- ast_log(LOG_WARNING, "Failed to write to stream at %s!\n", dest);
- ast_frfree(f);
- break;
- }
-
- }
- ast_frfree(f);
- }
- }
- res = ast_set_read_format(c, rfmt);
- if (res)
- ast_log(LOG_WARNING, "Unable to restore read format on '%s'\n", c->name);
- ast_dsp_free(sildet);
- ast_closestream(writer);
- return 0;
-}
-
-static int (*ast_has_voicemail_func)(const char *mailbox, const char *folder) = NULL;
-static int (*ast_messagecount_func)(const char *mailbox, int *newmsgs, int *oldmsgs) = NULL;
-
-void ast_install_vm_functions(int (*has_voicemail_func)(const char *mailbox, const char *folder),
- int (*messagecount_func)(const char *mailbox, int *newmsgs, int *oldmsgs))
-{
- ast_has_voicemail_func = has_voicemail_func;
- ast_messagecount_func = messagecount_func;
-}
-
-void ast_uninstall_vm_functions(void)
-{
- ast_has_voicemail_func = NULL;
- ast_messagecount_func = NULL;
-}
-
-int ast_app_has_voicemail(const char *mailbox, const char *folder)
-{
- static int warned = 0;
- if (ast_has_voicemail_func)
- return ast_has_voicemail_func(mailbox, folder);
-
- if ((option_verbose > 2) && !warned) {
- ast_verbose(VERBOSE_PREFIX_3 "Message check requested for mailbox %s/folder %s but voicemail not loaded.\n", mailbox, folder ? folder : "INBOX");
- warned++;
- }
- return 0;
-}
-
-
-int ast_app_messagecount(const char *mailbox, int *newmsgs, int *oldmsgs)
-{
- static int warned = 0;
- if (newmsgs)
- *newmsgs = 0;
- if (oldmsgs)
- *oldmsgs = 0;
- if (ast_messagecount_func)
- return ast_messagecount_func(mailbox, newmsgs, oldmsgs);
-
- if (!warned && (option_verbose > 2)) {
- warned++;
- ast_verbose(VERBOSE_PREFIX_3 "Message count requested for mailbox %s but voicemail not loaded.\n", mailbox);
- }
-
- return 0;
-}
-
-int ast_dtmf_stream(struct ast_channel *chan,struct ast_channel *peer,char *digits,int between)
-{
- char *ptr;
- int res = 0;
- struct ast_frame f;
- if (!between)
- between = 100;
-
- if (peer)
- res = ast_autoservice_start(peer);
-
- if (!res) {
- res = ast_waitfor(chan,100);
- if (res > -1) {
- for (ptr=digits; *ptr; ptr++) {
- if (*ptr == 'w') {
- res = ast_safe_sleep(chan, 500);
- if (res)
- break;
- continue;
- }
- memset(&f, 0, sizeof(f));
- f.frametype = AST_FRAME_DTMF;
- f.subclass = *ptr;
- f.src = "ast_dtmf_stream";
- if (strchr("0123456789*#abcdABCD",*ptr)==NULL) {
- ast_log(LOG_WARNING, "Illegal DTMF character '%c' in string. (0-9*#aAbBcCdD allowed)\n",*ptr);
- } else {
- res = ast_write(chan, &f);
- if (res)
- break;
- /* pause between digits */
- res = ast_safe_sleep(chan,between);
- if (res)
- break;
- }
- }
- }
- if (peer) {
- /* Stop autoservice on the peer channel, but don't overwrite any error condition
- that has occurred previously while acting on the primary channel */
- if (ast_autoservice_stop(peer) && !res)
- res = -1;
- }
- }
- return res;
-}
-
-struct linear_state {
- int fd;
- int autoclose;
- int allowoverride;
- int origwfmt;
-};
-
-static void linear_release(struct ast_channel *chan, void *params)
-{
- struct linear_state *ls = params;
- if (ls->origwfmt && ast_set_write_format(chan, ls->origwfmt)) {
- ast_log(LOG_WARNING, "Unable to restore channel '%s' to format '%d'\n", chan->name, ls->origwfmt);
- }
- if (ls->autoclose)
- close(ls->fd);
- free(params);
-}
-
-static int linear_generator(struct ast_channel *chan, void *data, int len, int samples)
-{
- struct ast_frame f;
- short buf[2048 + AST_FRIENDLY_OFFSET / 2];
- struct linear_state *ls = data;
- int res;
- len = samples * 2;
- if (len > sizeof(buf) - AST_FRIENDLY_OFFSET) {
- ast_log(LOG_WARNING, "Can't generate %d bytes of data!\n" ,len);
- len = sizeof(buf) - AST_FRIENDLY_OFFSET;
- }
- memset(&f, 0, sizeof(f));
- res = read(ls->fd, buf + AST_FRIENDLY_OFFSET/2, len);
- if (res > 0) {
- f.frametype = AST_FRAME_VOICE;
- f.subclass = AST_FORMAT_SLINEAR;
- f.data = buf + AST_FRIENDLY_OFFSET/2;
- f.datalen = res;
- f.samples = res / 2;
- f.offset = AST_FRIENDLY_OFFSET;
- ast_write(chan, &f);
- if (res == len)
- return 0;
- }
- return -1;
-}
-
-static void *linear_alloc(struct ast_channel *chan, void *params)
-{
- struct linear_state *ls;
- /* In this case, params is already malloc'd */
- if (params) {
- ls = params;
- if (ls->allowoverride)
- ast_set_flag(chan, AST_FLAG_WRITE_INT);
- else
- ast_clear_flag(chan, AST_FLAG_WRITE_INT);
- ls->origwfmt = chan->writeformat;
- if (ast_set_write_format(chan, AST_FORMAT_SLINEAR)) {
- ast_log(LOG_WARNING, "Unable to set '%s' to linear format (write)\n", chan->name);
- free(ls);
- ls = params = NULL;
- }
- }
- return params;
-}
-
-static struct ast_generator linearstream =
-{
- alloc: linear_alloc,
- release: linear_release,
- generate: linear_generator,
-};
-
-int ast_linear_stream(struct ast_channel *chan, const char *filename, int fd, int allowoverride)
-{
- struct linear_state *lin;
- char tmpf[256];
- int res = -1;
- int autoclose = 0;
- if (fd < 0) {
- if (ast_strlen_zero(filename))
- return -1;
- autoclose = 1;
- if (filename[0] == '/')
- ast_copy_string(tmpf, filename, sizeof(tmpf));
- else
- snprintf(tmpf, sizeof(tmpf), "%s/%s/%s", (char *)ast_config_AST_VAR_DIR, "sounds", filename);
- fd = open(tmpf, O_RDONLY);
- if (fd < 0){
- ast_log(LOG_WARNING, "Unable to open file '%s': %s\n", tmpf, strerror(errno));
- return -1;
- }
- }
- lin = malloc(sizeof(struct linear_state));
- if (lin) {
- memset(lin, 0, sizeof(lin));
- lin->fd = fd;
- lin->allowoverride = allowoverride;
- lin->autoclose = autoclose;
- res = ast_activate_generator(chan, &linearstream, lin);
- }
- return res;
-}
-
-int ast_control_streamfile(struct ast_channel *chan, const char *file,
- const char *fwd, const char *rev,
- const char *stop, const char *pause,
- const char *restart, int skipms)
-{
- char *breaks = NULL;
- char *end = NULL;
- int blen = 2;
- int res;
- long pause_restart_point = 0;
-
- if (stop)
- blen += strlen(stop);
- if (pause)
- blen += strlen(pause);
- if (restart)
- blen += strlen(restart);
-
- if (blen > 2) {
- breaks = alloca(blen + 1);
- breaks[0] = '\0';
- if (stop)
- strcat(breaks, stop);
- if (pause)
- strcat(breaks, pause);
- if (restart)
- strcat(breaks, restart);
- }
- if (chan->_state != AST_STATE_UP)
- res = ast_answer(chan);
-
- if (file) {
- if ((end = strchr(file,':'))) {
- if (!strcasecmp(end, ":end")) {
- *end = '\0';
- end++;
- }
- }
- }
-
- for (;;) {
- ast_stopstream(chan);
- res = ast_streamfile(chan, file, chan->language);
- if (!res) {
- if (pause_restart_point) {
- ast_seekstream(chan->stream, pause_restart_point, SEEK_SET);
- pause_restart_point = 0;
- }
- else if (end) {
- ast_seekstream(chan->stream, 0, SEEK_END);
- end = NULL;
- };
- res = ast_waitstream_fr(chan, breaks, fwd, rev, skipms);
- }
-
- if (res < 1)
- break;
-
- /* We go at next loop if we got the restart char */
- if (restart && strchr(restart, res)) {
- ast_log(LOG_DEBUG, "we'll restart the stream here at next loop\n");
- pause_restart_point = 0;
- continue;
- }
-
- if (pause && strchr(pause, res)) {
- pause_restart_point = ast_tellstream(chan->stream);
- for (;;) {
- ast_stopstream(chan);
- res = ast_waitfordigit(chan, 1000);
- if (!res)
- continue;
- else if (res == -1 || strchr(pause, res) || (stop && strchr(stop, res)))
- break;
- }
- if (res == *pause) {
- res = 0;
- continue;
- }
- }
-
- if (res == -1)
- break;
-
- /* if we get one of our stop chars, return it to the calling function */
- if (stop && strchr(stop, res))
- break;
- }
-
- ast_stopstream(chan);
-
- return res;
-}
-
-int ast_play_and_wait(struct ast_channel *chan, const char *fn)
-{
- int d;
- d = ast_streamfile(chan, fn, chan->language);
- if (d)
- return d;
- d = ast_waitstream(chan, AST_DIGIT_ANY);
- ast_stopstream(chan);
- return d;
-}
-
-static int global_silence_threshold = 128;
-static int global_maxsilence = 0;
-
-int ast_play_and_record(struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime, const char *fmt, int *duration, int silencethreshold, int maxsilence, const char *path)
-{
- int d;
- char *fmts;
- char comment[256];
- int x, fmtcnt=1, res=-1,outmsg=0;
- struct ast_frame *f;
- struct ast_filestream *others[MAX_OTHER_FORMATS];
- char *sfmt[MAX_OTHER_FORMATS];
- char *stringp=NULL;
- time_t start, end;
- struct ast_dsp *sildet=NULL; /* silence detector dsp */
- int totalsilence = 0;
- int dspsilence = 0;
- int gotsilence = 0; /* did we timeout for silence? */
- int rfmt=0;
- struct ast_silence_generator *silgen = NULL;
-
- if (silencethreshold < 0)
- silencethreshold = global_silence_threshold;
-
- if (maxsilence < 0)
- maxsilence = global_maxsilence;
-
- /* barf if no pointer passed to store duration in */
- if (duration == NULL) {
- ast_log(LOG_WARNING, "Error play_and_record called without duration pointer\n");
- return -1;
- }
-
- ast_log(LOG_DEBUG,"play_and_record: %s, %s, '%s'\n", playfile ? playfile : "<None>", recordfile, fmt);
- snprintf(comment,sizeof(comment),"Playing %s, Recording to: %s on %s\n", playfile ? playfile : "<None>", recordfile, chan->name);
-
- if (playfile) {
- d = ast_play_and_wait(chan, playfile);
- if (d > -1)
- d = ast_streamfile(chan, "beep",chan->language);
- if (!d)
- d = ast_waitstream(chan,"");
- if (d < 0)
- return -1;
- }
-
- fmts = ast_strdupa(fmt);
-
- stringp=fmts;
- strsep(&stringp, "|");
- ast_log(LOG_DEBUG,"Recording Formats: sfmts=%s\n", fmts);
- sfmt[0] = ast_strdupa(fmts);
-
- while((fmt = strsep(&stringp, "|"))) {
- if (fmtcnt > MAX_OTHER_FORMATS - 1) {
- ast_log(LOG_WARNING, "Please increase MAX_OTHER_FORMATS in app.c\n");
- break;
- }
- sfmt[fmtcnt++] = ast_strdupa(fmt);
- }
-
- time(&start);
- end=start; /* pre-initialize end to be same as start in case we never get into loop */
- for (x=0;x<fmtcnt;x++) {
- others[x] = ast_writefile(recordfile, sfmt[x], comment, O_TRUNC, 0, 0700);
- ast_verbose( VERBOSE_PREFIX_3 "x=%d, open writing: %s format: %s, %p\n", x, recordfile, sfmt[x], others[x]);
-
- if (!others[x]) {
- break;
- }
- }
-
- if (path)
- ast_unlock_path(path);
-
- if (maxsilence > 0) {
- sildet = ast_dsp_new(); /* Create the silence detector */
- if (!sildet) {
- ast_log(LOG_WARNING, "Unable to create silence detector :(\n");
- return -1;
- }
- ast_dsp_set_threshold(sildet, silencethreshold);
- rfmt = chan->readformat;
- res = ast_set_read_format(chan, AST_FORMAT_SLINEAR);
- if (res < 0) {
- ast_log(LOG_WARNING, "Unable to set to linear mode, giving up\n");
- ast_dsp_free(sildet);
- return -1;
- }
- }
-
- /* Request a video update */
- ast_indicate(chan, AST_CONTROL_VIDUPDATE);
-
- if (option_transmit_silence_during_record)
- silgen = ast_channel_start_silence_generator(chan);
-
- if (x == fmtcnt) {
- /* Loop forever, writing the packets we read to the writer(s), until
- we read a # or get a hangup */
- f = NULL;
- for(;;) {
- res = ast_waitfor(chan, 2000);
- if (!res) {
- ast_log(LOG_DEBUG, "One waitfor failed, trying another\n");
- /* Try one more time in case of masq */
- res = ast_waitfor(chan, 2000);
- if (!res) {
- ast_log(LOG_WARNING, "No audio available on %s??\n", chan->name);
- res = -1;
- }
- }
-
- if (res < 0) {
- f = NULL;
- break;
- }
- f = ast_read(chan);
- if (!f)
- break;
- if (f->frametype == AST_FRAME_VOICE) {
- /* write each format */
- for (x=0;x<fmtcnt;x++) {
- res = ast_writestream(others[x], f);
- }
-
- /* Silence Detection */
- if (maxsilence > 0) {
- dspsilence = 0;
- ast_dsp_silence(sildet, f, &dspsilence);
- if (dspsilence)
- totalsilence = dspsilence;
- else
- totalsilence = 0;
-
- if (totalsilence > maxsilence) {
- /* Ended happily with silence */
- if (option_verbose > 2)
- ast_verbose( VERBOSE_PREFIX_3 "Recording automatically stopped after a silence of %d seconds\n", totalsilence/1000);
- ast_frfree(f);
- gotsilence = 1;
- outmsg=2;
- break;
- }
- }
- /* Exit on any error */
- if (res) {
- ast_log(LOG_WARNING, "Error writing frame\n");
- ast_frfree(f);
- break;
- }
- } else if (f->frametype == AST_FRAME_VIDEO) {
- /* Write only once */
- ast_writestream(others[0], f);
- } else if (f->frametype == AST_FRAME_DTMF) {
- if (f->subclass == '#') {
- if (option_verbose > 2)
- ast_verbose( VERBOSE_PREFIX_3 "User ended message by pressing %c\n", f->subclass);
- res = '#';
- outmsg = 2;
- ast_frfree(f);
- break;
- }
- if (f->subclass == '0') {
- /* Check for a '0' during message recording also, in case caller wants operator */
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "User cancelled by pressing %c\n", f->subclass);
- res = '0';
- outmsg = 0;
- ast_frfree(f);
- break;
- }
- }
- if (maxtime) {
- time(&end);
- if (maxtime < (end - start)) {
- if (option_verbose > 2)
- ast_verbose( VERBOSE_PREFIX_3 "Took too long, cutting it short...\n");
- outmsg = 2;
- res = 't';
- ast_frfree(f);
- break;
- }
- }
- ast_frfree(f);
- }
- if (end == start) time(&end);
- if (!f) {
- if (option_verbose > 2)
- ast_verbose( VERBOSE_PREFIX_3 "User hung up\n");
- res = -1;
- outmsg=1;
- }
- } else {
- ast_log(LOG_WARNING, "Error creating writestream '%s', format '%s'\n", recordfile, sfmt[x]);
- }
-
- if (silgen)
- ast_channel_stop_silence_generator(chan, silgen);
-
- *duration = end - start;
-
- for (x=0;x<fmtcnt;x++) {
- if (!others[x])
- break;
- if (res > 0) {
- if (totalsilence)
- ast_stream_rewind(others[x], totalsilence-200);
- else
- ast_stream_rewind(others[x], 200);
- }
- ast_truncstream(others[x]);
- ast_closestream(others[x]);
- }
- if (rfmt) {
- if (ast_set_read_format(chan, rfmt)) {
- ast_log(LOG_WARNING, "Unable to restore format %s to channel '%s'\n", ast_getformatname(rfmt), chan->name);
- }
- }
- if (outmsg > 1) {
- /* Let them know recording is stopped */
- if(!ast_streamfile(chan, "auth-thankyou", chan->language))
- ast_waitstream(chan, "");
- }
- if (sildet)
- ast_dsp_free(sildet);
- return res;
-}
-
-int ast_play_and_prepend(struct ast_channel *chan, char *playfile, char *recordfile, int maxtime, char *fmt, int *duration, int beep, int silencethreshold, int maxsilence)
-{
- int d = 0;
- char *fmts;
- char comment[256];
- int x, fmtcnt=1, res=-1,outmsg=0;
- struct ast_frame *f;
- struct ast_filestream *others[MAX_OTHER_FORMATS];
- struct ast_filestream *realfiles[MAX_OTHER_FORMATS];
- char *sfmt[MAX_OTHER_FORMATS];
- char *stringp=NULL;
- time_t start, end;
- struct ast_dsp *sildet; /* silence detector dsp */
- int totalsilence = 0;
- int dspsilence = 0;
- int gotsilence = 0; /* did we timeout for silence? */
- int rfmt=0;
- char prependfile[80];
-
- if (silencethreshold < 0)
- silencethreshold = global_silence_threshold;
-
- if (maxsilence < 0)
- maxsilence = global_maxsilence;
-
- /* barf if no pointer passed to store duration in */
- if (duration == NULL) {
- ast_log(LOG_WARNING, "Error play_and_prepend called without duration pointer\n");
- return -1;
- }
-
- ast_log(LOG_DEBUG,"play_and_prepend: %s, %s, '%s'\n", playfile ? playfile : "<None>", recordfile, fmt);
- snprintf(comment,sizeof(comment),"Playing %s, Recording to: %s on %s\n", playfile ? playfile : "<None>", recordfile, chan->name);
-
- if (playfile || beep) {
- if (!beep)
- d = ast_play_and_wait(chan, playfile);
- if (d > -1)
- d = ast_streamfile(chan, "beep",chan->language);
- if (!d)
- d = ast_waitstream(chan,"");
- if (d < 0)
- return -1;
- }
- ast_copy_string(prependfile, recordfile, sizeof(prependfile));
- strncat(prependfile, "-prepend", sizeof(prependfile) - strlen(prependfile) - 1);
-
- fmts = ast_strdupa(fmt);
-
- stringp=fmts;
- strsep(&stringp, "|");
- ast_log(LOG_DEBUG,"Recording Formats: sfmts=%s\n", fmts);
- sfmt[0] = ast_strdupa(fmts);
-
- while((fmt = strsep(&stringp, "|"))) {
- if (fmtcnt > MAX_OTHER_FORMATS - 1) {
- ast_log(LOG_WARNING, "Please increase MAX_OTHER_FORMATS in app.c\n");
- break;
- }
- sfmt[fmtcnt++] = ast_strdupa(fmt);
- }
-
- time(&start);
- end=start; /* pre-initialize end to be same as start in case we never get into loop */
- for (x=0;x<fmtcnt;x++) {
- others[x] = ast_writefile(prependfile, sfmt[x], comment, O_TRUNC, 0, 0700);
- ast_verbose( VERBOSE_PREFIX_3 "x=%d, open writing: %s format: %s, %p\n", x, prependfile, sfmt[x], others[x]);
- if (!others[x]) {
- break;
- }
- }
-
- sildet = ast_dsp_new(); /* Create the silence detector */
- if (!sildet) {
- ast_log(LOG_WARNING, "Unable to create silence detector :(\n");
- return -1;
- }
- ast_dsp_set_threshold(sildet, silencethreshold);
-
- if (maxsilence > 0) {
- rfmt = chan->readformat;
- res = ast_set_read_format(chan, AST_FORMAT_SLINEAR);
- if (res < 0) {
- ast_log(LOG_WARNING, "Unable to set to linear mode, giving up\n");
- ast_dsp_free(sildet);
- return -1;
- }
- }
-
- if (x == fmtcnt) {
- /* Loop forever, writing the packets we read to the writer(s), until
- we read a # or get a hangup */
- f = NULL;
- for(;;) {
- res = ast_waitfor(chan, 2000);
- if (!res) {
- ast_log(LOG_DEBUG, "One waitfor failed, trying another\n");
- /* Try one more time in case of masq */
- res = ast_waitfor(chan, 2000);
- if (!res) {
- ast_log(LOG_WARNING, "No audio available on %s??\n", chan->name);
- res = -1;
- }
- }
-
- if (res < 0) {
- f = NULL;
- break;
- }
- f = ast_read(chan);
- if (!f)
- break;
- if (f->frametype == AST_FRAME_VOICE) {
- /* write each format */
- for (x=0;x<fmtcnt;x++) {
- if (!others[x])
- break;
- res = ast_writestream(others[x], f);
- }
-
- /* Silence Detection */
- if (maxsilence > 0) {
- dspsilence = 0;
- ast_dsp_silence(sildet, f, &dspsilence);
- if (dspsilence)
- totalsilence = dspsilence;
- else
- totalsilence = 0;
-
- if (totalsilence > maxsilence) {
- /* Ended happily with silence */
- if (option_verbose > 2)
- ast_verbose( VERBOSE_PREFIX_3 "Recording automatically stopped after a silence of %d seconds\n", totalsilence/1000);
- ast_frfree(f);
- gotsilence = 1;
- outmsg=2;
- break;
- }
- }
- /* Exit on any error */
- if (res) {
- ast_log(LOG_WARNING, "Error writing frame\n");
- ast_frfree(f);
- break;
- }
- } else if (f->frametype == AST_FRAME_VIDEO) {
- /* Write only once */
- ast_writestream(others[0], f);
- } else if (f->frametype == AST_FRAME_DTMF) {
- /* stop recording with any digit */
- if (option_verbose > 2)
- ast_verbose( VERBOSE_PREFIX_3 "User ended message by pressing %c\n", f->subclass);
- res = 't';
- outmsg = 2;
- ast_frfree(f);
- break;
- }
- if (maxtime) {
- time(&end);
- if (maxtime < (end - start)) {
- if (option_verbose > 2)
- ast_verbose( VERBOSE_PREFIX_3 "Took too long, cutting it short...\n");
- res = 't';
- outmsg=2;
- ast_frfree(f);
- break;
- }
- }
- ast_frfree(f);
- }
- if (end == start) time(&end);
- if (!f) {
- if (option_verbose > 2)
- ast_verbose( VERBOSE_PREFIX_3 "User hung up\n");
- res = -1;
- outmsg=1;
-#if 0
- /* delete all the prepend files */
- for (x=0;x<fmtcnt;x++) {
- if (!others[x])
- break;
- ast_closestream(others[x]);
- ast_filedelete(prependfile, sfmt[x]);
- }
-#endif
- }
- } else {
- ast_log(LOG_WARNING, "Error creating writestream '%s', format '%s'\n", prependfile, sfmt[x]);
- }
- ast_dsp_free(sildet);
- *duration = end - start;
-#if 0
- if (outmsg > 1) {
-#else
- if (outmsg) {
-#endif
- struct ast_frame *fr;
- for (x=0;x<fmtcnt;x++) {
- snprintf(comment, sizeof(comment), "Opening the real file %s.%s\n", recordfile, sfmt[x]);
- realfiles[x] = ast_readfile(recordfile, sfmt[x], comment, O_RDONLY, 0, 0);
- if (!others[x] || !realfiles[x])
- break;
- if (totalsilence)
- ast_stream_rewind(others[x], totalsilence-200);
- else
- ast_stream_rewind(others[x], 200);
- ast_truncstream(others[x]);
- /* add the original file too */
- while ((fr = ast_readframe(realfiles[x]))) {
- ast_writestream(others[x],fr);
- }
- ast_closestream(others[x]);
- ast_closestream(realfiles[x]);
- ast_filerename(prependfile, recordfile, sfmt[x]);
-#if 0
- ast_verbose("Recording Format: sfmts=%s, prependfile %s, recordfile %s\n", sfmt[x],prependfile,recordfile);
-#endif
- ast_filedelete(prependfile, sfmt[x]);
- }
- }
- if (rfmt) {
- if (ast_set_read_format(chan, rfmt)) {
- ast_log(LOG_WARNING, "Unable to restore format %s to channel '%s'\n", ast_getformatname(rfmt), chan->name);
- }
- }
- if (outmsg) {
- if (outmsg > 1) {
- /* Let them know it worked */
- ast_streamfile(chan, "auth-thankyou", chan->language);
- ast_waitstream(chan, "");
- }
- }
- return res;
-}
-
-/* Channel group core functions */
-
-int ast_app_group_split_group(char *data, char *group, int group_max, char *category, int category_max)
-{
- int res=0;
- char tmp[256];
- char *grp=NULL, *cat=NULL;
-
- if (!ast_strlen_zero(data)) {
- ast_copy_string(tmp, data, sizeof(tmp));
- grp = tmp;
- cat = strchr(tmp, '@');
- if (cat) {
- *cat = '\0';
- cat++;
- }
- }
-
- if (!ast_strlen_zero(grp))
- ast_copy_string(group, grp, group_max);
- else
- res = -1;
-
- if (cat)
- snprintf(category, category_max, "%s_%s", GROUP_CATEGORY_PREFIX, cat);
- else
- ast_copy_string(category, GROUP_CATEGORY_PREFIX, category_max);
-
- return res;
-}
-
-int ast_app_group_set_channel(struct ast_channel *chan, char *data)
-{
- int res=0;
- char group[80] = "";
- char category[80] = "";
-
- if (!ast_app_group_split_group(data, group, sizeof(group), category, sizeof(category))) {
- pbx_builtin_setvar_helper(chan, category, group);
- } else
- res = -1;
-
- return res;
-}
-
-int ast_app_group_get_count(char *group, char *category)
-{
- struct ast_channel *chan;
- int count = 0;
- char *test;
- char cat[80];
- char *s;
-
- if (ast_strlen_zero(group))
- return 0;
-
- s = (!ast_strlen_zero(category)) ? category : GROUP_CATEGORY_PREFIX;
- ast_copy_string(cat, s, sizeof(cat));
-
- chan = NULL;
- while ((chan = ast_channel_walk_locked(chan)) != NULL) {
- test = pbx_builtin_getvar_helper(chan, cat);
- if (test && !strcasecmp(test, group))
- count++;
- ast_mutex_unlock(&chan->lock);
- }
-
- return count;
-}
-
-int ast_app_group_match_get_count(char *groupmatch, char *category)
-{
- regex_t regexbuf;
- struct ast_channel *chan;
- int count = 0;
- char *test;
- char cat[80];
- char *s;
-
- if (ast_strlen_zero(groupmatch))
- return 0;
-
- /* if regex compilation fails, return zero matches */
- if (regcomp(&regexbuf, groupmatch, REG_EXTENDED | REG_NOSUB))
- return 0;
-
- s = (!ast_strlen_zero(category)) ? category : GROUP_CATEGORY_PREFIX;
- ast_copy_string(cat, s, sizeof(cat));
-
- chan = NULL;
- while ((chan = ast_channel_walk_locked(chan)) != NULL) {
- test = pbx_builtin_getvar_helper(chan, cat);
- if (test && !regexec(&regexbuf, test, 0, NULL, 0))
- count++;
- ast_mutex_unlock(&chan->lock);
- }
-
- regfree(&regexbuf);
-
- return count;
-}
-
-unsigned int ast_app_separate_args(char *buf, char delim, char **array, int arraylen)
-{
- int argc;
- char *scan;
- int paren = 0;
-
- if (!buf || !array || !arraylen)
- return 0;
-
- memset(array, 0, arraylen * sizeof(*array));
-
- scan = buf;
-
- for (argc = 0; *scan && (argc < arraylen - 1); argc++) {
- array[argc] = scan;
- for (; *scan; scan++) {
- if (*scan == '(')
- paren++;
- else if (*scan == ')') {
- if (paren)
- paren--;
- } else if ((*scan == delim) && !paren) {
- *scan++ = '\0';
- break;
- }
- }
- }
-
- if (*scan)
- array[argc++] = scan;
-
- return argc;
-}
-
-enum AST_LOCK_RESULT ast_lock_path(const char *path)
-{
- char *s;
- char *fs;
- int res;
- int fd;
- time_t start;
-
- s = alloca(strlen(path) + 10);
- fs = alloca(strlen(path) + 20);
-
- if (!fs || !s) {
- ast_log(LOG_WARNING, "Out of memory!\n");
- return AST_LOCK_FAILURE;
- }
-
- snprintf(fs, strlen(path) + 19, "%s/.lock-%08x", path, rand());
- fd = open(fs, O_WRONLY | O_CREAT | O_EXCL, 0600);
- if (fd < 0) {
- fprintf(stderr, "Unable to create lock file '%s': %s\n", path, strerror(errno));
- return AST_LOCK_PATH_NOT_FOUND;
- }
- close(fd);
-
- snprintf(s, strlen(path) + 9, "%s/.lock", path);
- time(&start);
- while (((res = link(fs, s)) < 0) && (errno == EEXIST) && (time(NULL) - start < 5))
- usleep(1);
- if (res) {
- ast_log(LOG_WARNING, "Failed to lock path '%s': %s\n", path, strerror(errno));
- return AST_LOCK_TIMEOUT;
- } else {
- unlink(fs);
- ast_log(LOG_DEBUG, "Locked path '%s'\n", path);
- return AST_LOCK_SUCCESS;
- }
-}
-
-int ast_unlock_path(const char *path)
-{
- char *s;
- s = alloca(strlen(path) + 10);
- if (!s)
- return -1;
- snprintf(s, strlen(path) + 9, "%s/%s", path, ".lock");
- ast_log(LOG_DEBUG, "Unlocked path '%s'\n", path);
- return unlink(s);
-}
-
-int ast_record_review(struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime, const char *fmt, int *duration, const char *path)
-{
- int silencethreshold = 128;
- int maxsilence=0;
- int res = 0;
- int cmd = 0;
- int max_attempts = 3;
- int attempts = 0;
- int recorded = 0;
- int message_exists = 0;
- /* Note that urgent and private are for flagging messages as such in the future */
-
- /* barf if no pointer passed to store duration in */
- if (duration == NULL) {
- ast_log(LOG_WARNING, "Error ast_record_review called without duration pointer\n");
- return -1;
- }
-
- cmd = '3'; /* Want to start by recording */
-
- while ((cmd >= 0) && (cmd != 't')) {
- switch (cmd) {
- case '1':
- if (!message_exists) {
- /* In this case, 1 is to record a message */
- cmd = '3';
- break;
- } else {
- ast_streamfile(chan, "vm-msgsaved", chan->language);
- ast_waitstream(chan, "");
- cmd = 't';
- return res;
- }
- case '2':
- /* Review */
- ast_verbose(VERBOSE_PREFIX_3 "Reviewing the recording\n");
- ast_streamfile(chan, recordfile, chan->language);
- cmd = ast_waitstream(chan, AST_DIGIT_ANY);
- break;
- case '3':
- message_exists = 0;
- /* Record */
- if (recorded == 1)
- ast_verbose(VERBOSE_PREFIX_3 "Re-recording\n");
- else
- ast_verbose(VERBOSE_PREFIX_3 "Recording\n");
- recorded = 1;
- cmd = ast_play_and_record(chan, playfile, recordfile, maxtime, fmt, duration, silencethreshold, maxsilence, path);
- if (cmd == -1) {
- /* User has hung up, no options to give */
- return cmd;
- }
- if (cmd == '0') {
- break;
- } else if (cmd == '*') {
- break;
- }
- else {
- /* If all is well, a message exists */
- message_exists = 1;
- cmd = 0;
- }
- break;
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- case '*':
- case '#':
- cmd = ast_play_and_wait(chan, "vm-sorry");
- break;
- default:
- if (message_exists) {
- cmd = ast_play_and_wait(chan, "vm-review");
- }
- else {
- cmd = ast_play_and_wait(chan, "vm-torerecord");
- if (!cmd)
- cmd = ast_waitfordigit(chan, 600);
- }
-
- if (!cmd)
- cmd = ast_waitfordigit(chan, 6000);
- if (!cmd) {
- attempts++;
- }
- if (attempts > max_attempts) {
- cmd = 't';
- }
- }
- }
- if (cmd == 't')
- cmd = 0;
- return cmd;
-}
-
-#define RES_UPONE (1 << 16)
-#define RES_EXIT (1 << 17)
-#define RES_REPEAT (1 << 18)
-#define RES_RESTART ((1 << 19) | RES_REPEAT)
-
-static int ast_ivr_menu_run_internal(struct ast_channel *chan, struct ast_ivr_menu *menu, void *cbdata);
-static int ivr_dispatch(struct ast_channel *chan, struct ast_ivr_option *option, char *exten, void *cbdata)
-{
- int res;
- int (*ivr_func)(struct ast_channel *, void *);
- char *c;
- char *n;
-
- switch(option->action) {
- case AST_ACTION_UPONE:
- return RES_UPONE;
- case AST_ACTION_EXIT:
- return RES_EXIT | (((unsigned long)(option->adata)) & 0xffff);
- case AST_ACTION_REPEAT:
- return RES_REPEAT | (((unsigned long)(option->adata)) & 0xffff);
- case AST_ACTION_RESTART:
- return RES_RESTART ;
- case AST_ACTION_NOOP:
- return 0;
- case AST_ACTION_BACKGROUND:
- res = ast_streamfile(chan, (char *)option->adata, chan->language);
- if (!res) {
- res = ast_waitstream(chan, AST_DIGIT_ANY);
- } else {
- ast_log(LOG_NOTICE, "Unable to find file '%s'!\n", (char *)option->adata);
- res = 0;
- }
- return res;
- case AST_ACTION_PLAYBACK:
- res = ast_streamfile(chan, (char *)option->adata, chan->language);
- if (!res) {
- res = ast_waitstream(chan, "");
- } else {
- ast_log(LOG_NOTICE, "Unable to find file '%s'!\n", (char *)option->adata);
- res = 0;
- }
- return res;
- case AST_ACTION_MENU:
- res = ast_ivr_menu_run_internal(chan, (struct ast_ivr_menu *)option->adata, cbdata);
- /* Do not pass entry errors back up, treaat ast though ti was an "UPONE" */
- if (res == -2)
- res = 0;
- return res;
- case AST_ACTION_WAITOPTION:
- res = ast_waitfordigit(chan, 1000 * (chan->pbx ? chan->pbx->rtimeout : 10));
- if (!res)
- return 't';
- return res;
- case AST_ACTION_CALLBACK:
- ivr_func = option->adata;
- res = ivr_func(chan, cbdata);
- return res;
- case AST_ACTION_TRANSFER:
- res = ast_parseable_goto(chan, option->adata);
- return 0;
- case AST_ACTION_PLAYLIST:
- case AST_ACTION_BACKLIST:
- res = 0;
- c = ast_strdupa(option->adata);
- if (c) {
- while((n = strsep(&c, ";")))
- if ((res = ast_streamfile(chan, n, chan->language)) || (res = ast_waitstream(chan, (option->action == AST_ACTION_BACKLIST) ? AST_DIGIT_ANY : "")))
- break;
- ast_stopstream(chan);
- }
- return res;
- default:
- ast_log(LOG_NOTICE, "Unknown dispatch function %d, ignoring!\n", option->action);
- return 0;
- };
- return -1;
-}
-
-static int option_exists(struct ast_ivr_menu *menu, char *option)
-{
- int x;
- for (x=0;menu->options[x].option;x++)
- if (!strcasecmp(menu->options[x].option, option))
- return x;
- return -1;
-}
-
-static int option_matchmore(struct ast_ivr_menu *menu, char *option)
-{
- int x;
- for (x=0;menu->options[x].option;x++)
- if ((!strncasecmp(menu->options[x].option, option, strlen(option))) &&
- (menu->options[x].option[strlen(option)]))
- return x;
- return -1;
-}
-
-static int read_newoption(struct ast_channel *chan, struct ast_ivr_menu *menu, char *exten, int maxexten)
-{
- int res=0;
- int ms;
- while(option_matchmore(menu, exten)) {
- ms = chan->pbx ? chan->pbx->dtimeout : 5000;
- if (strlen(exten) >= maxexten - 1)
- break;
- res = ast_waitfordigit(chan, ms);
- if (res < 1)
- break;
- exten[strlen(exten) + 1] = '\0';
- exten[strlen(exten)] = res;
- }
- return res > 0 ? 0 : res;
-}
-
-static int ast_ivr_menu_run_internal(struct ast_channel *chan, struct ast_ivr_menu *menu, void *cbdata)
-{
- /* Execute an IVR menu structure */
- int res=0;
- int pos = 0;
- int retries = 0;
- char exten[AST_MAX_EXTENSION] = "s";
- if (option_exists(menu, "s") < 0) {
- strcpy(exten, "g");
- if (option_exists(menu, "g") < 0) {
- ast_log(LOG_WARNING, "No 's' nor 'g' extension in menu '%s'!\n", menu->title);
- return -1;
- }
- }
- while(!res) {
- while(menu->options[pos].option) {
- if (!strcasecmp(menu->options[pos].option, exten)) {
- res = ivr_dispatch(chan, menu->options + pos, exten, cbdata);
- ast_log(LOG_DEBUG, "IVR Dispatch of '%s' (pos %d) yields %d\n", exten, pos, res);
- if (res < 0)
- break;
- else if (res & RES_UPONE)
- return 0;
- else if (res & RES_EXIT)
- return res;
- else if (res & RES_REPEAT) {
- int maxretries = res & 0xffff;
- if ((res & RES_RESTART) == RES_RESTART) {
- retries = 0;
- } else
- retries++;
- if (!maxretries)
- maxretries = 3;
- if ((maxretries > 0) && (retries >= maxretries)) {
- ast_log(LOG_DEBUG, "Max retries %d exceeded\n", maxretries);
- return -2;
- } else {
- if (option_exists(menu, "g") > -1)
- strcpy(exten, "g");
- else if (option_exists(menu, "s") > -1)
- strcpy(exten, "s");
- }
- pos=0;
- continue;
- } else if (res && strchr(AST_DIGIT_ANY, res)) {
- ast_log(LOG_DEBUG, "Got start of extension, %c\n", res);
- exten[1] = '\0';
- exten[0] = res;
- if ((res = read_newoption(chan, menu, exten, sizeof(exten))))
- break;
- if (option_exists(menu, exten) < 0) {
- if (option_exists(menu, "i")) {
- ast_log(LOG_DEBUG, "Invalid extension entered, going to 'i'!\n");
- strcpy(exten, "i");
- pos = 0;
- continue;
- } else {
- ast_log(LOG_DEBUG, "Aborting on invalid entry, with no 'i' option!\n");
- res = -2;
- break;
- }
- } else {
- ast_log(LOG_DEBUG, "New existing extension: %s\n", exten);
- pos = 0;
- continue;
- }
- }
- }
- pos++;
- }
- ast_log(LOG_DEBUG, "Stopping option '%s', res is %d\n", exten, res);
- pos = 0;
- if (!strcasecmp(exten, "s"))
- strcpy(exten, "g");
- else
- break;
- }
- return res;
-}
-
-int ast_ivr_menu_run(struct ast_channel *chan, struct ast_ivr_menu *menu, void *cbdata)
-{
- int res;
- res = ast_ivr_menu_run_internal(chan, menu, cbdata);
- /* Hide internal coding */
- if (res > 0)
- res = 0;
- return res;
-}
-
-char *ast_read_textfile(const char *filename)
-{
- int fd;
- char *output=NULL;
- struct stat filesize;
- int count=0;
- int res;
- if(stat(filename,&filesize)== -1){
- ast_log(LOG_WARNING,"Error can't stat %s\n", filename);
- return NULL;
- }
- count=filesize.st_size + 1;
- fd = open(filename, O_RDONLY);
- if (fd < 0) {
- ast_log(LOG_WARNING, "Cannot open file '%s' for reading: %s\n", filename, strerror(errno));
- return NULL;
- }
- output=(char *)malloc(count);
- if (output) {
- res = read(fd, output, count - 1);
- if (res == count - 1) {
- output[res] = '\0';
- } else {
- ast_log(LOG_WARNING, "Short read of %s (%d of %d): %s\n", filename, res, count - 1, strerror(errno));
- free(output);
- output = NULL;
- }
- } else
- ast_log(LOG_WARNING, "Out of memory!\n");
- close(fd);
- return output;
-}
-
-int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags *flags, char **args, char *optstr)
-{
- char *s;
- int curarg;
- unsigned int argloc;
- char *arg;
- int res = 0;
-
- ast_clear_flag(flags, AST_FLAGS_ALL);
-
- if (!optstr)
- return 0;
-
- s = optstr;
- while (*s) {
- curarg = *s++ & 0x7f;
- ast_set_flag(flags, options[curarg].flag);
- argloc = options[curarg].arg_index;
- if (*s == '(') {
- /* Has argument */
- arg = ++s;
- while (*s && (*s != ')'))
- s++;
- if (*s) {
- if (argloc)
- args[argloc - 1] = arg;
- *s++ = '\0';
- } else {
- ast_log(LOG_WARNING, "Missing closing parenthesis for argument '%c' in string '%s'\n", curarg, arg);
- res = -1;
- }
- } else if (argloc) {
- args[argloc - 1] = NULL;
- }
- }
-
- return res;
-}
diff --git a/1.2-netsec/apps/Makefile b/1.2-netsec/apps/Makefile
deleted file mode 100644
index ca7f86e7b..000000000
--- a/1.2-netsec/apps/Makefile
+++ /dev/null
@@ -1,133 +0,0 @@
-#
-# Asterisk -- A telephony toolkit for Linux.
-#
-# Makefile for PBX applications
-#
-# Copyright (C) 1999-2005, Digium
-#
-# Mark Spencer <markster@digium.com>
-#
-# This program is free software, distributed under the terms of
-# the GNU General Public License
-#
-
-APPS=app_dial.so app_playback.so app_voicemail.so app_directory.so app_mp3.so\
- app_system.so app_echo.so app_record.so app_image.so app_url.so app_disa.so \
- app_adsiprog.so app_getcpeid.so app_milliwatt.so \
- app_zapateller.so app_setcallerid.so app_festival.so \
- app_queue.so app_senddtmf.so app_parkandannounce.so \
- app_setcidname.so app_lookupcidname.so app_macro.so \
- app_authenticate.so app_softhangup.so app_lookupblacklist.so \
- app_waitforring.so app_privacy.so app_db.so app_chanisavail.so \
- app_enumlookup.so app_transfer.so app_setcidnum.so app_cdr.so \
- app_hasnewvoicemail.so app_sayunixtime.so app_cut.so app_read.so \
- app_setcdruserfield.so app_random.so app_ices.so app_eval.so \
- app_nbscat.so app_sendtext.so app_exec.so \
- app_groupcount.so app_txtcidname.so app_controlplayback.so \
- app_talkdetect.so app_alarmreceiver.so app_userevent.so app_verbose.so \
- app_test.so app_forkcdr.so app_math.so app_realtime.so \
- app_dumpchan.so app_waitforsilence.so app_while.so app_setrdnis.so \
- app_md5.so app_readfile.so app_chanspy.so app_settransfercapability.so \
- app_dictate.so app_externalivr.so app_directed_pickup.so \
- app_mixmonitor.so app_stack.so
-
-#
-# Obsolete things...
-#
-#APPS+=app_sql_postgres.so
-#APPS+=app_sql_odbc.so
-
-#
-# Experimental things
-#
-#APPS+=app_ivrdemo.so
-#APPS+=app_skel.so
-#APPS+=app_rpt.so
-
-ifndef WITHOUT_ZAPTEL
-ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/linux/zaptel.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/zaptel.h),)
- APPS+=app_zapras.so app_meetme.so app_flash.so app_zapbarge.so app_zapscan.so app_page.so
-endif
-endif # WITHOUT_ZAPTEL
-
-ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/osp/osp.h $(CROSS_COMPILE_TARGET)/usr/include/osp/osp.h),)
-APPS+=app_osplookup.so
-endif
-
-ifeq ($(findstring BSD,${OSARCH}),BSD)
-CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include -L$(CROSS_COMPILE_TARGET)/usr/local/lib
-endif
-
-CURLLIBS=$(shell $(CROSS_COMPILE_BIN)curl-config --libs)
-ifneq ($(shell if [[ 0x`$(CROSS_COMPILE_BIN)curl-config --vernum` -ge 0x70907 ]]; then echo "OK" ; fi),)
- ifneq (${CURLLIBS},)
- APPS+=app_curl.so
- endif
-endif
-
-ifeq (${OSARCH},CYGWIN)
-CYGSOLINK=-Wl,--out-implib=lib$@.a -Wl,--export-all-symbols
-CYGSOLIB=-L.. -L. -L../res -lasterisk.dll -lres_features.so -lres_adsi.so -lres_monitor.so
-else
-CFLAGS+=-fPIC
-APPS+=app_sms.so
-endif
-
-#
-# If you have UnixODBC you can use ODBC voicemail
-# storage
-#
-# Uncomment to use ODBC storage
-#CFLAGS+=-DUSE_ODBC_STORAGE
-# Uncomment for extended ODBC voicemail storage
-#CFLAGS+=-DEXTENDED_ODBC_STORAGE
-# See doc/README.odbcstorage for more information
-
-all: $(APPS)
-
-clean:
- rm -f *.so *.o look .depend
-
-%.so : %.o
- $(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB}
-
-app_rpt.so : app_rpt.o
- $(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -ltonezone
-
-install: all
- for x in $(APPS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
- rm -f $(DESTDIR)$(MODULES_DIR)/app_datetime.so
- rm -f $(DESTDIR)$(MODULES_DIR)/app_qcall.so
-
-app_curl.so: app_curl.o
- $(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} $(CURLLIBS)
-
-app_sql_postgres.o: app_sql_postgres.c
- $(CC) -pipe -I$(CROSS_COMPILE_TARGET)/usr/local/pgsql/include -I$(CROSS_COMPILE_TARGET)/usr/include/postgresql $(CFLAGS) -c -o app_sql_postgres.o app_sql_postgres.c
-
-app_sql_postgres.so: app_sql_postgres.o
- $(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -L/usr/local/pgsql/lib -lpq
-
-app_sql_odbc.so: app_sql_odbc.o
- $(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -lodbc
-
-look: look.c
- $(CC) -pipe -O6 -g look.c -o look -lncurses
-
-ifeq (SunOS,$(shell uname))
-app_chanspy.so: app_chanspy.o
- $(CC) $(SOLINK) -o $@ $< -lrt
-endif
-
-
-ifneq ($(wildcard .depend),)
- include .depend
-endif
-
-depend: .depend
-
-.depend:
- ../build_tools/mkdep $(CFLAGS) `ls *.c`
-
-env:
- env
diff --git a/1.2-netsec/apps/app_adsiprog.c b/1.2-netsec/apps/app_adsiprog.c
deleted file mode 100644
index 79fe30122..000000000
--- a/1.2-netsec/apps/app_adsiprog.c
+++ /dev/null
@@ -1,1606 +0,0 @@
-/*
- * Asterisk -- An open source telephony toolkit.
- *
- * Copyright (C) 1999 - 2005, Digium, Inc.
- *
- * Mark Spencer <markster@digium.com>
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE file
- * at the top of the source tree.
- */
-
-/*! \file
- * \brief Program Asterisk ADSI Scripts into phone
- *
- * \ingroup applications
- */
-
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <errno.h>
-
-#include "asterisk.h"
-
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-
-#include "asterisk/file.h"
-#include "asterisk/logger.h"
-#include "asterisk/channel.h"
-#include "asterisk/pbx.h"
-#include "asterisk/module.h"
-#include "asterisk/adsi.h"
-#include "asterisk/options.h"
-#include "asterisk/utils.h"
-#include "asterisk/lock.h"
-
-static char *tdesc = "Asterisk ADSI Programming Application";
-
-static char *app = "ADSIProg";
-
-static char *synopsis = "Load Asterisk ADSI Scripts into phone";
-
-/* #define DUMP_MESSAGES */
-
-static char *descrip =
-" ADSIProg(script): This application programs an ADSI Phone with the given\n"
-"script. If nothing is specified, the default script (asterisk.adsi) is used.\n";
-
-STANDARD_LOCAL_USER;
-
-LOCAL_USER_DECL;
-
-struct adsi_event {
- int id;
- char *name;
-};
-
-static struct adsi_event events[] = {
- { 1, "CALLERID" },
- { 2, "VMWI" },
- { 3, "NEARANSWER" },
- { 4, "FARANSWER" },
- { 5, "ENDOFRING" },
- { 6, "IDLE" },
- { 7, "OFFHOOK" },
- { 8, "CIDCW" },
- { 9, "BUSY" },
- { 10, "FARRING" },
- { 11, "DIALTONE" },
- { 12, "RECALL" },
- { 13, "MESSAGE" },
- { 14, "REORDER" },
- { 15, "DISTINCTIVERING" },
- { 16, "RING" },
- { 17, "REMINDERRING" },
- { 18, "SPECIALRING" },
- { 19, "CODEDRING" },
- { 20, "TIMER" },
- { 21, "INUSE" },
- { 22, "EVENT22" },
- { 23, "EVENT23" },
- { 24, "CPEID" },
-};
-
-static struct adsi_event justify[] = {
- { 0, "CENTER" },
- { 1, "RIGHT" },
- { 2, "LEFT" },
- { 3, "INDENT" },
-};
-
-#define STATE_NORMAL 0
-#define STATE_INKEY 1
-#define STATE_INSUB 2
-#define STATE_INIF 3
-
-#define MAX_RET_CODE 20
-#define MAX_SUB_LEN 255
-#define MAX_MAIN_LEN 1600
-
-#define ARG_STRING (1 << 0)
-#define ARG_NUMBER (1 << 1)
-
-struct adsi_soft_key {
- char vname[40]; /* Which "variable" is associated with it */
- int retstrlen; /* Length of return string */
- int initlen; /* initial length */
- int id;
- int defined;
- char retstr[80]; /* Return string data */
-};
-
-struct adsi_subscript {
- char vname[40];
- int id;
- int defined;
- int datalen;
- int inscount;
- int ifinscount;
- char *ifdata;
- char data[2048];
-};
-
-struct adsi_state {
- char vname[40];
- int id;
-};
-
-struct adsi_flag {
- char vname[40];
- int id;
-};
-
-struct adsi_display {
- char vname[40];
- int id;
- char data[70];
- int datalen;
-};
-
-struct adsi_script {
- int state;
- int numkeys;
- int numsubs;
- int numstates;
- int numdisplays;
- int numflags;
- struct adsi_soft_key *key;
- struct adsi_subscript *sub;
- /* Pre-defined displays */
- struct adsi_display displays[63];
- /* ADSI States 1 (initial) - 254 */
- struct adsi_state states[256];
- /* Keys 2-63 */
- struct adsi_soft_key keys[62];
- /* Subscripts 0 (main) to 127 */
- struct adsi_subscript subs[128];
- /* Flags 1-7 */
- struct adsi_flag flags[7];
-
- /* Stuff from adsi script */
- unsigned char sec[5];
- char desc[19];
- unsigned char fdn[5];
- int ver;
-};
-
-
-static int process_token(void *out, char *src, int maxlen, int argtype)
-{
- if ((strlen(src) > 1) && src[0] == '\"') {
- /* This is a quoted string */
- if (!(argtype & ARG_STRING))
- return -1;
- src++;
- /* Don't take more than what's there */
- if (maxlen > strlen(src) - 1)
- maxlen = strlen(src) - 1;
- memcpy(out, src, maxlen);
- ((char *)out)[maxlen] = '\0';
- } else if (!ast_strlen_zero(src) && (src[0] == '\\')) {
- if (!(argtype & ARG_NUMBER))
- return -1;
- /* Octal value */
- if (sscanf(src, "%o", (int *)out) != 1)
- return -1;
- if (argtype & ARG_STRING) {
- /* Convert */
- *((unsigned int *)out) = htonl(*((unsigned int *)out));
- }
- } else if ((strlen(src) > 2) && (src[0] == '0') && (tolower(src[1]) == 'x')) {
- if (!(argtype & ARG_NUMBER))
- return -1;
- /* Hex value */
- if (sscanf(src + 2, "%x", (unsigned int *)out) != 1)
- return -1;
- if (argtype & ARG_STRING) {
- /* Convert */
- *((unsigned int *)out) = htonl(*((unsigned int *)out));
- }
- } else if ((!ast_strlen_zero(src) && isdigit(src[0]))) {
- if (!(argtype & ARG_NUMBER))
- return -1;
- /* Hex value */
- if (sscanf(src, "%d", (int *)out) != 1)
- return -1;
- if (argtype & ARG_STRING) {
- /* Convert */
- *((unsigned int *)out) = htonl(*((unsigned int *)out));
- }
- } else
- return -1;
- return 0;
-}
-
-static char *get_token(char **buf, char *script, int lineno)
-{
- char *tmp = *buf;
- char *keyword;
- int quoted = 0;
- /* Advance past any white space */
- while(*tmp && (*tmp < 33))
- tmp++;
- if (!*tmp)
- return NULL;
- keyword = tmp;
- while(*tmp && ((*tmp > 32) || quoted)) {
- if (*tmp == '\"') {
- quoted = !quoted;
- }
- tmp++;
- }
- if (quoted) {
- ast_log(LOG_WARNING, "Mismatched quotes at line %d of %s\n", lineno, script);
- return NULL;
- }
- *tmp = '\0';
- tmp++;
- while(*tmp && (*tmp < 33))
- tmp++;
- /* Note where we left off */
- *buf = tmp;
- return keyword;
-}
-
-static char *validdtmf = "123456789*0#ABCD";
-
-static int send_dtmf(char *buf, char *name, int id, char *args, struct adsi_script *state, char *script, int lineno)
-{
- char dtmfstr[80];
- char *a;
- int bytes=0;
- a = get_token(&args, script, lineno);
- if (!a) {
- ast_log(LOG_WARNING, "Expecting something to send for SENDDTMF at line %d of %s\n", lineno, script);
- return 0;
- }
- if (process_token(dtmfstr, a, sizeof(dtmfstr) - 1, ARG_STRING)) {
- ast_log(LOG_WARNING, "Invalid token for SENDDTMF at line %d of %s\n", lineno, script);
- return 0;
- }
- a = dtmfstr;
- while(*a) {
- if (strchr(validdtmf, *a)) {
- *buf = *a;
- buf++;
- bytes++;
- } else
- ast_log(LOG_WARNING, "'%c' is not a valid DTMF tone at line %d of %s\n", *a, lineno, script);
- a++;
- }
- return bytes;
-}
-
-static int goto_line(char *buf, char *name, int id, char *args, struct adsi_script *state, char *script, int lineno)
-{
- char *page;
- char *gline;
- int line;
- unsigned char cmd;
- page = get_token(&args, script, lineno);
- gline = get_token(&args, script, lineno);
- if (!page || !gline) {
- ast_log(LOG_WARNING, "Expecting page and line number for GOTOLINE at line %d of %s\n", lineno, script);
- return 0;
- }
- if (!strcasecmp(page, "INFO")) {
- cmd = 0;
- } else if (!strcasecmp(page, "COMM")) {
- cmd = 0x80;
- } else {
- ast_log(LOG_WARNING, "Expecting either 'INFO' or 'COMM' page, got got '%s' at line %d of %s\n", page, lineno, script);
- return 0;
- }
- if (process_token(&line, gline, sizeof(line), ARG_NUMBER)) {
- ast_log(LOG_WARNING, "Invalid line number '%s' at line %d of %s\n", gline, lineno, script);
- return 0;
- }
- cmd |= line;
- buf[0] = 0x8b;
- buf[1] = cmd;
- return 2;
-}
-
-static int goto_line_rel(char *buf, char *name, int id, char *args, struct adsi_script *state, char *script, int lineno)
-{
- char *dir;
- char *gline;
- int line;
- unsigned char cmd;
- dir = get_token(&args, script, lineno);
- gline = get_token(&args, script, lineno);
- if (!dir || !gline) {
- ast_log(LOG_WARNING, "Expecting direction and number of lines for GOTOLINEREL at line %d of %s\n", lineno, script);
- return 0;
- }
- if (!strcasecmp(dir, "UP")) {
- cmd = 0;
- } else if (!strcasecmp(dir, "DOWN")) {
- cmd = 0x20;
- } else {
- ast_log(LOG_WARNING, "Expecting either 'UP' or 'DOWN' direction, got '%s' at line %d of %s\n", dir, lineno, script);
- return 0;
- }
- if (process_token(&line, gline, sizeof(line), ARG_NUMBER)) {
- ast_log(LOG_WARNING, "Invalid line number '%s' at line %d of %s\n", gline, lineno, script);
- return 0;
- }
- cmd |= line;
- buf[0] = 0x8c;
- buf[1] = cmd;
- return 2;
-}
-
-static int send_delay(char *buf, char *name, int id, char *args, struct adsi_script *state, char *script, int lineno)
-{
- char *gtime;
- int ms;
- gtime = get_token(&args, script, lineno);
- if (!gtime) {
- ast_log(LOG_WARNING, "Expecting number of milliseconds to wait at line %d of %s\n", lineno, script);
- return 0;
- }
- if (process_token(&ms, gtime, sizeof(ms), ARG_NUMBER)) {
- ast_log(LOG_WARNING, "Invalid delay milliseconds '%s' at line %d of %s\n", gtime, lineno, script);
- return 0;
- }
- buf[0] = 0x90;
- if (id == 11)
- buf[1] = ms / 100;
- else
- buf[1] = ms / 10;
- return 2;
-}
-
-static int set_state(char *buf, char *name, int id, char *args, struct adsi_script *istate, char *script, int lineno)
-{
- char *gstate;
- int state;
- gstate = get_token(&args, script, lineno);
- if (!gstate) {
- ast_log(LOG_WARNING, "Expecting state number at line %d of %s\n", lineno, script);
- return 0;
- }
- if (process_token(&state, gstate, sizeof(state), ARG_NUMBER)) {
- ast_log(LOG_WARNING, "Invalid state number '%s' at line %d of %s\n", gstate, lineno, script);
- return 0;
- }
- buf[0] = id;
- buf[1] = state;
- return 2;
-}
-
-static int cleartimer(char *buf, char *name, int id, char *args, struct adsi_script *istate, char *script, int lineno)
-{
- char *tok;
- tok = get_token(&args, script, lineno);
- if (tok)
- ast_log(LOG_WARNING, "Clearing timer requires no arguments ('%s') at line %d of %s\n", tok, lineno, script);
-
- buf[0] = id;
- /* For some reason the clear code is different slightly */
- if (id == 7)
- buf[1] = 0x10;
- else
- buf[1] = 0x00;
- return 2;
-}
-
-static struct adsi_flag *getflagbyname(struct adsi_script *state, char *name, char *script, int lineno, int create)
-{
- int x;
- for (x=0;x<state->numflags;x++)
- if (!strcasecmp(state->flags[x].vname, name))
- return &state->flags[x];
- /* Return now if we're not allowed to create */
- if (!create)
- return NULL;
- if (state->numflags > 6) {
- ast_log(LOG_WARNING, "No more flag space at line %d of %s\n", lineno, script);
- return NULL;
- }
- ast_copy_string(state->flags[state->numflags].vname, name, sizeof(state->flags[state->numflags].vname));
- state->flags[state->numflags].id = state->numflags + 1;
- state->numflags++;
- return &state->flags[state->numflags-1];
-}
-
-static int setflag(char *buf, char *name, int id, char *args, struct adsi_script *state, char *script, int lineno)
-{
- char *tok;
- char sname[80];
- struct adsi_flag *flag;
- tok = get_token(&args, script, lineno);
- if (!tok) {
- ast_log(LOG_WARNING, "Setting flag requires a flag number at line %d of %s\n", lineno, script);
- return 0;
- }
- if (process_token(sname, tok, sizeof(sname) - 1, ARG_STRING)) {
- ast_log(LOG_WARNING, "Invalid flag '%s' at line %d of %s\n", tok, lineno, script);
- return 0;
- }
- flag = getflagbyname(state, sname, script, lineno, 0);
- if (!flag) {
- ast_log(LOG_WARNING, "Flag '%s' is undeclared at line %d of %s\n", sname, lineno, script);
- return 0;
- }
- buf[0] = id;
- buf[1] = ((flag->id & 0x7) << 4) | 1;
- return 2;
-}
-
-static int clearflag(char *buf, char *name, int id, char *args, struct adsi_script *state, char *script, int lineno)
-{
- char *tok;
- struct adsi_flag *flag;
- char sname[80];
- tok = get_token(&args, script, lineno);
- if (!tok) {
- ast_log(LOG_WARNING, "Clearing flag requires a flag number at line %d of %s\n", lineno, script);
- return 0;
- }
- if (process_token(sname, tok, sizeof(sname) - 1, ARG_STRING)) {
- ast_log(LOG_WARNING, "Invalid flag '%s' at line %d of %s\n", tok, lineno, script);
- return 0;
- }
- flag = getflagbyname(state, sname, script, lineno, 0);
- if (!flag) {
- ast_log(LOG_WARNING, "Flag '%s' is undeclared at line %d of %s\n", sname, lineno, script);
- return 0;
- }
- buf[0] = id;
- buf[1] = ((flag->id & 0x7) << 4);
- return 2;
-}
-
-static int starttimer(char *buf, char *name, int id, char *args, struct adsi_script *istate, char *script, int lineno)
-{
- char *tok;
- int secs;
- tok = get_token(&args, script, lineno);
- if (!tok) {
- ast_log(LOG_WARNING, "Missing number of seconds at line %d of %s\n", lineno, script);
- return 0;
- }
- if (process_token(&secs, tok, sizeof(secs), ARG_NUMBER)) {
- ast_log(LOG_WARNING, "Invalid number of seconds '%s' at line %d of %s\n", tok, lineno, script);
- return 0;
- }
- buf[0] = id;
- buf[1] = 0x1;
- buf[2] = secs;
- return 3;
-}
-
-static int geteventbyname(char *name)
-{
- int x;
- for (x=0;x<sizeof(events) / sizeof(events[0]); x++) {
- if (!strcasecmp(events[x].name, name))
- return events[x].id;
- }
- return 0;
-}
-
-static int getjustifybyname(char *name)
-{
- int x;
- for (x=0;x<sizeof(justify) / sizeof(justify[0]); x++) {
- if (!strcasecmp(justify[x].name, name))
- return justify[x].id;
- }
- return -1;
-}
-
-static struct adsi_soft_key *getkeybyname(struct adsi_script *state, char *name, char *script, int lineno)
-{
- int x;
- for (x=0;x<state->numkeys;x++)
- if (!strcasecmp(state->keys[x].vname, name))
- return &state->keys[x];
- if (state->numkeys > 61) {
- ast_log(LOG_WARNING, "No more key space at line %d of %s\n", lineno, script);
- return NULL;
- }
- ast_copy_string(state->keys[state->numkeys].vname, name, sizeof(state->keys[state->numkeys].vname));
- state->keys[state->numkeys].id = state->numkeys + 2;
- state->numkeys++;
- return &state->keys[state->numkeys-1];
-}
-
-static struct adsi_subscript *getsubbyname(struct adsi_script *state, char *name, char *script, int lineno)
-{
- int x;
- for (x=0;x<state->numsubs;x++)
- if (!strcasecmp(state->subs[x].vname, name))
- return &state->subs[x];
- if (state->numsubs > 127) {
- ast_log(LOG_WARNING, "No more subscript space at line %d of %s\n", lineno, script);
- return NULL;
- }
- ast_copy_string(state->subs[state->numsubs].vname, name, sizeof(state->subs[state->numsubs].vname));
- state->subs[state->numsubs].id = state->numsubs;
- state->numsubs++;
- return &state->subs[state->numsubs-1];
-}
-
-static struct adsi_state *getstatebyname(struct adsi_script *state, char *name, char *script, int lineno, int create)
-{
- int x;
- for (x=0;x<state->numstates;x++)
- if (!strcasecmp(state->states[x].vname, name))
- return &state->states[x];
- /* Return now if we're not allowed to create */
- if (!create)
- return NULL;
- if (state->numstates > 253) {
- ast_log(LOG_WARNING, "No more state space at line %d of %s\n", lineno, script);
- return NULL;
- }
- ast_copy_string(state->states[state->numstates].vname, name, sizeof(state->states[state->numstates].vname));
- state->states[state->numstates].id = state->numstates + 1;
- state->numstates++;
- return &state->states[state->numstates-1];
-}
-
-static struct adsi_display *getdisplaybyname(struct adsi_script *state, char *name, char *script, int lineno, int create)
-{
- int x;
- for (x=0;x<state->numdisplays;x++)
- if (!strcasecmp(state->displays[x].vname, name))
- return &state->displays[x];
- /* Return now if we're not allowed to create */
- if (!create)
- return NULL;
- if (state->numdisplays > 61) {
- ast_log(LOG_WARNING, "No more display space at line %d of %s\n", lineno, script);
- return NULL;
- }
- ast_copy_string(state->displays[state->numdisplays].vname, name, sizeof(state->displays[state->numdisplays].vname));
- state->displays[state->numdisplays].id = state->numdisplays + 1;
- state->numdisplays++;
- return &state->displays[state->numdisplays-1];
-}
-
-static int showkeys(char *buf, char *name, int id, char *args, struct adsi_script *state, char *script, int lineno)
-{
- char *tok;
- char newkey[80];
- int bytes;
- unsigned char keyid[6];
- int x;
- int flagid=0;
- struct adsi_soft_key *key;
- struct adsi_flag *flag;
-
- for (x=0;x<7;x++) {
- /* Up to 6 key arguments */
- tok = get_token(&args, script, lineno);
- if (!tok)
- break;
- if (!strcasecmp(tok, "UNLESS")) {
- /* Check for trailing UNLESS flag */
- tok = get_token(&args, script, lineno);
- if (!tok) {
- ast_log(LOG_WARNING, "Missing argument for UNLESS clause at line %d of %s\n", lineno, script);
- } else if (process_token(newkey, tok, sizeof(newkey) - 1, ARG_STRING)) {
- ast_log(LOG_WARNING, "Invalid flag name '%s' at line %d of %s\n", tok, lineno, script);
- } else if (!(flag = getflagbyname(state, newkey, script, lineno, 0))) {
- ast_log(LOG_WARNING, "Flag '%s' is undeclared at line %d of %s\n", newkey, lineno, script);
- } else
- flagid = flag->id;
- if ((tok = get_token(&args, script, lineno)))
- ast_log(LOG_WARNING, "Extra arguments after UNLESS clause: '%s' at line %d of %s\n", tok, lineno, script);
- break;
- }
- if (x > 5) {
- ast_log(LOG_WARNING, "Only 6 keys can be defined, ignoring '%s' at line %d of %s\n", tok, lineno, script);
- break;
- }
- if (process_token(newkey, tok, sizeof(newkey) - 1, ARG_STRING)) {
- ast_log(LOG_WARNING, "Invalid token for key name: %s\n", tok);
- continue;
- }
-
- key = getkeybyname(state, newkey, script, lineno);
- if (!key)
- break;
- keyid[x] = key->id;
- }
- buf[0] = id;
- buf[1] = (flagid & 0x7) << 3 | (x & 0x7);
- for (bytes=0;bytes<x;bytes++) {
- buf[bytes + 2] = keyid[bytes];
- }
- return 2 + x;
-}
-
-static int showdisplay(char *buf, char *name, int id, char *args, struct adsi_script *state, char *script, int lineno)
-{
- char *tok;
- char dispname[80];
- int line=0;
- int flag=0;
- int cmd = 3;
- struct adsi_display *disp;
-
- /* Get display */
- tok = get_token(&args, script, lineno);
- if (!tok || process_token(dispname, tok, sizeof(dispname) - 1, ARG_STRING)) {
- ast_log(LOG_WARNING, "Invalid display name: %s at line %d of %s\n", tok ? tok : "<nothing>", lineno, script);
- return 0;
- }
- disp = getdisplaybyname(state, dispname, script, lineno, 0);
- if (!disp) {
- ast_log(LOG_WARNING, "Display '%s' is undefined at line %d of %s\n", dispname, lineno, script);
- return 0;
- }
-
- tok = get_token(&args, script, lineno);
- if (!tok || strcasecmp(tok, "AT")) {
- ast_log(LOG_WARNING, "Missing token 'AT' at line %d of %s\n", lineno, script);
- return 0;
- }
- /* Get line number */
- tok = get_token(&args, script, lineno);
- if (!tok || process_token(&line, tok, sizeof(line), ARG_NUMBER)) {
- ast_log(LOG_WARNING, "Invalid line: '%s' at line %d of %s\n", tok ? tok : "<nothing>", lineno, script);
- return 0;
- }
- tok = get_token(&args, script, lineno);
- if (tok && !strcasecmp(tok, "NOUPDATE")) {
- cmd = 1;
- tok = get_token(&args, script, lineno);
- }
- if (tok && !strcasecmp(tok, "UNLESS")) {
- /* Check for trailing UNLESS flag */
- tok = get_token(&args, script, lineno);
- if (!tok) {
- ast_log(LOG_WARNING, "Missing argument for UNLESS clause at line %d of %s\n", lineno, script);
- } else if (process_token(&flag, tok, sizeof(flag), ARG_NUMBER)) {
- ast_log(LOG_WARNING, "Invalid flag number '%s' at line %d of %s\n", tok, lineno, script);
- }
- if ((tok = get_token(&args, script, lineno)))
- ast_log(LOG_WARNING, "Extra arguments after UNLESS clause: '%s' at line %d of %s\n", tok, lineno, script);
- }
-
- buf[0] = id;
- buf[1] = (cmd << 6) | (disp->id & 0x3f);
- buf[2] = ((line & 0x1f) << 3) | (flag & 0x7);
- return 3;
-}
-
-static int cleardisplay(char *buf, char *name, int id, char *args, struct adsi_script *istate, char *script, int lineno)
-{
- char *tok;
- tok = get_token(&args, script, lineno);
- if (tok)
- ast_log(LOG_WARNING, "Clearing display requires no arguments ('%s') at line %d of %s\n", tok, lineno, script);
-
- buf[0] = id;
- buf[1] = 0x00;
- return 2;
-}
-
-static int digitdirect(char *buf, char *name, int id, char *args, struct adsi_script *istate, char *script, int lineno)
-{
- char *tok;
- tok = get_token(&args, script, lineno);
- if (tok)
- ast_log(LOG_WARNING, "Digitdirect requires no arguments ('%s') at line %d of %s\n", tok, lineno, script);
-
- buf[0] = id;
- buf[1] = 0x7;
- return 2;
-}
-
-static int clearcbone(char *buf, char *name, int id, char *args, struct adsi_script *istate, char *script, int lineno)
-{
- char *tok;
- tok = get_token(&args, script, lineno);
- if (tok)
- ast_log(LOG_WARNING, "CLEARCB1 requires no arguments ('%s') at line %d of %s\n", tok, lineno, script);
-
- buf[0] = id;
- buf[1] = 0;
- return 2;
-}
-
-static int digitcollect(char *buf, char *name, int id, char *args, struct adsi_script *istate, char *script, int lineno)
-{
- char *tok;
- tok = get_token(&args, script, lineno);
- if (tok)
- ast_log(LOG_WARNING, "Digitcollect requires no arguments ('%s') at line %d of %s\n", tok, lineno, script);
-
- buf[0] = id;
- buf[1] = 0xf;
- return 2;
-}
-
-static int subscript(char *buf, char *name, int id, char *args, struct adsi_script *state, char *script, int lineno)
-{
- char *tok;
- char subscript[80];
- struct adsi_subscript *sub;
- tok = get_token(&args, script, lineno);
- if (!tok) {
- ast_log(LOG_WARNING, "Missing subscript to call at line %d of %s\n", lineno, script);
- return 0;
- }
- if (process_token(subscript, tok, sizeof(subscript) - 1, ARG_STRING)) {
- ast_log(LOG_WARNING, "Invalid number of seconds '%s' at line %d of %s\n", tok, lineno, script);
- return 0;
- }
- sub = getsubbyname(state, subscript, script, lineno);
- if (!sub)
- return 0;
- buf[0] = 0x9d;
- buf[1] = sub->id;
- return 2;
-}
-
-static int onevent(char *buf, char *name, int id, char *args, struct adsi_script *state, char *script, int lineno)
-{
- char *tok;
- char subscript[80];
- char sname[80];
- int sawin=0;
- int event;
- int snums[8];
- int scnt = 0;
- int x;
- struct adsi_subscript *sub;
- tok = get_token(&args, script, lineno);
- if (!tok) {
- ast_log(LOG_WARNING, "Missing event for 'ONEVENT' at line %d of %s\n", lineno, script);
- return 0;
- }
- event = geteventbyname(tok);
- if (event < 1) {
- ast_log(LOG_WARNING, "'%s' is not a valid event name, at line %d of %s\n", args, lineno, script);
- return 0;
- }
- tok = get_token(&args, script, lineno);
- while ((!sawin && !strcasecmp(tok, "IN")) ||
- (sawin && !strcasecmp(tok, "OR"))) {
- sawin = 1;
- if (scnt > 7) {
- ast_log(LOG_WARNING, "No more than 8 states may be specified for inclusion at line %d of %s\n", lineno, script);
- return 0;
- }
- /* Process 'in' things */
- tok = get_token(&args, script, lineno);
- if (process_token(sname, tok, sizeof(sname), ARG_STRING)) {
- ast_log(LOG_WARNING, "'%s' is not a valid state name at line %d of %s\n", tok, lineno, script);
- return 0;
- }
- if ((snums[scnt] = getstatebyname(state, sname, script, lineno, 0) < 0)) {
- ast_log(LOG_WARNING, "State '%s' not declared at line %d of %s\n", sname, lineno, script);
- return 0;
- }
- scnt++;
- tok = get_token(&args, script, lineno);
- if (!tok)
- break;
- }
- if (!tok || strcasecmp(tok, "GOTO")) {
- if (!tok)
- tok = "<nothing>";
- if (sawin)
- ast_log(LOG_WARNING, "Got '%s' while looking for 'GOTO' or 'OR' at line %d of %s\n", tok, lineno, script);
- else
- ast_log(LOG_WARNING, "Got '%s' while looking for 'GOTO' or 'IN' at line %d of %s\n", tok, lineno, script);
- }
- tok = get_token(&args, script, lineno);
- if (!tok) {
- ast_log(LOG_WARNING, "Missing subscript to call at line %d of %s\n", lineno, script);
- return 0;
- }
- if (process_token(subscript, tok, sizeof(subscript) - 1, ARG_STRING)) {
- ast_log(LOG_WARNING, "Invalid subscript '%s' at line %d of %s\n", tok, lineno, script);
- return 0;
- }
- sub = getsubbyname(state, subscript, script, lineno);
- if (!sub)
- return 0;
- buf[0] = 8;
- buf[1] = event;
- buf[2] = sub->id | 0x80;
- for (x=0;x<scnt;x++)
- buf[3 + x] = snums[x];
- return 3 + scnt;
-}
-
-struct adsi_key_cmd {
- char *name;
- int id;
- int (*add_args)(char *buf, char *name, int id, char *args, struct adsi_script *state, char *script, int lineno);
-};
-
-static struct adsi_key_cmd kcmds[] = {
- { "SENDDTMF", 0, send_dtmf },
- /* Encoded DTMF would go here */
- { "ONHOOK", 0x81 },
- { "OFFHOOK", 0x82 },
- { "FLASH", 0x83 },
- { "WAITDIALTONE", 0x84 },
- /* Send line number */
- { "BLANK", 0x86 },
- { "SENDCHARS", 0x87 },
- { "CLEARCHARS", 0x88 },
- { "BACKSPACE", 0x89 },
- /* Tab column */
- { "GOTOLINE", 0x8b, goto_line },
- { "GOTOLINEREL", 0x8c, goto_line_rel },
- { "PAGEUP", 0x8d },
- { "PAGEDOWN", 0x8e },
- /* Extended DTMF */
- { "DELAY", 0x90, send_delay },
- { "DIALPULSEONE", 0x91 },
- { "DATAMODE", 0x92 },
- { "VOICEMODE", 0x93 },
- /* Display call buffer 'n' */
- /* Clear call buffer 'n' */
- { "CLEARCB1", 0x95, clearcbone },
- { "DIGITCOLLECT", 0x96, digitcollect },
- { "DIGITDIRECT", 0x96, digitdirect },
- { "CLEAR", 0x97 },
- { "SHOWDISPLAY", 0x98, showdisplay },
- { "CLEARDISPLAY", 0x98, cleardisplay },
- { "SHOWKEYS", 0x99, showkeys },
- { "SETSTATE", 0x9a, set_state },
- { "TIMERSTART", 0x9b, starttimer },
- { "TIMERCLEAR", 0x9b, cleartimer },
- { "SETFLAG", 0x9c, setflag },
- { "CLEARFLAG", 0x9c, clearflag },
- { "GOTO", 0x9d, subscript },
- { "EVENT22", 0x9e },
- { "EVENT23", 0x9f },
- { "EXIT", 0xa0 },
-};
-
-static struct adsi_key_cmd opcmds[] = {
-
- /* 1 - Branch on event -- handled specially */
- { "SHOWKEYS", 2, showkeys },
- /* Display Control */
- { "SHOWDISPLAY", 3, showdisplay },
- { "CLEARDISPLAY", 3, cleardisplay },
- { "CLEAR", 5 },
- { "SETSTATE", 6, set_state },
- { "TIMERSTART", 7, starttimer },
- { "TIMERCLEAR", 7, cleartimer },
- { "ONEVENT", 8, onevent },
- /* 9 - Subroutine label, treated specially */
- { "SETFLAG", 10, setflag },
- { "CLEARFLAG", 10, clearflag },
- { "DELAY", 11, send_delay },
- { "EXIT", 12 },
-};
-
-
-static int process_returncode(struct adsi_soft_key *key, char *code, char *args, struct adsi_script *state, char *script, int lineno)
-{
- int x;
- char *unused;
- int res;
- for (x=0;x<sizeof(kcmds) / sizeof(kcmds[0]);x++) {
- if ((kcmds[x].id > -1) && !strcasecmp(kcmds[x].name, code)) {
- if (kcmds[x].add_args) {
- res = kcmds[x].add_args(key->retstr + key->retstrlen,
- code, kcmds[x].id, args, state, script, lineno);
- if ((key->retstrlen + res - key->initlen) <= MAX_RET_CODE)
- key->retstrlen += res;
- else
- ast_log(LOG_WARNING, "No space for '%s' code in key '%s' at line %d of %s\n", kcmds[x].name, key->vname, lineno, script);
- } else {
- if ((unused = get_token(&args, script, lineno)))
- ast_log(LOG_WARNING, "'%s' takes no arguments at line %d of %s (token is '%s')\n", kcmds[x].name, lineno, script, unused);
- if ((key->retstrlen + 1 - key->initlen) <= MAX_RET_CODE) {
- key->retstr[key->retstrlen] = kcmds[x].id;
- key->retstrlen++;
- } else
- ast_log(LOG_WARNING, "No space for '%s' code in key '%s' at line %d of %s\n", kcmds[x].name, key->vname, lineno, script);
- }
- return 0;
- }
- }
- return -1;
-}
-
-static int process_opcode(struct adsi_subscript *sub, char *code, char *args, struct adsi_script *state, char *script, int lineno)
-{
- int x;
- char *unused;
- int res;
- int max = sub->id ? MAX_SUB_LEN : MAX_MAIN_LEN;
- for (x=0;x<sizeof(opcmds) / sizeof(opcmds[0]);x++) {
- if ((opcmds[x].id > -1) && !strcasecmp(opcmds[x].name, code)) {
- if (opcmds[x].add_args) {
- res = opcmds[x].add_args(sub->data + sub->datalen,
- code, opcmds[x].id, args, state, script, lineno);
- if ((sub->datalen + res + 1) <= max)
- sub->datalen += res;
- else {
- ast_log(LOG_WARNING, "No space for '%s' code in subscript '%s' at line %d of %s\n", opcmds[x].name, sub->vname, lineno, script);
- return -1;
- }
- } else {
- if ((unused = get_token(&args, script, lineno)))
- ast_log(LOG_WARNING, "'%s' takes no arguments at line %d of %s (token is '%s')\n", opcmds[x].name, lineno, script, unused);
- if ((sub->datalen + 2) <= max) {
- sub->data[sub->datalen] = opcmds[x].id;
- sub->datalen++;
- } else {
- ast_log(LOG_WARNING, "No space for '%s' code in key '%s' at line %d of %s\n", opcmds[x].name, sub->vname, lineno, script);
- return -1;
- }
- }
- /* Separate commands with 0xff */
- sub->data[sub->datalen] = 0xff;
- sub->datalen++;
- sub->inscount++;
- return 0;
- }
- }
- return -1;
-}
-
-static int adsi_process(struct adsi_script *state, char *buf, char *script, int lineno)
-{
- char *keyword;
- char *args;
- char vname[256];
- char tmp[80];
- char tmp2[80];
- int lrci;
- int wi;
- int event;
- struct adsi_display *disp;
- struct adsi_subscript *newsub;
- /* Find the first keyword */
- keyword = get_token(&buf, script, lineno);
- if (!keyword)
- return 0;
- switch(state->state) {
- case STATE_NORMAL:
- if (!strcasecmp(keyword, "DESCRIPTION")) {
- args = get_token(&buf, script, lineno);
- if (args) {
- if (process_token(state->desc, args, sizeof(state->desc) - 1, ARG_STRING))
- ast_log(LOG_WARNING, "'%s' is not a valid token for DESCRIPTION at line %d of %s\n", args, lineno, script);
- } else
- ast_log(LOG_WARNING, "Missing argument for DESCRIPTION at line %d of %s\n", lineno, script);
- } else if (!strcasecmp(keyword, "VERSION")) {
- args = get_token(&buf, script, lineno);
- if (args) {
- if (process_token(&state->ver, args, sizeof(state->ver) - 1, ARG_NUMBER))
- ast_log(LOG_WARNING, "'%s' is not a valid token for VERSION at line %d of %s\n", args, lineno, script);
- } else
- ast_log(LOG_WARNING, "Missing argument for VERSION at line %d of %s\n", lineno, script);
- } else if (!strcasecmp(keyword, "SECURITY")) {
- args = get_token(&buf, script, lineno);
- if (args) {
- if (process_token(state->sec, args, sizeof(state->sec) - 1, ARG_STRING | ARG_NUMBER))
- ast_log(LOG_WARNING, "'%s' is not a valid token for SECURITY at line %d of %s\n", args, lineno, script);
- } else
- ast_log(LOG_WARNING, "Missing argument for SECURITY at line %d of %s\n", lineno, script);
- } else if (!strcasecmp(keyword, "FDN")) {
- args = get_token(&buf, script, lineno);
- if (args) {
- if (process_token(state->fdn, args, sizeof(state->fdn) - 1, ARG_STRING | ARG_NUMBER))
- ast_log(LOG_WARNING, "'%s' is not a valid token for FDN at line %d of %s\n", args, lineno, script);
- } else
- ast_log(LOG_WARNING, "Missing argument for FDN at line %d of %s\n", lineno, script);
- } else if (!strcasecmp(keyword, "KEY")) {
- args = get_token(&buf, script, lineno);
- if (!args) {
- ast_log(LOG_WARNING, "KEY definition missing name at line %d of %s\n", lineno, script);
- break;
- }
- if (process_token(vname, args, sizeof(vname) - 1, ARG_STRING)) {
- ast_log(LOG_WARNING, "'%s' is not a valid token for a KEY name at line %d of %s\n", args, lineno, script);
- break;
- }
- state->key = getkeybyname(state, vname, script, lineno);
- if (!state->key) {
- ast_log(LOG_WARNING, "Out of key space at line %d of %s\n", lineno, script);
- break;
- }
- if (state->key->defined) {
- ast_log(LOG_WARNING, "Cannot redefine key '%s' at line %d of %s\n", vname, lineno, script);
- break;
- }
- args = get_token(&buf, script, lineno);
- if (!args || strcasecmp(args, "IS")) {
- ast_log(LOG_WARNING, "Expecting 'IS', but got '%s' at line %d of %s\n", args ? args : "<nothing>", lineno, script);
- break;
- }
- args = get_token(&buf, script, lineno);
- if (!args) {
- ast_log(LOG_WARNING, "KEY definition missing short name at line %d of %s\n", lineno, script);
- break;
- }
- if (process_token(tmp, args, sizeof(tmp) - 1, ARG_STRING)) {
- ast_log(LOG_WARNING, "'%s' is not a valid token for a KEY short name at line %d of %s\n", args, lineno, script);
- break;
- }
- args = get_token(&buf, script, lineno);
- if (args) {
- if (strcasecmp(args, "OR")) {
- ast_log(LOG_WARNING, "Expecting 'OR' but got '%s' instead at line %d of %s\n", args, lineno, script);
- break;
- }
- args = get_token(&buf, script, lineno);
- if (!args) {
- ast_log(LOG_WARNING, "KEY definition missing optional long name at line %d of %s\n", lineno, script);
- break;
- }
- if (process_token(tmp2, args, sizeof(tmp2) - 1, ARG_STRING)) {
- ast_log(LOG_WARNING, "'%s' is not a valid token for a KEY long name at line %d of %s\n", args, lineno, script);
- break;
- }
- } else {
- ast_copy_string(tmp2, tmp, sizeof(tmp2));
- }
- if (strlen(tmp2) > 18) {
- ast_log(LOG_WARNING, "Truncating full name to 18 characters at line %d of %s\n", lineno, script);
- tmp2[18] = '\0';
- }
- if (strlen(tmp) > 7) {
- ast_log(LOG_WARNING, "Truncating short name to 7 bytes at line %d of %s\n", lineno, script);
- tmp[7] = '\0';
- }
- /* Setup initial stuff */
- state->key->retstr[0] = 128;
- /* 1 has the length */
- state->key->retstr[2] = state->key->id;
- /* Put the Full name in */
- memcpy(state->key->retstr + 3, tmp2, strlen(tmp2));
- /* Update length */
- state->key->retstrlen = strlen(tmp2) + 3;
- /* Put trailing 0xff */
- state->key->retstr[state->key->retstrlen++] = 0xff;
- /* Put the short name */
- memcpy(state->key->retstr + state->key->retstrlen, tmp, strlen(tmp));
- /* Update length */
- state->key->retstrlen += strlen(tmp);
- /* Put trailing 0xff */
- state->key->retstr[state->key->retstrlen++] = 0xff;
- /* Record initial length */
- state->key->initlen = state->key->retstrlen;
- state->state = STATE_INKEY;
- } else if (!strcasecmp(keyword, "SUB")) {
- args = get_token(&buf, script, lineno);
- if (!args) {
- ast_log(LOG_WARNING, "SUB definition missing name at line %d of %s\n", lineno, script);
- break;
- }
- if (process_token(vname, args, sizeof(vname) - 1, ARG_STRING)) {
- ast_log(LOG_WARNING, "'%s' is not a valid token for a KEY name at line %d of %s\n", args, lineno, script);
- break;
- }
- state->sub = getsubbyname(state, vname, script, lineno);
- if (!state->sub) {
- ast_log(LOG_WARNING, "Out of subroutine space at line %d of %s\n", lineno, script);
- break;
- }
- if (state->sub->defined) {
- ast_log(LOG_WARNING, "Cannot redefine subroutine '%s' at line %d of %s\n", vname, lineno, script);
- break;
- }
- /* Setup sub */
- state->sub->data[0] = 130;
- /* 1 is the length */
- state->sub->data[2] = 0x0; /* Clear extensibility bit */
- state->sub->datalen = 3;
- if (state->sub->id) {
- /* If this isn't the main subroutine, make a subroutine label for it */
- state->sub->data[3] = 9;
- state->sub->data[4] = state->sub->id;
- /* 5 is length */
- state->sub->data[6] = 0xff;
- state->sub->datalen = 7;
- }
- args = get_token(&buf, script, lineno);
- if (!args || strcasecmp(args, "IS")) {
- ast_log(LOG_WARNING, "Expecting 'IS', but got '%s' at line %d of %s\n", args ? args : "<nothing>", lineno, script);
- break;
- }
- state->state = STATE_INSUB;
- } else if (!strcasecmp(keyword, "STATE")) {
- args = get_token(&buf, script, lineno);
- if (!args) {
- ast_log(LOG_WARNING, "STATE definition missing name at line %d of %s\n", lineno, script);
- break;
- }
- if (process_token(vname, args, sizeof(vname) - 1, ARG_STRING)) {
- ast_log(LOG_WARNING, "'%s' is not a valid token for a STATE name at line %d of %s\n", args, lineno, script);
- break;
- }
- if (getstatebyname(state, vname, script, lineno, 0)) {
- ast_log(LOG_WARNING, "State '%s' is already defined at line %d of %s\n", vname, lineno, script);
- break;
- }
- getstatebyname(state, vname, script, lineno, 1);
- } else if (!strcasecmp(keyword, "FLAG")) {
- args = get_token(&buf, script, lineno);
- if (!args) {
- ast_log(LOG_WARNING, "FLAG definition missing name at line %d of %s\n", lineno, script);
- break;
- }
- if (process_token(vname, args, sizeof(vname) - 1, ARG_STRING)) {
- ast_log(LOG_WARNING, "'%s' is not a valid token for a FLAG name at line %d of %s\n", args, lineno, script);
- break;
- }
- if (getflagbyname(state, vname, script, lineno, 0)) {
- ast_log(LOG_WARNING, "Flag '%s' is already defined\n", vname);
- break;
- }
- getflagbyname(state, vname, script, lineno, 1);
- } else if (!strcasecmp(keyword, "DISPLAY")) {
- lrci = 0;
- wi = 0;
- args = get_token(&buf, script, lineno);
- if (!args) {
- ast_log(LOG_WARNING, "SUB definition missing name at line %d of %s\n", lineno, script);
- break;
- }
- if (process_token(vname, args, sizeof(vname) - 1, ARG_STRING)) {
- ast_log(LOG_WARNING, "'%s' is not a valid token for a KEY name at line %d of %s\n", args, lineno, script);
- break;
- }
- if (getdisplaybyname(state, vname, script, lineno, 0)) {
- ast_log(LOG_WARNING, "State '%s' is already defined\n", vname);
- break;
- }
- disp = getdisplaybyname(state, vname, script, lineno, 1);
- if (!disp)
- break;
- args = get_token(&buf, script, lineno);
- if (!args || strcasecmp(args, "IS")) {
- ast_log(LOG_WARNING, "Missing 'IS' at line %d of %s\n", lineno, script);
- break;
- }
- args = get_token(&buf, script, lineno);
- if (!args) {
- ast_log(LOG_WARNING, "Missing Column 1 text at line %d of %s\n", lineno, script);
- break;
- }
- if (process_token(tmp, args, sizeof(tmp) - 1, ARG_STRING)) {
- ast_log(LOG_WARNING, "Token '%s' is not valid column 1 text at line %d of %s\n", args, lineno, script);
- break;
- }
- if (strlen(tmp) > 20) {
- ast_log(LOG_WARNING, "Truncating column one to 20 characters at line %d of %s\n", lineno, script);
- tmp[20] = '\0';
- }
- memcpy(disp->data + 5, tmp, strlen(tmp));
- disp->datalen = strlen(tmp) + 5;
- disp->data[disp->datalen++] = 0xff;
-
- args = get_token(&buf, script, lineno);
- if (args && !process_token(tmp, args, sizeof(tmp) - 1, ARG_STRING)) {
- /* Got a column two */
- if (strlen(tmp) > 20) {
- ast_log(LOG_WARNING, "Truncating column two to 20 characters at line %d of %s\n", lineno, script);
- tmp[20] = '\0';
- }
- memcpy(disp->data + disp->datalen, tmp, strlen(tmp));
- disp->datalen += strlen(tmp);
- args = get_token(&buf, script, lineno);
- }
- while(args) {
- if (!strcasecmp(args, "JUSTIFY")) {
- args = get_token(&buf, script, lineno);
- if (!args) {
- ast_log(LOG_WARNING, "Qualifier 'JUSTIFY' requires an argument at line %d of %s\n", lineno, script);
- break;
- }
- lrci = getjustifybyname(args);
- if (lrci < 0) {
- ast_log(LOG_WARNING, "'%s' is not a valid justification at line %d of %s\n", args, lineno, script);
- break;
- }
- } else if (!strcasecmp(args, "WRAP")) {
- wi = 0x80;
- } else {
- ast_log(LOG_WARNING, "'%s' is not a known qualifier at line %d of %s\n", args, lineno, script);
- break;
- }
- args = get_token(&buf, script, lineno);
- }
- if (args) {
- /* Something bad happened */
- break;
- }
- disp->data[0] = 129;
- disp->data[1] = disp->datalen - 2;
- disp->data[2] = ((lrci & 0x3) << 6) | disp->id;
- disp->data[3] = wi;
- disp->data[4] = 0xff;
- } else {
- ast_log(LOG_WARNING, "Invalid or Unknown keyword '%s' in PROGRAM\n", keyword);
- }
- break;
- case STATE_INKEY:
- if (process_returncode(state->key, keyword, buf, state, script, lineno)) {
- if (!strcasecmp(keyword, "ENDKEY")) {
- /* Return to normal operation and increment current key */
- state->state = STATE_NORMAL;
- state->key->defined = 1;
- state->key->retstr[1] = state->key->retstrlen - 2;
- state->key = NULL;
- } else {
- ast_log(LOG_WARNING, "Invalid or Unknown keyword '%s' in SOFTKEY definition at line %d of %s\n", keyword, lineno, script);
- }
- }
- break;
- case STATE_INIF:
- if (process_opcode(state->sub, keyword, buf, state, script, lineno)) {
- if (!strcasecmp(keyword, "ENDIF")) {
- /* Return to normal SUB operation and increment current key */
- state->state = STATE_INSUB;
- state->sub->defined = 1;
- /* Store the proper number of instructions */
- state->sub->ifdata[2] = state->sub->ifinscount;
- } else if (!strcasecmp(keyword, "GOTO")) {
- args = get_token(&buf, script, lineno);
- if (!args) {
- ast_log(LOG_WARNING, "GOTO clause missing Subscript name at line %d of %s\n", lineno, script);
- break;
- }
- if (process_token(tmp, args, sizeof(tmp) - 1, ARG_STRING)) {
- ast_log(LOG_WARNING, "'%s' is not a valid subscript name token at line %d of %s\n", args, lineno, script);
- break;
- }
- newsub = getsubbyname(state, tmp, script, lineno);
- if (!newsub)
- break;
- /* Somehow you use GOTO to go to another place */
- state->sub->data[state->sub->datalen++] = 0x8;
- state->sub->data[state->sub->datalen++] = state->sub->ifdata[1];
- state->sub->data[state->sub->datalen++] = newsub->id;
- /* Terminate */
- state->sub->data[state->sub->datalen++] = 0xff;
- /* Increment counters */
- state->sub->inscount++;
- state->sub->ifinscount++;
- } else {
- ast_log(LOG_WARNING, "Invalid or Unknown keyword '%s' in IF clause at line %d of %s\n", keyword, lineno, script);
- }
- } else
- state->sub->ifinscount++;
- break;
- case STATE_INSUB:
- if (process_opcode(state->sub, keyword, buf, state, script, lineno)) {
- if (!strcasecmp(keyword, "ENDSUB")) {
- /* Return to normal operation and increment current key */
- state->state = STATE_NORMAL;
- state->sub->defined = 1;
- /* Store the proper length */
- state->sub->data[1] = state->sub->datalen - 2;
- if (state->sub->id) {
- /* if this isn't main, store number of instructions, too */
- state->sub->data[5] = state->sub->inscount;
- }
- state->sub = NULL;
- } else if (!strcasecmp(keyword, "IFEVENT")) {
- args = get_token(&buf, script, lineno);
- if (!args) {
- ast_log(LOG_WARNING, "IFEVENT clause missing Event name at line %d of %s\n", lineno, script);
- break;
- }
- event = geteventbyname(args);
- if (event < 1) {
- ast_log(LOG_WARNING, "'%s' is not a valid event\n", args);
- break;
- }
- args = get_token(&buf, script, lineno);
- if (!args || strcasecmp(args, "THEN")) {
- ast_log(LOG_WARNING, "IFEVENT clause missing 'THEN' at line %d of %s\n", lineno, script);
- break;
- }
- state->sub->ifinscount = 0;
- state->sub->ifdata = state->sub->data +
- state->sub->datalen;
- /* Reserve header and insert op codes */
- state->sub->ifdata[0] = 0x1;
- state->sub->ifdata[1] = event;
- /* 2 is for the number of instructions */
- state->sub->ifdata[3] = 0xff;
- state->sub->datalen += 4;
- /* Update Subscript instruction count */
- state->sub->inscount++;
- state->state = STATE_INIF;
- } else {
- ast_log(LOG_WARNING, "Invalid or Unknown keyword '%s' in SUB definition at line %d of %s\n", keyword, lineno, script);
- }
- }
- break;
- default:
- ast_log(LOG_WARNING, "Can't process keyword '%s' in weird state %d\n", keyword, state->state);
- }
- return 0;
-}
-
-static struct adsi_script *compile_script(char *script)
-{
- FILE *f;
- char fn[256];
- char buf[256];
- char *c;
- int lineno=0;
- int x, err;
- struct adsi_script *scr;
- if (script[0] == '/')
- ast_copy_string(fn, script, sizeof(fn));
- else
- snprintf(fn, sizeof(fn), "%s/%s", (char *)ast_config_AST_CONFIG_DIR, script);
- f = fopen(fn, "r");
- if (!f) {
- ast_log(LOG_WARNING, "Can't open file '%s'\n", fn);
- return NULL;
- }
- scr = malloc(sizeof(struct adsi_script));
- if (!scr) {
- fclose(f);
- ast_log(LOG_WARNING, "Out of memory loading script '%s'\n", fn);
- return NULL;
- }
- memset(scr, 0, sizeof(struct adsi_script));
- /* Create "main" as first subroutine */
- getsubbyname(scr, "main", NULL, 0);
- while(!feof(f)) {
- fgets(buf, sizeof(buf), f);
- if (!feof(f)) {
- lineno++;
- /* Trim off trailing return */
- buf[strlen(buf) - 1] = '\0';
- c = strchr(buf, ';');
- /* Strip comments */
- if (c)
- *c = '\0';
- if (!ast_strlen_zero(buf))
- adsi_process(scr, buf, script, lineno);
- }
- }
- fclose(f);
- /* Make sure we're in the main routine again */
- switch(scr->state) {
- case STATE_NORMAL:
- break;
- case STATE_INSUB:
- ast_log(LOG_WARNING, "Missing ENDSUB at end of file %s\n", script);
- free(scr);
- return NULL;
- case STATE_INKEY:
- ast_log(LOG_WARNING, "Missing ENDKEY at end of file %s\n", script);
- free(scr);
- return NULL;
- }
- err = 0;
-
- /* Resolve all keys and record their lengths */
- for (x=0;x<scr->numkeys;x++) {
- if (!scr->keys[x].defined) {
- ast_log(LOG_WARNING, "Key '%s' referenced but never defined in file %s\n", scr->keys[x].vname, fn);
- err++;
- }
- }
-
- /* Resolve all subs */
- for (x=0;x<scr->numsubs;x++) {
- if (!scr->subs[x].defined) {
- ast_log(LOG_WARNING, "Subscript '%s' referenced but never defined in file %s\n", scr->subs[x].vname, fn);
- err++;
- }
- if (x == (scr->numsubs - 1)) {
- /* Clear out extension bit on last message */
- scr->subs[x].data[2] = 0x80;
- }
- }
-
- if (err) {
- free(scr);
- return NULL;
- }
- return scr;
-}
-
-#ifdef DUMP_MESSAGES
-static void dump_message(char *type, char *vname, unsigned char *buf, int buflen)
-{
- int x;
- printf("%s %s: [ ", type, vname);
- for (x=0;x<buflen;x++)
- printf("%02x ", buf[x]);
- printf("]\n");
-}
-#endif
-
-static int adsi_prog(struct ast_channel *chan, char *script)
-{
- struct adsi_script *scr;
- int x;
- unsigned char buf[1024];
- int bytes;
- scr = compile_script(script);
- if (!scr)
- return -1;
-
- /* Start an empty ADSI Session */
- if (adsi_load_session(chan, NULL, 0, 1) < 1)
- return -1;
-
- /* Now begin the download attempt */
- if (adsi_begin_download(chan, scr->desc, scr->fdn, scr->sec, scr->ver)) {
- /* User rejected us for some reason */
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "User rejected download attempt\n");
- ast_log(LOG_NOTICE, "User rejected download on channel %s\n", chan->name);
- free(scr);
- return -1;
- }
-
- bytes = 0;
- /* Start with key definitions */
- for (x=0;x<scr->numkeys;x++) {
- if (bytes + scr->keys[x].retstrlen > 253) {
- /* Send what we've collected so far */
- if (adsi_transmit_message(chan, buf, bytes, ADSI_MSG_DOWNLOAD)) {
- ast_log(LOG_WARNING, "Unable to send chunk ending at %d\n", x);
- return -1;
- }
- bytes =0;
- }
- memcpy(buf + bytes, scr->keys[x].retstr, scr->keys[x].retstrlen);
- bytes += scr->keys[x].retstrlen;
-#ifdef DUMP_MESSAGES
- dump_message("Key", scr->keys[x].vname, scr->keys[x].retstr, scr->keys[x].retstrlen);
-#endif
- }
- if (bytes) {
- if (adsi_transmit_message(chan, buf, bytes, ADSI_MSG_DOWNLOAD)) {
- ast_log(LOG_WARNING, "Unable to send chunk ending at %d\n", x);
- return -1;
- }
- }
-
- bytes = 0;
- /* Continue with the display messages */
- for (x=0;x<scr->numdisplays;x++) {
- if (bytes + scr->displays[x].datalen > 253) {
- /* Send what we've collected so far */
- if (adsi_transmit_message(chan, buf, bytes, ADSI_MSG_DOWNLOAD)) {
- ast_log(LOG_WARNING, "Unable to send chunk ending at %d\n", x);
- return -1;
- }
- bytes =0;
- }
- memcpy(buf + bytes, scr->displays[x].data, scr->displays[x].datalen);
- bytes += scr->displays[x].datalen;
-#ifdef DUMP_MESSAGES
- dump_message("Display", scr->displays[x].vname, scr->displays[x].data, scr->displays[x].datalen);
-#endif
- }
- if (bytes) {
- if (adsi_transmit_message(chan, buf, bytes, ADSI_MSG_DOWNLOAD)) {
- ast_log(LOG_WARNING, "Unable to send chunk ending at %d\n", x);
- return -1;
- }
- }
-
- bytes = 0;
- /* Send subroutines */
- for (x=0;x<scr->numsubs;x++) {
- if (bytes + scr->subs[x].datalen > 253) {
- /* Send what we've collected so far */
- if (adsi_transmit_message(chan, buf, bytes, ADSI_MSG_DOWNLOAD)) {
- ast_log(LOG_WARNING, "Unable to send chunk ending at %d\n", x);
- return -1;
- }
- bytes =0;
- }
- memcpy(buf + bytes, scr->subs[x].data, scr->subs[x].datalen);
- bytes += scr->subs[x].datalen;
-#ifdef DUMP_MESSAGES
- dump_message("Sub", scr->subs[x].vname, scr->subs[x].data, scr->subs[x].datalen);
-#endif
- }
- if (bytes) {
- if (adsi_transmit_message(chan, buf, bytes, ADSI_MSG_DOWNLOAD)) {
- ast_log(LOG_WARNING, "Unable to send chunk ending at %d\n", x);
- return -1;
- }
- }
-
-
- bytes = 0;
- bytes += adsi_display(buf, ADSI_INFO_PAGE, 1, ADSI_JUST_LEFT, 0, "Download complete.", "");
- bytes += adsi_set_line(buf, ADSI_INFO_PAGE, 1);
- if (adsi_transmit_message(chan, buf, bytes, ADSI_MSG_DISPLAY) < 0)
- return -1;
- if (adsi_end_download(chan)) {
- /* Download failed for some reason */
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "Download attempt failed\n");
- ast_log(LOG_NOTICE, "Download failed on %s\n", chan->name);
- free(scr);
- return -1;
- }
- free(scr);
- adsi_unload_session(chan);
- return 0;
-}
-
-static int adsi_exec(struct ast_channel *chan, void *data)
-{
- int res=0;
- struct localuser *u;
-
- LOCAL_USER_ADD(u);
-
- if (ast_strlen_zero(data))
- data = "asterisk.adsi";
-
- if (!adsi_available(chan)) {
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "ADSI Unavailable on CPE. Not bothering to try.\n");
- } else {
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "ADSI Available on CPE. Attempting Upload.\n");
- res = adsi_prog(chan, data);
- }
-
- LOCAL_USER_REMOVE(u);
-
- return res;
-}
-
-int unload_module(void)
-{
- int res;
-
- res = ast_unregister_application(app);
-
- STANDARD_HANGUP_LOCALUSERS;
-
- return res;
-}
-
-int load_module(void)
-{
- return ast_register_application(app, adsi_exec, synopsis, descrip);
-}
-
-char *description(void)
-{
- return tdesc;
-}
-
-int usecount(void)
-{
- int res;
- STANDARD_USECOUNT(res);
- return res;
-}
-
-char *key()
-{
- return ASTERISK_GPL_KEY;
-}
diff --git a/1.2-netsec/apps/app_alarmreceiver.c b/1.2-netsec/apps/app_alarmreceiver.c
deleted file mode 100644
index 7c36b60b8..000000000
--- a/1.2-netsec/apps/app_alarmreceiver.c
+++ /dev/null
@@ -1,867 +0,0 @@
-/*
- * Asterisk -- An open source telephony toolkit.
- *
- * Copyright (C) 2004 - 2005 Steve Rodgers
- *
- * Steve Rodgers <hwstar@rodgers.sdcoxmail.com>
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE file
- * at the top of the source tree.
- */
-
-/*! \file
- * \brief Central Station Alarm receiver for Ademco Contact ID
- * \author Steve Rodgers <hwstar@rodgers.sdcoxmail.com>
- *
- * *** WARNING *** WARNING *** WARNING *** WARNING *** WARNING *** WARNING *** WARNING *** WARNING ***
- *
- * Use at your own risk. Please consult the GNU GPL license document included with Asterisk details. *
- *
- * *** WARNING *** WARNING *** WARNING *** WARNING *** WARNING *** WARNING *** WARNING *** WARNING ***
- *
- * \ingroup applications
- */
-
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <sys/wait.h>
-#include <unistd.h>
-#include <sys/time.h>
-
-#include "asterisk.h"
-
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-
-#include "asterisk/lock.h"
-#include "asterisk/file.h"
-#include "asterisk/logger.h"
-#include "asterisk/channel.h"
-#include "asterisk/pbx.h"
-#include "asterisk/module.h"
-#include "asterisk/translate.h"
-#include "asterisk/ulaw.h"
-#include "asterisk/options.h"
-#include "asterisk/app.h"
-#include "asterisk/dsp.h"
-#include "asterisk/config.h"
-#include "asterisk/localtime.h"
-#include "asterisk/callerid.h"
-#include "asterisk/astdb.h"
-
-#define ALMRCV_CONFIG "alarmreceiver.conf"
-#define ADEMCO_CONTACT_ID "ADEMCO_CONTACT_ID"
-
-struct event_node{
- char data[17];
- struct event_node *next;
-};
-
-typedef struct event_node event_node_t;
-
-static char *tdesc = "Alarm Receiver for Asterisk";
-
-static char *app = "AlarmReceiver";
-
-static char *synopsis = "Provide support for receving alarm reports from a burglar or fire alarm panel";
-static char *descrip =
-" AlarmReceiver(): Only 1 signalling format is supported at this time: Ademco\n"
-"Contact ID. This application should be called whenever there is an alarm\n"
-"panel calling in to dump its events. The application will handshake with the\n"
-"alarm panel, and receive events, validate them, handshake them, and store them\n"
-"until the panel hangs up. Once the panel hangs up, the application will run the\n"
-"system command specified by the eventcmd setting in alarmreceiver.conf and pipe\n"
-"the events to the standard input of the application. The configuration file also\n"
-"contains settings for DTMF timing, and for the loudness of the acknowledgement\n"
-"tones.\n";
-
-/* Config Variables */
-
-static int fdtimeout = 2000;
-static int sdtimeout = 200;
-static int toneloudness = 4096;
-static int log_individual_events = 0;
-static char event_spool_dir[128] = {'\0'};
-static char event_app[128] = {'\0'};
-static char db_family[128] = {'\0'};
-static char time_stamp_format[128] = {"%a %b %d, %Y @ %H:%M:%S %Z"};
-
-
-/* Misc variables */
-
-
-static char event_file[14] = "/event-XXXXXX";
-
-
-
-STANDARD_LOCAL_USER;
-
-LOCAL_USER_DECL;
-
-/*
-* Attempt to access a database variable and increment it,
-* provided that the user defined db-family in alarmreceiver.conf
-* The alarmreceiver app will write statistics to a few variables
-* in this family if it is defined. If the new key doesn't exist in the
-* family, then create it and set its value to 1.
-*/
-
-static void database_increment( char *key )
-{
- int res = 0;
- unsigned v;
- char value[16];
-
-
- if (ast_strlen_zero(db_family))
- return; /* If not defined, don't do anything */
-
- res = ast_db_get(db_family, key, value, sizeof(value) - 1);
-
- if(res){
- if(option_verbose >= 4)
- ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: Creating database entry %s and setting to 1\n", key);
- /* Guess we have to create it */
- res = ast_db_put(db_family, key, "1");
- return;
- }
-
- sscanf(value, "%u", &v);
- v++;
-
- if(option_verbose >= 4)
- ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: New value for %s: %u\n", key, v);
-
- snprintf(value, sizeof(value), "%u", v);
-
- res = ast_db_put(db_family, key, value);
-
- if((res)&&(option_verbose >= 4))
- ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: database_increment write error");
-
- return;
-}
-
-
-/*
-* Build a MuLaw data block for a single frequency tone
-*/
-
-static void make_tone_burst(unsigned char *data, float freq, float loudness, int len, int *x)
-{
- int i;
- float val;
-
- for(i = 0; i < len; i++){
- val = loudness * sin((freq * 2.0 * M_PI * (*x)++)/8000.0);
- data[i] = AST_LIN2MU((int)val);
- }
-
- /* wrap back around from 8000 */
-
- if (*x >= 8000) *x = 0;
- return;
-}
-
-/*
-* Send a single tone burst for a specifed duration and frequency.
-* Returns 0 if successful
-*/
-
-static int send_tone_burst(struct ast_channel *chan, float freq, int duration, int tldn)
-{
- int res = 0;
- int i = 0;
- int x = 0;
- struct ast_frame *f, wf;
-
- struct {
- unsigned char offset[AST_FRIENDLY_OFFSET];
- unsigned char buf[640];
- } tone_block;
-
- for(;;)
- {
-
- if (ast_waitfor(chan, -1) < 0){
- res = -1;
- break;
- }
-
- f = ast_read(chan);
- if (!f){
- res = -1;
- break;
- }
-
- if (f->frametype == AST_FRAME_VOICE) {
- wf.frametype = AST_FRAME_VOICE;
- wf.subclass = AST_FORMAT_ULAW;
- wf.offset = AST_FRIENDLY_OFFSET;
- wf.mallocd = 0;
- wf.data = tone_block.buf;
- wf.datalen = f->datalen;
- wf.samples = wf.datalen;
-
- make_tone_burst(tone_block.buf, freq, (float) tldn, wf.datalen, &x);
-
- i += wf.datalen / 8;
- if (i > duration) {
- break;
- }
- if (ast_write(chan, &wf)){
- if(option_verbose >= 4)
- ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: Failed to write frame on %s\n", chan->name);
- ast_log(LOG_WARNING, "AlarmReceiver Failed to write frame on %s\n",chan->name);
- res = -1;
- break;
- }
- }
-
- ast_frfree(f);
- }
- return res;
-}
-
-/*
-* Receive a string of DTMF digits where the length of the digit string is known in advance. Do not give preferential
-* treatment to any digit value, and allow separate time out values to be specified for the first digit and all subsequent
-* digits.
-*
-* Returns 0 if all digits successfully received.
-* Returns 1 if a digit time out occurred
-* Returns -1 if the caller hung up or there was a channel error.
-*
-*/
-
-static int receive_dtmf_digits(struct ast_channel *chan, char *digit_string, int length, int fdto, int sdto)
-{
- int res = 0;
- int i = 0;
- int r;
- struct ast_frame *f;
- struct timeval lastdigittime;
-
- lastdigittime = ast_tvnow();
- for(;;){
- /* if outa time, leave */
- if (ast_tvdiff_ms(ast_tvnow(), lastdigittime) >
- ((i > 0) ? sdto : fdto)){
- if(option_verbose >= 4)
- ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: DTMF Digit Timeout on %s\n", chan->name);
-
- ast_log(LOG_DEBUG,"AlarmReceiver: DTMF timeout on chan %s\n",chan->name);
-
- res = 1;
- break;
- }
-
- if ((r = ast_waitfor(chan, -1) < 0)) {
- ast_log(LOG_DEBUG, "Waitfor returned %d\n", r);
- continue;
- }
-
- f = ast_read(chan);
-
- if (f == NULL){
- res = -1;
- break;
- }
-
- /* If they hung up, leave */
- if ((f->frametype == AST_FRAME_CONTROL) &&
- (f->subclass == AST_CONTROL_HANGUP)){
- ast_frfree(f);
- res = -1;
- break;
- }
-
- /* if not DTMF, just do it again */
- if (f->frametype != AST_FRAME_DTMF){
- ast_frfree(f);
- continue;
- }
-
- digit_string[i++] = f->subclass; /* save digit */
-
- ast_frfree(f);
-
- /* If we have all the digits we expect, leave */
- if(i >= length)
- break;
-
- lastdigittime = ast_tvnow();
- }
-
- digit_string[i] = '\0'; /* Nul terminate the end of the digit string */
- return res;
-
-}
-
-/*
-* Write the metadata to the log file
-*/
-
-static int write_metadata( FILE *logfile, char *signalling_type, struct ast_channel *chan)
-{
- int res = 0;
- time_t t;
- struct tm now;
- char *cl,*cn;
- char workstring[80];
- char timestamp[80];
-
- /* Extract the caller ID location */
- if (chan->cid.cid_num)
- ast_copy_string(workstring, chan->cid.cid_num, sizeof(workstring));
- workstring[sizeof(workstring) - 1] = '\0';
-
- ast_callerid_parse(workstring, &cn, &cl);
- if (cl)
- ast_shrink_phone_number(cl);
-
-
- /* Get the current time */
-
- time(&t);
- ast_localtime(&t, &now, NULL);
-
- /* Format the time */
-
- strftime(timestamp, sizeof(timestamp), time_stamp_format, &now);
-
-
- res = fprintf(logfile, "\n\n[metadata]\n\n");
-
- if(res >= 0)
- res = fprintf(logfile, "PROTOCOL=%s\n", signalling_type);
-
- if(res >= 0)
- res = fprintf(logfile, "CALLINGFROM=%s\n", (!cl) ? "<unknown>" : cl);
-
- if(res >- 0)
- res = fprintf(logfile, "CALLERNAME=%s\n", (!cn) ? "<unknown>" : cn);
-
- if(res >= 0)
- res = fprintf(logfile, "TIMESTAMP=%s\n\n", timestamp);
-
- if(res >= 0)
- res = fprintf(logfile, "[events]\n\n");
-
- if(res < 0){
- ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: can't write metadata\n");
-
- ast_log(LOG_DEBUG,"AlarmReceiver: can't write metadata\n");
- }
- else
- res = 0;
-
- return res;
-}
-
-/*
-* Write a single event to the log file
-*/
-
-static int write_event( FILE *logfile, event_node_t *event)
-{
- int res = 0;
-
- if( fprintf(logfile, "%s\n", event->data) < 0)
- res = -1;
-
- return res;
-}
-
-
-/*
-* If we are configured to log events, do so here.
-*
-*/
-
-static int log_events(struct ast_channel *chan, char *signalling_type, event_node_t *event)
-{
-
- int res = 0;
- char workstring[sizeof(event_spool_dir)+sizeof(event_file)] = "";
- int fd;
- FILE *logfile;
- event_node_t *elp = event;
-
- if (!ast_strlen_zero(event_spool_dir)) {
-
- /* Make a template */
-
- ast_copy_string(workstring, event_spool_dir, sizeof(workstring));
- strncat(workstring, event_file, sizeof(workstring) - strlen(workstring) - 1);
-
- /* Make the temporary file */
-
- fd = mkstemp(workstring);
-
- if(fd == -1){
- ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: can't make temporary file\n");
- ast_log(LOG_DEBUG,"AlarmReceiver: can't make temporary file\n");
- res = -1;
- }
-
- if(!res){
- logfile = fdopen(fd, "w");
- if(logfile){
- /* Write the file */
- res = write_metadata(logfile, signalling_type, chan);
- if(!res)
- while((!res) && (elp != NULL)){
- res = write_event(logfile, elp);
- elp = elp->next;
- }
- if(!res){
- if(fflush(logfile) == EOF)
- res = -1;
- if(!res){
- if(fclose(logfile) == EOF)
- res = -1;
- }
- }
- }
- else
- res = -1;
- }
- }
-
- return res;
-}
-
-/*
-* This function implements the logic to receive the Ademco contact ID format.
-*
-* The function will return 0 when the caller hangs up, else a -1 if there was a problem.
-*/
-
-static int receive_ademco_contact_id( struct ast_channel *chan, void *data, int fdto, int sdto, int tldn, event_node_t **ehead)
-{
- int i,j;
- int res = 0;
- int checksum;
- char event[17];
- event_node_t *enew, *elp;
- int got_some_digits = 0;
- int events_received = 0;
- int ack_retries = 0;
-
- static char digit_map[15] = "0123456789*#ABC";
- static unsigned char digit_weights[15] = {10,1,2,3,4,5,6,7,8,9,11,12,13,14,15};
-
- database_increment("calls-received");
-
- /* Wait for first event */
-
- if(option_verbose >= 4)
- ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: Waiting for first event from panel\n");
-
- while(res >= 0){
-
- if(got_some_digits == 0){
-
- /* Send ACK tone sequence */
-
-
- if(option_verbose >= 4)
- ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: Sending 1400Hz 100ms burst (ACK)\n");
-
-
- res = send_tone_burst(chan, 1400.0, 100, tldn);
-
- if(!res)
- res = ast_safe_sleep(chan, 100);
-
- if(!res){
- if(option_verbose >= 4)
- ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: Sending 2300Hz 100ms burst (ACK)\n");
-
- res = send_tone_burst(chan, 2300.0, 100, tldn);
- }
-
- }
-
- if( res >= 0)
- res = receive_dtmf_digits(chan, event, sizeof(event) - 1, fdto, sdto);
-
- if (res < 0){
-
- if(events_received == 0)
- /* Hangup with no events received should be logged in the DB */
- database_increment("no-events-received");
- else{
- if(ack_retries){
- if(option_verbose >= 4)
- ast_verbose(VERBOSE_PREFIX_2 "AlarmReceiver: ACK retries during this call: %d\n", ack_retries);
-
- database_increment("ack-retries");
- }
- }
- if(option_verbose >= 4)
- ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: App exiting...\n");
- res = -1;
- break;
- }
-
- if(res != 0){
- /* Didn't get all of the digits */
- if(option_verbose >= 2)
- ast_verbose(VERBOSE_PREFIX_2 "AlarmReceiver: Incomplete string: %s, trying again...\n", event);
-
- if(!got_some_digits){
- got_some_digits = (!ast_strlen_zero(event)) ? 1 : 0;
- ack_retries++;
- }
- continue;
- }
-
- got_some_digits = 1;
-
- if(option_verbose >= 2)
- ast_verbose(VERBOSE_PREFIX_2 "AlarmReceiver: Received Event %s\n", event);
- ast_log(LOG_DEBUG, "AlarmReceiver: Received event: %s\n", event);
-
- /* Calculate checksum */
-
- for(j = 0, checksum = 0; j < 16; j++){
- for(i = 0 ; i < sizeof(digit_map) ; i++){
- if(digit_map[i] == event[j])
- break;
- }
-
- if(i == 16)
- break;
-
- checksum += digit_weights[i];
- }
-
- if(i == 16){
- if(option_verbose >= 2)
- ast_verbose(VERBOSE_PREFIX_2 "AlarmReceiver: Bad DTMF character %c, trying again\n", event[j]);
- continue; /* Bad character */
- }
-
- /* Checksum is mod(15) of the total */
-
- checksum = checksum % 15;
-
- if(checksum){
- database_increment("checksum-errors");
- if(option_verbose >= 2){
- ast_verbose(VERBOSE_PREFIX_2 "AlarmReceiver: Nonzero checksum\n");
- ast_log(LOG_DEBUG, "AlarmReceiver: Nonzero checksum\n");
- continue;
- }
- }
-
- /* Check the message type for correctness */
-
- if(strncmp(event + 4, "18", 2)){
- if(strncmp(event + 4, "98", 2)){
- database_increment("format-errors");
- if(option_verbose >= 2)
- ast_verbose(VERBOSE_PREFIX_2 "AlarmReceiver: Wrong message type\n");
- ast_log(LOG_DEBUG, "AlarmReceiver: Wrong message type\n");
- continue;
- }
- }
-
- events_received++;
-
- /* Queue the Event */
-
- if((enew = malloc(sizeof(event_node_t))) == NULL){
- if(option_verbose >= 1)
- ast_verbose(VERBOSE_PREFIX_1 "AlarmReceiver: Failed to allocate memory\n");
- ast_log(LOG_WARNING, "AlarmReceiver Failed to allocate memory\n");
- res = -1;
- break;
- }
-
- memset(enew, 0, sizeof(event_node_t));
-
- enew->next = NULL;
- ast_copy_string(enew->data, event, sizeof(enew->data));
-
- /*
- * Insert event onto end of list
- */
-
- if(*ehead == NULL){
- *ehead = enew;
- }
- else{
- for(elp = *ehead; elp->next != NULL; elp = elp->next)
- ;
-
- elp->next = enew;
- }
-
- if(res > 0)
- res = 0;
-
- /* Let the user have the option of logging the single event before sending the kissoff tone */
-
- if((res == 0) && (log_individual_events))
- res = log_events(chan, ADEMCO_CONTACT_ID, enew);
-
- /* Wait 200 msec before sending kissoff */
-
- if(res == 0)
- res = ast_safe_sleep(chan, 200);
-
- /* Send the kissoff tone */
-
- if(res == 0)
- res = send_tone_burst(chan, 1400.0, 900, tldn);
- }
-
-
- return res;
-}
-
-
-/*
-* This is the main function called by Asterisk Core whenever the App is invoked in the extension logic.
-* This function will always return 0.
-*/
-
-static int alarmreceiver_exec(struct ast_channel *chan, void *data)
-{
- int res = 0;
- struct localuser *u;
- event_node_t *elp, *efree;
- char signalling_type[64] = "";
-
- event_node_t *event_head = NULL;
-
- LOCAL_USER_ADD(u);
-
- /* Set write and read formats to ULAW */
-
- if(option_verbose >= 4)
- ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: Setting read and write formats to ULAW\n");
-
- if (ast_set_write_format(chan,AST_FORMAT_ULAW)){
- ast_log(LOG_WARNING, "AlarmReceiver: Unable to set write format to Mu-law on %s\n",chan->name);
- LOCAL_USER_REMOVE(u);
- return -1;
- }
-
- if (ast_set_read_format(chan,AST_FORMAT_ULAW)){
- ast_log(LOG_WARNING, "AlarmReceiver: Unable to set read format to Mu-law on %s\n",chan->name);
- LOCAL_USER_REMOVE(u);
- return -1;
- }
-
- /* Set default values for this invokation of the application */
-
- ast_copy_string(signalling_type, ADEMCO_CONTACT_ID, sizeof(signalling_type));
-
-
- /* Answer the channel if it is not already */
-
- if(option_verbose >= 4)
- ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: Answering channel\n");
-
- if (chan->_state != AST_STATE_UP) {
-
- res = ast_answer(chan);
-
- if (res) {
- LOCAL_USER_REMOVE(u);
- return -1;
- }
- }
-
- /* Wait for the connection to settle post-answer */
-
- if(option_verbose >= 4)
- ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: Waiting for connection to stabilize\n");
-
- res = ast_safe_sleep(chan, 1250);
-
- /* Attempt to receive the events */
-
- if(!res){
-
- /* Determine the protocol to receive in advance */
- /* Note: Ademco contact is the only one supported at this time */
- /* Others may be added later */
-
- if(!strcmp(signalling_type, ADEMCO_CONTACT_ID))
- receive_ademco_contact_id(chan, data, fdtimeout, sdtimeout, toneloudness, &event_head);
- else
- res = -1;
- }
-
-
-
- /* Events queued by receiver, write them all out here if so configured */
-
- if((!res) && (log_individual_events == 0)){
- res = log_events(chan, signalling_type, event_head);
-
- }
-
- /*
- * Do we exec a command line at the end?
- */
-
- if((!res) && (!ast_strlen_zero(event_app)) && (event_head)){
- ast_log(LOG_DEBUG,"Alarmreceiver: executing: %s\n", event_app);
- ast_safe_system(event_app);
- }
-
- /*
- * Free up the data allocated in our linked list
- */
-
- for(elp = event_head; (elp != NULL);){
- efree = elp;
- elp = elp->next;
- free(efree);
- }
-
-
- LOCAL_USER_REMOVE(u);
-
- return 0;
-}
-
-/*
-* Load the configuration from the configuration file
-*/
-
-static int load_config(void)
-{
- struct ast_config *cfg;
- char *p;
-
- /* Read in the config file */
-
- cfg = ast_config_load(ALMRCV_CONFIG);
-
- if(!cfg){
-
- if(option_verbose >= 4)
- ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: No config file\n");
- }
- else{
-
-
- p = ast_variable_retrieve(cfg, "general", "eventcmd");
-
- if(p){
- ast_copy_string(event_app, p, sizeof(event_app));
- event_app[sizeof(event_app) - 1] = '\0';
- }
-
- p = ast_variable_retrieve(cfg, "general", "loudness");
- if(p){
- toneloudness = atoi(p);
- if(toneloudness < 100)
- toneloudness = 100;
- if(toneloudness > 8192)
- toneloudness = 8192;
- }
- p = ast_variable_retrieve(cfg, "general", "fdtimeout");
- if(p){
- fdtimeout = atoi(p);
- if(fdtimeout < 1000)
- fdtimeout = 1000;
- if(fdtimeout > 10000)
- fdtimeout = 10000;
- }
-
- p = ast_variable_retrieve(cfg, "general", "sdtimeout");
- if(p){
- sdtimeout = atoi(p);
- if(sdtimeout < 110)
- sdtimeout = 110;
- if(sdtimeout > 4000)
- sdtimeout = 4000;
-
- }
-
- p = ast_variable_retrieve(cfg, "general", "logindividualevents");
- if(p){
- log_individual_events = ast_true(p);
-
- }
-
- p = ast_variable_retrieve(cfg, "general", "eventspooldir");
-
- if(p){
- ast_copy_string(event_spool_dir, p, sizeof(event_spool_dir));
- event_spool_dir[sizeof(event_spool_dir) - 1] = '\0';
- }
-
- p = ast_variable_retrieve(cfg, "general", "timestampformat");
-
- if(p){
- ast_copy_string(time_stamp_format, p, sizeof(time_stamp_format));
- time_stamp_format[sizeof(time_stamp_format) - 1] = '\0';
- }
-
- p = ast_variable_retrieve(cfg, "general", "db-family");
-
- if(p){
- ast_copy_string(db_family, p, sizeof(db_family));
- db_family[sizeof(db_family) - 1] = '\0';
- }
- ast_config_destroy(cfg);
- }
- return 0;
-
-}
-
-/*
-* These functions are required to implement an Asterisk App.
-*/
-
-
-int unload_module(void)
-{
- int res;
-
- res = ast_unregister_application(app);
-
- STANDARD_HANGUP_LOCALUSERS;
-
- return res;
-}
-
-int load_module(void)
-{
- load_config();
- return ast_register_application(app, alarmreceiver_exec, synopsis, descrip);
-}
-
-char *description(void)
-{
- return tdesc;
-}
-
-int usecount(void)
-{
- int res;
- STANDARD_USECOUNT(res);
- return res;
-}
-
-char *key()
-{
- return ASTERISK_GPL_KEY;
-}
diff --git a/1.2-netsec/apps/app_authenticate.c b/1.2-netsec/apps/app_authenticate.c
deleted file mode 100644
index 583c5f4d3..000000000
--- a/1.2-netsec/apps/app_authenticate.c
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Asterisk -- An open source telephony toolkit.
- *
- * Copyright (C) 1999 - 2005, Digium, Inc.
- *
- * Mark Spencer <markster@digium.com>
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE file
- * at the top of the source tree.
- */
-
-/*! \file
- * \brief Execute arbitrary authenticate commands
- *
- * \ingroup applications
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <stdio.h>
-
-#include "asterisk.h"
-
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-
-#include "asterisk/lock.h"
-#include "asterisk/file.h"
-#include "asterisk/logger.h"
-#include "asterisk/channel.h"
-#include "asterisk/pbx.h"
-#include "asterisk/module.h"
-#include "asterisk/app.h"
-#include "asterisk/astdb.h"
-#include "asterisk/utils.h"
-
-static char *tdesc = "Authentication Application";
-
-static char *app = "Authenticate";
-
-static char *synopsis = "Authenticate a user";
-
-static char *descrip =
-" Authenticate(password[|options]): This application asks the caller to enter a\n"
-"given password in order to continue dialplan execution. If the password begins\n"
-"with the '/' character, it is interpreted as a file which contains a list of\n"
-"valid passwords, listed 1 password per line in the file.\n"
-" When using a database key, the value associated with the key can be anything.\n"
-"Users have three attempts to authenticate before the channel is hung up. If the\n"
-"passsword is invalid, the 'j' option is specified, and priority n+101 exists,\n"
-"dialplan execution will continnue at this location.\n"
-" Options:\n"
-" a - Set the channels' account code to the password that is entered\n"
-" d - Interpret the given path as database key, not a literal file\n"
-" j - Support jumping to n+101 if authentication fails\n"
-" m - Interpret the given path as a file which contains a list of account\n"
-" codes and password hashes delimited with ':', listed one per line in\n"
-" the file. When one of the passwords is matched, the channel will have\n"
-" its account code set to the corresponding account code in the file.\n"
-" r - Remove the database key upon successful entry (valid with 'd' only)\n"
-;
-
-STANDARD_LOCAL_USER;
-
-LOCAL_USER_DECL;
-
-static int auth_exec(struct ast_channel *chan, void *data)
-{
- int res=0;
- int jump = 0;
- int retries;
- struct localuser *u;
- char password[256]="";
- char passwd[256];
- char *opts;
- char *prompt;
-
- if (ast_strlen_zero(data)) {
- ast_log(LOG_WARNING, "Authenticate requires an argument(password)\n");
- return -1;
- }
-
- LOCAL_USER_ADD(u);
-
- if (chan->_state != AST_STATE_UP) {
- res = ast_answer(chan);
- if (res) {
- LOCAL_USER_REMOVE(u);
- return -1;
- }
- }
-
- strncpy(password, data, sizeof(password) - 1);
- opts=strchr(password, '|');
- if (opts) {
- *opts = 0;
- opts++;
- } else
- opts = "";
- if (strchr(opts, 'j'))
- jump = 1;
- /* Start asking for password */
- prompt = "agent-pass";
- for (retries = 0; retries < 3; retries++) {
- res = ast_app_getdata(chan, prompt, passwd, sizeof(passwd) - 2, 0);
- if (res < 0)
- break;
- res = 0;
- if (password[0] == '/') {
- if (strchr(opts, 'd')) {
- char tmp[256];
- /* Compare against a database key */
- if (!ast_db_get(password + 1, passwd, tmp, sizeof(tmp))) {
- /* It's a good password */
- if (strchr(opts, 'r')) {
- ast_db_del(password + 1, passwd);
- }
- break;
- }
- } else {
- /* Compare against a file */
- FILE *f;
- f = fopen(password, "r");
- if (f) {
- char buf[256] = "";
- char md5passwd[33] = "";
- char *md5secret = NULL;
-
- while (!feof(f)) {
- fgets(buf, sizeof(buf), f);
- if (!feof(f) && !ast_strlen_zero(buf)) {
- buf[strlen(buf) - 1] = '\0';
- if (strchr(opts, 'm')) {
- md5secret = strchr(buf, ':');
- if (md5secret == NULL)
- continue;
- *md5secret = '\0';
- md5secret++;
- ast_md5_hash(md5passwd, passwd);
- if (!strcmp(md5passwd, md5secret)) {
- if (strchr(opts, 'a'))
- ast_cdr_setaccount(chan, buf);
- break;
- }
- } else {
- if (!strcmp(passwd, buf)) {
- if (strchr(opts, 'a'))
- ast_cdr_setaccount(chan, buf);
- break;
- }
- }
- }
- }
- fclose(f);
- if (!ast_strlen_zero(buf)) {
- if (strchr(opts, 'm')) {
- if (md5secret && !strcmp(md5passwd, md5secret))
- break;
- } else {
- if (!strcmp(passwd, buf))
- break;
- }
- }
- } else
- ast_log(LOG_WARNING, "Unable to open file '%s' for authentication: %s\n", password, strerror(errno));
- }
- } else {
- /* Compare against a fixed password */
- if (!strcmp(passwd, password))
- break;
- }
- prompt="auth-incorrect";
- }
- if ((retries < 3) && !res) {
- if (strchr(opts, 'a') && !strchr(opts, 'm'))
- ast_cdr_setaccount(chan, passwd);
- res = ast_streamfile(chan, "auth-thankyou", chan->language);
- if (!res)
- res = ast_waitstream(chan, "");
- } else {
- if (jump && ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101)) {
- res = 0;
- } else {
- if (!ast_streamfile(chan, "vm-goodbye", chan->language))
- res = ast_waitstream(chan, "");
- res = -1;
- }
- }
- LOCAL_USER_REMOVE(u);
- return res;
-}
-
-int unload_module(void)
-{
- int res;
-
- res = ast_unregister_application(app);
-
- STANDARD_HANGUP_LOCALUSERS;
-
- return res;
-}
-
-int load_module(void)
-{
- return ast_register_application(app, auth_exec, synopsis, descrip);
-}
-
-char *description(void)
-{
- return tdesc;
-}
-
-int usecount(void)
-{
- int res;
- STANDARD_USECOUNT(res);
- return res;
-}
-
-char *key()
-{
- return ASTERISK_GPL_KEY;
-}
diff --git a/1.2-netsec/apps/app_cdr.c b/1.2-netsec/apps/app_cdr.c
deleted file mode 100644
index 501bfc79b..000000000
--- a/1.2-netsec/apps/app_cdr.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Asterisk -- An open source telephony toolkit.
- *
- * Copyright (C) 1999 - 2005, Digium, Inc.
- *
- * Martin Pycko <martinp@digium.com>
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE file
- * at the top of the source tree.
- */
-
-/*! \file
- * \brief Applications connected with CDR engine
- *
- * \ingroup applications
- */
-
-#include <sys/types.h>
-#include <stdlib.h>
-
-#include "asterisk.h"
-
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-
-#include "asterisk/channel.h"
-#include "asterisk/module.h"
-#include "asterisk/pbx.h"
-
-
-static char *tdesc = "Tell Asterisk to not maintain a CDR for the current call";
-
-static char *nocdr_descrip =
-" NoCDR(): This application will tell Asterisk not to maintain a CDR for the\n"
-"current call.\n";
-
-static char *nocdr_app = "NoCDR";
-static char *nocdr_synopsis = "Tell Asterisk to not maintain a CDR for the current call";
-
-STANDARD_LOCAL_USER;
-
-LOCAL_USER_DECL;
-
-static int nocdr_exec(struct ast_channel *chan, void *data)
-{
- struct localuser *u;
-
- LOCAL_USER_ADD(u);
-
- if (chan->cdr) {
- ast_cdr_free(chan->cdr);
- chan->cdr = NULL;
- }
-
- LOCAL_USER_REMOVE(u);
-
- return 0;
-}
-
-int unload_module(void)
-{
- int res;
-
- res = ast_unregister_application(nocdr_app);
-
- STANDARD_HANGUP_LOCALUSERS;
-
- return res;
-}
-
-int load_module(void)
-{
- return ast_register_application(nocdr_app, nocdr_exec, nocdr_synopsis, nocdr_descrip);
-}
-
-char *description(void)
-{
- return tdesc;
-}
-
-int usecount(void)
-{
- int res;
- STANDARD_USECOUNT(res);
- return res;
-}
-
-char *key()
-{
- return ASTERISK_GPL_KEY;
-}
diff --git a/1.2-netsec/apps/app_chanisavail.c b/1.2-netsec/apps/app_chanisavail.c
deleted file mode 100644
index c55bb8ecb..000000000
--- a/1.2-netsec/apps/app_chanisavail.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
-* Asterisk -- An open source telephony toolkit.
-*
-* Copyright (C) 1999 - 2005, Digium, Inc.
-*
-* Mark Spencer <markster@digium.com>
-* James Golovich <james@gnuinter.net>
-*
-* See http://www.asterisk.org for more information about
-* the Asterisk project. Please do not directly contact
-* any of the maintainers of this project for assistance;
-* the project provides a web site, mailing lists and IRC
-* channels for your use.
-*
-* This program is free software, distributed under the terms of
-* the GNU General Public License Version 2. See the LICENSE file
-* at the top of the source tree.
-*/
-
-/*! \file
-* \brief Check if Channel is Available
-*
- * \ingroup applications
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sys/ioctl.h>
-
-#include "asterisk.h"
-
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-
-#include "asterisk/lock.h"
-#include "asterisk/file.h"
-#include "asterisk/logger.h"
-#include "asterisk/channel.h"
-#include "asterisk/pbx.h"
-#include "asterisk/module.h"
-#include "asterisk/app.h"
-#include "asterisk/devicestate.h"
-#include "asterisk/options.h"
-
-static char *tdesc = "Check channel availability";
-
-static char *app = "ChanIsAvail";
-
-static char *synopsis = "Check channel availability";
-
-static char *descrip =
-" ChanIsAvail(Technology/resource[&Technology2/resource2...][|options]): \n"
-"This application will check to see if any of the specified channels are\n"
-"available. The following variables will be set by this application:\n"
-" ${AVAILCHAN} - the name of the available channel, if one exists\n"
-" ${AVAILORIGCHAN} - the canonical channel name that was used to create the channel\n"
-" ${AVAILSTATUS} - the status code for the available channel\n"
-" Options:\n"
-" s - Consider the channel unavailable if the channel is in use at all\n"
-" j - Support jumping to priority n+101 if no channel is available\n";
-
-STANDARD_LOCAL_USER;
-
-LOCAL_USER_DECL;
-
-static int chanavail_exec(struct ast_channel *chan, void *data)
-{
- int res=-1, inuse=-1, option_state=0, priority_jump=0;
- int status;
- struct localuser *u;
- char *info, tmp[512], trychan[512], *peers, *tech, *number, *rest, *cur, *options, *stringp;
- struct ast_channel *tempchan;
-
- if (ast_strlen_zero(data)) {
- ast_log(LOG_WARNING, "ChanIsAvail requires an argument (Zap/1&Zap/2)\n");
- return -1;
- }
-
- LOCAL_USER_ADD(u);
-
- info = ast_strdupa(data);
- stringp = info;
- strsep(&stringp, "|");
- options = strsep(&stringp, "|");
- if (options) {
- if (strchr(options, 's'))
- option_state = 1;
- if (strchr(options, 'j'))
- priority_jump = 1;
- }
- peers = info;
- if (peers) {
- cur = peers;
- do {
- /* remember where to start next time */
- rest = strchr(cur, '&');
- if (rest) {
- *rest = 0;
- rest++;
- }
- tech = cur;
- number = strchr(tech, '/');
- if (!number) {
- ast_log(LOG_WARNING, "ChanIsAvail argument takes format ([technology]/[device])\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
- *number = '\0';
- number++;
-
- if (option_state) {
- /* If the pbx says in use then don't bother trying further.
- This is to permit testing if someone's on a call, even if the
- channel can permit more calls (ie callwaiting, sip calls, etc). */
-
- snprintf(trychan, sizeof(trychan), "%s/%s",cur,number);
- status = inuse = ast_device_state(trychan);
- }
- if ((inuse <= 1) && (tempchan = ast_request(tech, chan->nativeformats, number, &status))) {
- pbx_builtin_setvar_helper(chan, "AVAILCHAN", tempchan->name);
- /* Store the originally used channel too */
- snprintf(tmp, sizeof(tmp), "%s/%s", tech, number);
- pbx_builtin_setvar_helper(chan, "AVAILORIGCHAN", tmp);
- snprintf(tmp, sizeof(tmp), "%d", status);
- pbx_builtin_setvar_helper(chan, "AVAILSTATUS", tmp);
- ast_hangup(tempchan);
- tempchan = NULL;
- res = 1;
- break;
- } else {
- snprintf(tmp, sizeof(tmp), "%d", status);
- pbx_builtin_setvar_helper(chan, "AVAILSTATUS", tmp);
- }
- cur = rest;
- } while (cur);
- }
- if (res < 1) {
- pbx_builtin_setvar_helper(chan, "AVAILCHAN", "");
- pbx_builtin_setvar_helper(chan, "AVAILORIGCHAN", "");
- if (priority_jump || option_priority_jumping) {
- if (ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101)) {
- LOCAL_USER_REMOVE(u);
- return -1;
- }
- }
- }
-
- LOCAL_USER_REMOVE(u);
- return 0;
-}
-
-int unload_module(void)
-{
- int res = 0;
-
- res = ast_unregister_application(app);
-
- STANDARD_HANGUP_LOCALUSERS;
-
- return res;
-}
-
-int load_module(void)
-{
- return ast_register_application(app, chanavail_exec, synopsis, descrip);
-}
-
-char *description(void)
-{
- return tdesc;
-}
-
-int usecount(void)
-{
- int res;
- STANDARD_USECOUNT(res);
- return res;
-}
-
-char *key()
-{
- return ASTERISK_GPL_KEY;
-}
diff --git a/1.2-netsec/apps/app_chanspy.c b/1.2-netsec/apps/app_chanspy.c
deleted file mode 100644
index 299c58efc..000000000
--- a/1.2-netsec/apps/app_chanspy.c
+++ /dev/null
@@ -1,587 +0,0 @@
-/*
- * Asterisk -- An open source telephony toolkit.
- *
- * Copyright (C) 2005 Anthony Minessale II (anthmct@yahoo.com)
- *
- * Disclaimed to Digium
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE file
- * at the top of the source tree.
- */
-
-/*! \file
- * \brief ChanSpy: Listen in on any channel.
- *
- * \ingroup applications
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-
-#include "asterisk.h"
-
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-
-#include "asterisk/file.h"
-#include "asterisk/logger.h"
-#include "asterisk/channel.h"
-#include "asterisk/chanspy.h"
-#include "asterisk/features.h"
-#include "asterisk/options.h"
-#include "asterisk/app.h"
-#include "asterisk/utils.h"
-#include "asterisk/say.h"
-#include "asterisk/pbx.h"
-#include "asterisk/translate.h"
-#include "asterisk/module.h"
-#include "asterisk/lock.h"
-
-AST_MUTEX_DEFINE_STATIC(modlock);
-
-#define AST_NAME_STRLEN 256
-#define ALL_DONE(u, ret) LOCAL_USER_REMOVE(u); return ret;
-#define get_volfactor(x) x ? ((x > 0) ? (1 << x) : ((1 << abs(x)) * -1)) : 0
-
-static const char *synopsis = "Listen to the audio of an active channel\n";
-static const char *app = "ChanSpy";
-static const char *desc =
-" ChanSpy([chanprefix][|options]): This application is used to listen to the\n"
-"audio from an active Asterisk channel. This includes the audio coming in and\n"
-"out of the channel being spied on. If the 'chanprefix' parameter is specified,\n"
-"only channels beginning with this string will be spied upon.\n"
-" While Spying, the following actions may be performed:\n"
-" - Dialing # cycles the volume level.\n"
-" - Dialing * will stop spying and look for another channel to spy on.\n"
-" - Dialing a series of digits followed by # builds a channel name to append\n"
-" to 'chanprefix'. For example, executing ChanSpy(Agent) and then dialing\n"
-" the digits '1234#' while spying will begin spying on the channel,\n"
-" 'Agent/1234'.\n"
-" Options:\n"
-" b - Only spy on channels involved in a bridged call.\n"
-" g(grp) - Match only channels where their ${SPYGROUP} variable is set to\n"
-" 'grp'.\n"
-" q - Don't play a beep when beginning to spy on a channel.\n"
-" r[(basename)] - Record the session to the monitor spool directory. An\n"
-" optional base for the filename may be specified. The\n"
-" default is 'chanspy'.\n"
-" v([value]) - Adjust the initial volume in the range from -4 to 4. A\n"
-" negative value refers to a quieter setting.\n"
-;
-
-static const char *chanspy_spy_type = "ChanSpy";
-
-enum {
- OPTION_QUIET = (1 << 0), /* Quiet, no announcement */
- OPTION_BRIDGED = (1 << 1), /* Only look at bridged calls */
- OPTION_VOLUME = (1 << 2), /* Specify initial volume */
- OPTION_GROUP = (1 << 3), /* Only look at channels in group */
- OPTION_RECORD = (1 << 4), /* Record */
-} chanspy_opt_flags;
-
-enum {
- OPT_ARG_VOLUME = 0,
- OPT_ARG_GROUP,
- OPT_ARG_RECORD,
- OPT_ARG_ARRAY_SIZE,
-} chanspy_opt_args;
-
-AST_APP_OPTIONS(chanspy_opts, {
- AST_APP_OPTION('q', OPTION_QUIET),
- AST_APP_OPTION('b', OPTION_BRIDGED),
- AST_APP_OPTION_ARG('v', OPTION_VOLUME, OPT_ARG_VOLUME),
- AST_APP_OPTION_ARG('g', OPTION_GROUP, OPT_ARG_GROUP),
- AST_APP_OPTION_ARG('r', OPTION_RECORD, OPT_ARG_RECORD),
-});
-
-STANDARD_LOCAL_USER;
-LOCAL_USER_DECL;
-
-struct chanspy_translation_helper {
- /* spy data */
- struct ast_channel_spy spy;
- int fd;
- int volfactor;
-};
-
-static struct ast_channel *local_channel_walk(struct ast_channel *chan)
-{
- struct ast_channel *ret;
- ast_mutex_lock(&modlock);
- if ((ret = ast_channel_walk_locked(chan))) {
- ast_mutex_unlock(&ret->lock);
- }
- ast_mutex_unlock(&modlock);
- return ret;
-}
-
-static struct ast_channel *local_get_channel_begin_name(char *name)
-{
- struct ast_channel *chan, *ret = NULL;
- ast_mutex_lock(&modlock);
- chan = local_channel_walk(NULL);
- while (chan) {
- if (!strncmp(chan->name, name, strlen(name))) {
- ret = chan;
- break;
- }
- chan = local_channel_walk(chan);
- }
- ast_mutex_unlock(&modlock);
-
- return ret;
-}
-
-static void *spy_alloc(struct ast_channel *chan, void *data)
-{
- /* just store the data pointer in the channel structure */
- return data;
-}
-
-static void spy_release(struct ast_channel *chan, void *data)
-{
- /* nothing to do */
-}
-
-static int spy_generate(struct ast_channel *chan, void *data, int len, int samples)
-{
- struct chanspy_translation_helper *csth = data;
- struct ast_frame *f;
-
- if (csth->spy.status != CHANSPY_RUNNING)
- /* Channel is already gone more than likely */
- return -1;
-
- ast_mutex_lock(&csth->spy.lock);
- f = ast_channel_spy_read_frame(&csth->spy, samples);
- ast_mutex_unlock(&csth->spy.lock);
-
- if (!f)
- return 0;
-
- if (ast_write(chan, f)) {
- ast_frfree(f);
- return -1;
- }
-
- if (csth->fd)
- write(csth->fd, f->data, f->datalen);
-
- ast_frfree(f);
-
- return 0;
-}
-
-
-static struct ast_generator spygen = {
- .alloc = spy_alloc,
- .release = spy_release,
- .generate = spy_generate,
-};
-
-static int start_spying(struct ast_channel *chan, struct ast_channel *spychan, struct ast_channel_spy *spy)
-{
- int res;
- struct ast_channel *peer;
-
- ast_log(LOG_NOTICE, "Attaching %s to %s\n", spychan->name, chan->name);
-
- ast_mutex_lock(&chan->lock);
- res = ast_channel_spy_add(chan, spy);
- ast_mutex_unlock(&chan->lock);
-
- if (!res && ast_test_flag(chan, AST_FLAG_NBRIDGE) && (peer = ast_bridged_channel(chan))) {
- ast_softhangup(peer, AST_SOFTHANGUP_UNBRIDGE);
- }
-
- return res;
-}
-
-static void stop_spying(struct ast_channel *chan, struct ast_channel_spy *spy)
-{
- /* If our status has changed to DONE, then the channel we're spying on is gone....
- DON'T TOUCH IT!!! RUN AWAY!!! */
- if (spy->status == CHANSPY_DONE)
- return;
-
- if (!chan)
- return;
-
- ast_mutex_lock(&chan->lock);
- ast_channel_spy_remove(chan, spy);
- ast_mutex_unlock(&chan->lock);
-};
-
-/* Map 'volume' levels from -4 through +4 into
- decibel (dB) settings for channel drivers
-*/
-static signed char volfactor_map[] = {
- -24,
- -18,
- -12,
- -6,
- 0,
- 6,
- 12,
- 18,
- 24,
-};
-
-/* attempt to set the desired gain adjustment via the channel driver;
- if successful, clear it out of the csth structure so the
- generator will not attempt to do the adjustment itself
-*/
-static void set_volume(struct ast_channel *chan, struct chanspy_translation_helper *csth)
-{
- signed char volume_adjust = volfactor_map[csth->volfactor + 4];
-
- if (!ast_channel_setoption(chan, AST_OPTION_TXGAIN, &volume_adjust, sizeof(volume_adjust), 0))
- csth->volfactor = 0;
-}
-
-static int channel_spy(struct ast_channel *chan, struct ast_channel *spyee, int *volfactor, int fd)
-{
- struct chanspy_translation_helper csth;
- int running, res = 0, x = 0;
- char inp[24];
- char *name=NULL;
- struct ast_frame *f;
-
- running = (chan && !ast_check_hangup(chan) && spyee && !ast_check_hangup(spyee));
-
- if (running) {
- memset(inp, 0, sizeof(inp));
- name = ast_strdupa(spyee->name);
- if (option_verbose >= 2)
- ast_verbose(VERBOSE_PREFIX_2 "Spying on channel %s\n", name);
-
- memset(&csth, 0, sizeof(csth));
- ast_set_flag(&csth.spy, CHANSPY_FORMAT_AUDIO);
- ast_set_flag(&csth.spy, CHANSPY_TRIGGER_NONE);
- ast_set_flag(&csth.spy, CHANSPY_MIXAUDIO);
- csth.spy.type = chanspy_spy_type;
- csth.spy.status = CHANSPY_RUNNING;
- csth.spy.read_queue.format = AST_FORMAT_SLINEAR;
- csth.spy.write_queue.format = AST_FORMAT_SLINEAR;
- ast_mutex_init(&csth.spy.lock);
- csth.volfactor = *volfactor;
- set_volume(chan, &csth);
- csth.spy.read_vol_adjustment = csth.volfactor;
- csth.spy.write_vol_adjustment = csth.volfactor;
- csth.fd = fd;
-
- if (start_spying(spyee, chan, &csth.spy))
- running = 0;
- }
-
- if (running) {
- running = 1;
- ast_activate_generator(chan, &spygen, &csth);
-
- while (csth.spy.status == CHANSPY_RUNNING &&
- chan && !ast_check_hangup(chan) &&
- spyee &&
- !ast_check_hangup(spyee) &&
- running == 1 &&
- (res = ast_waitfor(chan, -1) > -1)) {
- if ((f = ast_read(chan))) {
- res = 0;
- if (f->frametype == AST_FRAME_DTMF) {
- res = f->subclass;
- }
- ast_frfree(f);
- if (!res) {
- continue;
- }
- } else {
- break;
- }
- if (x == sizeof(inp)) {
- x = 0;
- }
- if (res < 0) {
- running = -1;
- }
- if (res == 0) {
- continue;
- } else if (res == '*') {
- running = 0;
- } else if (res == '#') {
- if (!ast_strlen_zero(inp)) {
- running = x ? atoi(inp) : -1;
- break;
- } else {
- (*volfactor)++;
- if (*volfactor > 4) {
- *volfactor = -4;
- }
- if (option_verbose > 2) {
- ast_verbose(VERBOSE_PREFIX_3 "Setting spy volume on %s to %d\n", chan->name, *volfactor);
- }
- csth.volfactor = *volfactor;
- set_volume(chan, &csth);
- csth.spy.read_vol_adjustment = csth.volfactor;
- csth.spy.write_vol_adjustment = csth.volfactor;
- }
- } else if (res >= 48 && res <= 57) {
- inp[x++] = res;
- }
- }
- ast_deactivate_generator(chan);
- stop_spying(spyee, &csth.spy);
-
- if (option_verbose >= 2) {
- ast_verbose(VERBOSE_PREFIX_2 "Done Spying on channel %s\n", name);
- }
- } else {
- running = 0;
- }
-
- ast_mutex_destroy(&csth.spy.lock);
-
- return running;
-}
-
-static int chanspy_exec(struct ast_channel *chan, void *data)
-{
- struct localuser *u;
- struct ast_channel *peer=NULL, *prev=NULL;
- char name[AST_NAME_STRLEN],
- peer_name[AST_NAME_STRLEN + 5],
- *args,
- *ptr = NULL,
- *options = NULL,
- *spec = NULL,
- *argv[5],
- *mygroup = NULL,
- *recbase = NULL;
- int res = -1,
- volfactor = 0,
- silent = 0,
- argc = 0,
- bronly = 0,
- chosen = 0,
- count=0,
- waitms = 100,
- num = 0,
- oldrf = 0,
- oldwf = 0,
- fd = 0;
- struct ast_flags flags;
- signed char zero_volume = 0;
-
- if (!(args = ast_strdupa((char *)data))) {
- ast_log(LOG_ERROR, "Out of memory!\n");
- return -1;
- }
-
- LOCAL_USER_ADD(u);
-
- oldrf = chan->readformat;
- oldwf = chan->writeformat;
- if (ast_set_read_format(chan, AST_FORMAT_SLINEAR) < 0) {
- ast_log(LOG_ERROR, "Could Not Set Read Format.\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
-
- if (ast_set_write_format(chan, AST_FORMAT_SLINEAR) < 0) {
- ast_log(LOG_ERROR, "Could Not Set Write Format.\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
-
- ast_answer(chan);
-
- ast_set_flag(chan, AST_FLAG_SPYING); /* so nobody can spy on us while we are spying */
-
- if ((argc = ast_app_separate_args(args, '|', argv, sizeof(argv) / sizeof(argv[0])))) {
- spec = argv[0];
- if ( argc > 1) {
- options = argv[1];
- }
- if (ast_strlen_zero(spec) || !strcmp(spec, "all")) {
- spec = NULL;
- }
- }
-
- if (options) {
- char *opts[OPT_ARG_ARRAY_SIZE];
- ast_app_parse_options(chanspy_opts, &flags, opts, options);
- if (ast_test_flag(&flags, OPTION_GROUP)) {
- mygroup = opts[1];
- }
- if (ast_test_flag(&flags, OPTION_RECORD)) {
- if (!(recbase = opts[2])) {
- recbase = "chanspy";
- }
- }
- silent = ast_test_flag(&flags, OPTION_QUIET);
- bronly = ast_test_flag(&flags, OPTION_BRIDGED);
- if (ast_test_flag(&flags, OPTION_VOLUME) && opts[1]) {
- int vol;
-
- if ((sscanf(opts[0], "%d", &vol) != 1) || (vol > 4) || (vol < -4))
- ast_log(LOG_NOTICE, "Volume factor must be a number between -4 and 4\n");
- else
- volfactor = vol;
- }
- }
-
- if (recbase) {
- char filename[512];
- snprintf(filename,sizeof(filename),"%s/%s.%d.raw",ast_config_AST_MONITOR_DIR, recbase, (int)time(NULL));
- if ((fd = open(filename, O_CREAT | O_WRONLY, O_TRUNC, 0644)) <= 0) {
- ast_log(LOG_WARNING, "Cannot open %s for recording\n", filename);
- fd = 0;
- }
- }
-
- for(;;) {
- if (!silent) {
- res = ast_streamfile(chan, "beep", chan->language);
- if (!res)
- res = ast_waitstream(chan, "");
- if (res < 0) {
- ast_clear_flag(chan, AST_FLAG_SPYING);
- break;
- }
- }
-
- count = 0;
- res = ast_waitfordigit(chan, waitms);
- if (res < 0) {
- ast_clear_flag(chan, AST_FLAG_SPYING);
- break;
- }
-
- peer = local_channel_walk(NULL);
- prev=NULL;
- while(peer) {
- if (peer != chan) {
- char *group = NULL;
- int igrp = 1;
-
- if (peer == prev && !chosen) {
- break;
- }
- chosen = 0;
- group = pbx_builtin_getvar_helper(peer, "SPYGROUP");
- if (mygroup) {
- if (!group || strcmp(mygroup, group)) {
- igrp = 0;
- }
- }
-
- if (igrp && (!spec || ((strlen(spec) <= strlen(peer->name) &&
- !strncasecmp(peer->name, spec, strlen(spec)))))) {
- if (peer && (!bronly || ast_bridged_channel(peer)) &&
- !ast_check_hangup(peer) && !ast_test_flag(peer, AST_FLAG_SPYING)) {
- int x = 0;
- strncpy(peer_name, "spy-", 5);
- strncpy(peer_name + strlen(peer_name), peer->name, AST_NAME_STRLEN);
- ptr = strchr(peer_name, '/');
- *ptr = '\0';
- ptr++;
- for (x = 0 ; x < strlen(peer_name) ; x++) {
- if (peer_name[x] == '/') {
- break;
- }
- peer_name[x] = tolower(peer_name[x]);
- }
-
- if (!silent) {
- if (ast_fileexists(peer_name, NULL, NULL) != -1) {
- res = ast_streamfile(chan, peer_name, chan->language);
- if (!res)
- res = ast_waitstream(chan, "");
- if (res)
- break;
- } else
- res = ast_say_character_str(chan, peer_name, "", chan->language);
- if ((num=atoi(ptr)))
- ast_say_digits(chan, atoi(ptr), "", chan->language);
- }
- count++;
- prev = peer;
- res = channel_spy(chan, peer, &volfactor, fd);
- if (res == -1) {
- break;
- } else if (res > 1 && spec) {
- snprintf(name, AST_NAME_STRLEN, "%s/%d", spec, res);
- if ((peer = local_get_channel_begin_name(name))) {
- chosen = 1;
- }
- continue;
- }
- }
- }
- }
- if ((peer = local_channel_walk(peer)) == NULL) {
- break;
- }
- }
- waitms = count ? 100 : 5000;
- }
-
-
- if (fd > 0) {
- close(fd);
- }
-
- if (oldrf && ast_set_read_format(chan, oldrf) < 0) {
- ast_log(LOG_ERROR, "Could Not Set Read Format.\n");
- }
-
- if (oldwf && ast_set_write_format(chan, oldwf) < 0) {
- ast_log(LOG_ERROR, "Could Not Set Write Format.\n");
- }
-
- ast_clear_flag(chan, AST_FLAG_SPYING);
-
- ast_channel_setoption(chan, AST_OPTION_TXGAIN, &zero_volume, sizeof(zero_volume), 0);
-
- ALL_DONE(u, res);
-}
-
-int unload_module(void)
-{
- int res;
-
- res = ast_unregister_application(app);
-
- STANDARD_HANGUP_LOCALUSERS;
-
- return res;
-}
-
-int load_module(void)
-{
- return ast_register_application(app, chanspy_exec, synopsis, desc);
-}
-
-char *description(void)
-{
- return (char *) synopsis;
-}
-
-int usecount(void)
-{
- int res;
- STANDARD_USECOUNT(res);
- return res;
-}
-
-char *key()
-{
- return ASTERISK_GPL_KEY;
-}
diff --git a/1.2-netsec/apps/app_controlplayback.c b/1.2-netsec/apps/app_controlplayback.c
deleted file mode 100644
index 55a46ceb5..000000000
--- a/1.2-netsec/apps/app_controlplayback.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Asterisk -- An open source telephony toolkit.
- *
- * Copyright (C) 1999 - 2005, Digium, Inc.
- *
- * Mark Spencer <markster@digium.com>
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE file
- * at the top of the source tree.
- */
-
-/*! \file
- * \brief Trivial application to control playback of a sound file
- *
- * \ingroup applications
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "asterisk.h"
-
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-
-#include "asterisk/lock.h"
-#include "asterisk/file.h"
-#include "asterisk/logger.h"
-#include "asterisk/channel.h"
-#include "asterisk/pbx.h"
-#include "asterisk/app.h"
-#include "asterisk/module.h"
-#include "asterisk/translate.h"
-#include "asterisk/utils.h"
-#include "asterisk/options.h"
-
-static const char *tdesc = "Control Playback Application";
-
-static const char *app = "ControlPlayback";
-
-static const char *synopsis = "Play a file with fast forward and rewind";
-
-static const char *descrip =
-" ControlPlayback(file[|skipms[|ff[|rew[|stop[|pause[|restart|options]]]]]]]):\n"
-"This application will play back the given filename. By default, the '*' key\n"
-"can be used to rewind, and the '#' key can be used to fast-forward.\n"
-"Parameters:\n"
-" skipms - This is number of milliseconds to skip when rewinding or\n"
-" fast-forwarding.\n"
-" ff - Fast-forward when this DTMF digit is received.\n"
-" rew - Rewind when this DTMF digit is received.\n"
-" stop - Stop playback when this DTMF digit is received.\n"
-" pause - Pause playback when this DTMF digit is received.\n"
-" restart - Restart playback when this DTMF digit is received.\n"
-"Options:\n"
-" j - Jump to priority n+101 if the requested file is not found.\n"
-"This application sets the following channel variable upon completion:\n"
-" CPLAYBACKSTATUS - This variable contains the status of the attempt as a text\n"
-" string, one of: SUCCESS | USERSTOPPED | ERROR\n";
-
-STANDARD_LOCAL_USER;
-
-LOCAL_USER_DECL;
-
-static int is_on_phonepad(char key)
-{
- return key == 35 || key == 42 || (key >= 48 && key <= 57);
-}
-
-static int controlplayback_exec(struct ast_channel *chan, void *data)
-{
- int res = 0, priority_jump = 0;
- int skipms = 0;
- struct localuser *u;
- char *tmp;
- int argc;
- char *argv[8];
- enum arg_ids {
- arg_file = 0,
- arg_skip = 1,
- arg_fwd = 2,
- arg_rev = 3,
- arg_stop = 4,
- arg_pause = 5,
- arg_restart = 6,
- options = 7,
- };
-
- if (ast_strlen_zero(data)) {
- ast_log(LOG_WARNING, "ControlPlayback requires an argument (filename)\n");
- return -1;
- }
-
- LOCAL_USER_ADD(u);
-
- tmp = ast_strdupa(data);
- memset(argv, 0, sizeof(argv));
-
- argc = ast_app_separate_args(tmp, '|', argv, sizeof(argv) / sizeof(argv[0]));
-
- if (argc < 1) {
- ast_log(LOG_WARNING, "ControlPlayback requires an argument (filename)\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
-
- skipms = argv[arg_skip] ? atoi(argv[arg_skip]) : 3000;
- if (!skipms)
- skipms = 3000;
-
- if (!argv[arg_fwd] || !is_on_phonepad(*argv[arg_fwd]))
- argv[arg_fwd] = "#";
- if (!argv[arg_rev] || !is_on_phonepad(*argv[arg_rev]))
- argv[arg_rev] = "*";
- if (argv[arg_stop] && !is_on_phonepad(*argv[arg_stop]))
- argv[arg_stop] = NULL;
- if (argv[arg_pause] && !is_on_phonepad(*argv[arg_pause]))
- argv[arg_pause] = NULL;
- if (argv[arg_restart] && !is_on_phonepad(*argv[arg_restart]))
- argv[arg_restart] = NULL;
-
- if (argv[options]) {
- if (strchr(argv[options], 'j'))
- priority_jump = 1;
- }
-
- res = ast_control_streamfile(chan, argv[arg_file], argv[arg_fwd], argv[arg_rev], argv[arg_stop], argv[arg_pause], argv[arg_restart], skipms);
-
- /* If we stopped on one of our stop keys, return 0 */
- if (argv[arg_stop] && strchr(argv[arg_stop], res)) {
- res = 0;
- pbx_builtin_setvar_helper(chan, "CPLAYBACKSTATUS", "USERSTOPPED");
- } else {
- if (res < 0) {
- if (priority_jump || option_priority_jumping) {
- if (ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101)) {
- ast_log(LOG_WARNING, "ControlPlayback tried to jump to priority n+101 as requested, but priority didn't exist\n");
- }
- }
- res = 0;
- pbx_builtin_setvar_helper(chan, "CPLAYBACKSTATUS", "ERROR");
- } else
- pbx_builtin_setvar_helper(chan, "CPLAYBACKSTATUS", "SUCCESS");
- }
-
- LOCAL_USER_REMOVE(u);
-
- return res;
-}
-
-int unload_module(void)
-{
- int res;
-
- res = ast_unregister_application(app);
-
- STANDARD_HANGUP_LOCALUSERS;
-
- return res;
-}
-
-int load_module(void)
-{
- return ast_register_application(app, controlplayback_exec, synopsis, descrip);
-}
-
-char *description(void)
-{
- return (char *) tdesc;
-}
-
-int usecount(void)
-{
- int res;
-
- STANDARD_USECOUNT(res);
- return res;
-}
-
-char *key()
-{
- return ASTERISK_GPL_KEY;
-}
diff --git a/1.2-netsec/apps/app_curl.c b/1.2-netsec/apps/app_curl.c
deleted file mode 100644
index 5cf4b167d..000000000
--- a/1.2-netsec/apps/app_curl.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Asterisk -- An open source telephony toolkit.
- *
- * Copyright (C) 2004 - 2005, Tilghman Lesher
- *
- * Tilghman Lesher <curl-20050919@the-tilghman.com>
- * and Brian Wilkins <bwilkins@cfl.rr.com> (Added POST option)
- *
- * app_curl.c is distributed with no restrictions on usage or
- * redistribution.
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- */
-
-/*! \file
- * \brief Curl - App to load a URL
- *
- * \ingroup applications
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <curl/curl.h>
-
-#include "asterisk.h"
-
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-
-#include "asterisk/lock.h"
-#include "asterisk/file.h"
-#include "asterisk/logger.h"
-#include "asterisk/channel.h"
-#include "asterisk/pbx.h"
-#include "asterisk/cli.h"
-#include "asterisk/options.h"
-#include "asterisk/module.h"
-
-static char *tdesc = "Load external URL";
-
-static char *app = "Curl";
-
-static char *synopsis = "Load an external URL";
-
-static char *descrip =
-" Curl(URL[|postdata]): This application will request the specified URL.\n"
-"It is mainly used for signalling external applications of an event.\n"
-"Parameters:\n"
-" URL - This is the external URL to request.\n"
-" postdata - This information will be treated as POST data.\n"
-"This application will set the following variable:\n"
-" CURL - This variable will contain the resulting page.\n"
-"This application has been deprecated in favor of the CURL function.\n";
-
-STANDARD_LOCAL_USER;
-
-LOCAL_USER_DECL;
-
-struct MemoryStruct {
- char *memory;
- size_t size;
-};
-
-static void *myrealloc(void *ptr, size_t size)
-{
- /* There might be a realloc() out there that doesn't like reallocing
- NULL pointers, so we take care of it here */
- if (ptr)
- return realloc(ptr, size);
- else
- return malloc(size);
-}
-
-static size_t WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
-{
- register int realsize = size * nmemb;
- struct MemoryStruct *mem = (struct MemoryStruct *)data;
-
- mem->memory = (char *)myrealloc(mem->memory, mem->size + realsize + 1);
- if (mem->memory) {
- memcpy(&(mem->memory[mem->size]), ptr, realsize);
- mem->size += realsize;
- mem->memory[mem->size] = 0;
- }
- return realsize;
-}
-
-static int curl_internal(struct MemoryStruct *chunk, char *url, char *post)
-{
- CURL *curl;
-
- curl_global_init(CURL_GLOBAL_ALL);
- curl = curl_easy_init();
-
- if (!curl) {
- return -1;
- }
-
- curl_easy_setopt(curl, CURLOPT_URL, url);
- curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
- curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)chunk);
- curl_easy_setopt(curl, CURLOPT_USERAGENT, "asterisk-libcurl-agent/1.0");
-
- if (post) {
- curl_easy_setopt(curl, CURLOPT_POST, 1);
- curl_easy_setopt(curl, CURLOPT_POSTFIELDS, post);
- }
-
- curl_easy_perform(curl);
- curl_easy_cleanup(curl);
- return 0;
-}
-
-static int curl_exec(struct ast_channel *chan, void *data)
-{
- int res = 0;
- struct localuser *u;
- char *info, *post_data=NULL, *url;
- struct MemoryStruct chunk = { NULL, 0 };
- static int dep_warning = 0;
-
- if (!dep_warning) {
- ast_log(LOG_WARNING, "The application Curl is deprecated. Please use the CURL() function instead.\n");
- dep_warning = 1;
- }
-
- if (ast_strlen_zero(data)) {
- ast_log(LOG_WARNING, "Curl requires an argument (URL)\n");
- return -1;
- }
-
- LOCAL_USER_ADD(u);
-
- if ((info = ast_strdupa(data))) {
- url = strsep(&info, "|");
- post_data = info;
- } else {
- ast_log(LOG_ERROR, "Out of memory\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
-
- if (! curl_internal(&chunk, url, post_data)) {
- if (chunk.memory) {
- chunk.memory[chunk.size] = '\0';
- if (chunk.memory[chunk.size - 1] == 10)
- chunk.memory[chunk.size - 1] = '\0';
-
- pbx_builtin_setvar_helper(chan, "CURL", chunk.memory);
-
- free(chunk.memory);
- }
- } else {
- ast_log(LOG_ERROR, "Cannot allocate curl structure\n");
- res = -1;
- }
-
- LOCAL_USER_REMOVE(u);
- return res;
-}
-
-static char *acf_curl_exec(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
-{
- struct localuser *u;
- char *info, *post_data=NULL, *url;
- struct MemoryStruct chunk = { NULL, 0 };
-
- *buf = '\0';
-
- if (ast_strlen_zero(data)) {
- ast_log(LOG_WARNING, "CURL requires an argument (URL)\n");
- return buf;
- }
-
- LOCAL_USER_ACF_ADD(u);
-
- info = ast_strdupa(data);
- if (!info) {
- ast_log(LOG_ERROR, "Out of memory\n");
- LOCAL_USER_REMOVE(u);
- return buf;
- }
-
- url = strsep(&info, "|");
- post_data = info;
-
- if (! curl_internal(&chunk, url, post_data)) {
- if (chunk.memory) {
- chunk.memory[chunk.size] = '\0';
- if (chunk.memory[chunk.size - 1] == 10)
- chunk.memory[chunk.size - 1] = '\0';
-
- ast_copy_string(buf, chunk.memory, len);
- free(chunk.memory);
- }
- } else {
- ast_log(LOG_ERROR, "Cannot allocate curl structure\n");
- }
-
- LOCAL_USER_REMOVE(u);
- return buf;
-}
-
-struct ast_custom_function acf_curl = {
- .name = "CURL",
- .synopsis = "Retrieves the contents of a URL",
- .syntax = "CURL(url[|post-data])",
- .desc =
- " url - URL to retrieve\n"
- " post-data - Optional data to send as a POST (GET is default action)\n",
- .read = acf_curl_exec,
-};
-
-int unload_module(void)
-{
- int res;
-
- res = ast_custom_function_unregister(&acf_curl);
- res |= ast_unregister_application(app);
-
- STANDARD_HANGUP_LOCALUSERS;
-
- return res;
-}
-
-int load_module(void)
-{
- int res;
-
- res = ast_custom_function_register(&acf_curl);
- res |= ast_register_application(app, curl_exec, synopsis, descrip);
-
- return res;
-}
-
-char *description(void)
-{
- return tdesc;
-}
-
-int usecount(void)
-{
- int res;
- STANDARD_USECOUNT(res);
- return res;
-}
-
-char *key()
-{
- return ASTERISK_GPL_KEY;
-}
diff --git a/1.2-netsec/apps/app_cut.c b/1.2-netsec/apps/app_cut.c
deleted file mode 100644
index 46f934b89..000000000
--- a/1.2-netsec/apps/app_cut.c
+++ /dev/null
@@ -1,473 +0,0 @@
-/*
- * Asterisk -- An open source telephony toolkit.
- *
- * Copyright (c) 2003 Tilghman Lesher. All rights reserved.
- *
- * Tilghman Lesher <app_cut__v003@the-tilghman.com>
- *
- * This code is released by the author with no restrictions on usage.
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- */
-
-/*! \file
- * \brief Cut application
- *
- * \ingroup applications
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#include "asterisk.h"
-
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-
-#include "asterisk/file.h"
-#include "asterisk/logger.h"
-#include "asterisk/options.h"
-#include "asterisk/channel.h"
-#include "asterisk/pbx.h"
-#include "asterisk/module.h"
-#include "asterisk/app.h"
-
-/* Maximum length of any variable */
-#define MAXRESULT 1024
-
-static char *tdesc = "Cut out information from a string";
-
-static char *app_cut = "Cut";
-
-static char *cut_synopsis = "Splits a variable's contents using the specified delimiter";
-
-static char *cut_descrip =
-" Cut(newvar=varname,delimiter,fieldspec): This applicaiton will split the\n"
-"contents of a variable based on the given delimeter and store the result in\n"
-"a new variable.\n"
-"Parameters:\n"
-" newvar - new variable created from result string\n"
-" varname - variable you want cut\n"
-" delimiter - defaults to '-'\n"
-" fieldspec - number of the field you want (1-based offset)\n"
-" may also be specified as a range (with -)\n"
-" or group of ranges and fields (with &)\n"
-"This application has been deprecated in favor of the CUT function.\n";
-
-static char *app_sort = "Sort";
-static char *app_sort_synopsis = "Sorts a list of keywords and values";
-static char *app_sort_descrip =
-" Sort(newvar=key1:val1[,key2:val2[[...],keyN:valN]]): This application will\n"
-"sort the list provided in ascending order. The result will be stored in the\n"
-"specified variable name.\n"
-" This applicaiton has been deprecated in favor of the SORT function.\n";
-
-STANDARD_LOCAL_USER;
-
-LOCAL_USER_DECL;
-
-struct sortable_keys {
- char *key;
- float value;
-};
-
-static int sort_subroutine(const void *arg1, const void *arg2)
-{
- const struct sortable_keys *one=arg1, *two=arg2;
- if (one->value < two->value) {
- return -1;
- } else if (one->value == two->value) {
- return 0;
- } else {
- return 1;
- }
-}
-
-#define ERROR_NOARG (-1)
-#define ERROR_NOMEM (-2)
-#define ERROR_USAGE (-3)
-
-static int sort_internal(struct ast_channel *chan, char *data, char *buffer, size_t buflen)
-{
- char *strings, *ptrkey, *ptrvalue;
- int count=1, count2, element_count=0;
- struct sortable_keys *sortable_keys;
-
- memset(buffer, 0, buflen);
-
- if (!data) {
- return ERROR_NOARG;
- }
-
- strings = ast_strdupa((char *)data);
- if (!strings) {
- return ERROR_NOMEM;
- }
-
- for (ptrkey = strings; *ptrkey; ptrkey++) {
- if (*ptrkey == '|') {
- count++;
- }
- }
-
- sortable_keys = alloca(count * sizeof(struct sortable_keys));
- if (!sortable_keys) {
- return ERROR_NOMEM;
- }
-
- memset(sortable_keys, 0, count * sizeof(struct sortable_keys));
-
- /* Parse each into a struct */
- count2 = 0;
- while ((ptrkey = strsep(&strings, "|"))) {
- ptrvalue = index(ptrkey, ':');
- if (!ptrvalue) {
- count--;
- continue;
- }
- *ptrvalue = '\0';
- ptrvalue++;
- sortable_keys[count2].key = ptrkey;
- sscanf(ptrvalue, "%f", &sortable_keys[count2].value);
- count2++;
- }
-
- /* Sort the structs */
- qsort(sortable_keys, count, sizeof(struct sortable_keys), sort_subroutine);
-
- for (count2 = 0; count2 < count; count2++) {
- int blen = strlen(buffer);
- if (element_count++) {
- strncat(buffer + blen, ",", buflen - blen - 1);
- blen++;
- }
- strncat(buffer + blen, sortable_keys[count2].key, buflen - blen - 1);
- }
-
- return 0;
-}
-
-static int cut_internal(struct ast_channel *chan, char *data, char *buffer, size_t buflen)
-{
- char *s, *args[3], *varname=NULL, *delimiter=NULL, *field=NULL;
- int args_okay = 0;
-
- memset(buffer, 0, buflen);
-
- /* Check and parse arguments */
- if (data) {
- s = ast_strdupa((char *)data);
- if (s) {
- ast_app_separate_args(s, '|', args, 3);
- varname = args[0];
- delimiter = args[1];
- field = args[2];
-
- if (field) {
- args_okay = 1;
- }
- } else {
- return ERROR_NOMEM;
- }
- }
-
- if (args_okay) {
- char d, ds[2];
- char *tmp = alloca(strlen(varname) + 4);
- char varvalue[MAXRESULT], *tmp2=varvalue;
-
- if (tmp) {
- snprintf(tmp, strlen(varname) + 4, "${%s}", varname);
- memset(varvalue, 0, sizeof(varvalue));
- } else {
- return ERROR_NOMEM;
- }
-
- if (delimiter[0])
- d = delimiter[0];
- else
- d = '-';
-
- /* String form of the delimiter, for use with strsep(3) */
- snprintf(ds, sizeof(ds), "%c", d);
-
- pbx_substitute_variables_helper(chan, tmp, tmp2, MAXRESULT - 1);
-
- if (tmp2) {
- int curfieldnum = 1;
- while ((tmp2 != NULL) && (field != NULL)) {
- char *nextgroup = strsep(&field, "&");
- int num1 = 0, num2 = MAXRESULT;
- char trashchar;
-
- if (sscanf(nextgroup, "%d-%d", &num1, &num2) == 2) {
- /* range with both start and end */
- } else if (sscanf(nextgroup, "-%d", &num2) == 1) {
- /* range with end */
- num1 = 0;
- } else if ((sscanf(nextgroup, "%d%c", &num1, &trashchar) == 2) && (trashchar == '-')) {
- /* range with start */
- num2 = MAXRESULT;
- } else if (sscanf(nextgroup, "%d", &num1) == 1) {
- /* single number */
- num2 = num1;
- } else {