From 3f38ba1177844c1a7947549b5208f35585d5071c Mon Sep 17 00:00:00 2001 From: Jerry Date: Wed, 9 Nov 2022 18:41:39 +0800 Subject: [PATCH] update --- extensions.conf | 35 +++++++++++++----- modules.conf | 92 +++++++++++++++++------------------------------- musiconhold.conf | 6 +--- pjsip.conf | 61 +++++++++++++++++++++++++++----- 4 files changed, 113 insertions(+), 81 deletions(-) diff --git a/extensions.conf b/extensions.conf index 52d32e8..e2c468a 100644 --- a/extensions.conf +++ b/extensions.conf @@ -9,12 +9,12 @@ exten => _X!,200,Set(CALLNUM=${EXTEN}) exten => s,1,Playback(silence/1) same => n,Set(USERINPUT=) - same => n,Read(USERINPUT,jerry-whois,10,,1,6) + same => n,Read(USERINPUT,/opt/asterisk/sounds/jerry-whois,10,,1,6) same => n,GotoIf($["${READSTATUS}" = "TIMEOUT" & "${USERINPUT}" = ""]?s,1:) same => n,GotoIf($["${USERINPUT}" = ""]?extmymenu,${CALLNUM},200:whois,1) exten => whois,1,NoOp() - same => n,TrySystem(/var/lib/asterisk/scripts/jerry/whois.py "${USERINPUT}" "${UNIQUEID}") + same => n,TrySystem(/opt/asterisk/scripts/whois.py "${USERINPUT}" "${UNIQUEID}") same => n,Playback(/var/tmp/ast-dynamic/${UNIQUEID}) same => n,GotoIf($["${PLAYBACKSTATUS}" = "SUCCESS"]?whois,whoisend:) same => n,Playback(im-sorry&something-terribly-wrong) @@ -28,7 +28,7 @@ exten => _X!,210,Set(CALLNUM=${EXTEN}) same => n,Goto(3,1) exten => s,1,Wait(1) - same => n(loop),Background(jerry-intro) + same => n(loop),Background(/opt/asterisk/sounds/jerry-intro) same => n,WaitExten(15) exten => i,1,Playback(silence/1&goodbye) @@ -58,15 +58,15 @@ exten => 3,100,NoOp() same => n,Return() exten => 4,100,NoOp() - same => n,Read(TMPNOM,0005-unreeeal_superhero_3,1,,1,0.1) + same => n,Read(TMPNOM,/opt/asterisk/sounds/0005-unreeeal_superhero_3,1,,1,0.1) same => n,Return() exten => 5,100,NoOp() - same => n,Read(TMPNOM,0006-external,1,,1,0.1) + same => n,Read(TMPNOM,/opt/asterisk/sounds/0006-external,1,,1,0.1) same => n,Return() exten => 6,100,NoOp() - same => n,Read(TMPNOM,0009-macroform-cold_day,1,,1,0.1) + same => n,Read(TMPNOM,/opt/asterisk/sounds/0009-macroform-cold_day,1,,1,0.1) same => n,Return() exten => _X,100,NoOp() @@ -77,22 +77,27 @@ exten => _X,100,NoOp() [extmyself] exten => i,1,NoOp() -exten => chanunavail,1,Playback(im-sorry&number-not-answering&please-try-call-later) +exten => chanunavail,1,Playback(silence/1&im-sorry&number-not-answering&please-try-call-later&silence/1) same => n,Hangup() -exten => invalidinput,1,Playback(im-sorry&cannot-complete-as-dialed) +exten => invalidinput,1,Playback(silence/1&im-sorry&cannot-complete-as-dialed&silence/1) same => n,Hangup() +exten => _86X!/_42403618X!,5,Dial(PJSIP/${EXTEN:2}@REDACTED,300,r) exten => 0001,5,Dial(PJSIP/REDACTED,300,m) exten => 0002,5,Dial(PJSIP/REDACTED,300,m) exten => 0003,5,Dial(PJSIP/REDACTED,300,m) exten => 0004,5,Dial(PJSIP/REDACTED,300,m) exten => 0005/_42403618X!,5,Dial(PJSIP/REDACTED,300,m) +exten => 0006/_42403618X!,5,Dial(PJSIP/REDACTED,300,m) +exten => 0007/_42403618X!,5,Dial(PJSIP/REDACTED,300,m) +exten => 0008/_42403618X!,5,Dial(PJSIP/REDACTED,300,m) +exten => 0009/424036180009,5,Goto(pstnrecv,${EXTEN},5) exten => 0000,5,Goto(extmymenu,${EXTEN},200) exten => 0 ,5,Goto(extmymenu,${EXTEN},200) exten => 3618,5,Goto(extmymenu,${EXTEN},210) exten => 4242,5,Goto(extdn42whois,${EXTEN},200) -exten => _X! ,5,Playback(im-sorry&check-number-dial-again) +exten => _X! ,5,Playback(silence/1&im-sorry&check-number-dial-again&silence/1) same => n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?chanunavail,1:) [extpeers] @@ -119,6 +124,9 @@ exten => _42403914.,5,NoOp() same => n,Dial(PJSIP/${EXTEN}@kioubit) [jerry] +exten => _X!/424036180006,1,Goto(pstnphone,${EXTEN},5) +exten => _X!/424036180007,1,Goto(pstnphone,${EXTEN},5) +exten => _X!/424036180008,1,Goto(pstnphone,${EXTEN},5) exten => _4240XXXX.,1,Goto(extpeers,${EXTEN},5) exten => _0XXXX. ,1,Goto(extpeers,424${EXTEN},5) exten => _X! ,1,Goto(extpeers,42403618${EXTEN},5) @@ -132,3 +140,12 @@ exten => _X! ,1,NoOp() exten => _4240XXXX.,2,Goto(extpeers,${EXTEN},5) exten => _0XXXX. ,2,Goto(extpeers,424${EXTEN},5) exten => _X! ,2,Goto(extpeers,42403618${EXTEN},5) + +[pstnphone] +exten => _4240X!,5,Goto(extmyself,${EXTEN},5) +exten => _X!,5,Goto(extmyself,86${EXTEN},5) + +[pstnrecv] +exten => _X!,5,Set(CALLERID(number)=REDACTED) +same => n,Dial(PJSIP/REDACTED&PJSIP/REDACTED,300,r) +same => n,Hangup() diff --git a/modules.conf b/modules.conf index 65d2ed3..2dc6a58 100644 --- a/modules.conf +++ b/modules.conf @@ -8,76 +8,50 @@ autoload=yes ; ; Any modules that need to be loaded before the Asterisk core has been -; initialized (just after the logger has been initialized) can be loaded -; using 'preload'. This will frequently be needed if you wish to map all -; module configuration files into Realtime storage, since the Realtime -; driver will need to be loaded before the modules using those configuration -; files are initialized. +; initialized (just after the logger initialization) can be loaded +; using 'preload'. 'preload' forces a module and the modules it +; is known to depend upon to be loaded earlier than they normally get +; loaded. ; -; An example of loading ODBC support would be: -;preload => res_odbc.so -;preload => res_config_odbc.so +; NOTE: There is no good reason left to use 'preload' anymore. It was +; historically required to preload realtime driver modules so you could +; map Asterisk core configuration files to Realtime storage. +; This is no longer needed. ; -; If you want, load the GTK console right away. -; Don't load the KDE console since -; it's not as sophisticated right now. +;preload = your_special_module.so ; -noload => pbx_gtkconsole.so -;load => pbx_gtkconsole.so -noload => pbx_kdeconsole.so +; If you want Asterisk to fail if a module does not load, then use +; the "require" keyword. Asterisk will exit with a status code of 2 +; if a required module does not load. ; -; Intercom application is obsoleted by -; chan_oss. Don't load it. +;require = chan_pjsip.so ; -noload => app_intercom.so +; If you want you can combine with preload +; preload-require = your_special_module.so ; -; The 'modem' channel driver and its subdrivers are -; obsolete, don't load them. +;load = res_musiconhold.so ; -noload => chan_modem.so -noload => chan_modem_aopen.so -noload => chan_modem_bestdata.so -noload => chan_modem_i4l.so +; Load one of: alsa, or console (portaudio). +; By default, load chan_console only (automatically). ; -; Comment this out (after installing CAPI middleware and hardware -; drivers) if you have CAPI-able hardware and wish to use it in -; Asterisk. +noload = chan_alsa.so +;noload = chan_console.so ; -noload => chan_capi.so +; Do not load res_hep and kin unless you are using HEP monitoring +; in your network. ; -load => res_musiconhold.so +noload = res_hep.so +noload = res_hep_pjsip.so +noload = res_hep_rtcp.so ; -; Do not load load local channel drivers (using the system speaker) by default, -; they are not used in most installations and might block the sound hardware +; Do not load chan_sip by default, it may conflict with res_pjsip. +noload = chan_sip.so ; -noload => chan_alsa.so -noload => chan_console.so -noload => chan_oss.so +; Load one of the voicemail modules as they are mutually exclusive. +; By default, load app_voicemail only (automatically). ; -; Disable CDR logging to SQLite by default since it writes unconditionally to -; cdr.db without a way to rotate it. -; -noload => cdr_sqlite.so -; -; These conflict with app_directory.so and each other. -noload => app_directory_odbc.so -; -; Enable these if you want to configure Asterisk in a database -; -noload => res_config_odbc.so -noload => res_config_pgsql.so +;noload = app_voicemail.so +noload = app_voicemail_imap.so +noload = app_voicemail_odbc.so -noload => chan_sip.so -;preload => codec_opus.so -;preload => format_ogg_opus.so -;preload => res_sorcery_config.so -;preload => res_format_attr_opus.so -;preload => codec_gsm.so -;preload => format_gsm.so -;preload => format_wav_gsm.so -;preload => codec_resample.so -; -; Module names listed in "global" section will have symbols globally -; exported to modules loaded after them. -; -[global] +require = chan_pjsip.so diff --git a/musiconhold.conf b/musiconhold.conf index 3baa2fc..ee443b0 100644 --- a/musiconhold.conf +++ b/musiconhold.conf @@ -1,7 +1,3 @@ [default] mode=files -directory=moh - -;[custom] -;mode=files -;directory=/var/lib/asterisk/moh +directory=/opt/asterisk/moh diff --git a/pjsip.conf b/pjsip.conf index 2703833..e754c3d 100644 --- a/pjsip.conf +++ b/pjsip.conf @@ -18,15 +18,20 @@ bind=[::]:5060 type=endpoint context=jerry ;message_context=jerry-msg -allow=!all,opusloss,speex,ulaw,alaw -;direct_media=no -rtp_symmetric=no +allow=!all,opusloss,ulaw,alaw,speex +direct_media=no ; proxy all calls +rtp_ipv6=yes +rtp_symmetric=yes +tone_zone=cn +rtp_timeout=60 +rtp_timeout_hold=120 +rpid_immediate=yes force_rport=yes rewrite_contact=yes [peers-endpoint-template](!,endpoint-template) context=jerry-peers -allow=!all,speex,ulaw,alaw,opusloss +allow=!all,ulaw,alaw,opusloss [auth-template](!) type=auth @@ -88,6 +93,46 @@ username=REDACTED password=REDACTED [REDACTED](aor-template) +[REDACTED](endpoint-template) +auth = REDACTED +aors = REDACTED +callerid=Jerry <424036180006> +[REDACTED](auth-template) +auth_type=userpass +username=REDACTED +password=REDACTED +[REDACTED](aor-template) + +[REDACTED](endpoint-template) +auth = REDACTED +aors = REDACTED +callerid=Jerry <424036180007> +[REDACTED](auth-template) +auth_type=userpass +username=REDACTED +password=REDACTED +[REDACTED](aor-template) + +[REDACTED](endpoint-template) +auth = REDACTED +aors = REDACTED +callerid=Jerry <424036180008> +[REDACTED](auth-template) +auth_type=userpass +username=REDACTED +password=REDACTED +[REDACTED](aor-template) + +[REDACTED](endpoint-template) +auth = REDACTED +aors = REDACTED +callerid=Jerry <424036180009> +[REDACTED](auth-template) +auth_type=userpass +username=REDACTED +password=REDACTED +[REDACTED](aor-template) + ;=============EXTERN============== ;=============PEERS============== @@ -116,11 +161,11 @@ match=172.22.167.72 aors = sunnet identify_by=ip [sunnet](aor-template) -contact=sip:10.127.11.130:5060 +contact=sip:172.21.100.138:5060 [sunnet] type=identify endpoint=sunnet -match=10.127.11.130 +match=172.21.100.138 [hertz](peers-endpoint-template) aors = hertz @@ -137,11 +182,11 @@ aors = jrb0001 identify_by=ip allow=!all,opusloss,speex,ulaw,alaw [jrb0001](aor-template) -contact=sip:[fd42:5d71:219:1003:216:3eff:fe9d:882f]:5060 +contact=sip:[fd42:5d71:219:1008:216:3eff:fe9d:882f]:5060 [jrb0001] type=identify endpoint=jrb0001 -match=fd42:5d71:219:1003:216:3eff:fe9d:882f +match=fd42:5d71:219:1008:216:3eff:fe9d:882f [kioubit](peers-endpoint-template) aors = kioubit